kWorld
class relating to the level itself, and its occupants
stored in global var World
Map Structure
A map's floor plan is made up of areas. Each area is triangulated into sectors. You can get an actor's area and sector with kActor::AreaID()
and kActor::SectorIndex()
, respectively, or the sector at an arbitrary point with kActor::GetSectorIndexAtLocation()
.
You can enable a debug sector visualization with showcollision, and a readout containing the player's current sector with statplayloop.
Methods
kActor@ GetActorByTID( int tagID, int type = -1 )
get the first actor with a given tag ID and type (if specified)
bool TriggerActorsByTID( kActor@ a, int tagID )
uint GetAreaFlags( int areaID )
bit field of area flags:
- AAF_WATER – water area
- AAF_BLOCK – block entry
-
AAF_TOGGLE
–
allows
AAF_BLOCK
sectors to be mapped normally - AAF_CLIFF – slopes too steep to walk on (clearing via script does nothing)
- AAF_CLIMB – climbable surfaces
- AAF_ONESIDED – area can be walked under ("bridge" flag in the editor; clearing via script does nothing)
- AAF_CEILING – area has a ceiling
- AAF_CRAWL – cause the player to crawl in this area
-
AAF_ENTERCRAWL
–
small areas outside
AAF_CRAWL
entrances that also cause the player to crawl - AAF_HIDDEN – don't show on the map
- AAF_ENTERED – [no effect] (used internally by editor for flood fill operations; cleared on save)
- 1 << 11 – secret area
- AAF_RESTRICTED – AI will not enter the area
- AAF_SLOPETEST – set/clear AAF_CLIFF dynamically based on how steep the sector is
- AAF_DEATHPIT – fallling death
- AAF_MAPPED
- AAF_EVENT – trigger some kind of event when entered, like enemies appearing, or a door opening
- AAF_REPEATABLE – [unused]
- AAF_TELEPORT – teleport when stepped on
- AAF_DAMAGE – floor deals damag
- AAF_DRAWSKY – render cloud layers
-
AAF_TELEPORTAIR
–
teleport when entered at all, not just stepped on (paired with
AAF_TELEPORT
) -
AAF_LAVA
–
floor slows player down when combined with
AAF_DAMAGE
-
AAF_EVENTSOUND
–
play a sound when entered by the player (paired with
AAF_EVENT
) -
AAF_ANTIGRAVITY
–
antigravity shafts in level 8 (paired with
AAF_WATER
) -
AAF_LADDER
–
allows player to climb
AAF_CLIMB
sectors a bit faster - AAF_CHECKPOINT – level checkpoint
- AAF_SAVEGAME – save totem
- AAF_WARPRETURN – [unused]
-
AAF_SHALLOWWATER
–
prevent player from entering swimming state in
AAF_WATER
sectors also allows enemies that can't swim to enterAAF_WATER
sectors - AAF_DRAWSUN – render the sun (and light scatter, if enabled)
- 1 << 31 – Store Warp Return [unused]
void FloodMatchingAreaFlags( int sector, uint flags, bool bSet )
void FloodFillAreaFlags( kVec3& loc, uint flags, bool bSet )
set or clear the given flags in an area based on a sector or point inside it
void ChangeSectorHeight( int sector, float height )
change the physical floor height of the area sector
is part of, but not the visual floor height
void ChangeAreaWaterHeight( int areaID, float height )
change physical water height of an area, but not visual water height
int16 GetAreaArg( int areaID, int arg )
void ChangeAreaArg( int areaID, int arg, int16 value )
generic space for various area properties
typical arg
usage:
- warp ID
- warp level ID or event sound ID
- checkpoint ID
- tag ID
- floor damage hit points
- floor damage rate