PRooFPS-dd Dev Doc 1.0
PRooFPS-dd Developer Documentation
Loading...
Searching...
No Matches
proofps_dd::Maps Class Reference

Detailed Description

Definition at line 27 of file Maps.h.

#include <Maps.h>

+ Inheritance diagram for proofps_dd::Maps:

Public Member Functions

CConsole & getConsole () const
 
 Maps (pge_audio::PgeAudio &audio, PGEcfgProfiles &cfgProfiles, PR00FsUltimateRenderingEngine &gfx)
 
 ~Maps ()
 
 Maps (const Maps &)=delete
 
Mapsoperator= (const Maps &)=delete
 
 Maps (Maps &&)=delete
 
Maps && operator= (Maps &&)=delete
 
bool initialize ()
 Initializes the map handler.
 
bool isInitialized () const
 
void shutdown ()
 Shuts down the map handler.
 
const std::string & serverDecideFirstMapAndUpdateNextMapToBeLoaded ()
 
const std::string & getNextMapToBeLoaded () const
 
bool loaded () const
 
bool load (const char *fname, std::function< void(int)> &cbDisplayProgressUpdate)
 
void unload ()
 
unsigned int width () const
 
unsigned int height () const
 
void updateVisibilitiesForRenderer ()
 
const std::string & getFilename () const
 Retrieves the currently loaded map filename.
 
const std::set< PureVector > & getSpawnpoints () const
 Retrieves the set of spawnpoints of the currently loaded map.
 
const PureVector & getRandomSpawnpoint () const
 Retrieves a randomly selected spawnpoint from the set of spawnpoints of the currently loaded map.
 
const PureVector & getLeftMostSpawnpoint () const
 
const PureVector & getRightMostSpawnpoint () const
 
const PureVector & getBlockPosMin () const
 
const PureVector & getBlockPosMax () const
 
const PureVector & getBlocksVertexPosMin () const
 
const PureVector & getBlocksVertexPosMax () const
 
PureObject3D ** getBlocks ()
 
PureObject3D ** getForegroundBlocks ()
 
int getBlockCount () const
 
int getForegroundBlockCount () const
 
const std::map< MapItem::MapItemId, MapItem * > & getItems () const
 
const std::vector< PureObject3D * > & getJumppads () const
 
const std::map< std::string, PGEcfgVariable > & getVars () const
 
size_t getJumppadValidVarsCount ()
 
const TPURE_XY & getJumppadForceFactors (const size_t &index) const
 
void update (const float &fps)
 
bool handleMapItemUpdateFromServer (pge_network::PgeNetworkConnectionHandle, const MsgMapItemUpdateFromServer &msg)
 
MapcyclegetMapcycle ()
 

Static Public Member Functions

static const char * getLoggerModuleName ()
 

Static Public Attributes

static constexpr char * szCVarSvMap = "sv_map"
 
static constexpr float fMapBlockSizeWidth = 1.0f
 
static constexpr float fMapBlockSizeHeight = 1.0f
 
static constexpr float fMapBlockSizeDepth = 1.0f
 

Private Member Functions

void lineHandleAssignment (std::string &sVar, std::string &sValue)
 
bool lineHandleLayout (const std::string &sLine, TPureFloat &y, bool bDryRun)
 This function to be invoked for every single line of the map layout definition.
 

Static Private Member Functions

static bool lineShouldBeIgnored (const std::string &sLine)
 
static bool lineIsValueAssignment (const std::string &sLine, std::string &sVar, std::string &sValue, bool &bParseError)
 

Private Attributes

const std::set< char > foregroundBlocks
 
const std::set< char > backgroundBlocks
 
pge_audio::PgeAudio & m_audio
 
PGEcfgProfiles & m_cfgProfiles
 
PR00FsUltimateRenderingEngine & m_gfx
 
PureTexture * m_texRed
 
PureTexture * m_texDecorJumpPadVertical
 
std::string m_sServerMapFilenameToLoad
 We set this as soon as we get to know which map we should load.
 
std::map< char, PureObject3D * > m_mapReferenceBlockObject3Ds
 
PureObject3D ** m_blocks
 
int m_blocks_h
 
