2020-05-13 22:04:14 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
|
|
Copyright (C) 2000, 2003 - Matt Saettler (EDuke Enhancements)
|
|
|
|
Copyright (C) 2020 - Christoph Oelckers
|
|
|
|
|
|
|
|
This file is part of Enhanced Duke Nukem 3D version 1.5 - Atomic Edition
|
|
|
|
|
|
|
|
Duke Nukem 3D is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
Original Source: 1996 - Todd Replogle
|
|
|
|
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|
|
|
|
|
|
|
EDuke enhancements integrated: 04/13/2003 - Matt Saettler
|
|
|
|
|
|
|
|
Note: EDuke source was in transition. Changes are in-progress in the
|
|
|
|
source as it is released.
|
|
|
|
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
#include "ns.h"
|
2020-05-14 07:07:07 +00:00
|
|
|
#include "concmd.h"
|
2020-06-23 20:01:58 +00:00
|
|
|
#include "duke3d.h"
|
2020-05-13 22:04:14 +00:00
|
|
|
#include "gamevar.h"
|
2020-07-07 15:56:20 +00:00
|
|
|
#include "mapinfo.h"
|
2020-09-03 21:10:28 +00:00
|
|
|
#include "gamestate.h"
|
2020-09-17 20:36:09 +00:00
|
|
|
#include "conlabel.h"
|
|
|
|
#include "automap.h"
|
2020-10-17 08:30:11 +00:00
|
|
|
#include "dukeactor.h"
|
2020-05-13 22:04:14 +00:00
|
|
|
|
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
2020-07-06 14:24:22 +00:00
|
|
|
// Player Actions - used by ifp instruction.
|
|
|
|
enum playeraction_t {
|
2021-11-09 23:05:42 +00:00
|
|
|
pstanding = 0x00000001,
|
|
|
|
pwalking = 0x00000002,
|
|
|
|
prunning = 0x00000004,
|
|
|
|
pducking = 0x00000008,
|
|
|
|
pfalling = 0x00000010,
|
|
|
|
pjumping = 0x00000020,
|
|
|
|
phigher = 0x00000040,
|
|
|
|
pwalkingback = 0x00000080,
|
|
|
|
prunningback = 0x00000100,
|
|
|
|
pkicking = 0x00000200,
|
|
|
|
pshrunk = 0x00000400,
|
|
|
|
pjetpack = 0x00000800,
|
|
|
|
ponsteroids = 0x00001000,
|
|
|
|
ponground = 0x00002000,
|
|
|
|
palive = 0x00004000,
|
|
|
|
pdead = 0x00008000,
|
|
|
|
pfacing = 0x00010000
|
2020-07-06 14:24:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-07-18 10:37:35 +00:00
|
|
|
struct ParseState
|
|
|
|
{
|
2020-11-01 16:57:40 +00:00
|
|
|
int g_p;
|
2020-07-18 10:37:35 +00:00
|
|
|
int g_x;
|
|
|
|
int* g_t;
|
|
|
|
uint8_t killit_flag;
|
2020-10-24 07:35:43 +00:00
|
|
|
DDukeActor *g_ac;
|
2020-07-18 10:37:35 +00:00
|
|
|
int* insptr;
|
2020-10-23 18:18:38 +00:00
|
|
|
Collision coll;
|
2020-07-18 10:37:35 +00:00
|
|
|
|
|
|
|
int parse(void);
|
|
|
|
void parseifelse(int condition);
|
|
|
|
};
|
|
|
|
|
2020-10-21 23:12:16 +00:00
|
|
|
int furthestcanseepoint(DDukeActor* i, DDukeActor* ts, int* dax, int* day);
|
2020-10-22 17:12:48 +00:00
|
|
|
bool ifsquished(DDukeActor* i, int p);
|
2020-11-01 16:57:40 +00:00
|
|
|
void fakebubbaspawn(DDukeActor* actor, int g_p);
|
2021-11-21 08:08:05 +00:00
|
|
|
void tearitup(sectortype* sect);
|
2020-10-22 21:41:07 +00:00
|
|
|
void destroyit(DDukeActor* actor);
|
2020-11-01 16:57:40 +00:00
|
|
|
void mamaspawn(DDukeActor* actor);
|
2020-09-20 10:01:05 +00:00
|
|
|
void forceplayerangle(int snum);
|
2020-05-14 07:07:07 +00:00
|
|
|
|
2020-07-18 10:37:35 +00:00
|
|
|
bool killthesprite = false;
|
|
|
|
|
2020-05-14 21:25:53 +00:00
|
|
|
void addspritetodelete(int spnum)
|
|
|
|
{
|
2020-05-15 06:04:30 +00:00
|
|
|
killthesprite = true;
|
2020-05-14 21:25:53 +00:00
|
|
|
}
|
|
|
|
|
2021-12-05 16:36:57 +00:00
|
|
|
sectortype* toSect(int index)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2021-12-05 16:36:57 +00:00
|
|
|
return validSectorIndex(index) ? §or[index] : nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
int fromSect(sectortype* sect)
|
|
|
|
{
|
|
|
|
return sect ? sectnum(sect) : -1;
|
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
|
2021-12-05 16:36:57 +00:00
|
|
|
walltype* toWall(int index)
|
|
|
|
{
|
|
|
|
return validWallIndex(index) ? &wall[index] : nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
int fromWall(walltype* sect)
|
|
|
|
{
|
|
|
|
return sect ? wallnum(sect) : -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void DoUserDef(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, int sPlayer, int lParm2)
|
|
|
|
{
|
|
|
|
auto vValue = GetGameVarID(lVar2, sActor, sPlayer);
|
|
|
|
auto lValue = vValue.safeValue();
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
// most settings have been removed because they are either pointless, no longer existent or simply too dangerous to access.
|
|
|
|
// Others have been made read-only.
|
|
|
|
switch (lLabelID)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_GOD: // redid this so that the script won't be able to disable user-set god mode.
|
|
|
|
if (bSet) ud.god = (ud.god & ~2) | (lValue? 2:0);
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, !!ud.god, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_CASHMAN:
|
|
|
|
if (bSet) ud.cashman = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.cashman, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_EOG:
|
|
|
|
if (bSet) ud.eog = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.eog, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_SHOWALLMAP:
|
|
|
|
if (bSet) gFullMap = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, gFullMap, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_SHOWWEAPONS:
|
2020-11-29 11:23:31 +00:00
|
|
|
// Read-only user state.
|
2021-03-31 09:07:36 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, cl_showweapon, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_CAMERASPRITE:
|
2021-12-05 16:36:57 +00:00
|
|
|
if (bSet) ud.cameraactor = vValue.safeActor();
|
|
|
|
else SetGameVarID(lVar2, ud.cameraactor, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-14 10:52:59 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_LAST_CAMSPRITE:
|
2021-03-31 09:07:36 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, -1, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-14 07:07:07 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_LAST_LEVEL:
|
|
|
|
if (bSet) ud.last_level = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.last_level, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_SECRETLEVEL:
|
|
|
|
if (bSet) ud.secretlevel = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.secretlevel, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_CONST_VISIBILITY:
|
|
|
|
if (bSet) ud.const_visibility = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.const_visibility, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_SHADOWS:
|
|
|
|
if (bSet) ud.shadows = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.shadows, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case USERDEFS_M_COOP:
|
2021-03-31 09:07:36 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, ud.m_coop, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_COOP:
|
2021-03-31 09:07:36 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, ud.coop, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_RESPAWN_MONSTERS:
|
|
|
|
if (bSet) ud.respawn_monsters = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.respawn_monsters, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_RESPAWN_ITEMS:
|
|
|
|
if (bSet) ud.respawn_items = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.respawn_items, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_RESPAWN_INVENTORY:
|
|
|
|
if (bSet) ud.respawn_inventory = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.respawn_inventory, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_RECSTAT:
|
2021-03-31 09:07:36 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, ud.recstat, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_MONSTERS_OFF:
|
|
|
|
if (bSet) ud.monsters_off = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.monsters_off, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_BRIGHTNESS:
|
|
|
|
if (bSet) ud.brightness = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.brightness, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_M_RESPAWN_ITEMS:
|
|
|
|
if (bSet) ud.m_respawn_items = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.m_respawn_items, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_M_RESPAWN_MONSTERS:
|
|
|
|
if (bSet) ud.m_respawn_monsters = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.m_respawn_monsters, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_M_RESPAWN_INVENTORY:
|
|
|
|
if (bSet) ud.m_respawn_inventory = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.m_respawn_inventory, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_M_MONSTERS_OFF:
|
|
|
|
if (bSet) ud.m_monsters_off = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.m_monsters_off, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_M_FFIRE:
|
|
|
|
if (bSet) ud.m_ffire = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.m_ffire, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case USERDEFS_FFIRE:
|
|
|
|
if (bSet) ud.ffire = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.ffire, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case USERDEFS_MULTIMODE:
|
2021-03-31 09:07:36 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, ud.multimode, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case USERDEFS_PLAYER_SKILL:
|
|
|
|
if (bSet) ud.player_skill = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.player_skill, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case USERDEFS_MARKER:
|
|
|
|
if (bSet) ud.marker = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ud.marker, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
// This will also catch all deleted cases.
|
|
|
|
// make sure that the return value is always defined.
|
2021-03-31 09:07:36 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, 0, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////
|
2020-10-23 17:07:33 +00:00
|
|
|
void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, int sPlayer, int lParm2)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-12-05 16:36:57 +00:00
|
|
|
auto vValue = GetGameVarID(lVar2, sActor, sPlayer);
|
|
|
|
auto lValue = vValue.safeValue();
|
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
int iPlayer;
|
|
|
|
int lTemp;
|
|
|
|
|
|
|
|
if (lVar1 == g_iThisActorID)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-09-17 20:36:09 +00:00
|
|
|
// if they've asked for 'this', then use 'this player'...
|
|
|
|
iPlayer = sPlayer;
|
2020-05-14 07:07:07 +00:00
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
else
|
|
|
|
{
|
2021-12-05 16:36:57 +00:00
|
|
|
iPlayer = GetGameVarID(lVar1, sActor, sPlayer).safeValue();
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (iPlayer < 0 || iPlayer >= MAXPLAYERS)
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch (lLabelID)
|
|
|
|
{
|
|
|
|
case PLAYER_ZOOM:
|
2021-03-31 09:07:36 +00:00
|
|
|
SetGameVarID(lVar2, 768, sActor, sPlayer); //return default for AM zoom.
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_EXITX:
|
|
|
|
if (bSet) ps[iPlayer].exitx = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].exitx, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_EXITY:
|
|
|
|
if (bSet) ps[iPlayer].exity = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].exity, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_LOOGIEX:
|
|
|
|
if (bSet) ps[iPlayer].loogiex[lParm2] = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].loogiex[lParm2], sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_LOOGIEY:
|
2020-09-22 21:07:11 +00:00
|
|
|
if (bSet) ps[iPlayer].loogiey[lParm2] = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].loogiey[lParm2], sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_NUMLOOGS:
|
|
|
|
if (bSet) ps[iPlayer].numloogs = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].numloogs, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_LOOGCNT:
|
|
|
|
if (bSet) ps[iPlayer].loogcnt = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].loogcnt, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_POSX: // oh, my... :( Writing to these has been disabled until I know how to do it without the engine shitting all over itself.
|
2021-12-22 09:36:09 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, ps[iPlayer].pos.X, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_POSY:
|
2021-12-22 09:40:26 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, ps[iPlayer].pos.Y, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_POSZ:
|
2021-12-22 09:41:47 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, ps[iPlayer].pos.Z, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_HORIZ:
|
2021-03-31 08:48:38 +00:00
|
|
|
if (bSet)
|
|
|
|
{
|
|
|
|
if (ps[iPlayer].sync.actions & SB_CENTERVIEW)
|
|
|
|
{
|
|
|
|
ps[iPlayer].sync.actions &= ~SB_CENTERVIEW;
|
|
|
|
}
|
|
|
|
ps[iPlayer].horizon.settarget(lValue);
|
|
|
|
}
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].horizon.horiz.asbuild(), sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_OHORIZ:
|
2021-03-31 09:07:36 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, ps[iPlayer].horizon.ohoriz.asbuild(), sActor, sPlayer);
|
2020-10-07 06:12:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLAYER_HORIZOFF:
|
|
|
|
if (bSet) ps[iPlayer].horizon.horizoff = buildhoriz(lValue);
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].horizon.horizoff.asbuild(), sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_OHORIZOFF:
|
2021-03-31 09:07:36 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, ps[iPlayer].horizon.ohorizoff.asbuild(), sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_INVDISPTIME:
|
|
|
|
if (bSet) ps[iPlayer].invdisptime = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].invdisptime, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_BOBPOSX:
|
|
|
|
if (bSet) ps[iPlayer].bobposx = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].bobposx, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_BOBPOSY:
|
|
|
|
if (bSet) ps[iPlayer].bobposy = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].bobposy, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_OPOSX:
|
|
|
|
if (bSet) ps[iPlayer].oposx = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].oposx, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_OPOSY:
|
|
|
|
if (bSet) ps[iPlayer].oposy = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].oposy, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_OPOSZ:
|
|
|
|
if (bSet) ps[iPlayer].oposz = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].oposz, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_PYOFF:
|
|
|
|
if (bSet) ps[iPlayer].pyoff = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].pyoff, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_OPYOFF:
|
|
|
|
if (bSet) ps[iPlayer].opyoff = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].opyoff, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_POSXV:
|
|
|
|
if (bSet) ps[iPlayer].posxv = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].posxv, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_POSYV:
|
|
|
|
if (bSet) ps[iPlayer].posyv = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].posyv, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_POSZV:
|
|
|
|
if (bSet) ps[iPlayer].poszv = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].poszv, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_LAST_PISSED_TIME:
|
|
|
|
if (bSet) ps[iPlayer].last_pissed_time = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].last_pissed_time, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_TRUEFZ:
|
|
|
|
if (bSet) ps[iPlayer].truefz = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].truefz, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_TRUECZ:
|
|
|
|
if (bSet) ps[iPlayer].truecz = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].truecz, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-14 07:07:07 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_PLAYER_PAR:
|
|
|
|
if (bSet) ps[iPlayer].player_par = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].player_par, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_VISIBILITY:
|
|
|
|
if (bSet) ps[iPlayer].visibility = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].visibility, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_BOBCOUNTER:
|
|
|
|
if (bSet) ps[iPlayer].bobcounter = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].bobcounter, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_WEAPON_SWAY:
|
2021-12-10 06:31:51 +00:00
|
|
|
if (bSet) ps[iPlayer].oweapon_sway = ps[iPlayer].weapon_sway = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].weapon_sway, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_PALS_TIME:
|
|
|
|
if (bSet) ps[iPlayer].pals.a = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].pals.a, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_RANDOMFLAMEX:
|
|
|
|
if (bSet) ps[iPlayer].randomflamex = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].randomflamex, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_CRACK_TIME:
|
|
|
|
if (bSet) ps[iPlayer].crack_time = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].crack_time, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_AIM_MODE: // game has no business enforcing this in any way.
|
2021-03-31 09:07:36 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, ps[iPlayer].aim_mode, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_ANG:
|
2020-10-07 12:13:21 +00:00
|
|
|
if (bSet) ps[iPlayer].angle.settarget(lValue);
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].angle.ang.asbuild(), sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_OANG:
|
2021-03-31 09:07:36 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, ps[iPlayer].angle.oang.asbuild(), sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_ANGVEL: // This no longer exists.
|
2021-03-31 09:07:36 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, 0, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
2021-12-05 16:36:57 +00:00
|
|
|
case PLAYER_CURSECTNUM:
|
|
|
|
if (bSet) ps[iPlayer].cursector = toSect(lValue);
|
|
|
|
else SetGameVarID(lVar2, fromSect(ps[iPlayer].cursector), sActor, sPlayer);
|
|
|
|
break;
|
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_LOOK_ANG:
|
2021-04-11 05:43:11 +00:00
|
|
|
if (bSet) ps[iPlayer].angle.look_ang = buildang(lValue);
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].angle.look_ang.asbuild(), sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_LAST_EXTRA:
|
|
|
|
if (bSet) ps[iPlayer].last_extra = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].last_extra, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_SUBWEAPON:
|
|
|
|
if (bSet) ps[iPlayer].subweapon = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].subweapon, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_AMMO_AMOUNT:
|
2021-12-05 16:36:57 +00:00
|
|
|
lTemp = GetGameVarID(lParm2, sActor, sPlayer).safeValue();
|
2020-09-17 20:36:09 +00:00
|
|
|
if (bSet) ps[iPlayer].ammo_amount[lTemp] = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].ammo_amount[lTemp], sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_WACKEDBYACTOR:
|
2021-12-05 16:36:57 +00:00
|
|
|
if (bSet) ps[iPlayer].wackedbyactor = vValue.safeActor();
|
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].wackedbyactor, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_FRAG:
|
|
|
|
if (bSet) ps[iPlayer].frag = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].frag, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_FRAGGEDSELF:
|
|
|
|
if (bSet) ps[iPlayer].fraggedself = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].fraggedself, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_CURR_WEAPON:
|
|
|
|
if (bSet) ps[iPlayer].curr_weapon = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].curr_weapon, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_LAST_WEAPON:
|
|
|
|
if (bSet) ps[iPlayer].last_weapon = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].last_weapon, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_TIPINCS:
|
|
|
|
if (bSet) ps[iPlayer].tipincs = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].tipincs, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_WANTWEAPONFIRE:
|
|
|
|
if (bSet) ps[iPlayer].wantweaponfire = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].wantweaponfire, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_HOLODUKE_AMOUNT:
|
|
|
|
if (bSet) ps[iPlayer].holoduke_amount = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].holoduke_amount, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_NEWOWNER:
|
2021-12-05 16:36:57 +00:00
|
|
|
if (bSet) ps[iPlayer].newOwner = vValue.safeActor();
|
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].newOwner, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_HURT_DELAY:
|
|
|
|
if (bSet) ps[iPlayer].hurt_delay = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].hurt_delay, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_HBOMB_HOLD_DELAY:
|
|
|
|
if (bSet) ps[iPlayer].hbomb_hold_delay = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].hbomb_hold_delay, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_JUMPING_COUNTER:
|
|
|
|
if (bSet) ps[iPlayer].jumping_counter = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].jumping_counter, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_AIRLEFT:
|
|
|
|
if (bSet) ps[iPlayer].airleft = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].airleft, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-05-14 10:14:03 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_KNEE_INCS:
|
|
|
|
if (bSet) ps[iPlayer].knee_incs = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].knee_incs, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-14 10:14:03 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_ACCESS_INCS:
|
|
|
|
if (bSet) ps[iPlayer].access_incs = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].access_incs, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-14 10:14:03 +00:00
|
|
|
|
2021-12-05 16:36:57 +00:00
|
|
|
case PLAYER_ACCESS_WALLNUM:
|
|
|
|
if (bSet) ps[iPlayer].access_wall = toWall(lValue);
|
|
|
|
else SetGameVarID(lVar2, fromWall(ps[iPlayer].access_wall), sActor, sPlayer);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLAYER_ACCESS_SPRITENUM:
|
|
|
|
if (bSet) ps[iPlayer].access_spritenum = vValue.safeActor();
|
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].access_spritenum, sActor, sPlayer);
|
|
|
|
break;
|
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_KICKBACK_PIC:
|
2021-12-10 06:31:51 +00:00
|
|
|
if (bSet) ps[iPlayer].okickback_pic = ps[iPlayer].kickback_pic = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].kickback_pic, sActor, sPlayer);
|
2020-05-14 10:14:03 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_GOT_ACCESS:
|
|
|
|
if (bSet) ps[iPlayer].got_access = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].got_access, sActor, sPlayer);
|
2020-05-14 10:14:03 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_WEAPON_ANG:
|
|
|
|
if (bSet) ps[iPlayer].weapon_ang = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].weapon_ang, sActor, sPlayer);
|
2020-05-14 10:14:03 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_FIRSTAID_AMOUNT:
|
|
|
|
if (bSet) ps[iPlayer].firstaid_amount = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].firstaid_amount, sActor, sPlayer);
|
2020-05-14 10:14:03 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_SOMETHINGONPLAYER:
|
2021-12-05 16:36:57 +00:00
|
|
|
if (bSet) ps[iPlayer].somethingonplayer = vValue.safeActor();
|
|
|
|
else SetGameVarID(lVar2, (ps[iPlayer].somethingonplayer), sActor, sPlayer);
|
2020-05-14 10:14:03 +00:00
|
|
|
break;
|
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_ON_CRANE:
|
2021-12-05 16:36:57 +00:00
|
|
|
if (bSet) ps[iPlayer].on_crane = vValue.safeActor();
|
|
|
|
else SetGameVarID(lVar2, (ps[iPlayer].on_crane), sActor, sPlayer);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLAYER_I: // Read only, because this is very dangerous.
|
|
|
|
if (!bSet) SetGameVarID(lVar2, ps[iPlayer].actor, sActor, sPlayer);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLAYER_ONE_PARALLAX_SECTNUM:
|
|
|
|
if (bSet) ps[iPlayer].one_parallax_sectnum = toSect(lValue);
|
|
|
|
else SetGameVarID(lVar2, fromSect(ps[iPlayer].one_parallax_sectnum), sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-14 10:14:03 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_OVER_SHOULDER_ON:
|
|
|
|
if (bSet) ps[iPlayer].over_shoulder_on = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].over_shoulder_on, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-14 10:14:03 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_RANDOM_CLUB_FRAME:
|
2021-12-10 06:31:51 +00:00
|
|
|
if (bSet) ps[iPlayer].orandom_club_frame = ps[iPlayer].random_club_frame = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].random_club_frame, sActor, sPlayer);
|
2020-05-14 10:14:03 +00:00
|
|
|
break;
|
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_FIST_INCS:
|
|
|
|
if (bSet) ps[iPlayer].fist_incs = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].fist_incs, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-14 10:14:03 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_ONE_EIGHTY_COUNT:
|
2021-04-11 05:43:11 +00:00
|
|
|
if (bSet) ps[iPlayer].angle.spin = lValue;
|
2021-05-12 15:57:36 +00:00
|
|
|
else SetGameVarID(lVar2, int(ps[iPlayer].angle.spin), sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_CHEAT_PHASE:
|
|
|
|
if (bSet) ps[iPlayer].cheat_phase = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].cheat_phase, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_DUMMYPLAYERSPRITE:
|
2021-12-05 16:36:57 +00:00
|
|
|
if (bSet) ps[iPlayer].dummyplayersprite = vValue.safeActor();
|
|
|
|
else SetGameVarID(lVar2, (ps[iPlayer].dummyplayersprite), sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_EXTRA_EXTRA8:
|
|
|
|
if (bSet) ps[iPlayer].extra_extra8 = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].extra_extra8, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_QUICK_KICK:
|
|
|
|
if (bSet) ps[iPlayer].quick_kick = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].quick_kick, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_HEAT_AMOUNT:
|
|
|
|
if (bSet) ps[iPlayer].heat_amount = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].heat_amount, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_ACTORSQU:
|
2021-12-05 16:36:57 +00:00
|
|
|
if (bSet) ps[iPlayer].actorsqu = vValue.safeActor();
|
|
|
|
else SetGameVarID(lVar2, (ps[iPlayer].actorsqu), sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_TIMEBEFOREEXIT:
|
|
|
|
if (bSet) ps[iPlayer].timebeforeexit = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].timebeforeexit, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_CUSTOMEXITSOUND:
|
|
|
|
if (bSet) ps[iPlayer].customexitsound = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].customexitsound, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_WEAPRECS:
|
|
|
|
if (bSet) ps[iPlayer].weaprecs[lParm2] = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].weaprecs[lParm2], sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_WEAPRECCNT:
|
|
|
|
if (bSet) ps[iPlayer].weapreccnt = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].weapreccnt, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_INTERFACE_TOGGLE_FLAG:
|
|
|
|
if (bSet) ps[iPlayer].interface_toggle_flag = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].interface_toggle_flag, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_ROTSCRNANG:
|
2021-11-06 06:57:37 +00:00
|
|
|
if (bSet)
|
|
|
|
{
|
|
|
|
ps[iPlayer].angle.orotscrnang = ps[iPlayer].angle.rotscrnang;
|
|
|
|
ps[iPlayer].angle.rotscrnang = buildang(lValue);
|
|
|
|
}
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].angle.rotscrnang.asbuild(), sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_DEAD_FLAG:
|
|
|
|
if (bSet) ps[iPlayer].dead_flag = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].dead_flag, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_SHOW_EMPTY_WEAPON:
|
|
|
|
if (bSet) ps[iPlayer].show_empty_weapon = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].show_empty_weapon, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_SCUBA_AMOUNT:
|
|
|
|
if (bSet) ps[iPlayer].scuba_amount = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].scuba_amount, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_JETPACK_AMOUNT:
|
|
|
|
if (bSet) ps[iPlayer].jetpack_amount = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].jetpack_amount, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_STEROIDS_AMOUNT:
|
|
|
|
if (bSet) ps[iPlayer].steroids_amount = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].steroids_amount, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_SHIELD_AMOUNT:
|
|
|
|
if (bSet) ps[iPlayer].shield_amount = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].shield_amount, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-14 07:07:07 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_HOLODUKE_ON:
|
2021-12-05 16:36:57 +00:00
|
|
|
if (bSet) ps[iPlayer].holoduke_on = vValue.safeActor();
|
|
|
|
else SetGameVarID(lVar2, (ps[iPlayer].holoduke_on), sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-14 07:07:07 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_PYCOUNT:
|
|
|
|
if (bSet) ps[iPlayer].pycount = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].pycount, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_WEAPON_POS:
|
2021-12-10 06:31:51 +00:00
|
|
|
if (bSet) ps[iPlayer].oweapon_pos = ps[iPlayer].weapon_pos = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].weapon_pos, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_FRAG_PS:
|
|
|
|
if (bSet) ps[iPlayer].frag_ps = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].frag_ps, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_TRANSPORTER_HOLD:
|
|
|
|
if (bSet) ps[iPlayer].transporter_hold = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].transporter_hold, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_LAST_FULL_WEAPON:
|
|
|
|
if (bSet) ps[iPlayer].last_full_weapon = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].last_full_weapon, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_FOOTPRINTSHADE:
|
|
|
|
if (bSet) ps[iPlayer].footprintshade = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].footprintshade, sActor, sPlayer);
|
2020-05-14 17:23:36 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_BOOT_AMOUNT:
|
|
|
|
if (bSet) ps[iPlayer].boot_amount = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].boot_amount, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_GM:
|
2021-03-31 09:07:36 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, MODE_GAME, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-20 22:01:41 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_ON_WARPING_SECTOR:
|
|
|
|
if (bSet) ps[iPlayer].on_warping_sector = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].on_warping_sector, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-20 22:01:41 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_FOOTPRINTCOUNT:
|
|
|
|
if (bSet) ps[iPlayer].footprintcount = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].footprintcount, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-20 22:01:41 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_HBOMB_ON:
|
|
|
|
if (bSet) ps[iPlayer].hbomb_on = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].hbomb_on, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-20 22:01:41 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_JUMPING_TOGGLE:
|
|
|
|
if (bSet) ps[iPlayer].jumping_toggle = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].jumping_toggle, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-20 22:01:41 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_RAPID_FIRE_HOLD:
|
|
|
|
if (bSet) ps[iPlayer].rapid_fire_hold = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].rapid_fire_hold, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2020-05-20 22:01:41 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_ON_GROUND:
|
|
|
|
if (bSet) ps[iPlayer].on_ground = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].on_ground, sActor, sPlayer);
|
2020-05-14 10:14:03 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_INVEN_ICON:
|
|
|
|
if (bSet) ps[iPlayer].inven_icon = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].inven_icon, sActor, sPlayer);
|
2020-05-14 10:14:03 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_BUTTONPALETTE:
|
|
|
|
if (bSet) ps[iPlayer].buttonpalette = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].buttonpalette, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_JETPACK_ON:
|
|
|
|
if (bSet) ps[iPlayer].jetpack_on = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].jetpack_on, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_SPRITEBRIDGE:
|
|
|
|
if (bSet) ps[iPlayer].spritebridge = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].spritebridge, sActor, sPlayer);
|
2020-05-14 10:14:03 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_LASTRANDOMSPOT:
|
|
|
|
if (bSet) ps[iPlayer].lastrandomspot = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].lastrandomspot, sActor, sPlayer);
|
2020-05-14 10:14:03 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_SCUBA_ON:
|
|
|
|
if (bSet) ps[iPlayer].scuba_on = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].scuba_on, sActor, sPlayer);
|
2020-05-14 10:14:03 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_FOOTPRINTPAL:
|
|
|
|
if (bSet) ps[iPlayer].footprintpal = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].footprintpal, sActor, sPlayer);
|
2020-05-14 10:14:03 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_HEAT_ON:
|
|
|
|
if (bSet) ps[iPlayer].heat_on = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].heat_on, sActor, sPlayer);
|
2020-05-14 10:14:03 +00:00
|
|
|
break;
|
2020-05-14 17:23:36 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
case PLAYER_HOLSTER_WEAPON:
|
|
|
|
if (bSet) ps[iPlayer].holster_weapon = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].holster_weapon, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_FALLING_COUNTER:
|
|
|
|
if (bSet) ps[iPlayer].falling_counter = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].falling_counter, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_GOTWEAPON:
|
2021-11-14 14:03:50 +00:00
|
|
|
if (bSet) ps[iPlayer].gotweapon[lParm2] = !!lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].gotweapon[lParm2], sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_REFRESH_INVENTORY:
|
|
|
|
if (bSet) ps[iPlayer].refresh_inventory = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].refresh_inventory, sActor, sPlayer);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case PLAYER_TOGGLE_KEY_FLAG:
|
|
|
|
if (bSet) ps[iPlayer].toggle_key_flag = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].toggle_key_flag, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLAYER_KNUCKLE_INCS:
|
|
|
|
if (bSet) ps[iPlayer].knuckle_incs = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].knuckle_incs, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLAYER_WALKING_SND_TOGGLE:
|
|
|
|
if (bSet) ps[iPlayer].walking_snd_toggle = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].walking_snd_toggle, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLAYER_PALOOKUP:
|
|
|
|
if (bSet) ps[iPlayer].palookup = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].palookup, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLAYER_HARD_LANDING:
|
2021-12-10 06:31:51 +00:00
|
|
|
if (bSet) ps[iPlayer].ohard_landing = ps[iPlayer].hard_landing = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].hard_landing, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLAYER_MAX_SECRET_ROOMS:
|
|
|
|
if (bSet) ps[iPlayer].max_secret_rooms = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].max_secret_rooms, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLAYER_SECRET_ROOMS:
|
|
|
|
if (bSet) ps[iPlayer].secret_rooms = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].secret_rooms, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLAYER_MAX_ACTORS_KILLED:
|
|
|
|
if (bSet) ps[iPlayer].max_actors_killed = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].max_actors_killed, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PLAYER_ACTORS_KILLED:
|
|
|
|
if (bSet) ps[iPlayer].actors_killed = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, ps[iPlayer].actors_killed, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
2020-10-10 05:59:00 +00:00
|
|
|
case PLAYER_RETURN_TO_CENTER:
|
|
|
|
if (bSet)
|
|
|
|
{
|
|
|
|
ps[iPlayer].sync.actions |= SB_CENTERVIEW;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-07 10:14:29 +00:00
|
|
|
auto center = ps[iPlayer].sync.actions & SB_CENTERVIEW ? abs(xs_CRoundToInt(ps[iPlayer].horizon.horiz.asq16() * (9. / gi->playerHorizMax()))) : 0;
|
2021-03-31 09:07:36 +00:00
|
|
|
SetGameVarID(lVar2, center, sActor, sPlayer);
|
2020-10-10 05:59:00 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
default:
|
2021-03-31 09:07:36 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, 0, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////
|
2021-11-07 11:53:48 +00:00
|
|
|
void DoWall(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, int sPlayer, int lParm2)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-12-05 16:36:57 +00:00
|
|
|
auto lValue = GetGameVarID(lVar2, sActor, sPlayer).safeValue();
|
|
|
|
auto vWall = GetGameVarID(lVar1, sActor, sPlayer);
|
2021-12-21 09:51:41 +00:00
|
|
|
auto iWall = vWall.safeValue();
|
2020-09-17 20:36:09 +00:00
|
|
|
|
2021-12-21 08:54:21 +00:00
|
|
|
if (iWall < 0 || iWall >= (int)wall.Size() || vWall.isActor())
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-03-31 09:07:36 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, 0, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-11-06 23:29:16 +00:00
|
|
|
auto wallp = &wall[iWall];
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
// All fields affecting map geometry have been made read-only!
|
|
|
|
switch (lLabelID)
|
|
|
|
{
|
|
|
|
case WALL_X:
|
2021-12-22 09:59:50 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, wallp->pos.X, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case WALL_Y:
|
2021-11-06 23:29:16 +00:00
|
|
|
if (bSet) SetGameVarID(lVar2, wallp->y, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case WALL_POINT2:
|
2021-11-06 23:29:16 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, wallp->point2, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case WALL_NEXTWALL:
|
2021-11-06 23:29:16 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, wallp->nextwall, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case WALL_NEXTSECTOR:
|
2021-11-06 23:29:16 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, wallp->nextsector, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case WALL_CSTAT:
|
2021-12-18 14:36:50 +00:00
|
|
|
if (bSet) wallp->cstat = EWallFlags::FromInt(lValue);
|
2021-11-06 23:29:16 +00:00
|
|
|
else SetGameVarID(lVar2, wallp->cstat, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case WALL_PICNUM:
|
2021-11-06 23:29:16 +00:00
|
|
|
if (bSet) wallp->picnum = lValue;
|
|
|
|
else SetGameVarID(lVar2, wallp->picnum, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case WALL_OVERPICNUM:
|
2021-11-06 23:29:16 +00:00
|
|
|
if (bSet) wallp->overpicnum = lValue;
|
|
|
|
else SetGameVarID(lVar2, wallp->overpicnum, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case WALL_SHADE:
|
2021-11-06 23:29:16 +00:00
|
|
|
if (bSet) wallp->shade = lValue;
|
|
|
|
else SetGameVarID(lVar2, wallp->shade, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case WALL_PAL:
|
2021-11-06 23:29:16 +00:00
|
|
|
if (bSet) wallp->pal = lValue;
|
|
|
|
else SetGameVarID(lVar2, wallp->pal, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case WALL_XREPEAT:
|
2021-11-06 23:29:16 +00:00
|
|
|
if (bSet) wallp->xrepeat = lValue;
|
|
|
|
else SetGameVarID(lVar2, wallp->xrepeat, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case WALL_YREPEAT:
|
2021-11-06 23:29:16 +00:00
|
|
|
if (bSet) wallp->yrepeat = lValue;
|
|
|
|
else SetGameVarID(lVar2, wallp->yrepeat, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case WALL_XPANNING:
|
2021-11-06 23:29:16 +00:00
|
|
|
if (bSet) wallp->xpan_ = (float)(lValue & 255);
|
|
|
|
else SetGameVarID(lVar2, wallp->xpan(), sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case WALL_YPANNING:
|
2021-11-06 23:29:16 +00:00
|
|
|
if (bSet) wallp->ypan_ = (float)(lValue & 255);
|
|
|
|
else SetGameVarID(lVar2, wallp->ypan(), sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case WALL_LOTAG:
|
2021-11-06 23:29:16 +00:00
|
|
|
if (bSet) wallp->lotag = lValue;
|
|
|
|
else SetGameVarID(lVar2, wallp->lotag, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case WALL_HITAG:
|
2021-11-06 23:29:16 +00:00
|
|
|
if (bSet) wallp->hitag = lValue;
|
|
|
|
else SetGameVarID(lVar2, wallp->hitag, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case WALL_EXTRA:
|
2021-11-06 23:29:16 +00:00
|
|
|
if (bSet) wallp->extra = lValue;
|
|
|
|
else SetGameVarID(lVar2, wallp->extra, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-11-07 11:53:48 +00:00
|
|
|
void DoSector(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, int sPlayer, int lParm2)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
int iSector;
|
|
|
|
int lValue;
|
2021-12-05 16:36:57 +00:00
|
|
|
bool no = false;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
if (lVar1 == g_iThisActorID)
|
|
|
|
{
|
|
|
|
// if they've asked for 'this', then use 'this'...
|
2021-12-21 17:19:45 +00:00
|
|
|
iSector = sActor->spr.sectno();
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-05 16:36:57 +00:00
|
|
|
auto vv = GetGameVarID(lVar1, sActor, sPlayer);
|
|
|
|
no = vv.isActor();
|
|
|
|
iSector = vv.safeValue();
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
|
2021-12-21 09:51:41 +00:00
|
|
|
if (iSector < 0 || iSector >= (int)sector.Size() || no)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-03-31 09:07:36 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, 0, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-05 16:36:57 +00:00
|
|
|
lValue = GetGameVarID(lVar2, sActor, sPlayer).safeValue();
|
2021-11-06 22:05:25 +00:00
|
|
|
auto sectp = §or[iSector];
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
// All fields affecting map geometry have been made read-only!
|
|
|
|
switch (lLabelID)
|
|
|
|
{
|
|
|
|
case SECTOR_WALLPTR:
|
2021-11-06 22:05:25 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, sectp->wallptr, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_WALLNUM:
|
2021-11-06 22:05:25 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, sectp->wallnum, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_CEILINGZ:
|
2021-11-06 22:05:25 +00:00
|
|
|
if (bSet) sectp->ceilingz = lValue;
|
|
|
|
else SetGameVarID(lVar2, sectp->ceilingz, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_FLOORZ:
|
2021-11-06 22:05:25 +00:00
|
|
|
if (bSet) sectp->floorz = lValue;
|
|
|
|
else SetGameVarID(lVar2, sectp->floorz, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_CEILINGSTAT:
|
2021-12-18 13:08:57 +00:00
|
|
|
if (bSet) sectp->ceilingstat = ESectorFlags::FromInt(lValue);
|
2021-11-06 22:05:25 +00:00
|
|
|
else SetGameVarID(lVar2, sectp->ceilingstat, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_FLOORSTAT:
|
2021-12-18 13:08:57 +00:00
|
|
|
if (bSet) sectp->floorstat = ESectorFlags::FromInt(lValue);
|
2021-11-06 22:05:25 +00:00
|
|
|
else SetGameVarID(lVar2, sectp->floorstat, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_CEILINGPICNUM:
|
2021-11-06 22:05:25 +00:00
|
|
|
if (bSet) sectp->ceilingpicnum = lValue;
|
|
|
|
else SetGameVarID(lVar2, sectp->ceilingpicnum, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_CEILINGSLOPE:
|
2021-12-17 22:33:16 +00:00
|
|
|
if (bSet) sectp->setceilingslope(lValue);
|
2021-11-06 22:05:25 +00:00
|
|
|
else SetGameVarID(lVar2, sectp->ceilingheinum, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_CEILINGSHADE:
|
2021-11-06 22:05:25 +00:00
|
|
|
if (bSet) sectp->ceilingshade = lValue;
|
|
|
|
else SetGameVarID(lVar2, sectp->ceilingshade, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_CEILINGPAL:
|
2021-11-06 22:05:25 +00:00
|
|
|
if (bSet) sectp->ceilingpal = lValue;
|
|
|
|
else SetGameVarID(lVar2, sectp->ceilingpal, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_CEILINGXPANNING:
|
2021-11-06 22:05:25 +00:00
|
|
|
if (bSet) sectp->ceilingxpan_ = (float)(lValue & 255);
|
|
|
|
else SetGameVarID(lVar2, sectp->ceilingxpan(), sActor, sPlayer);
|
2020-11-25 19:52:06 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_CEILINGYPANNING:
|
2021-11-06 22:05:25 +00:00
|
|
|
if (bSet) sectp->ceilingypan_ = (float)(lValue & 255);
|
|
|
|
else SetGameVarID(lVar2, sectp->ceilingypan(), sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_FLOORPICNUM:
|
2021-11-06 22:05:25 +00:00
|
|
|
if (bSet) sectp->floorpicnum = lValue;
|
|
|
|
else SetGameVarID(lVar2, sectp->floorpicnum, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_FLOORSLOPE:
|
2021-12-17 22:33:16 +00:00
|
|
|
if (bSet) sectp->setfloorslope(lValue);
|
2021-11-06 22:05:25 +00:00
|
|
|
else SetGameVarID(lVar2, sectp->floorheinum, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_FLOORSHADE:
|
2021-11-06 22:05:25 +00:00
|
|
|
if (bSet) sectp->floorshade = lValue;
|
|
|
|
else SetGameVarID(lVar2, sectp->floorshade, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_FLOORPAL:
|
2021-11-06 22:05:25 +00:00
|
|
|
if (bSet) sectp->floorpal = lValue;
|
|
|
|
else SetGameVarID(lVar2, sectp->floorpal, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_FLOORXPANNING:
|
2021-11-06 22:05:25 +00:00
|
|
|
if (bSet) sectp->floorxpan_ = (float)(lValue & 255);
|
|
|
|
else SetGameVarID(lVar2, sectp->floorxpan(), sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_FLOORYPANNING:
|
2021-11-06 22:05:25 +00:00
|
|
|
if (bSet) sectp->floorypan_ = (float)(lValue & 255);
|
|
|
|
else SetGameVarID(lVar2, sectp->floorypan(), sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_VISIBILITY:
|
2021-11-06 22:05:25 +00:00
|
|
|
if (bSet) sectp->visibility = lValue;
|
|
|
|
else SetGameVarID(lVar2, sectp->visibility, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_LOTAG:
|
2021-11-06 22:05:25 +00:00
|
|
|
if (bSet) sectp->lotag = lValue;
|
|
|
|
else SetGameVarID(lVar2, sectp->lotag, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_HITAG:
|
2021-11-06 22:05:25 +00:00
|
|
|
if (bSet) sectp->hitag = lValue;
|
|
|
|
else SetGameVarID(lVar2, sectp->hitag, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case SECTOR_EXTRA:
|
2021-11-06 22:05:25 +00:00
|
|
|
if (bSet) sectp->extra = lValue;
|
|
|
|
else SetGameVarID(lVar2, sectp->extra, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2021-12-05 16:36:57 +00:00
|
|
|
|
2020-10-23 17:07:33 +00:00
|
|
|
void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, int sPlayer, int lParm2)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-12-05 16:36:57 +00:00
|
|
|
auto vValue = GetGameVarID(lVar2, sActor, sPlayer);
|
|
|
|
auto lValue = vValue.safeValue();
|
2020-09-17 20:36:09 +00:00
|
|
|
|
2020-10-23 17:07:33 +00:00
|
|
|
DDukeActor* act;
|
2020-09-17 20:36:09 +00:00
|
|
|
if (lVar1 == g_iThisActorID)
|
|
|
|
{
|
|
|
|
// if they've asked for 'this', then use 'this'...
|
2020-10-23 17:07:33 +00:00
|
|
|
act = sActor;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-05 16:36:57 +00:00
|
|
|
act = GetGameVarID(lVar1, sActor, sPlayer).safeActor();
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
2021-12-05 16:36:57 +00:00
|
|
|
if (!act)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-03-31 09:07:36 +00:00
|
|
|
if (!bSet) SetGameVarID(lVar2, 0, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (lLabelID)
|
|
|
|
{
|
|
|
|
case ACTOR_X:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.x = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.x, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_Y:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.y = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.y, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_Z:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.z = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.z, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_CSTAT:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.cstat = ESpriteFlags::FromInt(lValue);
|
|
|
|
else SetGameVarID(lVar2, act->spr.cstat, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_PICNUM:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.picnum = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.picnum, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_SHADE:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.shade = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.shade, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_PAL:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.pal = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.pal, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_CLIPDIST:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.clipdist = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.clipdist, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_DETAIL:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->spriteextra = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->spriteextra, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_XREPEAT:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.xrepeat = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.xrepeat, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_YREPEAT:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.yrepeat = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.yrepeat, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_XOFFSET:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.xoffset = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.xoffset, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_YOFFSET:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.yoffset = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.yoffset, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2021-12-05 16:36:57 +00:00
|
|
|
case ACTOR_SECTNUM: // made read only because this is not safe.
|
|
|
|
if (!bSet) /*changespritesect(iActor, lValue);
|
2021-12-21 19:29:46 +00:00
|
|
|
else*/ SetGameVarID(lVar2, act->spr.sectno(), sActor, sPlayer);
|
2021-12-05 16:36:57 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_STATNUM:
|
|
|
|
if (!bSet) /*changespritestat(iActor, lValue);
|
2021-12-21 19:29:46 +00:00
|
|
|
else*/ SetGameVarID(lVar2, act->spr.statnum, sActor, sPlayer);
|
2021-12-05 16:36:57 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
case ACTOR_ANG:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.ang = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.ang, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_OWNER:
|
2021-12-05 16:36:57 +00:00
|
|
|
// there is no way to handle this well because we do not know whether this is an actor or not. Pity.
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.owner = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.owner, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_XVEL:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.xvel = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.xvel, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_YVEL:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.yvel = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.yvel, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_ZVEL:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.zvel = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.zvel, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_LOTAG:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.lotag = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.lotag, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HITAG:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.hitag = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.hitag, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_EXTRA:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.extra = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.extra, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACTOR_HTCGG:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->cgg = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->cgg, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HTPICNUM:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->picnum = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->picnum, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HTANG:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->ang = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->ang, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HTEXTRA:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->extra = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->extra, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2021-12-05 16:36:57 +00:00
|
|
|
case ACTOR_HTOWNER:
|
|
|
|
if (bSet) act->hitOwnerActor = vValue.safeActor();
|
|
|
|
else SetGameVarID(lVar2, act->hitOwnerActor, sActor, sPlayer);
|
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
case ACTOR_HTMOVFLAG:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->movflag = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->movflag, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HTTEMPANG:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->tempang = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->tempang, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
2021-12-05 16:36:57 +00:00
|
|
|
case ACTOR_HTACTORSTAYPUT:
|
|
|
|
if (bSet) act->actorstayput = toSect(lValue);
|
|
|
|
else SetGameVarID(lVar2, fromSect(act->actorstayput), sActor, sPlayer);
|
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
case ACTOR_HTDISPICNUM:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->dispicnum = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->dispicnum, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HTTIMETOSLEEP:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->timetosleep = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->timetosleep, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HTFLOORZ:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->floorz = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->floorz, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HTCEILINGZ:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->ceilingz = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->ceilingz, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HTLASTVX:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->lastvx = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->lastvx, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HTLASTVY:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->lastvy = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->lastvy, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HTBPOSX:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.ox = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.ox, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HTBPOSY:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.oy = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.oy, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HTBPOSZ:
|
2021-12-21 19:29:46 +00:00
|
|
|
if (bSet) act->spr.oz = lValue;
|
|
|
|
else SetGameVarID(lVar2, act->spr.oz, sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HTG_T0:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->temp_data[0] = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->temp_data[0], sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HTG_T1:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->temp_data[1] = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->temp_data[1], sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HTG_T2:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->temp_data[2] = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->temp_data[2], sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HTG_T3:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->temp_data[3] = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->temp_data[3], sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HTG_T4:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->temp_data[4] = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->temp_data[4], sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case ACTOR_HTG_T5:
|
2020-10-24 05:25:25 +00:00
|
|
|
if (bSet) act->temp_data[5] = lValue;
|
2021-03-31 09:07:36 +00:00
|
|
|
else SetGameVarID(lVar2, act->temp_data[5], sActor, sPlayer);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ParseState::parseifelse(int condition)
|
|
|
|
{
|
|
|
|
if( condition )
|
|
|
|
{
|
|
|
|
// skip 'else' pointer.. and...
|
|
|
|
insptr+=2;
|
|
|
|
parse();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
insptr = &ScriptCode[*(insptr+1)];
|
|
|
|
if(*insptr == 10)
|
|
|
|
{
|
|
|
|
// else...
|
|
|
|
|
|
|
|
// skip 'else' and...
|
|
|
|
insptr+=2;
|
|
|
|
parse();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-23 18:13:35 +00:00
|
|
|
static int ifcanshoottarget(DDukeActor *actor, int g_p, int g_x)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
int j;
|
|
|
|
if (g_x > 1024)
|
|
|
|
{
|
2021-11-07 13:55:28 +00:00
|
|
|
int sclip, angdif;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (badguy(actor) && actor->spr.xrepeat > 56)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
sclip = 3084;
|
|
|
|
angdif = 48;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sclip = 768;
|
|
|
|
angdif = 16;
|
|
|
|
}
|
|
|
|
|
2020-10-23 18:13:35 +00:00
|
|
|
DDukeActor* hit;
|
|
|
|
j = hitasprite(actor, &hit);
|
2020-09-17 20:36:09 +00:00
|
|
|
if (j == (1 << 30))
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (j > sclip)
|
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (hit != nullptr && hit->spr.picnum == actor->spr.picnum)
|
2020-09-17 20:36:09 +00:00
|
|
|
j = 0;
|
|
|
|
else
|
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
actor->spr.ang += angdif; j = hitasprite(actor, &hit); actor->spr.ang -= angdif;
|
2020-09-17 20:36:09 +00:00
|
|
|
if (j > sclip)
|
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (hit != nullptr && hit->spr.picnum == actor->spr.picnum)
|
2020-09-17 20:36:09 +00:00
|
|
|
j = 0;
|
|
|
|
else
|
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
actor->spr.ang -= angdif; j = hitasprite(actor, &hit); actor->spr.ang += angdif;
|
2020-09-17 20:36:09 +00:00
|
|
|
if (j > 768)
|
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (hit != nullptr && hit->spr.picnum == actor->spr.picnum)
|
2020-09-17 20:36:09 +00:00
|
|
|
j = 0;
|
|
|
|
else j = 1;
|
|
|
|
}
|
|
|
|
else j = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else j = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else j = 0;
|
|
|
|
}
|
|
|
|
else j = 1;
|
|
|
|
return j;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-01 15:26:08 +00:00
|
|
|
static bool ifcansee(DDukeActor* actor, int pnum)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
int j;
|
2020-10-23 18:14:50 +00:00
|
|
|
DDukeActor* tosee;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
// select sprite for monster to target
|
|
|
|
// if holoduke is on, let them target holoduke first.
|
|
|
|
//
|
2020-11-01 15:26:08 +00:00
|
|
|
if (ps[pnum].holoduke_on != nullptr && !isRR())
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2020-11-01 15:26:08 +00:00
|
|
|
tosee = ps[pnum].holoduke_on;
|
2021-12-21 19:29:46 +00:00
|
|
|
j = cansee(actor->spr.x, actor->spr.y, actor->spr.z - (krand() & ((32 << 8) - 1)), actor->spr.sector(), tosee->spr.x, tosee->spr.y, tosee->spr.z, tosee->sector());
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
if (j == 0)
|
|
|
|
{
|
|
|
|
// they can't see player's holoduke
|
2020-10-23 18:14:50 +00:00
|
|
|
// check for player..
|
2020-11-01 15:26:08 +00:00
|
|
|
tosee = ps[pnum].GetActor();
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
}
|
2020-11-01 15:26:08 +00:00
|
|
|
else tosee = ps[pnum].GetActor(); // holoduke not on. look for player
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
// can they see player, (or player's holoduke)
|
2021-12-21 19:29:46 +00:00
|
|
|
j = cansee(actor->spr.x, actor->spr.y, actor->spr.z - (krand() & ((47 << 8))), actor->spr.sector(), tosee->spr.x, tosee->spr.y, tosee->spr.z - ((isRR()? 28 : 24) << 8), tosee->sector());
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
if (j == 0)
|
|
|
|
{
|
2020-10-23 18:14:50 +00:00
|
|
|
// search around for target player
|
|
|
|
// also modifies 'target' x&y if found.
|
2021-11-17 23:07:38 +00:00
|
|
|
j = furthestcanseepoint(actor, tosee, &actor->lastvx, &actor->lastvy);
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// else, they did see it.
|
2020-10-23 18:14:50 +00:00
|
|
|
// save where we were looking..
|
2021-12-21 17:19:45 +00:00
|
|
|
actor->lastvx = tosee->spr.x;
|
|
|
|
actor->lastvy = tosee->spr.y;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
|
2021-12-21 19:29:46 +00:00
|
|
|
if (j == 1 && (actor->spr.statnum == STAT_ACTOR || actor->spr.statnum == STAT_STANDABLE))
|
2020-10-23 18:14:50 +00:00
|
|
|
actor->timetosleep = SLEEPTIME;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
return j == 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// int *it = 0x00589a04;
|
|
|
|
|
|
|
|
int ParseState::parse(void)
|
|
|
|
{
|
|
|
|
int j, l, s;
|
|
|
|
|
|
|
|
if(killit_flag) return 1;
|
|
|
|
|
|
|
|
switch (*insptr)
|
|
|
|
{
|
|
|
|
case concmd_ifrnd:
|
|
|
|
{
|
|
|
|
insptr++;
|
|
|
|
// HACK ALERT! The fire animation uses a broken ifrnd setup to delay its start because original CON has no variables.
|
|
|
|
// But the chosen random value of 16/255 is too low and can cause delays of a second or more.
|
2021-12-21 21:31:25 +00:00
|
|
|
int spnum = g_ac->spr.picnum;
|
2020-09-17 20:36:09 +00:00
|
|
|
if (spnum == TILE_FIRE && g_t[4] == 0 && *insptr == 16)
|
|
|
|
{
|
|
|
|
parseifelse(rnd(64));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
parseifelse(rnd(*insptr));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_ifcanshoottarget:
|
2020-10-23 18:13:35 +00:00
|
|
|
parseifelse(ifcanshoottarget(g_ac, g_p, g_x));
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifcanseetarget:
|
2021-12-22 09:41:47 +00:00
|
|
|
j = cansee(g_ac->spr.x, g_ac->spr.y, g_ac->spr.z - ((krand() & 41) << 8), g_ac->spr.sector(), ps[g_p].pos.X, ps[g_p].pos.Y, ps[g_p].pos.Z/*-((krand()&41)<<8)*/, ps[g_p].GetActor()->sector());
|
2020-09-17 20:36:09 +00:00
|
|
|
parseifelse(j);
|
2020-10-23 18:16:03 +00:00
|
|
|
if (j) g_ac->timetosleep = SLEEPTIME;
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifnocover:
|
2021-12-22 09:41:47 +00:00
|
|
|
j = cansee(g_ac->spr.x, g_ac->spr.y, g_ac->spr.z, g_ac->spr.sector(), ps[g_p].pos.X, ps[g_p].pos.Y, ps[g_p].pos.Z, ps[g_p].GetActor()->sector());
|
2020-09-17 20:36:09 +00:00
|
|
|
parseifelse(j);
|
2020-10-23 18:16:03 +00:00
|
|
|
if (j) g_ac->timetosleep = SLEEPTIME;
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case concmd_ifactornotstayput:
|
2021-11-18 19:55:22 +00:00
|
|
|
parseifelse(g_ac->actorstayput == nullptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifcansee:
|
2020-10-23 18:14:50 +00:00
|
|
|
parseifelse(ifcansee(g_ac, g_p));
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case concmd_ifhitweapon:
|
2020-10-21 19:41:14 +00:00
|
|
|
parseifelse(fi.ifhitbyweapon(g_ac) >= 0);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifsquished:
|
2020-10-22 17:12:48 +00:00
|
|
|
parseifelse(ifsquished(g_ac, g_p) == 1);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifdead:
|
|
|
|
{
|
2021-12-21 21:31:25 +00:00
|
|
|
j = g_ac->spr.extra;
|
|
|
|
if (g_ac->spr.picnum == TILE_APLAYER)
|
2020-09-17 20:36:09 +00:00
|
|
|
j--;
|
|
|
|
parseifelse(j < 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case concmd_ai:
|
|
|
|
insptr++;
|
|
|
|
g_t[5] = *insptr;
|
|
|
|
g_t[4] = ScriptCode[g_t[5]]; // Action
|
|
|
|
g_t[1] = ScriptCode[g_t[5] + 1]; // move
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.hitag = ScriptCode[g_t[5] + 2]; // Ai
|
2020-09-17 20:36:09 +00:00
|
|
|
g_t[0] = g_t[2] = g_t[3] = 0;
|
2021-12-21 21:31:25 +00:00
|
|
|
if (g_ac->spr.hitag & random_angle)
|
|
|
|
g_ac->spr.ang = krand() & 2047;
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_action:
|
|
|
|
insptr++;
|
|
|
|
g_t[2] = 0;
|
|
|
|
g_t[3] = 0;
|
|
|
|
g_t[4] = *insptr;
|
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case concmd_ifpdistl:
|
|
|
|
insptr++;
|
|
|
|
parseifelse(g_x < *insptr);
|
2020-10-23 18:16:03 +00:00
|
|
|
if (g_x > MAXSLEEPDIST && g_ac->timetosleep == 0)
|
|
|
|
g_ac->timetosleep = SLEEPTIME;
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifpdistg:
|
|
|
|
insptr++;
|
|
|
|
parseifelse(g_x > * insptr);
|
2020-10-23 18:16:03 +00:00
|
|
|
if (g_x > MAXSLEEPDIST && g_ac->timetosleep == 0)
|
|
|
|
g_ac->timetosleep = SLEEPTIME;
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_else:
|
|
|
|
insptr = &ScriptCode[*(insptr + 1)];
|
|
|
|
break;
|
|
|
|
case concmd_addstrength:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.extra += *insptr;
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_strength:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.extra = *insptr;
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_smacksprite:
|
|
|
|
switch (krand() & 1)
|
|
|
|
{
|
|
|
|
case 0:
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.ang = (+512 + g_ac->spr.ang + (krand() & 511)) & 2047;
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.ang = (-512 + g_ac->spr.ang - (krand() & 511)) & 2047;
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_fakebubba:
|
|
|
|
insptr++;
|
2020-10-22 21:41:07 +00:00
|
|
|
fakebubbaspawn(g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case concmd_rndmove:
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.ang = krand() & 2047;
|
|
|
|
g_ac->spr.xvel = 25;
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_mamatrigger:
|
2020-11-02 18:54:20 +00:00
|
|
|
operateactivators(667, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_mamaspawn:
|
2020-10-22 21:45:49 +00:00
|
|
|
mamaspawn(g_ac);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_mamaquake:
|
2021-12-21 21:31:25 +00:00
|
|
|
if (g_ac->spr.pal == 31)
|
2020-09-17 20:36:09 +00:00
|
|
|
earthquaketime = 4;
|
2021-12-21 21:31:25 +00:00
|
|
|
else if (g_ac->spr.pal == 32)
|
2020-09-17 20:36:09 +00:00
|
|
|
earthquaketime = 6;
|
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_garybanjo:
|
|
|
|
if (banjosound == 0)
|
|
|
|
{
|
2021-11-07 13:55:28 +00:00
|
|
|
int rnum = (krand() & 3) + 1;
|
2020-09-17 20:36:09 +00:00
|
|
|
if (rnum == 4)
|
|
|
|
{
|
|
|
|
banjosound = 262;
|
|
|
|
}
|
|
|
|
else if (rnum == 1)
|
|
|
|
{
|
|
|
|
banjosound = 272;
|
|
|
|
}
|
|
|
|
else if (rnum == 2)
|
|
|
|
{
|
|
|
|
banjosound = 273;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
banjosound = 273;
|
|
|
|
}
|
2020-10-23 18:16:03 +00:00
|
|
|
S_PlayActorSound(banjosound, g_ac, CHAN_WEAPON);
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
2020-10-23 18:16:03 +00:00
|
|
|
else if (!S_CheckActorSoundPlaying(g_ac, banjosound))
|
|
|
|
S_PlayActorSound(banjosound, g_ac, CHAN_WEAPON);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_motoloopsnd:
|
2020-10-23 18:16:57 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(g_ac, 411))
|
|
|
|
S_PlayActorSound(411, g_ac, CHAN_VOICE);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_ifgotweaponce:
|
|
|
|
insptr++;
|
|
|
|
|
|
|
|
if (ud.coop >= 1 && ud.multimode > 1)
|
|
|
|
{
|
|
|
|
if (*insptr == 0)
|
|
|
|
{
|
|
|
|
for (j = 0; j < ps[g_p].weapreccnt; j++)
|
2021-12-21 21:31:25 +00:00
|
|
|
if (ps[g_p].weaprecs[j] == g_ac->spr.picnum)
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
2020-10-23 18:16:57 +00:00
|
|
|
parseifelse(j < ps[g_p].weapreccnt&& g_ac->GetOwner() == g_ac);
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
else if (ps[g_p].weapreccnt < 16)
|
|
|
|
{
|
2021-12-21 21:31:25 +00:00
|
|
|
ps[g_p].weaprecs[ps[g_p].weapreccnt++] = g_ac->spr.picnum;
|
2020-10-23 18:16:57 +00:00
|
|
|
parseifelse(g_ac->GetOwner() == g_ac);
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else parseifelse(0);
|
|
|
|
break;
|
|
|
|
case concmd_getlastpal:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
if (g_ac->spr.picnum == TILE_APLAYER)
|
|
|
|
g_ac->spr.pal = ps[g_ac->spr.yvel].palookup;
|
2020-09-17 20:36:09 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// Copied from DukeGDX.
|
2021-12-21 21:31:25 +00:00
|
|
|
if (g_ac->spr.picnum == TILE_EGG && g_ac->temp_data[5] == TILE_EGG + 2 && g_ac->spr.pal == 1)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
ps[connecthead].max_actors_killed++; //revive the egg
|
2020-10-23 18:16:57 +00:00
|
|
|
g_ac->temp_data[5] = 0;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.pal = (uint8_t)g_ac->tempang;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
2020-10-23 18:16:57 +00:00
|
|
|
g_ac->tempang = 0;
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_tossweapon:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
fi.checkweapons(&ps[g_ac->spr.yvel]);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_nullop:
|
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_mikesnd:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(g_ac, g_ac->spr.yvel))
|
|
|
|
S_PlayActorSound(g_ac->spr.yvel, g_ac, CHAN_VOICE);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_pkick:
|
|
|
|
insptr++;
|
|
|
|
|
2021-12-21 21:31:25 +00:00
|
|
|
if (ud.multimode > 1 && g_ac->spr.picnum == TILE_APLAYER)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
if (ps[otherp].quick_kick == 0)
|
|
|
|
ps[otherp].quick_kick = 14;
|
|
|
|
}
|
2021-12-21 21:31:25 +00:00
|
|
|
else if (g_ac->spr.picnum != TILE_APLAYER && ps[g_p].quick_kick == 0)
|
2020-09-17 20:36:09 +00:00
|
|
|
ps[g_p].quick_kick = 14;
|
|
|
|
break;
|
|
|
|
case concmd_sizeto:
|
|
|
|
insptr++;
|
|
|
|
|
|
|
|
// JBF 20030805: As I understand it, if xrepeat becomes 0 it basically kills the
|
|
|
|
// sprite, which is why the "sizeto 0 41" calls in 1.3d became "sizeto 4 41" in
|
|
|
|
// 1.4, so instead of patching the CONs I'll surruptitiously patch the code here
|
2020-10-11 09:39:51 +00:00
|
|
|
//if (!isPlutoPak() && *insptr == 0) *insptr = 4;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
2021-12-21 21:31:25 +00:00
|
|
|
j = ((*insptr) - g_ac->spr.xrepeat) << 1;
|
|
|
|
g_ac->spr.xrepeat += Sgn(j);
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
insptr++;
|
|
|
|
|
2021-12-21 21:31:25 +00:00
|
|
|
if ((g_ac->spr.picnum == TILE_APLAYER && g_ac->spr.yrepeat < 36) || *insptr < g_ac->spr.yrepeat || ((g_ac->spr.yrepeat * (tileHeight(g_ac->spr.picnum) + 8)) << 2) < (g_ac->floorz - g_ac->ceilingz))
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-12-21 21:31:25 +00:00
|
|
|
j = ((*insptr) - g_ac->spr.yrepeat) << 1;
|
|
|
|
if (abs(j)) g_ac->spr.yrepeat += Sgn(j);
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
insptr++;
|
|
|
|
|
|
|
|
break;
|
|
|
|
case concmd_sizeat:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.xrepeat = (uint8_t)*insptr;
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.yrepeat = (uint8_t)*insptr;
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_shoot:
|
|
|
|
insptr++;
|
2020-10-24 05:34:39 +00:00
|
|
|
fi.shoot(g_ac, (short)*insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_ifsoundid:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
parseifelse((short)*insptr == ambientlotag[g_ac->spr.ang]);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifsounddist:
|
|
|
|
insptr++;
|
|
|
|
if (*insptr == 0)
|
2021-12-21 21:31:25 +00:00
|
|
|
parseifelse(ambienthitag[g_ac->spr.ang] > g_x);
|
2020-09-17 20:36:09 +00:00
|
|
|
else if (*insptr == 1)
|
2021-12-21 21:31:25 +00:00
|
|
|
parseifelse(ambienthitag[g_ac->spr.ang] < g_x);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_soundtag:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
S_PlayActorSound(ambientlotag[g_ac->spr.ang], g_ac);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_soundtagonce:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(g_ac, ambientlotag[g_ac->spr.ang]))
|
|
|
|
S_PlayActorSound(ambientlotag[g_ac->spr.ang], g_ac);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_soundonce:
|
|
|
|
insptr++;
|
2020-10-23 18:16:57 +00:00
|
|
|
if (!S_CheckSoundPlaying(*insptr++))
|
|
|
|
S_PlayActorSound(*(insptr - 1), g_ac);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_stopsound:
|
|
|
|
insptr++;
|
2020-10-23 18:16:57 +00:00
|
|
|
if (S_CheckSoundPlaying(*insptr))
|
2021-03-31 09:07:36 +00:00
|
|
|
S_StopSound(*insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_globalsound:
|
|
|
|
insptr++;
|
|
|
|
if (g_p == screenpeek || ud.coop == 1)
|
2021-03-31 09:07:36 +00:00
|
|
|
S_PlayActorSound(*insptr, ps[screenpeek].GetActor());
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_smackbubba:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
if (!isRRRA() || g_ac->spr.pal != 105)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
setnextmap(false);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case concmd_mamaend:
|
|
|
|
insptr++;
|
|
|
|
ps[myconnectindex].MamaEnd = 150;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case concmd_ifactorhealthg:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
parseifelse(g_ac->spr.extra > (short)*insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifactorhealthl:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
parseifelse(g_ac->spr.extra < (short)*insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_sound:
|
|
|
|
insptr++;
|
2020-10-23 18:16:57 +00:00
|
|
|
S_PlayActorSound((short) *insptr,g_ac);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_tip:
|
|
|
|
insptr++;
|
|
|
|
ps[g_p].tipincs = 26;
|
|
|
|
break;
|
|
|
|
case concmd_iftipcow:
|
|
|
|
case concmd_ifhittruck: // both have the same code.
|
2020-10-23 18:16:57 +00:00
|
|
|
if (g_ac->spriteextra == 1) //
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
j = 1;
|
2020-10-23 18:16:57 +00:00
|
|
|
g_ac->spriteextra++;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
j = 0;
|
|
|
|
parseifelse(j > 0);
|
|
|
|
break;
|
|
|
|
case concmd_tearitup:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
tearitup(g_ac->spr.sector());
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_fall:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.xoffset = 0;
|
|
|
|
g_ac->spr.yoffset = 0;
|
2020-10-22 21:45:49 +00:00
|
|
|
fi.fall(g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_enda:
|
|
|
|
case concmd_break:
|
|
|
|
case concmd_ends:
|
|
|
|
case concmd_endevent:
|
|
|
|
return 1;
|
|
|
|
case concmd_rightbrace:
|
|
|
|
insptr++;
|
|
|
|
return 1;
|
|
|
|
case concmd_addammo:
|
|
|
|
insptr++;
|
2020-11-29 12:54:58 +00:00
|
|
|
if( ps[g_p].ammo_amount[*insptr] >= gs.max_ammo_amount[*insptr] )
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
killit_flag = 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
addammo( *insptr, &ps[g_p], *(insptr+1) );
|
|
|
|
if(ps[g_p].curr_weapon == KNEE_WEAPON)
|
|
|
|
if( ps[g_p].gotweapon[*insptr] )
|
|
|
|
fi.addweapon( &ps[g_p], *insptr );
|
|
|
|
insptr += 2;
|
|
|
|
break;
|
|
|
|
case concmd_money:
|
|
|
|
insptr++;
|
2020-10-24 07:35:43 +00:00
|
|
|
fi.lotsofmoney(g_ac,*insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_mail:
|
|
|
|
insptr++;
|
2020-10-24 07:35:43 +00:00
|
|
|
fi.lotsofmail(g_ac,*insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_sleeptime:
|
|
|
|
insptr++;
|
2020-10-23 18:16:57 +00:00
|
|
|
g_ac->timetosleep = (short)*insptr;
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_paper:
|
|
|
|
insptr++;
|
2020-10-24 07:35:43 +00:00
|
|
|
fi.lotsofpaper(g_ac,*insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_addkills:
|
|
|
|
insptr++;
|
|
|
|
if (isRR())
|
|
|
|
{
|
2020-10-23 18:18:38 +00:00
|
|
|
if (g_ac->spriteextra < 1 || g_ac->spriteextra == 128)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2020-10-23 17:02:58 +00:00
|
|
|
if (actorfella(g_ac))
|
2020-09-17 20:36:09 +00:00
|
|
|
ps[g_p].actors_killed += *insptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else ps[g_p].actors_killed += *insptr;
|
2021-11-18 19:55:22 +00:00
|
|
|
g_ac->actorstayput = nullptr;
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_lotsofglass:
|
|
|
|
insptr++;
|
2020-10-25 05:40:05 +00:00
|
|
|
spriteglass(g_ac, *insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_killit:
|
|
|
|
insptr++;
|
|
|
|
killit_flag = 1;
|
|
|
|
break;
|
|
|
|
case concmd_addweapon:
|
|
|
|
insptr++;
|
|
|
|
if( ps[g_p].gotweapon[*insptr] == 0 ) fi.addweapon( &ps[g_p], *insptr );
|
2020-11-29 12:54:58 +00:00
|
|
|
else if( ps[g_p].ammo_amount[*insptr] >= gs.max_ammo_amount[*insptr] )
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
killit_flag = 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
addammo( *insptr, &ps[g_p], *(insptr+1) );
|
|
|
|
if(ps[g_p].curr_weapon == KNEE_WEAPON)
|
|
|
|
if( ps[g_p].gotweapon[*insptr] )
|
|
|
|
fi.addweapon( &ps[g_p], *insptr );
|
|
|
|
insptr+=2;
|
|
|
|
break;
|
|
|
|
case concmd_debug:
|
|
|
|
insptr++;
|
|
|
|
Printf("%d\n",*insptr);
|
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_endofgame:
|
|
|
|
insptr++;
|
|
|
|
ps[g_p].timebeforeexit = *insptr;
|
|
|
|
ps[g_p].customexitsound = -1;
|
|
|
|
ud.eog = true;
|
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case concmd_isdrunk: // todo: move out to player_r.
|
|
|
|
insptr++;
|
|
|
|
ps[g_p].drink_amt += *insptr;
|
2021-12-21 17:19:45 +00:00
|
|
|
j = ps[g_p].GetActor()->spr.extra;
|
2020-09-17 20:36:09 +00:00
|
|
|
if (j > 0)
|
|
|
|
j += *insptr;
|
2020-11-29 12:54:58 +00:00
|
|
|
if (j > gs.max_player_health * 2)
|
|
|
|
j = gs.max_player_health * 2;
|
2020-09-17 20:36:09 +00:00
|
|
|
if (j < 0)
|
|
|
|
j = 0;
|
|
|
|
|
|
|
|
if (ud.god == 0)
|
|
|
|
{
|
|
|
|
if (*insptr > 0)
|
|
|
|
{
|
2020-11-29 12:54:58 +00:00
|
|
|
if ((j - *insptr) < (gs.max_player_health >> 2) &&
|
|
|
|
j >= (gs.max_player_health >> 2))
|
2020-11-02 19:23:05 +00:00
|
|
|
S_PlayActorSound(DUKE_GOTHEALTHATLOW, ps[g_p].GetActor());
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
ps[g_p].last_extra = j;
|
|
|
|
}
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
ps[g_p].GetActor()->spr.extra = j;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
if (ps[g_p].drink_amt > 100)
|
|
|
|
ps[g_p].drink_amt = 100;
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (ps[g_p].GetActor()->spr.extra >= gs.max_player_health)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
ps[g_p].GetActor()->spr.extra = gs.max_player_health;
|
2020-11-29 12:54:58 +00:00
|
|
|
ps[g_p].last_extra = gs.max_player_health;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_strafeleft:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
movesprite_ex(g_ac, -bsin(g_ac->spr.ang, -10), bcos(g_ac->spr.ang, -10), g_ac->spr.zvel, CLIPMASK0, coll);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_straferight:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
movesprite_ex(g_ac, bsin(g_ac->spr.ang, -10), -bcos(g_ac->spr.ang, -10), g_ac->spr.zvel, CLIPMASK0, coll);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_larrybird:
|
|
|
|
insptr++;
|
2021-12-22 09:41:47 +00:00
|
|
|
ps[g_p].pos.Z = ps[g_p].GetActor()->sector()->ceilingz;
|
|
|
|
ps[g_p].GetActor()->spr.z = ps[g_p].pos.Z;
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_destroyit:
|
|
|
|
insptr++;
|
2020-10-22 21:41:07 +00:00
|
|
|
destroyit(g_ac);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_iseat: // move out to player_r.
|
|
|
|
insptr++;
|
|
|
|
ps[g_p].eat += *insptr;
|
|
|
|
if (ps[g_p].eat > 100)
|
|
|
|
{
|
|
|
|
ps[g_p].eat = 100;
|
|
|
|
}
|
|
|
|
ps[g_p].drink_amt -= *insptr;
|
|
|
|
if (ps[g_p].drink_amt < 0)
|
|
|
|
ps[g_p].drink_amt = 0;
|
2021-12-21 17:19:45 +00:00
|
|
|
j = ps[g_p].GetActor()->spr.extra;
|
2021-12-21 21:31:25 +00:00
|
|
|
if (g_ac->spr.picnum != TILE_ATOMICHEALTH)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2020-11-29 12:54:58 +00:00
|
|
|
if (j > gs.max_player_health && *insptr > 0)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (j > 0)
|
|
|
|
j += (*insptr) * 3;
|
2020-11-29 12:54:58 +00:00
|
|
|
if (j > gs.max_player_health && *insptr > 0)
|
|
|
|
j = gs.max_player_health;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (j > 0)
|
|
|
|
j += *insptr;
|
2020-11-29 12:54:58 +00:00
|
|
|
if (j > (gs.max_player_health << 1))
|
|
|
|
j = (gs.max_player_health << 1);
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (j < 0) j = 0;
|
|
|
|
|
|
|
|
if (ud.god == 0)
|
|
|
|
{
|
|
|
|
if (*insptr > 0)
|
|
|
|
{
|
2020-11-29 12:54:58 +00:00
|
|
|
if ((j - *insptr) < (gs.max_player_health >> 2) &&
|
|
|
|
j >= (gs.max_player_health >> 2))
|
2020-11-02 19:23:05 +00:00
|
|
|
S_PlayActorSound(229, ps[g_p].GetActor());
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
ps[g_p].last_extra = j;
|
|
|
|
}
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
ps[g_p].GetActor()->spr.extra = j;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case concmd_addphealth: // todo: move out to player.
|
|
|
|
insptr++;
|
|
|
|
|
2020-11-02 23:20:51 +00:00
|
|
|
if(!isRR() && ps[g_p].newOwner != nullptr)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2020-11-02 23:20:51 +00:00
|
|
|
ps[g_p].newOwner = nullptr;
|
2021-12-22 09:36:09 +00:00
|
|
|
ps[g_p].pos.X = ps[g_p].oposx;
|
2021-12-22 09:40:26 +00:00
|
|
|
ps[g_p].pos.Y = ps[g_p].oposy;
|
2021-12-22 09:41:47 +00:00
|
|
|
ps[g_p].pos.Z = ps[g_p].oposz;
|
2020-10-07 12:13:21 +00:00
|
|
|
ps[g_p].angle.restore();
|
2021-12-22 09:40:26 +00:00
|
|
|
updatesector(ps[g_p].pos.X,ps[g_p].pos.Y,&ps[g_p].cursector);
|
2020-09-17 20:36:09 +00:00
|
|
|
|
2020-10-23 18:18:38 +00:00
|
|
|
DukeStatIterator it(STAT_ACTOR);
|
|
|
|
while (auto j = it.Next())
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (j->spr.picnum == TILE_CAMERA1)
|
|
|
|
j->spr.yvel = 0;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
j = ps[g_p].GetActor()->spr.extra;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
2021-12-21 21:31:25 +00:00
|
|
|
if(g_ac->spr.picnum != TILE_ATOMICHEALTH)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2020-11-29 12:54:58 +00:00
|
|
|
if( j > gs.max_player_health && *insptr > 0 )
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(j > 0)
|
|
|
|
j += *insptr;
|
2020-11-29 12:54:58 +00:00
|
|
|
if ( j > gs.max_player_health && *insptr > 0 )
|
|
|
|
j = gs.max_player_health;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( j > 0 )
|
|
|
|
j += *insptr;
|
2020-11-29 12:54:58 +00:00
|
|
|
if ( j > (gs.max_player_health<<1) )
|
|
|
|
j = (gs.max_player_health<<1);
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(j < 0) j = 0;
|
|
|
|
|
|
|
|
if(ud.god == 0)
|
|
|
|
{
|
|
|
|
if(*insptr > 0)
|
|
|
|
{
|
2020-11-29 12:54:58 +00:00
|
|
|
if( ( j - *insptr ) < (gs.max_player_health>>2) &&
|
|
|
|
j >= (gs.max_player_health>>2) )
|
2020-11-02 19:23:05 +00:00
|
|
|
S_PlayActorSound(isRR()? 229 : DUKE_GOTHEALTHATLOW,ps[g_p].GetActor());
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
ps[g_p].last_extra = j;
|
|
|
|
}
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
ps[g_p].GetActor()->spr.extra = j;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case concmd_state:
|
|
|
|
{
|
|
|
|
auto tempscrptr = insptr + 2;
|
|
|
|
insptr = &ScriptCode[*(insptr + 1)];
|
|
|
|
while (1) if (parse()) break;
|
|
|
|
insptr = tempscrptr;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case concmd_leftbrace:
|
|
|
|
insptr++;
|
|
|
|
while (1) if (parse()) break;
|
|
|
|
break;
|
|
|
|
case concmd_move:
|
|
|
|
g_t[0]=0;
|
|
|
|
insptr++;
|
|
|
|
g_t[1] = *insptr;
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.hitag = *insptr;
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
if(g_ac->spr.hitag&random_angle)
|
|
|
|
g_ac->spr.ang = krand()&2047;
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_spawn:
|
|
|
|
insptr++;
|
2021-11-21 00:04:16 +00:00
|
|
|
if(g_ac->insector())
|
2020-10-23 18:18:38 +00:00
|
|
|
spawn(g_ac,*insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_ifwasweapon:
|
|
|
|
case concmd_ifspawnedby: // these two are the same
|
|
|
|
insptr++;
|
2020-10-23 18:18:38 +00:00
|
|
|
parseifelse( g_ac->picnum == *insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifai:
|
|
|
|
insptr++;
|
|
|
|
parseifelse(g_t[5] == *insptr);
|
|
|
|
break;
|
|
|
|
case concmd_ifaction:
|
|
|
|
insptr++;
|
|
|
|
parseifelse(g_t[4] == *insptr);
|
|
|
|
break;
|
|
|
|
case concmd_ifactioncount:
|
|
|
|
insptr++;
|
|
|
|
parseifelse(g_t[2] >= *insptr);
|
|
|
|
break;
|
|
|
|
case concmd_resetactioncount:
|
|
|
|
insptr++;
|
|
|
|
g_t[2] = 0;
|
|
|
|
break;
|
|
|
|
case concmd_debris:
|
|
|
|
{
|
2021-11-07 13:36:39 +00:00
|
|
|
int dnum;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
insptr++;
|
|
|
|
dnum = *insptr;
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
bool weap = fi.spawnweapondebris(g_ac->spr.picnum, dnum);
|
2020-09-17 20:36:09 +00:00
|
|
|
|
2021-11-21 00:04:16 +00:00
|
|
|
if(g_ac->insector())
|
2020-09-17 20:36:09 +00:00
|
|
|
for(j=(*insptr)-1;j>=0;j--)
|
|
|
|
{
|
|
|
|
if(weap)
|
|
|
|
s = 0;
|
|
|
|
else s = (krand()%3);
|
|
|
|
|
2021-12-21 21:31:25 +00:00
|
|
|
auto l = EGS(g_ac->spr.sector(),
|
|
|
|
g_ac->spr.x + (krand() & 255) - 128, g_ac->spr.y + (krand() & 255) - 128, g_ac->spr.z - (8 << 8) - (krand() & 8191),
|
|
|
|
dnum + s, g_ac->spr.shade, 32 + (krand() & 15), 32 + (krand() & 15),
|
2020-10-23 18:18:38 +00:00
|
|
|
krand() & 2047, (krand() & 127) + 32, -(krand() & 2047), g_ac, 5);
|
2021-11-19 08:47:17 +00:00
|
|
|
if (l)
|
|
|
|
{
|
|
|
|
if (weap)
|
2021-12-21 17:19:45 +00:00
|
|
|
l->spr.yvel = gs.weaponsandammosprites[j % 14];
|
|
|
|
else l->spr.yvel = -1;
|
2021-12-21 21:31:25 +00:00
|
|
|
l->spr.pal = g_ac->spr.pal;
|
2021-11-19 08:47:17 +00:00
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
insptr++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case concmd_count:
|
|
|
|
insptr++;
|
|
|
|
g_t[0] = (short) *insptr;
|
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_cstator:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.cstat |= ESpriteFlags::FromInt(*insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_clipdist:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.clipdist = (uint8_t) *insptr;
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_cstat:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.cstat = ESpriteFlags::FromInt(*insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_newpic:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.picnum = (short)*insptr;
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_ifmove:
|
|
|
|
insptr++;
|
|
|
|
parseifelse(g_t[1] == *insptr);
|
|
|
|
break;
|
|
|
|
case concmd_resetplayer:
|
|
|
|
insptr++;
|
|
|
|
|
|
|
|
if(ud.multimode < 2)
|
|
|
|
{
|
|
|
|
gameaction = ga_autoloadgame;
|
|
|
|
killit_flag = 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-23 18:19:44 +00:00
|
|
|
// I am not convinced this is even remotely smart to be executed from here..
|
2020-09-17 20:36:09 +00:00
|
|
|
pickrandomspot(g_p);
|
2021-12-22 09:36:09 +00:00
|
|
|
g_ac->spr.x = ps[g_p].bobposx = ps[g_p].oposx = ps[g_p].pos.X;
|
2021-12-22 09:40:26 +00:00
|
|
|
g_ac->spr.y = ps[g_p].bobposy = ps[g_p].oposy = ps[g_p].pos.Y;
|
2021-12-22 09:41:47 +00:00
|
|
|
g_ac->spr.z = ps[g_p].oposz = ps[g_p].pos.Z;
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.backuppos();
|
2021-12-22 09:40:26 +00:00
|
|
|
updatesector(ps[g_p].pos.X, ps[g_p].pos.Y, &ps[g_p].cursector);
|
2021-12-22 09:41:47 +00:00
|
|
|
SetActor(ps[g_p].GetActor(), { ps[g_p].pos.X, ps[g_p].pos.Y, ps[g_p].pos.Z + gs.playerheight });
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.shade = -12;
|
|
|
|
g_ac->spr.clipdist = 64;
|
|
|
|
g_ac->spr.xrepeat = 42;
|
|
|
|
g_ac->spr.yrepeat = 36;
|
2020-10-23 18:19:44 +00:00
|
|
|
g_ac->SetOwner(g_ac);
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.xoffset = 0;
|
|
|
|
g_ac->spr.pal = ps[g_p].palookup;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
2021-12-21 21:31:25 +00:00
|
|
|
ps[g_p].last_extra = g_ac->spr.extra = gs.max_player_health;
|
2020-09-17 20:36:09 +00:00
|
|
|
ps[g_p].wantweaponfire = -1;
|
2020-10-07 06:12:37 +00:00
|
|
|
ps[g_p].horizon.ohoriz = ps[g_p].horizon.horiz = q16horiz(0);
|
2020-10-17 08:44:00 +00:00
|
|
|
ps[g_p].on_crane = nullptr;
|
2020-09-17 20:36:09 +00:00
|
|
|
ps[g_p].frag_ps = g_p;
|
2020-10-07 06:12:37 +00:00
|
|
|
ps[g_p].horizon.ohorizoff = ps[g_p].horizon.horizoff = q16horiz(0);
|
2020-09-17 20:36:09 +00:00
|
|
|
ps[g_p].opyoff = 0;
|
2020-10-21 08:52:51 +00:00
|
|
|
ps[g_p].wackedbyactor = nullptr;
|
2020-11-29 12:54:58 +00:00
|
|
|
ps[g_p].shield_amount = gs.max_armour_amount;
|
2020-09-17 20:36:09 +00:00
|
|
|
ps[g_p].dead_flag = 0;
|
2021-04-15 08:00:58 +00:00
|
|
|
ps[g_p].resurrected = false;
|
2020-09-17 20:36:09 +00:00
|
|
|
ps[g_p].pals.a = 0;
|
|
|
|
ps[g_p].footprintcount = 0;
|
|
|
|
ps[g_p].weapreccnt = 0;
|
|
|
|
ps[g_p].ftq = 0;
|
|
|
|
ps[g_p].posxv = ps[g_p].posyv = 0;
|
2021-04-11 05:43:11 +00:00
|
|
|
if (!isRR()) ps[g_p].angle.orotscrnang = ps[g_p].angle.rotscrnang = buildang(0);
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
ps[g_p].falling_counter = 0;
|
|
|
|
|
2020-10-23 18:19:44 +00:00
|
|
|
g_ac->extra = -1;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
2020-10-23 18:19:44 +00:00
|
|
|
g_ac->cgg = 0;
|
|
|
|
g_ac->movflag = 0;
|
|
|
|
g_ac->tempang = 0;
|
2021-11-18 19:55:22 +00:00
|
|
|
g_ac->actorstayput = nullptr;
|
2020-10-23 18:19:44 +00:00
|
|
|
g_ac->dispicnum = 0;
|
|
|
|
g_ac->SetHitOwner(ps[g_p].GetActor());
|
|
|
|
g_ac->temp_data[4] = 0;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
resetinventory(g_p);
|
|
|
|
resetweapons(g_p);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case concmd_ifcoop:
|
|
|
|
parseifelse(ud.coop || numplayers > 2);
|
|
|
|
break;
|
|
|
|
case concmd_ifonmud:
|
2021-12-21 21:31:25 +00:00
|
|
|
parseifelse(abs(g_ac->spr.z - g_ac->spr.sector()->floorz) < (32 << 8) && g_ac->spr.sector()->floorpicnum == 3073); // eew, hard coded tile numbers.. :?
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifonwater:
|
2021-12-21 21:31:25 +00:00
|
|
|
parseifelse( abs(g_ac->spr.z-g_ac->spr.sector()->floorz) < (32<<8) && g_ac->spr.sector()->lotag == ST_1_ABOVE_WATER);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifmotofast:
|
|
|
|
parseifelse(ps[g_p].MotoSpeed > 60);
|
|
|
|
break;
|
|
|
|
case concmd_ifonmoto:
|
|
|
|
parseifelse(ps[g_p].OnMotorcycle == 1);
|
|
|
|
break;
|
|
|
|
case concmd_ifonboat:
|
|
|
|
parseifelse(ps[g_p].OnBoat == 1);
|
|
|
|
break;
|
|
|
|
case concmd_ifsizedown:
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.xrepeat--;
|
|
|
|
g_ac->spr.yrepeat--;
|
|
|
|
parseifelse(g_ac->spr.xrepeat <= 5);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifwind:
|
|
|
|
parseifelse(WindTime > 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case concmd_ifinwater:
|
2021-12-21 21:31:25 +00:00
|
|
|
parseifelse( g_ac->spr.sector()->lotag == 2);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifcount:
|
|
|
|
insptr++;
|
|
|
|
parseifelse(g_t[0] >= *insptr);
|
|
|
|
break;
|
|
|
|
case concmd_ifactor:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
parseifelse(g_ac->spr.picnum == *insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_resetcount:
|
|
|
|
insptr++;
|
|
|
|
g_t[0] = 0;
|
|
|
|
break;
|
|
|
|
case concmd_addinventory:
|
|
|
|
insptr+=2;
|
|
|
|
switch(*(insptr-1))
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
ps[g_p].steroids_amount = *insptr;
|
|
|
|
ps[g_p].inven_icon = 2;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
ps[g_p].shield_amount += *insptr;// 100;
|
2020-11-29 12:54:58 +00:00
|
|
|
if(ps[g_p].shield_amount > gs.max_player_health)
|
|
|
|
ps[g_p].shield_amount = gs.max_player_health;
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
ps[g_p].scuba_amount = *insptr;// 1600;
|
|
|
|
ps[g_p].inven_icon = 6;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
ps[g_p].holoduke_amount = *insptr;// 1600;
|
|
|
|
ps[g_p].inven_icon = 3;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
ps[g_p].jetpack_amount = *insptr;// 1600;
|
|
|
|
ps[g_p].inven_icon = 4;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
if (isRR())
|
|
|
|
{
|
2021-12-21 21:31:25 +00:00
|
|
|
switch (g_ac->spr.lotag)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
case 100: ps[g_p].keys[1] = 1; break;
|
|
|
|
case 101: ps[g_p].keys[2] = 1; break;
|
|
|
|
case 102: ps[g_p].keys[3] = 1; break;
|
|
|
|
case 103: ps[g_p].keys[4] = 1; break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-21 21:31:25 +00:00
|
|
|
switch (g_ac->spr.pal)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
case 0: ps[g_p].got_access |= 1; break;
|
|
|
|
case 21: ps[g_p].got_access |= 2; break;
|
|
|
|
case 23: ps[g_p].got_access |= 4; break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
ps[g_p].heat_amount = *insptr;
|
|
|
|
ps[g_p].inven_icon = 5;
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
ps[g_p].inven_icon = 1;
|
|
|
|
ps[g_p].firstaid_amount = *insptr;
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
ps[g_p].inven_icon = 7;
|
|
|
|
ps[g_p].boot_amount = *insptr;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_hitradius:
|
2020-10-23 18:19:44 +00:00
|
|
|
fi.hitradius(g_ac, *(insptr + 1), *(insptr + 2), *(insptr + 3), *(insptr + 4), *(insptr + 5));
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr+=6;
|
|
|
|
break;
|
|
|
|
case concmd_ifp:
|
|
|
|
{
|
|
|
|
insptr++;
|
|
|
|
|
|
|
|
l = *insptr;
|
|
|
|
j = 0;
|
|
|
|
|
2021-12-21 21:31:25 +00:00
|
|
|
s = g_ac->spr.xvel;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
2020-10-23 18:19:44 +00:00
|
|
|
// sigh.. this was yet another place where number literals were used as bit masks for every single value, making the code totally unreadable.
|
2020-11-07 07:16:16 +00:00
|
|
|
if( (l& pducking) && ps[g_p].on_ground && PlayerInput(g_p, SB_CROUCH))
|
2020-09-17 20:36:09 +00:00
|
|
|
j = 1;
|
|
|
|
else if( (l& pfalling) && ps[g_p].jumping_counter == 0 && !ps[g_p].on_ground && ps[g_p].poszv > 2048 )
|
|
|
|
j = 1;
|
|
|
|
else if( (l& pjumping) && ps[g_p].jumping_counter > 348 )
|
|
|
|
j = 1;
|
|
|
|
else if( (l& pstanding) && s >= 0 && s < 8)
|
|
|
|
j = 1;
|
|
|
|
else if( (l& pwalking) && s >= 8 && !(PlayerInput(g_p, SB_RUN)) )
|
|
|
|
j = 1;
|
|
|
|
else if( (l& prunning) && s >= 8 && PlayerInput(g_p, SB_RUN) )
|
|
|
|
j = 1;
|
2021-12-22 09:41:47 +00:00
|
|
|
else if( (l& phigher) && ps[g_p].pos.Z < (g_ac->spr.z-(48<<8)) )
|
2020-09-17 20:36:09 +00:00
|
|
|
j = 1;
|
|
|
|
else if( (l& pwalkingback) && s <= -8 && !(PlayerInput(g_p, SB_RUN)) )
|
|
|
|
j = 1;
|
|
|
|
else if( (l& prunningback) && s <= -8 && (PlayerInput(g_p, SB_RUN)) )
|
|
|
|
j = 1;
|
|
|
|
else if( (l& pkicking) && ( ps[g_p].quick_kick > 0 || ( ps[g_p].curr_weapon == KNEE_WEAPON && ps[g_p].kickback_pic > 0 ) ) )
|
|
|
|
j = 1;
|
2021-12-21 17:19:45 +00:00
|
|
|
else if( (l& pshrunk) && ps[g_p].GetActor()->spr.xrepeat < (isRR() ? 8 : 32))
|
2020-09-17 20:36:09 +00:00
|
|
|
j = 1;
|
|
|
|
else if( (l& pjetpack) && ps[g_p].jetpack_on )
|
|
|
|
j = 1;
|
|
|
|
else if( (l& ponsteroids) && ps[g_p].steroids_amount > 0 && ps[g_p].steroids_amount < 400 )
|
|
|
|
j = 1;
|
|
|
|
else if( (l& ponground) && ps[g_p].on_ground)
|
|
|
|
j = 1;
|
2021-12-21 17:19:45 +00:00
|
|
|
else if( (l& palive) && ps[g_p].GetActor()->spr.xrepeat > (isRR() ? 8 : 32) && ps[g_p].GetActor()->spr.extra > 0 && ps[g_p].timebeforeexit == 0 )
|
2020-09-17 20:36:09 +00:00
|
|
|
j = 1;
|
2021-12-21 17:19:45 +00:00
|
|
|
else if( (l& pdead) && ps[g_p].GetActor()->spr.extra <= 0)
|
2020-09-17 20:36:09 +00:00
|
|
|
j = 1;
|
|
|
|
else if( (l& pfacing) )
|
|
|
|
{
|
2021-12-21 21:31:25 +00:00
|
|
|
if (g_ac->spr.picnum == TILE_APLAYER && ud.multimode > 1)
|
2021-12-22 09:40:26 +00:00
|
|
|
j = getincangle(ps[otherp].angle.ang.asbuild(), getangle(ps[g_p].pos.X - ps[otherp].pos.X, ps[g_p].pos.Y - ps[otherp].pos.Y));
|
2020-09-17 20:36:09 +00:00
|
|
|
else
|
2021-12-22 09:40:26 +00:00
|
|
|
j = getincangle(ps[g_p].angle.ang.asbuild(), getangle(g_ac->spr.x - ps[g_p].pos.X, g_ac->spr.y - ps[g_p].pos.Y));
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
if( j > -128 && j < 128 )
|
|
|
|
j = 1;
|
|
|
|
else
|
|
|
|
j = 0;
|
|
|
|
}
|
|
|
|
|
2021-03-31 09:07:36 +00:00
|
|
|
parseifelse( j);
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case concmd_ifstrength:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
parseifelse(g_ac->spr.extra <= *insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_guts:
|
|
|
|
insptr += 2;
|
2020-10-22 17:21:21 +00:00
|
|
|
fi.guts(g_ac,*(insptr-1),*insptr,g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_slapplayer:
|
|
|
|
insptr++;
|
2020-09-20 10:01:05 +00:00
|
|
|
forceplayerangle(g_p);
|
2020-11-14 11:15:17 +00:00
|
|
|
ps[g_p].posxv -= ps[g_p].angle.ang.bcos(7);
|
|
|
|
ps[g_p].posyv -= ps[g_p].angle.ang.bsin(7);
|
2020-09-17 20:36:09 +00:00
|
|
|
return 0;
|
|
|
|
case concmd_wackplayer:
|
|
|
|
insptr++;
|
|
|
|
if (!isRR())
|
2020-09-20 10:01:05 +00:00
|
|
|
forceplayerangle(g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
else
|
|
|
|
{
|
2020-11-14 11:15:17 +00:00
|
|
|
ps[g_p].posxv -= ps[g_p].angle.ang.bcos(10);
|
|
|
|
ps[g_p].posyv -= ps[g_p].angle.ang.bsin(10);
|
2020-09-17 20:36:09 +00:00
|
|
|
ps[g_p].jumping_counter = 767;
|
|
|
|
ps[g_p].jumping_toggle = 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
case concmd_ifgapzl:
|
|
|
|
insptr++;
|
2020-10-23 18:19:44 +00:00
|
|
|
parseifelse( (( g_ac->floorz - g_ac->ceilingz ) >> 8 ) < *insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifhitspace:
|
|
|
|
parseifelse(PlayerInput(g_p, SB_OPEN));
|
|
|
|
break;
|
|
|
|
case concmd_ifoutside:
|
2021-12-21 21:31:25 +00:00
|
|
|
parseifelse(g_ac->spr.sector()->ceilingstat & CSTAT_SECTOR_SKY);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifmultiplayer:
|
|
|
|
parseifelse(ud.multimode > 1);
|
|
|
|
break;
|
|
|
|
case concmd_operate:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
if( g_ac->spr.sector()->lotag == 0 )
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-12-06 11:24:22 +00:00
|
|
|
HitInfo hit{};
|
2021-12-21 21:31:25 +00:00
|
|
|
neartag({ g_ac->spr.x, g_ac->spr.y, g_ac->spr.z - (32 << 8) }, g_ac->spr.sector(), g_ac->spr.ang, hit, 768, 1);
|
2021-11-26 17:59:28 +00:00
|
|
|
auto sectp = hit.hitSector;
|
2021-11-18 17:21:05 +00:00
|
|
|
if (sectp)
|
2021-11-07 09:10:00 +00:00
|
|
|
{
|
|
|
|
if (isanearoperator(sectp->lotag))
|
|
|
|
if ((sectp->lotag & 0xff) == ST_23_SWINGING_DOOR || sectp->floorz == sectp->ceilingz)
|
|
|
|
if ((sectp->lotag & 16384) == 0 && (sectp->lotag & 32768) == 0)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-11-18 17:21:05 +00:00
|
|
|
DukeSectIterator it(sectp);
|
2020-10-23 18:19:44 +00:00
|
|
|
DDukeActor* a2;
|
|
|
|
while ((a2 = it.Next()))
|
2020-10-14 19:16:54 +00:00
|
|
|
{
|
2021-12-21 19:29:46 +00:00
|
|
|
if (a2->spr.picnum == ACTIVATOR)
|
2020-10-14 19:16:54 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-10-23 18:19:44 +00:00
|
|
|
if (a2 == nullptr)
|
2021-11-18 17:51:19 +00:00
|
|
|
operatesectors(sectp, g_ac);
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
2021-11-07 09:10:00 +00:00
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case concmd_ifinspace:
|
2021-12-21 21:31:25 +00:00
|
|
|
parseifelse(fi.ceilingspace(g_ac->spr.sector()));
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case concmd_spritepal:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
if(g_ac->spr.picnum != TILE_APLAYER)
|
|
|
|
g_ac->tempang = g_ac->spr.pal;
|
|
|
|
g_ac->spr.pal = *insptr;
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case concmd_cactor:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.picnum = *insptr;
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case concmd_ifbulletnear:
|
2020-10-21 23:12:16 +00:00
|
|
|
parseifelse( dodge(g_ac) == 1);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifrespawn:
|
2020-10-23 18:19:44 +00:00
|
|
|
if( badguy(g_ac) )
|
2020-09-17 20:36:09 +00:00
|
|
|
parseifelse( ud.respawn_monsters );
|
2021-12-21 21:31:25 +00:00
|
|
|
else if( inventory(g_ac) )
|
2020-09-17 20:36:09 +00:00
|
|
|
parseifelse( ud.respawn_inventory );
|
|
|
|
else
|
|
|
|
parseifelse( ud.respawn_items );
|
|
|
|
break;
|
|
|
|
case concmd_iffloordistl:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
parseifelse( (g_ac->floorz - g_ac->spr.z) <= ((*insptr)<<8));
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifceilingdistl:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
parseifelse( ( g_ac->spr.z - g_ac->ceilingz ) <= ((*insptr)<<8));
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_palfrom:
|
|
|
|
insptr++;
|
|
|
|
SetPlayerPal(&ps[g_p], PalEntry(insptr[0], insptr[1], insptr[2], insptr[3]));
|
|
|
|
insptr += 4;
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* case 74:
|
|
|
|
insptr++;
|
2020-11-01 16:57:40 +00:00
|
|
|
getglobalz(g_ac);
|
2020-10-23 18:19:44 +00:00
|
|
|
parseifelse( (( g_ac->floorz - g_ac->ceilingz ) >> 8 ) >= *insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
*/
|
|
|
|
case concmd_addlog:
|
|
|
|
{ int l;
|
|
|
|
int lFile;
|
|
|
|
insptr++;
|
|
|
|
lFile=*(insptr++); // file
|
|
|
|
l=*(insptr++); // line
|
|
|
|
// this was only printing file name and line number as debug output.
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_addlogvar:
|
|
|
|
{ int l;
|
|
|
|
int lFile;
|
|
|
|
insptr++;
|
|
|
|
lFile=*(insptr++); // file
|
|
|
|
l=*(insptr++); // l=Line number, *instpr=varID
|
|
|
|
if( (*insptr >= iGameVarCount)
|
|
|
|
|| *insptr < 0
|
|
|
|
)
|
|
|
|
{
|
|
|
|
// invalid varID
|
|
|
|
insptr++;
|
|
|
|
break; // out of switch
|
|
|
|
}
|
|
|
|
DPrintf(DMSG_NOTIFY, "ADDLOGVAR: ");
|
|
|
|
|
|
|
|
if( aGameVars[*insptr].dwFlags & GAMEVAR_FLAG_READONLY)
|
|
|
|
{
|
|
|
|
DPrintf(DMSG_NOTIFY, " (read-only)");
|
|
|
|
}
|
|
|
|
if( aGameVars[*insptr].dwFlags & GAMEVAR_FLAG_PERPLAYER)
|
|
|
|
{
|
|
|
|
DPrintf(DMSG_NOTIFY, " (Per Player. Player=%d)",g_p);
|
|
|
|
}
|
|
|
|
else if( aGameVars[*insptr].dwFlags & GAMEVAR_FLAG_PERACTOR)
|
|
|
|
{
|
2020-10-25 05:40:05 +00:00
|
|
|
DPrintf(DMSG_NOTIFY, " (Per Actor. Actor=%p)",g_ac);
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DPrintf(DMSG_NOTIFY, " (Global)");
|
|
|
|
}
|
2021-12-07 22:27:12 +00:00
|
|
|
DPrintf(DMSG_NOTIFY, " =%d", GetGameVarID(*insptr, g_ac, g_p).safeValue());
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_setvar:
|
|
|
|
{ int i;
|
|
|
|
insptr++;
|
|
|
|
i=*(insptr++); // ID of def
|
2020-11-01 17:23:09 +00:00
|
|
|
SetGameVarID(i, *insptr, g_ac, g_p );
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_setvarvar:
|
|
|
|
{ int i;
|
|
|
|
insptr++;
|
|
|
|
i=*(insptr++); // ID of def
|
2020-11-01 17:23:09 +00:00
|
|
|
SetGameVarID(i, GetGameVarID(*insptr, g_ac, g_p), g_ac, g_p );
|
2020-09-17 20:36:09 +00:00
|
|
|
// aGameVars[i].lValue = aGameVars[*insptr].lValue;
|
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_addvar:
|
|
|
|
{ int i;
|
|
|
|
insptr++;
|
|
|
|
i=*(insptr++); // ID of def
|
2021-12-05 16:36:57 +00:00
|
|
|
SetGameVarID(i, GetGameVarID(i, g_ac, g_p).safeValue() + *insptr, g_ac, g_p );
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case concmd_addvarvar:
|
|
|
|
{ int i;
|
|
|
|
insptr++;
|
|
|
|
i=*(insptr++); // ID of def
|
2021-12-05 16:36:57 +00:00
|
|
|
SetGameVarID(i, GetGameVarID(i, g_ac, g_p).safeValue() + GetGameVarID(*insptr, g_ac, g_p).safeValue(), g_ac, g_p );
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_ifvarvare:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
insptr++;
|
|
|
|
i=*(insptr++); // ID of def
|
|
|
|
j=0;
|
2021-12-05 16:36:57 +00:00
|
|
|
if(GetGameVarID(i, g_ac, g_p).safeValue() == GetGameVarID(*(insptr), g_ac, g_p).safeValue())
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
j=1;
|
|
|
|
}
|
|
|
|
parseifelse( j );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_ifvarvarg:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
insptr++;
|
|
|
|
i=*(insptr++); // ID of def
|
|
|
|
j=0;
|
2021-12-05 16:36:57 +00:00
|
|
|
if(GetGameVarID(i, g_ac, g_p).safeValue() > GetGameVarID(*(insptr), g_ac, g_p).safeValue())
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
j=1;
|
|
|
|
}
|
|
|
|
parseifelse( j );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_ifvarvarl:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
insptr++;
|
|
|
|
i=*(insptr++); // ID of def
|
|
|
|
j=0;
|
2021-12-05 16:36:57 +00:00
|
|
|
if(GetGameVarID(i, g_ac, g_p).safeValue() < GetGameVarID(*(insptr), g_ac, g_p).safeValue())
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
j=1;
|
|
|
|
}
|
|
|
|
parseifelse( j );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_ifvare:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
insptr++;
|
|
|
|
i=*(insptr++); // ID of def
|
|
|
|
j=0;
|
2021-12-05 16:36:57 +00:00
|
|
|
if(GetGameVarID(i, g_ac, g_p).safeValue() == *insptr)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
j=1;
|
|
|
|
}
|
|
|
|
parseifelse( j );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_ifvarg:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
insptr++;
|
|
|
|
i=*(insptr++); // ID of def
|
|
|
|
j=0;
|
2021-12-05 16:36:57 +00:00
|
|
|
if(GetGameVarID(i, g_ac, g_p).safeValue() > *insptr)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
j=1;
|
|
|
|
}
|
|
|
|
parseifelse( j );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_ifvarl:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
insptr++;
|
|
|
|
i=*(insptr++); // ID of def
|
|
|
|
j=0;
|
2021-12-05 16:36:57 +00:00
|
|
|
if(GetGameVarID(i, g_ac, g_p).safeValue() < *insptr)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
j=1;
|
|
|
|
}
|
|
|
|
parseifelse( j );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_ifphealthl:
|
|
|
|
insptr++;
|
2021-12-21 17:19:45 +00:00
|
|
|
parseifelse( ps[g_p].GetActor()->spr.extra < *insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case concmd_ifpinventory:
|
|
|
|
{
|
|
|
|
insptr++;
|
|
|
|
j = 0;
|
|
|
|
switch(*(insptr++))
|
|
|
|
{
|
2021-11-14 11:25:25 +00:00
|
|
|
case 0:
|
|
|
|
if( ps[g_p].steroids_amount != *insptr)
|
2020-09-17 20:36:09 +00:00
|
|
|
j = 1;
|
|
|
|
break;
|
2021-11-14 11:25:25 +00:00
|
|
|
case 1:
|
|
|
|
if(ps[g_p].shield_amount != gs.max_player_health )
|
2020-09-17 20:36:09 +00:00
|
|
|
j = 1;
|
|
|
|
break;
|
2021-11-14 11:25:25 +00:00
|
|
|
case 2:
|
|
|
|
if(ps[g_p].scuba_amount != *insptr) j = 1;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
if(ps[g_p].holoduke_amount != *insptr) j = 1;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
if(ps[g_p].jetpack_amount != *insptr) j = 1;
|
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
case 6:
|
|
|
|
if (isRR())
|
|
|
|
{
|
2021-12-21 21:31:25 +00:00
|
|
|
switch (g_ac->spr.lotag)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-11-14 11:25:25 +00:00
|
|
|
case 100:
|
|
|
|
if (ps[g_p].keys[1]) j = 1;
|
|
|
|
break;
|
|
|
|
case 101:
|
|
|
|
if (ps[g_p].keys[2]) j = 1;
|
|
|
|
break;
|
|
|
|
case 102:
|
|
|
|
if (ps[g_p].keys[3]) j = 1;
|
|
|
|
break;
|
|
|
|
case 103:
|
|
|
|
if (ps[g_p].keys[4]) j = 1;
|
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-21 21:31:25 +00:00
|
|
|
switch (g_ac->spr.pal)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-11-14 11:25:25 +00:00
|
|
|
case 0:
|
|
|
|
if (ps[g_p].got_access & 1) j = 1;
|
|
|
|
break;
|
|
|
|
case 21:
|
|
|
|
if (ps[g_p].got_access & 2) j = 1;
|
|
|
|
break;
|
|
|
|
case 23:
|
|
|
|
if (ps[g_p].got_access & 4) j = 1;
|
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2021-11-14 11:25:25 +00:00
|
|
|
case 7:
|
|
|
|
if(ps[g_p].heat_amount != *insptr) j = 1;
|
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
case 9:
|
2021-11-14 11:25:25 +00:00
|
|
|
if(ps[g_p].firstaid_amount != *insptr) j = 1;
|
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
case 10:
|
2021-11-14 11:25:25 +00:00
|
|
|
if(ps[g_p].boot_amount != *insptr) j = 1;
|
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
parseifelse(j);
|
|
|
|
break;
|
2020-05-14 07:07:07 +00:00
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
case concmd_pstomp:
|
2020-05-14 07:07:07 +00:00
|
|
|
insptr++;
|
2021-12-21 17:19:45 +00:00
|
|
|
if( ps[g_p].knee_incs == 0 && ps[g_p].GetActor()->spr.xrepeat >= (isRR()? 9: 40) )
|
2021-12-22 09:41:47 +00:00
|
|
|
if( cansee(g_ac->spr.x,g_ac->spr.y,g_ac->spr.z-(4<<8),g_ac->spr.sector(),ps[g_p].pos.X,ps[g_p].pos.Y,ps[g_p].pos.Z+(16<<8),ps[g_p].GetActor()->spr.sector()) )
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
|
|
|
ps[g_p].knee_incs = 1;
|
|
|
|
if(ps[g_p].weapon_pos == 0)
|
|
|
|
ps[g_p].weapon_pos = -1;
|
2020-10-23 18:21:09 +00:00
|
|
|
ps[g_p].actorsqu = g_ac;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
case concmd_ifawayfromwall:
|
|
|
|
{
|
2021-12-21 21:31:25 +00:00
|
|
|
auto s1 = g_ac->spr.sector();
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
j = 0;
|
|
|
|
|
2021-12-21 21:31:25 +00:00
|
|
|
updatesector(g_ac->spr.x + 108, g_ac->spr.y + 108, &s1);
|
|
|
|
if (s1 == g_ac->spr.sector())
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-12-21 21:31:25 +00:00
|
|
|
updatesector(g_ac->spr.x - 108, g_ac->spr.y - 108, &s1);
|
|
|
|
if (s1 == g_ac->spr.sector())
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-12-21 21:31:25 +00:00
|
|
|
updatesector(g_ac->spr.x + 108, g_ac->spr.y - 108, &s1);
|
|
|
|
if (s1 == g_ac->spr.sector())
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-12-21 21:31:25 +00:00
|
|
|
updatesector(g_ac->spr.x - 108, g_ac->spr.y + 108, &s1);
|
|
|
|
if (s1 == g_ac->spr.sector())
|
2020-09-17 20:36:09 +00:00
|
|
|
j = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
parseifelse(j);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case concmd_quote:
|
|
|
|
insptr++;
|
|
|
|
FTA(*insptr,&ps[g_p]);
|
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
case concmd_ifinouterspace:
|
2021-12-21 21:31:25 +00:00
|
|
|
parseifelse( fi.floorspace(g_ac->spr.sector()));
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifnotmoving:
|
2021-05-14 08:03:07 +00:00
|
|
|
parseifelse( (g_ac->movflag&kHitTypeMask) > kHitSector );
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_respawnhitag:
|
|
|
|
insptr++;
|
2020-10-22 21:45:49 +00:00
|
|
|
fi.respawnhitag(g_ac);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
case concmd_ifspritepal:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
parseifelse( g_ac->spr.pal == *insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case concmd_ifangdiffl:
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
j = abs(getincangle(ps[g_p].angle.ang.asbuild(),g_ac->spr.ang));
|
2020-09-17 20:36:09 +00:00
|
|
|
parseifelse( j <= *insptr);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case concmd_ifnosounds:
|
2020-10-25 05:40:05 +00:00
|
|
|
parseifelse(!S_CheckAnyActorSoundPlaying(g_ac));
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case concmd_ifplaybackon: //Twentieth Anniversary World Tour
|
|
|
|
parseifelse(false);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case concmd_espawnvar:
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
2020-10-25 05:40:05 +00:00
|
|
|
DDukeActor* lReturn = nullptr;
|
2020-09-17 20:36:09 +00:00
|
|
|
int lIn;
|
|
|
|
insptr++;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
lIn = *insptr++;
|
2021-12-05 16:36:57 +00:00
|
|
|
lIn = GetGameVarID(lIn, g_ac, g_p).safeValue();
|
2021-11-21 00:04:16 +00:00
|
|
|
if(g_ac->insector())
|
2020-10-25 05:40:05 +00:00
|
|
|
lReturn = spawn(g_ac, lIn);
|
2020-05-14 07:07:07 +00:00
|
|
|
|
2021-12-05 16:36:57 +00:00
|
|
|
SetGameVarID(g_iReturnVarID, (lReturn), g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_espawn:
|
|
|
|
{
|
2020-10-25 05:40:05 +00:00
|
|
|
DDukeActor* lReturn = nullptr;
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
2021-11-21 00:04:16 +00:00
|
|
|
if(g_ac->insector())
|
2020-10-25 05:40:05 +00:00
|
|
|
lReturn = spawn(g_ac, *insptr);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
2021-12-05 16:36:57 +00:00
|
|
|
SetGameVarID(g_iReturnVarID, (lReturn), g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_setsector:
|
|
|
|
case concmd_getsector:
|
|
|
|
{
|
|
|
|
// syntax [gs]etsector[<var>].x <VAR>
|
|
|
|
// <varid> <xxxid> <varid>
|
|
|
|
int lLabelID;
|
|
|
|
int lVar1, lVar2;
|
|
|
|
int lWhat;
|
|
|
|
int lParm2;
|
|
|
|
|
|
|
|
lWhat = *(insptr++);
|
|
|
|
lVar1 = *(insptr++);
|
|
|
|
lLabelID = *(insptr++);
|
2020-09-17 21:02:52 +00:00
|
|
|
lParm2 = *(insptr++);
|
2020-09-17 20:36:09 +00:00
|
|
|
lVar2 = *(insptr++);
|
2020-10-23 17:07:33 +00:00
|
|
|
DoSector(lWhat == concmd_setsector, lVar1, lLabelID, lVar2, g_ac, g_p, lParm2);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_sqrt:
|
|
|
|
{
|
|
|
|
// syntax sqrt <invar> <outvar>
|
2020-05-14 07:07:07 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
int lInVarID;
|
|
|
|
int lOutVarID;
|
|
|
|
int lIn;
|
|
|
|
|
|
|
|
insptr++;
|
|
|
|
lInVarID = *(insptr++);
|
|
|
|
lOutVarID = *(insptr++);
|
2021-12-05 16:36:57 +00:00
|
|
|
lIn = GetGameVarID(lInVarID, g_ac, g_p).safeValue();
|
2020-10-23 18:22:08 +00:00
|
|
|
SetGameVarID(lOutVarID, ksqrt(lIn), g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_findnearactor:
|
|
|
|
{
|
|
|
|
// syntax findnearactorvar <type> <maxdist> <getvar>
|
|
|
|
// gets the sprite ID of the nearest actor within max dist
|
|
|
|
// that is of <type> into <getvar>
|
|
|
|
// -1 for none found
|
|
|
|
// <type> <maxdist> <varid>
|
|
|
|
int lType;
|
|
|
|
int lMaxDist;
|
|
|
|
int lVarID;
|
|
|
|
int lTemp;
|
|
|
|
int lDist;
|
|
|
|
|
|
|
|
insptr++;
|
|
|
|
|
|
|
|
lType = *(insptr++);
|
|
|
|
lMaxDist = *(insptr++);
|
|
|
|
lVarID = *(insptr++);
|
|
|
|
|
2020-10-25 05:40:05 +00:00
|
|
|
DDukeActor* lFound = nullptr;
|
2020-09-17 20:36:09 +00:00
|
|
|
lDist = 32767; // big number
|
|
|
|
|
2020-10-23 18:22:08 +00:00
|
|
|
DukeStatIterator it(STAT_ACTOR);
|
|
|
|
while (auto j = it.Next())
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (j->spr.picnum == lType)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-10-23 18:22:08 +00:00
|
|
|
lTemp = ldist(g_ac, j);
|
2020-09-17 20:36:09 +00:00
|
|
|
if (lTemp < lMaxDist)
|
|
|
|
{
|
|
|
|
if (lTemp < lDist)
|
|
|
|
{
|
2020-10-25 05:40:05 +00:00
|
|
|
lFound = j;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-13 22:04:14 +00:00
|
|
|
|
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
2021-12-05 16:36:57 +00:00
|
|
|
SetGameVarID(lVarID, (lFound), g_ac, g_p);
|
2020-05-14 07:07:07 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_findnearactorvar:
|
|
|
|
{
|
|
|
|
// syntax findnearactorvar <type> <maxdistvar> <getvar>
|
|
|
|
// gets the sprite ID of the nearest actor within max dist
|
|
|
|
// that is of <type> into <getvar>
|
|
|
|
// -1 for none found
|
|
|
|
// <type> <maxdistvarid> <varid>
|
|
|
|
int lType;
|
|
|
|
int lMaxDistVar;
|
|
|
|
int lMaxDist;
|
|
|
|
int lVarID;
|
|
|
|
int lTemp;
|
|
|
|
int lDist;
|
|
|
|
|
|
|
|
insptr++;
|
|
|
|
|
|
|
|
lType = *(insptr++);
|
|
|
|
lMaxDistVar = *(insptr++);
|
|
|
|
lVarID = *(insptr++);
|
2021-12-05 16:36:57 +00:00
|
|
|
lMaxDist = GetGameVarID(lMaxDistVar, g_ac, g_p).safeValue();
|
2021-11-14 12:33:35 +00:00
|
|
|
DDukeActor* lFound = nullptr;
|
2020-09-17 20:36:09 +00:00
|
|
|
lDist = 32767; // big number
|
|
|
|
|
2020-10-23 18:22:08 +00:00
|
|
|
DukeStatIterator it(STAT_ACTOR);
|
|
|
|
while (auto j = it.Next())
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (j->spr.picnum == lType)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2020-10-23 18:22:08 +00:00
|
|
|
lTemp = ldist(g_ac, j);
|
2020-09-17 20:36:09 +00:00
|
|
|
if (lTemp < lMaxDist)
|
|
|
|
{
|
|
|
|
if (lTemp < lDist)
|
|
|
|
{
|
2020-10-25 05:40:05 +00:00
|
|
|
lFound = j;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2021-12-05 16:36:57 +00:00
|
|
|
SetGameVarID(lVarID, (lFound), g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_setplayer:
|
|
|
|
case concmd_getplayer:
|
|
|
|
{
|
|
|
|
// syntax [gs]etplayer[<var>].x <VAR>
|
|
|
|
// <varid> <xxxid> <varid>
|
|
|
|
int lLabelID;
|
|
|
|
int lVar1, lVar2;
|
|
|
|
int lWhat;
|
|
|
|
int lParm2;
|
|
|
|
|
|
|
|
lWhat = *(insptr++);
|
|
|
|
lVar1 = *(insptr++);
|
|
|
|
lLabelID = *(insptr++);
|
2020-09-17 21:02:52 +00:00
|
|
|
lParm2 = *(insptr++);
|
2020-09-17 20:36:09 +00:00
|
|
|
lVar2 = *(insptr++);
|
|
|
|
|
2020-10-23 17:07:33 +00:00
|
|
|
DoPlayer(lWhat == concmd_setplayer, lVar1, lLabelID, lVar2, g_ac, g_p, lParm2);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_getuserdef:
|
|
|
|
case concmd_setuserdef:
|
|
|
|
{
|
|
|
|
// syntax [gs]etuserdef.xxx <VAR>
|
|
|
|
// <xxxid> <varid>
|
|
|
|
int lLabelID;
|
|
|
|
int lVar1, lVar2;
|
|
|
|
int lWhat;
|
|
|
|
int lParm2;
|
|
|
|
|
|
|
|
lWhat = *(insptr++);
|
|
|
|
lVar1 = -1;
|
|
|
|
lLabelID = *(insptr++);
|
2020-09-17 21:02:52 +00:00
|
|
|
lParm2 = *(insptr++);
|
2020-09-17 20:36:09 +00:00
|
|
|
lVar2 = *(insptr++);
|
|
|
|
|
2020-10-23 17:07:33 +00:00
|
|
|
DoUserDef(lWhat == concmd_setuserdef, lVar1, lLabelID, lVar2, g_ac, g_p, lParm2);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_setwall:
|
|
|
|
case concmd_getwall:
|
|
|
|
{
|
|
|
|
// syntax [gs]etwall[<var>].x <VAR>
|
|
|
|
// <varid> <xxxid> <varid>
|
|
|
|
int lLabelID;
|
|
|
|
int lVar1, lVar2;
|
|
|
|
int lWhat;
|
|
|
|
int lParm2;
|
|
|
|
|
|
|
|
lWhat = *(insptr++);
|
|
|
|
lVar1 = *(insptr++);
|
|
|
|
lLabelID = *(insptr++);
|
2020-09-17 21:02:52 +00:00
|
|
|
lParm2 = *(insptr++);
|
2020-09-17 20:36:09 +00:00
|
|
|
lVar2 = *(insptr++);
|
|
|
|
|
2020-10-23 17:07:33 +00:00
|
|
|
DoWall(lWhat == concmd_setwall, lVar1, lLabelID, lVar2, g_ac, g_p, lParm2);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_setactorvar:
|
|
|
|
{
|
|
|
|
// syntax [gs]etactorvar[<var>].<varx> <VAR>
|
|
|
|
// gets the value of the per-actor variable varx into VAR
|
|
|
|
// <var> <varx> <VAR>
|
|
|
|
int lVar1, lVar2, lVar3;
|
|
|
|
|
|
|
|
insptr++;
|
|
|
|
|
|
|
|
lVar1 = *(insptr++);
|
|
|
|
lVar2 = *(insptr++);
|
|
|
|
lVar3 = *(insptr++);
|
|
|
|
|
2021-12-05 16:36:57 +00:00
|
|
|
auto lSprite = GetGameVarID(lVar1, g_ac, g_p);
|
|
|
|
if (lSprite.isActor())
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-12-05 16:36:57 +00:00
|
|
|
auto lTemp = GetGameVarID(lVar3, g_ac, g_p);
|
|
|
|
SetGameVarID(lVar2, lTemp, lSprite.actor(), g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_getactorvar:
|
|
|
|
{
|
|
|
|
// syntax [gs]etactorvar[<var>].<varx> <VAR>
|
|
|
|
// gets the value of the per-actor variable varx into VAR
|
|
|
|
// <var> <varx> <VAR>
|
|
|
|
int lVar1, lVar2, lVar3;
|
|
|
|
|
|
|
|
insptr++;
|
|
|
|
|
|
|
|
lVar1 = *(insptr++);
|
|
|
|
lVar2 = *(insptr++);
|
|
|
|
lVar3 = *(insptr++);
|
2020-05-14 07:07:07 +00:00
|
|
|
|
2021-12-05 16:36:57 +00:00
|
|
|
auto lSprite = GetGameVarID(lVar1, g_ac, g_p);
|
|
|
|
if (lSprite.isActor())
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-12-05 16:36:57 +00:00
|
|
|
auto lTemp = GetGameVarID(lVar2, lSprite.actor(), g_p);
|
2020-10-23 18:22:08 +00:00
|
|
|
SetGameVarID(lVar3, lTemp, g_ac, g_p);
|
2020-05-14 07:07:07 +00:00
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_setactor:
|
|
|
|
case concmd_getactor:
|
|
|
|
{
|
|
|
|
// syntax [gs]etactor[<var>].x <VAR>
|
|
|
|
// <varid> <xxxid> <varid>
|
|
|
|
int lLabelID;
|
|
|
|
int lVar1, lVar2;
|
|
|
|
int lWhat;
|
|
|
|
int lParm2;
|
|
|
|
|
|
|
|
lWhat = *(insptr++);
|
|
|
|
lVar1 = *(insptr++);
|
|
|
|
lLabelID = *(insptr++);
|
2020-09-17 21:02:52 +00:00
|
|
|
lParm2 = *(insptr++);
|
2020-09-17 20:36:09 +00:00
|
|
|
lVar2 = *(insptr++);
|
|
|
|
|
2020-10-23 17:07:33 +00:00
|
|
|
DoActor(lWhat == concmd_setactor, lVar1, lLabelID, lVar2, g_ac, g_p, lParm2);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_getangletotarget:
|
|
|
|
{
|
|
|
|
int i;
|
2021-11-07 13:36:39 +00:00
|
|
|
int ang;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
insptr++;
|
|
|
|
i = *(insptr++); // ID of def
|
|
|
|
|
2020-10-23 18:22:08 +00:00
|
|
|
// g_ac->lastvx and lastvy are last known location of target.
|
2021-12-21 21:31:25 +00:00
|
|
|
ang = getangle(g_ac->lastvx - g_ac->spr.x, g_ac->lastvy - g_ac->spr.y);
|
2020-10-23 18:22:08 +00:00
|
|
|
SetGameVarID(i, ang, g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_lockplayer:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
insptr++;
|
|
|
|
i = *(insptr++); // ID of def
|
2021-12-05 16:36:57 +00:00
|
|
|
ps[g_p].transporter_hold = GetGameVarID(i, g_ac, g_p).safeValue();
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_getplayerangle:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
insptr++;
|
|
|
|
i = *(insptr++); // ID of def
|
2020-10-23 18:22:08 +00:00
|
|
|
SetGameVarID(i, ps[g_p].angle.ang.asbuild(), g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_setplayerangle:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
insptr++;
|
|
|
|
i = *(insptr++); // ID of def
|
2021-12-05 16:36:57 +00:00
|
|
|
ps[g_p].angle.ang = buildang(GetGameVarID(i, g_ac, g_p).safeValue() & 2047);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
case concmd_getactorangle:
|
|
|
|
{
|
|
|
|
int i;
|
2020-05-14 07:07:07 +00:00
|
|
|
insptr++;
|
2020-09-17 20:36:09 +00:00
|
|
|
i = *(insptr++); // ID of def
|
2021-12-21 21:31:25 +00:00
|
|
|
SetGameVarID(i, g_ac->spr.ang, g_ac, g_p);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
case concmd_setactorangle:
|
|
|
|
{
|
|
|
|
int i;
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
2020-09-17 20:36:09 +00:00
|
|
|
i = *(insptr++); // ID of def
|
2021-12-21 21:31:25 +00:00
|
|
|
g_ac->spr.ang = GetGameVarID(i, g_ac, g_p).safeValue();
|
|
|
|
g_ac->spr.ang &= 2047;
|
2020-05-14 17:23:36 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
case concmd_randvar:
|
|
|
|
{
|
|
|
|
int i;
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
2020-09-17 20:36:09 +00:00
|
|
|
i = *(insptr++); // ID of def
|
2021-01-04 11:57:26 +00:00
|
|
|
SetGameVarID(i, MulScale(rand(), *insptr, 15), g_ac, g_p);
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_mulvar:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
insptr++;
|
|
|
|
i = *(insptr++); // ID of def
|
2021-12-05 16:36:57 +00:00
|
|
|
SetGameVarID(i, GetGameVarID(i, g_ac, g_p).safeValue()* (*insptr), g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_divvar:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
insptr++;
|
|
|
|
i = *(insptr++); // ID of def
|
|
|
|
if ((*insptr) == 0)
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
2020-09-17 20:36:09 +00:00
|
|
|
I_Error("Divide by Zero in CON.");
|
2020-05-14 17:23:36 +00:00
|
|
|
}
|
2021-12-05 16:36:57 +00:00
|
|
|
SetGameVarID(i, GetGameVarID(i, g_ac, g_p).safeValue() / (*insptr), g_ac, g_p);
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
case concmd_modvar:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int l;
|
|
|
|
int lResult;
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
2020-09-17 20:36:09 +00:00
|
|
|
i = *(insptr++); // ID of def
|
|
|
|
l = (*insptr);
|
|
|
|
if (l == 0)
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
2020-09-17 20:36:09 +00:00
|
|
|
I_Error("Divide by Zero in CON");
|
2020-05-14 17:23:36 +00:00
|
|
|
}
|
2021-12-05 16:36:57 +00:00
|
|
|
lResult = GetGameVarID(i, g_ac, g_p).safeValue() % l;
|
2020-10-23 18:22:08 +00:00
|
|
|
SetGameVarID(i, lResult, g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
2020-05-14 17:23:36 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
case concmd_andvar:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int l;
|
|
|
|
int lResult;
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
2020-09-17 20:36:09 +00:00
|
|
|
i = *(insptr++); // ID of def
|
|
|
|
l = (*insptr);
|
2021-12-05 16:36:57 +00:00
|
|
|
lResult = GetGameVarID(i, g_ac, g_p).safeValue() & l;
|
2020-10-23 18:22:08 +00:00
|
|
|
SetGameVarID(i, lResult, g_ac, g_p);
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
case concmd_xorvar:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int l;
|
|
|
|
int lResult;
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
2020-09-17 20:36:09 +00:00
|
|
|
i = *(insptr++); // ID of def
|
|
|
|
l = (*insptr);
|
2021-12-05 16:36:57 +00:00
|
|
|
lResult = GetGameVarID(i, g_ac, g_p).safeValue() ^ l;
|
2020-10-23 18:22:08 +00:00
|
|
|
SetGameVarID(i, lResult, g_ac, g_p);
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
case concmd_orvar:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int l;
|
|
|
|
int lResult;
|
|
|
|
insptr++;
|
|
|
|
i = *(insptr++); // ID of def
|
|
|
|
l = (*insptr);
|
2021-12-05 16:36:57 +00:00
|
|
|
lResult = GetGameVarID(i, g_ac, g_p).safeValue() | l;
|
2020-10-23 18:22:55 +00:00
|
|
|
SetGameVarID(i, lResult, g_ac, g_p);
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
case concmd_randvarvar:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int l1, l2;
|
|
|
|
int lResult;
|
|
|
|
insptr++;
|
|
|
|
i = *(insptr++); // ID of def
|
2021-12-05 16:36:57 +00:00
|
|
|
l1 = GetGameVarID(i, g_ac, g_p).safeValue(); // not used for this command
|
|
|
|
l2 = GetGameVarID(*insptr, g_ac, g_p).safeValue();
|
2021-01-04 11:57:26 +00:00
|
|
|
lResult = MulScale(rand(), l2, 15);
|
2020-10-23 18:22:55 +00:00
|
|
|
SetGameVarID(i, lResult, g_ac, g_p);
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
case concmd_gmaxammo:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int l1, l2;
|
|
|
|
int lResult;
|
|
|
|
insptr++;
|
|
|
|
i = *(insptr++); // ID of def
|
2021-12-05 16:36:57 +00:00
|
|
|
l1 = GetGameVarID(i, g_ac, g_p).safeValue();
|
|
|
|
l2 = GetGameVarID(*insptr, g_ac, g_p).safeValue(); // l2 not used in this one
|
2020-11-29 12:54:58 +00:00
|
|
|
lResult = gs.max_ammo_amount[l1];
|
2020-10-23 18:22:55 +00:00
|
|
|
SetGameVarID(*insptr, lResult, g_ac, g_p);
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
case concmd_smaxammo:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int l1, l2;
|
|
|
|
insptr++;
|
|
|
|
i = *(insptr++); // ID of def
|
2021-12-05 16:36:57 +00:00
|
|
|
l1 = GetGameVarID(i, g_ac, g_p).safeValue();
|
|
|
|
l2 = GetGameVarID(*insptr, g_ac, g_p).safeValue();
|
2020-11-29 12:54:58 +00:00
|
|
|
gs.max_ammo_amount[l1] = l2;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
case concmd_mulvarvar:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int l1, l2;
|
|
|
|
int lResult;
|
|
|
|
insptr++;
|
|
|
|
i = *(insptr++); // ID of def
|
2021-12-05 16:36:57 +00:00
|
|
|
l1 = GetGameVarID(i, g_ac, g_p).safeValue();
|
|
|
|
l2 = GetGameVarID(*insptr, g_ac, g_p).safeValue();
|
2020-09-17 20:36:09 +00:00
|
|
|
lResult = l1 * l2;
|
2020-10-23 18:22:55 +00:00
|
|
|
SetGameVarID(i, lResult, g_ac, g_p);
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
case concmd_divvarvar:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int l1, l2;
|
|
|
|
int lResult;
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
2020-09-17 20:36:09 +00:00
|
|
|
i = *(insptr++); // ID of def
|
2021-12-05 16:36:57 +00:00
|
|
|
l1 = GetGameVarID(i, g_ac, g_p).safeValue();
|
|
|
|
l2 = GetGameVarID(*insptr, g_ac, g_p).safeValue();
|
2020-09-17 20:36:09 +00:00
|
|
|
if (l2 == 0)
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
2020-09-17 20:36:09 +00:00
|
|
|
I_Error("Divide by Zero in CON");
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
lResult = l1 / l2;
|
2020-10-23 18:22:55 +00:00
|
|
|
SetGameVarID(i, lResult, g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_modvarvar:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int l1, l2;
|
|
|
|
int lResult;
|
|
|
|
insptr++;
|
|
|
|
i = *(insptr++); // ID of def
|
2021-12-05 16:36:57 +00:00
|
|
|
l1 = GetGameVarID(i, g_ac, g_p).safeValue();
|
|
|
|
l2 = GetGameVarID(*insptr, g_ac, g_p).safeValue();
|
2020-09-17 20:36:09 +00:00
|
|
|
if (l2 == 0)
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
2020-09-17 20:36:09 +00:00
|
|
|
I_Error("Mod by Zero in CON");
|
2020-05-14 17:23:36 +00:00
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
lResult = l1 % l2;
|
2020-10-23 18:22:55 +00:00
|
|
|
SetGameVarID(i, lResult, g_ac, g_p);
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
case concmd_andvarvar:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int l1, l2;
|
|
|
|
int lResult;
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
2020-09-17 20:36:09 +00:00
|
|
|
i = *(insptr++); // ID of def
|
2021-12-05 16:36:57 +00:00
|
|
|
l1 = GetGameVarID(i, g_ac, g_p).safeValue();
|
|
|
|
l2 = GetGameVarID(*insptr, g_ac, g_p).safeValue();
|
2020-09-17 20:36:09 +00:00
|
|
|
lResult = l1 & l2;
|
2020-10-23 18:22:55 +00:00
|
|
|
SetGameVarID(i, lResult, g_ac, g_p);
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
case concmd_xorvarvar:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int l1, l2;
|
|
|
|
int lResult;
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
2020-09-17 20:36:09 +00:00
|
|
|
i = *(insptr++); // ID of def
|
2021-12-05 16:36:57 +00:00
|
|
|
l1 = GetGameVarID(i, g_ac, g_p).safeValue();
|
|
|
|
l2 = GetGameVarID(*insptr, g_ac, g_p).safeValue();
|
2020-09-17 20:36:09 +00:00
|
|
|
lResult = l1 ^ l2;
|
2020-10-23 18:22:55 +00:00
|
|
|
SetGameVarID(i, lResult, g_ac, g_p);
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
case concmd_orvarvar:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int l1, l2;
|
|
|
|
int lResult;
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
2020-09-17 20:36:09 +00:00
|
|
|
i = *(insptr++); // ID of def
|
2021-12-05 16:36:57 +00:00
|
|
|
l1 = GetGameVarID(i, g_ac, g_p).safeValue();
|
|
|
|
l2 = GetGameVarID(*insptr, g_ac, g_p).safeValue();
|
2020-09-17 20:36:09 +00:00
|
|
|
lResult = l1 | l2;
|
2020-10-23 18:22:55 +00:00
|
|
|
SetGameVarID(i, lResult, g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_subvar:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
insptr++;
|
|
|
|
i = *(insptr++); // ID of def
|
2021-12-05 16:36:57 +00:00
|
|
|
SetGameVarID(i, GetGameVarID(i, g_ac, g_p).safeValue() - *insptr, g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_subvarvar:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
insptr++;
|
|
|
|
i = *(insptr++); // ID of def
|
2021-12-05 16:36:57 +00:00
|
|
|
SetGameVarID(i, GetGameVarID(i, g_ac, g_p).safeValue() - GetGameVarID(*insptr, g_ac, g_p).safeValue(), g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_sin:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int lValue;
|
|
|
|
insptr++;
|
|
|
|
i = *(insptr++); // ID of def
|
2021-12-05 16:36:57 +00:00
|
|
|
lValue = bsin(GetGameVarID(*insptr, g_ac, g_p).safeValue());
|
2020-10-23 18:22:55 +00:00
|
|
|
SetGameVarID(i, lValue, g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
insptr++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case concmd_spgetlotag:
|
|
|
|
{
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
SetGameVarID(g_iLoTagID, g_ac->spr.lotag, g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_spgethitag:
|
|
|
|
{
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
SetGameVarID(g_iHiTagID, g_ac->spr.hitag, g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_sectgetlotag:
|
|
|
|
{
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
SetGameVarID(g_iLoTagID, g_ac->spr.sector()->lotag, g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_sectgethitag:
|
|
|
|
{
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
SetGameVarID(g_iHiTagID, g_ac->spr.sector()->hitag, g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_gettexturefloor:
|
|
|
|
{
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
SetGameVarID(g_iTextureID, g_ac->spr.sector()->floorpicnum, g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case concmd_startlevel:
|
|
|
|
{
|
|
|
|
// from 'level' cheat in game.c (about line 6250)
|
|
|
|
int volnume;
|
|
|
|
int levnume;
|
|
|
|
|
|
|
|
insptr++; // skip command
|
2021-12-05 16:36:57 +00:00
|
|
|
volnume = GetGameVarID(*insptr++, g_ac, g_p).safeValue();
|
|
|
|
levnume = GetGameVarID(*insptr++, g_ac, g_p).safeValue();
|
2021-05-02 08:35:43 +00:00
|
|
|
auto level = FindMapByIndex(volnume, levnume);
|
2020-09-17 20:36:09 +00:00
|
|
|
if (level != nullptr)
|
2021-07-20 08:51:34 +00:00
|
|
|
ChangeLevel(level, g_nextskill);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_myosx:
|
|
|
|
case concmd_myospalx:
|
|
|
|
|
|
|
|
case concmd_myos:
|
|
|
|
case concmd_myospal:
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
int tilenum;
|
|
|
|
int shade;
|
|
|
|
int orientation;
|
|
|
|
int pal;
|
|
|
|
int tw = *insptr++;
|
2021-12-05 16:36:57 +00:00
|
|
|
x = GetGameVarID(*insptr++, g_ac, g_p).safeValue();
|
|
|
|
y = GetGameVarID(*insptr++, g_ac, g_p).safeValue();
|
|
|
|
tilenum = GetGameVarID(*insptr++, g_ac, g_p).safeValue();
|
|
|
|
shade = GetGameVarID(*insptr++, g_ac, g_p).safeValue();
|
|
|
|
orientation = GetGameVarID(*insptr++, g_ac, g_p).safeValue();
|
2020-09-17 20:36:09 +00:00
|
|
|
if (tw == concmd_myospal)
|
|
|
|
{
|
2021-12-05 16:36:57 +00:00
|
|
|
pal = GetGameVarID(*insptr++, g_ac, g_p).safeValue();
|
2020-09-17 20:36:09 +00:00
|
|
|
//myospal(x, y, tilenum, shade, orientation, pal);
|
|
|
|
}
|
|
|
|
else if (tw == concmd_myos)
|
|
|
|
{
|
|
|
|
//myos(x, y, tilenum, shade, orientation);
|
|
|
|
}
|
|
|
|
else if (tw == concmd_myosx)
|
|
|
|
{
|
|
|
|
//myos640(x, y, tilenum, shade, orientation);
|
|
|
|
}
|
|
|
|
else if (tw == concmd_myospalx)
|
|
|
|
{
|
2021-12-05 16:36:57 +00:00
|
|
|
pal = GetGameVarID(*insptr++, g_ac, g_p).safeValue();
|
2020-09-17 20:36:09 +00:00
|
|
|
//myospal640(x, y, tilenum, shade, orientation, pal);
|
|
|
|
}
|
2020-05-14 17:23:36 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
case concmd_displayrand:
|
|
|
|
{
|
|
|
|
int i;
|
2020-05-14 17:23:36 +00:00
|
|
|
insptr++;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
i = *(insptr++); // ID of def
|
2020-10-23 18:22:55 +00:00
|
|
|
SetGameVarID(i, rand(), g_ac, g_p);
|
2020-05-14 17:23:36 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
case concmd_switch:
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
2020-09-17 20:36:09 +00:00
|
|
|
int lVarID;
|
|
|
|
int lValue;
|
|
|
|
int* lpDefault;
|
|
|
|
int* lpCases;
|
|
|
|
int lCases;
|
|
|
|
int lEnd;
|
|
|
|
int lCheckCase;
|
2021-11-07 11:53:48 +00:00
|
|
|
bool bMatched;
|
2020-09-17 20:36:09 +00:00
|
|
|
int* lTempInsPtr;
|
|
|
|
|
|
|
|
// command format:
|
|
|
|
// variable ID to check
|
|
|
|
// script offset to 'end'
|
|
|
|
// count of case statements
|
|
|
|
// script offset to default case (null if none)
|
|
|
|
// For each case: value, ptr to code
|
|
|
|
insptr++; // p-code
|
|
|
|
lVarID = *insptr++;
|
2021-12-05 16:36:57 +00:00
|
|
|
lValue = GetGameVarID(lVarID, g_ac, g_p).safeValue();
|
2020-09-17 20:36:09 +00:00
|
|
|
lEnd = *insptr++;
|
|
|
|
lCases = *insptr++;
|
|
|
|
lpDefault = insptr++;
|
|
|
|
lpCases = insptr;
|
|
|
|
insptr += lCases * 2;
|
2021-11-07 11:53:48 +00:00
|
|
|
bMatched = false;
|
2020-09-17 20:36:09 +00:00
|
|
|
lTempInsPtr = insptr;
|
|
|
|
for (lCheckCase = 0; lCheckCase < lCases && !bMatched; lCheckCase++)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-09-17 20:36:09 +00:00
|
|
|
if (lpCases[lCheckCase * 2] == lValue)
|
|
|
|
{
|
|
|
|
insptr = &ScriptCode[lpCases[lCheckCase * 2 + 1]];
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
if (parse())
|
|
|
|
break;
|
|
|
|
}
|
2021-11-07 11:53:48 +00:00
|
|
|
bMatched = true;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
if (!bMatched)
|
|
|
|
{
|
|
|
|
if (*lpDefault)
|
|
|
|
{
|
|
|
|
insptr = &ScriptCode[*lpDefault];
|
|
|
|
while (1) if (parse()) break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//AddLog("No Matching Case: No Default to use");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
insptr = &ScriptCode[lEnd];
|
2020-05-14 17:23:36 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
case concmd_endswitch:
|
|
|
|
insptr++;
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case concmd_starttrack:
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
|
|
|
insptr++;
|
2020-09-17 20:36:09 +00:00
|
|
|
int music_select = *insptr++;
|
2021-05-02 08:35:43 +00:00
|
|
|
auto level = FindMapByIndex(currentLevel->cluster, music_select+1); // this was 0-based in EDuke 2.0...
|
2020-09-17 20:36:09 +00:00
|
|
|
if (level) S_PlayLevelMusic(level);
|
2020-05-14 17:23:36 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
case concmd_gettextureceiling:
|
|
|
|
{
|
|
|
|
insptr++;
|
2021-12-21 21:31:25 +00:00
|
|
|
SetGameVarID(g_iTextureID, g_ac->spr.sector()->ceilingpicnum, g_ac, g_p);
|
2020-09-17 20:36:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case concmd_ifvarvarand:
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
insptr++;
|
2020-09-17 20:36:09 +00:00
|
|
|
i = *(insptr++); // ID of def
|
|
|
|
j = 0;
|
2021-12-05 16:36:57 +00:00
|
|
|
if (GetGameVarID(i, g_ac, g_p).safeValue() & GetGameVarID(*(insptr), g_ac, g_p).safeValue())
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-09-17 20:36:09 +00:00
|
|
|
j = 1;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
parseifelse(j);
|
2020-05-14 17:23:36 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
case concmd_ifvarvarn:
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
insptr++;
|
2020-09-17 20:36:09 +00:00
|
|
|
i = *(insptr++); // ID of def
|
|
|
|
j = 0;
|
2021-12-05 16:36:57 +00:00
|
|
|
if (GetGameVarID(i, g_ac, g_p).safeValue() != GetGameVarID(*(insptr), g_ac, g_p).safeValue())
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-09-17 20:36:09 +00:00
|
|
|
j = 1;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
parseifelse(j);
|
2020-05-14 17:23:36 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
case concmd_ifvarn:
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
insptr++;
|
2020-09-17 20:36:09 +00:00
|
|
|
i = *(insptr++); // ID of def
|
|
|
|
j = 0;
|
2021-12-05 16:36:57 +00:00
|
|
|
if (GetGameVarID(i, g_ac, g_p).safeValue() != *insptr)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-09-17 20:36:09 +00:00
|
|
|
j = 1;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
parseifelse(j);
|
2020-05-14 17:23:36 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
case concmd_ifvarand:
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
insptr++;
|
2020-09-17 20:36:09 +00:00
|
|
|
i = *(insptr++); // ID of def
|
|
|
|
j = 0;
|
2021-12-05 16:36:57 +00:00
|
|
|
if (GetGameVarID(i, g_ac, g_p).safeValue() & *insptr)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-09-17 20:36:09 +00:00
|
|
|
j = 1;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
parseifelse(j);
|
2020-05-14 17:23:36 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
Printf(TEXTCOLOR_RED "Unrecognized PCode of %d in parse. Killing current sprite.\n",*insptr);
|
|
|
|
Printf(TEXTCOLOR_RED "Offset=%0X\n",int(insptr-ScriptCode.Data()));
|
|
|
|
killit_flag = 1;
|
2020-05-14 17:23:36 +00:00
|
|
|
break;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-23 18:27:05 +00:00
|
|
|
void LoadActor(DDukeActor *actor, int p, int x)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-11-07 11:53:48 +00:00
|
|
|
int done;
|
2020-09-17 20:36:09 +00:00
|
|
|
|
|
|
|
ParseState s;
|
|
|
|
s.g_p = p; // Player ID
|
|
|
|
s.g_x = x; // ??
|
2020-10-23 18:27:05 +00:00
|
|
|
s.g_ac = actor;
|
|
|
|
s.g_t = &s.g_ac->temp_data[0]; // Sprite's 'extra' data
|
2020-09-17 20:36:09 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
auto addr = gs.tileinfo[actor->spr.picnum].loadeventscriptptr;
|
2020-09-17 20:36:09 +00:00
|
|
|
if (addr == 0) return;
|
|
|
|
|
|
|
|
s.killit_flag = 0;
|
|
|
|
|
2021-11-21 00:04:16 +00:00
|
|
|
if(!actor->insector())
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
2020-10-23 18:27:05 +00:00
|
|
|
deletesprite(actor);
|
2020-09-17 20:36:09 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
do
|
|
|
|
done = s.parse();
|
|
|
|
while (done == 0);
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
if (s.killit_flag == 1)
|
|
|
|
{
|
2020-10-23 18:27:05 +00:00
|
|
|
// if player was set to squish, first stop that..
|
2020-09-17 20:36:09 +00:00
|
|
|
if (p >= 0)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-23 18:27:05 +00:00
|
|
|
if (ps[p].actorsqu == actor)
|
2020-10-17 08:30:11 +00:00
|
|
|
ps[p].actorsqu = nullptr;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
2020-10-23 18:27:05 +00:00
|
|
|
deletesprite(actor);
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
|
|
|
else
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-23 18:27:05 +00:00
|
|
|
fi.move(actor, p, x);
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (actor->spr.statnum == STAT_ACTOR)
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2020-10-23 18:27:05 +00:00
|
|
|
if (badguy(actor))
|
2020-09-17 20:36:09 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (actor->spr.xrepeat > 60) return;
|
|
|
|
if (ud.respawn_monsters == 1 && actor->spr.extra <= 0) return;
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
2021-12-21 17:19:45 +00:00
|
|
|
else if (ud.respawn_items == 1 && (actor->spr.cstat & CSTAT_SPRITE_INVISIBLE)) return;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-10-23 18:27:05 +00:00
|
|
|
if (actor->timetosleep > 1)
|
|
|
|
actor->timetosleep--;
|
|
|
|
else if (actor->timetosleep == 1)
|
2021-11-26 20:52:01 +00:00
|
|
|
ChangeActorStat(actor, STAT_ZOMBIEACTOR);
|
2020-09-17 20:36:09 +00:00
|
|
|
}
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
else if (actor->spr.statnum == 6)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-09-17 20:36:09 +00:00
|
|
|
#if 0
|
2020-10-23 18:27:05 +00:00
|
|
|
switch (actor->s.picnum)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-09-17 20:36:09 +00:00
|
|
|
case RUBBERCAN:
|
|
|
|
case EXPLODINGBARREL:
|
|
|
|
case WOODENHORSE:
|
|
|
|
case HORSEONSIDE:
|
|
|
|
case CANWITHSOMETHING:
|
|
|
|
case FIREBARREL:
|
|
|
|
case NUKEBARREL:
|
|
|
|
case NUKEBARRELDENTED:
|
|
|
|
case NUKEBARRELLEAKED:
|
|
|
|
case TRIPBOMB:
|
|
|
|
case EGG:
|
2020-10-23 18:27:05 +00:00
|
|
|
if (actor->timetosleep > 1)
|
|
|
|
actor->timetosleep--;
|
|
|
|
else if (actor->timetosleep == 1)
|
2020-09-17 20:36:09 +00:00
|
|
|
changespritestat(i, 2);
|
|
|
|
break;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
2020-09-17 20:36:09 +00:00
|
|
|
#endif
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-14 17:23:36 +00:00
|
|
|
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2020-09-17 20:36:09 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-23 18:28:29 +00:00
|
|
|
void execute(DDukeActor *actor,int p,int x)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (gs.actorinfo[actor->spr.picnum].scriptaddress == 0) return;
|
2020-05-15 06:04:30 +00:00
|
|
|
|
2020-05-14 17:23:36 +00:00
|
|
|
int done;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-07-18 10:37:35 +00:00
|
|
|
ParseState s;
|
|
|
|
s.g_p = p; // Player ID
|
|
|
|
s.g_x = x; // ??
|
2020-10-23 18:28:29 +00:00
|
|
|
s.g_ac = actor;
|
|
|
|
s.g_t = &actor->temp_data[0]; // Sprite's 'extra' data
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (gs.actorinfo[actor->spr.picnum].scriptaddress == 0) return;
|
|
|
|
s.insptr = &ScriptCode[4 + (gs.actorinfo[actor->spr.picnum].scriptaddress)];
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-07-18 10:37:35 +00:00
|
|
|
s.killit_flag = 0;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2021-11-21 00:04:16 +00:00
|
|
|
if(!actor->insector())
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-23 18:28:29 +00:00
|
|
|
if(badguy(actor))
|
2020-07-18 10:37:35 +00:00
|
|
|
ps[p].actors_killed++;
|
2020-10-23 18:28:29 +00:00
|
|
|
deletesprite(actor);
|
2020-05-13 22:04:14 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-07-18 10:37:35 +00:00
|
|
|
if (s.g_t[4])
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-05-14 17:23:36 +00:00
|
|
|
// This code was utterly cryptic in the original source.
|
2020-07-18 10:37:35 +00:00
|
|
|
auto ptr = &ScriptCode[s.g_t[4]];
|
2020-05-14 17:23:36 +00:00
|
|
|
int numframes = ptr[1];
|
|
|
|
int increment = ptr[3];
|
|
|
|
int delay = ptr[4];
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
actor->spr.lotag += TICSPERFRAME;
|
|
|
|
if (actor->spr.lotag > delay)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-07-18 10:37:35 +00:00
|
|
|
s.g_t[2]++;
|
2021-12-21 17:19:45 +00:00
|
|
|
actor->spr.lotag = 0;
|
2020-07-18 10:37:35 +00:00
|
|
|
s.g_t[3] += increment;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
2020-07-18 10:37:35 +00:00
|
|
|
if (abs(s.g_t[3]) >= abs(numframes * increment))
|
|
|
|
s.g_t[3] = 0;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
do
|
2020-07-18 10:37:35 +00:00
|
|
|
done = s.parse();
|
2020-05-13 22:04:14 +00:00
|
|
|
while( done == 0 );
|
|
|
|
|
2020-07-18 10:37:35 +00:00
|
|
|
if(s.killit_flag == 1)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-23 18:28:29 +00:00
|
|
|
// if player was set to squish, first stop that..
|
|
|
|
if(ps[p].actorsqu == actor)
|
2020-10-17 08:30:11 +00:00
|
|
|
ps[p].actorsqu = nullptr;
|
2020-05-15 06:04:30 +00:00
|
|
|
killthesprite = true;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-23 18:28:29 +00:00
|
|
|
fi.move(actor, p, x);
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (actor->spr.statnum == STAT_ACTOR)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-10-23 18:28:29 +00:00
|
|
|
if (badguy(actor))
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (actor->spr.xrepeat > 60) goto quit;
|
|
|
|
if (ud.respawn_monsters == 1 && actor->spr.extra <= 0) goto quit;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
2021-12-21 17:19:45 +00:00
|
|
|
else if (ud.respawn_items == 1 && (actor->spr.cstat & CSTAT_SPRITE_INVISIBLE)) goto quit;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-10-23 18:28:29 +00:00
|
|
|
if (actor->timetosleep > 1)
|
|
|
|
actor->timetosleep--;
|
|
|
|
else if (actor->timetosleep == 1)
|
2021-11-26 20:52:01 +00:00
|
|
|
ChangeActorStat(actor, STAT_ZOMBIEACTOR);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
else if (actor->spr.statnum == STAT_STANDABLE)
|
2020-10-23 18:28:29 +00:00
|
|
|
fi.checktimetosleep(actor);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
2020-05-15 06:04:30 +00:00
|
|
|
quit:
|
2020-10-23 18:28:29 +00:00
|
|
|
if (killthesprite) deletesprite(actor);
|
2020-05-15 06:04:30 +00:00
|
|
|
killthesprite = false;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-15 08:44:57 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-01 16:57:40 +00:00
|
|
|
void OnEvent(int iEventID, int p, DDukeActor *actor, int x)
|
2020-05-15 08:44:57 +00:00
|
|
|
{
|
2021-11-07 11:53:48 +00:00
|
|
|
int done;
|
2020-05-15 08:44:57 +00:00
|
|
|
|
|
|
|
if (iEventID >= MAXGAMEEVENTS)
|
|
|
|
{
|
|
|
|
Printf("Invalid Event ID\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (apScriptGameEvent[iEventID] == 0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-07-18 10:37:35 +00:00
|
|
|
ParseState s;
|
|
|
|
s.g_p = p; /// current player ID
|
|
|
|
s.g_x = x; // ?
|
2020-11-01 16:57:40 +00:00
|
|
|
s.g_ac = actor;
|
|
|
|
s.g_t = actor->temp_data;
|
2020-05-15 08:44:57 +00:00
|
|
|
|
2020-07-18 10:37:35 +00:00
|
|
|
s.insptr = &ScriptCode[apScriptGameEvent[iEventID]];
|
2020-05-15 08:44:57 +00:00
|
|
|
|
2020-07-18 10:37:35 +00:00
|
|
|
s.killit_flag = 0;
|
2020-05-15 08:44:57 +00:00
|
|
|
do
|
2020-07-18 10:37:35 +00:00
|
|
|
done = s.parse();
|
2020-05-15 08:44:57 +00:00
|
|
|
while (done == 0);
|
|
|
|
}
|
|
|
|
|
2020-05-13 22:04:14 +00:00
|
|
|
END_DUKE_NS
|