| 2983 | //--------------------------------------------------------------------------- |
| 2984 | |
| 2985 | void 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 |
no test coverage detected