MCPcopy Create free account
hub / github.com/ZDoom/Raze / DoPlayerFall

Function DoPlayerFall

source/games/sw/src/player.cpp:2985–3138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2983//---------------------------------------------------------------------------
2984
2985void DoPlayerFall(DSWPlayer* pp)
2986{
2987 short i;
2988 double depth;
2989
2990 // reset flag key for double jumps
2991 if (!(pp->cmd.ucmd.actions & SB_JUMP))
2992 {
2993 pp->KeyPressBits |= SB_JUMP;
2994 }
2995
2996 if (SectorIsUnderwaterArea(pp->cursector))
2997 {
2998 StackedWaterSplash(pp);
2999 DoPlayerBeginDiveNoWarp(pp);
3000 return;
3001 }
3002
3003 for (i = 0; i < synctics; i++)
3004 {
3005 // adjust jump speed by gravity
3006 pp->jump_speed += PlayerGravity;
3007 if (pp->jump_speed > 4100)
3008 pp->jump_speed = 4100;
3009
3010 // adjust player height by jump speed
3011 pp->GetActor()->spr.pos.Z += pp->jump_speed * JUMP_FACTOR;
3012
3013 if (pp->jump_speed > 2000)
3014 {
3015 PlayerSound(DIGI_FALLSCREAM, v3df_dontpan|v3df_doppler|v3df_follow,pp);
3016 }
3017 else if (pp->jump_speed > 1300 && !sw_nocenterview)
3018 {
3019 if (!(pp->cmd.ucmd.actions & SB_CENTERVIEW))
3020 {
3021 pp->cmd.ucmd.actions |= SB_CENTERVIEW;
3022 }
3023 }
3024
3025
3026
3027 depth = GetZadjustment(pp->cursector, FLOOR_Z_ADJUST);
3028 if (depth == 0)
3029 depth = pp->WadeDepth;
3030
3031 double recoil_amnt;
3032
3033 if (depth > 20)
3034 recoil_amnt = 0;
3035 else
3036 recoil_amnt = min(pp->jump_speed * 6 * JUMP_FACTOR, 35.);
3037
3038 // need a test for head hits a sloped ceiling while falling
3039 // if player gets to close the Ceiling while Falling
3040 if (PlayerCeilingHit(pp, pp->hiz + pp->p_ceiling_dist))
3041 {
3042 // put player at the ceiling

Callers 6

DoPlayerJumpFunction · 0.85
DoPlayerForceJumpFunction · 0.85
DoPlayerCrawlFunction · 0.85
DoPlayerFlyFunction · 0.85
DoPlayerWadeFunction · 0.85
DoPlayerRunFunction · 0.85

Calls 15

SectorIsUnderwaterAreaFunction · 0.85
StackedWaterSplashFunction · 0.85
DoPlayerBeginDiveNoWarpFunction · 0.85
PlayerSoundFunction · 0.85
GetZadjustmentFunction · 0.85
PlayerCeilingHitFunction · 0.85
PlayerFloorHitFunction · 0.85
PlayerSectorBoundFunction · 0.85
PlaySoundFunction · 0.85
StopPlayerSoundFunction · 0.85
DoPlayerTestCrawlFunction · 0.85
DoPlayerHeightFunction · 0.85

Tested by

no test coverage detected