PureObject3D ** m_foregroundBlocks
 
int m_foregroundBlocks_h
 
std::map< std::string, PGEcfgVariable > m_vars
 
std::string m_sRawName
 
std::string m_sFileName
 
std::map< char, std::string > m_Block2Texture
 
std::set< PureVector > m_spawnpoints
 
PureVector m_blocksVertexPosMin
 
PureVector m_blocksVertexPosMax
 
PureVector m_blockPosMin
 
PureVector m_blockPosMax
 
PureVector m_spawnpointLeftMost
 
PureVector m_spawnpointRightMost
 
unsigned int m_width
 
unsigned int m_height
 
std::map< MapItem::MapItemId, MapItem * > m_items
 
std::vector< PureObject3D * > m_decorations
 
std::vector< PureObject3D * > m_jumppads
 
size_t m_nValidJumppadVarsCount
 
std::vector< TPURE_XY > m_fJumppadForceFactors
 
Mapcycle m_mapcycle
 

Static Private Attributes

static constexpr float GAME_PLAYERS_POS_Z = -1.2f
 
static constexpr float GAME_ITEMS_POS_Z = GAME_PLAYERS_POS_Z + 0.1f
 
static constexpr float GAME_DECOR_POS_Z = fMapBlockSizeDepth / -2.f - 0.1f
 

Constructor & Destructor Documentation

◆ Maps() [1/3]

proofps_dd::Maps::Maps ( pge_audio::PgeAudio & audio,
PGEcfgProfiles & cfgProfiles,
PR00FsUltimateRenderingEngine & gfx )

Definition at line 21 of file Maps.cpp.

◆ ~Maps()

proofps_dd::Maps::~Maps ( )

Definition at line 41 of file Maps.cpp.

◆ Maps() [2/3]

proofps_dd::Maps::Maps ( const Maps & )
delete

◆ Maps() [3/3]

proofps_dd::Maps::Maps ( Maps && )
delete

Member Function Documentation

◆ getBlockCount()

int proofps_dd::Maps::getBlockCount ( ) const

Definition at line 547 of file Maps.cpp.

◆ getBlockPosMax()

const PureVector & proofps_dd::Maps::getBlockPosMax ( ) const

Definition at line 522 of file Maps.cpp.

◆ getBlockPosMin()

const PureVector & proofps_dd::Maps::getBlockPosMin ( ) const

Definition at line 517 of file Maps.cpp.

◆ getBlocks()

PureObject3D ** proofps_dd::Maps::getBlocks ( )

Definition at line 537 of file Maps.cpp.

◆ getBlocksVertexPosMax()

const PureVector & proofps_dd::Maps::getBlocksVertexPosMax ( ) const

Definition at line 532 of file Maps.cpp.

◆ getBlocksVertexPosMin()

const PureVector & proofps_dd::Maps::getBlocksVertexPosMin ( ) const

Definition at line 527 of file Maps.cpp.

◆ getConsole()

CConsole & proofps_dd::Maps::getConsole ( ) const

Definition at line 46 of file Maps.cpp.

◆ getFilename()

const std::string & proofps_dd::Maps::getFilename ( ) const

Retrieves the currently loaded map filename.

Returns
Filename of the currently loaded map. Empty string if no map is loaded currently.

Definition at line 459 of file Maps.cpp.

◆ getForegroundBlockCount()

int proofps_dd::Maps::getForegroundBlockCount ( ) const

Definition at line 552 of file Maps.cpp.

◆ getForegroundBlocks()

PureObject3D ** proofps_dd::Maps::getForegroundBlocks ( )

Definition at line 542 of file Maps.cpp.

◆ getItems()

const std::map< proofps_dd::MapItem::MapItemId, proofps_dd::MapItem * > & proofps_dd::Maps::getItems ( ) const

Definition at line 557 of file Maps.cpp.

◆ getJumppadForceFactors()

const TPURE_XY & proofps_dd::Maps::getJumppadForceFactors ( const size_t & index) const

Definition at line 677 of file Maps.cpp.

◆ getJumppads()

const std::vector< PureObject3D * > & proofps_dd::Maps::getJumppads ( ) const

