mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
SW: Fix assertions and OOB so that the player can noclip OOB
git-svn-id: https://svn.eduke32.com/eduke32@8348 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
f19848a1b3
commit
823e47f3e8
9 changed files with 157 additions and 60 deletions
|
@ -2186,7 +2186,6 @@ drawscreen(PLAYERp pp)
|
|||
int tx, ty, tz,thoriz,pp_siz;
|
||||
short tang,tsectnum;
|
||||
short i,j;
|
||||
walltype *wal;
|
||||
int tiltlock;
|
||||
int bob_amt = 0;
|
||||
int quake_z, quake_x, quake_y;
|
||||
|
@ -2285,11 +2284,13 @@ drawscreen(PLAYERp pp)
|
|||
|
||||
if (tsectnum < 0)
|
||||
{
|
||||
#if 0
|
||||
// if we hit an invalid sector move to the last valid position for drawing
|
||||
tsectnum = lv_sectnum;
|
||||
tx = lv_x;
|
||||
ty = lv_y;
|
||||
tz = lv_z;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2301,7 +2302,7 @@ drawscreen(PLAYERp pp)
|
|||
}
|
||||
|
||||
// with "last valid" code this should never happen
|
||||
ASSERT(tsectnum >= 0 && tsectnum <= MAXSECTORS);
|
||||
// ASSERT(tsectnum >= 0 && tsectnum <= MAXSECTORS);
|
||||
|
||||
pp->six = tx;
|
||||
pp->siy = ty;
|
||||
|
@ -2420,18 +2421,21 @@ drawscreen(PLAYERp pp)
|
|||
|
||||
i = pp->cursectnum;
|
||||
|
||||
show2dsector[i>>3] |= (1<<(i&7));
|
||||
wal = &wall[sector[i].wallptr];
|
||||
for (j=sector[i].wallnum; j>0; j--,wal++)
|
||||
if (i >= 0)
|
||||
{
|
||||
i = wal->nextsector;
|
||||
if (i < 0) continue;
|
||||
if (wal->cstat&0x0071) continue;
|
||||
uint16_t const nextwall = wal->nextwall;
|
||||
if (nextwall < MAXWALLS && wall[nextwall].cstat&0x0071) continue;
|
||||
if (sector[i].lotag == 32767) continue;
|
||||
if (sector[i].ceilingz >= sector[i].floorz) continue;
|
||||
show2dsector[i>>3] |= (1<<(i&7));
|
||||
walltype *wal = &wall[sector[i].wallptr];
|
||||
for (j=sector[i].wallnum; j>0; j--,wal++)
|
||||
{
|
||||
i = wal->nextsector;
|
||||
if (i < 0) continue;
|
||||
if (wal->cstat&0x0071) continue;
|
||||
uint16_t const nextwall = wal->nextwall;
|
||||
if (nextwall < MAXWALLS && wall[nextwall].cstat&0x0071) continue;
|
||||
if (sector[i].lotag == 32767) continue;
|
||||
if (sector[i].ceilingz >= sector[i].floorz) continue;
|
||||
show2dsector[i>>3] |= (1<<(i&7));
|
||||
}
|
||||
}
|
||||
|
||||
if ((dimensionmode == 5 || dimensionmode == 6) && pp == Player+myconnectindex)
|
||||
|
|
|
@ -1389,6 +1389,9 @@ PlayerInitChemBomb(PLAYERp pp)
|
|||
|
||||
PlaySound(DIGI_THROW, &pp->posx, &pp->posy, &pp->posz, v3df_dontpan | v3df_doppler);
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return 0;
|
||||
|
||||
nx = pp->posx;
|
||||
ny = pp->posy;
|
||||
nz = pp->posz + pp->bob_z + Z(8);
|
||||
|
@ -1834,6 +1837,9 @@ PlayerInitCaltrops(PLAYERp pp)
|
|||
|
||||
PlaySound(DIGI_THROW, &pp->posx, &pp->posy, &pp->posz, v3df_dontpan | v3df_doppler);
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return 0;
|
||||
|
||||
nx = pp->posx;
|
||||
ny = pp->posy;
|
||||
nz = pp->posz + pp->bob_z + Z(8);
|
||||
|
|
|
@ -7347,7 +7347,6 @@ pDisplaySprites(PLAYERp pp)
|
|||
int smoothratio;
|
||||
unsigned i;
|
||||
|
||||
SECT_USERp sectu = SectUser[pp->cursectnum];
|
||||
uint8_t pal = 0;
|
||||
short ang;
|
||||
int flags;
|
||||
|
@ -7488,17 +7487,23 @@ pDisplaySprites(PLAYERp pp)
|
|||
// if its a weapon sprite and the view is set to the outside don't draw the sprite
|
||||
if (TEST(psp->flags, PANF_WEAPON_SPRITE))
|
||||
{
|
||||
pal = sector[pp->cursectnum].floorpal;
|
||||
|
||||
if (sector[pp->cursectnum].floorpal != PALETTE_DEFAULT)
|
||||
SECT_USERp sectu = nullptr;
|
||||
int16_t floorshade = 0;
|
||||
if (pp->cursectnum >= 0)
|
||||
{
|
||||
SECT_USERp sectu = SectUser[pp->cursectnum];
|
||||
if (sectu && TEST(sectu->flags, SECTFU_DONT_COPY_PALETTE))
|
||||
pal = PALETTE_DEFAULT;
|
||||
}
|
||||
sectu = SectUser[pp->cursectnum];
|
||||
pal = sector[pp->cursectnum].floorpal;
|
||||
floorshade = sector[pp->cursectnum].floorshade;
|
||||
|
||||
if (pal == PALETTE_FOG || pal == PALETTE_DIVE || pal == PALETTE_DIVE_LAVA)
|
||||
pal = psp->pal; // Set it back
|
||||
if (pal != PALETTE_DEFAULT)
|
||||
{
|
||||
if (sectu && TEST(sectu->flags, SECTFU_DONT_COPY_PALETTE))
|
||||
pal = PALETTE_DEFAULT;
|
||||
}
|
||||
|
||||
if (pal == PALETTE_FOG || pal == PALETTE_DIVE || pal == PALETTE_DIVE_LAVA)
|
||||
pal = psp->pal; // Set it back
|
||||
}
|
||||
|
||||
///////////
|
||||
|
||||
|
@ -7508,7 +7513,7 @@ pDisplaySprites(PLAYERp pp)
|
|||
}
|
||||
|
||||
//shade = overlay_shade = DIV2(sector[pp->cursectnum].floorshade + sector[pp->cursectnum].ceilingshade);
|
||||
shade = overlay_shade = sector[pp->cursectnum].floorshade - 10;
|
||||
shade = overlay_shade = floorshade - 10;
|
||||
|
||||
if (TEST(psp->PlayerP->Flags, PF_VIEW_FROM_OUTSIDE))
|
||||
{
|
||||
|
|
|
@ -1794,13 +1794,14 @@ DoPlayerTurnTurret(PLAYERp pp)
|
|||
|
||||
void SlipSlope(PLAYERp pp)
|
||||
{
|
||||
short wallptr = sector[pp->cursectnum].wallptr;
|
||||
short ang;
|
||||
SECT_USERp sectu = SectUser[pp->cursectnum];
|
||||
SECT_USERp sectu;
|
||||
|
||||
if (!sectu || !TEST(sectu->flags, SECTFU_SLIDE_SECTOR) || !TEST(sector[pp->cursectnum].floorstat, FLOOR_STAT_SLOPE))
|
||||
if (pp->cursectnum < 0 || !(sectu = SectUser[pp->cursectnum]) || !TEST(sectu->flags, SECTFU_SLIDE_SECTOR) || !TEST(sector[pp->cursectnum].floorstat, FLOOR_STAT_SLOPE))
|
||||
return;
|
||||
|
||||
short wallptr = sector[pp->cursectnum].wallptr;
|
||||
|
||||
ang = getangle(wall[wall[wallptr].point2].x - wall[wallptr].x, wall[wall[wallptr].point2].y - wall[wallptr].y);
|
||||
|
||||
ang = NORM_ANGLE(ang + 512);
|
||||
|
@ -2537,6 +2538,9 @@ DoPlayerMenuKeys(PLAYERp pp)
|
|||
|
||||
void PlayerSectorBound(PLAYERp pp, int amt)
|
||||
{
|
||||
if (pp->cursectnum < 9)
|
||||
return;
|
||||
|
||||
int cz,fz;
|
||||
|
||||
// player should never go into a sector
|
||||
|
@ -2680,7 +2684,7 @@ DoPlayerMove(PLAYERp pp)
|
|||
|
||||
DoPlayerHorizon(pp);
|
||||
|
||||
if (TEST(sector[pp->cursectnum].extra, SECTFX_DYNAMIC_AREA))
|
||||
if (pp->cursectnum >= 0 && TEST(sector[pp->cursectnum].extra, SECTFX_DYNAMIC_AREA))
|
||||
{
|
||||
if (TEST(pp->Flags, PF_FLYING|PF_JUMPING|PF_FALLING))
|
||||
{
|
||||
|
@ -2722,6 +2726,9 @@ DoPlayerSectorUpdatePreMove(PLAYERp pp)
|
|||
{
|
||||
short sectnum = pp->cursectnum;
|
||||
|
||||
if (sectnum < 0)
|
||||
return;
|
||||
|
||||
if (TEST(sector[pp->cursectnum].extra, SECTFX_DYNAMIC_AREA))
|
||||
{
|
||||
updatesectorz(pp->posx, pp->posy, pp->posz, §num);
|
||||
|
@ -2749,13 +2756,12 @@ DoPlayerSectorUpdatePreMove(PLAYERp pp)
|
|||
void
|
||||
DoPlayerSectorUpdatePostMove(PLAYERp pp)
|
||||
{
|
||||
short sectnum;
|
||||
short sectnum = pp->cursectnum;
|
||||
int fz,cz;
|
||||
|
||||
// need to do updatesectorz if in connect area
|
||||
if (FAF_ConnectArea(pp->cursectnum))
|
||||
if (sectnum >= 0 && FAF_ConnectArea(sectnum))
|
||||
{
|
||||
sectnum = pp->cursectnum;
|
||||
updatesectorz(pp->posx, pp->posy, pp->posz, &pp->cursectnum);
|
||||
|
||||
// can mess up if below
|
||||
|
@ -2773,7 +2779,7 @@ DoPlayerSectorUpdatePostMove(PLAYERp pp)
|
|||
|
||||
// try again
|
||||
updatesectorz(pp->posx, pp->posy, pp->posz, &pp->cursectnum);
|
||||
ASSERT(pp->cursectnum >= 0);
|
||||
// ASSERT(pp->cursectnum >= 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -3662,7 +3668,7 @@ DoPlayerFall(PLAYERp pp)
|
|||
FLAG_KEY_RESET(pp, SK_JUMP);
|
||||
}
|
||||
|
||||
if (SectorIsUnderwaterArea(pp->cursectnum))
|
||||
if (pp->cursectnum >= 0 && SectorIsUnderwaterArea(pp->cursectnum))
|
||||
{
|
||||
StackedWaterSplash(pp);
|
||||
DoPlayerBeginDiveNoWarp(pp);
|
||||
|
@ -4245,7 +4251,7 @@ DoPlayerCrawl(PLAYERp pp)
|
|||
{
|
||||
USERp u = User[pp->PlayerSprite];
|
||||
|
||||
if (SectorIsUnderwaterArea(pp->cursectnum))
|
||||
if (pp->cursectnum >= 0 && SectorIsUnderwaterArea(pp->cursectnum))
|
||||
{
|
||||
// if stacked water - which it should be
|
||||
if (FAF_ConnectArea(pp->cursectnum))
|
||||
|
@ -4348,7 +4354,7 @@ DoPlayerCrawl(PLAYERp pp)
|
|||
return;
|
||||
}
|
||||
|
||||
if (TEST(sector[pp->cursectnum].extra, SECTFX_DYNAMIC_AREA))
|
||||
if (pp->cursectnum >= 0 && TEST(sector[pp->cursectnum].extra, SECTFX_DYNAMIC_AREA))
|
||||
{
|
||||
pp->posz = pp->loz - PLAYER_CRAWL_HEIGHT;
|
||||
}
|
||||
|
@ -4430,7 +4436,7 @@ DoPlayerFly(PLAYERp pp)
|
|||
{
|
||||
USERp u = User[pp->PlayerSprite];
|
||||
|
||||
if (SectorIsUnderwaterArea(pp->cursectnum))
|
||||
if (pp->cursectnum >= 0 && SectorIsUnderwaterArea(pp->cursectnum))
|
||||
{
|
||||
DoPlayerBeginDiveNoWarp(pp);
|
||||
return;
|
||||
|
@ -5116,7 +5122,7 @@ void DoPlayerBeginDiveNoWarp(PLAYERp pp)
|
|||
if (Prediction)
|
||||
return;
|
||||
|
||||
if (!SectorIsUnderwaterArea(pp->cursectnum))
|
||||
if (pp->cursectnum < 0 || !SectorIsUnderwaterArea(pp->cursectnum))
|
||||
return;
|
||||
|
||||
if (pp->Bloody) pp->Bloody = FALSE; // Water washes away the blood
|
||||
|
@ -5282,7 +5288,7 @@ DoPlayerDive(PLAYERp pp)
|
|||
SECT_USERp sectu = SectUser[pp->cursectnum];
|
||||
|
||||
// whenever your view is not in a water area
|
||||
if (!SectorIsUnderwaterArea(pp->cursectnum))
|
||||
if (pp->cursectnum < 0 || !SectorIsUnderwaterArea(pp->cursectnum))
|
||||
{
|
||||
DoPlayerStopDiveNoWarp(pp);
|
||||
DoPlayerBeginRun(pp);
|
||||
|
@ -7356,7 +7362,7 @@ DoPlayerRun(PLAYERp pp)
|
|||
{
|
||||
USERp u = User[pp->PlayerSprite];
|
||||
|
||||
if (SectorIsUnderwaterArea(pp->cursectnum))
|
||||
if (pp->cursectnum >= 0 && SectorIsUnderwaterArea(pp->cursectnum))
|
||||
{
|
||||
DoPlayerBeginDiveNoWarp(pp);
|
||||
return;
|
||||
|
@ -7428,7 +7434,7 @@ DoPlayerRun(PLAYERp pp)
|
|||
{
|
||||
if (TEST_SYNC_KEY(pp, SK_OPERATE))
|
||||
{
|
||||
if (FLAG_KEY_PRESSED(pp, SK_OPERATE))
|
||||
if (FLAG_KEY_PRESSED(pp, SK_OPERATE) && pp->cursectnum >= 0)
|
||||
{
|
||||
if (TEST(sector[pp->cursectnum].extra, SECTFX_OPERATIONAL))
|
||||
{
|
||||
|
@ -8405,6 +8411,9 @@ DoFootPrints(short SpriteNum)
|
|||
|
||||
if (u->PlayerP)
|
||||
{
|
||||
if (u->PlayerP->cursectnum < 0)
|
||||
return 0;
|
||||
|
||||
if (FAF_ConnectArea(u->PlayerP->cursectnum))
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ SWBOOL FAF_DebugView = 0;
|
|||
|
||||
void COVERupdatesector(int32_t x, int32_t y, int16_t* newsector)
|
||||
{
|
||||
ASSERT(*newsector>=0 && *newsector<MAXSECTORS);
|
||||
// ASSERT(*newsector>=0 && *newsector<MAXSECTORS);
|
||||
updatesector(x,y,newsector);
|
||||
}
|
||||
|
||||
|
@ -281,10 +281,10 @@ FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects,
|
|||
SWBOOL plax_found = FALSE;
|
||||
vec3_t s = { xs, ys, zs };
|
||||
|
||||
ASSERT(sects >= 0 && secte >= 0);
|
||||
// ASSERT(sects >= 0 && secte >= 0);
|
||||
|
||||
// early out to regular routine
|
||||
if (!FAF_Sector(sects) && !FAF_Sector(secte))
|
||||
if ((sects < 0 || !FAF_Sector(sects)) && (secte < 0 || !FAF_Sector(secte)))
|
||||
{
|
||||
return cansee(xs,ys,zs,sects,xe,ye,ze,secte);
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ GetZadjustment(short sectnum, short hitag)
|
|||
short i, nexti;
|
||||
SPRITEp sp;
|
||||
|
||||
if (!TEST(sector[sectnum].extra, SECTFX_Z_ADJUST))
|
||||
if (sectnum < 0 || !TEST(sector[sectnum].extra, SECTFX_Z_ADJUST))
|
||||
return 0L;
|
||||
|
||||
TRAVERSE_SPRITE_STAT(headspritestat[STAT_ST1], i, nexti)
|
||||
|
@ -517,7 +517,7 @@ void FAFgetzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
// because the ceiling and floors get moved out of the way for drawing.
|
||||
|
||||
// early out to regular routine
|
||||
if (!FAF_ConnectArea(sectnum))
|
||||
if (sectnum < 0 || !FAF_ConnectArea(sectnum))
|
||||
{
|
||||
getzrange_old(x, y, z, sectnum, hiz, ceilhit, loz, florhit, clipdist, clipmask);
|
||||
SectorZadjust(*ceilhit, hiz, *florhit, loz);
|
||||
|
@ -545,7 +545,7 @@ void FAFgetzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
|
||||
updatesectorz(x, y, newz, &uppersect);
|
||||
if (uppersect < 0)
|
||||
_ErrMsg(ERR_STD_ARG, "Did not find a sector at %d, %d, %d", x, y, newz);
|
||||
return; // _ErrMsg(ERR_STD_ARG, "Did not find a sector at %d, %d, %d", x, y, newz);
|
||||
getzrange_old(x, y, newz, uppersect, hiz, ceilhit, &foo1, &foo2, clipdist, clipmask);
|
||||
SectorZadjust(*ceilhit, hiz, -1, NULL);
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ void FAFgetzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
|
||||
updatesectorz(x, y, newz, &lowersect);
|
||||
if (lowersect < 0)
|
||||
_ErrMsg(ERR_STD_ARG, "Did not find a sector at %d, %d, %d", x, y, newz);
|
||||
return; // _ErrMsg(ERR_STD_ARG, "Did not find a sector at %d, %d, %d", x, y, newz);
|
||||
getzrange_old(x, y, newz, lowersect, &foo1, &foo2, loz, florhit, clipdist, clipmask);
|
||||
SectorZadjust(-1, NULL, *florhit, loz);
|
||||
WaterAdjust(*florhit, loz);
|
||||
|
@ -614,7 +614,7 @@ void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
}
|
||||
updatesectorz(x, y, newz, &uppersect);
|
||||
if (uppersect < 0)
|
||||
_ErrMsg(ERR_STD_ARG, "Did not find a sector at %d, %d, %d, sectnum %d", x, y, newz, sectnum);
|
||||
return; // _ErrMsg(ERR_STD_ARG, "Did not find a sector at %d, %d, %d, sectnum %d", x, y, newz, sectnum);
|
||||
getzrangepoint(x, y, newz, uppersect, hiz, ceilhit, &foo1, &foo2);
|
||||
SectorZadjust(*ceilhit, hiz, -1, NULL);
|
||||
}
|
||||
|
@ -630,7 +630,7 @@ void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, int16_t sectnum,
|
|||
}
|
||||
updatesectorz(x, y, newz, &lowersect);
|
||||
if (lowersect < 0)
|
||||
_ErrMsg(ERR_STD_ARG, "Did not find a sector at %d, %d, %d, sectnum %d", x, y, newz, sectnum);
|
||||
return; // _ErrMsg(ERR_STD_ARG, "Did not find a sector at %d, %d, %d, sectnum %d", x, y, newz, sectnum);
|
||||
getzrangepoint(x, y, newz, lowersect, &foo1, &foo2, loz, florhit);
|
||||
SectorZadjust(-1, NULL, *florhit, loz);
|
||||
WaterAdjust(*florhit, loz);
|
||||
|
|
|
@ -2087,11 +2087,14 @@ int DoTrapMatch(short match)
|
|||
void
|
||||
OperateTripTrigger(PLAYERp pp)
|
||||
{
|
||||
SECTORp sectp = §or[pp->cursectnum];
|
||||
|
||||
if (Prediction)
|
||||
return;
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return;
|
||||
|
||||
SECTORp sectp = §or[pp->cursectnum];
|
||||
|
||||
#if 0
|
||||
// new method
|
||||
if (TEST(sectp->extra, SECTFX_TRIGGER))
|
||||
|
@ -2249,6 +2252,9 @@ OperateContinuousTrigger(PLAYERp pp)
|
|||
if (Prediction)
|
||||
return;
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return;
|
||||
|
||||
switch (LOW_TAG(pp->cursectnum))
|
||||
{
|
||||
case TAG_TRIGGER_MISSILE_TRAP:
|
||||
|
@ -2589,8 +2595,6 @@ int DoPlayerGrabStar(PLAYERp pp)
|
|||
void
|
||||
PlayerOperateEnv(PLAYERp pp)
|
||||
{
|
||||
SECT_USERp sectu = SectUser[pp->cursectnum];
|
||||
SECTORp sectp = §or[pp->cursectnum];
|
||||
SWBOOL found;
|
||||
|
||||
if (Prediction)
|
||||
|
@ -2730,8 +2734,10 @@ PlayerOperateEnv(PLAYERp pp)
|
|||
//
|
||||
// ////////////////////////////
|
||||
|
||||
if (sectu && sectu->damage)
|
||||
SECT_USERp sectu;
|
||||
if (pp->cursectnum >= 0 && (sectu = SectUser[pp->cursectnum]) && sectu->damage)
|
||||
{
|
||||
SECTORp sectp = §or[pp->cursectnum];
|
||||
if (TEST(sectu->flags, SECTFU_DAMAGE_ABOVE_SECTOR))
|
||||
{
|
||||
PlayerTakeSectorDamage(pp);
|
||||
|
@ -2761,7 +2767,7 @@ PlayerOperateEnv(PLAYERp pp)
|
|||
{
|
||||
OperateTripTrigger(pp);
|
||||
|
||||
if (TEST(sector[pp->cursectnum].extra, SECTFX_WARP_SECTOR))
|
||||
if (pp->cursectnum >= 0 && TEST(sector[pp->cursectnum].extra, SECTFX_WARP_SECTOR))
|
||||
{
|
||||
if (!TEST(pp->Flags2, PF2_TELEPORTED))
|
||||
{
|
||||
|
|
|
@ -962,7 +962,7 @@ SpawnSprite(short stat, short id, STATEp state, short sectnum, int x, int y, int
|
|||
|
||||
ASSERT(!Prediction);
|
||||
|
||||
PRODUCTION_ASSERT(sectnum >= 0 && sectnum < MAXSECTORS);
|
||||
// PRODUCTION_ASSERT(sectnum >= 0 && sectnum < MAXSECTORS);
|
||||
|
||||
SpriteNum = COVERinsertsprite(sectnum, stat);
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ WarpPlaneSectorInfo(short sectnum, SPRITEp *sp_ceiling, SPRITEp *sp_floor)
|
|||
if (Prediction)
|
||||
return FALSE;
|
||||
|
||||
if (!TEST(sector[sectnum].extra, SECTFX_WARP_SECTOR))
|
||||
if (sectnum < 0 || !TEST(sector[sectnum].extra, SECTFX_WARP_SECTOR))
|
||||
return FALSE;
|
||||
|
||||
TRAVERSE_SPRITE_STAT(headspritestat[STAT_WARP], i, nexti)
|
||||
|
|
|
@ -2777,7 +2777,7 @@ int DoLavaErupt(short SpriteNum)
|
|||
TRAVERSE_CONNECT(pnum)
|
||||
{
|
||||
pp = Player + pnum;
|
||||
if (TEST(sector[pp->cursectnum].extra, SECTFX_TRIGGER))
|
||||
if (pp->cursectnum >= 0 && TEST(sector[pp->cursectnum].extra, SECTFX_TRIGGER))
|
||||
{
|
||||
TRAVERSE_SPRITE_SECT(headspritesect[pp->cursectnum],i,nexti)
|
||||
{
|
||||
|
@ -13027,6 +13027,9 @@ InitSpellRing(PLAYERp pp)
|
|||
if (!SW_SHAREWARE)
|
||||
PlaySound(DIGI_RFWIZ, &pp->posx, &pp->posy, &pp->posz, v3df_none);
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return;
|
||||
|
||||
for (missiles = 0, ang = ang_start; missiles < max_missiles; ang += ang_diff, missiles++)
|
||||
{
|
||||
SpriteNum = SpawnSprite(STAT_MISSILE_SKIP4, FIREBALL1, s_Ring, pp->cursectnum, pp->posx, pp->posy, pp->posz, ang, 0);
|
||||
|
@ -13575,6 +13578,9 @@ InitSpellNapalm(PLAYERp pp)
|
|||
|
||||
PlaySound(DIGI_NAPFIRE, &pp->posx, &pp->posy, &pp->posz, v3df_none);
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return;
|
||||
|
||||
for (i = 0; i < SIZ(mp); i++)
|
||||
{
|
||||
SpriteNum = SpawnSprite(STAT_MISSILE, FIREBALL1, s_Napalm, pp->cursectnum,
|
||||
|
@ -13735,6 +13741,9 @@ InitSpellMirv(PLAYERp pp)
|
|||
|
||||
PlaySound(DIGI_MIRVFIRE, &pp->posx, &pp->posy, &pp->posz, v3df_none);
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return 0;
|
||||
|
||||
SpriteNum = SpawnSprite(STAT_MISSILE, FIREBALL1, s_Mirv, pp->cursectnum,
|
||||
pp->posx, pp->posy, pp->posz + Z(12), pp->pang, MIRV_VELOCITY);
|
||||
|
||||
|
@ -14746,13 +14755,16 @@ InitStar(PLAYERp pp)
|
|||
|
||||
PlayerUpdateAmmo(pp, u->WeaponNum, -3);
|
||||
|
||||
PlaySound(DIGI_STAR, &pp->posx, &pp->posy, &pp->posz, v3df_dontpan|v3df_doppler);
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return 0;
|
||||
|
||||
nx = pp->posx;
|
||||
ny = pp->posy;
|
||||
|
||||
nz = pp->posz + pp->bob_z + Z(8);
|
||||
|
||||
PlaySound(DIGI_STAR, &pp->posx, &pp->posy, &pp->posz, v3df_dontpan|v3df_doppler);
|
||||
|
||||
// Spawn a shot
|
||||
// Inserting and setting up variables
|
||||
|
||||
|
@ -14877,6 +14889,9 @@ InitHeartAttack(PLAYERp pp)
|
|||
|
||||
PlayerUpdateAmmo(pp, WPN_HEART, -1);
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return;
|
||||
|
||||
SpriteNum = SpawnSprite(STAT_MISSILE_SKIP4, BLOOD_WORM, s_BloodWorm, pp->cursectnum,
|
||||
pp->posx, pp->posy, pp->posz + Z(12), pp->pang, BLOOD_WORM_VELOCITY*2);
|
||||
|
||||
|
@ -14950,6 +14965,9 @@ InitHeartAttack(PLAYERp pp)
|
|||
|
||||
PlayerUpdateAmmo(pp, WPN_HEART, -1);
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return;
|
||||
|
||||
SpriteNum = SpawnSprite(STAT_MISSILE_SKIP4, BLOOD_WORM, s_BloodWorm, pp->cursectnum,
|
||||
pp->posx, pp->posy, pp->posz + Z(12), pp->pang, BLOOD_WORM_VELOCITY*2);
|
||||
|
||||
|
@ -15265,6 +15283,9 @@ InitLaser(PLAYERp pp)
|
|||
|
||||
PlaySound(DIGI_RIOTFIRE, &pp->posx, &pp->posy, &pp->posz, v3df_dontpan|v3df_doppler);
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return 0;
|
||||
|
||||
nx = pp->posx;
|
||||
ny = pp->posy;
|
||||
|
||||
|
@ -15374,6 +15395,9 @@ InitRail(PLAYERp pp)
|
|||
// Make sprite shade brighter
|
||||
u->Vis = 128;
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return 0;
|
||||
|
||||
nx = pp->posx;
|
||||
ny = pp->posy;
|
||||
|
||||
|
@ -15555,17 +15579,30 @@ InitRocket(PLAYERp pp)
|
|||
DoPlayerBeginRecoil(pp, ROCKET_RECOIL_AMT);
|
||||
|
||||
PlayerUpdateAmmo(pp, u->WeaponNum, -1);
|
||||
if (pp->WpnRocketHeat)
|
||||
{
|
||||
switch (pp->WpnRocketType)
|
||||
{
|
||||
case 1:
|
||||
pp->WpnRocketHeat--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PlaySound(DIGI_RIOTFIRE, &pp->posx, &pp->posy, &pp->posz, v3df_dontpan|v3df_doppler);
|
||||
|
||||
// Make sprite shade brighter
|
||||
u->Vis = 128;
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return 0;
|
||||
|
||||
nx = pp->posx;
|
||||
ny = pp->posy;
|
||||
|
||||
// Spawn a shot
|
||||
// Inserting and setting up variables
|
||||
|
||||
//nz = pp->posz + pp->bob_z + Z(12);
|
||||
nz = pp->posz + pp->bob_z + Z(8);
|
||||
w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], pp->cursectnum,
|
||||
|
@ -15601,7 +15638,6 @@ InitRocket(PLAYERp pp)
|
|||
switch (pp->WpnRocketType)
|
||||
{
|
||||
case 1:
|
||||
pp->WpnRocketHeat--;
|
||||
SET(wu->Flags, SPR_FIND_PLAYER);
|
||||
wp->pal = wu->spal = 20; // Yellow
|
||||
break;
|
||||
|
@ -15679,11 +15715,15 @@ InitBunnyRocket(PLAYERp pp)
|
|||
|
||||
PlaySound(DIGI_BUNNYATTACK, &pp->posx, &pp->posy, &pp->posz, v3df_dontpan|v3df_doppler);
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return 0;
|
||||
|
||||
nx = pp->posx;
|
||||
ny = pp->posy;
|
||||
|
||||
// Spawn a shot
|
||||
// Inserting and setting up variables
|
||||
|
||||
//nz = pp->posz + pp->bob_z + Z(12);
|
||||
nz = pp->posz + pp->bob_z + Z(8);
|
||||
w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R4, &s_BunnyRocket[0][0], pp->cursectnum,
|
||||
|
@ -15789,11 +15829,15 @@ InitNuke(PLAYERp pp)
|
|||
// Make sprite shade brighter
|
||||
u->Vis = 128;
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return 0;
|
||||
|
||||
nx = pp->posx;
|
||||
ny = pp->posy;
|
||||
|
||||
// Spawn a shot
|
||||
// Inserting and setting up variables
|
||||
|
||||
//nz = pp->posz + pp->bob_z + Z(12);
|
||||
nz = pp->posz + pp->bob_z + Z(8);
|
||||
w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], pp->cursectnum,
|
||||
|
@ -15978,6 +16022,9 @@ InitMicro(PLAYERp pp)
|
|||
if (TargetSortCount > MAX_MICRO)
|
||||
TargetSortCount = MAX_MICRO;
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < MAX_MICRO; i++)
|
||||
{
|
||||
if (ts < &TargetSort[TargetSortCount] && ts->sprite_num >= 0)
|
||||
|
@ -17534,6 +17581,9 @@ DoDefaultStat(short SpriteNum)
|
|||
int
|
||||
InitTracerUzi(PLAYERp pp)
|
||||
{
|
||||
if (pp->cursectnum < 0)
|
||||
return 0;
|
||||
|
||||
USERp u = User[pp->PlayerSprite];
|
||||
SPRITEp wp, hsp;
|
||||
USERp wu;
|
||||
|
@ -17552,6 +17602,7 @@ InitTracerUzi(PLAYERp pp)
|
|||
|
||||
// Spawn a shot
|
||||
// Inserting and setting up variables
|
||||
|
||||
w = SpawnSprite(STAT_MISSILE, 0, s_Tracer, pp->cursectnum,
|
||||
nx, ny, nz, pp->pang, TRACER_VELOCITY);
|
||||
|
||||
|
@ -18549,6 +18600,9 @@ InitTurretRail(short SpriteNum, PLAYERp pp)
|
|||
|
||||
if (SW_SHAREWARE) return FALSE; // JBF: verify
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return 0;
|
||||
|
||||
nx = sp->x;
|
||||
ny = sp->y;
|
||||
nz = sp->z;
|
||||
|
@ -18605,6 +18659,8 @@ InitTurretLaser(short SpriteNum, PLAYERp pp)
|
|||
|
||||
if (SW_SHAREWARE) return FALSE; // JBF: verify
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return 0;
|
||||
|
||||
nx = sp->x;
|
||||
ny = sp->y;
|
||||
|
@ -19394,12 +19450,16 @@ InitGrenade(PLAYERp pp)
|
|||
// Make sprite shade brighter
|
||||
u->Vis = 128;
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return 0;
|
||||
|
||||
nx = pp->posx;
|
||||
ny = pp->posy;
|
||||
nz = pp->posz + pp->bob_z + Z(8);
|
||||
|
||||
// Spawn a shot
|
||||
// Inserting and setting up variables
|
||||
|
||||
w = SpawnSprite(STAT_MISSILE, GRENADE, &s_Grenade[0][0], pp->cursectnum,
|
||||
nx, ny, nz, pp->pang, GRENADE_VELOCITY);
|
||||
|
||||
|
@ -19561,12 +19621,16 @@ InitMine(PLAYERp pp)
|
|||
|
||||
PlaySound(DIGI_MINETHROW, &pp->posx, &pp->posy, &pp->posz, v3df_dontpan|v3df_doppler);
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return 0;
|
||||
|
||||
nx = pp->posx;
|
||||
ny = pp->posy;
|
||||
nz = pp->posz + pp->bob_z + Z(8);
|
||||
|
||||
// Spawn a shot
|
||||
// Inserting and setting up variables
|
||||
|
||||
w = SpawnSprite(STAT_MISSILE, MINE, s_Mine, pp->cursectnum,
|
||||
nx, ny, nz, pp->pang, MINE_VELOCITY);
|
||||
|
||||
|
@ -19740,6 +19804,9 @@ InitFireball(PLAYERp pp)
|
|||
// Make sprite shade brighter
|
||||
u->Vis = 128;
|
||||
|
||||
if (pp->cursectnum < 0)
|
||||
return 0;
|
||||
|
||||
nx += pp->posx;
|
||||
ny += pp->posy;
|
||||
|
||||
|
|
Loading…
Reference in a new issue