OpenEnroth 73e68f7
Loading...
Searching...
No Matches
Functions | Variables
Indoor.cpp File Reference
#include "Engine/Graphics/Indoor.h"
#include <algorithm>
#include <limits>
#include <ranges>
#include <string>
#include "Engine/Engine.h"
#include "Engine/EngineGlobals.h"
#include "Engine/AssetsManager.h"
#include "Engine/Events/Processor.h"
#include "Engine/Graphics/BspRenderer.h"
#include "Engine/Graphics/Collisions.h"
#include "Engine/Graphics/DecalBuilder.h"
#include "Engine/Objects/DecorationList.h"
#include "Engine/Objects/Decoration.h"
#include "Engine/Graphics/LightmapBuilder.h"
#include "Engine/Graphics/LightsStack.h"
#include "Engine/Graphics/Outdoor.h"
#include "Engine/Graphics/ParticleEngine.h"
#include "Engine/Graphics/TextureFrameTable.h"
#include "Engine/Graphics/Sprites.h"
#include "Engine/Graphics/PortalFunctions.h"
#include "Engine/Graphics/Viewport.h"
#include "Engine/Graphics/Image.h"
#include "Engine/Graphics/Renderer/Renderer.h"
#include "Engine/Random/Random.h"
#include "Engine/Objects/Actor.h"
#include "Engine/Objects/ObjectList.h"
#include "Engine/Objects/SpriteObject.h"
#include "Engine/Tables/ItemTable.h"
#include "Engine/OurMath.h"
#include "Engine/Party.h"
#include "Engine/Snapshots/CompositeSnapshots.h"
#include "Engine/SpellFxRenderer.h"
#include "Engine/Time/Timer.h"
#include "Engine/TurnEngine/TurnEngine.h"
#include "Engine/Localization.h"
#include "Engine/MapInfo.h"
#include "Engine/LOD.h"
#include "GUI/GUIProgressBar.h"
#include "GUI/GUIWindow.h"
#include "GUI/UI/UIStatusBar.h"
#include "Media/Audio/AudioPlayer.h"
#include "Library/Logger/Logger.h"
#include "Library/LodFormats/LodFormats.h"
#include "Utility/String/Ascii.h"
#include "Utility/Math/TrigLut.h"
#include "Utility/Exception.h"

Functions

void PrepareDrawLists_BLV ()
 
void BLV_InitialiseDoors ()
 
void BLV_UpdateDoors ()
 
void BLV_UpdateDoorGeometry (BLVDoor *door, int distance)
 
void switchDoorAnimation (unsigned int uDoorID, DoorAction action)
 
void UpdateActors_BLV ()
 
void loadAndPrepareBLV (MapId mapid, bool bLoading)
 
float BLV_GetFloorLevel (const Vec3f &pos, int uSectorID, int *pFaceID)
 
bool Check_LineOfSight (const Vec3f &target, const Vec3f &from)
 
bool Check_LOS_Obscurred_Indoors (const Vec3f &target, const Vec3f &from)
 
bool Check_LOS_Obscurred_Outdoors_Bmodels (const Vec3f &target, const Vec3f &from)
 
char DoInteractionWithTopmostZObject (Pid pid)
 
void BLV_UpdateUserInputAndOther ()
 
void BLV_ProcessPartyActions ()
 
int CalcDistPointToLine (int x1, int y1, int x2, int y2, int x3, int y3)
 
int SpawnEncounterMonsters (MapInfo *map_info, int enc_index)
 
int DropTreasureAt (ItemTreasureLevel trs_level, RandomItemType trs_type, Vec3f pos, uint16_t facing)
 
void SpawnRandomTreasure (MapInfo *mapInfo, SpawnPoint *a2)
 
void FindBillboardsLightLevels_BLV ()
 
float GetIndoorFloorZ (const Vec3f &pos, int *pSectorID, int *pFaceID)
 
float GetApproximateIndoorFloorZ (const Vec3f &pos, int *pSectorID, int *pFaceID)
 

Variables

IndoorLocationpIndoor = nullptr
 
BLVRenderParamspBLVRenderParams = new BLVRenderParams
 
static constexpr IndexedArray< SoundId, MAP_FIRST, MAP_LASTpDoorSoundIDsByLocationID
 

Function Documentation

◆ BLV_GetFloorLevel()

float BLV_GetFloorLevel ( const Vec3f pos,
int  uSectorID,
int *  pFaceID = nullptr 
)
Parameters
posActor's position.
uSectorIDActor's sector id.
[out]pFaceIDId of the closest floor/ceiling face for the provided position, or -1 if wrong sector is supplied or actor is out of bounds. Pass nullptr to ignore.
Returns
Float Z coordinate of the floor/ceiling face for the given position. If wrong sector is supplied or actor is out of bounds, -30000 is returned.

