Amulets & Armor  v1.02
Open Source Game
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Macros | Functions
MAP

Map Interface. More...

Macros

#define TICKS_PER_DAY   0x7FFFFL
 

Functions

T_word32 FreeMemory (T_void)
 
E_Boolean MapCheckCrushByCeiling (T_word16 sector, T_sword16 newHeight)
 
E_Boolean MapCheckCrushByFloor (T_word16 sector, T_sword16 newHeight)
 
E_Boolean MapExist (T_word32 num)
 
T_void MapFinish (T_void)
 
T_void MapForceOpenForwardWall (T_3dObject *p_obj)
 
T_sword16 MapGetCeilingHeight (T_word16 sector)
 
T_byte8MapGetCeilingTextureName (T_word16 sectorNum)
 
T_word32 MapGetDayOffset (T_void)
 
T_sword16 MapGetFloorHeight (T_word16 sector)
 
T_byte8MapGetFloorTextureName (T_word16 sectorNum)
 
T_word16 MapGetForwardWallActivation (T_3dObject *p_obj)
 
T_void MapGetForwardWallActivationType (T_3dObject *p_obj, E_wallActivation *p_type, T_word16 *p_data)
 
T_byte8MapGetLowerTextureName (T_word16 sideNum)
 
T_byte8MapGetMainTextureName (T_word16 sideNum)
 
T_word32 MapGetMapSpecial (T_void)
 
T_void MapGetNextMapAndPlace (T_word16 sector, T_word16 *p_nextMap, T_word16 *p_nextMapPlace)
 
T_byte8 MapGetOutsideLighting (T_void)
 
T_word16 MapGetSectorAction (T_word16 sector)
 
T_byte8 MapGetSectorLighting (T_word16 sector)
 
T_sectorType MapGetSectorType (T_word16 sectorNum)
 
T_void MapGetStartLocation (T_word16 num, T_sword16 *p_x, T_sword16 *p_y, T_word16 *p_angle)
 
T_word16 MapGetTextureXOffset (T_word16 sideNum)
 
T_word16 MapGetTextureYOffset (T_word16 sideNum)
 
T_byte8MapGetUpperTextureName (T_word16 sideNum)
 
T_sword16 MapGetWalkingFloorHeight (T_word16 sector)
 
T_sword16 MapGetWalkingFloorHeightAtXY (T_sword16 x, T_sword16 y)
 
E_Boolean MapGetWallDamage (T_3dObject *p_obj, T_word16 *p_damageAmount, T_byte8 *p_damageType)
 
T_void MapInitialize (T_void)
 
E_Boolean MapIsDay (T_void)
 
T_void MapLoad (T_word32 mapNumber)
 
T_void MapOpenForwardWall (T_3dObject *p_obj, E_Boolean checkForItemRequired)
 
T_void MapOutputTimeOfDay (T_void)
 
T_void MapSave (T_word32 mapNumber)
 
T_void MapSetBackdrop (T_byte8 *p_backdrop)
 
T_void MapSetCeilingHeight (T_word16 sector, T_sword16 height)
 
T_void MapSetCeilingTextureForSector (T_word16 sectorNum, T_byte8 *p_textureName)
 
T_void MapSetDayOffset (T_word32 offset)
 
T_void MapSetFloorHeight (T_word16 sector, T_sword16 height)
 
T_void MapSetFloorTextureForSector (T_word16 sectorNum, T_byte8 *p_textureName)
 
T_void MapSetLowerTextureForSide (T_word16 sideNum, T_byte8 *p_textureName)
 
T_void MapSetMainTextureForSide (T_word16 sideNum, T_byte8 *p_textureName)
 
T_void MapSetOutsideLighting (T_byte8 outsideLight)
 
T_void MapSetSectorLighting (T_word16 sector, T_byte8 lightLevel)
 
T_void MapSetSectorState (T_word16 sectorNum, T_word16 sectorState)
 
T_void MapSetSideState (T_word16 sideNum, T_word16 sideState)
 