Definition at line 689 of file Maps.cpp.

◆ getJumppadValidVarsCount()

size_t proofps_dd::Maps::getJumppadValidVarsCount ( )

Definition at line 567 of file Maps.cpp.

◆ getLeftMostSpawnpoint()

const PureVector & proofps_dd::Maps::getLeftMostSpawnpoint ( ) const

Definition at line 497 of file Maps.cpp.

◆ getLoggerModuleName()

const char * proofps_dd::Maps::getLoggerModuleName ( )
static

Definition at line 51 of file Maps.cpp.

◆ getMapcycle()

proofps_dd::Mapcycle & proofps_dd::Maps::getMapcycle ( )

Definition at line 777 of file Maps.cpp.

◆ getNextMapToBeLoaded()

const std::string & proofps_dd::Maps::getNextMapToBeLoaded ( ) const

Definition at line 160 of file Maps.cpp.

◆ getRandomSpawnpoint()

const PureVector & proofps_dd::Maps::getRandomSpawnpoint ( ) const

Retrieves a randomly selected spawnpoint from the set of spawnpoints of the currently loaded map.

A spawnpoint is a 3D coordinate where the player can spawn at.

Returns
A randomly selected spawnpoint on the current map.

Definition at line 483 of file Maps.cpp.

◆ getRightMostSpawnpoint()

const PureVector & proofps_dd::Maps::getRightMostSpawnpoint ( ) const

Definition at line 507 of file Maps.cpp.

◆ getSpawnpoints()

const std::set< PureVector > & proofps_dd::Maps::getSpawnpoints ( ) const

Retrieves the set of spawnpoints of the currently loaded map.

A spawnpoint is a 3D coordinate where the player can spawn at.

Returns
The set of spawnpoints of the currently loaded map.

Definition at line 471 of file Maps.cpp.

◆ getVars()

const std::map< std::string, PGEcfgVariable > & proofps_dd::Maps::getVars ( ) const

Definition at line 562 of file Maps.cpp.

◆ handleMapItemUpdateFromServer()

bool proofps_dd::Maps::handleMapItemUpdateFromServer ( pge_network::PgeNetworkConnectionHandle ,
const MsgMapItemUpdateFromServer & msg )

Definition at line 752 of file Maps.cpp.

◆ height()

unsigned int proofps_dd::Maps::height ( ) const

Definition at line 421 of file Maps.cpp.

◆ initialize()

bool proofps_dd::Maps::initialize ( )

Initializes the map handler.

Reads the mapcycle file if it exists. You need to invoke this once before trying to load any map.

Returns
True on success, false otherwise.

Definition at line 63 of file Maps.cpp.

◆ isInitialized()

bool proofps_dd::Maps::isInitialized ( ) const

Definition at line 87 of file Maps.cpp.

◆ lineHandleAssignment()

void proofps_dd::Maps::lineHandleAssignment ( std::string & sVar,
std::string & sValue )
private

Definition at line 861 of file Maps.cpp.

◆ lineHandleLayout()

bool proofps_dd::Maps::lineHandleLayout ( const std::string & sLine,
TPureFloat & y,
bool bDryRun )
private

This function to be invoked for every single line of the map layout definition.

Map layout definition is the last part of a map file, containing the blocks building up the map (walls, floor, etc.).

Parameters
sLineThe current line of the map layout definition we want to process.
yThe current height we are currently placing newly created blocks for this line of the map definition layout.
bDryRunIf true, blocks are not allocated thus the map is not actually created, however the following variables are actually updated: m_width, m_height, m_blocks_h, m_foregroundBlocks_h, m_items, y. If we finish processing all lines with bDryRun as true, we will know the actual size of the map and number of blocks, thus in the next non-dry run we will have to allocate memory only once for the blocks. And yes, dry run actually creates all the items in m_items.

Definition at line 887 of file Maps.cpp.

◆ lineIsValueAssignment()

bool proofps_dd::Maps::lineIsValueAssignment ( const std::string & sLine,
std::string & sVar,
std::string & sValue,
bool & bParseError )
staticprivate

Definition at line 794 of file Maps.cpp.

◆ lineShouldBeIgnored()

