Cleanup some Duke game logic, mostly to allow easier chaining to the default case

From-SVN: r8786
This commit is contained in:
Evan Ramos 2020-03-29 08:41:03 +00:00 committed by Christoph Oelckers
parent ec3e8bffe1
commit 2dbbfd4db2
5 changed files with 264 additions and 248 deletions

View file

@ -107,8 +107,13 @@ void A_RadiusDamageObject_Internal(int const spriteNum, int const otherSprite, i
auto const pSprite = (uspriteptr_t)&sprite[spriteNum]; auto const pSprite = (uspriteptr_t)&sprite[spriteNum];
auto const pOther = &sprite[otherSprite]; auto const pOther = &sprite[otherSprite];
// DEFAULT, ZOMBIEACTOR, MISC // DEFAULT, ZOMBIEACTOR, MISC
if (pOther->statnum == STAT_DEFAULT || pOther->statnum == STAT_ZOMBIEACTOR || pOther->statnum == STAT_MISC || AFLAMABLE(pOther->picnum)) if (pOther->statnum == STAT_DEFAULT || pOther->statnum == STAT_ZOMBIEACTOR || pOther->statnum == STAT_MISC
#ifndef EDUKE32_STANDALONE
|| (!FURY && AFLAMABLE(pOther->picnum))
#endif
)
{ {
#ifndef EDUKE32_STANDALONE #ifndef EDUKE32_STANDALONE
if (pSprite->picnum != SHRINKSPARK || (pOther->cstat&257)) if (pSprite->picnum != SHRINKSPARK || (pOther->cstat&257))
@ -161,7 +166,8 @@ void A_RadiusDamageObject_Internal(int const spriteNum, int const otherSprite, i
#endif #endif
) )
dmgActor.picnum = pSprite->picnum; dmgActor.picnum = pSprite->picnum;
else dmgActor.picnum = RADIUSEXPLOSION; else
dmgActor.picnum = RADIUSEXPLOSION;
#ifndef EDUKE32_STANDALONE #ifndef EDUKE32_STANDALONE
if (pSprite->picnum != SHRINKSPARK) if (pSprite->picnum != SHRINKSPARK)
@ -1055,11 +1061,12 @@ ACTOR_STATIC void G_MoveZombieActors(void)
: sector[pSprite->sectnum].floorshade; : sector[pSprite->sectnum].floorshade;
actor[spriteNum].timetosleep = 0; actor[spriteNum].timetosleep = 0;
changespritestat(spriteNum, STAT_STANDABLE); changespritestat(spriteNum, STAT_STANDABLE);
break;
} }
break; fallthrough__;
case RECON__STATIC: case RECON__STATIC:
if (!FURY) if (!FURY && pSprite->picnum == RECON)
CS(spriteNum) |= 257; CS(spriteNum) |= 257;
fallthrough__; fallthrough__;
#endif #endif
@ -3357,7 +3364,8 @@ ACTOR_STATIC void G_MoveWeapons(void)
case SPIT__STATIC: case SPIT__STATIC:
case COOLEXPLOSION1__STATIC: case COOLEXPLOSION1__STATIC:
case FREEZEBLAST__STATIC: case FREEZEBLAST__STATIC:
case FIRELASER__STATIC: break; case FIRELASER__STATIC:
break;
case RPG__STATIC: case RPG__STATIC:
{ {

View file

@ -412,9 +412,9 @@ void G_DoCheats(void)
{ {
case CHEAT_WEAPONS: case CHEAT_WEAPONS:
{ {
int const weaponLimit = (VOLUMEONE) ? 6 : 0; int const weaponLimit = (VOLUMEONE) ? SHRINKER_WEAPON : MAX_WEAPONS;
for (bssize_t weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS-weaponLimit; weaponNum++) for (bssize_t weaponNum = PISTOL_WEAPON; weaponNum < weaponLimit; weaponNum++)
{ {
P_AddAmmo(pPlayer, weaponNum, pPlayer->max_ammo_amount[weaponNum]); P_AddAmmo(pPlayer, weaponNum, pPlayer->max_ammo_amount[weaponNum]);
pPlayer->gotweapon |= (1<<weaponNum); pPlayer->gotweapon |= (1<<weaponNum);
@ -533,12 +533,12 @@ void G_DoCheats(void)
case CHEAT_STUFF: case CHEAT_STUFF:
{ {
int const weaponLimit = (VOLUMEONE) ? 6 : 0; int const weaponLimit = (VOLUMEONE) ? SHRINKER_WEAPON : MAX_WEAPONS;
for (bssize_t weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS-weaponLimit; weaponNum++) for (bssize_t weaponNum = PISTOL_WEAPON; weaponNum < weaponLimit; weaponNum++)
pPlayer->gotweapon |= (1<<weaponNum); pPlayer->gotweapon |= (1<<weaponNum);
for (bssize_t weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS-weaponLimit; weaponNum++) for (bssize_t weaponNum = PISTOL_WEAPON; weaponNum < weaponLimit; weaponNum++)
P_AddAmmo(pPlayer, weaponNum, pPlayer->max_ammo_amount[weaponNum]); P_AddAmmo(pPlayer, weaponNum, pPlayer->max_ammo_amount[weaponNum]);
G_CheatGetInv(pPlayer); G_CheatGetInv(pPlayer);

View file

@ -1215,65 +1215,10 @@ int A_Spawn(int spriteNum, int tileNum)
#endif #endif
switch (DYNAMICTILEMAP(pSprite->picnum)) switch (DYNAMICTILEMAP(pSprite->picnum))
{ {
default:
if (G_HaveActor(pSprite->picnum))
{
if (spriteNum == -1 && pSprite->lotag > ud.player_skill)
{
pSprite->xrepeat = pSprite->yrepeat = 0;
changespritestat(newSprite, STAT_MISC);
break;
}
// Init the size
if (pSprite->xrepeat == 0 || pSprite->yrepeat == 0)
pSprite->xrepeat = pSprite->yrepeat = 1;
if (A_CheckSpriteFlags(newSprite, SFLAG_BADGUY))
{
if (ud.monsters_off == 1)
{
pSprite->xrepeat = pSprite->yrepeat = 0;
changespritestat(newSprite, STAT_MISC);
break;
}
A_Fall(newSprite);
if (A_CheckSpriteFlags(newSprite, SFLAG_BADGUYSTAYPUT))
pActor->stayput = pSprite->sectnum;
g_player[myconnectindex].ps->max_actors_killed++;
pSprite->clipdist = 80;
if (spriteNum >= 0)
{
if (sprite[spriteNum].picnum == RESPAWN)
pActor->tempang = sprite[newSprite].pal = sprite[spriteNum].pal;
A_PlayAlertSound(newSprite);
changespritestat(newSprite, STAT_ACTOR);
}
else
changespritestat(newSprite, STAT_ZOMBIEACTOR);
}
else
{
pSprite->clipdist = 40;
pSprite->owner = newSprite;
changespritestat(newSprite, STAT_ACTOR);
}
pActor->timetosleep = 0;
if (spriteNum >= 0)
pSprite->ang = sprite[spriteNum].ang;
}
break;
case FOF__STATIC: case FOF__STATIC:
pSprite->xrepeat = pSprite->yrepeat = 0; pSprite->xrepeat = pSprite->yrepeat = 0;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
case CAMERA1__STATIC: case CAMERA1__STATIC:
pSprite->extra = 1; pSprite->extra = 1;
pSprite->cstat &= 32768; pSprite->cstat &= 32768;
@ -1291,7 +1236,7 @@ int A_Spawn(int spriteNum, int tileNum)
pSprite->pal = 0; pSprite->pal = 0;
changespritestat(newSprite, STAT_ACTOR); changespritestat(newSprite, STAT_ACTOR);
} }
break; goto SPAWN_END;
#ifndef EDUKE32_STANDALONE #ifndef EDUKE32_STANDALONE
case CAMERAPOLE__STATIC: case CAMERAPOLE__STATIC:
pSprite->extra = 1; pSprite->extra = 1;
@ -1308,7 +1253,7 @@ int A_Spawn(int spriteNum, int tileNum)
} }
else else
pSprite->pal = 0; pSprite->pal = 0;
break; goto SPAWN_END;
case BOLT1__STATIC: case BOLT1__STATIC:
case SIDEBOLT1__STATIC: case SIDEBOLT1__STATIC:
@ -1317,7 +1262,7 @@ int A_Spawn(int spriteNum, int tileNum)
pSprite->yvel = 0; pSprite->yvel = 0;
changespritestat(newSprite, STAT_STANDABLE); changespritestat(newSprite, STAT_STANDABLE);
break; goto SPAWN_END;
case WATERSPLASH2__STATIC: case WATERSPLASH2__STATIC:
if (spriteNum >= 0) if (spriteNum >= 0)
@ -1374,7 +1319,7 @@ int A_Spawn(int spriteNum, int tileNum)
case DUKEGUN__STATIC: case DUKEGUN__STATIC:
case DUKELEG__STATIC: case DUKELEG__STATIC:
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
case TONGUE__STATIC: case TONGUE__STATIC:
if (spriteNum >= 0) if (spriteNum >= 0)
pSprite->ang = sprite[spriteNum].ang; pSprite->ang = sprite[spriteNum].ang;
@ -1382,14 +1327,15 @@ int A_Spawn(int spriteNum, int tileNum)
pSprite->zvel = 256-(krand()&511); pSprite->zvel = 256-(krand()&511);
pSprite->xvel = 64-(krand()&127); pSprite->xvel = 64-(krand()&127);
changespritestat(newSprite, STAT_PROJECTILE); changespritestat(newSprite, STAT_PROJECTILE);
break; goto SPAWN_END;
case NATURALLIGHTNING__STATIC: case NATURALLIGHTNING__STATIC:
pSprite->cstat &= ~257; pSprite->cstat &= ~257;
pSprite->cstat |= 32768; pSprite->cstat |= 32768;
break; goto SPAWN_END;
case TRANSPORTERSTAR__STATIC: case TRANSPORTERSTAR__STATIC:
case TRANSPORTERBEAM__STATIC: case TRANSPORTERBEAM__STATIC:
if (spriteNum == -1) break; if (spriteNum == -1)
goto SPAWN_END;
if (pSprite->picnum == TRANSPORTERBEAM) if (pSprite->picnum == TRANSPORTERBEAM)
{ {
pSprite->xrepeat = 31; pSprite->xrepeat = 31;
@ -1417,12 +1363,12 @@ int A_Spawn(int spriteNum, int tileNum)
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
A_SetSprite(newSprite,CLIPMASK0); A_SetSprite(newSprite,CLIPMASK0);
setsprite(newSprite,&pSprite->pos); setsprite(newSprite,&pSprite->pos);
break; goto SPAWN_END;
case FEMMAG1__STATIC: case FEMMAG1__STATIC:
case FEMMAG2__STATIC: case FEMMAG2__STATIC:
pSprite->cstat &= ~257; pSprite->cstat &= ~257;
changespritestat(newSprite, STAT_DEFAULT); changespritestat(newSprite, STAT_DEFAULT);
break; goto SPAWN_END;
case DUKETAG__STATIC: case DUKETAG__STATIC:
case SIGN1__STATIC: case SIGN1__STATIC:
case SIGN2__STATIC: case SIGN2__STATIC:
@ -1432,7 +1378,7 @@ int A_Spawn(int spriteNum, int tileNum)
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
} }
else pSprite->pal = 0; else pSprite->pal = 0;
break; goto SPAWN_END;
case MASKWALL1__STATIC: case MASKWALL1__STATIC:
case MASKWALL2__STATIC: case MASKWALL2__STATIC:
@ -1453,7 +1399,7 @@ int A_Spawn(int spriteNum, int tileNum)
int const j = pSprite->cstat & SPAWN_PROTECT_CSTAT_MASK; int const j = pSprite->cstat & SPAWN_PROTECT_CSTAT_MASK;
pSprite->cstat = j | CSTAT_SPRITE_BLOCK; pSprite->cstat = j | CSTAT_SPRITE_BLOCK;
changespritestat(newSprite, STAT_DEFAULT); changespritestat(newSprite, STAT_DEFAULT);
break; goto SPAWN_END;
} }
case PODFEM1__STATIC: case PODFEM1__STATIC:
@ -1479,14 +1425,14 @@ int A_Spawn(int spriteNum, int tileNum)
pSprite->cstat |= 257; pSprite->cstat |= 257;
pSprite->clipdist = 32; pSprite->clipdist = 32;
changespritestat(newSprite, STAT_ZOMBIEACTOR); changespritestat(newSprite, STAT_ZOMBIEACTOR);
break; goto SPAWN_END;
case QUEBALL__STATIC: case QUEBALL__STATIC:
case STRIPEBALL__STATIC: case STRIPEBALL__STATIC:
pSprite->cstat = 256; pSprite->cstat = 256;
pSprite->clipdist = 8; pSprite->clipdist = 8;
changespritestat(newSprite, STAT_ZOMBIEACTOR); changespritestat(newSprite, STAT_ZOMBIEACTOR);
break; goto SPAWN_END;
case DUKELYINGDEAD__STATIC: case DUKELYINGDEAD__STATIC:
if (spriteNum >= 0 && sprite[spriteNum].picnum == APLAYER) if (spriteNum >= 0 && sprite[spriteNum].picnum == APLAYER)
@ -1509,28 +1455,28 @@ int A_Spawn(int spriteNum, int tileNum)
pSprite->cstat |= 257; pSprite->cstat |= 257;
pSprite->clipdist = 128; pSprite->clipdist = 128;
changespritestat(newSprite, STAT_ACTOR); changespritestat(newSprite, STAT_ACTOR);
break; goto SPAWN_END;
case RESPAWNMARKERRED__STATIC: case RESPAWNMARKERRED__STATIC:
pSprite->xrepeat = pSprite->yrepeat = 24; pSprite->xrepeat = pSprite->yrepeat = 24;
if (spriteNum >= 0) if (spriteNum >= 0)
pSprite->z = actor[spriteNum].floorz; // -(1<<4); pSprite->z = actor[spriteNum].floorz; // -(1<<4);
changespritestat(newSprite, STAT_ACTOR); changespritestat(newSprite, STAT_ACTOR);
break; goto SPAWN_END;
case MIKE__STATIC: case MIKE__STATIC:
pSprite->yvel = pSprite->hitag; pSprite->yvel = pSprite->hitag;
pSprite->hitag = 0; pSprite->hitag = 0;
changespritestat(newSprite, STAT_ACTOR); changespritestat(newSprite, STAT_ACTOR);
break; goto SPAWN_END;
case WEATHERWARN__STATIC: case WEATHERWARN__STATIC:
changespritestat(newSprite, STAT_ACTOR); changespritestat(newSprite, STAT_ACTOR);
break; goto SPAWN_END;
case SPOTLITE__STATIC: case SPOTLITE__STATIC:
T1(newSprite) = pSprite->x; T1(newSprite) = pSprite->x;
T2(newSprite) = pSprite->y; T2(newSprite) = pSprite->y;
break; goto SPAWN_END;
case BULLETHOLE__STATIC: case BULLETHOLE__STATIC:
pSprite->xrepeat = 3; pSprite->xrepeat = 3;
pSprite->yrepeat = 3; pSprite->yrepeat = 3;
@ -1538,7 +1484,7 @@ int A_Spawn(int spriteNum, int tileNum)
A_AddToDeleteQueue(newSprite); A_AddToDeleteQueue(newSprite);
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
case MONEY__STATIC: case MONEY__STATIC:
case MAIL__STATIC: case MAIL__STATIC:
@ -1551,7 +1497,7 @@ int A_Spawn(int spriteNum, int tileNum)
pSprite->ang = krand() & 2047; pSprite->ang = krand() & 2047;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
case SHELL__STATIC: //From the player case SHELL__STATIC: //From the player
case SHOTGUNSHELL__STATIC: case SHOTGUNSHELL__STATIC:
@ -1600,7 +1546,7 @@ int A_Spawn(int spriteNum, int tileNum)
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
} }
break; goto SPAWN_END;
case WATERBUBBLE__STATIC: case WATERBUBBLE__STATIC:
if (spriteNum >= 0) if (spriteNum >= 0)
@ -1613,7 +1559,7 @@ int A_Spawn(int spriteNum, int tileNum)
pSprite->xrepeat = pSprite->yrepeat = 4; pSprite->xrepeat = pSprite->yrepeat = 4;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
case CRANE__STATIC: case CRANE__STATIC:
@ -1657,13 +1603,13 @@ int A_Spawn(int spriteNum, int tileNum)
pSprite->owner = -1; pSprite->owner = -1;
pSprite->extra = 8; pSprite->extra = 8;
changespritestat(newSprite, STAT_STANDABLE); changespritestat(newSprite, STAT_STANDABLE);
break; goto SPAWN_END;
case TRASH__STATIC: case TRASH__STATIC:
pSprite->ang = krand()&2047; pSprite->ang = krand()&2047;
pSprite->xrepeat = pSprite->yrepeat = 24; pSprite->xrepeat = pSprite->yrepeat = 24;
changespritestat(newSprite, STAT_STANDABLE); changespritestat(newSprite, STAT_STANDABLE);
break; goto SPAWN_END;
case WATERDRIP__STATIC: case WATERDRIP__STATIC:
if (spriteNum >= 0 && (sprite[spriteNum].statnum == STAT_PLAYER || sprite[spriteNum].statnum == STAT_ACTOR)) if (spriteNum >= 0 && (sprite[spriteNum].statnum == STAT_PLAYER || sprite[spriteNum].statnum == STAT_ACTOR))
@ -1691,19 +1637,19 @@ int A_Spawn(int spriteNum, int tileNum)
case WATERDRIPSPLASH__STATIC: case WATERDRIPSPLASH__STATIC:
pSprite->xrepeat = pSprite->yrepeat = 24; pSprite->xrepeat = pSprite->yrepeat = 24;
changespritestat(newSprite, STAT_STANDABLE); changespritestat(newSprite, STAT_STANDABLE);
break; goto SPAWN_END;
case PLUG__STATIC: case PLUG__STATIC:
pSprite->lotag = 9999; pSprite->lotag = 9999;
changespritestat(newSprite, STAT_STANDABLE); changespritestat(newSprite, STAT_STANDABLE);
break; goto SPAWN_END;
case TARGET__STATIC: case TARGET__STATIC:
case DUCK__STATIC: case DUCK__STATIC:
case LETTER__STATIC: case LETTER__STATIC:
pSprite->extra = 1; pSprite->extra = 1;
pSprite->cstat |= 257; pSprite->cstat |= 257;
changespritestat(newSprite, STAT_ACTOR); changespritestat(newSprite, STAT_ACTOR);
break; goto SPAWN_END;
case OCTABRAINSTAYPUT__STATIC: case OCTABRAINSTAYPUT__STATIC:
case LIZTROOPSTAYPUT__STATIC: case LIZTROOPSTAYPUT__STATIC:
@ -1803,7 +1749,7 @@ int A_Spawn(int spriteNum, int tileNum)
{ {
pSprite->xrepeat=pSprite->yrepeat=0; pSprite->xrepeat=pSprite->yrepeat=0;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
} }
else else
{ {
@ -1837,7 +1783,7 @@ int A_Spawn(int spriteNum, int tileNum)
if (pSprite->picnum == ROTATEGUN) if (pSprite->picnum == ROTATEGUN)
pSprite->zvel = 0; pSprite->zvel = 0;
break; goto SPAWN_END;
case REACTOR2__STATIC: case REACTOR2__STATIC:
case REACTOR__STATIC: case REACTOR__STATIC:
@ -1847,14 +1793,14 @@ int A_Spawn(int spriteNum, int tileNum)
{ {
pSprite->xrepeat = pSprite->yrepeat = 0; pSprite->xrepeat = pSprite->yrepeat = 0;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
} }
pSprite->pal = 0; pSprite->pal = 0;
pSprite->shade = -17; pSprite->shade = -17;
changespritestat(newSprite, STAT_ZOMBIEACTOR); changespritestat(newSprite, STAT_ZOMBIEACTOR);
break; goto SPAWN_END;
case HEAVYHBOMB__STATIC: case HEAVYHBOMB__STATIC:
if (spriteNum >= 0) if (spriteNum >= 0)
@ -1869,13 +1815,13 @@ int A_Spawn(int spriteNum, int tileNum)
{ {
pSprite->xrepeat = pSprite->yrepeat = 0; pSprite->xrepeat = pSprite->yrepeat = 0;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
} }
pSprite->pal = 0; pSprite->pal = 0;
pSprite->shade = -17; pSprite->shade = -17;
changespritestat(newSprite, STAT_ZOMBIEACTOR); changespritestat(newSprite, STAT_ZOMBIEACTOR);
break; goto SPAWN_END;
case RECON__STATIC: case RECON__STATIC:
if (pSprite->lotag > ud.player_skill) if (pSprite->lotag > ud.player_skill)
@ -1890,7 +1836,7 @@ int A_Spawn(int spriteNum, int tileNum)
{ {
pSprite->xrepeat = pSprite->yrepeat = 0; pSprite->xrepeat = pSprite->yrepeat = 0;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
} }
pSprite->extra = 130; pSprite->extra = 130;
pSprite->cstat |= 256; // Make it hitable pSprite->cstat |= 256; // Make it hitable
@ -1899,13 +1845,13 @@ int A_Spawn(int spriteNum, int tileNum)
{ {
pSprite->xrepeat = pSprite->yrepeat = 0; pSprite->xrepeat = pSprite->yrepeat = 0;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
} }
pSprite->pal = 0; pSprite->pal = 0;
pSprite->shade = -17; pSprite->shade = -17;
changespritestat(newSprite, STAT_ZOMBIEACTOR); changespritestat(newSprite, STAT_ZOMBIEACTOR);
break; goto SPAWN_END;
case ATOMICHEALTH__STATIC: case ATOMICHEALTH__STATIC:
case STEROIDS__STATIC: case STEROIDS__STATIC:
@ -1957,7 +1903,7 @@ int A_Spawn(int spriteNum, int tileNum)
{ {
pSprite->xrepeat = pSprite->yrepeat = 0; pSprite->xrepeat = pSprite->yrepeat = 0;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
} }
pSprite->pal = 0; pSprite->pal = 0;
@ -1971,7 +1917,7 @@ int A_Spawn(int spriteNum, int tileNum)
{ {
pSprite->xrepeat = pSprite->yrepeat = 0; pSprite->xrepeat = pSprite->yrepeat = 0;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
} }
else else
{ {
@ -1991,7 +1937,7 @@ int A_Spawn(int spriteNum, int tileNum)
changespritestat(newSprite, STAT_ZOMBIEACTOR); changespritestat(newSprite, STAT_ZOMBIEACTOR);
A_Fall(newSprite); A_Fall(newSprite);
} }
break; goto SPAWN_END;
case WATERFOUNTAIN__STATIC: case WATERFOUNTAIN__STATIC:
SLT(newSprite) = 1; SLT(newSprite) = 1;
@ -2004,12 +1950,12 @@ int A_Spawn(int spriteNum, int tileNum)
pSprite->cstat = 257; // Make it hitable pSprite->cstat = 257; // Make it hitable
sprite[newSprite].extra = 1; sprite[newSprite].extra = 1;
changespritestat(newSprite, STAT_STANDABLE); changespritestat(newSprite, STAT_STANDABLE);
break; goto SPAWN_END;
case FLOORFLAME__STATIC: case FLOORFLAME__STATIC:
pSprite->shade = -127; pSprite->shade = -127;
changespritestat(newSprite, STAT_STANDABLE); changespritestat(newSprite, STAT_STANDABLE);
break; goto SPAWN_END;
case BOUNCEMINE__STATIC: case BOUNCEMINE__STATIC:
pSprite->owner = newSprite; pSprite->owner = newSprite;
@ -2018,7 +1964,7 @@ int A_Spawn(int spriteNum, int tileNum)
pSprite->shade = -127; pSprite->shade = -127;
pSprite->extra = g_impactDamage<<2; pSprite->extra = g_impactDamage<<2;
changespritestat(newSprite, STAT_ZOMBIEACTOR); changespritestat(newSprite, STAT_ZOMBIEACTOR);
break; goto SPAWN_END;
case STEAM__STATIC: case STEAM__STATIC:
if (spriteNum >= 0) if (spriteNum >= 0)
@ -2032,7 +1978,7 @@ int A_Spawn(int spriteNum, int tileNum)
fallthrough__; fallthrough__;
case CEILINGSTEAM__STATIC: case CEILINGSTEAM__STATIC:
changespritestat(newSprite, STAT_STANDABLE); changespritestat(newSprite, STAT_STANDABLE);
break; goto SPAWN_END;
case TOILET__STATIC: case TOILET__STATIC:
case STALL__STATIC: case STALL__STATIC:
@ -2040,7 +1986,7 @@ int A_Spawn(int spriteNum, int tileNum)
pSprite->cstat |= 257; pSprite->cstat |= 257;
pSprite->clipdist = 8; pSprite->clipdist = 8;
pSprite->owner = newSprite; pSprite->owner = newSprite;
break; goto SPAWN_END;
case CANWITHSOMETHING__STATIC: case CANWITHSOMETHING__STATIC:
case CANWITHSOMETHING2__STATIC: case CANWITHSOMETHING2__STATIC:
@ -2078,12 +2024,12 @@ int A_Spawn(int spriteNum, int tileNum)
pSprite->cstat = 257|(krand()&4); pSprite->cstat = 257|(krand()&4);
changespritestat(newSprite, STAT_ZOMBIEACTOR); changespritestat(newSprite, STAT_ZOMBIEACTOR);
} }
break; goto SPAWN_END;
case TOILETWATER__STATIC: case TOILETWATER__STATIC:
pSprite->shade = -16; pSprite->shade = -16;
changespritestat(newSprite, STAT_STANDABLE); changespritestat(newSprite, STAT_STANDABLE);
break; goto SPAWN_END;
case LASERLINE__STATIC: case LASERLINE__STATIC:
pSprite->yrepeat = 6; pSprite->yrepeat = 6;
@ -2101,7 +2047,7 @@ int A_Spawn(int spriteNum, int tileNum)
if (spriteNum >= 0) pSprite->ang = actor[spriteNum].t_data[5]+512; if (spriteNum >= 0) pSprite->ang = actor[spriteNum].t_data[5]+512;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
case FORCESPHERE__STATIC: case FORCESPHERE__STATIC:
if (spriteNum == -1) if (spriteNum == -1)
@ -2114,7 +2060,7 @@ int A_Spawn(int spriteNum, int tileNum)
pSprite->xrepeat = pSprite->yrepeat = 1; pSprite->xrepeat = pSprite->yrepeat = 1;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
} }
break; goto SPAWN_END;
case BLOOD__STATIC: case BLOOD__STATIC:
pSprite->xrepeat = pSprite->yrepeat = 16; pSprite->xrepeat = pSprite->yrepeat = 16;
@ -2122,7 +2068,8 @@ int A_Spawn(int spriteNum, int tileNum)
if (spriteNum >= 0 && sprite[spriteNum].pal == 6) if (spriteNum >= 0 && sprite[spriteNum].pal == 6)
pSprite->pal = 6; pSprite->pal = 6;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
case BLOODPOOL__STATIC: case BLOODPOOL__STATIC:
case PUKE__STATIC: case PUKE__STATIC:
{ {
@ -2150,13 +2097,13 @@ int A_Spawn(int spriteNum, int tileNum)
zero_puke: zero_puke:
pSprite->xrepeat = pSprite->yrepeat = 0; pSprite->xrepeat = pSprite->yrepeat = 0;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
} }
if (sector[sectNum].lotag == ST_1_ABOVE_WATER) if (sector[sectNum].lotag == ST_1_ABOVE_WATER)
{ {
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
} }
if (spriteNum >= 0 && pSprite->picnum != PUKE) if (spriteNum >= 0 && pSprite->picnum != PUKE)
@ -2178,7 +2125,7 @@ int A_Spawn(int spriteNum, int tileNum)
if (spriteNum >= 0) if (spriteNum >= 0)
pSprite->xrepeat = pSprite->yrepeat = 1; pSprite->xrepeat = pSprite->yrepeat = 1;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
case BLOODSPLAT1__STATIC: case BLOODSPLAT1__STATIC:
case BLOODSPLAT2__STATIC: case BLOODSPLAT2__STATIC:
@ -2194,14 +2141,14 @@ int A_Spawn(int spriteNum, int tileNum)
A_AddToDeleteQueue(newSprite); A_AddToDeleteQueue(newSprite);
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
case TRIPBOMB__STATIC: case TRIPBOMB__STATIC:
if (pSprite->lotag > ud.player_skill) if (pSprite->lotag > ud.player_skill)
{ {
pSprite->xrepeat = pSprite->yrepeat = 0; pSprite->xrepeat = pSprite->yrepeat = 0;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
} }
pSprite->xrepeat = 4; pSprite->xrepeat = 4;
@ -2217,18 +2164,18 @@ int A_Spawn(int spriteNum, int tileNum)
pActor->t_data[5] = pSprite->ang; pActor->t_data[5] = pSprite->ang;
changespritestat(newSprite, STAT_ZOMBIEACTOR); changespritestat(newSprite, STAT_ZOMBIEACTOR);
break; goto SPAWN_END;
case SPACEMARINE__STATIC: case SPACEMARINE__STATIC:
pSprite->extra = 20; pSprite->extra = 20;
pSprite->cstat |= 257; pSprite->cstat |= 257;
changespritestat(newSprite, STAT_ZOMBIEACTOR); changespritestat(newSprite, STAT_ZOMBIEACTOR);
break; goto SPAWN_END;
case DOORSHOCK__STATIC: case DOORSHOCK__STATIC:
pSprite->cstat |= 1+256; pSprite->cstat |= 1+256;
pSprite->shade = -12; pSprite->shade = -12;
changespritestat(newSprite, STAT_STANDABLE); changespritestat(newSprite, STAT_STANDABLE);
break; goto SPAWN_END;
case HYDRENT__STATIC: case HYDRENT__STATIC:
case PANNEL1__STATIC: case PANNEL1__STATIC:
case PANNEL2__STATIC: case PANNEL2__STATIC:
@ -2300,10 +2247,11 @@ int A_Spawn(int spriteNum, int tileNum)
fallthrough__; fallthrough__;
case OCEANSPRITE4__STATIC: case OCEANSPRITE4__STATIC:
changespritestat(newSprite, STAT_DEFAULT); changespritestat(newSprite, STAT_DEFAULT);
break; goto SPAWN_END;
case FRAMEEFFECT1_13__STATIC: case FRAMEEFFECT1_13__STATIC:
if (PLUTOPAK) break; if (PLUTOPAK)
break;
fallthrough__; fallthrough__;
case FRAMEEFFECT1__STATIC: case FRAMEEFFECT1__STATIC:
if (spriteNum >= 0) if (spriteNum >= 0)
@ -2316,7 +2264,7 @@ int A_Spawn(int spriteNum, int tileNum)
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
case FOOTPRINTS__STATIC: case FOOTPRINTS__STATIC:
case FOOTPRINTS2__STATIC: case FOOTPRINTS2__STATIC:
case FOOTPRINTS3__STATIC: case FOOTPRINTS3__STATIC:
@ -2339,7 +2287,7 @@ int A_Spawn(int spriteNum, int tileNum)
{ {
pSprite->xrepeat = pSprite->yrepeat = 0; pSprite->xrepeat = pSprite->yrepeat = 0;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
} }
} }
else goto zero_footprint; else goto zero_footprint;
@ -2350,7 +2298,7 @@ int A_Spawn(int spriteNum, int tileNum)
{ {
zero_footprint: zero_footprint:
pSprite->xrepeat = pSprite->yrepeat = 0; pSprite->xrepeat = pSprite->yrepeat = 0;
break; goto SPAWN_END;
} }
pSprite->cstat = 32 + ((g_player[P_Get(spriteNum)].ps->footprintcount & 1) << 2); pSprite->cstat = 32 + ((g_player[P_Get(spriteNum)].ps->footprintcount & 1) << 2);
@ -2364,14 +2312,14 @@ int A_Spawn(int spriteNum, int tileNum)
A_AddToDeleteQueue(newSprite); A_AddToDeleteQueue(newSprite);
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
case VIEWSCREEN__STATIC: case VIEWSCREEN__STATIC:
case VIEWSCREEN2__STATIC: case VIEWSCREEN2__STATIC:
pSprite->owner = newSprite; pSprite->owner = newSprite;
pSprite->lotag = pSprite->extra = 1; pSprite->lotag = pSprite->extra = 1;
changespritestat(newSprite, STAT_STANDABLE); changespritestat(newSprite, STAT_STANDABLE);
break; goto SPAWN_END;
case RESPAWN__STATIC: case RESPAWN__STATIC:
pSprite->extra = 66-13; pSprite->extra = 66-13;
fallthrough__; fallthrough__;
@ -2380,11 +2328,11 @@ int A_Spawn(int spriteNum, int tileNum)
{ {
pSprite->xrepeat = pSprite->yrepeat = 0; pSprite->xrepeat = pSprite->yrepeat = 0;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
} }
pSprite->cstat = 32768; pSprite->cstat = 32768;
changespritestat(newSprite, STAT_FX); changespritestat(newSprite, STAT_FX);
break; goto SPAWN_END;
case EXPLOSION2__STATIC: case EXPLOSION2__STATIC:
#ifdef POLYMER #ifdef POLYMER
@ -2438,7 +2386,7 @@ int A_Spawn(int spriteNum, int tileNum)
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
case PLAYERONWATER__STATIC: case PLAYERONWATER__STATIC:
if (spriteNum >= 0) if (spriteNum >= 0)
@ -2450,7 +2398,7 @@ int A_Spawn(int spriteNum, int tileNum)
pSprite->cstat |= 32768; pSprite->cstat |= 32768;
} }
changespritestat(newSprite, STAT_DUMMYPLAYER); changespritestat(newSprite, STAT_DUMMYPLAYER);
break; goto SPAWN_END;
case APLAYER__STATIC: case APLAYER__STATIC:
pSprite->xrepeat = 0; pSprite->xrepeat = 0;
@ -2461,7 +2409,7 @@ int A_Spawn(int spriteNum, int tileNum)
|| ((g_gametypeFlags[ud.coop] & GAMETYPE_COOPSPAWN) / GAMETYPE_COOPSPAWN) != pSprite->lotag) || ((g_gametypeFlags[ud.coop] & GAMETYPE_COOPSPAWN) / GAMETYPE_COOPSPAWN) != pSprite->lotag)
? STAT_MISC ? STAT_MISC
: STAT_PLAYER); : STAT_PLAYER);
break; goto SPAWN_END;
case TOUCHPLATE__STATIC: case TOUCHPLATE__STATIC:
T3(newSprite) = sector[sectNum].floorz; T3(newSprite) = sector[sectNum].floorz;
@ -2472,7 +2420,7 @@ int A_Spawn(int spriteNum, int tileNum)
{ {
pSprite->xrepeat=pSprite->yrepeat=0; pSprite->xrepeat=pSprite->yrepeat=0;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
} }
#ifndef EDUKE32_STANDALONE #ifndef EDUKE32_STANDALONE
fallthrough__; fallthrough__;
@ -2487,18 +2435,18 @@ int A_Spawn(int spriteNum, int tileNum)
#endif #endif
pSprite->cstat |= 32768; pSprite->cstat |= 32768;
changespritestat(newSprite, STAT_STANDABLE); changespritestat(newSprite, STAT_STANDABLE);
break; goto SPAWN_END;
case MASTERSWITCH__STATIC: case MASTERSWITCH__STATIC:
if (pSprite->picnum == MASTERSWITCH) if (pSprite->picnum == MASTERSWITCH)
pSprite->cstat |= 32768; pSprite->cstat |= 32768;
pSprite->yvel = 0; pSprite->yvel = 0;
changespritestat(newSprite, STAT_STANDABLE); changespritestat(newSprite, STAT_STANDABLE);
break; goto SPAWN_END;
case LOCATORS__STATIC: case LOCATORS__STATIC:
pSprite->cstat |= 32768; pSprite->cstat |= 32768;
changespritestat(newSprite, STAT_LOCATOR); changespritestat(newSprite, STAT_LOCATOR);
break; goto SPAWN_END;
case ACTIVATORLOCKED__STATIC: case ACTIVATORLOCKED__STATIC:
case ACTIVATOR__STATIC: case ACTIVATOR__STATIC:
@ -2506,7 +2454,7 @@ int A_Spawn(int spriteNum, int tileNum)
if (pSprite->picnum == ACTIVATORLOCKED) if (pSprite->picnum == ACTIVATORLOCKED)
sector[pSprite->sectnum].lotag |= 16384; sector[pSprite->sectnum].lotag |= 16384;
changespritestat(newSprite, STAT_ACTIVATOR); changespritestat(newSprite, STAT_ACTIVATOR);
break; goto SPAWN_END;
case OOZ__STATIC: case OOZ__STATIC:
case OOZ2__STATIC: case OOZ2__STATIC:
@ -2530,7 +2478,7 @@ int A_Spawn(int spriteNum, int tileNum)
pSprite->xrepeat = 25 - (oozSize >> 1); pSprite->xrepeat = 25 - (oozSize >> 1);
pSprite->cstat |= (krand() & 4); pSprite->cstat |= (krand() & 4);
break; goto SPAWN_END;
} }
case SECTOREFFECTOR__STATIC: case SECTOREFFECTOR__STATIC:
@ -3096,7 +3044,7 @@ int A_Spawn(int spriteNum, int tileNum)
} }
changespritestat(newSprite, STAT_EFFECTOR); changespritestat(newSprite, STAT_EFFECTOR);
break; goto SPAWN_END;
case SEENINE__STATIC: case SEENINE__STATIC:
case OOZFILTER__STATIC: case OOZFILTER__STATIC:
@ -3113,7 +3061,7 @@ int A_Spawn(int spriteNum, int tileNum)
pSprite->owner = newSprite; pSprite->owner = newSprite;
changespritestat(newSprite, STAT_STANDABLE); changespritestat(newSprite, STAT_STANDABLE);
break; goto SPAWN_END;
case CRACK1__STATIC: case CRACK1__STATIC:
case CRACK2__STATIC: case CRACK2__STATIC:
@ -3135,7 +3083,7 @@ int A_Spawn(int spriteNum, int tileNum)
{ {
pSprite->xrepeat = pSprite->yrepeat = 0; pSprite->xrepeat = pSprite->yrepeat = 0;
changespritestat(newSprite, STAT_MISC); changespritestat(newSprite, STAT_MISC);
break; goto SPAWN_END;
} }
pSprite->pal = 0; pSprite->pal = 0;
@ -3144,9 +3092,67 @@ int A_Spawn(int spriteNum, int tileNum)
changespritestat(newSprite, STAT_STANDABLE); changespritestat(newSprite, STAT_STANDABLE);
A_SetSprite(newSprite,CLIPMASK0); A_SetSprite(newSprite,CLIPMASK0);
break; goto SPAWN_END;
default:
break; // NOT goto
} }
// implementation of the default case
if (G_HaveActor(pSprite->picnum))
{
if (spriteNum == -1 && pSprite->lotag > ud.player_skill)
{
pSprite->xrepeat = pSprite->yrepeat = 0;
changespritestat(newSprite, STAT_MISC);
goto SPAWN_END;
}
// Init the size
if (pSprite->xrepeat == 0 || pSprite->yrepeat == 0)
pSprite->xrepeat = pSprite->yrepeat = 1;
if (A_CheckSpriteFlags(newSprite, SFLAG_BADGUY))
{
if (ud.monsters_off == 1)
{
pSprite->xrepeat = pSprite->yrepeat = 0;
changespritestat(newSprite, STAT_MISC);
goto SPAWN_END;
}
A_Fall(newSprite);
if (A_CheckSpriteFlags(newSprite, SFLAG_BADGUYSTAYPUT))
pActor->stayput = pSprite->sectnum;
g_player[myconnectindex].ps->max_actors_killed++;
pSprite->clipdist = 80;
if (spriteNum >= 0)
{
if (sprite[spriteNum].picnum == RESPAWN)
pActor->tempang = sprite[newSprite].pal = sprite[spriteNum].pal;
A_PlayAlertSound(newSprite);
changespritestat(newSprite, STAT_ACTOR);
}
else
changespritestat(newSprite, STAT_ZOMBIEACTOR);
}
else
{
pSprite->clipdist = 40;
pSprite->owner = newSprite;
changespritestat(newSprite, STAT_ACTOR);
}
pActor->timetosleep = 0;
if (spriteNum >= 0)
pSprite->ang = sprite[spriteNum].ang;
}
SPAWN_END: SPAWN_END:
if (VM_HaveEvent(EVENT_SPAWN)) if (VM_HaveEvent(EVENT_SPAWN))
{ {

View file

@ -56,8 +56,6 @@ BEGIN_DUKE_NS
#ifndef EDUKE32_STANDALONE #ifndef EDUKE32_STANDALONE
#define AFLAMABLE(X) (X==BOX||X==TREE1||X==TREE2||X==TIRE||X==CONE) #define AFLAMABLE(X) (X==BOX||X==TREE1||X==TREE2||X==TIRE||X==CONE)
#else
#define AFLAMABLE(X) (0)
#endif #endif
#define rnd(X) ((krand()>>8)>=(255-(X))) #define rnd(X) ((krand()>>8)>=(255-(X)))

View file

@ -1939,7 +1939,7 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc)
PN(spriteNum) = BGRATE1; PN(spriteNum) = BGRATE1;
CS(spriteNum) &= (65535-256-1); CS(spriteNum) &= (65535-256-1);
A_PlaySound(VENT_BUST, spriteNum); A_PlaySound(VENT_BUST, spriteNum);
break; return;
case FANSPRITE__STATIC: case FANSPRITE__STATIC:
PN(spriteNum) = FANSPRITEBROKE; PN(spriteNum) = FANSPRITEBROKE;
@ -1955,7 +1955,7 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc)
auto const pSprite = &sprite[spriteNum]; auto const pSprite = &sprite[spriteNum];
RANDOMSCRAP(pSprite, spriteNum); RANDOMSCRAP(pSprite, spriteNum);
} }
break; return;
case OCEANSPRITE1__STATIC: case OCEANSPRITE1__STATIC:
case OCEANSPRITE2__STATIC: case OCEANSPRITE2__STATIC:
@ -1964,7 +1964,7 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc)
case OCEANSPRITE5__STATIC: case OCEANSPRITE5__STATIC:
A_Spawn(spriteNum,SMALLSMOKE); A_Spawn(spriteNum,SMALLSMOKE);
A_DeleteSprite(spriteNum); A_DeleteSprite(spriteNum);
break; return;
case QUEBALL__STATIC: case QUEBALL__STATIC:
case STRIPEBALL__STATIC: case STRIPEBALL__STATIC:
@ -1989,7 +1989,7 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc)
A_DeleteSprite(spriteNum); A_DeleteSprite(spriteNum);
} }
} }
break; return;
case TREE1__STATIC: case TREE1__STATIC:
case TREE2__STATIC: case TREE2__STATIC:
@ -2015,7 +2015,7 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc)
T1(spriteNum) = 1; T1(spriteNum) = 1;
A_Spawn(spriteNum,BURNING); A_Spawn(spriteNum,BURNING);
} }
break; return;
} }
case CACTUS__STATIC: case CACTUS__STATIC:
@ -2045,7 +2045,7 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc)
PN(spriteNum) = CACTUSBROKE; PN(spriteNum) = CACTUSBROKE;
CS(spriteNum) &= ~257; CS(spriteNum) &= ~257;
} }
break; return;
} }
case HANGLIGHT__STATIC: case HANGLIGHT__STATIC:
@ -2054,14 +2054,14 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc)
A_InsertSprite(SECT(spriteNum),SX(spriteNum),SY(spriteNum),SZ(spriteNum)-ZOFFSET3,SCRAP1+(krand()&15),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(sprite[spriteNum].zvel>>2),spriteNum,5); A_InsertSprite(SECT(spriteNum),SX(spriteNum),SY(spriteNum),SZ(spriteNum)-ZOFFSET3,SCRAP1+(krand()&15),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(sprite[spriteNum].zvel>>2),spriteNum,5);
A_PlaySound(GLASS_HEAVYBREAK,spriteNum); A_PlaySound(GLASS_HEAVYBREAK,spriteNum);
A_DeleteSprite(spriteNum); A_DeleteSprite(spriteNum);
break; return;
case WATERFOUNTAIN__STATIC: case WATERFOUNTAIN__STATIC:
// case WATERFOUNTAIN+1: // case WATERFOUNTAIN+1:
// case WATERFOUNTAIN+2: // case WATERFOUNTAIN+2:
PN(spriteNum) = WATERFOUNTAINBROKE; PN(spriteNum) = WATERFOUNTAINBROKE;
A_Spawn(spriteNum,TOILETWATER); A_Spawn(spriteNum,TOILETWATER);
break; return;
case SATELITE__STATIC: case SATELITE__STATIC:
case FUELPOD__STATIC: case FUELPOD__STATIC:
@ -2075,7 +2075,7 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc)
A_Spawn(spriteNum,EXPLOSION2); A_Spawn(spriteNum,EXPLOSION2);
A_DeleteSprite(spriteNum); A_DeleteSprite(spriteNum);
} }
break; return;
case BOTTLE1__STATIC: case BOTTLE1__STATIC:
case BOTTLE2__STATIC: case BOTTLE2__STATIC:
@ -2119,13 +2119,13 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc)
SA(spriteNum) = krand()&2047; SA(spriteNum) = krand()&2047;
A_SpawnWallGlass(spriteNum,-1,8); A_SpawnWallGlass(spriteNum,-1,8);
A_DeleteSprite(spriteNum); A_DeleteSprite(spriteNum);
break; return;
case FETUS__STATIC: case FETUS__STATIC:
PN(spriteNum) = FETUSBROKE; PN(spriteNum) = FETUSBROKE;
A_PlaySound(GLASS_BREAKING,spriteNum); A_PlaySound(GLASS_BREAKING,spriteNum);
A_SpawnWallGlass(spriteNum,-1,10); A_SpawnWallGlass(spriteNum,-1,10);
break; return;
case FETUSBROKE__STATIC: case FETUSBROKE__STATIC:
for (bssize_t j=48; j>0; j--) for (bssize_t j=48; j>0; j--)
@ -2140,13 +2140,13 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc)
A_PlaySound(GLASS_BREAKING,spriteNum); A_PlaySound(GLASS_BREAKING,spriteNum);
A_SpawnWallGlass(spriteNum,-1,10); A_SpawnWallGlass(spriteNum,-1,10);
A_DeleteSprite(spriteNum); A_DeleteSprite(spriteNum);
break; return;
case HYDROPLANT__STATIC: case HYDROPLANT__STATIC:
PN(spriteNum) = BROKEHYDROPLANT; PN(spriteNum) = BROKEHYDROPLANT;
A_PlaySound(GLASS_BREAKING,spriteNum); A_PlaySound(GLASS_BREAKING,spriteNum);
A_SpawnWallGlass(spriteNum,-1,10); A_SpawnWallGlass(spriteNum,-1,10);
break; return;
case FORCESPHERE__STATIC: case FORCESPHERE__STATIC:
sprite[spriteNum].xrepeat = 0; sprite[spriteNum].xrepeat = 0;
@ -2154,13 +2154,13 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc)
actor[OW(spriteNum)].t_data[1] = !actor[OW(spriteNum)].t_data[1]; actor[OW(spriteNum)].t_data[1] = !actor[OW(spriteNum)].t_data[1];
actor[OW(spriteNum)].t_data[2] ++; actor[OW(spriteNum)].t_data[2] ++;
A_Spawn(spriteNum,EXPLOSION2); A_Spawn(spriteNum,EXPLOSION2);
break; return;
case BROKEHYDROPLANT__STATIC: case BROKEHYDROPLANT__STATIC:
A_PlaySound(GLASS_BREAKING,spriteNum); A_PlaySound(GLASS_BREAKING,spriteNum);
A_SpawnWallGlass(spriteNum,-1,5); A_SpawnWallGlass(spriteNum,-1,5);
A_DeleteSprite(spriteNum); A_DeleteSprite(spriteNum);
break; return;
case TOILET__STATIC: case TOILET__STATIC:
PN(spriteNum) = TOILETBROKE; PN(spriteNum) = TOILETBROKE;
@ -2168,7 +2168,7 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc)
CS(spriteNum) &= ~257; CS(spriteNum) &= ~257;
A_Spawn(spriteNum,TOILETWATER); A_Spawn(spriteNum,TOILETWATER);
A_PlaySound(GLASS_BREAKING,spriteNum); A_PlaySound(GLASS_BREAKING,spriteNum);
break; return;
case STALL__STATIC: case STALL__STATIC:
PN(spriteNum) = STALLBROKE; PN(spriteNum) = STALLBROKE;
@ -2176,7 +2176,7 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc)
CS(spriteNum) &= ~257; CS(spriteNum) &= ~257;
A_Spawn(spriteNum,TOILETWATER); A_Spawn(spriteNum,TOILETWATER);
A_PlaySound(GLASS_HEAVYBREAK,spriteNum); A_PlaySound(GLASS_HEAVYBREAK,spriteNum);
break; return;
case HYDRENT__STATIC: case HYDRENT__STATIC:
PN(spriteNum) = BROKEFIREHYDRENT; PN(spriteNum) = BROKEFIREHYDRENT;
@ -2188,26 +2188,26 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc)
// sprite[j].pal = 2; // sprite[j].pal = 2;
// } // }
A_PlaySound(GLASS_HEAVYBREAK,spriteNum); A_PlaySound(GLASS_HEAVYBREAK,spriteNum);
break; return;
case CIRCLEPANNEL__STATIC: case CIRCLEPANNEL__STATIC:
PN(spriteNum) = CIRCLEPANNELBROKE; PN(spriteNum) = CIRCLEPANNELBROKE;
CS(spriteNum) &= (65535-256-1); CS(spriteNum) &= (65535-256-1);
A_PlaySound(VENT_BUST,spriteNum); A_PlaySound(VENT_BUST,spriteNum);
break; return;
case PANNEL1__STATIC: case PANNEL1__STATIC:
case PANNEL2__STATIC: case PANNEL2__STATIC:
PN(spriteNum) = BPANNEL1; PN(spriteNum) = BPANNEL1;
CS(spriteNum) &= (65535-256-1); CS(spriteNum) &= (65535-256-1);
A_PlaySound(VENT_BUST,spriteNum); A_PlaySound(VENT_BUST,spriteNum);
break; return;
case PANNEL3__STATIC: case PANNEL3__STATIC:
PN(spriteNum) = BPANNEL3; PN(spriteNum) = BPANNEL3;
CS(spriteNum) &= (65535-256-1); CS(spriteNum) &= (65535-256-1);
A_PlaySound(VENT_BUST,spriteNum); A_PlaySound(VENT_BUST,spriteNum);
break; return;
case PIPE1__STATIC: case PIPE1__STATIC:
case PIPE2__STATIC: case PIPE2__STATIC:
@ -2240,7 +2240,7 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc)
int newSprite = A_Spawn(spriteNum, STEAM); int newSprite = A_Spawn(spriteNum, STEAM);
sprite[newSprite].z = sector[SECT(spriteNum)].floorz-ZOFFSET5; sprite[newSprite].z = sector[SECT(spriteNum)].floorz-ZOFFSET5;
break; return;
} }
case MONK__STATIC: case MONK__STATIC:
@ -2252,7 +2252,8 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc)
fallthrough__; fallthrough__;
case SPACEMARINE__STATIC: case SPACEMARINE__STATIC:
sprite[spriteNum].extra -= sprite[dmgSrc].extra; sprite[spriteNum].extra -= sprite[dmgSrc].extra;
if (sprite[spriteNum].extra > 0) break; if (sprite[spriteNum].extra > 0)
return;
SA(spriteNum) = krand()&2047; SA(spriteNum) = krand()&2047;
A_Shoot(spriteNum,BLOODSPLAT1); A_Shoot(spriteNum,BLOODSPLAT1);
SA(spriteNum) = krand()&2047; SA(spriteNum) = krand()&2047;
@ -2277,13 +2278,13 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc)
A_DoGuts(spriteNum,JIBS3,6); A_DoGuts(spriteNum,JIBS3,6);
S_PlaySound(SQUISHED); S_PlaySound(SQUISHED);
A_DeleteSprite(spriteNum); A_DeleteSprite(spriteNum);
break; return;
case CHAIR1__STATIC: case CHAIR1__STATIC:
case CHAIR2__STATIC: case CHAIR2__STATIC:
PN(spriteNum) = BROKENCHAIR; PN(spriteNum) = BROKENCHAIR;
CS(spriteNum) = 0; CS(spriteNum) = 0;
break; return;
case CHAIR3__STATIC: case CHAIR3__STATIC:
case MOVIECAMERA__STATIC: case MOVIECAMERA__STATIC:
@ -2302,101 +2303,104 @@ void A_DamageObject_Duke3D(int spriteNum, int const dmgSrc)
RANDOMSCRAP(pSprite, spriteNum); RANDOMSCRAP(pSprite, spriteNum);
} }
A_DeleteSprite(spriteNum); A_DeleteSprite(spriteNum);
break; return;
case PLAYERONWATER__STATIC: case PLAYERONWATER__STATIC:
spriteNum = OW(spriteNum); spriteNum = OW(spriteNum);
fallthrough__; fallthrough__;
default: default:
if ((sprite[spriteNum].cstat&16) && SHT(spriteNum) == 0 && SLT(spriteNum) == 0 && sprite[spriteNum].statnum == STAT_DEFAULT) break; // NOT return
break; }
if ((sprite[dmgSrc].picnum == FREEZEBLAST || sprite[dmgSrc].owner != spriteNum) && sprite[spriteNum].statnum != STAT_PROJECTILE) // implementation of the default case
if ((sprite[spriteNum].cstat&16) && SHT(spriteNum) == 0 && SLT(spriteNum) == 0 && sprite[spriteNum].statnum == STAT_DEFAULT)
return;
if ((sprite[dmgSrc].picnum == FREEZEBLAST || sprite[dmgSrc].owner != spriteNum) && sprite[spriteNum].statnum != STAT_PROJECTILE)
{
if (A_CheckEnemySprite(&sprite[spriteNum]) == 1)
{ {
if (A_CheckEnemySprite(&sprite[spriteNum]) == 1) if (sprite[dmgSrc].picnum == RPG)
{ sprite[dmgSrc].extra <<= 1;
if (sprite[dmgSrc].picnum == RPG)
sprite[dmgSrc].extra <<= 1;
if ((PN(spriteNum) != DRONE) && (PN(spriteNum) != ROTATEGUN) && (PN(spriteNum) != COMMANDER) if ((PN(spriteNum) != DRONE) && (PN(spriteNum) != ROTATEGUN) && (PN(spriteNum) != COMMANDER)
&& (PN(spriteNum) < GREENSLIME || PN(spriteNum) > GREENSLIME + 7)) && (PN(spriteNum) < GREENSLIME || PN(spriteNum) > GREENSLIME + 7))
if (sprite[dmgSrc].picnum != FREEZEBLAST) if (sprite[dmgSrc].picnum != FREEZEBLAST)
if (!A_CheckSpriteFlags(spriteNum, SFLAG_BADGUY) || A_CheckSpriteFlags(spriteNum, SFLAG_HURTSPAWNBLOOD)) if (!A_CheckSpriteFlags(spriteNum, SFLAG_BADGUY) || A_CheckSpriteFlags(spriteNum, SFLAG_HURTSPAWNBLOOD))
{
int const newSprite = A_Spawn(dmgSrc, JIBS6);
sprite[newSprite].z += ZOFFSET6;
if (sprite[dmgSrc].pal == 6)
sprite[newSprite].pal = 6;
sprite[newSprite].xvel = 16;
sprite[newSprite].xrepeat = sprite[newSprite].yrepeat = 24;
sprite[newSprite].ang += 32 - (krand() & 63);
}
int const damageOwner = sprite[dmgSrc].owner;
if (damageOwner >= 0 && sprite[damageOwner].picnum == APLAYER && PN(spriteNum) != ROTATEGUN && PN(spriteNum) != DRONE)
if (g_player[P_Get(damageOwner)].ps->curr_weapon == SHOTGUN_WEAPON)
if (!A_CheckSpriteFlags(spriteNum, SFLAG_BADGUY) || A_CheckSpriteFlags(spriteNum, SFLAG_HURTSPAWNBLOOD))
{
A_Shoot(spriteNum, BLOODSPLAT3);
A_Shoot(spriteNum, BLOODSPLAT1);
A_Shoot(spriteNum, BLOODSPLAT2);
A_Shoot(spriteNum, BLOODSPLAT4);
}
if (!A_CheckSpriteFlags(spriteNum, SFLAG_NODAMAGEPUSH))
{
if (sprite[spriteNum].extra > 0)
{ {
if ((sprite[spriteNum].cstat & 48) == 0) int const newSprite = A_Spawn(dmgSrc, JIBS6);
SA(spriteNum) = (sprite[dmgSrc].ang + 1024) & 2047; sprite[newSprite].z += ZOFFSET6;
sprite[spriteNum].xvel = -(sprite[dmgSrc].extra << 2); if (sprite[dmgSrc].pal == 6)
int16_t sectNum = SECT(spriteNum); sprite[newSprite].pal = 6;
pushmove(&sprite[spriteNum].pos, &sectNum, 128L, (4L << 8), (4L << 8), CLIPMASK0); sprite[newSprite].xvel = 16;
if (sectNum != SECT(spriteNum) && (unsigned)sectNum < MAXSECTORS) sprite[newSprite].xrepeat = sprite[newSprite].yrepeat = 24;
changespritesect(spriteNum, sectNum); sprite[newSprite].ang += 32 - (krand() & 63);
} }
}
if (sprite[spriteNum].statnum == STAT_ZOMBIEACTOR) int const damageOwner = sprite[dmgSrc].owner;
if (damageOwner >= 0 && sprite[damageOwner].picnum == APLAYER && PN(spriteNum) != ROTATEGUN && PN(spriteNum) != DRONE)
if (g_player[P_Get(damageOwner)].ps->curr_weapon == SHOTGUN_WEAPON)
if (!A_CheckSpriteFlags(spriteNum, SFLAG_BADGUY) || A_CheckSpriteFlags(spriteNum, SFLAG_HURTSPAWNBLOOD))
{
A_Shoot(spriteNum, BLOODSPLAT3);
A_Shoot(spriteNum, BLOODSPLAT1);
A_Shoot(spriteNum, BLOODSPLAT2);
A_Shoot(spriteNum, BLOODSPLAT4);
}
if (!A_CheckSpriteFlags(spriteNum, SFLAG_NODAMAGEPUSH))
{
if (sprite[spriteNum].extra > 0)
{ {
changespritestat(spriteNum, STAT_ACTOR); if ((sprite[spriteNum].cstat & 48) == 0)
actor[spriteNum].timetosleep = SLEEPTIME; SA(spriteNum) = (sprite[dmgSrc].ang + 1024) & 2047;
sprite[spriteNum].xvel = -(sprite[dmgSrc].extra << 2);
int16_t sectNum = SECT(spriteNum);
pushmove(&sprite[spriteNum].pos, &sectNum, 128L, (4L << 8), (4L << 8), CLIPMASK0);
if (sectNum != SECT(spriteNum) && (unsigned)sectNum < MAXSECTORS)
changespritesect(spriteNum, sectNum);
} }
if ((sprite[spriteNum].xrepeat < 24 || PN(spriteNum) == SHARK) && sprite[dmgSrc].picnum == SHRINKSPARK)
return;
} }
if (sprite[spriteNum].statnum != STAT_ZOMBIEACTOR) if (sprite[spriteNum].statnum == STAT_ZOMBIEACTOR)
{ {
if (sprite[dmgSrc].picnum == FREEZEBLAST && ((PN(spriteNum) == APLAYER && sprite[spriteNum].pal == 1) || (g_freezerSelfDamage == 0 && sprite[dmgSrc].owner == spriteNum))) changespritestat(spriteNum, STAT_ACTOR);
return; actor[spriteNum].timetosleep = SLEEPTIME;
actor[spriteNum].picnum = sprite[dmgSrc].picnum;
actor[spriteNum].extra += sprite[dmgSrc].extra;
actor[spriteNum].ang = sprite[dmgSrc].ang;
actor[spriteNum].owner = sprite[dmgSrc].owner;
if(A_CheckSpriteFlags(spriteNum, SFLAG_DAMAGEEVENT))
VM_OnEventWithReturn(EVENT_POSTDAMAGESPRITE, dmgSrc, -1, spriteNum);
}
if (sprite[spriteNum].statnum == STAT_PLAYER)
{
auto ps = g_player[P_Get(spriteNum)].ps;
if (ps->newowner >= 0)
G_ClearCameraView(ps);
if (sprite[spriteNum].xrepeat < 24 && sprite[dmgSrc].picnum == SHRINKSPARK)
return;
if (sprite[actor[spriteNum].owner].picnum != APLAYER)
if (ud.player_skill >= 3)
sprite[dmgSrc].extra += (sprite[dmgSrc].extra>>1);
} }
if ((sprite[spriteNum].xrepeat < 24 || PN(spriteNum) == SHARK) && sprite[dmgSrc].picnum == SHRINKSPARK)
return;
} }
break; if (sprite[spriteNum].statnum != STAT_ZOMBIEACTOR)
{
if (sprite[dmgSrc].picnum == FREEZEBLAST && ((PN(spriteNum) == APLAYER && sprite[spriteNum].pal == 1) || (g_freezerSelfDamage == 0 && sprite[dmgSrc].owner == spriteNum)))
return;
actor[spriteNum].picnum = sprite[dmgSrc].picnum;
actor[spriteNum].extra += sprite[dmgSrc].extra;
actor[spriteNum].ang = sprite[dmgSrc].ang;
actor[spriteNum].owner = sprite[dmgSrc].owner;
if(A_CheckSpriteFlags(spriteNum, SFLAG_DAMAGEEVENT))
VM_OnEventWithReturn(EVENT_POSTDAMAGESPRITE, dmgSrc, -1, spriteNum);
}
if (sprite[spriteNum].statnum == STAT_PLAYER)
{
auto ps = g_player[P_Get(spriteNum)].ps;
if (ps->newowner >= 0)
G_ClearCameraView(ps);
if (sprite[spriteNum].xrepeat < 24 && sprite[dmgSrc].picnum == SHRINKSPARK)
return;
if (sprite[actor[spriteNum].owner].picnum != APLAYER)
if (ud.player_skill >= 3)
sprite[dmgSrc].extra += (sprite[dmgSrc].extra>>1);
}
} }
} }
#endif #endif