◆ BLV_InitialiseDoors()

void BLV_InitialiseDoors ( )

Initialises all door geometry into starting position on load.

◆ BLV_ProcessPartyActions()

void BLV_ProcessPartyActions ( )

◆ BLV_UpdateDoorGeometry()

void BLV_UpdateDoorGeometry ( BLVDoor door,
int  distance 
)

Updates the geomtry position of the supplied door.

Parameters
doorPointer to door to update.
distanceDistance the door is displaced. 0 is open, door->uMoveLength when closed.

◆ BLV_UpdateDoors()

void BLV_UpdateDoors ( )

Updates all door geometry into current position and plays sounds if moving.

Original binary offset:
0x46F228

◆ BLV_UpdateUserInputAndOther()

void BLV_UpdateUserInputAndOther ( )

◆ CalcDistPointToLine()

int CalcDistPointToLine ( int  x1,
int  y1,
int  x2,
int  y2,
int  x3,
int  y3 
)

◆ Check_LineOfSight()

bool Check_LineOfSight ( const Vec3f target,
const Vec3f from 
)
Parameters
targetVec3f of position to check line of sight to
fromVec3f of position to check line of sight from
Returns
True if line of sight clear to target

◆ Check_LOS_Obscurred_Indoors()

bool Check_LOS_Obscurred_Indoors ( const Vec3f target,
const Vec3f from 
)
Parameters
targetVec3f of position to check line of sight to
fromVec3f of position to check line of sight from
Returns
True if line of sight obscurred by level geometery

◆ Check_LOS_Obscurred_Outdoors_Bmodels()

bool Check_LOS_Obscurred_Outdoors_Bmodels ( const Vec3f target,
const Vec3f from 
)
Parameters
targetVec3f of position to check line of sight to
fromVec3f of position to check line of sight from
Returns
True if line of sight obscurred by outdoor models

◆ DoInteractionWithTopmostZObject()

char DoInteractionWithTopmostZObject ( Pid  pid)

◆ DropTreasureAt()

int DropTreasureAt ( ItemTreasureLevel  trs_level,
RandomItemType  trs_type,
Vec3f  pos,
uint16_t  facing 
)

◆ FindBillboardsLightLevels_BLV()

void FindBillboardsLightLevels_BLV ( )

◆ GetApproximateIndoorFloorZ()

float GetApproximateIndoorFloorZ ( const Vec3f pos,
int *  pSectorID,
int *  pFaceID = nullptr 
)
Original binary offset:
0x0047272C.

Same as GetIndoorFloorZ, but also tries jiggling the party around a bit if the collision point couldn't be found.

See also
GetIndoorFloorZ

◆ GetIndoorFloorZ()

float GetIndoorFloorZ ( const Vec3f pos,
int *  pSectorID,
int *  pFaceID = nullptr 
)
Todo:
looks like this also works for ceilings, reflect in docs?
Parameters
posActor's position.
[in,out]pSectorIDActor's cached sector id. If the cached sector id is no longer valid (e.g. an actor has already moved to another sector), then the new sector id is returned in this output parameter. If the actor moves out of level bounds (this happens), then this parameter is set to 0.
[out]pFaceIDId of the floor face on which the actor is standing, or -1 if actor is outside the level boundaries. Pass nullptr to ignore.
Returns
Z coordinate for the floor at (X, Y), or -30000 if actor is outside the level boundaries.

◆ loadAndPrepareBLV()

void loadAndPrepareBLV ( MapId  mapid,
bool  bLoading 
)
Original binary offset:
0x460A78

◆ PrepareDrawLists_BLV()

void PrepareDrawLists_BLV ( )

◆ SpawnEncounterMonsters()

int SpawnEncounterMonsters ( MapInfo map_info,
int  enc_index 
)

◆ SpawnRandomTreasure()

void SpawnRandomTreasure ( MapInfo mapInfo,
SpawnPoint a2 
)

◆ switchDoorAnimation()

void switchDoorAnimation ( unsigned int  uDoorID,
DoorAction  a2 
)
Original binary offset:
0x449A49

◆ UpdateActors_BLV()

void UpdateActors_BLV ( )

Variable Documentation

◆ pBLVRenderParams

BLVRenderParams* pBLVRenderParams = new BLVRenderParams

◆ pDoorSoundIDsByLocationID

constexpr IndexedArray<SoundId, MAP_FIRST, MAP_LAST> pDoorSoundIDsByLocationID
staticconstexpr

◆ pIndoor

IndoorLocation* pIndoor = nullptr