T_void MapSetUpperTextureForSide (T_word16 sideNum, T_byte8 *p_textureName)
 
T_void MapSetWallBitmapTextureXY (T_word16 wallNum, T_word16 side, T_sword16 offX, T_sword16 offY)
 
T_void MapSetWallState (T_word16 wallNum, T_word16 wallState)
 
T_void MapSetWallTexture (T_word16 sideNum, T_byte8 *p_textureName)
 
T_void MapUnload (T_void)
 
T_void MapUpdateLighting (T_void)
 

Detailed Description

Map Interface.

All map handling routines come here. Need to know about a sector's floor and ceiling heights. This is the place. This code differs from the 3D_IO code because it handles all the extra code needed for the game for lighting, walls sliding, textures on walls, backdrops, and traveling. Perhaps it is best to think of it as the "Map State"

See Also
http://www.amuletsandarmor.com/AALicense.txt

Macro Definition Documentation

#define TICKS_PER_DAY   0x7FFFFL

MapUpdateLighting updates all lighting effects for the map.

Function Documentation

T_word32 FreeMemory ( T_void  )
E_Boolean MapCheckCrushByCeiling ( T_word16  sector,
T_sword16  newHeight 
)

MapCheckCrush sees if lowering the ceiling of the given sector to the new height will cause a character to be crushed.

Parameters
sector– Sector to consider
newHeight– New ceiling height to consider
Returns
TRUE = object or player is going to be crushed, or FALSE for ok.
E_Boolean MapCheckCrushByFloor ( T_word16  sector,
T_sword16  newHeight 
)

MapCheckCrushByFloor if raising the floor of a given sector to the new height will cause a character to be crushed.

Parameters
sector– Sector to consider
newHeight– New floor height to consider
Returns
TRUE = object or player is going to be crushed, or FALSE for ok.
E_Boolean MapExist ( T_word32  num)

MapExist tells if a map exists.

Returns
TRUE=Map does exist
T_void MapFinish ( T_void  )

MapFinish is called to finish up any data or code needed by the Map Module.

T_void MapForceOpenForwardWall ( T_3dObject p_obj)

MapForceOpenForwardWall always opens the forward wall. If the door is locked and/or requires an item, the door is unlocked and gets rid of the item.

Parameters
p_obj– Object doing the open
T_sword16 MapGetCeilingHeight ( T_word16  sector)

MapGetCeilingHeight gets the given sector's ceiling height.

Parameters
sector– Sector's ceiling to change.
T_byte8* MapGetCeilingTextureName ( T_word16  sectorNum)

MapGetCeilingTextureName returens the name of the ceiling texture in a given sector.

Parameters
sectorNum– Number of sector
Returns
Pointer to 8 characters for name
T_word32 MapGetDayOffset ( T_void  )
T_sword16 MapGetFloorHeight ( T_word16  sector)

MapGetFloorHeight returns the height of the given sector.

Parameters
sector– Sector's floor to get.
T_byte8* MapGetFloorTextureName ( T_word16  sectorNum)

MapGetFloorTextureName returns the name of the floor texture name in a given sector.

Parameters
sectorNum– Number of sector
Returns
Pointer to 8 characters for name
T_word16 MapGetForwardWallActivation ( T_3dObject p_obj)

The following routines are not needed for the server-only build. MapGetForwardWallActivation is used to get the activation number of the wall in front of the current POV.

NOTE: The current 3d engine does not allow for wall activation.

Returns
Activation number
T_void MapGetForwardWallActivationType ( T_3dObject p_obj,
E_wallActivation p_type,
T_word16 p_data 
)

MapGetForwardWallActivationType returns the type of action that will occur (including specific data) if the forward wall is activated.

Parameters
p_obj– Thing opening door
p_type– Type of wall activation
p_data– Reutrn wall activation value
Returns
TRUE if can open, else false
T_byte8* MapGetLowerTextureName ( T_word16  sideNum)

MapGetLowerTextureName returns the name of the lower texture name on a given side of a wall.