bool proofps_dd::Maps::lineShouldBeIgnored ( const std::string & sLine)
staticprivate

Definition at line 789 of file Maps.cpp.

◆ load()

bool proofps_dd::Maps::load ( const char * fname,
std::function< void(int)> & cbDisplayProgressUpdate )

Definition at line 170 of file Maps.cpp.

◆ loaded()

bool proofps_dd::Maps::loaded ( ) const

Definition at line 165 of file Maps.cpp.

◆ operator=() [1/2]

Maps & proofps_dd::Maps::operator= ( const Maps & )
delete

◆ operator=() [2/2]

Maps && proofps_dd::Maps::operator= ( Maps && )
delete

◆ serverDecideFirstMapAndUpdateNextMapToBeLoaded()

const std::string & proofps_dd::Maps::serverDecideFirstMapAndUpdateNextMapToBeLoaded ( )

Definition at line 122 of file Maps.cpp.

◆ shutdown()

void proofps_dd::Maps::shutdown ( )

Shuts down the map handler.

The currently loaded map will be also unloaded. After calling this, initialize() can be invoked again.

Definition at line 97 of file Maps.cpp.

◆ unload()

void proofps_dd::Maps::unload ( )

Definition at line 361 of file Maps.cpp.

◆ update()

void proofps_dd::Maps::update ( const float & fps)

Definition at line 694 of file Maps.cpp.

◆ updateVisibilitiesForRenderer()

void proofps_dd::Maps::updateVisibilitiesForRenderer ( )

Definition at line 426 of file Maps.cpp.

◆ width()

unsigned int proofps_dd::Maps::width ( ) const

Definition at line 416 of file Maps.cpp.

Member Data Documentation

◆ backgroundBlocks

const std::set<char> proofps_dd::Maps::backgroundBlocks
private
Initial value:
= {
'a', 'c', 'e', 'm', 'n', 'p', 'o', 'r', 'u', 'v', 'w', 'x', 'y', 'z',
',' ,
'+' ,
'2' ,
'3' ,
'4' ,
'S'
}

Definition at line 115 of file Maps.h.

◆ fMapBlockSizeDepth

float proofps_dd::Maps::fMapBlockSizeDepth = 1.0f
staticconstexpr

Definition at line 35 of file Maps.h.

◆ fMapBlockSizeHeight

float proofps_dd::Maps::fMapBlockSizeHeight = 1.0f
staticconstexpr

Definition at line 34 of file Maps.h.

◆ fMapBlockSizeWidth

float proofps_dd::Maps::fMapBlockSizeWidth = 1.0f
staticconstexpr

Definition at line 33 of file Maps.h.

◆ foregroundBlocks

const std::set<char> proofps_dd::Maps::foregroundBlocks
private
Initial value:
= {
'B', 'D', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'Q', 'T',
'^' ,
'\\' ,
'/'
}

Definition at line 107 of file Maps.h.

◆ GAME_DECOR_POS_Z

float proofps_dd::Maps::GAME_DECOR_POS_Z = fMapBlockSizeDepth / -2.f - 0.1f
staticconstexprprivate

Definition at line 105 of file Maps.h.

◆ GAME_ITEMS_POS_Z

float proofps_dd::Maps::GAME_ITEMS_POS_Z = GAME_PLAYERS_POS_Z + 0.1f
staticconstexprprivate

Definition at line 104 of file Maps.h.

◆ GAME_PLAYERS_POS_Z

float proofps_dd::Maps::GAME_PLAYERS_POS_Z = -1.2f
staticconstexprprivate

Definition at line 103 of file Maps.h.

◆ m_audio

pge_audio::PgeAudio& proofps_dd::Maps::m_audio
private

Definition at line 126 of file Maps.h.

◆ m_Block2Texture

std::map<char, std::string> proofps_dd::Maps::m_Block2Texture
private

Definition at line 146 of file Maps.h.

◆ m_blockPosMax

PureVector proofps_dd::Maps::m_blockPosMax
private

Definition at line 149 of file Maps.h.

◆ m_blockPosMin

PureVector proofps_dd::Maps::m_blockPosMin
private

Definition at line 149 of file Maps.h.

◆ m_blocks

