0
0
Fork 0
mirror of https://github.com/ZDoom/Raze.git synced 2025-03-23 17:31:14 +00:00

- make sure that the aplWeapon* stuff is never accessed outside of WW2GI.

This commit is contained in:
Christoph Oelckers 2022-12-31 09:09:29 +01:00
parent f0a6c4ecd8
commit 07c4b61260
3 changed files with 14 additions and 16 deletions

View file

@ -549,6 +549,8 @@ void InitGameVarPointers(void)
char aszBuf[64];
// called from game Init AND when level is loaded...
if (!isWW2GI()) return;
for (i = 0; i < 12/*MAX_WEAPONS*/; i++) // Setup only exists for the original 12 weapons.
{
sprintf(aszBuf, "WEAPON%d_CLIP", i);

View file

@ -282,9 +282,13 @@ void displayweapon_d(int snum, double interpfrac)
}
else
{
auto weapTotalTime = aplWeaponTotalTime(p->curr_weapon, snum);
auto weapFireDelay = aplWeaponFireDelay(p->curr_weapon, snum);
auto weapReload = aplWeaponReload(p->curr_weapon, snum);
int weapTotalTime = 0, weapFireDelay = 0, weapReload = 0;
if (isWW2GI())
{
weapTotalTime = aplWeaponTotalTime(p->curr_weapon, snum);
weapFireDelay = aplWeaponFireDelay(p->curr_weapon, snum);
weapReload = aplWeaponReload(p->curr_weapon, snum);
}
//---------------------------------------------------------------------------
//
@ -737,7 +741,6 @@ void displayweapon_d(int snum, double interpfrac)
{
// down
offsets.Y += 10 * (kickback_pic - weapTotalTime); //D
// offsets.X += 80 * (*kb - aplWeaponTotalTime[cw][snum]);
hud_drawpal(268 + offsets.X, 238 + offsets.Y, DTILE_DEVISTATOR, shade, o, pal, angle);
hud_drawpal(30 + offsets.X, 240 + offsets.Y, DTILE_DEVISTATOR, shade, o | 4, pal, angle);
}
@ -745,7 +748,6 @@ void displayweapon_d(int snum, double interpfrac)
{
// up and left
offsets.Y += 10 * (weapReload - kickback_pic); //U
// offsets.X += 80 * (*kb - aplWeaponTotalTime[cw][snum]);
hud_drawpal(268 + offsets.X, 238 + offsets.Y, DTILE_DEVISTATOR, shade, o, pal, angle);
hud_drawpal(30 + offsets.X, 240 + offsets.Y, DTILE_DEVISTATOR, shade, o | 4, pal, angle);
}

View file

@ -1344,28 +1344,22 @@ static void operateweapon(int snum, ESyncBits actions)
p->ammo_amount[p->curr_weapon]--;
shoot(pact, DukeGrowSparkClass);
//#ifdef NAM
//#else
if (!(aplWeaponFlags(p->curr_weapon, snum) & WEAPON_FLAG_NOVISIBLE))
if (!isNam())
{
// make them visible if not set...
p->visibility = 0;
lastvisinc = PlayClock + 32;
checkavailweapon(p);
}
checkavailweapon(p);
//#endif
}
else if (!isNam()) p->kickback_pic++;
if (isNam() && p->kickback_pic > 30)
{
// reload now...
p->okickback_pic = p->kickback_pic = 0;
if (!(aplWeaponFlags(p->curr_weapon, snum) & WEAPON_FLAG_NOVISIBLE))
{
// make them visible if not set...
p->visibility = 0;
lastvisinc = PlayClock + 32;
}
// make them visible if not set...
p->visibility = 0;
lastvisinc = PlayClock + 32;
checkavailweapon(p);
}
break;