mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40: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)
|
||||
pPlayer->inv_amount[invidx] = defaultnum;
|
||||
}
|
||||
|
||||
static void G_CheatGetInv(DukePlayer_t *pPlayer)
|
||||
{
|
||||
doinvcheat(pPlayer, GET_STEROIDS, 400);
|
||||
if (!RR) doinvcheat(pPlayer, GET_HEATS, 1200);
|
||||
doinvcheat(pPlayer, GET_BOOTS, RR ? 2000 : 200);
|
||||
doinvcheat(pPlayer, GET_SHIELD, 100);
|
||||
doinvcheat(pPlayer, GET_SCUBA, 6400);
|
||||
doinvcheat(pPlayer, GET_HOLODUKE, 2400);
|
||||
doinvcheat(pPlayer, GET_JETPACK, RR ? 600 : 1600);
|
||||
doinvcheat(pPlayer, GET_FIRSTAID, pPlayer->max_player_health);
|
||||
doinvcheat(pPlayer, GET_STEROIDS, 400, EVENT_CHEATGETSTEROIDS);
|
||||
if (!RR) doinvcheat(pPlayer, GET_HEATS, 1200, EVENT_CHEATGETHEAT);
|
||||
doinvcheat(pPlayer, GET_BOOTS, RR ? 2000 : 200, EVENT_CHEATGETBOOT);
|
||||
doinvcheat(pPlayer, GET_SHIELD, 100, EVENT_CHEATGETSHIELD);
|
||||
doinvcheat(pPlayer, GET_SCUBA, 6400, EVENT_CHEATGETSCUBA);
|
||||
doinvcheat(pPlayer, GET_HOLODUKE, 2400, EVENT_CHEATGETHOLODUKE);
|
||||
doinvcheat(pPlayer, GET_JETPACK, RR ? 600 : 1600, EVENT_CHEATGETJETPACK);
|
||||
doinvcheat(pPlayer, GET_FIRSTAID, pPlayer->max_player_health, EVENT_CHEATGETFIRSTAID);
|
||||
}
|
||||
|
||||
static void end_cheat(DukePlayer_t * const pPlayer)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//-------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2016 EDuke32 developers and contributors
|
||||
|
||||
|
@ -6730,6 +6730,8 @@ static void G_CompileScripts(void)
|
|||
Bmemset(sprite, 0, MAXSPRITES*sizeof(spritetype));
|
||||
Bmemset(sector, 0, MAXSECTORS*sizeof(sectortype));
|
||||
Bmemset(wall, 0, MAXWALLS*sizeof(walltype));
|
||||
|
||||
VM_OnEvent(EVENT_INIT);
|
||||
}
|
||||
|
||||
static inline void G_CheckGametype(void)
|
||||
|
|
|
@ -131,6 +131,87 @@ static void VM_DeleteSprite(int const spriteNum, int const playerNum)
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -28,6 +28,35 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "gamedef.h" // vmstate_t
|
||||
|
||||
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;
|
||||
|
|
|
@ -302,7 +302,11 @@ static int GetAutoAimAng(int spriteNum, int playerNum, int projecTile, int zAdju
|
|||
|
||||
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)
|
||||
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;
|
||||
|
||||
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 (!pPlayer->auto_aim)
|
||||
|
@ -689,7 +701,7 @@ growspark_rr:
|
|||
|
||||
if (playerNum >= 0)
|
||||
P_PreFireHitscan(spriteNum, playerNum, projecTile, &startPos, &Zvel, &shootAng,
|
||||
projecTile == SHOTSPARK1, 1);
|
||||
projecTile == SHOTSPARK1 && !WW2GI, 1);
|
||||
else
|
||||
A_PreFireHitscan(pSprite, &startPos, &Zvel, &shootAng, 1);
|
||||
|
||||
|
@ -4125,6 +4137,15 @@ void P_SelectNextInvItem(DukePlayer_t *pPlayer)
|
|||
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)
|
||||
{
|
||||
int playerNum;
|
||||
|
@ -4179,6 +4200,8 @@ void P_CheckWeapon(DukePlayer_t *pPlayer)
|
|||
pPlayer->last_weapon = pPlayer->curr_weapon;
|
||||
pPlayer->random_club_frame = 0;
|
||||
pPlayer->curr_weapon = weaponNum;
|
||||
P_SetWeaponGamevars(playerNum, pPlayer);
|
||||
VM_OnEvent(EVENT_CHANGEWEAPON, pPlayer->i, playerNum);
|
||||
pPlayer->kickback_pic = 0;
|
||||
if (pPlayer->holster_weapon == 1)
|
||||
{
|
||||
|
@ -4509,18 +4532,42 @@ static void P_ProcessWeapon(int playerNum)
|
|||
}
|
||||
}
|
||||
#define WEAPON2_CLIP 20
|
||||
if (NAM && TEST_SYNC_KEY(playerBits, SK_HOLSTER))
|
||||
if (NAM_WW2GI && TEST_SYNC_KEY(playerBits, SK_HOLSTER)) // 'Holster Weapon
|
||||
{
|
||||
if (pPlayer->curr_weapon == PISTOL_WEAPON)
|
||||
if (NAM)
|
||||
{
|
||||
if (pPlayer->ammo_amount[PISTOL_WEAPON] > WEAPON2_CLIP)
|
||||
if (pPlayer->curr_weapon == PISTOL_WEAPON)
|
||||
{
|
||||
// throw away the remaining clip
|
||||
pPlayer->ammo_amount[PISTOL_WEAPON] -= pPlayer->ammo_amount[PISTOL_WEAPON] % WEAPON2_CLIP;
|
||||
(*weaponFrame) = 3;
|
||||
playerBits &= ~BIT(SK_FIRE);
|
||||
if (pPlayer->ammo_amount[PISTOL_WEAPON] > WEAPON2_CLIP)
|
||||
{
|
||||
// throw away the remaining clip
|
||||
pPlayer->ammo_amount[PISTOL_WEAPON] -= pPlayer->ammo_amount[PISTOL_WEAPON] % WEAPON2_CLIP;
|
||||
(*weaponFrame) = 3;
|
||||
playerBits &= ~BIT(SK_FIRE);
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
#undef WEAPON2_CLIP
|
||||
|
@ -4577,156 +4624,160 @@ static void P_ProcessWeapon(int playerNum)
|
|||
}
|
||||
else
|
||||
{
|
||||
switch (DYNAMICWEAPONMAP(pPlayer->curr_weapon))
|
||||
P_SetWeaponGamevars(playerNum, pPlayer);
|
||||
if (VM_OnEvent(EVENT_FIRE, pPlayer->i, playerNum) == 0)
|
||||
{
|
||||
case HANDBOMB_WEAPON__STATIC:
|
||||
pPlayer->hbomb_hold_delay = 0;
|
||||
if (pPlayer->ammo_amount[pPlayer->curr_weapon] > 0)
|
||||
{
|
||||
(*weaponFrame) = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case HANDREMOTE_WEAPON__STATIC:
|
||||
pPlayer->hbomb_hold_delay = 0;
|
||||
(*weaponFrame) = 1;
|
||||
break;
|
||||
|
||||
case PISTOL_WEAPON__STATIC:
|
||||
if (pPlayer->ammo_amount[PISTOL_WEAPON] > 0)
|
||||
{
|
||||
pPlayer->ammo_amount[PISTOL_WEAPON]--;
|
||||
(*weaponFrame) = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case SHOTGUN_WEAPON__STATIC:
|
||||
if (pPlayer->ammo_amount[SHOTGUN_WEAPON] > 0 && pPlayer->random_club_frame == 0)
|
||||
{
|
||||
(*weaponFrame) = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case TRIPBOMB_WEAPON__STATIC:
|
||||
case BOWLINGBALL_WEAPON__STATIC:
|
||||
if (RR)
|
||||
{
|
||||
switch (DYNAMICWEAPONMAP(pPlayer->curr_weapon))
|
||||
{
|
||||
case HANDBOMB_WEAPON__STATIC:
|
||||
pPlayer->hbomb_hold_delay = 0;
|
||||
if (pPlayer->ammo_amount[pPlayer->curr_weapon] > 0)
|
||||
{
|
||||
//pPlayer->ammo_amount[pPlayer->curr_weapon]--;
|
||||
(*weaponFrame) = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (pPlayer->curr_weapon == BOWLINGBALL)
|
||||
break;
|
||||
if (pPlayer->ammo_amount[pPlayer->curr_weapon] > 0)
|
||||
{
|
||||
hitdata_t hitData;
|
||||
|
||||
hitscan((const vec3_t *)pPlayer, pPlayer->cursectnum, sintable[(fix16_to_int(pPlayer->q16ang) + 512) & 2047],
|
||||
sintable[fix16_to_int(pPlayer->q16ang) & 2047], fix16_to_int(F16(100) - pPlayer->q16horiz - pPlayer->q16horizoff) * 32, &hitData,
|
||||
CLIPMASK1);
|
||||
|
||||
if ((hitData.sect < 0 || hitData.sprite >= 0) ||
|
||||
(hitData.wall >= 0 && sector[hitData.sect].lotag > 2))
|
||||
break;
|
||||
|
||||
if (hitData.wall >= 0 && wall[hitData.wall].overpicnum >= 0)
|
||||
if (wall[hitData.wall].overpicnum == BIGFORCE)
|
||||
break;
|
||||
|
||||
int spriteNum = headspritesect[hitData.sect];
|
||||
while (spriteNum >= 0)
|
||||
{
|
||||
if (sprite[spriteNum].picnum == TRIPBOMB && klabs(sprite[spriteNum].z - hitData.pos.z) < ZOFFSET4 &&
|
||||
((sprite[spriteNum].x - hitData.pos.x) * (sprite[spriteNum].x - hitData.pos.x) +
|
||||
(sprite[spriteNum].y - hitData.pos.y) * (sprite[spriteNum].y - hitData.pos.y)) < (290 * 290))
|
||||
break;
|
||||
spriteNum = nextspritesect[spriteNum];
|
||||
}
|
||||
|
||||
// ST_2_UNDERWATER
|
||||
if (spriteNum == -1 && hitData.wall >= 0 && (wall[hitData.wall].cstat & 16) == 0)
|
||||
if ((wall[hitData.wall].nextsector >= 0 && sector[wall[hitData.wall].nextsector].lotag <= 2) ||
|
||||
(wall[hitData.wall].nextsector == -1 && sector[hitData.sect].lotag <= 2))
|
||||
if (((hitData.pos.x - pPlayer->pos.x) * (hitData.pos.x - pPlayer->pos.x) +
|
||||
(hitData.pos.y - pPlayer->pos.y) * (hitData.pos.y - pPlayer->pos.y)) < (290 * 290))
|
||||
{
|
||||
pPlayer->pos.z = pPlayer->opos.z;
|
||||
pPlayer->vel.z = 0;
|
||||
(*weaponFrame) = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SHRINKER_WEAPON__STATIC:
|
||||
if (pPlayer->ammo_amount[SHRINKER_WEAPON] > 0)
|
||||
{
|
||||
(*weaponFrame) = 1;
|
||||
A_PlaySound(SHRINKER_FIRE, pPlayer->i);
|
||||
}
|
||||
break;
|
||||
|
||||
case GROW_WEAPON__STATIC:
|
||||
if (pPlayer->ammo_amount[GROW_WEAPON] > 0)
|
||||
{
|
||||
(*weaponFrame) = 1;
|
||||
A_PlaySound(RR ? 431 : EXPANDERSHOOT, pPlayer->i);
|
||||
}
|
||||
break;
|
||||
|
||||
case FREEZE_WEAPON__STATIC:
|
||||
if (pPlayer->ammo_amount[FREEZE_WEAPON] > 0)
|
||||
{
|
||||
(*weaponFrame) = 1;
|
||||
if (!RR)
|
||||
A_PlaySound(CAT_FIRE, pPlayer->i);
|
||||
}
|
||||
break;
|
||||
|
||||
case RPG_WEAPON__STATIC:
|
||||
case CHAINGUN_WEAPON__STATIC:
|
||||
if (pPlayer->ammo_amount[pPlayer->curr_weapon] > 0)
|
||||
{
|
||||
(*weaponFrame) = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case DEVISTATOR_WEAPON__STATIC:
|
||||
if (pPlayer->ammo_amount[pPlayer->curr_weapon] > 0)
|
||||
{
|
||||
case HANDREMOTE_WEAPON__STATIC:
|
||||
pPlayer->hbomb_hold_delay = 0;
|
||||
(*weaponFrame) = 1;
|
||||
pPlayer->hbomb_hold_delay = !pPlayer->hbomb_hold_delay;
|
||||
if (!RR)
|
||||
A_PlaySound(CAT_FIRE, pPlayer->i);
|
||||
}
|
||||
break;
|
||||
|
||||
case KNEE_WEAPON__STATIC:
|
||||
case SLINGBLADE_WEAPON__STATIC:
|
||||
if (RRRA)
|
||||
{
|
||||
if (pPlayer->ammo_amount[pPlayer->curr_weapon] > 0 && !pPlayer->quick_kick)
|
||||
(*weaponFrame) = 1;
|
||||
break;
|
||||
}
|
||||
if (RRRA && pPlayer->curr_weapon == SLINGBLADE) break;
|
||||
if (pPlayer->quick_kick == 0)
|
||||
{
|
||||
(*weaponFrame) = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case CHICKEN_WEAPON__STATIC:
|
||||
case MOTORCYCLE_WEAPON__STATIC:
|
||||
case BOAT_WEAPON__STATIC:
|
||||
if (!RRRA) break;
|
||||
if (pPlayer->ammo_amount[pPlayer->curr_weapon] > 0)
|
||||
{
|
||||
(*weaponFrame) = 1;
|
||||
}
|
||||
break;
|
||||
case PISTOL_WEAPON__STATIC:
|
||||
if (pPlayer->ammo_amount[PISTOL_WEAPON] > 0)
|
||||
{
|
||||
pPlayer->ammo_amount[PISTOL_WEAPON]--;
|
||||
(*weaponFrame) = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case SHOTGUN_WEAPON__STATIC:
|
||||
if (pPlayer->ammo_amount[SHOTGUN_WEAPON] > 0 && pPlayer->random_club_frame == 0)
|
||||
{
|
||||
(*weaponFrame) = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case TRIPBOMB_WEAPON__STATIC:
|
||||
case BOWLINGBALL_WEAPON__STATIC:
|
||||
if (RR)
|
||||
{
|
||||
if (pPlayer->ammo_amount[pPlayer->curr_weapon] > 0)
|
||||
{
|
||||
//pPlayer->ammo_amount[pPlayer->curr_weapon]--;
|
||||
(*weaponFrame) = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (pPlayer->curr_weapon == BOWLINGBALL)
|
||||
break;
|
||||
if (pPlayer->ammo_amount[pPlayer->curr_weapon] > 0)
|
||||
{
|
||||
hitdata_t hitData;
|
||||
|
||||
hitscan((const vec3_t *)pPlayer, pPlayer->cursectnum, sintable[(fix16_to_int(pPlayer->q16ang) + 512) & 2047],
|
||||
sintable[fix16_to_int(pPlayer->q16ang) & 2047], fix16_to_int(F16(100) - pPlayer->q16horiz - pPlayer->q16horizoff) * 32, &hitData,
|
||||
CLIPMASK1);
|
||||
|
||||
if ((hitData.sect < 0 || hitData.sprite >= 0) ||
|
||||
(hitData.wall >= 0 && sector[hitData.sect].lotag > 2))
|
||||
break;
|
||||
|
||||
if (hitData.wall >= 0 && wall[hitData.wall].overpicnum >= 0)
|
||||
if (wall[hitData.wall].overpicnum == BIGFORCE)
|
||||
break;
|
||||
|
||||
int spriteNum = headspritesect[hitData.sect];
|
||||
while (spriteNum >= 0)
|
||||
{
|
||||
if (sprite[spriteNum].picnum == TRIPBOMB && klabs(sprite[spriteNum].z - hitData.pos.z) < ZOFFSET4 &&
|
||||
((sprite[spriteNum].x - hitData.pos.x) * (sprite[spriteNum].x - hitData.pos.x) +
|
||||
(sprite[spriteNum].y - hitData.pos.y) * (sprite[spriteNum].y - hitData.pos.y)) < (290 * 290))
|
||||
break;
|
||||
spriteNum = nextspritesect[spriteNum];
|
||||
}
|
||||
|
||||
// ST_2_UNDERWATER
|
||||
if (spriteNum == -1 && hitData.wall >= 0 && (wall[hitData.wall].cstat & 16) == 0)
|
||||
if ((wall[hitData.wall].nextsector >= 0 && sector[wall[hitData.wall].nextsector].lotag <= 2) ||
|
||||
(wall[hitData.wall].nextsector == -1 && sector[hitData.sect].lotag <= 2))
|
||||
if (((hitData.pos.x - pPlayer->pos.x) * (hitData.pos.x - pPlayer->pos.x) +
|
||||
(hitData.pos.y - pPlayer->pos.y) * (hitData.pos.y - pPlayer->pos.y)) < (290 * 290))
|
||||
{
|
||||
pPlayer->pos.z = pPlayer->opos.z;
|
||||
pPlayer->vel.z = 0;
|
||||
(*weaponFrame) = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SHRINKER_WEAPON__STATIC:
|
||||
if (pPlayer->ammo_amount[SHRINKER_WEAPON] > 0)
|
||||
{
|
||||
(*weaponFrame) = 1;
|
||||
A_PlaySound(SHRINKER_FIRE, pPlayer->i);
|
||||
}
|
||||
break;
|
||||
|
||||
case GROW_WEAPON__STATIC:
|
||||
if (pPlayer->ammo_amount[GROW_WEAPON] > 0)
|
||||
{
|
||||
(*weaponFrame) = 1;
|
||||
A_PlaySound(RR ? 431 : EXPANDERSHOOT, pPlayer->i);
|
||||
}
|
||||
break;
|
||||
|
||||
case FREEZE_WEAPON__STATIC:
|
||||
if (pPlayer->ammo_amount[FREEZE_WEAPON] > 0)
|
||||
{
|
||||
(*weaponFrame) = 1;
|
||||
if (!RR)
|
||||
A_PlaySound(CAT_FIRE, pPlayer->i);
|
||||
}
|
||||
break;
|
||||
|
||||
case RPG_WEAPON__STATIC:
|
||||
case CHAINGUN_WEAPON__STATIC:
|
||||
if (pPlayer->ammo_amount[pPlayer->curr_weapon] > 0)
|
||||
{
|
||||
(*weaponFrame) = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case DEVISTATOR_WEAPON__STATIC:
|
||||
if (pPlayer->ammo_amount[pPlayer->curr_weapon] > 0)
|
||||
{
|
||||
(*weaponFrame) = 1;
|
||||
pPlayer->hbomb_hold_delay = !pPlayer->hbomb_hold_delay;
|
||||
if (!RR)
|
||||
A_PlaySound(CAT_FIRE, pPlayer->i);
|
||||
}
|
||||
break;
|
||||
|
||||
case KNEE_WEAPON__STATIC:
|
||||
case SLINGBLADE_WEAPON__STATIC:
|
||||
if (RRRA)
|
||||
{
|
||||
if (pPlayer->ammo_amount[pPlayer->curr_weapon] > 0 && !pPlayer->quick_kick)
|
||||
(*weaponFrame) = 1;
|
||||
break;
|
||||
}
|
||||
if (RRRA && pPlayer->curr_weapon == SLINGBLADE) break;
|
||||
if (pPlayer->quick_kick == 0)
|
||||
{
|
||||
(*weaponFrame) = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case CHICKEN_WEAPON__STATIC:
|
||||
case MOTORCYCLE_WEAPON__STATIC:
|
||||
case BOAT_WEAPON__STATIC:
|
||||
if (!RRRA) break;
|
||||
if (pPlayer->ammo_amount[pPlayer->curr_weapon] > 0)
|
||||
{
|
||||
(*weaponFrame) = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5957,14 +6008,20 @@ static void P_DoJetpack(int const playerNum, int const playerBits, int const pla
|
|||
|
||||
if (TEST_SYNC_KEY(playerBits, SK_JUMP)) // jumping, flying up
|
||||
{
|
||||
pPlayer->pos.z -= zAdjust;
|
||||
pPlayer->crack_time = 777;
|
||||
if (VM_OnEvent(EVENT_SOARUP, pPlayer->i, playerNum) == 0)
|
||||
{
|
||||
pPlayer->pos.z -= zAdjust;
|
||||
pPlayer->crack_time = 777;
|
||||
}
|
||||
}
|
||||
|
||||
if (TEST_SYNC_KEY(playerBits, SK_CROUCH)) // crouching, flying down
|
||||
{
|
||||
pPlayer->pos.z += zAdjust;
|
||||
pPlayer->crack_time = 777;
|
||||
if (VM_OnEvent(EVENT_SOARDOWN, pPlayer->i, playerNum) == 0)
|
||||
{
|
||||
pPlayer->pos.z += zAdjust;
|
||||
pPlayer->crack_time = 777;
|
||||
}
|
||||
}
|
||||
|
||||
int const Zdiff = (playerShrunk == 0 && (sectorLotag == 0 || sectorLotag == ST_2_UNDERWATER)) ? 32 : 16;
|
||||
|
@ -6894,15 +6951,21 @@ check_enemy_sprite:
|
|||
if (TEST_SYNC_KEY(playerBits, SK_LOOK_LEFT) && (!RRRA || !pPlayer->on_motorcycle))
|
||||
{
|
||||
// look_left
|
||||
pPlayer->look_ang -= 152;
|
||||
pPlayer->rotscrnang += 24;
|
||||
if (VM_OnEvent(EVENT_LOOKLEFT,pPlayer->i,playerNum) == 0)
|
||||
{
|
||||
pPlayer->look_ang -= 152;
|
||||
pPlayer->rotscrnang += 24;
|
||||
}
|
||||
}
|
||||
|
||||
if (TEST_SYNC_KEY(playerBits, SK_LOOK_RIGHT) && (!RRRA || !pPlayer->on_motorcycle))
|
||||
{
|
||||
// look_right
|
||||
pPlayer->look_ang += 152;
|
||||
pPlayer->rotscrnang -= 24;
|
||||
if (VM_OnEvent(EVENT_LOOKRIGHT,pPlayer->i,playerNum) == 0)
|
||||
{
|
||||
pPlayer->look_ang += 152;
|
||||
pPlayer->rotscrnang -= 24;
|
||||
}
|
||||
}
|
||||
|
||||
if (RRRA && pPlayer->sea_sick)
|
||||
|
@ -7209,8 +7272,11 @@ check_enemy_sprite:
|
|||
if (TEST_SYNC_KEY(playerBits, SK_CROUCH) && (!RRRA || !pPlayer->on_motorcycle))
|
||||
{
|
||||
// crouching
|
||||
pPlayer->pos.z += (2048+768);
|
||||
pPlayer->crack_time = 777;
|
||||
if (VM_OnEvent(EVENT_CROUCH,pPlayer->i,playerNum) == 0)
|
||||
{
|
||||
pPlayer->pos.z += (2048+768);
|
||||
pPlayer->crack_time = 777;
|
||||
}
|
||||
}
|
||||
|
||||
// jumping
|
||||
|
@ -7221,8 +7287,11 @@ check_enemy_sprite:
|
|||
if (pPlayer->jumping_counter == 0)
|
||||
if ((floorZ-ceilZ) > (56<<8))
|
||||
{
|
||||
pPlayer->jumping_counter = 1;
|
||||
pPlayer->jumping_toggle = 1;
|
||||
if (VM_OnEvent(EVENT_JUMP,pPlayer->i,playerNum) == 0)
|
||||
{
|
||||
pPlayer->jumping_counter = 1;
|
||||
pPlayer->jumping_toggle = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7822,29 +7891,42 @@ HORIZONLY:;
|
|||
int centerHoriz = 0;
|
||||
|
||||
if (TEST_SYNC_KEY(playerBits, SK_CENTER_VIEW) || pPlayer->hard_landing)
|
||||
pPlayer->return_to_center = 9;
|
||||
if (VM_OnEvent(EVENT_RETURNTOCENTER, pPlayer->i,playerNum) == 0)
|
||||
pPlayer->return_to_center = 9;
|
||||
|
||||
if (TEST_SYNC_KEY(playerBits, SK_LOOK_UP))
|
||||
{
|
||||
pPlayer->return_to_center = 9;
|
||||
pPlayer->q16horiz += fix16_from_int(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
|
||||
centerHoriz++;
|
||||
if (VM_OnEvent(EVENT_LOOKUP, pPlayer->i, playerNum) == 0)
|
||||
{
|
||||
pPlayer->return_to_center = 9;
|
||||
pPlayer->q16horiz += fix16_from_int(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
|
||||
centerHoriz++;
|
||||
}
|
||||
}
|
||||
else if (TEST_SYNC_KEY(playerBits, SK_LOOK_DOWN))
|
||||
{
|
||||
pPlayer->return_to_center = 9;
|
||||
pPlayer->q16horiz -= fix16_from_int(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
|
||||
centerHoriz++;
|
||||
if (VM_OnEvent(EVENT_LOOKDOWN,pPlayer->i,playerNum) == 0)
|
||||
{
|
||||
pPlayer->return_to_center = 9;
|
||||
pPlayer->q16horiz -= fix16_from_int(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
|
||||
centerHoriz++;
|
||||
}
|
||||
}
|
||||
else if (TEST_SYNC_KEY(playerBits, SK_AIM_UP) && (!RRRA || !pPlayer->on_motorcycle))
|
||||
{
|
||||
pPlayer->q16horiz += fix16_from_int(6<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
|
||||
centerHoriz++;
|
||||
if (VM_OnEvent(EVENT_AIMUP,pPlayer->i,playerNum) == 0)
|
||||
{
|
||||
pPlayer->q16horiz += fix16_from_int(6<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
|
||||
centerHoriz++;
|
||||
}
|
||||
}
|
||||
else if (TEST_SYNC_KEY(playerBits, SK_AIM_DOWN) && (!RRRA || !pPlayer->on_motorcycle))
|
||||
{
|
||||
pPlayer->q16horiz -= fix16_from_int(6<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
|
||||
centerHoriz++;
|
||||
if (VM_OnEvent(EVENT_AIMDOWN,pPlayer->i,playerNum) == 0)
|
||||
{
|
||||
pPlayer->q16horiz -= fix16_from_int(6<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
|
||||
centerHoriz++;
|
||||
}
|
||||
}
|
||||
if (RR && pPlayer->recoil && *weaponFrame == 0)
|
||||
{
|
||||
|
|
|
@ -493,7 +493,9 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent)
|
|||
|
||||
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;
|
||||
|
||||
|
@ -641,6 +643,7 @@ void G_CacheMapData(void)
|
|||
|
||||
while (percentage > lpc)
|
||||
{
|
||||
G_HandleAsync();
|
||||
Bsprintf(tempbuf, "Loaded %d%% (%d/%d textures)\n", lpc, pc, g_precacheCount);
|
||||
G_DoLoadScreen(tempbuf, lpc);
|
||||
|
||||
|
@ -1048,6 +1051,8 @@ void P_ResetWeapons(int playerNum)
|
|||
pPlayer->last_pissed_time = 0;
|
||||
pPlayer->holster_weapon = 0;
|
||||
pPlayer->last_used_weapon = -1;
|
||||
|
||||
VM_OnEvent(EVENT_RESETWEAPONS, pPlayer->i, playerNum);
|
||||
}
|
||||
|
||||
void P_ResetInventory(int playerNum)
|
||||
|
@ -1104,6 +1109,8 @@ void P_ResetInventory(int playerNum)
|
|||
g_hulkSpawn = 2;
|
||||
}
|
||||
}
|
||||
|
||||
VM_OnEvent(EVENT_RESETINVENTORY, pPlayer->i, playerNum);
|
||||
}
|
||||
|
||||
static void resetprestat(int playerNum, int gameMode)
|
||||
|
@ -2259,6 +2266,8 @@ int G_EnterLevel(int gameMode)
|
|||
if ((gameMode & MODE_DEMO) == 0 && ud.recstat == 2)
|
||||
ud.recstat = 0;
|
||||
|
||||
VM_OnEvent(EVENT_ENTERLEVEL);
|
||||
|
||||
//if (g_networkMode != NET_DEDICATED_SERVER)
|
||||
{
|
||||
S_PauseSounds(false);
|
||||
|
|
|
@ -3636,9 +3636,12 @@ void P_HandleSharedKeys(int playerNum)
|
|||
if (TEST_SYNC_KEY(playerBits, SK_QUICK_KICK) && pPlayer->quick_kick == 0)
|
||||
if (pPlayer->curr_weapon != KNEE_WEAPON || pPlayer->kickback_pic == 0)
|
||||
{
|
||||
pPlayer->quick_kick = 14;
|
||||
if (pPlayer->fta == 0 || pPlayer->ftq == 80)
|
||||
P_DoQuote(QUOTE_MIGHTY_FOOT,pPlayer);
|
||||
if (VM_OnEvent(EVENT_QUICKKICK,g_player[playerNum].ps->i,playerNum) == 0)
|
||||
{
|
||||
pPlayer->quick_kick = 14;
|
||||
if (pPlayer->fta == 0 || pPlayer->ftq == 80)
|
||||
P_DoQuote(QUOTE_MIGHTY_FOOT,pPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3678,19 +3681,23 @@ void P_HandleSharedKeys(int playerNum)
|
|||
|
||||
if (TEST_SYNC_KEY(playerBits, SK_INVENTORY) && pPlayer->newowner == -1) // inventory button generates event for selected item
|
||||
{
|
||||
switch (pPlayer->inven_icon)
|
||||
if (VM_OnEvent(EVENT_INVENTORY,g_player[playerNum].ps->i,playerNum) == 0)
|
||||
{
|
||||
case ICON_JETPACK: playerBits |= BIT(SK_JETPACK); break;
|
||||
case ICON_HOLODUKE: playerBits |= BIT(SK_HOLODUKE); break;
|
||||
case ICON_HEATS: playerBits |= BIT(SK_NIGHTVISION); break;
|
||||
case ICON_FIRSTAID: playerBits |= BIT(SK_MEDKIT); break;
|
||||
case ICON_STEROIDS: playerBits |= BIT(SK_STEROIDS); break;
|
||||
switch (pPlayer->inven_icon)
|
||||
{
|
||||
case ICON_JETPACK: playerBits |= BIT(SK_JETPACK); break;
|
||||
case ICON_HOLODUKE: playerBits |= BIT(SK_HOLODUKE); break;
|
||||
case ICON_HEATS: playerBits |= BIT(SK_NIGHTVISION); break;
|
||||
case ICON_FIRSTAID: playerBits |= BIT(SK_MEDKIT); break;
|
||||
case ICON_STEROIDS: playerBits |= BIT(SK_STEROIDS); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
P_UpdateScreenPal(pPlayer);
|
||||
|
@ -3702,14 +3709,17 @@ void P_HandleSharedKeys(int playerNum)
|
|||
|
||||
if (TEST_SYNC_KEY(playerBits, SK_STEROIDS))
|
||||
{
|
||||
if (pPlayer->inv_amount[GET_STEROIDS] == 400)
|
||||
if (VM_OnEvent(EVENT_USESTEROIDS,g_player[playerNum].ps->i,playerNum) == 0)
|
||||
{
|
||||
pPlayer->inv_amount[GET_STEROIDS]--;
|
||||
A_PlaySound(DUKE_TAKEPILLS,pPlayer->i);
|
||||
P_DoQuote(QUOTE_USED_STEROIDS,pPlayer);
|
||||
if (pPlayer->inv_amount[GET_STEROIDS] == 400)
|
||||
{
|
||||
pPlayer->inv_amount[GET_STEROIDS]--;
|
||||
A_PlaySound(DUKE_TAKEPILLS,pPlayer->i);
|
||||
P_DoQuote(QUOTE_USED_STEROIDS,pPlayer);
|
||||
}
|
||||
if (pPlayer->inv_amount[GET_STEROIDS] > 0)
|
||||
pPlayer->inven_icon = ICON_STEROIDS;
|
||||
}
|
||||
if (pPlayer->inv_amount[GET_STEROIDS] > 0)
|
||||
pPlayer->inven_icon = ICON_STEROIDS;
|
||||
return; // is there significance to returning?
|
||||
}
|
||||
if (pPlayer->refresh_inventory)
|
||||
|
@ -3760,6 +3770,17 @@ CHECKINV1:
|
|||
}
|
||||
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)
|
||||
{
|
||||
pPlayer->inven_icon = inventoryIcon;
|
||||
|
@ -4070,29 +4091,35 @@ rrtripbomb_case:
|
|||
{
|
||||
if (pPlayer->holoduke_on == -1)
|
||||
{
|
||||
if (pPlayer->inv_amount[GET_HOLODUKE] > 0)
|
||||
if (VM_OnEvent(EVENT_HOLODUKEON, g_player[playerNum].ps->i, playerNum) == 0)
|
||||
{
|
||||
pPlayer->inven_icon = ICON_HOLODUKE;
|
||||
|
||||
if (pPlayer->cursectnum > -1)
|
||||
if (pPlayer->inv_amount[GET_HOLODUKE] > 0)
|
||||
{
|
||||
int const i = A_InsertSprite(pPlayer->cursectnum, pPlayer->pos.x, pPlayer->pos.y,
|
||||
pPlayer->pos.z+(30<<8), APLAYER, -64, 0, 0, fix16_to_int(pPlayer->q16ang), 0, 0, -1, 10);
|
||||
pPlayer->holoduke_on = i;
|
||||
T4(i) = T5(i) = 0;
|
||||
sprite[i].yvel = playerNum;
|
||||
sprite[i].extra = 0;
|
||||
P_DoQuote(QUOTE_HOLODUKE_ON,pPlayer);
|
||||
A_PlaySound(TELEPORTER,pPlayer->holoduke_on);
|
||||
pPlayer->inven_icon = ICON_HOLODUKE;
|
||||
|
||||
if (pPlayer->cursectnum > -1)
|
||||
{
|
||||
int const i = A_InsertSprite(pPlayer->cursectnum, pPlayer->pos.x, pPlayer->pos.y,
|
||||
pPlayer->pos.z+(30<<8), APLAYER, -64, 0, 0, fix16_to_int(pPlayer->q16ang), 0, 0, -1, 10);
|
||||
pPlayer->holoduke_on = i;
|
||||
T4(i) = T5(i) = 0;
|
||||
sprite[i].yvel = playerNum;
|
||||
sprite[i].extra = 0;
|
||||
P_DoQuote(QUOTE_HOLODUKE_ON,pPlayer);
|
||||
A_PlaySound(TELEPORTER,pPlayer->holoduke_on);
|
||||
}
|
||||
}
|
||||
else P_DoQuote(QUOTE_HOLODUKE_NOT_FOUND,pPlayer);
|
||||
}
|
||||
else P_DoQuote(QUOTE_HOLODUKE_NOT_FOUND,pPlayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
A_PlaySound(TELEPORTER,pPlayer->holoduke_on);
|
||||
pPlayer->holoduke_on = -1;
|
||||
P_DoQuote(QUOTE_HOLODUKE_OFF,pPlayer);
|
||||
if (VM_OnEvent(EVENT_HOLODUKEOFF,g_player[playerNum].ps->i,playerNum) == 0)
|
||||
{
|
||||
A_PlaySound(TELEPORTER,pPlayer->holoduke_on);
|
||||
pPlayer->holoduke_on = -1;
|
||||
P_DoQuote(QUOTE_HOLODUKE_OFF,pPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4123,35 +4150,38 @@ rrtripbomb_case:
|
|||
|
||||
if (TEST_SYNC_KEY(playerBits, SK_MEDKIT))
|
||||
{
|
||||
if (pPlayer->inv_amount[GET_FIRSTAID] > 0 && sprite[pPlayer->i].extra < pPlayer->max_player_health)
|
||||
if (VM_OnEvent(EVENT_USEMEDKIT,g_player[playerNum].ps->i,playerNum) == 0)
|
||||
{
|
||||
int healthDiff = pPlayer->max_player_health-sprite[pPlayer->i].extra;
|
||||
|
||||
if (RR) healthDiff = 10;
|
||||
|
||||
if (pPlayer->inv_amount[GET_FIRSTAID] > healthDiff)
|
||||
if (pPlayer->inv_amount[GET_FIRSTAID] > 0 && sprite[pPlayer->i].extra < pPlayer->max_player_health)
|
||||
{
|
||||
pPlayer->inv_amount[GET_FIRSTAID] -= healthDiff;
|
||||
int healthDiff = pPlayer->max_player_health-sprite[pPlayer->i].extra;
|
||||
|
||||
if (RR) healthDiff = 10;
|
||||
|
||||
if (pPlayer->inv_amount[GET_FIRSTAID] > healthDiff)
|
||||
{
|
||||
pPlayer->inv_amount[GET_FIRSTAID] -= healthDiff;
|
||||
if (RR)
|
||||
sprite[pPlayer->i].extra += healthDiff;
|
||||
if (!RR || sprite[pPlayer->i].extra > pPlayer->max_player_health)
|
||||
sprite[pPlayer->i].extra = pPlayer->max_player_health;
|
||||
pPlayer->inven_icon = ICON_FIRSTAID;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite[pPlayer->i].extra += pPlayer->inv_amount[GET_FIRSTAID];
|
||||
pPlayer->inv_amount[GET_FIRSTAID] = 0;
|
||||
P_SelectNextInvItem(pPlayer);
|
||||
}
|
||||
if (RR)
|
||||
sprite[pPlayer->i].extra += healthDiff;
|
||||
if (!RR || sprite[pPlayer->i].extra > pPlayer->max_player_health)
|
||||
sprite[pPlayer->i].extra = pPlayer->max_player_health;
|
||||
pPlayer->inven_icon = ICON_FIRSTAID;
|
||||
{
|
||||
if (sprite[pPlayer->i].extra > pPlayer->max_player_health)
|
||||
sprite[pPlayer->i].extra = pPlayer->max_player_health;
|
||||
pPlayer->drink_amt += 10;
|
||||
}
|
||||
if (!RR || (pPlayer->drink_amt <= 100 && !A_CheckSoundPlaying(pPlayer->i, DUKE_USEMEDKIT)))
|
||||
A_PlaySound(DUKE_USEMEDKIT,pPlayer->i);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite[pPlayer->i].extra += pPlayer->inv_amount[GET_FIRSTAID];
|
||||
pPlayer->inv_amount[GET_FIRSTAID] = 0;
|
||||
P_SelectNextInvItem(pPlayer);
|
||||
}
|
||||
if (RR)
|
||||
{
|
||||
if (sprite[pPlayer->i].extra > pPlayer->max_player_health)
|
||||
sprite[pPlayer->i].extra = pPlayer->max_player_health;
|
||||
pPlayer->drink_amt += 10;
|
||||
}
|
||||
if (!RR || (pPlayer->drink_amt <= 100 && !A_CheckSoundPlaying(pPlayer->i, DUKE_USEMEDKIT)))
|
||||
A_PlaySound(DUKE_USEMEDKIT,pPlayer->i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4159,35 +4189,38 @@ rrtripbomb_case:
|
|||
{
|
||||
if (RR)
|
||||
{
|
||||
if (pPlayer->inv_amount[GET_JETPACK] > 0 && sprite[pPlayer->i].extra < pPlayer->max_player_health)
|
||||
if (VM_OnEvent(EVENT_USEJETPACK,g_player[playerNum].ps->i,playerNum) == 0)
|
||||
{
|
||||
if (!A_CheckSoundPlaying(pPlayer->i, 429))
|
||||
A_PlaySound(429, pPlayer->i);
|
||||
|
||||
pPlayer->inv_amount[GET_JETPACK] -= 100;
|
||||
if (pPlayer->drink_amt > 0)
|
||||
if (pPlayer->inv_amount[GET_JETPACK] > 0 && sprite[pPlayer->i].extra < pPlayer->max_player_health)
|
||||
{
|
||||
pPlayer->drink_amt -= 5;
|
||||
if (pPlayer->drink_amt < 0)
|
||||
pPlayer->drink_amt = 0;
|
||||
if (!A_CheckSoundPlaying(pPlayer->i, 429))
|
||||
A_PlaySound(429, pPlayer->i);
|
||||
|
||||
pPlayer->inv_amount[GET_JETPACK] -= 100;
|
||||
if (pPlayer->drink_amt > 0)
|
||||
{
|
||||
pPlayer->drink_amt -= 5;
|
||||
if (pPlayer->drink_amt < 0)
|
||||
pPlayer->drink_amt = 0;
|
||||
}
|
||||
|
||||
if (pPlayer->eat_amt < 100)
|
||||
{
|
||||
pPlayer->eat_amt += 5;
|
||||
if (pPlayer->eat_amt > 100)
|
||||
pPlayer->eat_amt = 100;
|
||||
}
|
||||
|
||||
sprite[pPlayer->i].extra += 5;
|
||||
|
||||
pPlayer->inven_icon = 4;
|
||||
|
||||
if (sprite[pPlayer->i].extra > pPlayer->max_player_health)
|
||||
sprite[pPlayer->i].extra = pPlayer->max_player_health;
|
||||
|
||||
if (pPlayer->inv_amount[GET_JETPACK] <= 0)
|
||||
P_SelectNextInvItem(pPlayer);
|
||||
}
|
||||
|
||||
if (pPlayer->eat_amt < 100)
|
||||
{
|
||||
pPlayer->eat_amt += 5;
|
||||
if (pPlayer->eat_amt > 100)
|
||||
pPlayer->eat_amt = 100;
|
||||
}
|
||||
|
||||
sprite[pPlayer->i].extra += 5;
|
||||
|
||||
pPlayer->inven_icon = 4;
|
||||
|
||||
if (sprite[pPlayer->i].extra > pPlayer->max_player_health)
|
||||
sprite[pPlayer->i].extra = pPlayer->max_player_health;
|
||||
|
||||
if (pPlayer->inv_amount[GET_JETPACK] <= 0)
|
||||
P_SelectNextInvItem(pPlayer);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -4219,7 +4252,8 @@ rrtripbomb_case:
|
|||
}
|
||||
|
||||
if (TEST_SYNC_KEY(playerBits, SK_TURNAROUND) && pPlayer->one_eighty_count == 0)
|
||||
pPlayer->one_eighty_count = -1024;
|
||||
if (VM_OnEvent(EVENT_TURNAROUND,pPlayer->i,playerNum) == 0)
|
||||
pPlayer->one_eighty_count = -1024;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue