![]() |
PRooFPS-dd Dev Doc 1.0
PRooFPS-dd Developer Documentation
|
#include <Maps.h>
Inheritance diagram for proofps_dd::Maps:Classes | |
| struct | BlockTexture |
Public Member Functions | |
| CConsole & | getConsole () const |
| Maps (pge_audio::PgeAudio &audio, PGEcfgProfiles &cfgProfiles, PR00FsUltimateRenderingEngine &gfx) | |
| ~Maps () | |
| Maps (const Maps &)=delete | |
| Maps & | operator= (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::vector< PureVector > & | getSpawnpoints () const |
| Retrieves the set of spawnpoints of the currently loaded map. | |
| const std::set< size_t > & | getTeamSpawnpoints (const unsigned int &iTeamId) const |
| Retrieves the spawn group of the currently loaded map, for the specified team. | |
| bool | areTeamSpawnpointsDefined () const |
| bool | canUseTeamSpawnpoints (const bool &bTeamGame, const unsigned int &iTeamId) const |
| Tells if all conditions meet for selecting a team spawnpoint from a spawn group: | |
| const PureVector & | getRandomSpawnpoint (const bool &bTeamGame, const unsigned int &iTeamId=0) 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 PureBoundingVolumeHierarchy & | getBVH () const |
| const std::map< MapItem::MapItemId, MapItem * > & | getItems () const |
| const std::vector< PureObject3D * > & | getDecals () 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, const PureObject3D &objCurrentPlayer) |
| bool | handleMapItemUpdateFromServer (pge_network::PgeNetworkConnectionHandle, const MsgMapItemUpdateFromServer &msg) |
| Mapcycle & | getMapcycle () |
Static Public Member Functions | |
| static const char * | getLoggerModuleName () |
Static Public Attributes | |
| static constexpr char * | szCVarSvMap = "sv_map" |
| static constexpr char * | szCVarSvMapTeamSpawnGroups = "sv_map_team_spawn_groups" |
| static constexpr char * | szCVarSvMapCollisionMode = "sv_map_collision_mode" |
| static constexpr char * | szCVarSvMapCollisionBvhDebugRender = "sv_map_collision_bvh_debug_render" |
| static constexpr char * | szCVarSvMapCollisionBvhMaxDepth = "sv_map_collision_bvh_max_depth" |
| static constexpr float | fMapBlockSizeWidth = 1.0f |
| static constexpr float | fMapBlockSizeHeight = 1.0f |
| static constexpr float | fMapBlockSizeDepth = 1.0f |
| static constexpr size_t | nStairstepsCount = 4 |
| static constexpr float | fStairstepHeight = fMapBlockSizeHeight / static_cast<float>(nStairstepsCount) |
| static constexpr float | GAME_PLAYERS_POS_Z = -1.2f |
Private Member Functions | |
| bool | lineHandleDecalAssignment (const std::string &sValue) |
| bool | lineHandleAssignment (const std::string &sVar, const std::string &sValue) |
| bool | createSingleSmallStairStep (const bool &bDryRun, const float &fStairstepPosX, const float &fStairstepPosY, const float &fStairstepSizeX, const float &fStairstepSizeY, PureTexture *pTexture, const bool &bDescending, const float &fU0, const float &fV0, const float &fU1, const float &fV1) |
| Creates a stairstep. | |
| bool | createSmallStairStepsForSingleBigStairsBlock (const bool &bDryRun, const size_t &iLinePos, const size_t &nLineLength, const bool &bCopyPreviousFgBlock, const int &iObjectFgToBeCopied, const bool &bCopyPreviousBgBlock, const int &iObjectBgToBeCopied, const float &fBlockPosX, const float &fBlockPosY) |
| Invoked when a stairs block character is encountered. | |
| bool | lineHandleLayout (const std::string &sLine, TPureFloat &y, bool bDryRun) |
| This function to be invoked for every single line of the map layout definition. | |
| bool | parseTeamSpawnpointsFromString (const std::string &sVarValue, std::set< size_t > &targetSet) |
| bool | parseTeamSpawnpoints () |
| bool | checkAndUpdateSpawnpoints () |
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 |
| PureBoundingVolumeHierarchyRoot | m_bvh |
| std::map< std::string, PGEcfgVariable > | m_vars |
| std::string | m_sRawName |
| Raw map name, basically filename without extension. | |
| std::string | m_sFileName |
| std::map< char, BlockTexture > | m_Block2Texture |
| std::vector< PureVector > | m_spawnpoints |
| std::set< size_t > | m_spawngroup_1 |
| std::set< size_t > | m_spawngroup_2 |
| 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_decals |
| 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_ITEMS_POS_Z = GAME_PLAYERS_POS_Z + 0.1f |
| static constexpr float | GAME_DECAL_POS_Z = fMapBlockSizeDepth / -2.f |
| static constexpr float | GAME_DECOR_POS_Z = fMapBlockSizeDepth / -2.f - 0.1f |
| proofps_dd::Maps::Maps | ( | pge_audio::PgeAudio & | audio, |
| PGEcfgProfiles & | cfgProfiles, | ||
| PR00FsUltimateRenderingEngine & | gfx ) |
|
delete |
|
delete |
| bool proofps_dd::Maps::areTeamSpawnpointsDefined | ( | ) | const |
| bool proofps_dd::Maps::canUseTeamSpawnpoints | ( | const bool & | bTeamGame, |
| const unsigned int & | iTeamId ) const |
Tells if all conditions meet for selecting a team spawnpoint from a spawn group:
| bTeamGame | True if current GameMode is team-based game, false otherwise. |
| iTeamId | The team ID if we want to find a spawn point from a spawn group for the specified team. |
|
private |
|
private |
Creates a stairstep.
The given texture UV-coordinates are for the front and back faces only, the other faces will have different UV-coordinates so that the texture will look properly aligned on all surfaces.
| bDryRun | Caller must pass its own such variable. To be on the same page, this function shall never run in dry run! |
| fStairstepPosX | World-space position X where to place this new stairstep. |
| fStairstepPosY | World-space position Y where to place this new stairstep. |
| fStairstepSizeX | Horizontal size of this new stairstep. |
| fStairstepSizeY | Vertical size of this new stairstep. |
| pTexture | Texture to be set. Expected to be nullptr for ascending stairsteps since the next regular foreground block will decide that. |
| bDescending | True if we are creating stairstep as part of a descending stairs block, false if for ascending. |
| fU0 | Texture U coordinate of the 2 LEFT-side vertices of the front and back faces of the stairstep box. |
| fU1 | Texture U coordinate of the 2 RIGHT-side vertices of the front and back faces of the stairstep box. |
| fV0 | Texture V coordinate of the 2 BOTTOM vertices of the front and back faces of the stairstep box. |
| fV1 | Texture V coordinate of the 2 TOP vertices of the front and back faces of the stairstep box. |
|
private |
Invoked when a stairs block character is encountered.
| bDryRun | Caller must pass their same variable. Need to have same logic based on this variable as caller has. |
| iLinePos | The current horizontal position index in the current line. |
| bCopyPreviousFgBlock | True if we are handling a descending stairs block i.e. the previous block's texture needs to be copied. False if we are handling an ascending stairs block. |
| iObjectFgToBeCopied | Index of the foreground block of which texture needs to be copied. Valid only if bCopyPreviousFgBlock is true i.e. when handling a descending stairs block. |
| bCopyPreviousBgBlock | True if we can use iObjectBgToBeCopied to make a copy of another background block behind this new stairs block. False if we don't create such background block behind this new stairs block. |
| iObjectBgToBeCopied | Index of the background block of we are going to copy. Valid only if bCopyPreviousBgBlock is true. |
| fBlockPosX | The horizontal world-position of the stairs block we are handling now. |
| fBlockPosY | The vertical world-position of the stairs block we are handling now. |
| const PureVector & proofps_dd::Maps::getBlockPosMax | ( | ) | const |
| const PureVector & proofps_dd::Maps::getBlockPosMin | ( | ) | const |
| const PureVector & proofps_dd::Maps::getBlocksVertexPosMax | ( | ) | const |
| const PureVector & proofps_dd::Maps::getBlocksVertexPosMin | ( | ) | const |
| const PureBoundingVolumeHierarchy & proofps_dd::Maps::getBVH | ( | ) | const |
| const std::vector< PureObject3D * > & proofps_dd::Maps::getDecals | ( | ) | const |
| const std::string & proofps_dd::Maps::getFilename | ( | ) | const |
| const std::map< proofps_dd::MapItem::MapItemId, proofps_dd::MapItem * > & proofps_dd::Maps::getItems | ( | ) | const |
| const TPURE_XY & proofps_dd::Maps::getJumppadForceFactors | ( | const size_t & | index | ) | const |
| const std::vector< PureObject3D * > & proofps_dd::Maps::getJumppads | ( | ) | const |
| const PureVector & proofps_dd::Maps::getLeftMostSpawnpoint | ( | ) | const |
|
static |
| proofps_dd::Mapcycle & proofps_dd::Maps::getMapcycle | ( | ) |
| const std::string & proofps_dd::Maps::getNextMapToBeLoaded | ( | ) | const |
| const PureVector & proofps_dd::Maps::getRandomSpawnpoint | ( | const bool & | bTeamGame, |
| const unsigned int & | iTeamId = 0 ) 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.
This function can be used also if we want to get a randomly selected spawnpoint from a spawn group. In that case bTeamGame and iTeamId arguments need to be properly set. If the current map does not define spawn groups, or the server setting "Team Spawn Groups" is disabled, then these 2 arguments are ignored but still a randomly selected spawnpoint is returned.
| bTeamGame | True if current GameMode is team-based game, false otherwise. |
| iTeamId | The team ID if we want to find a spawn point from a spawn group for the specified team. Considered only if bTeamGame is true. Must be 1 or 2 to actually utilize spawn groups. If 0, bTeamGame is considered as false. |
| const PureVector & proofps_dd::Maps::getRightMostSpawnpoint | ( | ) | const |
| const std::vector< PureVector > & proofps_dd::Maps::getSpawnpoints | ( | ) | const |
| const std::set< size_t > & proofps_dd::Maps::getTeamSpawnpoints | ( | const unsigned int & | iTeamId | ) | const |
| const std::map< std::string, PGEcfgVariable > & proofps_dd::Maps::getVars | ( | ) | const |
| bool proofps_dd::Maps::handleMapItemUpdateFromServer | ( | pge_network::PgeNetworkConnectionHandle | , |
| const MsgMapItemUpdateFromServer & | msg ) |
| bool proofps_dd::Maps::initialize | ( | ) |
|
private |
|
private |
|
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.).
| sLine | The current line of the map layout definition we want to process. |
| y | The current height we are currently placing newly created blocks for this line of the map definition layout. |
| bDryRun | If 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. |
|
staticprivate |
|
staticprivate |
| bool proofps_dd::Maps::load | ( | const char * | fname, |
| std::function< void(int)> & | cbDisplayProgressUpdate ) |
|
private |
| const std::string & proofps_dd::Maps::serverDecideFirstMapAndUpdateNextMapToBeLoaded | ( | ) |
| 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.
| void proofps_dd::Maps::update | ( | const float & | fps, |
| const PureObject3D & | objCurrentPlayer ) |
|
private |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
private |
|
staticconstexpr |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexpr |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |