mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Rednukem: WW2GI events
# Conflicts: # source/rr/src/events_defs.h # source/rr/src/game.cpp # source/rr/src/gameexec.h
This commit is contained in:
parent
47572cc01a
commit
972f2c4f0d
7 changed files with 506 additions and 268 deletions
|
@ -216,22 +216,23 @@ void G_SetupCheats(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void doinvcheat(DukePlayer_t * const pPlayer, int32_t invidx, int32_t defaultnum)
|
static void doinvcheat(DukePlayer_t * const pPlayer, int32_t invidx, int32_t defaultnum, int event)
|
||||||
{
|
{
|
||||||
|
defaultnum = VM_OnEventWithReturn(event, pPlayer->i, myconnectindex, defaultnum);
|
||||||
if (defaultnum >= 0)
|
if (defaultnum >= 0)
|
||||||
pPlayer->inv_amount[invidx] = defaultnum;
|
pPlayer->inv_amount[invidx] = defaultnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void G_CheatGetInv(DukePlayer_t *pPlayer)
|
static void G_CheatGetInv(DukePlayer_t *pPlayer)
|
||||||
{
|
{
|
||||||
doinvcheat(pPlayer, GET_STEROIDS, 400);
|
doinvcheat(pPlayer, GET_STEROIDS, 400, EVENT_CHEATGETSTEROIDS);
|
||||||
if (!RR) doinvcheat(pPlayer, GET_HEATS, 1200);
|
if (!RR) doinvcheat(pPlayer, GET_HEATS, 1200, EVENT_CHEATGETHEAT);
|
||||||
doinvcheat(pPlayer, GET_BOOTS, RR ? 2000 : 200);
|
doinvcheat(pPlayer, GET_BOOTS, RR ? 2000 : 200, EVENT_CHEATGETBOOT);
|
||||||
doinvcheat(pPlayer, GET_SHIELD, 100);
|
doinvcheat(pPlayer, GET_SHIELD, 100, EVENT_CHEATGETSHIELD);
|
||||||
doinvcheat(pPlayer, GET_SCUBA, 6400);
|
doinvcheat(pPlayer, GET_SCUBA, 6400, EVENT_CHEATGETSCUBA);
|
||||||
doinvcheat(pPlayer, GET_HOLODUKE, 2400);
|
doinvcheat(pPlayer, GET_HOLODUKE, 2400, EVENT_CHEATGETHOLODUKE);
|
||||||
doinvcheat(pPlayer, GET_JETPACK, RR ? 600 : 1600);
|
doinvcheat(pPlayer, GET_JETPACK, RR ? 600 : 1600, EVENT_CHEATGETJETPACK);
|
||||||
doinvcheat(pPlayer, GET_FIRSTAID, pPlayer->max_player_health);
|
doinvcheat(pPlayer, GET_FIRSTAID, pPlayer->max_player_health, EVENT_CHEATGETFIRSTAID);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void end_cheat(DukePlayer_t * const pPlayer)
|
static void end_cheat(DukePlayer_t * const pPlayer)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2016 EDuke32 developers and contributors
|
Copyright (C) 2016 EDuke32 developers and contributors
|
||||||
|
|
||||||
|
@ -6730,6 +6730,8 @@ static void G_CompileScripts(void)
|
||||||
Bmemset(sprite, 0, MAXSPRITES*sizeof(spritetype));
|
Bmemset(sprite, 0, MAXSPRITES*sizeof(spritetype));
|
||||||
Bmemset(sector, 0, MAXSECTORS*sizeof(sectortype));
|
Bmemset(sector, 0, MAXSECTORS*sizeof(sectortype));
|
||||||
Bmemset(wall, 0, MAXWALLS*sizeof(walltype));
|
Bmemset(wall, 0, MAXWALLS*sizeof(walltype));
|
||||||
|
|
||||||
|
VM_OnEvent(EVENT_INIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void G_CheckGametype(void)
|
static inline void G_CheckGametype(void)
|
||||||
|
|
|
@ -131,6 +131,87 @@ static void VM_DeleteSprite(int const spriteNum, int const playerNum)
|
||||||
}
|
}
|
||||||
|
|
||||||
intptr_t apScriptEvents[MAXEVENTS];
|
intptr_t apScriptEvents[MAXEVENTS];
|
||||||
|
static uspritetype dummy_sprite;
|
||||||
|
static actor_t dummy_actor;
|
||||||
|
|
||||||
|
static inline void VM_DummySprite(void)
|
||||||
|
{
|
||||||
|
vm.pUSprite = &dummy_sprite;
|
||||||
|
vm.pActor = &dummy_actor;
|
||||||
|
vm.pData = &dummy_actor.t_data[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
// verification that the event actually exists happens elsewhere
|
||||||
|
static FORCE_INLINE int32_t VM_EventInlineInternal__(int const eventNum, int const spriteNum, int const playerNum,
|
||||||
|
int const playerDist = -1, int32_t returnValue = 0)
|
||||||
|
{
|
||||||
|
vmstate_t const newVMstate = { spriteNum, playerNum, playerDist, 0,
|
||||||
|
&sprite[spriteNum&(MAXSPRITES-1)],
|
||||||
|
&actor[spriteNum&(MAXSPRITES-1)].t_data[0],
|
||||||
|
g_player[playerNum&(MAXPLAYERS-1)].ps,
|
||||||
|
&actor[spriteNum&(MAXSPRITES-1)] };
|
||||||
|
|
||||||
|
auto &globalReturn = aGameVars[g_returnVarID].global;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
vmstate_t vm;
|
||||||
|
intptr_t globalReturn;
|
||||||
|
int eventNum;
|
||||||
|
intptr_t const *insptr;
|
||||||
|
} const saved = { vm, globalReturn, g_currentEvent, insptr };
|
||||||
|
|
||||||
|
vm = newVMstate;
|
||||||
|
g_currentEvent = eventNum;
|
||||||
|
insptr = apScript + apScriptEvents[eventNum];
|
||||||
|
globalReturn = returnValue;
|
||||||
|
|
||||||
|
double const t = timerGetHiTicks();
|
||||||
|
|
||||||
|
if ((unsigned)spriteNum >= MAXSPRITES)
|
||||||
|
VM_DummySprite();
|
||||||
|
|
||||||
|
if ((unsigned)playerNum >= (unsigned)g_mostConcurrentPlayers)
|
||||||
|
vm.pPlayer = g_player[0].ps;
|
||||||
|
|
||||||
|
VM_Execute(true);
|
||||||
|
|
||||||
|
if (vm.flags & VM_KILL)
|
||||||
|
VM_DeleteSprite(vm.spriteNum, vm.playerNum);
|
||||||
|
|
||||||
|
// restoring these needs to happen after VM_DeleteSprite() due to event recursion
|
||||||
|
returnValue = globalReturn;
|
||||||
|
|
||||||
|
vm = saved.vm;
|
||||||
|
globalReturn = saved.globalReturn;
|
||||||
|
g_currentEvent = saved.eventNum;
|
||||||
|
insptr = saved.insptr;
|
||||||
|
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// the idea here is that the compiler inlines the call to VM_EventInlineInternal__() and gives us a set of
|
||||||
|
// functions which are optimized further based on distance/return having values known at compile time
|
||||||
|
|
||||||
|
int32_t VM_ExecuteEvent(int const nEventID, int const spriteNum, int const playerNum, int const nDist, int32_t const nReturn)
|
||||||
|
{
|
||||||
|
return VM_EventInlineInternal__(nEventID, spriteNum, playerNum, nDist, nReturn);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t VM_ExecuteEvent(int const nEventID, int const spriteNum, int const playerNum, int const nDist)
|
||||||
|
{
|
||||||
|
return VM_EventInlineInternal__(nEventID, spriteNum, playerNum, nDist);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t VM_ExecuteEvent(int const nEventID, int const spriteNum, int const playerNum)
|
||||||
|
{
|
||||||
|
return VM_EventInlineInternal__(nEventID, spriteNum, playerNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t VM_ExecuteEventWithValue(int const nEventID, int const spriteNum, int const playerNum, int32_t const nReturn)
|
||||||
|
{
|
||||||
|
return VM_EventInlineInternal__(nEventID, spriteNum, playerNum, -1, nReturn);
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t VM_CheckSquished(void)
|
static int32_t VM_CheckSquished(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,6 +28,35 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "gamedef.h" // vmstate_t
|
#include "gamedef.h" // vmstate_t
|
||||||
|
|
||||||
BEGIN_RR_NS
|
BEGIN_RR_NS
|
||||||
|
int32_t VM_ExecuteEvent(int const nEventID, int const spriteNum, int const playerNum, int const nDist, int32_t const nReturn);
|
||||||
|
int32_t VM_ExecuteEvent(int const nEventID, int const spriteNum, int const playerNum, int const nDist);
|
||||||
|
int32_t VM_ExecuteEvent(int const nEventID, int const spriteNum, int const playerNum);
|
||||||
|
int32_t VM_ExecuteEventWithValue(int const nEventID, int const spriteNum, int const playerNum, int32_t const nReturn);
|
||||||
|
|
||||||
|
static FORCE_INLINE int VM_HaveEvent(int const nEventID)
|
||||||
|
{
|
||||||
|
return !!apScriptEvents[nEventID];
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE int32_t VM_OnEvent(int nEventID, int spriteNum, int playerNum, int nDist, int32_t nReturn)
|
||||||
|
{
|
||||||
|
return VM_HaveEvent(nEventID) ? VM_ExecuteEvent(nEventID, spriteNum, playerNum, nDist, nReturn) : nReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE int32_t VM_OnEvent(int nEventID, int spriteNum, int playerNum, int nDist)
|
||||||
|
{
|
||||||
|
return VM_HaveEvent(nEventID) ? VM_ExecuteEvent(nEventID, spriteNum, playerNum, nDist) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE int32_t VM_OnEvent(int nEventID, int spriteNum = -1, int playerNum = -1)
|
||||||
|
{
|
||||||
|
return VM_HaveEvent(nEventID) ? VM_ExecuteEvent(nEventID, spriteNum, playerNum) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE int32_t VM_OnEventWithReturn(int nEventID, int spriteNum, int playerNum, int32_t nReturn)
|
||||||
|
{
|
||||||
|
return VM_HaveEvent(nEventID) ? VM_ExecuteEventWithValue(nEventID, spriteNum, playerNum, nReturn) : nReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
extern int32_t ticrandomseed;
|
extern int32_t ticrandomseed;
|
||||||
|
|
|
@ -302,7 +302,11 @@ static int GetAutoAimAng(int spriteNum, int playerNum, int projecTile, int zAdju
|
||||||
|
|
||||||
Bassert((unsigned)playerNum < MAXPLAYERS);
|
Bassert((unsigned)playerNum < MAXPLAYERS);
|
||||||
|
|
||||||
int aimang = (g_player[playerNum].ps->auto_aim == 3 && (!RRRA || projecTile != RPG2)) ? AUTO_AIM_ANGLE<<1 : AUTO_AIM_ANGLE;
|
Gv_SetVar(g_aimAngleVarID, (g_player[playerNum].ps->auto_aim == 3 && (!RRRA || projecTile != RPG2)) ? AUTO_AIM_ANGLE<<1 : AUTO_AIM_ANGLE, spriteNum, playerNum);
|
||||||
|
|
||||||
|
VM_OnEvent(EVENT_GETAUTOAIMANGLE, spriteNum, playerNum);
|
||||||
|
|
||||||
|
int aimang = Gv_GetVar(g_aimAngleVarID, spriteNum, playerNum);
|
||||||
if (aimang > 0)
|
if (aimang > 0)
|
||||||
returnSprite = A_FindTargetSprite(&sprite[spriteNum], aimang, projecTile);
|
returnSprite = A_FindTargetSprite(&sprite[spriteNum], aimang, projecTile);
|
||||||
|
|
||||||
|
@ -361,6 +365,14 @@ static void P_PreFireHitscan(int spriteNum, int playerNum, int projecTile, vec3_
|
||||||
|
|
||||||
DukePlayer_t *const pPlayer = g_player[playerNum].ps;
|
DukePlayer_t *const pPlayer = g_player[playerNum].ps;
|
||||||
|
|
||||||
|
Gv_SetVar(g_angRangeVarID, angRange, spriteNum, playerNum);
|
||||||
|
Gv_SetVar(g_zRangeVarID, zRange, spriteNum, playerNum);
|
||||||
|
|
||||||
|
VM_OnEvent(EVENT_GETSHOTRANGE, spriteNum, playerNum);
|
||||||
|
|
||||||
|
angRange = Gv_GetVar(g_angRangeVarID, spriteNum, playerNum);
|
||||||
|
zRange = Gv_GetVar(g_zRangeVarID, spriteNum, playerNum);
|
||||||
|
|
||||||
if (accurateAim)
|
if (accurateAim)
|
||||||
{
|
{
|
||||||
if (!pPlayer->auto_aim)
|
if (!pPlayer->auto_aim)
|
||||||
|
@ -689,7 +701,7 @@ growspark_rr:
|
||||||
|
|
||||||
if (playerNum >= 0)
|
if (playerNum >= 0)
|
||||||
P_PreFireHitscan(spriteNum, playerNum, projecTile, &startPos, &Zvel, &shootAng,
|
P_PreFireHitscan(spriteNum, playerNum, projecTile, &startPos, &Zvel, &shootAng,
|
||||||
projecTile == SHOTSPARK1, 1);
|
projecTile == SHOTSPARK1 && !WW2GI, 1);
|
||||||
else
|
else
|
||||||
A_PreFireHitscan(pSprite, &startPos, &Zvel, &shootAng, 1);
|
A_PreFireHitscan(pSprite, &startPos, &Zvel, &shootAng, 1);
|
||||||
|
|
||||||
|
@ -4125,6 +4137,15 @@ void P_SelectNextInvItem(DukePlayer_t *pPlayer)
|
||||||
pPlayer->inven_icon = ICON_NONE;
|
pPlayer->inven_icon = ICON_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set C-CON's WEAPON and WORKSLIKE gamevars.
|
||||||
|
void P_SetWeaponGamevars(int playerNum, const DukePlayer_t * const pPlayer)
|
||||||
|
{
|
||||||
|
Gv_SetVar(g_weaponVarID, pPlayer->curr_weapon, pPlayer->i, playerNum);
|
||||||
|
Gv_SetVar(g_worksLikeVarID,
|
||||||
|
((unsigned)pPlayer->curr_weapon < MAX_WEAPONS) ? PWEAPON(playerNum, pPlayer->curr_weapon, WorksLike) : -1,
|
||||||
|
pPlayer->i, playerNum);
|
||||||
|
}
|
||||||
|
|
||||||
void P_CheckWeapon(DukePlayer_t *pPlayer)
|
void P_CheckWeapon(DukePlayer_t *pPlayer)
|
||||||
{
|
{
|
||||||
int playerNum;
|
int playerNum;
|
||||||
|
@ -4179,6 +4200,8 @@ void P_CheckWeapon(DukePlayer_t *pPlayer)
|
||||||
pPlayer->last_weapon = pPlayer->curr_weapon;
|
pPlayer->last_weapon = pPlayer->curr_weapon;
|
||||||
pPlayer->random_club_frame = 0;
|
pPlayer->random_club_frame = 0;
|
||||||
pPlayer->curr_weapon = weaponNum;
|
pPlayer->curr_weapon = weaponNum;
|
||||||
|
P_SetWeaponGamevars(playerNum, pPlayer);
|
||||||
|
VM_OnEvent(EVENT_CHANGEWEAPON, pPlayer->i, playerNum);
|
||||||
pPlayer->kickback_pic = 0;
|
pPlayer->kickback_pic = 0;
|
||||||
if (pPlayer->holster_weapon == 1)
|
if (pPlayer->holster_weapon == 1)
|
||||||
{
|
{
|
||||||
|
@ -4509,7 +4532,9 @@ static void P_ProcessWeapon(int playerNum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#define WEAPON2_CLIP 20
|
#define WEAPON2_CLIP 20
|
||||||
if (NAM && TEST_SYNC_KEY(playerBits, SK_HOLSTER))
|
if (NAM_WW2GI && TEST_SYNC_KEY(playerBits, SK_HOLSTER)) // 'Holster Weapon
|
||||||
|
{
|
||||||
|
if (NAM)
|
||||||
{
|
{
|
||||||
if (pPlayer->curr_weapon == PISTOL_WEAPON)
|
if (pPlayer->curr_weapon == PISTOL_WEAPON)
|
||||||
{
|
{
|
||||||
|
@ -4523,6 +4548,28 @@ static void P_ProcessWeapon(int playerNum)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
P_SetWeaponGamevars(playerNum, pPlayer);
|
||||||
|
|
||||||
|
if (VM_OnEvent(EVENT_HOLSTER, pPlayer->i, playerNum) == 0)
|
||||||
|
{
|
||||||
|
if (PWEAPON(playerNum, pPlayer->curr_weapon, Flags) & WEAPON_HOLSTER_CLEARS_CLIP)
|
||||||
|
{
|
||||||
|
int const weap = pPlayer->curr_weapon, clipcnt = PWEAPON(playerNum, weap, Clip);
|
||||||
|
|
||||||
|
if (pPlayer->ammo_amount[weap] > clipcnt && (pPlayer->ammo_amount[weap] % clipcnt) != 0)
|
||||||
|
{
|
||||||
|
pPlayer->ammo_amount[weap] -= pPlayer->ammo_amount[weap] % clipcnt;
|
||||||
|
*weaponFrame = PWEAPON(playerNum, weap, TotalTime)+1;
|
||||||
|
playerBits &= ~BIT(SK_FIRE); // not firing...
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#undef WEAPON2_CLIP
|
#undef WEAPON2_CLIP
|
||||||
if (pPlayer->curr_weapon == SHRINKER_WEAPON || pPlayer->curr_weapon == GROW_WEAPON
|
if (pPlayer->curr_weapon == SHRINKER_WEAPON || pPlayer->curr_weapon == GROW_WEAPON
|
||||||
|| (RR && (pPlayer->curr_weapon == TRIPBOMB_WEAPON || pPlayer->curr_weapon == BOWLINGBALL_WEAPON))
|
|| (RR && (pPlayer->curr_weapon == TRIPBOMB_WEAPON || pPlayer->curr_weapon == BOWLINGBALL_WEAPON))
|
||||||
|
@ -4576,6 +4623,9 @@ static void P_ProcessWeapon(int playerNum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
P_SetWeaponGamevars(playerNum, pPlayer);
|
||||||
|
if (VM_OnEvent(EVENT_FIRE, pPlayer->i, playerNum) == 0)
|
||||||
{
|
{
|
||||||
switch (DYNAMICWEAPONMAP(pPlayer->curr_weapon))
|
switch (DYNAMICWEAPONMAP(pPlayer->curr_weapon))
|
||||||
{
|
{
|
||||||
|
@ -4730,6 +4780,7 @@ static void P_ProcessWeapon(int playerNum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (*weaponFrame)
|
else if (*weaponFrame)
|
||||||
{
|
{
|
||||||
int spriteNum;
|
int spriteNum;
|
||||||
|
@ -5956,16 +6007,22 @@ static void P_DoJetpack(int const playerNum, int const playerBits, int const pla
|
||||||
int const zAdjust = playerShrunk ? 512 : 2048;
|
int const zAdjust = playerShrunk ? 512 : 2048;
|
||||||
|
|
||||||
if (TEST_SYNC_KEY(playerBits, SK_JUMP)) // jumping, flying up
|
if (TEST_SYNC_KEY(playerBits, SK_JUMP)) // jumping, flying up
|
||||||
|
{
|
||||||
|
if (VM_OnEvent(EVENT_SOARUP, pPlayer->i, playerNum) == 0)
|
||||||
{
|
{
|
||||||
pPlayer->pos.z -= zAdjust;
|
pPlayer->pos.z -= zAdjust;
|
||||||
pPlayer->crack_time = 777;
|
pPlayer->crack_time = 777;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (TEST_SYNC_KEY(playerBits, SK_CROUCH)) // crouching, flying down
|
if (TEST_SYNC_KEY(playerBits, SK_CROUCH)) // crouching, flying down
|
||||||
|
{
|
||||||
|
if (VM_OnEvent(EVENT_SOARDOWN, pPlayer->i, playerNum) == 0)
|
||||||
{
|
{
|
||||||
pPlayer->pos.z += zAdjust;
|
pPlayer->pos.z += zAdjust;
|
||||||
pPlayer->crack_time = 777;
|
pPlayer->crack_time = 777;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int const Zdiff = (playerShrunk == 0 && (sectorLotag == 0 || sectorLotag == ST_2_UNDERWATER)) ? 32 : 16;
|
int const Zdiff = (playerShrunk == 0 && (sectorLotag == 0 || sectorLotag == ST_2_UNDERWATER)) ? 32 : 16;
|
||||||
|
|
||||||
|
@ -6894,16 +6951,22 @@ check_enemy_sprite:
|
||||||
if (TEST_SYNC_KEY(playerBits, SK_LOOK_LEFT) && (!RRRA || !pPlayer->on_motorcycle))
|
if (TEST_SYNC_KEY(playerBits, SK_LOOK_LEFT) && (!RRRA || !pPlayer->on_motorcycle))
|
||||||
{
|
{
|
||||||
// look_left
|
// look_left
|
||||||
|
if (VM_OnEvent(EVENT_LOOKLEFT,pPlayer->i,playerNum) == 0)
|
||||||
|
{
|
||||||
pPlayer->look_ang -= 152;
|
pPlayer->look_ang -= 152;
|
||||||
pPlayer->rotscrnang += 24;
|
pPlayer->rotscrnang += 24;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (TEST_SYNC_KEY(playerBits, SK_LOOK_RIGHT) && (!RRRA || !pPlayer->on_motorcycle))
|
if (TEST_SYNC_KEY(playerBits, SK_LOOK_RIGHT) && (!RRRA || !pPlayer->on_motorcycle))
|
||||||
{
|
{
|
||||||
// look_right
|
// look_right
|
||||||
|
if (VM_OnEvent(EVENT_LOOKRIGHT,pPlayer->i,playerNum) == 0)
|
||||||
|
{
|
||||||
pPlayer->look_ang += 152;
|
pPlayer->look_ang += 152;
|
||||||
pPlayer->rotscrnang -= 24;
|
pPlayer->rotscrnang -= 24;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (RRRA && pPlayer->sea_sick)
|
if (RRRA && pPlayer->sea_sick)
|
||||||
{
|
{
|
||||||
|
@ -7209,9 +7272,12 @@ check_enemy_sprite:
|
||||||
if (TEST_SYNC_KEY(playerBits, SK_CROUCH) && (!RRRA || !pPlayer->on_motorcycle))
|
if (TEST_SYNC_KEY(playerBits, SK_CROUCH) && (!RRRA || !pPlayer->on_motorcycle))
|
||||||
{
|
{
|
||||||
// crouching
|
// crouching
|
||||||
|
if (VM_OnEvent(EVENT_CROUCH,pPlayer->i,playerNum) == 0)
|
||||||
|
{
|
||||||
pPlayer->pos.z += (2048+768);
|
pPlayer->pos.z += (2048+768);
|
||||||
pPlayer->crack_time = 777;
|
pPlayer->crack_time = 777;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// jumping
|
// jumping
|
||||||
if (!TEST_SYNC_KEY(playerBits, SK_JUMP) && (!RRRA || !pPlayer->on_motorcycle) && pPlayer->jumping_toggle == 1)
|
if (!TEST_SYNC_KEY(playerBits, SK_JUMP) && (!RRRA || !pPlayer->on_motorcycle) && pPlayer->jumping_toggle == 1)
|
||||||
|
@ -7220,11 +7286,14 @@ check_enemy_sprite:
|
||||||
{
|
{
|
||||||
if (pPlayer->jumping_counter == 0)
|
if (pPlayer->jumping_counter == 0)
|
||||||
if ((floorZ-ceilZ) > (56<<8))
|
if ((floorZ-ceilZ) > (56<<8))
|
||||||
|
{
|
||||||
|
if (VM_OnEvent(EVENT_JUMP,pPlayer->i,playerNum) == 0)
|
||||||
{
|
{
|
||||||
pPlayer->jumping_counter = 1;
|
pPlayer->jumping_counter = 1;
|
||||||
pPlayer->jumping_toggle = 1;
|
pPlayer->jumping_toggle = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!RR && pPlayer->jumping_counter && !TEST_SYNC_KEY(playerBits, SK_JUMP))
|
if (!RR && pPlayer->jumping_counter && !TEST_SYNC_KEY(playerBits, SK_JUMP))
|
||||||
pPlayer->jumping_toggle = 0;
|
pPlayer->jumping_toggle = 0;
|
||||||
|
@ -7822,30 +7891,43 @@ HORIZONLY:;
|
||||||
int centerHoriz = 0;
|
int centerHoriz = 0;
|
||||||
|
|
||||||
if (TEST_SYNC_KEY(playerBits, SK_CENTER_VIEW) || pPlayer->hard_landing)
|
if (TEST_SYNC_KEY(playerBits, SK_CENTER_VIEW) || pPlayer->hard_landing)
|
||||||
|
if (VM_OnEvent(EVENT_RETURNTOCENTER, pPlayer->i,playerNum) == 0)
|
||||||
pPlayer->return_to_center = 9;
|
pPlayer->return_to_center = 9;
|
||||||
|
|
||||||
if (TEST_SYNC_KEY(playerBits, SK_LOOK_UP))
|
if (TEST_SYNC_KEY(playerBits, SK_LOOK_UP))
|
||||||
|
{
|
||||||
|
if (VM_OnEvent(EVENT_LOOKUP, pPlayer->i, playerNum) == 0)
|
||||||
{
|
{
|
||||||
pPlayer->return_to_center = 9;
|
pPlayer->return_to_center = 9;
|
||||||
pPlayer->q16horiz += fix16_from_int(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
|
pPlayer->q16horiz += fix16_from_int(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
|
||||||
centerHoriz++;
|
centerHoriz++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (TEST_SYNC_KEY(playerBits, SK_LOOK_DOWN))
|
else if (TEST_SYNC_KEY(playerBits, SK_LOOK_DOWN))
|
||||||
|
{
|
||||||
|
if (VM_OnEvent(EVENT_LOOKDOWN,pPlayer->i,playerNum) == 0)
|
||||||
{
|
{
|
||||||
pPlayer->return_to_center = 9;
|
pPlayer->return_to_center = 9;
|
||||||
pPlayer->q16horiz -= fix16_from_int(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
|
pPlayer->q16horiz -= fix16_from_int(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
|
||||||
centerHoriz++;
|
centerHoriz++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (TEST_SYNC_KEY(playerBits, SK_AIM_UP) && (!RRRA || !pPlayer->on_motorcycle))
|
else if (TEST_SYNC_KEY(playerBits, SK_AIM_UP) && (!RRRA || !pPlayer->on_motorcycle))
|
||||||
|
{
|
||||||
|
if (VM_OnEvent(EVENT_AIMUP,pPlayer->i,playerNum) == 0)
|
||||||
{
|
{
|
||||||
pPlayer->q16horiz += fix16_from_int(6<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
|
pPlayer->q16horiz += fix16_from_int(6<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
|
||||||
centerHoriz++;
|
centerHoriz++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (TEST_SYNC_KEY(playerBits, SK_AIM_DOWN) && (!RRRA || !pPlayer->on_motorcycle))
|
else if (TEST_SYNC_KEY(playerBits, SK_AIM_DOWN) && (!RRRA || !pPlayer->on_motorcycle))
|
||||||
|
{
|
||||||
|
if (VM_OnEvent(EVENT_AIMDOWN,pPlayer->i,playerNum) == 0)
|
||||||
{
|
{
|
||||||
pPlayer->q16horiz -= fix16_from_int(6<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
|
pPlayer->q16horiz -= fix16_from_int(6<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
|
||||||
centerHoriz++;
|
centerHoriz++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (RR && pPlayer->recoil && *weaponFrame == 0)
|
if (RR && pPlayer->recoil && *weaponFrame == 0)
|
||||||
{
|
{
|
||||||
int delta = pPlayer->recoil >> 1;
|
int delta = pPlayer->recoil >> 1;
|
||||||
|
|
|
@ -493,7 +493,9 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent)
|
||||||
|
|
||||||
videoClearScreen(0);
|
videoClearScreen(0);
|
||||||
|
|
||||||
rotatesprite_fs(320<<15,200<<15,65536L,0,LOADSCREEN,0,0,2+8+64+BGSTRETCH);
|
int const loadScreenTile = VM_OnEventWithReturn(EVENT_GETLOADTILE, g_player[screenpeek].ps->i, screenpeek, LOADSCREEN);
|
||||||
|
|
||||||
|
rotatesprite_fs(320<<15,200<<15,65536L,0,loadScreenTile,0,0,2+8+64+BGSTRETCH);
|
||||||
|
|
||||||
int const textY = RRRA ? 140 : 90;
|
int const textY = RRRA ? 140 : 90;
|
||||||
|
|
||||||
|
@ -641,6 +643,7 @@ void G_CacheMapData(void)
|
||||||
|
|
||||||
while (percentage > lpc)
|
while (percentage > lpc)
|
||||||
{
|
{
|
||||||
|
G_HandleAsync();
|
||||||
Bsprintf(tempbuf, "Loaded %d%% (%d/%d textures)\n", lpc, pc, g_precacheCount);
|
Bsprintf(tempbuf, "Loaded %d%% (%d/%d textures)\n", lpc, pc, g_precacheCount);
|
||||||
G_DoLoadScreen(tempbuf, lpc);
|
G_DoLoadScreen(tempbuf, lpc);
|
||||||
|
|
||||||
|
@ -1048,6 +1051,8 @@ void P_ResetWeapons(int playerNum)
|
||||||
pPlayer->last_pissed_time = 0;
|
pPlayer->last_pissed_time = 0;
|
||||||
pPlayer->holster_weapon = 0;
|
pPlayer->holster_weapon = 0;
|
||||||
pPlayer->last_used_weapon = -1;
|
pPlayer->last_used_weapon = -1;
|
||||||
|
|
||||||
|
VM_OnEvent(EVENT_RESETWEAPONS, pPlayer->i, playerNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void P_ResetInventory(int playerNum)
|
void P_ResetInventory(int playerNum)
|
||||||
|
@ -1104,6 +1109,8 @@ void P_ResetInventory(int playerNum)
|
||||||
g_hulkSpawn = 2;
|
g_hulkSpawn = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VM_OnEvent(EVENT_RESETINVENTORY, pPlayer->i, playerNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void resetprestat(int playerNum, int gameMode)
|
static void resetprestat(int playerNum, int gameMode)
|
||||||
|
@ -2259,6 +2266,8 @@ int G_EnterLevel(int gameMode)
|
||||||
if ((gameMode & MODE_DEMO) == 0 && ud.recstat == 2)
|
if ((gameMode & MODE_DEMO) == 0 && ud.recstat == 2)
|
||||||
ud.recstat = 0;
|
ud.recstat = 0;
|
||||||
|
|
||||||
|
VM_OnEvent(EVENT_ENTERLEVEL);
|
||||||
|
|
||||||
//if (g_networkMode != NET_DEDICATED_SERVER)
|
//if (g_networkMode != NET_DEDICATED_SERVER)
|
||||||
{
|
{
|
||||||
S_PauseSounds(false);
|
S_PauseSounds(false);
|
||||||
|
|
|
@ -3635,12 +3635,15 @@ void P_HandleSharedKeys(int playerNum)
|
||||||
|
|
||||||
if (TEST_SYNC_KEY(playerBits, SK_QUICK_KICK) && pPlayer->quick_kick == 0)
|
if (TEST_SYNC_KEY(playerBits, SK_QUICK_KICK) && pPlayer->quick_kick == 0)
|
||||||
if (pPlayer->curr_weapon != KNEE_WEAPON || pPlayer->kickback_pic == 0)
|
if (pPlayer->curr_weapon != KNEE_WEAPON || pPlayer->kickback_pic == 0)
|
||||||
|
{
|
||||||
|
if (VM_OnEvent(EVENT_QUICKKICK,g_player[playerNum].ps->i,playerNum) == 0)
|
||||||
{
|
{
|
||||||
pPlayer->quick_kick = 14;
|
pPlayer->quick_kick = 14;
|
||||||
if (pPlayer->fta == 0 || pPlayer->ftq == 80)
|
if (pPlayer->fta == 0 || pPlayer->ftq == 80)
|
||||||
P_DoQuote(QUOTE_MIGHTY_FOOT,pPlayer);
|
P_DoQuote(QUOTE_MIGHTY_FOOT,pPlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!(playerBits & ((15u<<SK_WEAPON_BITS)|BIT(SK_STEROIDS)|BIT(SK_NIGHTVISION)|BIT(SK_MEDKIT)|BIT(SK_QUICK_KICK)| \
|
if (!(playerBits & ((15u<<SK_WEAPON_BITS)|BIT(SK_STEROIDS)|BIT(SK_NIGHTVISION)|BIT(SK_MEDKIT)|BIT(SK_QUICK_KICK)| \
|
||||||
BIT(SK_HOLSTER)|BIT(SK_INV_LEFT)|BIT(SK_PAUSE)|BIT(SK_HOLODUKE)|BIT(SK_JETPACK)|BIT(SK_INV_RIGHT)| \
|
BIT(SK_HOLSTER)|BIT(SK_INV_LEFT)|BIT(SK_PAUSE)|BIT(SK_HOLODUKE)|BIT(SK_JETPACK)|BIT(SK_INV_RIGHT)| \
|
||||||
|
@ -3677,6 +3680,8 @@ void P_HandleSharedKeys(int playerNum)
|
||||||
if (sprite[pPlayer->i].extra <= 0) return; // if dead...
|
if (sprite[pPlayer->i].extra <= 0) return; // if dead...
|
||||||
|
|
||||||
if (TEST_SYNC_KEY(playerBits, SK_INVENTORY) && pPlayer->newowner == -1) // inventory button generates event for selected item
|
if (TEST_SYNC_KEY(playerBits, SK_INVENTORY) && pPlayer->newowner == -1) // inventory button generates event for selected item
|
||||||
|
{
|
||||||
|
if (VM_OnEvent(EVENT_INVENTORY,g_player[playerNum].ps->i,playerNum) == 0)
|
||||||
{
|
{
|
||||||
switch (pPlayer->inven_icon)
|
switch (pPlayer->inven_icon)
|
||||||
{
|
{
|
||||||
|
@ -3687,10 +3692,12 @@ void P_HandleSharedKeys(int playerNum)
|
||||||
case ICON_STEROIDS: playerBits |= BIT(SK_STEROIDS); break;
|
case ICON_STEROIDS: playerBits |= BIT(SK_STEROIDS); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!RR && TEST_SYNC_KEY(playerBits, SK_NIGHTVISION))
|
if (!RR && TEST_SYNC_KEY(playerBits, SK_NIGHTVISION))
|
||||||
{
|
{
|
||||||
if (pPlayer->inv_amount[GET_HEATS] > 0)
|
if (VM_OnEvent(EVENT_USENIGHTVISION,g_player[playerNum].ps->i,playerNum) == 0
|
||||||
|
&& pPlayer->inv_amount[GET_HEATS] > 0)
|
||||||
{
|
{
|
||||||
pPlayer->heat_on = !pPlayer->heat_on;
|
pPlayer->heat_on = !pPlayer->heat_on;
|
||||||
P_UpdateScreenPal(pPlayer);
|
P_UpdateScreenPal(pPlayer);
|
||||||
|
@ -3701,6 +3708,8 @@ void P_HandleSharedKeys(int playerNum)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TEST_SYNC_KEY(playerBits, SK_STEROIDS))
|
if (TEST_SYNC_KEY(playerBits, SK_STEROIDS))
|
||||||
|
{
|
||||||
|
if (VM_OnEvent(EVENT_USESTEROIDS,g_player[playerNum].ps->i,playerNum) == 0)
|
||||||
{
|
{
|
||||||
if (pPlayer->inv_amount[GET_STEROIDS] == 400)
|
if (pPlayer->inv_amount[GET_STEROIDS] == 400)
|
||||||
{
|
{
|
||||||
|
@ -3710,6 +3719,7 @@ void P_HandleSharedKeys(int playerNum)
|
||||||
}
|
}
|
||||||
if (pPlayer->inv_amount[GET_STEROIDS] > 0)
|
if (pPlayer->inv_amount[GET_STEROIDS] > 0)
|
||||||
pPlayer->inven_icon = ICON_STEROIDS;
|
pPlayer->inven_icon = ICON_STEROIDS;
|
||||||
|
}
|
||||||
return; // is there significance to returning?
|
return; // is there significance to returning?
|
||||||
}
|
}
|
||||||
if (pPlayer->refresh_inventory)
|
if (pPlayer->refresh_inventory)
|
||||||
|
@ -3760,6 +3770,17 @@ CHECKINV1:
|
||||||
}
|
}
|
||||||
else inventoryIcon = 0;
|
else inventoryIcon = 0;
|
||||||
|
|
||||||
|
if (TEST_SYNC_KEY(playerBits, SK_INV_LEFT)) // Inventory_Left
|
||||||
|
{
|
||||||
|
/*Gv_SetVar(g_iReturnVarID,dainv,g_player[snum].ps->i,snum);*/
|
||||||
|
inventoryIcon = VM_OnEventWithReturn(EVENT_INVENTORYLEFT,g_player[playerNum].ps->i,playerNum, inventoryIcon);
|
||||||
|
}
|
||||||
|
else if (TEST_SYNC_KEY(playerBits, SK_INV_RIGHT)) // Inventory_Right
|
||||||
|
{
|
||||||
|
/*Gv_SetVar(g_iReturnVarID,dainv,g_player[snum].ps->i,snum);*/
|
||||||
|
inventoryIcon = VM_OnEventWithReturn(EVENT_INVENTORYRIGHT,g_player[playerNum].ps->i,playerNum, inventoryIcon);
|
||||||
|
}
|
||||||
|
|
||||||
if (inventoryIcon >= 1)
|
if (inventoryIcon >= 1)
|
||||||
{
|
{
|
||||||
pPlayer->inven_icon = inventoryIcon;
|
pPlayer->inven_icon = inventoryIcon;
|
||||||
|
@ -4069,6 +4090,8 @@ rrtripbomb_case:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pPlayer->holoduke_on == -1)
|
if (pPlayer->holoduke_on == -1)
|
||||||
|
{
|
||||||
|
if (VM_OnEvent(EVENT_HOLODUKEON, g_player[playerNum].ps->i, playerNum) == 0)
|
||||||
{
|
{
|
||||||
if (pPlayer->inv_amount[GET_HOLODUKE] > 0)
|
if (pPlayer->inv_amount[GET_HOLODUKE] > 0)
|
||||||
{
|
{
|
||||||
|
@ -4088,7 +4111,10 @@ rrtripbomb_case:
|
||||||
}
|
}
|
||||||
else P_DoQuote(QUOTE_HOLODUKE_NOT_FOUND,pPlayer);
|
else P_DoQuote(QUOTE_HOLODUKE_NOT_FOUND,pPlayer);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (VM_OnEvent(EVENT_HOLODUKEOFF,g_player[playerNum].ps->i,playerNum) == 0)
|
||||||
{
|
{
|
||||||
A_PlaySound(TELEPORTER,pPlayer->holoduke_on);
|
A_PlaySound(TELEPORTER,pPlayer->holoduke_on);
|
||||||
pPlayer->holoduke_on = -1;
|
pPlayer->holoduke_on = -1;
|
||||||
|
@ -4096,6 +4122,7 @@ rrtripbomb_case:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (RR && TEST_SYNC_KEY(playerBits, SK_NIGHTVISION) && pPlayer->newowner == -1 && pPlayer->yehaa_timer == 0)
|
if (RR && TEST_SYNC_KEY(playerBits, SK_NIGHTVISION) && pPlayer->newowner == -1 && pPlayer->yehaa_timer == 0)
|
||||||
{
|
{
|
||||||
|
@ -4122,6 +4149,8 @@ rrtripbomb_case:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TEST_SYNC_KEY(playerBits, SK_MEDKIT))
|
if (TEST_SYNC_KEY(playerBits, SK_MEDKIT))
|
||||||
|
{
|
||||||
|
if (VM_OnEvent(EVENT_USEMEDKIT,g_player[playerNum].ps->i,playerNum) == 0)
|
||||||
{
|
{
|
||||||
if (pPlayer->inv_amount[GET_FIRSTAID] > 0 && sprite[pPlayer->i].extra < pPlayer->max_player_health)
|
if (pPlayer->inv_amount[GET_FIRSTAID] > 0 && sprite[pPlayer->i].extra < pPlayer->max_player_health)
|
||||||
{
|
{
|
||||||
|
@ -4154,10 +4183,13 @@ rrtripbomb_case:
|
||||||
A_PlaySound(DUKE_USEMEDKIT,pPlayer->i);
|
A_PlaySound(DUKE_USEMEDKIT,pPlayer->i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((pPlayer->newowner == -1 || RR) && TEST_SYNC_KEY(playerBits, SK_JETPACK))
|
if ((pPlayer->newowner == -1 || RR) && TEST_SYNC_KEY(playerBits, SK_JETPACK))
|
||||||
{
|
{
|
||||||
if (RR)
|
if (RR)
|
||||||
|
{
|
||||||
|
if (VM_OnEvent(EVENT_USEJETPACK,g_player[playerNum].ps->i,playerNum) == 0)
|
||||||
{
|
{
|
||||||
if (pPlayer->inv_amount[GET_JETPACK] > 0 && sprite[pPlayer->i].extra < pPlayer->max_player_health)
|
if (pPlayer->inv_amount[GET_JETPACK] > 0 && sprite[pPlayer->i].extra < pPlayer->max_player_health)
|
||||||
{
|
{
|
||||||
|
@ -4190,6 +4222,7 @@ rrtripbomb_case:
|
||||||
P_SelectNextInvItem(pPlayer);
|
P_SelectNextInvItem(pPlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pPlayer->inv_amount[GET_JETPACK] > 0)
|
if (pPlayer->inv_amount[GET_JETPACK] > 0)
|
||||||
|
@ -4219,6 +4252,7 @@ rrtripbomb_case:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TEST_SYNC_KEY(playerBits, SK_TURNAROUND) && pPlayer->one_eighty_count == 0)
|
if (TEST_SYNC_KEY(playerBits, SK_TURNAROUND) && pPlayer->one_eighty_count == 0)
|
||||||
|
if (VM_OnEvent(EVENT_TURNAROUND,pPlayer->i,playerNum) == 0)
|
||||||
pPlayer->one_eighty_count = -1024;
|
pPlayer->one_eighty_count = -1024;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue