User:Monster Iestyn/Source Code Documentation/p_user.c

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 source file

Includes

The file(s) below will also be included if HW3SOUND is defined:

  • hardware/hw3sound.h

The file(s) below will also be included if HWRENDER is defined:

Macros

Macro Defined as Description
INVERSECOLORMAP 32 Unused; originally used in Doom to apply the invulnerability powerup's colormap to the player
MAXBOB (0x10 << FRACBITS)
(16*FRACUNIT)
Maximum value for player->bob used in P_CalcHeight
SPACESPECIAL 12 Sector effect number (from Group 1) for Space Countdown, used in P_InSpaceSector
MAXDRILLSPEED 14000 Maximum value for player->speed when drilling as NiGHTS Super Sonic, used in P_NiGHTSMovement
MAXNORMALSPEED 6250 Maximum value for player->speed when flying normally as NiGHTS Super Sonic, used in P_NiGHTSMovement
MAXCAMERADIST 140*FRACUNIT Unused; was used in P_MoveChaseCamera as the maximum value for thiscam->relativex, the relative X-distance the camera is positioned from the player in 2D mode, but the relevant code has since been commented out

Variables

PIT_CheckSolidsTeeter variables

Name Type Default Attributes Description
*teeterer mobj_t none static The player Object currently being checked for teetering by PIT_CheckSolidsTeeter. In P_DoTeeter this is set to player->mo before searching the blockmap for objects to teeter on, so that the player's Object can be passed to each PIT_CheckSolidsTeeter call when iterating through the surrounding blockmap
solidteeter boolean none static Saves whether the player is currently able to teeter or not from previous PIT_CheckSolidsTeeter calls. In P_DoTeeter this is initially set to the current value of the teeter variable (note: it will always be true to begin with), and may be changed to true or false by each PIT_CheckSolidsTeeter call when searching the blockmap for objects to teeter on. The final value after searching the blockmap becomes the new value of teeter
highesttop fixed_t none static Saves the highest z height found for a solid Object's top so far in a block when searching for objects to teeter on. In P_DoTeeter this is initially set to INT32_MIN for each block, and is updated by PIT_CheckSolidsTeeter if a found solid Object's top is below the player and is found to be higher than the variable's current value
couldteeter boolean none static Saves from previous PIT_CheckSolidsTeeter calls whether or not the player is standing on a solid Object but is still able to teeter from on top of it. In P_DoTeeter this is initially set to false, and PIT_CheckSolidsTeeter may then change this to true if the player has found a solid Object they can stand on but is standing off one of its edges. This then means if any further solid Objects are found that the player can stand on, PIT_CheckSolidsTeeter must check if the player is standing on both or not. If they are, the player is not teetering
teeterxl
teeterxh
fixed_t none static Saves the X-coordinates of the left-most and right-most edges of the player's "teeter" box found so far from previous PIT_CheckSolidsTeeter calls. In P_DoTeeter these are both initially set to player->mo->x, and PIT_CheckSolidsTeeter may then update these values if the player has found a solid Object they can stand on but is standing off one of its edges. If at least two solid Objects have been found that the player can stand on, and the player's position is within the "teeter" box, the player is not teetering
teeteryl
teeteryh
fixed_t none static Saves the Y-coordinates of the bottom-most and top-most edges of the player's "teeter" box found so far from previous PIT_CheckSolidsTeeter calls. In P_DoTeeter these are both initially set to player->mo->y, and PIT_CheckSolidsTeeter may then update these values if the player has found a solid Object they can stand on but is standing off one of its edges. If at least two solid Objects have been found that the player can stand on, and the player's position is within the "teeter" box, the player is not teetering

Cameras

Name Type Default Attributes Description
camera
camera2
camera_t none The cameras of player 1 and player 2, respectively
t_cam_dist fixed_t -42
t_cam_height fixed_t -42
t_cam_rotate fixed_t -42
t_cam2_dist fixed_t -42
t_cam2_height fixed_t -42
t_cam2_rotate fixed_t -42

Console variables

