User:Monster Iestyn/Source Code Documentation/p_mobj.h

From SRB2 Wiki
Jump to navigation Jump to search
This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki by finishing this article.
Online link GitHub entry
File type C header file
#include guard __P_MOBJ__

Includes

Typedefs

Name Type Description
mobjflag_t enum Primary Object flags
mobjflag2_t enum Secondary Object flags
dirtype_t enum Movement directions
mobjeflag_t enum Extra Object flags
precipflag_t enum Precipitation flags
mobj_t
struct mobj_s
struct The structure of a map Object
precipmobj_t
struct precipmobj_s
struct The structure of a precipitation map Object
actioncache_t
struct actioncache_s
struct The structure of a cached action

Enumerations

mobjflag_t

mobjflag2_t

dirtype_t

Value Name Description
-1 DI_NODIR No direction
0 DI_EAST East
1 DI_NORTHEAST North-east
2 DI_NORTH North
3 DI_NORTHWEST North-west
4 DI_WEST West
5 DI_SOUTHWEST South-west
6 DI_SOUTH South
7 DI_SOUTHEAST South-east
8 NUMDIRS Number of directions

mobjeflag_t

precipflag_t

Value Name Description
1 PCF_INVISIBLE Don't draw.
2 PCF_PIT Above a death pit.
4 PCF_FOF Above an FOF.
8 PCF_MOVINGFOF Above a moving FOF.
16 PCF_RAIN Is rain.
32 PCF_THUNK Ran the thinker this tic.

Structs

mobj_t

Data name Data type Description
thinker thinker_t Mobj's thinker
x
y
z
fixed_t Mobj's current x, y and z co-ordinates in the map, respectively
*snext struct mobj_s Pointer to next mobj in sector list
**sprev struct mobj_s Pointer to previous mobj's pointer in sector list
angle angle_t Mobj's current angle
sprite spritenum_t Mobj's current sprite number. See List of sprites
frame UINT32 Mobj's current sprite frame number. See Sprite#Frame List
anim_duration UINT16 If the frame flag FF_ANIMATE is set, this is the duration in tics between each frame in the state's animation.
*touching_sectorlist struct msecnode_s a linked list of sectors where this object appears
*subsector struct subsector_s Subsector the mobj resides in
floorz fixed_t Nearest floor below
ceilingz fixed_t Nearest ceiling above
radius fixed_t Mobj's radius; set to info->radius when spawned
height fixed_t Mobj's height; set to info->height when spawned
momx
momy
momz
fixed_t Mobj's current x, y and z momentum, respectively
pmomz fixed_t Mobj's "platform" z momentum
tics INT32 State tic counter, changes state when this reaches 0
*state state_t Mobj's current state. See List of states
flags UINT32 Primary Object flags
flags2 UINT32 Secondary Object flags
eflags UINT16 Extra Object flags
*skin void Player skin, used to override the "PLAY" sprite prefix with a new prefix when non-NULL; also used by End Level Signs and Extra Life Monitors to change the sprite used depending on the character being played
color UINT8 Mobj's current skin color
*bnext struct mobj_s Pointer to next mobj in the blockmap
**bprev struct mobj_s Pointer to previous mobj's pointer in the blockmap
*hnext struct mobj_s Pointer to next mobj in a NiGHTS Hoop
*hprev struct mobj_s Pointer to previous mobj in a NiGHTS Hoop
type mobjtype_t Mobj's Object number. See List of Objects
*info const mobjinfo_t Refers to Object's SOC properties (e.g. info->seestate = SeeState)
health INT32 Mobj's health; set to info->spawnhealth when spawned
movedir angle_t Mobj's movement direction (see #dirtype_t) (also used for various other purposes)
movecount INT32 Mobj's movement counter – when 0, select a new direction (also used for various other purposes)
*target struct mobj_s Mobj's target object
reactiontime INT32 Mobj's reaction time counter – if >0, object will not attack yet; set to info->reactiontime when spawned (also used for various other purposes)
threshold INT32 Mobj's threshold value – if >0, target will be chased no matter what (also used for various other purposes)
*player struct player_s Player properties; only valid if Object type is MT_PLAYER
lastlook INT32 Player number last looked for; set to -1 when first spawned
*spawnpoint mapthing_t Mobj's Map Thing properties
*tracer struct mobj_s Mobj's tracer object
friction fixed_t Mobj's friction value; normally set to ORIG_FRICTION (59392) (also used for various other purposes)
movefactor fixed_t Mobj's movement factor; normally set to ORIG_FRICTION_FACTOR (2048) (also used for various other purposes)
fuse INT32 Mobj's fuse counter; when 0, this usually kills the Object
watertop fixed_t Top of the water FOF the Object is in
waterbottom fixed_t Bottom of the water FOF the Object is in
mobjnum UINT32 A unique number for the Object. Used for restoring pointers on save games
scale fixed_t Mobj's scale – changes to match destscale if the two don't match; normally set to FRACUNIT
destscale fixed_t Mobj's destination scale; normally set to FRACUNIT
scalespeed fixed_t Mobj's scaling speed – the speed to gradually increase/decrease the scale by; normally set to FRACUNIT/12
extravalue1 INT32 An extra variable that is used for miscellaneous purposes.
extravalue2 INT32 An extra variable that is used for miscellaneous purposes. A_Repeat uses this to set the repeat count.
cusval INT32 The Object's "custom value". This was ported from the v2.0 modification SRB2Morphed.
cusmem INT32 This is intended as a "memory" for the Object's "custom value", allowing you to store a copy of the custom value and then recall it later, after the actual custom value may have changed. This was ported from the v2.0 modification SRB2Morphed.
standingslope struct pslope_s This member is declared only if ESLOPE is defined

