2019-11-20 16:21:32 +00:00
//-------------------------------------------------------------------------
/*
Copyright ( C ) 2010 - 2019 EDuke32 developers and contributors
Copyright ( C ) 2019 sirlemonhead , Nuke . YKT
This file is part of PCExhumed .
PCExhumed is free software ; you can redistribute it and / or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE .
See the GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 , USA .
*/
//-------------------------------------------------------------------------
2019-11-22 23:11:37 +00:00
# include "ns.h"
2019-08-26 03:59:14 +00:00
# include "player.h"
2020-08-18 07:52:08 +00:00
# include "aistuff.h"
2019-08-26 03:59:14 +00:00
# include "exhumed.h"
# include "names.h"
# include "engine.h"
# include "sequence.h"
# include "view.h"
2021-01-01 22:38:15 +00:00
# include "input.h"
2019-08-26 03:59:14 +00:00
# include "status.h"
# include "sound.h"
# include "sound.h"
2020-05-24 05:58:56 +00:00
# include "buildtiles.h"
2020-08-22 18:14:00 +00:00
# include "gstrings.h"
2020-08-23 10:26:52 +00:00
# include "gamestate.h"
2020-08-23 14:24:54 +00:00
# include "mapinfo.h"
2020-09-06 18:49:43 +00:00
# include "automap.h"
2021-01-04 19:44:46 +00:00
# include "interpolate.h"
2020-09-06 18:49:43 +00:00
2019-08-26 03:59:14 +00:00
# include <assert.h>
# include <stdio.h>
# include <string.h>
2019-11-22 23:11:37 +00:00
BEGIN_PS_NS
2021-11-21 20:09:27 +00:00
extern int nStatusSeqOffset ;
2021-05-13 10:58:30 +00:00
2020-08-26 07:19:50 +00:00
int lPlayerXVel = 0 ;
int lPlayerYVel = 0 ;
2021-11-21 20:09:27 +00:00
int obobangle = 0 , bobangle = 0 ;
2019-08-26 03:59:14 +00:00
2020-10-11 09:33:28 +00:00
static actionSeq PlayerSeq [ ] = {
2019-08-31 07:47:15 +00:00
{ 18 , 0 } , { 0 , 0 } , { 9 , 0 } , { 27 , 0 } , { 63 , 0 } ,
2019-11-20 16:21:32 +00:00
{ 72 , 0 } , { 54 , 0 } , { 45 , 0 } , { 54 , 0 } , { 81 , 0 } ,
{ 90 , 0 } , { 99 , 0 } , { 108 , 0 } , { 8 , 0 } , { 0 , 0 } ,
{ 139 , 0 } , { 117 , 1 } , { 119 , 1 } , { 120 , 1 } , { 121 , 1 } ,
2019-08-31 07:47:15 +00:00
{ 122 , 1 }
2019-08-26 03:59:14 +00:00
} ;
2021-11-21 18:24:46 +00:00
static const uint8_t nHeightTemplate [ ] = { 0 , 0 , 0 , 0 , 0 , 0 , 7 , 7 , 7 , 9 , 9 , 9 , 9 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ;
2019-08-26 03:59:14 +00:00
2022-09-07 05:25:34 +00:00
static constexpr double nActionEyeLevel [ ] = {
- 55.0 , - 55.0 , - 55.0 , - 55.0 , - 55.0 , - 55.0 , - 32.5 ,
- 32.5 , - 32.5 , - 32.5 , - 32.5 , - 32.5 , - 32.5 , - 55.0 ,
- 55.0 , - 55.0 , - 55.0 , - 55.0 , - 55.0 , - 55.0 , - 55.0
2019-08-26 03:59:14 +00:00
} ;
2021-11-21 18:24:46 +00:00
static const uint16_t nGunLotag [ ] = { 52 , 53 , 54 , 55 , 56 , 57 } ;
static const uint16_t nGunPicnum [ ] = { 57 , 488 , 490 , 491 , 878 , 899 , 3455 } ;
2019-08-26 03:59:14 +00:00
2021-11-21 18:24:46 +00:00
static const int16_t nItemText [ ] = {
2019-08-31 07:47:15 +00:00
- 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 18 , 20 , 19 , 13 , - 1 , 10 , 1 , 0 , 2 , - 1 , 3 ,
- 1 , 4 , 5 , 9 , 6 , 7 , 8 , - 1 , 11 , - 1 , 13 , 12 , 14 , 15 , - 1 , 16 , 17 ,
- 1 , - 1 , - 1 , 21 , 22 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 23 , 24 , 25 , 26 , 27 ,
- 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1
2019-08-26 03:59:14 +00:00
} ;
int nLocalPlayer = 0 ;
Player PlayerList [ kMaxPlayers ] ;
2021-10-21 10:51:16 +00:00
2021-12-07 17:53:02 +00:00
TObjPtr < DExhumedActor * > nNetStartSprite [ kMaxPlayers ] = { } ;
2019-08-26 03:59:14 +00:00
2022-09-10 17:18:09 +00:00
double nStandHeight ;
2019-08-26 03:59:14 +00:00
2021-11-21 20:09:27 +00:00
int PlayerCount ;
int nNetStartSprites ;
int nCurStartSprite ;
2019-08-26 03:59:14 +00:00
2021-12-07 17:53:02 +00:00
size_t MarkPlayers ( )
{
for ( auto & p : PlayerList )
{
GC : : Mark ( p . pActor ) ;
GC : : Mark ( p . pDoppleSprite ) ;
GC : : Mark ( p . pPlayerFloorSprite ) ;
GC : : Mark ( p . pPlayerGrenade ) ;
}
GC : : MarkArray ( nNetStartSprite , kMaxPlayers ) ;
return 5 * kMaxPlayers ;
}
2022-09-07 07:48:05 +00:00
void SetSavePoint ( int nPlayer , const DVector3 & pos , sectortype * pSector , DAngle nAngle )
2019-08-26 03:59:14 +00:00
{
2022-08-23 21:36:23 +00:00
PlayerList [ nPlayer ] . sPlayerSave . pos = pos ;
2021-11-22 23:20:15 +00:00
PlayerList [ nPlayer ] . sPlayerSave . pSector = pSector ;
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . sPlayerSave . nAngle = nAngle ;
2019-08-26 03:59:14 +00:00
}
2022-09-09 17:05:36 +00:00
void feebtag ( const DVector3 & pos , sectortype * pSector , DExhumedActor * * nSprite , int nVal2 , double deflen )
2019-08-26 03:59:14 +00:00
{
2021-10-22 16:39:28 +00:00
* nSprite = nullptr ;
2019-08-31 07:47:15 +00:00
2022-02-19 09:11:12 +00:00
int startwall = pSector - > wallptr ;
2019-08-31 07:47:15 +00:00
2021-11-22 21:20:53 +00:00
int nWalls = pSector - > wallnum ;
2019-08-31 07:47:15 +00:00
int var_20 = nVal2 & 2 ;
int var_14 = nVal2 & 1 ;
while ( 1 )
{
2021-11-22 21:20:53 +00:00
if ( pSector ! = nullptr )
2019-08-31 07:47:15 +00:00
{
2021-11-22 21:20:53 +00:00
ExhumedSectIterator it ( pSector ) ;
2021-10-20 20:27:16 +00:00
while ( auto pActor = it . Next ( ) )
2019-08-31 07:47:15 +00:00
{
2021-12-23 16:05:32 +00:00
int nStat = pActor - > spr . statnum ;
2019-08-31 07:47:15 +00:00
2021-12-23 16:05:32 +00:00
if ( nStat > = 900 & & ! ( pActor - > spr . cstat & CSTAT_SPRITE_INVISIBLE ) )
2019-08-31 07:47:15 +00:00
{
2022-09-09 17:05:36 +00:00
auto diff = pActor - > spr . pos - pos ;
2019-08-31 07:47:15 +00:00
2022-09-09 17:05:36 +00:00
if ( diff . Z < 20 & & diff . Z > - 100 )
2019-08-31 07:47:15 +00:00
{
2022-09-09 17:05:36 +00:00
double len = diff . XY ( ) . Length ( ) ;
2020-06-12 23:34:29 +00:00
2022-09-09 17:05:36 +00:00
if ( len < deflen & & ( ( nStat ! = 950 & & nStat ! = 949 ) | | ! ( var_14 & 1 ) ) & & ( ( nStat ! = 912 & & nStat ! = 913 ) | | ! ( var_20 & 2 ) ) )
2020-06-12 23:34:29 +00:00
{
2022-09-09 17:05:36 +00:00
deflen = len ;
2021-10-22 16:39:28 +00:00
* nSprite = pActor ;
2019-08-31 07:47:15 +00:00
}
}
}
}
}
nWalls - - ;
if ( nWalls < - 1 )
return ;
2022-02-19 09:11:12 +00:00
pSector = wall [ startwall ] . nextSector ( ) ;
2019-08-31 07:47:15 +00:00
startwall + + ;
}
2019-08-26 03:59:14 +00:00
}
void InitPlayer ( )
{
2019-08-31 07:47:15 +00:00
for ( int i = 0 ; i < kMaxPlayers ; i + + ) {
2021-10-21 20:39:17 +00:00
PlayerList [ i ] . pActor = nullptr ;
2022-01-03 21:13:45 +00:00
PlayerList [ i ] . pPlayerPushSect = nullptr ;
PlayerList [ i ] . pPlayerViewSect = nullptr ;
2019-08-31 07:47:15 +00:00
}
2019-08-26 03:59:14 +00:00
}
2021-11-16 17:50:02 +00:00
void InitPlayerKeys ( int nPlayer )
2019-08-26 03:59:14 +00:00
{
2019-08-31 07:47:15 +00:00
PlayerList [ nPlayer ] . keys = 0 ;
2019-08-26 03:59:14 +00:00
}
2021-11-16 17:50:02 +00:00
void InitPlayerInventory ( int nPlayer )
2019-08-26 03:59:14 +00:00
{
2019-08-31 07:47:15 +00:00
memset ( & PlayerList [ nPlayer ] , 0 , sizeof ( Player ) ) ;
2019-08-26 03:59:14 +00:00
2021-05-13 11:44:58 +00:00
PlayerList [ nPlayer ] . nItem = - 1 ;
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nPlayerSwear = 4 ;
2019-08-26 03:59:14 +00:00
2019-08-31 07:47:15 +00:00
ResetPlayerWeapons ( nPlayer ) ;
2019-08-26 03:59:14 +00:00
2021-05-13 17:06:38 +00:00
PlayerList [ nPlayer ] . nLives = kDefaultLives ;
2019-08-26 03:59:14 +00:00
2021-10-21 20:39:17 +00:00
PlayerList [ nPlayer ] . pActor = nullptr ;
2019-08-31 07:47:15 +00:00
PlayerList [ nPlayer ] . nRun = - 1 ;
2019-08-26 03:59:14 +00:00
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nPistolClip = 6 ;
PlayerList [ nPlayer ] . nPlayerClip = 0 ;
2019-08-26 03:59:14 +00:00
2019-08-31 07:47:15 +00:00
PlayerList [ nPlayer ] . nCurrentWeapon = 0 ;
2019-08-26 03:59:14 +00:00
2019-08-31 07:47:15 +00:00
if ( nPlayer = = nLocalPlayer ) {
2020-08-24 17:54:26 +00:00
automapMode = am_off ;
2019-08-31 07:47:15 +00:00
}
2019-08-26 03:59:14 +00:00
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nPlayerScore = 0 ;
2019-08-26 03:59:14 +00:00
2019-11-24 12:59:36 +00:00
auto pixels = tilePtr ( kTile3571 + nPlayer ) ;
2019-08-26 03:59:14 +00:00
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nPlayerColor = pixels [ tileWidth ( nPlayer + kTile3571 ) * tileHeight ( nPlayer + kTile3571 ) / 2 ] ;
2019-08-26 03:59:14 +00:00
}
2021-11-21 19:48:11 +00:00
int GetPlayerFromActor ( DExhumedActor * pActor )
2019-08-26 03:59:14 +00:00
{
2022-05-23 22:30:41 +00:00
return RunData [ pActor - > spr . intowner ] . nObjIndex ;
2019-08-26 03:59:14 +00:00
}
2021-11-16 17:50:02 +00:00
void RestartPlayer ( int nPlayer )
2019-08-26 03:59:14 +00:00
{
2020-10-13 22:19:39 +00:00
auto plr = & PlayerList [ nPlayer ] ;
2021-12-26 07:47:54 +00:00
auto pActor = plr - > pActor ;
2021-12-07 17:53:02 +00:00
DExhumedActor * pDopSprite = plr - > pDoppleSprite ;
2020-10-13 22:19:39 +00:00
2021-10-21 17:44:53 +00:00
DExhumedActor * floorsprt ;
2020-10-13 22:19:39 +00:00
2021-10-21 19:20:54 +00:00
if ( pActor )
2020-10-13 22:19:39 +00:00
{
2022-05-23 22:30:41 +00:00
runlist_DoSubRunRec ( pActor - > spr . intowner ) ;
2021-12-23 18:01:43 +00:00
runlist_FreeRun ( pActor - > spr . lotag - 1 ) ;
2020-10-13 22:19:39 +00:00
2021-10-21 19:20:54 +00:00
ChangeActorStat ( pActor , 0 ) ;
2020-10-13 22:19:39 +00:00
2021-10-21 20:39:17 +00:00
plr - > pActor = nullptr ;
2020-10-13 22:19:39 +00:00
2021-12-07 17:53:02 +00:00
DExhumedActor * pFloorSprite = plr - > pPlayerFloorSprite ;
2021-10-21 17:44:53 +00:00
if ( pFloorSprite ! = nullptr ) {
DeleteActor ( pFloorSprite ) ;
2020-10-13 22:19:39 +00:00
}
2021-10-21 17:54:39 +00:00
if ( pDopSprite )
2020-10-13 22:19:39 +00:00
{
2022-05-23 22:30:41 +00:00
runlist_DoSubRunRec ( pDopSprite - > spr . intowner ) ;
2021-12-23 18:01:43 +00:00
runlist_FreeRun ( pDopSprite - > spr . lotag - 1 ) ;
2021-10-21 17:54:39 +00:00
DeleteActor ( pDopSprite ) ;
2020-10-13 22:19:39 +00:00
}
}
2021-10-21 19:20:54 +00:00
pActor = GrabBody ( ) ;
2020-10-13 22:19:39 +00:00
2021-11-22 23:20:15 +00:00
ChangeActorSect ( pActor , plr - > sPlayerSave . pSector ) ;
2021-10-21 19:20:54 +00:00
ChangeActorStat ( pActor , 100 ) ;
2020-10-13 22:19:39 +00:00
2021-12-30 15:51:56 +00:00
auto pDActor = insertActor ( pActor - > sector ( ) , 100 ) ;
2021-10-21 19:20:54 +00:00
plr - > pDoppleSprite = pDActor ;
2020-10-13 22:19:39 +00:00
if ( nTotalPlayers > 1 )
{
2021-12-07 17:53:02 +00:00
DExhumedActor * nNStartSprite = nNetStartSprite [ nCurStartSprite ] ;
2020-10-13 22:19:39 +00:00
nCurStartSprite + + ;
if ( nCurStartSprite > = nNetStartSprites ) {
nCurStartSprite = 0 ;
}
2022-10-05 15:38:44 +00:00
pActor - > spr . pos = nNStartSprite - > spr . pos ;
2021-12-30 15:51:56 +00:00
ChangeActorSect ( pActor , nNStartSprite - > sector ( ) ) ;
2022-08-29 06:58:06 +00:00
plr - > angle . ang = nNStartSprite - > spr . angle ;
2022-08-28 03:15:31 +00:00
pActor - > spr . angle = plr - > angle . ang ;
2021-12-23 18:01:43 +00:00
2021-12-30 15:51:56 +00:00
floorsprt = insertActor ( pActor - > sector ( ) , 0 ) ;
2021-12-23 18:01:43 +00:00
2022-10-05 15:38:44 +00:00
floorsprt - > spr . pos = pActor - > spr . pos ;
2021-12-23 18:01:43 +00:00
floorsprt - > spr . yrepeat = 64 ;
floorsprt - > spr . xrepeat = 64 ;
floorsprt - > spr . cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR ;
floorsprt - > spr . picnum = nPlayer + kTile3571 ;
2020-10-13 22:19:39 +00:00
}
else
{
2022-08-23 21:36:23 +00:00
pActor - > spr . pos . XY ( ) = plr - > sPlayerSave . pos . XY ( ) ;
pActor - > spr . pos . Z = plr - > sPlayerSave . pSector - > floorz ;
2022-09-07 07:48:05 +00:00
plr - > angle . ang = plr - > sPlayerSave . nAngle ;
2022-08-23 20:49:17 +00:00
pActor - > spr . angle = plr - > angle . ang ;
2020-10-13 22:19:39 +00:00
2021-10-21 17:44:53 +00:00
floorsprt = nullptr ;
2020-10-13 22:19:39 +00:00
}
plr - > angle . backup ( ) ;
plr - > horizon . backup ( ) ;
2021-10-21 19:20:54 +00:00
plr - > pPlayerFloorSprite = floorsprt ;
2020-10-13 22:19:39 +00:00
2021-12-23 18:01:43 +00:00
pActor - > spr . cstat = CSTAT_SPRITE_BLOCK_ALL ;
pActor - > spr . shade = - 12 ;
2022-09-09 16:24:22 +00:00
pActor - > set_const_clipdist ( 58 ) ;
2021-12-23 18:01:43 +00:00
pActor - > spr . pal = 0 ;
pActor - > spr . xrepeat = 40 ;
pActor - > spr . yrepeat = 40 ;
pActor - > spr . xoffset = 0 ;
pActor - > spr . yoffset = 0 ;
pActor - > spr . picnum = seq_GetSeqPicnum ( kSeqJoe , 18 , 0 ) ;
2020-10-13 22:19:39 +00:00
2022-09-03 08:02:25 +00:00
pActor - > vel . X = 0 ;
pActor - > vel . Y = 0 ;
pActor - > vel . Z = 0 ;
2019-08-31 07:47:15 +00:00
2022-09-10 17:18:09 +00:00
nStandHeight = GetActorHeightF ( pActor ) ;
2019-08-31 07:47:15 +00:00
2021-12-23 18:01:43 +00:00
pActor - > spr . hitag = 0 ;
pActor - > spr . extra = - 1 ;
pActor - > spr . lotag = runlist_HeadRun ( ) + 1 ;
2020-10-13 22:19:39 +00:00
2022-10-05 15:38:44 +00:00
pDActor - > spr . pos = pActor - > spr . pos ;
2021-12-23 18:01:43 +00:00
pDActor - > spr . xrepeat = pActor - > spr . xrepeat ;
pDActor - > spr . yrepeat = pActor - > spr . yrepeat ;
pDActor - > spr . xoffset = 0 ;
pDActor - > spr . yoffset = 0 ;
pDActor - > spr . shade = pActor - > spr . shade ;
2022-08-28 03:15:31 +00:00
pDActor - > spr . angle = pActor - > spr . angle ;
2021-12-23 18:01:43 +00:00
pDActor - > spr . cstat = pActor - > spr . cstat ;
2019-08-26 03:59:14 +00:00
2021-12-23 18:01:43 +00:00
pDActor - > spr . lotag = runlist_HeadRun ( ) + 1 ;
2019-08-26 03:59:14 +00:00
2020-10-13 22:19:39 +00:00
plr - > nAction = 0 ;
plr - > nHealth = 800 ; // TODO - define
2019-08-26 03:59:14 +00:00
2020-10-13 22:19:39 +00:00
if ( nNetPlayerCount ) {
plr - > nHealth = 1600 ; // TODO - define
}
2019-08-26 03:59:14 +00:00
2021-11-21 18:33:51 +00:00
plr - > nSeqSize = 0 ;
2021-10-21 20:39:17 +00:00
plr - > pActor = pActor ;
2020-10-13 22:19:39 +00:00
plr - > bIsMummified = false ;
2019-08-31 07:47:15 +00:00
2020-10-13 22:19:39 +00:00
if ( plr - > invincibility > = 0 ) {
plr - > invincibility = 0 ;
}
2021-10-21 19:20:54 +00:00
plr - > nTorch = 0 ;
2020-10-13 22:19:39 +00:00
plr - > nMaskAmount = 0 ;
SetTorch ( nPlayer , 0 ) ;
2021-10-21 19:20:54 +00:00
plr - > nInvisible = 0 ;
2020-10-13 22:19:39 +00:00
plr - > bIsFiring = 0 ;
2021-11-21 18:33:51 +00:00
plr - > nSeqSize2 = 0 ;
2021-11-22 23:20:15 +00:00
plr - > pPlayerViewSect = plr - > sPlayerSave . pSector ;
2021-11-21 18:33:51 +00:00
plr - > nState = 0 ;
2020-10-13 22:19:39 +00:00
2021-10-21 19:20:54 +00:00
plr - > nDouble = 0 ;
2019-08-31 07:47:15 +00:00
2020-10-13 22:19:39 +00:00
plr - > nSeq = kSeqJoe ;
2021-10-21 19:20:54 +00:00
plr - > nPlayerPushSound = - 1 ;
2019-08-31 07:47:15 +00:00
2021-11-21 18:33:51 +00:00
plr - > nNextWeapon = - 1 ;
2019-08-26 03:59:14 +00:00
2020-10-13 22:19:39 +00:00
if ( plr - > nCurrentWeapon = = 7 ) {
2021-11-21 18:33:51 +00:00
plr - > nCurrentWeapon = plr - > nLastWeapon ;
2020-10-13 22:19:39 +00:00
}
2019-08-31 07:47:15 +00:00
2021-11-21 18:33:51 +00:00
plr - > nLastWeapon = 0 ;
2020-10-13 22:19:39 +00:00
plr - > nAir = 100 ;
2019-08-26 03:59:14 +00:00
2021-05-02 13:54:19 +00:00
if ( ! ( currentLevel - > gameflags & LEVEL_EX_MULTI ) )
2020-10-13 22:19:39 +00:00
{
RestoreMinAmmo ( nPlayer ) ;
}
else
{
ResetPlayerWeapons ( nPlayer ) ;
plr - > nMagic = 0 ;
}
2019-08-26 03:59:14 +00:00
2021-10-21 19:20:54 +00:00
plr - > pPlayerGrenade = nullptr ;
2022-09-07 05:25:34 +00:00
plr - > oeyelevel = plr - > eyelevel = - 55. ;
2020-10-13 22:19:39 +00:00
dVertPan [ nPlayer ] = 0 ;
2019-08-26 03:59:14 +00:00
2020-10-13 22:19:39 +00:00
nTemperature [ nPlayer ] = 0 ;
2019-08-26 03:59:14 +00:00
2022-09-09 20:59:16 +00:00
plr - > nThrust . Zero ( ) ;
2019-08-26 03:59:14 +00:00
2021-04-13 11:56:01 +00:00
plr - > nDestVertPan = plr - > horizon . ohoriz = plr - > horizon . horiz = q16horiz ( 0 ) ;
2021-10-21 19:20:54 +00:00
plr - > nBreathTimer = 90 ;
2019-08-26 03:59:14 +00:00
2021-10-21 19:20:54 +00:00
plr - > nTauntTimer = RandomSize ( 3 ) + 3 ;
2019-08-26 03:59:14 +00:00
2022-05-23 22:30:41 +00:00
pDActor - > spr . intowner = runlist_AddRunRec ( pDActor - > spr . lotag - 1 , nPlayer , 0xA0000 ) ;
pActor - > spr . intowner = runlist_AddRunRec ( pActor - > spr . lotag - 1 , nPlayer , 0xA0000 ) ;
2019-08-26 03:59:14 +00:00
2020-10-13 22:19:39 +00:00
if ( plr - > nRun < 0 ) {
2021-10-15 16:37:39 +00:00
plr - > nRun = runlist_AddRunRec ( NewRun , nPlayer , 0xA0000 ) ;
2020-10-13 22:19:39 +00:00
}
2019-08-26 03:59:14 +00:00
2020-10-13 22:19:39 +00:00
BuildRa ( nPlayer ) ;
2019-08-26 03:59:14 +00:00
2020-10-13 22:19:39 +00:00
if ( nPlayer = = nLocalPlayer )
{
RestoreGreenPal ( ) ;
2021-04-13 11:56:01 +00:00
plr - > bPlayerPan = plr - > bLockPan = false ;
2020-10-13 22:19:39 +00:00
}
2019-08-26 03:59:14 +00:00
2021-10-21 19:20:54 +00:00
plr - > ototalvel = plr - > totalvel = 0 ;
2019-08-26 03:59:14 +00:00
2020-10-13 22:19:39 +00:00
memset ( & sPlayerInput [ nPlayer ] , 0 , sizeof ( PlayerInput ) ) ;
sPlayerInput [ nPlayer ] . nItem = - 1 ;
2019-08-26 03:59:14 +00:00
2021-10-21 19:20:54 +00:00
plr - > nDeathType = 0 ;
2020-10-13 22:19:39 +00:00
nQuake [ nPlayer ] = 0 ;
2019-08-26 03:59:14 +00:00
}
2021-01-19 08:44:16 +00:00
2019-08-26 03:59:14 +00:00
int GrabPlayer ( )
{
2019-08-31 07:47:15 +00:00
if ( PlayerCount > = kMaxPlayers ) {
return - 1 ;
}
2019-08-26 03:59:14 +00:00
2019-08-31 07:47:15 +00:00
return PlayerCount + + ;
2019-08-26 03:59:14 +00:00
}
void StartDeathSeq ( int nPlayer , int nVal )
{
2019-08-31 07:47:15 +00:00
FreeRa ( nPlayer ) ;
2021-12-26 07:47:54 +00:00
auto pActor = PlayerList [ nPlayer ] . pActor ;
2019-08-31 07:47:15 +00:00
PlayerList [ nPlayer ] . nHealth = 0 ;
2021-12-30 15:51:56 +00:00
int nLotag = pActor - > sector ( ) - > lotag ;
2019-08-31 07:47:15 +00:00
if ( nLotag > 0 ) {
2021-10-28 16:57:50 +00:00
runlist_SignalRun ( nLotag - 1 , nPlayer , & ExhumedAI : : EnterSector ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-21 17:44:53 +00:00
if ( PlayerList [ nPlayer ] . pPlayerGrenade )
2019-08-31 07:47:15 +00:00
{
ThrowGrenade ( nPlayer , 0 , 0 , 0 , - 10000 ) ;
}
else
{
if ( nNetPlayerCount )
{
int nWeapon = PlayerList [ nPlayer ] . nCurrentWeapon ;
if ( nWeapon > kWeaponSword & & nWeapon < = kWeaponRing )
{
2021-12-30 15:51:56 +00:00
auto pSector = pActor - > sector ( ) ;
2021-11-22 22:05:48 +00:00
if ( pSector - > pBelow ! = nullptr ) {
pSector = pSector - > pBelow ;
2019-08-31 07:47:15 +00:00
}
2021-09-17 13:33:07 +00:00
auto pGunActor = GrabBodyGunSprite ( ) ;
2021-11-22 22:05:48 +00:00
ChangeActorSect ( pGunActor , pSector ) ;
2019-08-31 07:47:15 +00:00
2022-10-05 15:38:44 +00:00
pGunActor - > spr . pos = { pActor - > spr . pos . X , pActor - > spr . pos . Y , pSector - > floorz - 2 } ;
2019-08-31 07:47:15 +00:00
2021-09-17 13:33:07 +00:00
ChangeActorStat ( pGunActor , nGunLotag [ nWeapon ] + 900 ) ;
2019-08-31 07:47:15 +00:00
2021-12-23 18:01:43 +00:00
pGunActor - > spr . picnum = nGunPicnum [ nWeapon ] ;
2019-08-31 07:47:15 +00:00
2021-10-21 07:50:00 +00:00
BuildItemAnim ( pGunActor ) ;
2019-08-31 07:47:15 +00:00
}
}
}
StopFiringWeapon ( nPlayer ) ;
2020-10-07 06:40:59 +00:00
PlayerList [ nPlayer ] . horizon . ohoriz = PlayerList [ nPlayer ] . horizon . horiz = q16horiz ( 0 ) ;
2022-09-07 05:25:34 +00:00
PlayerList [ nPlayer ] . oeyelevel = PlayerList [ nPlayer ] . eyelevel = - 55 ;
2021-05-13 17:15:53 +00:00
PlayerList [ nPlayer ] . nInvisible = 0 ;
2019-08-31 07:47:15 +00:00
dVertPan [ nPlayer ] = 15 ;
2021-12-23 21:51:26 +00:00
pActor - > spr . cstat & = ~ CSTAT_SPRITE_INVISIBLE ;
2019-08-31 07:47:15 +00:00
SetNewWeaponImmediate ( nPlayer , - 2 ) ;
2021-12-30 15:51:56 +00:00
if ( pActor - > sector ( ) - > Damage < = 0 )
2019-08-31 07:47:15 +00:00
{
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nDeathType = nVal ;
2019-08-31 07:47:15 +00:00
}
else
{
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nDeathType = 2 ;
2019-08-31 07:47:15 +00:00
}
nVal * = 2 ;
2021-12-30 15:51:56 +00:00
if ( nVal | | ! ( pActor - > sector ( ) - > Flag & kSectUnderwater ) )
2019-08-31 07:47:15 +00:00
{
PlayerList [ nPlayer ] . nAction = nVal + 17 ;
}
else {
PlayerList [ nPlayer ] . nAction = 16 ;
}
2021-11-21 18:33:51 +00:00
PlayerList [ nPlayer ] . nSeqSize = 0 ;
2019-08-31 07:47:15 +00:00
2021-12-23 16:05:32 +00:00
pActor - > spr . cstat & = ~ CSTAT_SPRITE_BLOCK_ALL ;
2019-11-20 16:21:32 +00:00
2019-08-31 07:47:15 +00:00
if ( nTotalPlayers = = 1 )
{
2021-05-02 13:54:19 +00:00
if ( ! ( currentLevel - > gameflags & LEVEL_EX_TRAINING ) ) { // if not on the training level
2021-05-13 17:06:38 +00:00
PlayerList [ nPlayer ] . nLives - - ;
2019-08-31 07:47:15 +00:00
}
2021-05-13 17:06:38 +00:00
if ( PlayerList [ nPlayer ] . nLives < 0 ) {
PlayerList [ nPlayer ] . nLives = 0 ;
2019-08-31 07:47:15 +00:00
}
}
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . ototalvel = PlayerList [ nPlayer ] . totalvel = 0 ;
2019-08-26 03:59:14 +00:00
}
int AddAmmo ( int nPlayer , int nWeapon , int nAmmoAmount )
{
2019-08-31 07:47:15 +00:00
if ( ! nAmmoAmount ) {
nAmmoAmount = 1 ;
}
2021-11-21 19:48:11 +00:00
int nCurAmmo = PlayerList [ nPlayer ] . nAmmo [ nWeapon ] ;
2019-08-31 07:47:15 +00:00
if ( nCurAmmo > = 300 & & nAmmoAmount > 0 ) {
return 0 ;
}
nAmmoAmount = nCurAmmo + nAmmoAmount ;
if ( nAmmoAmount > 300 ) {
nAmmoAmount = 300 ;
}
PlayerList [ nPlayer ] . nAmmo [ nWeapon ] = nAmmoAmount ;
if ( nWeapon = = 1 )
{
2021-10-21 10:51:16 +00:00
if ( ! PlayerList [ nPlayer ] . nPistolClip ) {
PlayerList [ nPlayer ] . nPistolClip = 6 ;
2019-08-31 07:47:15 +00:00
}
}
return 1 ;
2019-08-26 03:59:14 +00:00
}
void SetPlayerMummified ( int nPlayer , int bIsMummified )
{
2021-12-07 17:53:02 +00:00
DExhumedActor * pActor = PlayerList [ nPlayer ] . pActor ;
2019-08-26 03:59:14 +00:00
2022-09-03 08:02:25 +00:00
pActor - > vel . Y = 0 ;
pActor - > vel . X = 0 ;
2019-08-26 03:59:14 +00:00
2019-08-31 07:47:15 +00:00
PlayerList [ nPlayer ] . bIsMummified = bIsMummified ;
2019-08-26 03:59:14 +00:00
2019-08-31 07:47:15 +00:00
if ( bIsMummified )
{
PlayerList [ nPlayer ] . nAction = 13 ;
PlayerList [ nPlayer ] . nSeq = kSeqMummy ;
}
else
{
PlayerList [ nPlayer ] . nAction = 0 ;
PlayerList [ nPlayer ] . nSeq = kSeqJoe ;
}
2019-08-26 03:59:14 +00:00
2021-11-21 18:33:51 +00:00
PlayerList [ nPlayer ] . nSeqSize = 0 ;
2019-08-26 03:59:14 +00:00
}
void ShootStaff ( int nPlayer )
{
2019-08-31 07:47:15 +00:00
PlayerList [ nPlayer ] . nAction = 15 ;
2021-11-21 18:33:51 +00:00
PlayerList [ nPlayer ] . nSeqSize = 0 ;
2019-08-31 07:47:15 +00:00
PlayerList [ nPlayer ] . nSeq = kSeqJoe ;
2019-08-26 03:59:14 +00:00
}
2019-08-31 07:47:15 +00:00
void PlayAlert ( const char * str )
2019-08-26 03:59:14 +00:00
{
2019-08-31 07:47:15 +00:00
StatusMessage ( 300 , str ) ;
PlayLocalSound ( StaticSound [ kSound63 ] , 0 ) ;
2019-08-26 03:59:14 +00:00
}
2020-08-22 18:14:00 +00:00
static void pickupMessage ( int no )
{
no = nItemText [ no ] ;
if ( no ! = - 1 )
{
FStringf label ( " TXT_EX_PICKUP%d " , no + 1 ) ;
auto str = GStrings [ label ] ;
if ( str ) Printf ( PRINT_NOTIFY , " %s \n " , str ) ;
}
}
2020-09-21 10:37:09 +00:00
void UpdatePlayerSpriteAngle ( Player * pPlayer )
{
2022-09-07 07:48:05 +00:00
inita = pPlayer - > angle . ang ;
if ( pPlayer - > pActor ) pPlayer - > pActor - > spr . angle = inita ;
2020-09-21 10:37:09 +00:00
}
2021-10-15 20:19:07 +00:00
void AIPlayer : : Draw ( RunListEvent * ev )
2019-08-26 03:59:14 +00:00
{
2021-11-16 17:50:02 +00:00
int nPlayer = RunData [ ev - > nRun ] . nObjIndex ;
2021-10-15 20:19:07 +00:00
assert ( nPlayer > = 0 & & nPlayer < kMaxPlayers ) ;
2021-11-21 19:48:11 +00:00
int nAction = PlayerList [ nPlayer ] . nAction ;
2021-10-15 20:19:07 +00:00
2021-11-21 18:33:51 +00:00
seq_PlotSequence ( ev - > nParam , SeqOffsets [ PlayerList [ nPlayer ] . nSeq ] + PlayerSeq [ nAction ] . a , PlayerList [ nPlayer ] . nSeqSize , PlayerSeq [ nAction ] . b ) ;
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
void AIPlayer : : RadialDamage ( RunListEvent * ev )
{
2021-11-16 17:50:02 +00:00
int nPlayer = RunData [ ev - > nRun ] . nObjIndex ;
2019-08-31 07:47:15 +00:00
assert ( nPlayer > = 0 & & nPlayer < kMaxPlayers ) ;
2021-12-26 07:47:54 +00:00
auto pPlayerActor = PlayerList [ nPlayer ] . pActor ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( PlayerList [ nPlayer ] . nHealth < = 0 )
{
return ;
}
2019-08-31 07:47:15 +00:00
2021-10-21 20:39:17 +00:00
ev - > nDamage = runlist_CheckRadialDamage ( pPlayerActor ) ;
2021-10-15 20:19:07 +00:00
Damage ( ev ) ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
void AIPlayer : : Damage ( RunListEvent * ev )
{
int nDamage = ev - > nDamage ;
2021-11-16 17:50:02 +00:00
int nPlayer = RunData [ ev - > nRun ] . nObjIndex ;
2021-12-26 07:47:54 +00:00
auto pPlayerActor = PlayerList [ nPlayer ] . pActor ;
2021-11-21 19:48:11 +00:00
int nAction = PlayerList [ nPlayer ] . nAction ;
2021-12-07 17:53:02 +00:00
DExhumedActor * pDopple = PlayerList [ nPlayer ] . pDoppleSprite ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( ! nDamage ) {
return ;
}
2019-11-03 17:20:05 +00:00
2021-12-07 17:53:02 +00:00
DExhumedActor * pActor2 = ( ! ev - > isRadialEvent ( ) ) ? ev - > pOtherActor : ev - > pRadialActor - > pTarget . Get ( ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// ok continue case 0x80000 as normal, loc_1C57C
if ( ! PlayerList [ nPlayer ] . nHealth ) {
return ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( ! PlayerList [ nPlayer ] . invincibility )
{
PlayerList [ nPlayer ] . nHealth - = nDamage ;
if ( nPlayer = = nLocalPlayer )
{
TintPalette ( nDamage , 0 , 0 ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( PlayerList [ nPlayer ] . nHealth > 0 )
{
if ( nDamage > 40 | | ( totalmoves & 0xF ) < 2 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
if ( PlayerList [ nPlayer ] . invincibility ) {
2019-08-31 07:47:15 +00:00
return ;
}
2021-12-30 15:51:56 +00:00
if ( pPlayerActor - > sector ( ) - > Flag & kSectUnderwater )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
if ( nAction ! = 12 )
2019-08-31 07:47:15 +00:00
{
2021-11-21 18:33:51 +00:00
PlayerList [ nPlayer ] . nSeqSize = 0 ;
2021-10-15 20:19:07 +00:00
PlayerList [ nPlayer ] . nAction = 12 ;
return ;
2019-08-31 07:47:15 +00:00
}
}
2021-10-15 20:19:07 +00:00
else
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
if ( nAction ! = 4 )
2019-08-31 07:47:15 +00:00
{
2021-11-21 18:33:51 +00:00
PlayerList [ nPlayer ] . nSeqSize = 0 ;
2021-10-15 20:19:07 +00:00
PlayerList [ nPlayer ] . nAction = 4 ;
2019-08-31 07:47:15 +00:00
2021-10-21 16:22:14 +00:00
if ( pActor2 )
2019-08-31 07:47:15 +00:00
{
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nPlayerSwear - - ;
if ( PlayerList [ nPlayer ] . nPlayerSwear < = 0 )
2019-08-31 07:47:15 +00:00
{
2021-10-21 17:54:39 +00:00
D3PlayFX ( StaticSound [ kSound52 ] , pDopple ) ;
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nPlayerSwear = RandomSize ( 3 ) + 4 ;
2019-08-31 07:47:15 +00:00
}
}
}
2021-10-15 20:19:07 +00:00
}
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
return ;
}
else
{
// player has died
2021-12-21 22:18:23 +00:00
if ( pActor2 & & pActor2 - > spr . statnum = = 100 )
2021-10-15 20:19:07 +00:00
{
2021-11-21 19:48:11 +00:00
int nPlayer2 = GetPlayerFromActor ( pActor2 ) ;
2021-10-15 20:19:07 +00:00
if ( nPlayer2 = = nPlayer ) // player caused their own death
{
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nPlayerScore - - ;
2019-08-31 07:47:15 +00:00
}
else
{
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nPlayerScore + + ;
2021-10-15 20:19:07 +00:00
}
}
2021-10-21 16:22:14 +00:00
else if ( pActor2 = = nullptr )
2021-10-15 20:19:07 +00:00
{
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nPlayerScore - - ;
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-28 16:08:03 +00:00
if ( ev - > isRadialEvent ( ) )
2021-10-15 20:19:07 +00:00
{
for ( int i = 122 ; i < = 131 ; i + + )
{
2021-10-21 19:10:17 +00:00
BuildCreatureChunk ( pPlayerActor , seq_GetSeqPicnum ( kSeqJoe , i , 0 ) ) ;
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
StartDeathSeq ( nPlayer , 1 ) ;
}
else
{
StartDeathSeq ( nPlayer , 0 ) ;
}
}
}
2019-08-31 07:47:15 +00:00
2022-09-10 08:55:19 +00:00
bool CheckMovingBlocks ( int nPlayer , Collision & nMove , DVector3 & spr_pos , sectortype * spr_sect )
{
auto pPlayerActor = PlayerList [ nPlayer ] . pActor ;
int const z = ( pPlayerActor - > int_zvel ( ) * 4 ) > > 2 ;
if ( nMove . type = = kHitSector | | nMove . type = = kHitWall )
{
sectortype * sect ;
int nNormal = 0 ;
if ( nMove . type = = kHitSector )
{
sect = nMove . hitSector ;
// Hm... Normal calculation here was broken.
}
else //if (nMove.type == kHitWall)
{
sect = nMove . hitWall - > nextSector ( ) ;
nNormal = GetWallNormal ( nMove . hitWall ) ;
}
// moving blocks - move this to a separate function!
if ( sect ! = nullptr )
{
if ( ( sect - > hitag = = 45 ) & & bTouchFloor )
{
int nDiff = AngleDiff ( DAngle : : fromBuild ( nNormal ) , DAngle : : fromBuild ( ( pPlayerActor - > int_ang ( ) + 1024 ) & kAngleMask ) ) ;
if ( nDiff < 0 ) {
nDiff = - nDiff ;
}
if ( nDiff < = 256 )
{
PlayerList [ nPlayer ] . pPlayerPushSect = sect ;
2022-09-10 11:29:42 +00:00
DVector2 vel ( FixedToFloat < 18 > ( sPlayerInput [ nPlayer ] . xVel ) , FixedToFloat < 18 > ( sPlayerInput [ nPlayer ] . yVel ) ) ;
auto nMyAngle = VecToAngle ( vel ) . Normalized360 ( ) ;
2022-09-10 08:55:19 +00:00
setsectinterpolate ( sect ) ;
2022-09-10 11:29:42 +00:00
MoveSector ( sect , nMyAngle , vel ) ;
2022-09-10 08:55:19 +00:00
if ( PlayerList [ nPlayer ] . nPlayerPushSound < = - 1 )
{
PlayerList [ nPlayer ] . nPlayerPushSound = 1 ;
int nBlock = PlayerList [ nPlayer ] . pPlayerPushSect - > extra ;
DExhumedActor * pBlockActor = sBlockInfo [ nBlock ] . pActor ;
D3PlayFX ( StaticSound [ kSound23 ] , pBlockActor , 0x4000 ) ;
}
else
{
pPlayerActor - > spr . pos = spr_pos ;
ChangeActorSect ( pPlayerActor , spr_sect ) ;
}
2022-09-10 11:29:42 +00:00
movesprite ( pPlayerActor , FloatToFixed < 18 > ( vel . X ) , FloatToFixed < 18 > ( vel . Y ) , z , 5120 , - 5120 , CLIPMASK0 ) ;
2022-09-10 08:55:19 +00:00
return true ;
}
}
}
}
return false ;
}
2021-10-15 20:19:07 +00:00
void AIPlayer : : Tick ( RunListEvent * ev )
{
int var_48 = 0 ;
int var_40 ;
bool mplevel = ( currentLevel - > gameflags & LEVEL_EX_MULTI ) ;
2021-11-16 17:50:02 +00:00
int nPlayer = RunData [ ev - > nRun ] . nObjIndex ;
2021-10-15 20:19:07 +00:00
assert ( nPlayer > = 0 & & nPlayer < kMaxPlayers ) ;
2021-12-26 07:47:54 +00:00
auto pPlayerActor = PlayerList [ nPlayer ] . pActor ;
2021-10-15 20:19:07 +00:00
2021-12-07 17:53:02 +00:00
DExhumedActor * pDopple = PlayerList [ nPlayer ] . pDoppleSprite ;
2021-10-15 20:19:07 +00:00
2021-11-21 19:48:11 +00:00
int nAction = PlayerList [ nPlayer ] . nAction ;
int nActionB = PlayerList [ nPlayer ] . nAction ;
2021-10-15 20:19:07 +00:00
PlayerList [ nPlayer ] . angle . backup ( ) ;
PlayerList [ nPlayer ] . horizon . backup ( ) ;
PlayerList [ nPlayer ] . angle . resetadjustment ( ) ;
PlayerList [ nPlayer ] . horizon . resetadjustment ( ) ;
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . oeyelevel = PlayerList [ nPlayer ] . eyelevel ;
2021-10-15 20:19:07 +00:00
2022-09-09 17:24:25 +00:00
pPlayerActor - > vel . X = FixedToFloat < 18 > ( sPlayerInput [ nPlayer ] . xVel ) ;
pPlayerActor - > vel . Y = FixedToFloat < 18 > ( sPlayerInput [ nPlayer ] . yVel ) ;
2021-10-15 20:19:07 +00:00
if ( sPlayerInput [ nPlayer ] . nItem > - 1 )
{
UseItem ( nPlayer , sPlayerInput [ nPlayer ] . nItem ) ;
sPlayerInput [ nPlayer ] . nItem = - 1 ;
}
2021-12-24 09:48:35 +00:00
pPlayerActor - > spr . picnum = seq_GetSeqPicnum ( PlayerList [ nPlayer ] . nSeq , PlayerSeq [ nHeightTemplate [ nAction ] ] . a , PlayerList [ nPlayer ] . nSeqSize ) ;
2021-12-23 18:01:43 +00:00
pDopple - > spr . picnum = pPlayerActor - > spr . picnum ;
2021-10-15 20:19:07 +00:00
if ( PlayerList [ nPlayer ] . nTorch > 0 )
{
PlayerList [ nPlayer ] . nTorch - - ;
if ( PlayerList [ nPlayer ] . nTorch = = 0 )
{
SetTorch ( nPlayer , 0 ) ;
}
else
{
if ( nPlayer ! = nLocalPlayer )
{
nFlashDepth = 5 ;
2022-08-20 14:19:07 +00:00
AddFlash ( pPlayerActor - > sector ( ) , pPlayerActor - > spr . pos , 0 ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
}
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( PlayerList [ nPlayer ] . nDouble > 0 )
{
PlayerList [ nPlayer ] . nDouble - - ;
if ( PlayerList [ nPlayer ] . nDouble = = 150 & & nPlayer = = nLocalPlayer ) {
2022-08-15 14:07:45 +00:00
PlayAlert ( GStrings ( " TXT_EX_WEAPONEX " ) ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( PlayerList [ nPlayer ] . nInvisible > 0 )
{
PlayerList [ nPlayer ] . nInvisible - - ;
if ( PlayerList [ nPlayer ] . nInvisible = = 0 )
2019-08-31 07:47:15 +00:00
{
2021-12-23 21:51:26 +00:00
pPlayerActor - > spr . cstat & = ~ CSTAT_SPRITE_INVISIBLE ; // set visible
2021-12-07 17:53:02 +00:00
DExhumedActor * pFloorSprite = PlayerList [ nPlayer ] . pPlayerFloorSprite ;
2019-08-31 07:47:15 +00:00
2021-10-21 17:44:53 +00:00
if ( pFloorSprite ! = nullptr ) {
2021-12-23 21:51:26 +00:00
pFloorSprite - > spr . cstat & = ~ CSTAT_SPRITE_INVISIBLE ; // set visible
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
}
else if ( PlayerList [ nPlayer ] . nInvisible = = 150 & & nPlayer = = nLocalPlayer )
{
2022-08-15 14:07:45 +00:00
PlayAlert ( GStrings ( " TXT_EX_INVISEX " ) ) ;
2021-10-15 20:19:07 +00:00
}
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( PlayerList [ nPlayer ] . invincibility > 0 )
{
PlayerList [ nPlayer ] . invincibility - - ;
if ( PlayerList [ nPlayer ] . invincibility = = 150 & & nPlayer = = nLocalPlayer ) {
2022-08-15 14:07:45 +00:00
PlayAlert ( GStrings ( " TXT_EX_INVINCEX " ) ) ;
2021-10-15 20:19:07 +00:00
}
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( nQuake [ nPlayer ] ! = 0 )
{
nQuake [ nPlayer ] = - nQuake [ nPlayer ] ;
if ( nQuake [ nPlayer ] > 0 )
{
2022-09-07 07:58:41 +00:00
nQuake [ nPlayer ] - = 2. ;
2021-10-15 20:19:07 +00:00
if ( nQuake [ nPlayer ] < 0 )
nQuake [ nPlayer ] = 0 ;
}
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// loc_1A494:
if ( SyncInput ( ) )
{
Player * pPlayer = & PlayerList [ nPlayer ] ;
pPlayer - > angle . applyinput ( sPlayerInput [ nPlayer ] . nAngle , & sPlayerInput [ nLocalPlayer ] . actions ) ;
UpdatePlayerSpriteAngle ( pPlayer ) ;
}
2019-08-31 07:47:15 +00:00
2022-08-31 22:40:58 +00:00
// player.zvel is modified within Gravity()
2022-09-09 17:29:11 +00:00
double zVel = pPlayerActor - > vel . Z ;
2019-08-31 07:47:15 +00:00
2021-10-20 21:02:23 +00:00
Gravity ( pPlayerActor ) ;
2019-08-31 07:47:15 +00:00
2022-09-09 17:29:11 +00:00
if ( pPlayerActor - > vel . Z > = 6500 / 256. & & zVel < 6500 / 256. )
2021-10-15 20:19:07 +00:00
{
2021-10-21 20:39:17 +00:00
D3PlayFX ( StaticSound [ kSound17 ] , pPlayerActor ) ;
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// loc_1A4E6
2021-12-30 15:51:56 +00:00
auto pSector = pPlayerActor - > sector ( ) ;
2021-11-22 23:20:15 +00:00
int nSectFlag = PlayerList [ nPlayer ] . pPlayerViewSect - > Flag ;
2019-08-31 07:47:15 +00:00
2022-09-10 15:05:16 +00:00
auto playerPos = pPlayerActor - > spr . pos . XY ( ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
int x = ( sPlayerInput [ nPlayer ] . xVel * 4 ) > > 2 ;
int y = ( sPlayerInput [ nPlayer ] . yVel * 4 ) > > 2 ;
2022-09-10 08:55:19 +00:00
int const z = ( pPlayerActor - > int_zvel ( ) * 4 ) > > 2 ;
2019-08-31 07:47:15 +00:00
2022-09-03 08:03:30 +00:00
if ( pPlayerActor - > vel . Z > 32 )
2022-09-09 17:29:11 +00:00
pPlayerActor - > vel . Z = 32 ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( PlayerList [ nPlayer ] . bIsMummified )
{
x / = 2 ;
y / = 2 ;
}
2019-08-31 07:47:15 +00:00
2022-08-20 14:29:57 +00:00
auto spr_pos = pPlayerActor - > spr . pos ;
2021-12-30 15:51:56 +00:00
auto spr_sect = pPlayerActor - > sector ( ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// TODO
// nSectFlag & kSectUnderwater;
2019-08-31 07:47:15 +00:00
2022-09-09 17:29:11 +00:00
zVel = pPlayerActor - > vel . Z ;
2019-08-31 07:47:15 +00:00
2021-11-26 13:26:03 +00:00
Collision nMove ;
nMove . setNone ( ) ;
2021-10-15 20:19:07 +00:00
if ( bSlipMode )
{
2022-01-31 22:33:06 +00:00
pPlayerActor - > add_int_pos ( { ( x > > 14 ) , ( y > > 14 ) , 0 } ) ;
2021-10-15 20:19:07 +00:00
2022-08-22 21:57:39 +00:00
SetActor ( pPlayerActor , pPlayerActor - > spr . pos ) ;
2022-08-20 14:44:30 +00:00
pPlayerActor - > spr . pos . Z = pPlayerActor - > sector ( ) - > floorz ;
2021-10-15 20:19:07 +00:00
}
else
{
2021-10-21 18:25:15 +00:00
nMove = movesprite ( pPlayerActor , x , y , z , 5120 , - 5120 , CLIPMASK0 ) ;
2019-08-31 07:47:15 +00:00
2021-12-30 15:51:56 +00:00
auto pPlayerSect = pPlayerActor - > sector ( ) ;
2019-08-31 07:47:15 +00:00
2022-09-09 16:07:44 +00:00
pushmove ( pPlayerActor , & pPlayerSect , pPlayerActor - > int_clipdist ( ) , 5120 , - 5120 , CLIPMASK0 ) ;
2021-12-30 15:51:56 +00:00
if ( pPlayerSect ! = pPlayerActor - > sector ( ) ) {
2021-11-23 00:07:47 +00:00
ChangeActorSect ( pPlayerActor , pPlayerSect ) ;
2021-10-15 20:19:07 +00:00
}
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// loc_1A6E4
2022-09-10 15:05:16 +00:00
if ( inside ( pPlayerActor - > spr . pos . X , pPlayerActor - > spr . pos . Y , pPlayerActor - > sector ( ) ) ! = 1 )
2021-10-15 20:19:07 +00:00
{
2021-11-23 00:07:47 +00:00
ChangeActorSect ( pPlayerActor , spr_sect ) ;
2019-08-31 07:47:15 +00:00
2022-08-20 14:29:57 +00:00
pPlayerActor - > spr . pos . XY ( ) = spr_pos . XY ( ) ;
2019-08-31 07:47:15 +00:00
2022-09-09 17:29:11 +00:00
if ( zVel < pPlayerActor - > vel . Z ) {
pPlayerActor - > vel . Z = zVel ;
2021-10-15 20:19:07 +00:00
}
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// int _bTouchFloor = bTouchFloor;
2021-12-30 15:51:56 +00:00
int bUnderwater = pPlayerActor - > sector ( ) - > Flag & kSectUnderwater ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( bUnderwater )
{
2022-09-09 20:59:16 +00:00
PlayerList [ nPlayer ] . nThrust / = 2 ;
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// Trigger Ramses?
2021-12-30 15:51:56 +00:00
if ( ( pPlayerActor - > sector ( ) - > Flag & 0x8000 ) & & bTouchFloor )
2021-10-15 20:19:07 +00:00
{
if ( nTotalPlayers < = 1 )
{
2021-10-21 22:08:40 +00:00
auto ang = GetAngleToSprite ( pPlayerActor , pSpiritSprite ) & kAngleMask ;
2022-08-27 12:20:38 +00:00
PlayerList [ nPlayer ] . angle . settarget ( DAngle : : fromBuild ( ang ) , true ) ;
2022-08-16 21:21:10 +00:00
pPlayerActor - > set_int_ang ( ang ) ;
2019-08-31 07:47:15 +00:00
2022-06-06 08:41:45 +00:00
PlayerList [ nPlayer ] . horizon . settarget ( buildhoriz ( 0 ) , true ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
lPlayerXVel = 0 ;
lPlayerYVel = 0 ;
2019-08-31 07:47:15 +00:00
2022-09-03 08:02:25 +00:00
pPlayerActor - > vel . X = 0 ;
pPlayerActor - > vel . Y = 0 ;
pPlayerActor - > vel . Z = 0 ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( nFreeze < 1 )
{
nFreeze = 1 ;
StopAllSounds ( ) ;
StopLocalSound ( ) ;
InitSpiritHead ( ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
PlayerList [ nPlayer ] . nDestVertPan = q16horiz ( 0 ) ;
2022-05-30 10:35:41 +00:00
PlayerList [ nPlayer ] . horizon . settarget ( buildhoriz ( currentLevel - > ex_ramses_horiz ) ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
}
else
{
LevelFinished ( ) ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
return ;
}
2021-10-21 18:25:15 +00:00
if ( nMove . type | | nMove . exbits )
2021-10-15 20:19:07 +00:00
{
if ( bTouchFloor )
{
// Damage stuff..
2022-09-09 20:59:16 +00:00
PlayerList [ nPlayer ] . nThrust / = 2 ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( nPlayer = = nLocalPlayer )
2019-08-31 07:47:15 +00:00
{
2022-09-09 17:29:11 +00:00
double zVelB = zVel ;
2021-10-15 20:19:07 +00:00
if ( zVelB < 0 ) {
zVelB = - zVelB ;
}
2022-09-09 17:29:11 +00:00
if ( zVelB > 2 & & ! PlayerList [ nPlayer ] . horizon . horiz . asq16 ( ) & & cl_slopetilting ) {
2021-10-15 20:19:07 +00:00
PlayerList [ nPlayer ] . nDestVertPan = q16horiz ( 0 ) ;
}
2019-08-31 07:47:15 +00:00
}
2022-09-09 17:29:11 +00:00
if ( zVel > = 6500 / 256. )
2019-08-31 07:47:15 +00:00
{
2022-09-03 08:04:16 +00:00
pPlayerActor - > vel . XY ( ) * = 0.25 ;
2019-08-31 07:47:15 +00:00
2022-09-09 17:29:11 +00:00
runlist_DamageEnemy ( pPlayerActor , nullptr , ( ( int ( zVel * 256 ) - 6500 ) > > 7 ) + 10 ) ;
2019-11-20 16:21:32 +00:00
2021-10-15 20:19:07 +00:00
if ( PlayerList [ nPlayer ] . nHealth < = 0 )
{
2022-09-03 08:02:25 +00:00
pPlayerActor - > vel . X = 0 ;
pPlayerActor - > vel . Y = 0 ;
2019-11-20 16:21:32 +00:00
2021-10-21 20:39:17 +00:00
StopActorSound ( pPlayerActor ) ;
2022-08-20 15:52:06 +00:00
PlayFXAtXYZ ( StaticSound [ kSoundJonFDie ] , pPlayerActor - > spr . pos , CHANF_NONE , 1 ) ; // CHECKME
2019-08-31 07:47:15 +00:00
}
else
{
2021-10-21 20:39:17 +00:00
D3PlayFX ( StaticSound [ kSound27 ] | 0x2000 , pPlayerActor ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
}
}
2019-08-31 07:47:15 +00:00
2022-09-10 08:55:19 +00:00
if ( CheckMovingBlocks ( nPlayer , nMove , spr_pos , spr_sect ) )
goto sectdone ;
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// loc_1AB46:
2021-10-21 10:51:16 +00:00
if ( PlayerList [ nPlayer ] . nPlayerPushSound > - 1 )
2021-10-15 20:19:07 +00:00
{
2021-11-22 20:09:24 +00:00
if ( PlayerList [ nPlayer ] . pPlayerPushSect ! = nullptr )
2021-10-15 20:19:07 +00:00
{
2021-11-22 20:09:24 +00:00
StopActorSound ( sBlockInfo [ PlayerList [ nPlayer ] . pPlayerPushSect - > extra ] . pActor ) ;
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nPlayerPushSound = - 1 ;
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
sectdone :
if ( ! PlayerList [ nPlayer ] . bPlayerPan & & ! PlayerList [ nPlayer ] . bLockPan )
{
2022-09-10 15:05:16 +00:00
PlayerList [ nPlayer ] . nDestVertPan = q16horiz ( clamp ( ( int ( ( spr_pos . Z - pPlayerActor - > spr . pos . Z ) * zworldtoint ) ) < < 9 , gi - > playerHorizMin ( ) , gi - > playerHorizMax ( ) ) ) ;
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2022-09-10 15:05:16 +00:00
playerPos - = pPlayerActor - > spr . pos . XY ( ) ;
2019-08-31 07:47:15 +00:00
2019-11-20 16:21:32 +00:00
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . ototalvel = PlayerList [ nPlayer ] . totalvel ;
2022-09-10 15:05:16 +00:00
PlayerList [ nPlayer ] . totalvel = playerPos . Length ( ) * worldtoint ;
2019-08-31 07:47:15 +00:00
2021-12-30 15:51:56 +00:00
auto pViewSect = pPlayerActor - > sector ( ) ;
2019-08-31 07:47:15 +00:00
2022-09-07 07:58:41 +00:00
double EyeZ = PlayerList [ nPlayer ] . eyelevel + pPlayerActor - > spr . pos . Z + nQuake [ nPlayer ] ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
while ( 1 )
{
2022-09-07 05:25:34 +00:00
double nCeilZ = pViewSect - > ceilingz ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( EyeZ > = nCeilZ )
break ;
2019-08-31 07:47:15 +00:00
2021-11-22 22:05:48 +00:00
if ( pViewSect - > pAbove = = nullptr )
2021-10-15 20:19:07 +00:00
break ;
2019-08-26 03:59:14 +00:00
2021-11-22 22:05:48 +00:00
pViewSect = pViewSect - > pAbove ;
2021-10-15 20:19:07 +00:00
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
// Do underwater sector check
if ( bUnderwater )
{
2021-12-30 15:51:56 +00:00
if ( pViewSect ! = pPlayerActor - > sector ( ) )
2021-10-15 20:19:07 +00:00
{
2021-10-21 18:25:15 +00:00
if ( nMove . type = = kHitWall )
2021-01-05 00:01:31 +00:00
{
2022-08-20 14:29:57 +00:00
auto pos = pPlayerActor - > spr . pos ;
2021-01-05 00:01:31 +00:00
2021-11-22 22:05:48 +00:00
ChangeActorSect ( pPlayerActor , pViewSect ) ;
2019-08-31 07:47:15 +00:00
2020-06-22 10:24:21 +00:00
2022-08-20 14:29:57 +00:00
double fz = pViewSect - > floorz - 20 ;
pPlayerActor - > spr . pos = DVector3 ( spr_pos . XY ( ) , fz ) ;
2019-08-31 07:47:15 +00:00
2021-10-21 18:25:15 +00:00
auto coll = movesprite ( pPlayerActor , x , y , 0 , 5120 , 0 , CLIPMASK0 ) ;
if ( coll . type = = kHitWall )
2021-10-15 20:19:07 +00:00
{
2021-12-30 15:51:56 +00:00
ChangeActorSect ( pPlayerActor , pPlayerActor - > sector ( ) ) ;
2022-08-20 14:29:57 +00:00
pPlayerActor - > spr . pos = pos ;
2021-10-15 20:19:07 +00:00
}
else
{
2022-08-20 14:29:57 +00:00
pPlayerActor - > spr . pos . Z = fz - 1 ;
2021-10-21 18:25:15 +00:00
D3PlayFX ( StaticSound [ kSound42 ] , pPlayerActor ) ;
2021-10-15 20:19:07 +00:00
}
}
}
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// loc_1ADAF
2021-11-22 23:20:15 +00:00
PlayerList [ nPlayer ] . pPlayerViewSect = pViewSect ;
2019-08-31 07:47:15 +00:00
2022-08-20 14:29:57 +00:00
PlayerList [ nPlayer ] . nPlayerD . X = int ( ( pPlayerActor - > spr . pos . X - spr_pos . X ) * worldtoint ) ;
PlayerList [ nPlayer ] . nPlayerD . Y = int ( ( pPlayerActor - > spr . pos . Y - spr_pos . Y ) * worldtoint ) ;
2019-08-31 07:47:15 +00:00
2021-11-22 22:05:48 +00:00
int var_5C = pViewSect - > Flag & kSectUnderwater ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
auto actions = sPlayerInput [ nPlayer ] . actions ;
// loc_1AEF5:
if ( PlayerList [ nPlayer ] . nHealth > 0 )
{
if ( PlayerList [ nPlayer ] . nMaskAmount > 0 )
{
PlayerList [ nPlayer ] . nMaskAmount - - ;
if ( PlayerList [ nPlayer ] . nMaskAmount = = 150 & & nPlayer = = nLocalPlayer ) {
2022-08-15 14:07:45 +00:00
PlayAlert ( GStrings ( " TXT_EX_MASKEX " ) ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( ! PlayerList [ nPlayer ] . invincibility )
{
// Handle air
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nBreathTimer - - ;
2021-10-15 20:19:07 +00:00
2021-10-21 10:51:16 +00:00
if ( PlayerList [ nPlayer ] . nBreathTimer < = 0 )
2019-08-31 07:47:15 +00:00
{
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nBreathTimer = 90 ;
2021-10-15 20:19:07 +00:00
// if underwater
if ( var_5C )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
if ( PlayerList [ nPlayer ] . nMaskAmount > 0 )
2019-08-31 07:47:15 +00:00
{
2021-10-21 18:25:15 +00:00
D3PlayFX ( StaticSound [ kSound30 ] , pPlayerActor ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
PlayerList [ nPlayer ] . nAir = 100 ;
}
else
{
PlayerList [ nPlayer ] . nAir - = 25 ;
if ( PlayerList [ nPlayer ] . nAir > 0 )
2019-08-31 07:47:15 +00:00
{
2021-10-21 18:25:15 +00:00
D3PlayFX ( StaticSound [ kSound25 ] , pPlayerActor ) ;
2019-08-31 07:47:15 +00:00
}
else
{
2021-10-15 20:19:07 +00:00
PlayerList [ nPlayer ] . nHealth + = ( PlayerList [ nPlayer ] . nAir < < 2 ) ;
if ( PlayerList [ nPlayer ] . nHealth < = 0 )
{
PlayerList [ nPlayer ] . nHealth = 0 ;
StartDeathSeq ( nPlayer , 0 ) ;
}
PlayerList [ nPlayer ] . nAir = 0 ;
if ( PlayerList [ nPlayer ] . nHealth < 300 )
{
2021-10-21 18:25:15 +00:00
D3PlayFX ( StaticSound [ kSound79 ] , pPlayerActor ) ;
2021-10-15 20:19:07 +00:00
}
else
{
2021-10-21 18:25:15 +00:00
D3PlayFX ( StaticSound [ kSound19 ] , pPlayerActor ) ;
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
}
}
2021-10-15 20:19:07 +00:00
DoBubbles ( nPlayer ) ;
2019-08-31 07:47:15 +00:00
}
}
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// loc_1B0B9
if ( var_5C ) // if underwater
{
if ( PlayerList [ nPlayer ] . nTorch > 0 )
{
PlayerList [ nPlayer ] . nTorch = 0 ;
SetTorch ( nPlayer , 0 ) ;
}
}
else
{
2021-12-30 15:51:56 +00:00
auto pTmpSect = pPlayerActor - > sector ( ) ;
2019-08-31 07:47:15 +00:00
2022-08-20 18:25:38 +00:00
if ( PlayerList [ nPlayer ] . totalvel > 25 & & pPlayerActor - > spr . pos . Z > pTmpSect - > floorz )
2019-08-31 07:47:15 +00:00
{
2021-11-20 19:52:29 +00:00
if ( pTmpSect - > Depth & & ! pTmpSect - > Speed & & ! pTmpSect - > Damage )
2019-08-31 07:47:15 +00:00
{
2021-10-21 18:25:15 +00:00
D3PlayFX ( StaticSound [ kSound42 ] , pPlayerActor ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// CHECKME - wrong place?
if ( nSectFlag & kSectUnderwater )
{
if ( PlayerList [ nPlayer ] . nAir < 50 )
2019-08-31 07:47:15 +00:00
{
2021-10-21 18:25:15 +00:00
D3PlayFX ( StaticSound [ kSound14 ] , pPlayerActor ) ;
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nBreathTimer = 1 ;
2021-10-15 20:19:07 +00:00
}
2021-12-30 09:30:21 +00:00
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nBreathTimer - - ;
if ( PlayerList [ nPlayer ] . nBreathTimer < = 0 )
2021-10-15 20:19:07 +00:00
{
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nBreathTimer = 90 ;
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( PlayerList [ nPlayer ] . nAir < 100 )
{
PlayerList [ nPlayer ] . nAir = 100 ;
}
}
2019-10-29 15:17:43 +00:00
2021-10-15 20:19:07 +00:00
// loc_1B1EB
2021-12-07 17:53:02 +00:00
DExhumedActor * pFloorActor = PlayerList [ nPlayer ] . pPlayerFloorSprite ;
2021-10-21 17:44:53 +00:00
if ( nTotalPlayers > 1 & & pFloorActor )
2021-10-15 20:19:07 +00:00
{
2022-08-29 17:27:52 +00:00
pFloorActor - > spr . pos . XY ( ) = pPlayerActor - > spr . pos . XY ( ) ;
2021-10-15 20:19:07 +00:00
2021-12-30 15:51:56 +00:00
if ( pFloorActor - > sector ( ) ! = pPlayerActor - > sector ( ) )
2021-10-15 20:19:07 +00:00
{
2021-12-30 15:51:56 +00:00
ChangeActorSect ( pFloorActor , pPlayerActor - > sector ( ) ) ;
2021-10-15 20:19:07 +00:00
}
2022-08-20 14:44:30 +00:00
pFloorActor - > spr . pos . Z = pPlayerActor - > sector ( ) - > floorz ;
2021-10-15 20:19:07 +00:00
}
int var_30 = 0 ;
if ( PlayerList [ nPlayer ] . nHealth > = 800 )
{
var_30 = 2 ;
}
if ( PlayerList [ nPlayer ] . nMagic > = 1000 )
{
var_30 | = 1 ;
}
// code to handle item pickup?
2021-11-26 18:30:32 +00:00
HitInfo near ;
2021-10-15 20:19:07 +00:00
// neartag finds the nearest sector, wall, and sprite which has its hitag and/or lotag set to a value.
2022-09-10 15:05:16 +00:00
neartag ( pPlayerActor - > spr . pos , pPlayerActor - > sector ( ) , pPlayerActor - > spr . angle , near , 128. , 2 ) ;
2021-10-15 20:19:07 +00:00
2021-10-22 16:39:28 +00:00
DExhumedActor * pActorB ;
2022-09-09 17:05:36 +00:00
feebtag ( pPlayerActor - > spr . pos , pPlayerActor - > sector ( ) , & pActorB , var_30 , 48 ) ;
2021-10-15 20:19:07 +00:00
// Item pickup code
2021-12-21 22:18:23 +00:00
if ( pActorB ! = nullptr & & pActorB - > spr . statnum > = 900 )
2021-10-15 20:19:07 +00:00
{
int var_8C = 16 ;
int var_88 = 9 ;
2019-08-31 07:47:15 +00:00
2021-12-23 18:01:43 +00:00
int var_70 = pActorB - > spr . statnum - 900 ;
2021-10-15 20:19:07 +00:00
int var_44 = 0 ;
// item lotags start at 6 (1-5 reserved?) so 0-offset them
int itemtype = var_70 - 6 ;
if ( itemtype < = 54 )
{
switch ( itemtype )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
do_default :
default :
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
// loc_1B3C7
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// CHECKME - is order of evaluation correct?
if ( ! mplevel | | ( var_70 > = 25 & & ( var_70 < = 25 | | var_70 = = 50 ) ) )
2019-08-31 07:47:15 +00:00
{
2021-11-08 00:13:54 +00:00
// If this is an anim we need to properly destroy it so we need to do some proper detection and not wild guesses.
if ( pActorB - > nRun = = pActorB - > nDamage & & pActorB - > nRun ! = 0 & & pActorB - > nPhase = = ITEM_MAGIC )
DestroyAnim ( pActorB ) ;
else
DeleteActor ( pActorB ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
else
{
2021-10-21 08:20:08 +00:00
StartRegenerate ( pActorB ) ;
2021-10-15 20:19:07 +00:00
}
do_default_b :
// loc_1BA74
if ( nPlayer = = nLocalPlayer )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
if ( nItemText [ var_70 ] > - 1 & & nTotalPlayers = = 1 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
pickupMessage ( var_70 ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
TintPalette ( var_44 * 4 , var_8C * 4 , 0 ) ;
if ( var_88 > - 1 )
{
PlayLocalSound ( var_88 , 0 ) ;
}
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
break ;
}
case 0 : // Speed Loader
{
2021-12-23 18:01:43 +00:00
if ( AddAmmo ( nPlayer , 1 , pActorB - > spr . hitag ) )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
var_88 = StaticSound [ kSoundAmmoPickup ] ;
goto do_default ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
break ;
}
case 1 : // Fuel Canister
{
2021-12-23 18:01:43 +00:00
if ( AddAmmo ( nPlayer , 3 , pActorB - > spr . hitag ) )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
var_88 = StaticSound [ kSoundAmmoPickup ] ;
goto do_default ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
break ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
case 2 : // M - 60 Ammo Belt
2019-08-31 07:47:15 +00:00
{
2021-12-23 18:01:43 +00:00
if ( AddAmmo ( nPlayer , 2 , pActorB - > spr . hitag ) )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
var_88 = StaticSound [ kSoundAmmoPickup ] ;
CheckClip ( nPlayer ) ;
goto do_default ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
break ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
case 3 : // Grenade
case 21 :
case 49 :
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
if ( AddAmmo ( nPlayer , 4 , 1 ) )
{
var_88 = StaticSound [ kSoundAmmoPickup ] ;
2021-10-21 10:51:16 +00:00
if ( ! ( PlayerList [ nPlayer ] . nPlayerWeapons & 0x10 ) )
2021-10-15 20:19:07 +00:00
{
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nPlayerWeapons | = 0x10 ;
2021-10-15 20:19:07 +00:00
SetNewWeaponIfBetter ( nPlayer , 4 ) ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( var_70 = = 55 )
{
2021-12-23 18:01:43 +00:00
pActorB - > spr . cstat = CSTAT_SPRITE_INVISIBLE ;
2021-10-21 07:53:39 +00:00
DestroyItemAnim ( pActorB ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// loc_1BA74: - repeated block, see in default case
if ( nPlayer = = nLocalPlayer )
{
if ( nItemText [ var_70 ] > - 1 & & nTotalPlayers = = 1 )
{
pickupMessage ( var_70 ) ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
TintPalette ( var_44 * 4 , var_8C * 4 , 0 ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( var_88 > - 1 )
{
PlayLocalSound ( var_88 , 0 ) ;
}
}
break ;
}
else
{
goto do_default ;
}
}
break ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
case 4 : // Pickable item
case 9 : // Pickable item
case 10 : // Reserved
case 18 :
case 25 :
case 28 :
case 29 :
case 30 :
case 33 :
case 34 :
case 35 :
case 36 :
case 37 :
case 38 :
case 45 :
case 52 :
{
goto do_default ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
case 5 : // Map
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
GrabMap ( ) ;
goto do_default ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
case 6 : // Berry Twig
{
2021-12-23 18:01:43 +00:00
if ( pActorB - > spr . hitag = = 0 ) {
2021-10-15 20:19:07 +00:00
break ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
var_88 = 20 ;
int edx = 40 ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( edx < = 0 | | ( ! ( var_30 & 2 ) ) )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
if ( ! PlayerList [ nPlayer ] . invincibility | | edx > 0 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
PlayerList [ nPlayer ] . nHealth + = edx ;
if ( PlayerList [ nPlayer ] . nHealth > 800 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
PlayerList [ nPlayer ] . nHealth = 800 ;
}
else
{
if ( PlayerList [ nPlayer ] . nHealth < 0 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
var_88 = - 1 ;
StartDeathSeq ( nPlayer , 0 ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
}
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( var_70 = = 12 )
{
2021-12-23 18:01:43 +00:00
pActorB - > spr . hitag = 0 ;
pActorB - > spr . picnum + + ;
2019-08-31 07:47:15 +00:00
2021-10-21 07:53:39 +00:00
ChangeActorStat ( pActorB , 0 ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// loc_1BA74: - repeated block, see in default case
if ( nPlayer = = nLocalPlayer )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
if ( nItemText [ var_70 ] > - 1 & & nTotalPlayers = = 1 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
pickupMessage ( var_70 ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
TintPalette ( var_44 * 4 , var_8C * 4 , 0 ) ;
if ( var_88 > - 1 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
PlayLocalSound ( var_88 , 0 ) ;
2019-08-31 07:47:15 +00:00
}
}
2021-10-15 20:19:07 +00:00
break ;
}
else
{
if ( var_70 ! = 14 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
var_88 = 21 ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
else
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
var_44 = var_8C ;
var_88 = 22 ;
var_8C = 0 ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
goto do_default ;
}
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
break ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
case 7 : // Blood Bowl
{
int edx = 160 ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// Same code as case 6 now till break
if ( edx < = 0 | | ( ! ( var_30 & 2 ) ) )
{
if ( ! PlayerList [ nPlayer ] . invincibility | | edx > 0 )
{
PlayerList [ nPlayer ] . nHealth + = edx ;
if ( PlayerList [ nPlayer ] . nHealth > 800 )
{
PlayerList [ nPlayer ] . nHealth = 800 ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
else
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
if ( PlayerList [ nPlayer ] . nHealth < 0 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
var_88 = - 1 ;
StartDeathSeq ( nPlayer , 0 ) ;
2019-08-31 07:47:15 +00:00
}
}
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( var_70 = = 12 )
{
2021-12-23 18:01:43 +00:00
pActorB - > spr . hitag = 0 ;
pActorB - > spr . picnum + + ;
2019-08-31 07:47:15 +00:00
2021-10-21 07:53:39 +00:00
ChangeActorStat ( pActorB , 0 ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// loc_1BA74: - repeated block, see in default case
if ( nPlayer = = nLocalPlayer )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
if ( nItemText [ var_70 ] > - 1 & & nTotalPlayers = = 1 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
pickupMessage ( var_70 ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
TintPalette ( var_44 * 4 , var_8C * 4 , 0 ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( var_88 > - 1 )
{
PlayLocalSound ( var_88 , 0 ) ;
2019-08-31 07:47:15 +00:00
}
}
2021-10-15 20:19:07 +00:00
break ;
}
else
{
if ( var_70 ! = 14 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
var_88 = 21 ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
else
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
var_44 = var_8C ;
var_88 = 22 ;
var_8C = 0 ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
goto do_default ;
}
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
break ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
case 8 : // Cobra Venom Bowl
{
int edx = - 200 ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// Same code as case 6 and 7 from now till break
if ( edx < = 0 | | ( ! ( var_30 & 2 ) ) )
{
if ( ! PlayerList [ nPlayer ] . invincibility | | edx > 0 )
{
PlayerList [ nPlayer ] . nHealth + = edx ;
if ( PlayerList [ nPlayer ] . nHealth > 800 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
PlayerList [ nPlayer ] . nHealth = 800 ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
else
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
if ( PlayerList [ nPlayer ] . nHealth < 0 )
{
var_88 = - 1 ;
StartDeathSeq ( nPlayer , 0 ) ;
2019-08-31 07:47:15 +00:00
}
}
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( var_70 = = 12 )
{
2021-12-23 18:01:43 +00:00
pActorB - > spr . hitag = 0 ;
pActorB - > spr . picnum + + ;
2019-08-31 07:47:15 +00:00
2021-10-21 07:53:39 +00:00
ChangeActorStat ( pActorB , 0 ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// loc_1BA74: - repeated block, see in default case
if ( nPlayer = = nLocalPlayer )
{
if ( nItemText [ var_70 ] > - 1 & & nTotalPlayers = = 1 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
pickupMessage ( var_70 ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
TintPalette ( var_44 * 4 , var_8C * 4 , 0 ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( var_88 > - 1 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
PlayLocalSound ( var_88 , 0 ) ;
2019-08-31 07:47:15 +00:00
}
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
break ;
}
else
{
if ( var_70 ! = 14 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
var_88 = 21 ;
}
else
{
var_44 = var_8C ;
var_88 = 22 ;
var_8C = 0 ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
goto do_default ;
}
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
break ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
case 11 : // Bubble Nest
{
PlayerList [ nPlayer ] . nAir + = 10 ;
if ( PlayerList [ nPlayer ] . nAir > 100 ) {
PlayerList [ nPlayer ] . nAir = 100 ; // TODO - constant
}
2019-08-26 03:59:14 +00:00
2021-10-21 10:51:16 +00:00
if ( PlayerList [ nPlayer ] . nBreathTimer < 89 )
2021-10-15 20:19:07 +00:00
{
2021-10-21 20:39:17 +00:00
D3PlayFX ( StaticSound [ kSound13 ] , pPlayerActor ) ;
2021-10-15 20:19:07 +00:00
}
2019-08-26 03:59:14 +00:00
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nBreathTimer = 90 ;
2021-10-15 20:19:07 +00:00
break ;
}
2019-11-13 22:57:21 +00:00
2021-10-15 20:19:07 +00:00
case 12 : // Still Beating Heart
{
if ( GrabItem ( nPlayer , kItemHeart ) ) {
goto do_default ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
break ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
case 13 : // Scarab amulet(Invicibility)
{
if ( GrabItem ( nPlayer , kItemInvincibility ) ) {
goto do_default ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
break ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
case 14 : // Severed Slave Hand(double damage)
{
if ( GrabItem ( nPlayer , kItemDoubleDamage ) ) {
goto do_default ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
break ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
case 15 : // Unseen eye(Invisibility)
{
if ( GrabItem ( nPlayer , kItemInvisibility ) ) {
goto do_default ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
break ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
case 16 : // Torch
{
if ( GrabItem ( nPlayer , kItemTorch ) ) {
goto do_default ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
break ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
case 17 : // Sobek Mask
{
if ( GrabItem ( nPlayer , kItemMask ) ) {
goto do_default ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
break ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
case 19 : // Extra Life
{
var_88 = - 1 ;
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
if ( PlayerList [ nPlayer ] . nLives > = kMaxPlayerLives ) {
break ;
}
2019-11-13 22:57:21 +00:00
2021-10-15 20:19:07 +00:00
PlayerList [ nPlayer ] . nLives + + ;
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
var_8C = 32 ;
var_44 = 32 ;
goto do_default ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
// FIXME - lots of repeated code from here down!!
case 20 : // sword pickup??
{
var_40 = 0 ;
int ebx = 0 ;
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
// loc_1B75D
int var_18 = 1 < < var_40 ;
2019-08-31 07:47:15 +00:00
2021-11-21 19:34:15 +00:00
int weapons = PlayerList [ nPlayer ] . nPlayerWeapons ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( weapons & var_18 )
{
if ( mplevel )
{
AddAmmo ( nPlayer , WeaponInfo [ var_40 ] . nAmmoType , ebx ) ;
}
}
else
{
weapons = var_40 ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
SetNewWeaponIfBetter ( nPlayer , weapons ) ;
2019-08-26 03:59:14 +00:00
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nPlayerWeapons | = var_18 ;
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
AddAmmo ( nPlayer , WeaponInfo [ weapons ] . nAmmoType , ebx ) ;
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
var_88 = StaticSound [ kSound72 ] ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
if ( var_40 = = 2 ) {
CheckClip ( nPlayer ) ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
if ( var_70 < = 50 ) {
goto do_default ;
}
2019-08-26 03:59:14 +00:00
2021-12-23 18:01:43 +00:00
pActorB - > spr . cstat = CSTAT_SPRITE_INVISIBLE ;
2021-10-21 07:53:39 +00:00
DestroyItemAnim ( pActorB ) ;
2021-10-15 20:19:07 +00:00
////
// loc_1BA74: - repeated block, see in default case
if ( nPlayer = = nLocalPlayer )
{
if ( nItemText [ var_70 ] > - 1 & & nTotalPlayers = = 1 )
{
pickupMessage ( var_70 ) ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
TintPalette ( var_44 * 4 , var_8C * 4 , 0 ) ;
2019-11-13 22:57:21 +00:00
2021-10-15 20:19:07 +00:00
if ( var_88 > - 1 )
{
PlayLocalSound ( var_88 , 0 ) ;
}
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
break ;
/////
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
case 22 : // .357 Magnum Revolver
case 46 :
{
var_40 = 1 ;
int ebx = 6 ;
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
// loc_1B75D
int var_18 = 1 < < var_40 ;
2019-08-31 07:47:15 +00:00
2021-11-21 19:34:15 +00:00
int weapons = PlayerList [ nPlayer ] . nPlayerWeapons ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( weapons & var_18 )
{
if ( mplevel )
{
AddAmmo ( nPlayer , WeaponInfo [ var_40 ] . nAmmoType , ebx ) ;
}
}
else
{
weapons = var_40 ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
SetNewWeaponIfBetter ( nPlayer , weapons ) ;
2019-08-26 03:59:14 +00:00
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nPlayerWeapons | = var_18 ;
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
AddAmmo ( nPlayer , WeaponInfo [ weapons ] . nAmmoType , ebx ) ;
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
var_88 = StaticSound [ kSound72 ] ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
if ( var_40 = = 2 ) {
CheckClip ( nPlayer ) ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
if ( var_70 < = 50 ) {
goto do_default ;
}
2019-08-26 03:59:14 +00:00
2021-12-23 18:01:43 +00:00
pActorB - > spr . cstat = CSTAT_SPRITE_INVISIBLE ;
2021-10-21 07:53:39 +00:00
DestroyItemAnim ( pActorB ) ;
2021-10-15 20:19:07 +00:00
////
// loc_1BA74: - repeated block, see in default case
if ( nPlayer = = nLocalPlayer )
{
if ( nItemText [ var_70 ] > - 1 & & nTotalPlayers = = 1 )
{
pickupMessage ( var_70 ) ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
TintPalette ( var_44 * 4 , var_8C * 4 , 0 ) ;
2019-11-13 22:57:21 +00:00
2021-10-15 20:19:07 +00:00
if ( var_88 > - 1 )
{
PlayLocalSound ( var_88 , 0 ) ;
}
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
break ;
/////
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
case 23 : // M - 60 Machine Gun
case 47 :
{
var_40 = 2 ;
int ebx = 24 ;
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
// loc_1B75D
int var_18 = 1 < < var_40 ;
2019-08-31 07:47:15 +00:00
2021-11-21 19:34:15 +00:00
int weapons = PlayerList [ nPlayer ] . nPlayerWeapons ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( weapons & var_18 )
{
if ( mplevel )
{
AddAmmo ( nPlayer , WeaponInfo [ var_40 ] . nAmmoType , ebx ) ;
}
}
else
{
weapons = var_40 ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
SetNewWeaponIfBetter ( nPlayer , weapons ) ;
2019-08-26 03:59:14 +00:00
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nPlayerWeapons | = var_18 ;
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
AddAmmo ( nPlayer , WeaponInfo [ weapons ] . nAmmoType , ebx ) ;
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
var_88 = StaticSound [ kSound72 ] ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
if ( var_40 = = 2 ) {
CheckClip ( nPlayer ) ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
if ( var_70 < = 50 ) {
goto do_default ;
}
2019-08-26 03:59:14 +00:00
2021-12-23 18:01:43 +00:00
pActorB - > spr . cstat = CSTAT_SPRITE_INVISIBLE ;
2021-10-21 07:53:39 +00:00
DestroyItemAnim ( pActorB ) ;
2021-10-15 20:19:07 +00:00
////
// loc_1BA74: - repeated block, see in default case
if ( nPlayer = = nLocalPlayer )
{
if ( nItemText [ var_70 ] > - 1 & & nTotalPlayers = = 1 )
{
pickupMessage ( var_70 ) ;
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
TintPalette ( var_44 * 4 , var_8C * 4 , 0 ) ;
2019-11-13 22:57:21 +00:00
2021-10-15 20:19:07 +00:00
if ( var_88 > - 1 )
{
PlayLocalSound ( var_88 , 0 ) ;
}
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
break ;
/////
}
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
case 24 : // Flame Thrower
case 48 :
{
var_40 = 3 ;
int ebx = 100 ;
2019-08-26 03:59:14 +00:00
2021-10-15 20:19:07 +00:00
// loc_1B75D
int var_18 = 1 < < var_40 ;
2019-08-31 07:47:15 +00:00
2021-11-21 19:34:15 +00:00
int weapons = PlayerList [ nPlayer ] . nPlayerWeapons ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( weapons & var_18 )
{
if ( mplevel )
{
AddAmmo ( nPlayer , WeaponInfo [ var_40 ] . nAmmoType , ebx ) ;
}
}
else
{
weapons = var_40 ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
SetNewWeaponIfBetter ( nPlayer , weapons ) ;
2019-08-31 07:47:15 +00:00
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nPlayerWeapons | = var_18 ;
2019-11-20 16:21:32 +00:00
2021-10-15 20:19:07 +00:00
AddAmmo ( nPlayer , WeaponInfo [ weapons ] . nAmmoType , ebx ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
var_88 = StaticSound [ kSound72 ] ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( var_40 = = 2 ) {
CheckClip ( nPlayer ) ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( var_70 < = 50 ) {
goto do_default ;
}
2019-08-31 07:47:15 +00:00
2021-12-23 18:01:43 +00:00
pActorB - > spr . cstat = CSTAT_SPRITE_INVISIBLE ;
2021-10-21 07:53:39 +00:00
DestroyItemAnim ( pActorB ) ;
2021-10-15 20:19:07 +00:00
////
// loc_1BA74: - repeated block, see in default case
if ( nPlayer = = nLocalPlayer )
{
if ( nItemText [ var_70 ] > - 1 & & nTotalPlayers = = 1 )
{
pickupMessage ( var_70 ) ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
TintPalette ( var_44 * 4 , var_8C * 4 , 0 ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( var_88 > - 1 )
{
PlayLocalSound ( var_88 , 0 ) ;
}
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
break ;
/////
}
2019-11-20 16:21:32 +00:00
2021-10-15 20:19:07 +00:00
case 26 : // Cobra Staff
case 50 :
{
var_40 = 5 ;
int ebx = 20 ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// loc_1B75D
int var_18 = 1 < < var_40 ;
2019-08-31 07:47:15 +00:00
2021-11-21 19:34:15 +00:00
int weapons = PlayerList [ nPlayer ] . nPlayerWeapons ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( weapons & var_18 )
{
if ( mplevel )
{
AddAmmo ( nPlayer , WeaponInfo [ var_40 ] . nAmmoType , ebx ) ;
}
}
else
{
weapons = var_40 ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
SetNewWeaponIfBetter ( nPlayer , weapons ) ;
2019-08-31 07:47:15 +00:00
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nPlayerWeapons | = var_18 ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
AddAmmo ( nPlayer , WeaponInfo [ weapons ] . nAmmoType , ebx ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
var_88 = StaticSound [ kSound72 ] ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
if ( var_40 = = 2 ) {
CheckClip ( nPlayer ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
if ( var_70 < = 50 ) {
goto do_default ;
2019-08-31 07:47:15 +00:00
}
2021-12-23 18:01:43 +00:00
pActorB - > spr . cstat = CSTAT_SPRITE_INVISIBLE ;
2021-10-21 07:53:39 +00:00
DestroyItemAnim ( pActorB ) ;
2021-10-15 20:19:07 +00:00
////
// loc_1BA74: - repeated block, see in default case
if ( nPlayer = = nLocalPlayer )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
if ( nItemText [ var_70 ] > - 1 & & nTotalPlayers = = 1 )
{
pickupMessage ( var_70 ) ;
}
TintPalette ( var_44 * 4 , var_8C * 4 , 0 ) ;
if ( var_88 > - 1 )
{
PlayLocalSound ( var_88 , 0 ) ;
}
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
break ;
/////
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
case 27 : // Eye of Ra Gauntlet
case 51 :
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
var_40 = 6 ;
int ebx = 2 ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// loc_1B75D
int var_18 = 1 < < var_40 ;
2019-08-31 07:47:15 +00:00
2021-11-21 19:34:15 +00:00
int weapons = PlayerList [ nPlayer ] . nPlayerWeapons ;
2021-10-15 20:19:07 +00:00
if ( weapons & var_18 )
{
if ( mplevel )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
AddAmmo ( nPlayer , WeaponInfo [ var_40 ] . nAmmoType , ebx ) ;
2019-08-31 07:47:15 +00:00
}
}
else
{
2021-10-15 20:19:07 +00:00
weapons = var_40 ;
SetNewWeaponIfBetter ( nPlayer , weapons ) ;
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nPlayerWeapons | = var_18 ;
2021-10-15 20:19:07 +00:00
AddAmmo ( nPlayer , WeaponInfo [ weapons ] . nAmmoType , ebx ) ;
var_88 = StaticSound [ kSound72 ] ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
if ( var_40 = = 2 ) {
CheckClip ( nPlayer ) ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( var_70 < = 50 ) {
goto do_default ;
2019-08-31 07:47:15 +00:00
}
2021-12-23 18:01:43 +00:00
pActorB - > spr . cstat = CSTAT_SPRITE_INVISIBLE ;
2021-10-21 07:53:39 +00:00
DestroyItemAnim ( pActorB ) ;
2021-10-15 20:19:07 +00:00
////
// loc_1BA74: - repeated block, see in default case
if ( nPlayer = = nLocalPlayer )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
if ( nItemText [ var_70 ] > - 1 & & nTotalPlayers = = 1 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
pickupMessage ( var_70 ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
TintPalette ( var_44 * 4 , var_8C * 4 , 0 ) ;
if ( var_88 > - 1 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
PlayLocalSound ( var_88 , 0 ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
break ;
/////
}
case 31 : // Cobra staff ammo
{
if ( AddAmmo ( nPlayer , 5 , 1 ) ) {
var_88 = StaticSound [ kSoundAmmoPickup ] ;
goto do_default ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
break ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
case 32 : // Raw Energy
{
2021-12-23 18:01:43 +00:00
if ( AddAmmo ( nPlayer , 6 , pActorB - > spr . hitag ) ) {
2021-10-15 20:19:07 +00:00
var_88 = StaticSound [ kSoundAmmoPickup ] ;
goto do_default ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
break ;
}
case 39 : // Power key
case 40 : // Time key
case 41 : // War key
case 42 : // Earth key
{
int keybit = 4096 < < ( itemtype - 39 ) ;
var_88 = - 1 ;
if ( ! ( PlayerList [ nPlayer ] . keys & keybit ) )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
PlayerList [ nPlayer ] . keys | = keybit ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( nTotalPlayers > 1 )
{
goto do_default_b ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
else
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
goto do_default ;
2019-08-31 07:47:15 +00:00
}
}
2021-10-15 20:19:07 +00:00
break ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
case 43 : // Magical Essence
case 44 : // ?
{
if ( PlayerList [ nPlayer ] . nMagic > = 1000 ) {
break ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
var_88 = StaticSound [ kSoundMana1 ] ;
PlayerList [ nPlayer ] . nMagic + = 100 ;
if ( PlayerList [ nPlayer ] . nMagic > = 1000 ) {
PlayerList [ nPlayer ] . nMagic = 1000 ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
goto do_default ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
case 53 : // Scarab (Checkpoint)
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
if ( nLocalPlayer = = nPlayer )
2019-08-31 07:47:15 +00:00
{
2021-10-21 07:53:39 +00:00
pActorB - > nIndex2 + + ;
pActorB - > nAction & = 0xEF ;
pActorB - > nIndex = 0 ;
2021-10-15 20:19:07 +00:00
2021-10-21 07:53:39 +00:00
ChangeActorStat ( pActorB , 899 ) ;
2019-08-31 07:47:15 +00:00
}
2022-09-07 07:48:05 +00:00
SetSavePoint ( nPlayer , pPlayerActor - > spr . pos , pPlayerActor - > sector ( ) , pPlayerActor - > spr . angle ) ;
2021-10-15 20:19:07 +00:00
break ;
}
case 54 : // Golden Sarcophagus (End Level)
{
if ( ! bInDemo )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
LevelFinished ( ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
2021-10-21 07:53:39 +00:00
DestroyItemAnim ( pActorB ) ;
DeleteActor ( pActorB ) ;
2021-10-15 20:19:07 +00:00
break ;
}
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
}
}
// CORRECT ? // loc_1BAF9:
if ( bTouchFloor )
{
2021-12-30 15:51:56 +00:00
if ( pPlayerActor - > sector ( ) - > lotag > 0 )
2021-10-15 20:19:07 +00:00
{
2021-12-30 15:51:56 +00:00
runlist_SignalRun ( pPlayerActor - > sector ( ) - > lotag - 1 , nPlayer , & ExhumedAI : : TouchFloor ) ;
2021-10-15 20:19:07 +00:00
}
}
2021-12-30 15:51:56 +00:00
if ( pSector ! = pPlayerActor - > sector ( ) )
2021-10-15 20:19:07 +00:00
{
2021-11-22 23:55:46 +00:00
if ( pSector - > lotag > 0 )
2021-10-15 20:19:07 +00:00
{
2021-11-22 23:55:46 +00:00
runlist_SignalRun ( pSector - > lotag - 1 , nPlayer , & ExhumedAI : : EnterSector ) ;
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-12-30 15:51:56 +00:00
if ( pPlayerActor - > sector ( ) - > lotag > 0 )
2021-10-15 20:19:07 +00:00
{
2021-12-30 15:51:56 +00:00
runlist_SignalRun ( pPlayerActor - > sector ( ) - > lotag - 1 , nPlayer , & ExhumedAI : : LeaveSector ) ;
2021-10-15 20:19:07 +00:00
}
}
if ( ! PlayerList [ nPlayer ] . bIsMummified )
{
if ( actions & SB_OPEN )
{
ClearSpaceBar ( nPlayer ) ;
2021-11-22 21:20:53 +00:00
int tag ;
2021-11-26 18:30:32 +00:00
if ( near . hitWall ! = nullptr & & ( tag = near . hitWall - > lotag ) > 0 )
2019-08-31 07:47:15 +00:00
{
2021-11-22 21:20:53 +00:00
runlist_SignalRun ( tag - 1 , nPlayer , & ExhumedAI : : Use ) ;
2019-08-31 07:47:15 +00:00
}
2020-09-21 10:37:09 +00:00
2021-11-26 18:30:32 +00:00
if ( near . hitSector ! = nullptr & & ( tag = near . hitSector - > lotag ) > 0 )
2020-09-21 10:37:09 +00:00
{
2021-11-22 21:20:53 +00:00
runlist_SignalRun ( tag - 1 , nPlayer , & ExhumedAI : : Use ) ;
2020-09-21 10:37:09 +00:00
}
2021-10-15 20:19:07 +00:00
}
// was int var_38 = buttons & 0x8
if ( actions & SB_FIRE )
{
FireWeapon ( nPlayer ) ;
}
else
{
StopFiringWeapon ( nPlayer ) ;
}
// loc_1BC57:
2021-12-23 18:01:43 +00:00
// CHECKME - are we finished with 'nSector' variable at this point? if so, maybe set it to pPlayerActor->spr.sector so we can make this code a bit neater. Don't assume pPlayerActor->spr.sector == nSector here!!
2022-09-10 17:18:09 +00:00
if ( nStandHeight > ( pPlayerActor - > sector ( ) - > floorz - pPlayerActor - > sector ( ) - > ceilingz ) ) {
2021-10-15 20:19:07 +00:00
var_48 = 1 ;
}
2021-04-13 11:56:01 +00:00
2021-10-15 20:19:07 +00:00
// Jumping
if ( actions & SB_JUMP )
{
if ( bUnderwater )
2021-04-13 11:56:01 +00:00
{
2022-09-09 17:29:11 +00:00
pPlayerActor - > vel . Z = - 8 ;
2021-10-15 20:19:07 +00:00
nActionB = 10 ;
2021-04-13 11:56:01 +00:00
}
2021-10-15 20:19:07 +00:00
else if ( bTouchFloor )
2021-04-19 10:23:22 +00:00
{
2021-10-15 20:19:07 +00:00
if ( nAction < 6 | | nAction > 8 )
{
2022-09-09 17:29:11 +00:00
pPlayerActor - > vel . Z = - 14 ;
2021-10-15 20:19:07 +00:00
nActionB = 3 ;
}
2021-04-19 10:23:22 +00:00
}
2021-04-13 11:56:01 +00:00
2021-10-15 20:19:07 +00:00
// goto loc_1BE70:
}
else if ( actions & SB_CROUCH )
{
if ( bUnderwater )
2021-04-13 11:56:01 +00:00
{
2022-09-09 17:29:11 +00:00
pPlayerActor - > vel . Z = 8 ;
2021-10-15 20:19:07 +00:00
nActionB = 10 ;
2021-04-13 11:56:01 +00:00
}
2021-10-15 20:19:07 +00:00
else
2021-04-13 11:56:01 +00:00
{
2022-09-07 05:25:34 +00:00
if ( PlayerList [ nPlayer ] . eyelevel < - 32.5 ) {
PlayerList [ nPlayer ] . eyelevel + = ( ( - 32.5 - PlayerList [ nPlayer ] . eyelevel ) * 0.5 ) ;
2021-10-15 20:19:07 +00:00
}
loc_1BD2E :
2021-10-21 10:51:16 +00:00
if ( PlayerList [ nPlayer ] . totalvel < 1 ) {
2021-10-15 20:19:07 +00:00
nActionB = 6 ;
}
else {
nActionB = 7 ;
2021-04-16 13:37:05 +00:00
}
2021-04-13 11:56:01 +00:00
}
2021-10-15 20:19:07 +00:00
// goto loc_1BE70:
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
else
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
if ( PlayerList [ nPlayer ] . nHealth > 0 )
2019-08-31 07:47:15 +00:00
{
2022-09-07 05:25:34 +00:00
PlayerList [ nPlayer ] . eyelevel + = ( nActionEyeLevel [ nAction ] - PlayerList [ nPlayer ] . eyelevel ) * 0.5 ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( bUnderwater )
{
2021-10-21 10:51:16 +00:00
if ( PlayerList [ nPlayer ] . totalvel < = 1 )
2021-10-15 20:19:07 +00:00
nActionB = 9 ;
else
nActionB = 10 ;
}
else
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
// CHECKME - confirm branching in this area is OK
if ( var_48 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
goto loc_1BD2E ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
else
2019-08-31 07:47:15 +00:00
{
2021-10-21 10:51:16 +00:00
if ( PlayerList [ nPlayer ] . totalvel < = 1 ) {
2021-10-15 20:19:07 +00:00
nActionB = 0 ; //bUnderwater; // this is just setting to 0
}
2021-10-21 10:51:16 +00:00
else if ( PlayerList [ nPlayer ] . totalvel < = 30 ) {
2021-10-15 20:19:07 +00:00
nActionB = 2 ;
}
else
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
nActionB = 1 ;
2019-08-31 07:47:15 +00:00
}
}
2021-10-15 20:19:07 +00:00
}
}
// loc_1BE30
if ( actions & SB_FIRE ) // was var_38
{
if ( bUnderwater )
{
nActionB = 11 ;
}
else
{
if ( nActionB ! = 2 & & nActionB ! = 1 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
nActionB = 5 ;
2019-08-31 07:47:15 +00:00
}
}
}
}
2021-10-15 20:19:07 +00:00
// loc_1BE70:
// Handle player pressing number keys to change weapon
uint8_t var_90 = sPlayerInput [ nPlayer ] . getNewWeapon ( ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( var_90 )
{
var_90 - - ;
2019-08-31 07:47:15 +00:00
2021-10-21 10:51:16 +00:00
if ( PlayerList [ nPlayer ] . nPlayerWeapons & ( 1 < < var_90 ) )
2021-10-15 20:19:07 +00:00
{
SetNewWeapon ( nPlayer , var_90 ) ;
}
}
}
else // player is mummified
{
if ( actions & SB_FIRE )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
FireWeapon ( nPlayer ) ;
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( nAction ! = 15 )
{
2021-10-21 10:51:16 +00:00
if ( PlayerList [ nPlayer ] . totalvel < = 1 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
nActionB = 13 ;
}
else
{
nActionB = 14 ;
}
}
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
// loc_1BF09
if ( nActionB ! = nAction & & nAction ! = 4 )
{
nAction = nActionB ;
PlayerList [ nPlayer ] . nAction = nActionB ;
2021-11-21 18:33:51 +00:00
PlayerList [ nPlayer ] . nSeqSize = 0 ;
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
Player * pPlayer = & PlayerList [ nPlayer ] ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( SyncInput ( ) )
{
pPlayer - > horizon . applyinput ( sPlayerInput [ nPlayer ] . pan , & sPlayerInput [ nLocalPlayer ] . actions ) ;
}
2019-08-31 07:47:15 +00:00
2021-10-30 03:52:36 +00:00
if ( actions & ( SB_AIM_UP | SB_AIM_DOWN ) | | sPlayerInput [ nPlayer ] . pan )
2021-10-15 20:19:07 +00:00
{
pPlayer - > nDestVertPan = pPlayer - > horizon . horiz ;
pPlayer - > bPlayerPan = pPlayer - > bLockPan = true ;
}
2021-10-30 03:52:36 +00:00
else if ( actions & ( SB_LOOK_UP | SB_LOOK_DOWN | SB_CENTERVIEW ) )
2021-10-15 20:19:07 +00:00
{
pPlayer - > nDestVertPan = pPlayer - > horizon . horiz ;
pPlayer - > bPlayerPan = pPlayer - > bLockPan = false ;
}
2019-08-31 07:47:15 +00:00
2021-10-21 10:51:16 +00:00
if ( PlayerList [ nPlayer ] . totalvel > 20 )
2021-10-15 20:19:07 +00:00
{
pPlayer - > bPlayerPan = false ;
}
2021-10-30 03:53:04 +00:00
if ( cl_slopetilting & & ! pPlayer - > bPlayerPan & & ! pPlayer - > bLockPan )
2021-10-15 20:19:07 +00:00
{
double nVertPan = ( pPlayer - > nDestVertPan - pPlayer - > horizon . horiz ) . asbuildf ( ) * 0.25 ;
if ( nVertPan ! = 0 )
2019-08-31 07:47:15 +00:00
{
2022-05-30 10:35:41 +00:00
pPlayer - > horizon . addadjustment ( buildfhoriz ( abs ( nVertPan ) > = 4 ? clamp ( nVertPan , - 4. , 4. ) : nVertPan * 2. ) ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
}
}
else // else, player's health is less than 0
{
// loc_1C0E9
if ( actions & SB_OPEN )
{
ClearSpaceBar ( nPlayer ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( nAction > = 16 )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
if ( nPlayer = = nLocalPlayer )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
StopAllSounds ( ) ;
StopLocalSound ( ) ;
GrabPalette ( ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
2021-10-21 10:51:16 +00:00
PlayerList [ nPlayer ] . nCurrentWeapon = PlayerList [ nPlayer ] . nPlayerOldWeapon ;
2021-10-15 20:19:07 +00:00
if ( PlayerList [ nPlayer ] . nLives & & nNetTime )
2019-08-31 07:47:15 +00:00
{
2021-10-15 20:19:07 +00:00
if ( nAction ! = 20 )
2019-08-31 07:47:15 +00:00
{
2021-12-23 18:01:43 +00:00
pPlayerActor - > spr . picnum = seq_GetSeqPicnum ( kSeqJoe , 120 , 0 ) ;
pPlayerActor - > spr . cstat = 0 ;
2022-08-20 14:44:30 +00:00
pPlayerActor - > spr . pos . Z = pPlayerActor - > sector ( ) - > floorz ;
2019-08-31 07:47:15 +00:00
}
2020-09-21 09:28:39 +00:00
2021-10-15 20:19:07 +00:00
// will invalidate nPlayerSprite
RestartPlayer ( nPlayer ) ;
2019-08-31 07:47:15 +00:00
2021-12-26 07:47:54 +00:00
pPlayerActor = PlayerList [ nPlayer ] . pActor ;
2021-10-21 17:54:39 +00:00
pDopple = PlayerList [ nPlayer ] . pDoppleSprite ;
2021-10-15 20:19:07 +00:00
}
else
{
2022-01-22 22:11:34 +00:00
DoGameOverScene ( currentLevel - > levelNumber = = 20 ) ;
2021-10-15 20:19:07 +00:00
return ;
2019-08-31 07:47:15 +00:00
}
}
2021-10-15 20:19:07 +00:00
}
}
// loc_1C201:
if ( nLocalPlayer = = nPlayer )
{
2021-11-22 23:35:29 +00:00
pLocalEyeSect = PlayerList [ nLocalPlayer ] . pPlayerViewSect ;
CheckAmbience ( pLocalEyeSect ) ;
2021-10-15 20:19:07 +00:00
}
int var_AC = SeqOffsets [ PlayerList [ nPlayer ] . nSeq ] + PlayerSeq [ nAction ] . a ;
2021-11-21 18:33:51 +00:00
seq_MoveSequence ( pPlayerActor , var_AC , PlayerList [ nPlayer ] . nSeqSize ) ;
PlayerList [ nPlayer ] . nSeqSize + + ;
2021-10-15 20:19:07 +00:00
2021-11-21 18:33:51 +00:00
if ( PlayerList [ nPlayer ] . nSeqSize > = SeqSize [ var_AC ] )
2021-10-15 20:19:07 +00:00
{
2021-11-21 18:33:51 +00:00
PlayerList [ nPlayer ] . nSeqSize = 0 ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
switch ( PlayerList [ nPlayer ] . nAction )
{
default :
break ;
case 3 :
2021-11-21 18:33:51 +00:00
PlayerList [ nPlayer ] . nSeqSize = SeqSize [ var_AC ] - 1 ;
2021-10-15 20:19:07 +00:00
break ;
case 4 :
PlayerList [ nPlayer ] . nAction = 0 ;
break ;
case 16 :
2021-11-21 18:33:51 +00:00
PlayerList [ nPlayer ] . nSeqSize = SeqSize [ var_AC ] - 1 ;
2021-10-15 20:19:07 +00:00
2022-08-20 18:25:38 +00:00
if ( pPlayerActor - > spr . pos . Z < pPlayerActor - > sector ( ) - > floorz )
{
2022-08-20 14:47:27 +00:00
pPlayerActor - > spr . pos . Z + + ;
2021-10-15 20:19:07 +00:00
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( ! RandomSize ( 5 ) )
2019-08-31 07:47:15 +00:00
{
2021-11-22 22:35:11 +00:00
sectortype * mouthSect ;
2022-08-20 13:42:53 +00:00
auto pos = WheresMyMouth ( nPlayer , & mouthSect ) ;
2021-10-15 20:19:07 +00:00
2022-08-20 13:42:53 +00:00
BuildAnim ( nullptr , 71 , 0 , DVector3 ( pos . XY ( ) , pPlayerActor - > spr . pos . Z + 15 ) , mouthSect , 75 , 128 ) ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
break ;
case 17 :
PlayerList [ nPlayer ] . nAction = 18 ;
break ;
case 19 :
2021-12-23 18:01:43 +00:00
pPlayerActor - > spr . cstat | = CSTAT_SPRITE_INVISIBLE ;
2021-10-15 20:19:07 +00:00
PlayerList [ nPlayer ] . nAction = 20 ;
break ;
}
}
// loc_1C3B4:
if ( nPlayer = = nLocalPlayer )
{
2022-08-23 21:36:23 +00:00
initpos = pPlayerActor - > spr . pos ;
2021-12-30 15:51:56 +00:00
initsectp = pPlayerActor - > sector ( ) ;
2022-09-07 07:48:05 +00:00
inita = pPlayerActor - > spr . angle ;
2021-10-15 20:19:07 +00:00
}
if ( ! PlayerList [ nPlayer ] . nHealth )
{
2022-09-09 20:59:16 +00:00
PlayerList [ nPlayer ] . nThrust . Zero ( ) ;
2021-10-15 20:19:07 +00:00
2022-09-07 05:25:34 +00:00
if ( PlayerList [ nPlayer ] . eyelevel > = - 11 )
2021-10-15 20:19:07 +00:00
{
2022-09-07 05:25:34 +00:00
PlayerList [ nPlayer ] . eyelevel = - 11 ;
2021-10-15 20:19:07 +00:00
dVertPan [ nPlayer ] = 0 ;
}
else
{
if ( PlayerList [ nPlayer ] . horizon . horiz . asq16 ( ) < 0 )
2019-08-31 07:47:15 +00:00
{
2022-05-30 10:35:41 +00:00
PlayerList [ nPlayer ] . horizon . settarget ( buildhoriz ( 0 ) ) ;
2022-09-07 05:25:34 +00:00
PlayerList [ nPlayer ] . eyelevel - = dVertPan [ nPlayer ] ;
2019-08-31 07:47:15 +00:00
}
2021-10-15 20:19:07 +00:00
else
{
2022-05-30 10:35:41 +00:00
PlayerList [ nPlayer ] . horizon . addadjustment ( buildhoriz ( dVertPan [ nPlayer ] ) ) ;
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
if ( PlayerList [ nPlayer ] . horizon . horiz . asq16 ( ) > gi - > playerHorizMax ( ) )
{
2022-05-30 10:35:41 +00:00
PlayerList [ nPlayer ] . horizon . settarget ( q16horiz ( gi - > playerHorizMax ( ) ) ) ;
2021-10-15 20:19:07 +00:00
}
else if ( PlayerList [ nPlayer ] . horizon . horiz . asq16 ( ) < = 0 )
{
2021-12-30 15:51:56 +00:00
if ( ! ( pPlayerActor - > sector ( ) - > Flag & kSectUnderwater ) )
2021-10-15 20:19:07 +00:00
{
2021-10-21 10:51:16 +00:00
SetNewWeapon ( nPlayer , PlayerList [ nPlayer ] . nDeathType + 8 ) ;
2021-10-15 20:19:07 +00:00
}
}
2019-08-31 07:47:15 +00:00
2021-10-15 20:19:07 +00:00
dVertPan [ nPlayer ] - - ;
}
2019-08-31 07:47:15 +00:00
}
}
2021-10-15 20:19:07 +00:00
// loc_1C4E1
2022-10-05 15:38:44 +00:00
pDopple - > spr . pos = pPlayerActor - > spr . pos ;
2021-10-15 20:19:07 +00:00
2021-12-30 15:51:56 +00:00
if ( pPlayerActor - > sector ( ) - > pAbove ! = nullptr )
2021-10-15 20:19:07 +00:00
{
2022-08-28 03:15:31 +00:00
pDopple - > spr . angle = pPlayerActor - > spr . angle ;
2021-12-30 15:51:56 +00:00
ChangeActorSect ( pDopple , pPlayerActor - > sector ( ) - > pAbove ) ;
2021-12-21 22:18:23 +00:00
pDopple - > spr . cstat = CSTAT_SPRITE_BLOCK_ALL ;
2021-10-15 20:19:07 +00:00
}
else
{
2021-12-21 22:18:23 +00:00
pDopple - > spr . cstat = CSTAT_SPRITE_INVISIBLE ;
2021-10-15 20:19:07 +00:00
}
MoveWeapons ( nPlayer ) ;
}
2020-11-29 23:47:53 +00:00
FSerializer & Serialize ( FSerializer & arc , const char * keyname , Player & w , Player * def )
{
if ( arc . BeginObject ( keyname ) )
{
arc ( " health " , w . nHealth )
2021-11-21 18:33:51 +00:00
( " at2 " , w . nSeqSize )
2020-11-29 23:47:53 +00:00
( " action " , w . nAction )
2021-10-21 20:39:17 +00:00
( " sprite " , w . pActor )
2020-11-29 23:47:53 +00:00
( " mummy " , w . bIsMummified )
( " invincible " , w . invincibility )
( " air " , w . nAir )
( " seq " , w . nSeq )
2021-05-13 11:44:58 +00:00
( " item " , w . nItem )
2020-11-29 23:47:53 +00:00
( " maskamount " , w . nMaskAmount )
( " keys " , w . keys )
( " magic " , w . nMagic )
. Array ( " items " , w . items , countof ( w . items ) )
. Array ( " ammo " , w . nAmmo , countof ( w . nAmmo ) )
( " weapon " , w . nCurrentWeapon )
( " isfiring " , w . bIsFiring )
2021-11-21 18:33:51 +00:00
( " field3f " , w . nSeqSize2 )
( " field38 " , w . nNextWeapon )
( " field3a " , w . nState )
( " field3c " , w . nLastWeapon )
2020-11-29 23:47:53 +00:00
( " seq " , w . nSeq )
( " horizon " , w . horizon )
( " angle " , w . angle )
2021-05-13 17:06:38 +00:00
( " lives " , w . nLives )
2021-05-13 17:15:53 +00:00
( " double " , w . nDouble )
( " invisible " , w . nInvisible )
( " torch " , w . nTorch )
2021-10-21 10:51:16 +00:00
( " breathtimer " , w . nBreathTimer )
( " playerswear " , w . nPlayerSwear )
2021-11-22 20:09:24 +00:00
( " pushsect " , w . pPlayerPushSect )
2021-10-21 10:51:16 +00:00
( " deathtype " , w . nDeathType )
( " score " , w . nPlayerScore )
( " color " , w . nPlayerColor )
2021-12-30 12:10:12 +00:00
( " dx " , w . nPlayerD . X )
( " dy " , w . nPlayerD . Y )
2021-10-21 10:51:16 +00:00
( " pistolclip " , w . nPistolClip )
2022-09-09 20:08:53 +00:00
( " thrustx " , w . nThrust . X )
( " thrusty " , w . nThrust . Y )
2021-10-21 17:54:39 +00:00
( " dopplesprite " , w . pDoppleSprite )
2021-10-21 10:51:16 +00:00
( " oldweapon " , w . nPlayerOldWeapon )
( " clip " , w . nPlayerClip )
( " pushsound " , w . nPlayerPushSound )
( " taunttimer " , w . nTauntTimer )
( " weapons " , w . nPlayerWeapons )
2021-11-22 23:20:15 +00:00
( " viewsect " , w . pPlayerViewSect )
2021-10-21 17:44:53 +00:00
( " floorspr " , w . pPlayerFloorSprite )
2021-10-21 10:51:16 +00:00
( " save " , w . sPlayerSave )
( " totalvel " , w . totalvel )
( " eyelevel " , w . eyelevel )
2021-10-21 17:44:53 +00:00
( " grenade " , w . pPlayerGrenade )
2021-10-21 10:51:16 +00:00
2020-11-29 23:47:53 +00:00
. EndObject ( ) ;
}
return arc ;
}
FSerializer & Serialize ( FSerializer & arc , const char * keyname , PlayerSave & w , PlayerSave * def )
{
if ( arc . BeginObject ( keyname ) )
{
2022-08-23 21:36:23 +00:00
arc ( " pos " , w . pos )
2021-11-22 23:20:15 +00:00
( " sector " , w . pSector )
2020-11-29 23:47:53 +00:00
( " angle " , w . nAngle )
. EndObject ( ) ;
}
return arc ;
}
void SerializePlayer ( FSerializer & arc )
{
if ( arc . BeginObject ( " player " ) )
{
arc ( " lxvel " , lPlayerXVel )
( " lyvel " , lPlayerYVel )
( " bobangle " , bobangle )
( " standheight " , nStandHeight )
( " playercount " , PlayerCount )
( " netstartsprites " , nNetStartSprites )
( " localplayer " , nLocalPlayer )
2021-10-21 08:41:41 +00:00
( " curstartsprite " , nCurStartSprite )
2021-10-21 10:51:16 +00:00
. Array ( " netstartsprite " , nNetStartSprite , kMaxPlayers )
. Array ( " list " , PlayerList , PlayerCount ) ;
2021-10-15 20:19:07 +00:00
arc . EndObject ( ) ;
2020-11-29 23:47:53 +00:00
}
}
2019-12-26 21:00:04 +00:00
2021-05-13 20:28:02 +00:00
DEFINE_FIELD_X ( ExhumedPlayer , Player , nHealth ) ;
DEFINE_FIELD_X ( ExhumedPlayer , Player , nLives ) ;
DEFINE_FIELD_X ( ExhumedPlayer , Player , nDouble ) ;
DEFINE_FIELD_X ( ExhumedPlayer , Player , nInvisible ) ;
DEFINE_FIELD_X ( ExhumedPlayer , Player , nTorch ) ;
2021-11-21 18:33:51 +00:00
DEFINE_FIELD_X ( ExhumedPlayer , Player , nSeqSize ) ;
2021-05-13 20:28:02 +00:00
DEFINE_FIELD_X ( ExhumedPlayer , Player , nAction ) ;
2021-10-21 20:39:17 +00:00
DEFINE_FIELD_X ( ExhumedPlayer , Player , pActor ) ;
2021-05-13 20:28:02 +00:00
DEFINE_FIELD_X ( ExhumedPlayer , Player , bIsMummified ) ;
DEFINE_FIELD_X ( ExhumedPlayer , Player , invincibility ) ;
DEFINE_FIELD_X ( ExhumedPlayer , Player , nAir ) ;
DEFINE_FIELD_X ( ExhumedPlayer , Player , nSeq ) ;
DEFINE_FIELD_X ( ExhumedPlayer , Player , nMaskAmount ) ;
2021-10-15 20:19:07 +00:00
DEFINE_FIELD_X ( ExhumedPlayer , Player , keys ) ;
2021-05-13 20:28:02 +00:00
DEFINE_FIELD_X ( ExhumedPlayer , Player , nMagic ) ;
DEFINE_FIELD_X ( ExhumedPlayer , Player , nItem ) ;
DEFINE_FIELD_X ( ExhumedPlayer , Player , items ) ;
DEFINE_FIELD_X ( ExhumedPlayer , Player , nAmmo ) ; // TODO - kMaxWeapons?
DEFINE_FIELD_X ( ExhumedPlayer , Player , nCurrentWeapon ) ;
2021-11-21 18:33:51 +00:00
DEFINE_FIELD_X ( ExhumedPlayer , Player , nSeqSize2 ) ;
2021-05-13 20:28:02 +00:00
DEFINE_FIELD_X ( ExhumedPlayer , Player , bIsFiring ) ;
2021-11-21 18:33:51 +00:00
DEFINE_FIELD_X ( ExhumedPlayer , Player , nNextWeapon ) ;
DEFINE_FIELD_X ( ExhumedPlayer , Player , nState ) ;
DEFINE_FIELD_X ( ExhumedPlayer , Player , nLastWeapon ) ;
2021-05-13 20:28:02 +00:00
DEFINE_FIELD_X ( ExhumedPlayer , Player , nRun ) ;
DEFINE_FIELD_X ( ExhumedPlayer , Player , bPlayerPan ) ;
DEFINE_FIELD_X ( ExhumedPlayer , Player , bLockPan ) ;
DEFINE_ACTION_FUNCTION ( _Exhumed , GetViewPlayer )
{
ACTION_RETURN_POINTER ( & PlayerList [ nLocalPlayer ] ) ;
}
2021-07-16 13:52:56 +00:00
DEFINE_ACTION_FUNCTION ( _Exhumed , GetPistolClip )
{
2021-10-21 10:51:16 +00:00
ACTION_RETURN_POINTER ( & PlayerList [ nLocalPlayer ] . nPistolClip ) ;
2021-07-16 13:52:56 +00:00
}
2021-07-17 04:57:43 +00:00
DEFINE_ACTION_FUNCTION ( _Exhumed , GetPlayerClip )
{
2021-10-21 10:51:16 +00:00
ACTION_RETURN_POINTER ( & PlayerList [ nLocalPlayer ] . nPlayerClip ) ;
2021-07-17 04:57:43 +00:00
}
2021-05-13 20:28:02 +00:00
DEFINE_ACTION_FUNCTION ( _ExhumedPlayer , IsUnderwater )
{
PARAM_SELF_STRUCT_PROLOGUE ( Player ) ;
auto nLocalPlayer = self - PlayerList ;
2021-11-22 23:20:15 +00:00
ACTION_RETURN_BOOL ( PlayerList [ nLocalPlayer ] . pPlayerViewSect - > Flag & kSectUnderwater ) ;
2021-05-13 20:28:02 +00:00
}
DEFINE_ACTION_FUNCTION ( _ExhumedPlayer , GetAngle )
{
PARAM_SELF_STRUCT_PROLOGUE ( Player ) ;
2022-08-16 21:15:49 +00:00
ACTION_RETURN_INT ( self - > pActor - > int_ang ( ) ) ;
2021-05-13 20:28:02 +00:00
}
2019-11-22 23:11:37 +00:00
END_PS_NS