Parameters
sideNum– Number of side
Returns
Pointer to 8 characters for name
T_byte8* MapGetMainTextureName ( T_word16  sideNum)

MapGetMainTextureName returns the name of the main texture name on a given side of a wall.

Parameters
sideNum– Number of side
Returns
Pointer to 8 characters for name
T_word32 MapGetMapSpecial ( T_void  )
T_void MapGetNextMapAndPlace ( T_word16  sector,
T_word16 p_nextMap,
T_word16 p_nextMapPlace 
)

MapGetNextMapAndPlace returns the map link for the given sector.

Parameters
sector– Sector to get map link
p_nextMap– Place to store next map number
p_nextMapPlace– Place to store next place number
T_byte8 MapGetOutsideLighting ( T_void  )

MapGetOutsideLighting returns how much light is outside.

Returns
Light level of outside
T_word16 MapGetSectorAction ( T_word16  sector)

SERVER_ONLY MapGetSectorAction returns the corresponding activity number for the given sector.

Parameters
sector– Sector to get activity of
Returns
Activation number for sector
T_byte8 MapGetSectorLighting ( T_word16  sector)

MapGetSectorLighting gets a sector have a different light level.

Parameters
sector– Number of sector
T_sectorType MapGetSectorType ( T_word16  sectorNum)
T_void MapGetStartLocation ( T_word16  num,
T_sword16 p_x,
T_sword16 p_y,
T_word16 p_angle 
)

MapGetStartLocation uses the given number to return by indirection the location of the map's starting point.

Parameters
num– Number of starting point
p_x– X starting location
p_y– Y starting location
p_angle– Angle of starting location
T_word16 MapGetTextureXOffset ( T_word16  sideNum)

MapGetTextureXOffset returns the x offset of a texture on a wall side.

Parameters
sideNum– Number of wall side
Returns
Texture shift in X direction
T_word16 MapGetTextureYOffset ( T_word16  sideNum)

MapGetTextureYOffset returns the y offset of a texture on a wall side.

Parameters
sideNum– Number of wall side
Returns
Shift in texture along y direction
T_byte8* MapGetUpperTextureName ( T_word16  sideNum)

MapGetUpperTextureName returns the name of the upper texture name on a given side of a wall.

Parameters
sideNum– Number of side
Returns
Pointer to 8 characters for name
T_sword16 MapGetWalkingFloorHeight ( T_word16  sector)

MapGetWalkingFloorHeight returns height of the floor if a thing is walking on it. For water areas, this can be lower than the actual floor height.

Parameters
sector– Sector's floor to get.
T_sword16 MapGetWalkingFloorHeightAtXY ( T_sword16  x,
T_sword16  y 
)

MapGetWalkingFloorHeightAtXY returns the height of the floor given a map coordinate.

Parameters
x– X Position on map.
y– Y Position on map.
Returns
Height there, or -32767
E_Boolean MapGetWallDamage ( T_3dObject p_obj,
T_word16 p_damageAmount,
T_byte8 p_damageType 
)

MapGetWallDamage is called to determine if an object is being damaged by a wall animation.

Parameters
p_obj– Object to check
p_damageAmount– Amount of damage
p_damageType– Type of damage to be done
Returns
TRUE=found damaging wall
T_void MapInitialize ( T_void  )

MapInitialize is called to start up any data or code needed by the Map Module.

E_Boolean MapIsDay ( T_void  )
T_void MapLoad ( T_word32  mapNumber)

MapLoad reads in the given file and uses it as the map for the current game. This only controls the map and the objects within. Player position or other related information is not defined.

Parameters
mapNumber– Number of the map to load

Change the tune.

T_void MapOpenForwardWall ( T_3dObject p_obj,
E_Boolean  checkForItemRequired 
)

MapOpenForwardWall tries to open a door attached to the forward wall.

T_void MapOutputTimeOfDay ( T_void  )
T_void MapSave ( T_word32  mapNumber)

MapSave writes the given file and all the information out to the current map number.

NOTE: Current 3d engine doesn't allow easy saving of the map. (Not that it's impossible or anything – just not yet).