The slope that the Object is standing on.

precipmobj_t

Data name Data type Description
thinker thinker_t Mobj's thinker
x
y
z
fixed_t Mobj's current x, y and z co-ordinates in the map, respectively
*snext struct precipmobj_s Pointer to next mobj in sector list
**sprev struct precipmobj_s Pointer to previous mobj's pointer in sector list
angle angle_t Mobj's current angle
sprite spritenum_t Mobj's current sprite number. See List of sprites
frame UINT32 Mobj's current sprite frame number. See Sprite#Frame List
anim_duration UINT16 If the frame flag FF_ANIMATE is set, this is the duration in tics between each frame in the state's animation.
*touching_sectorlist struct mprecipsecnode_s a linked list of sectors where this object appears
*subsector struct subsector_s Subsector the mobj resides in
floorz fixed_t Nearest floor below
ceilingz fixed_t Nearest ceiling above
radius fixed_t Mobj's radius; set to info->radius when spawned
height fixed_t Mobj's height; set to info->height when spawned
momx
momy
momz
fixed_t Mobj's current x, y and z momentum, respectively
precipflags fixed_t Precipitation flags; this is fixed_t so it takes the same place as "pmomz" if the Object is cast to a mobj_t.
tics INT32 State tic counter, changes state when this reaches 0
*state state_t Mobj's current state. See List of states
flags INT32 Primary Object flags

actioncache_t

Data name Data type Description
*next struct actioncache_s
*prev struct actioncache_s
*mobj struct mobj_s
statenum INT32

Macros

Macro Defined as Description
MAXHUNTEMERALDS 64

Externs

Data name Data type Non-extern location(s) Description
actioncachehead actioncache_t p_mobj.c The head of the cached action linked list.
*huntemeralds[MAXHUNTEMERALDS] mapthing_t p_mobj.c An array storing all Emerald Hunt Location Things (Object type MT_EMERHUNT) found in the current map.
numhuntemeralds INT32 p_mobj.c The number of Emerald Hunt Location Things found in the current map. This number should not exceed MAXHUNTEMERALDS.
runemeraldmanager boolean g_game.c If true, the manager function for Match/CTF Chaos Emerald spawning (P_EmeraldManager) will be run each tic for the current map. This should only be toggled on if the gametype is Match or CTF, and Match Chaos Emerald Spawn Things (Object type MT_EMERALDSPAWN) are found in the current map.
numstarposts INT32 p_setup.c The number of unique Star Post IDs in the current map. (Not to be confused with the number of actual Star Post Objects)

Function prototypes

Function name Return type Params Defined in Description
P_InitCachedActions void None p_mobj.c
P_RunCachedActions void None p_mobj.c
P_AddCachedAction void mobj_t *mobj,
INT32 statenum
p_mobj.c
P_MobjCheckWater void mobj_t *mobj p_mobj.c
P_SpawnPlayer void INT32 playernum p_mobj.c
P_MovePlayerToSpawn void INT32 playernum,
mapthing_t *mthing
p_mobj.c
P_MovePlayerToStarpost void INT32 playernum p_mobj.c
P_AfterPlayerSpawn void INT32 playernum p_mobj.c
P_SpawnMapThing void mapthing_t *mthing p_mobj.c
P_SpawnHoopsAndRings void mapthing_t *mthing p_mobj.c
P_SpawnHoopOfSomething void fixed_t x,
fixed_t y,
fixed_t z,
fixed_t radius,
INT32 number,
mobjtype_t type,
angle_t rotangle
p_mobj.c
P_SpawnPrecipitation void None p_mobj.c
P_SpawnParaloop void fixed_t x,
fixed_t y,
fixed_t z,
fixed_t radius,
INT32 number,
mobjtype_t type,
statenum_t nstate,
angle_t rotangle,
boolean spawncenter
p_mobj.c
P_BossTargetPlayer boolean mobj_t *actor,
boolean closest
p_mobj.c
P_SupermanLook4Players boolean mobj_t *actor p_mobj.c
P_DestroyRobots void None p_mobj.c
P_SnowThinker void precipmobj_t *mobj p_mobj.c
P_RainThinker void precipmobj_t *mobj p_mobj.c
P_NullPrecipThinker void precipmobj_t *mobj p_mobj.c
P_RemovePrecipMobj void precipmobj_t *mobj p_mobj.c
P_SetScale void mobj_t *mobj,
fixed_t newscale
p_mobj.c
P_XYMovement void mobj_t *mo p_mobj.c
P_EmeraldManager void None p_mobj.c