Name Type Default Attributes Description
CV_CamSpeed[] CV_PossibleValue_t
{{0, "MIN"}, {1*FRACUNIT, "MAX"}, {0, NULL}}
static The possible values for cv_cam_speed and cv_cam2_speed
rotation_cons_t[] CV_PossibleValue_t
{{1, "MIN"}, {45, "MAX"}, {0, NULL}}
static The possible values for cv_cam_rotspeed and cv_cam2_rotspeed
CV_CamRotate[] CV_PossibleValue_t
{{-720, "MIN"}, {720, "MAX"}, {0, NULL}}
static The possible values for cv_cam_rotate and cv_cam2_rotate
cv_cam_dist consvar_t
{"cam_dist", "128", CV_FLOAT, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}
cv_cam_height consvar_t
{"cam_height", "20", CV_FLOAT, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}
cv_cam_still consvar_t
{"cam_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
cv_cam_speed consvar_t
{"cam_speed", "0.25", CV_FLOAT, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL}
cv_cam_rotate consvar_t
{"cam_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate_OnChange, 0, NULL, NULL, 0, 0, NULL}
cv_cam_rotspeed consvar_t
{"cam_rotspeed", "10", 0, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
cv_cam2_dist consvar_t
{"cam2_dist", "128", CV_FLOAT, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}
cv_cam2_height consvar_t
{"cam2_height", "20", CV_FLOAT, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}
cv_cam2_still consvar_t
{"cam2_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
cv_cam2_speed consvar_t
{"cam2_speed", "0.25", CV_FLOAT, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL}
cv_cam2_rotate consvar_t
{"cam2_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate2_OnChange, 0, NULL, NULL, 0, 0, NULL}
cv_cam2_rotspeed consvar_t
{"cam2_rotspeed", "10", 0, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}

Miscellaneous

Name Type Default Attributes Description
onground boolean none static Used by various functions in p_user.c to check whether the player is on the ground or not. The value of this is set in P_2dMovement or P_3dMovement
playerdeadview boolean none Determines whether to show multiplayer rankings on the screen while dead or not

Functions list

* – pointer

Function name Return type Params Attributes Description
P_Thrust void mobj_t *mo,
angle_t angle,
fixed_t move
P_InstaThrust void mobj_t *mo,
angle_t angle,
fixed_t move
P_InstaThrustEvenIn2D void mobj_t *mo,
angle_t angle,
fixed_t move
P_ReturnThrustX fixed_t mobj_t *mo,
angle_t angle,
fixed_t move
Returns the X-component of the given thrust at the specified angle, i.e. what mo->momx would be for P_InstaThrust(mo, angle, move).
Note: mo is unused
P_ReturnThrustY fixed_t mobj_t *mo,
angle_t angle,
fixed_t move
Returns the Y-component of the given thrust at the specified angle, i.e. what mo->momy would be for P_InstaThrust(mo, angle, move).
Note: mo is unused
P_AutoPause boolean none Returns true when gameplay should be halted even if the game isn't necessarily paused.
P_CalcHeight void player_t *player Calculate the walking / running height adjustment.
P_PlayerMoving void INT32 pnum – player number to test Decides if a player is moving.
P_GetNextEmerald UINT8 none
P_GiveEmerald void boolean spawnObj
P_ResetScore void player_t *player
P_FindLowestMare UINT8 none
P_TransferToNextMare boolean player_t *player
P_FindAxis mobj_t * INT32 mare,
INT32 axisnum
static
P_FindAxisTransfer mobj_t * INT32 mare,
INT32 axisnum
mobjtype_t type
static
P_TransferToAxis void player_t *player,
INT32 axisnum
P_DeNightserizePlayer void player_t *player static
P_NightserizePlayer void player_t *player,
INT32 nighttime
P_PlayerInPain boolean player_t *player
P_DoPlayerPain void player_t *player,
mobj_t *source,
mobj_t *inflictor
P_ResetPlayer void player_t *player
P_GivePlayerRings void player_t *player,
INT32 num_rings
P_GivePlayerLives void player_t *player,
INT32 numlives
P_DoSuperTransformation void player_t *player,
boolean giverings
P_AddPlayerScore void player_t *player,
UINT32 amount
P_PlayLivesJingle void player_t *player
P_RestoreMusic void player_t *player

static

Lua-accessible

  • P_Thrust
  • P_InstaThrust
  • P_InstaThrustEvenIn2D
  • P_ReturnThrustX
  • P_ReturnThrustY
  • P_AutoPause
  • P_CalcHeight
  • P_PlayerMoving
  • P_GetNextEmerald
  • P_GiveEmerald
  • P_ResetScore
  • P_FindLowestMare
  • P_TransferToNextMare
  • P_FindAxis (static)
  • P_FindAxisTransfer (static)
  • P_TransferToAxis
  • P_DeNightserizePlayer (static)
  • P_NightserizePlayer
  • P_PlayerInPain
  • P_DoPlayerPain
  • P_ResetPlayer
  • P_GivePlayerRings
  • P_GivePlayerLives
  • P_DoSuperTransformation
  • P_AddPlayerScore
  • P_PlayLivesJingle
  • P_RestoreMusic
  • P_IsObjectInGoop
  • P_IsObjectOnGround
  • P_IsObjectOnGroundIn
  • P_SetObjectMomZ
  • P_GetPlayerHeight
  • P_GetPlayerSpinHeight
  • P_IsLocalPlayer
  • P_SpawnShieldOrb
  • P_SpawnGhostMobj
  • P_SpawnThokMobj
  • P_SpawnSpinMobj
  • P_DoPlayerExit
  • P_InSpaceSector
  • P_InQuicksand
  • P_CheckBustableBlocks (static)
  • P_CheckBouncySectors (static)
  • P_CheckQuicksand (static)
  • P_CheckSneakerAndLivesTimer (static)
  • P_CheckUnderwaterAndSpaceTimer (static)
  • P_CheckInvincibilityTimer (static)
  • P_DoBubbleBreath (static)
  • P_DoPlayerHeadSigns (static)
  • P_DoClimbing (static)
  • P_DoTeeter (static)
  • P_SetWeaponDelay (static)
  • P_DoFiring (static)
  • P_DoSuperStuff (static)
  • P_SuperReady
  • P_DoJump
  • P_DoSpinDash (static)
  • P_DoJumpShield
  • P_Telekinesis
  • P_DoJumpStuff (static)
  • P_AnalogMove (static)
  • P_GetPlayerControlDirection
  • P_2dMovement (static)
  • P_3dMovement (static)
  • P_SpectatorMovement (static)
  • P_ShootLine (static)
  • P_NightsTransferPoints (static)
  • P_DoNiGHTSCapsule (static)
  • P_NiGHTSMovement (static)
  • P_BlackOw
  • P_ElementalFireTrail
  • P_SkidStuff (static)
  • P_MovePlayer (static)
  • P_DoZoomTube (static)
  • P_DoRopeHang (static)
  • P_NukeEnemies
  • P_LookForEnemies
  • P_HomingAttack
  • P_FindEmerald
  • P_DeathThink (static)
  • CV_CamRotate_OnChange (static)
  • CV_CamRotate2_OnChange (static)
  • P_ResetCamera
  • P_MoveChaseCamera
  • P_SpectatorJoinGame (static)
  • P_CalcPostImg (static)
  • P_DoPityCheck
  • P_PlayerThink
  • P_PlayerAfterThink