Parameters
mapNumber– Number of the map to save

Does nothing yet. !!!!

T_void MapSetBackdrop ( T_byte8 p_backdrop)

MapSetBackdrop requires a pointer to a 320x100 (or bigger) picture and copies it into the backdrop to be used by the computer. (Actually, you pass in a 320x200 picture where the top 100 lines is half of the image and the next 100 lines are the right half of the image).

Parameters
p_backdrop– Pointer to backdrop
T_void MapSetCeilingHeight ( T_word16  sector,
T_sword16  height 
)

MapSetCeilingHeight makes the given sector's floor height go to the given height (instantly).

Parameters
sector– Sector's ceiling to change.
height– New height for ceiling.
T_void MapSetCeilingTextureForSector ( T_word16  sectorNum,
T_byte8 p_textureName 
)

MapSetCeilingTextureForSector declares the texture to be used on the given sector ceiling.

Parameters
sectorNum– Sector to affect.
p_textureName– Name of texture to use.
T_void MapSetDayOffset ( T_word32  offset)
T_void MapSetFloorHeight ( T_word16  sector,
T_sword16  height 
)

MapSetFloorHeight makes the given sector's floor height go to the given height (instantly).

Parameters
sector– Sector's floor to change.
height– New height for floor.
T_void MapSetFloorTextureForSector ( T_word16  sectorNum,
T_byte8 p_textureName 
)

MapSetFloorTextureForSector declares the texture to be used on the given sector floor.

Parameters
sectorNum– Sector to affect.
p_textureName– Name of texture to use.
T_void MapSetLowerTextureForSide ( T_word16  sideNum,
T_byte8 p_textureName 
)

MapSetLowerTextureForSide changes the texture used on the lower part of walls.

Parameters
sideNum– Side definition to affect.
p_textureName– Name of texture to use.
T_void MapSetMainTextureForSide ( T_word16  sideNum,
T_byte8 p_textureName 
)

MapSetMainTexture changes the texture used on the middle part of walls.

Parameters
sideNum– Side definition to affect.
p_textureName– Name of texture to use.
T_void MapSetOutsideLighting ( T_byte8  outsideLight)

MapSetOutsideLighting declares how much light is outside the world.

Parameters
outsideLight– Light level of outside
T_void MapSetSectorLighting ( T_word16  sector,
T_byte8  lightLevel 
)

MapSetSectorLighting makes a sector have a different light level.

Parameters
sector– Number of sector
lightLevel– new lighting level
T_void MapSetSectorState ( T_word16  sectorNum,
T_word16  sectorState 
)
T_void MapSetSideState ( T_word16  sideNum,
T_word16  sideState 
)
T_void MapSetUpperTextureForSide ( T_word16  sideNum,
T_byte8 p_textureName 
)

MapSetUpperTextureForSide changes the texture used on the lower part of walls.

Parameters
sideNum– Side definition to affect.
p_textureName– Name of texture to use.
T_void MapSetWallBitmapTextureXY ( T_word16  wallNum,
T_word16  side,
T_sword16  offX,
T_sword16  offY 
)

MapSetWallBitmapTextureXY changes the x and y offset of a wall's texture. Just pass in what wall, side, and the new x & y offset.

Parameters
wallNum– Number of wall to change.
side– Side of the wall (0 or 1)
offX– Offset in X (left to right) direction.
offY– Offset in Y (top to bottom) direction.
T_void MapSetWallState ( T_word16  wallNum,
T_word16  wallState 
)
T_void MapSetWallTexture ( T_word16  sideNum,
T_byte8 p_textureName 
)

MapSetWallTexture tries to be the all-in-wall way to change wall textures. If called on a wall, it will only change one part of the wall based on what exists based on the following priority - Main, Lower, & Upper.

Parameters
sideNum– Side definition to affect.
p_textureName– Name of texture to use.
T_void MapUnload ( T_void  )

When the current map is no longer needed, call this routine to remove it. All information and pictures concerning that map is removed from memory.

T_void MapUpdateLighting ( T_void  )