PureObject3D** proofps_dd::Maps::m_blocks
private

Definition at line 137 of file Maps.h.

◆ m_blocks_h

int proofps_dd::Maps::m_blocks_h
private

Definition at line 138 of file Maps.h.

◆ m_blocksVertexPosMax

PureVector proofps_dd::Maps::m_blocksVertexPosMax
private

Definition at line 148 of file Maps.h.

◆ m_blocksVertexPosMin

PureVector proofps_dd::Maps::m_blocksVertexPosMin
private

Definition at line 148 of file Maps.h.

◆ m_cfgProfiles

PGEcfgProfiles& proofps_dd::Maps::m_cfgProfiles
private

Definition at line 127 of file Maps.h.

◆ m_decorations

std::vector<PureObject3D*> proofps_dd::Maps::m_decorations
private

Definition at line 153 of file Maps.h.

◆ m_fJumppadForceFactors

std::vector<TPURE_XY> proofps_dd::Maps::m_fJumppadForceFactors
private

Definition at line 156 of file Maps.h.

◆ m_foregroundBlocks

PureObject3D** proofps_dd::Maps::m_foregroundBlocks
private

Definition at line 140 of file Maps.h.

◆ m_foregroundBlocks_h

int proofps_dd::Maps::m_foregroundBlocks_h
private

Definition at line 141 of file Maps.h.

◆ m_gfx

PR00FsUltimateRenderingEngine& proofps_dd::Maps::m_gfx
private

Definition at line 128 of file Maps.h.

◆ m_height

unsigned int proofps_dd::Maps::m_height
private

Definition at line 151 of file Maps.h.

◆ m_items

std::map<MapItem::MapItemId, MapItem*> proofps_dd::Maps::m_items
private

Definition at line 152 of file Maps.h.

◆ m_jumppads

std::vector<PureObject3D*> proofps_dd::Maps::m_jumppads
private

Definition at line 154 of file Maps.h.

◆ m_mapcycle

Mapcycle proofps_dd::Maps::m_mapcycle
private

Definition at line 159 of file Maps.h.

◆ m_mapReferenceBlockObject3Ds

std::map<char, PureObject3D*> proofps_dd::Maps::m_mapReferenceBlockObject3Ds
private

Definition at line 135 of file Maps.h.

◆ m_nValidJumppadVarsCount

size_t proofps_dd::Maps::m_nValidJumppadVarsCount
private

Definition at line 155 of file Maps.h.

◆ m_sFileName

std::string proofps_dd::Maps::m_sFileName
private

Definition at line 145 of file Maps.h.

◆ m_spawnpointLeftMost

PureVector proofps_dd::Maps::m_spawnpointLeftMost
private

Definition at line 150 of file Maps.h.

◆ m_spawnpointRightMost

PureVector proofps_dd::Maps::m_spawnpointRightMost
private

Definition at line 150 of file Maps.h.

◆ m_spawnpoints

std::set<PureVector> proofps_dd::Maps::m_spawnpoints
private

Definition at line 147 of file Maps.h.

◆ m_sRawName

std::string proofps_dd::Maps::m_sRawName
private

Definition at line 144 of file Maps.h.

◆ m_sServerMapFilenameToLoad

std::string proofps_dd::Maps::m_sServerMapFilenameToLoad
private

We set this as soon as we get to know which map we should load.

Definition at line 131 of file Maps.h.

◆ m_texDecorJumpPadVertical

PureTexture* proofps_dd::Maps::m_texDecorJumpPadVertical
private

Definition at line 130 of file Maps.h.

◆ m_texRed

PureTexture* proofps_dd::Maps::m_texRed
private

Definition at line 129 of file Maps.h.

◆ m_vars

std::map<std::string, PGEcfgVariable> proofps_dd::Maps::m_vars
private

Definition at line 143 of file Maps.h.

◆ m_width

unsigned int proofps_dd::Maps::m_width
private

Definition at line 151 of file Maps.h.

◆ szCVarSvMap

char* proofps_dd::Maps::szCVarSvMap = "sv_map"
staticconstexpr

Definition at line 31 of file Maps.h.


The documentation for this class was generated from the following files: