More misc small cleanups. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@6246 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2017-06-23 09:16:33 +00:00
parent ac2f2bd902
commit 81ac537bd1
3 changed files with 55 additions and 67 deletions

View file

@ -1537,7 +1537,7 @@ ACTOR_STATIC void G_MoveFallers(void)
if ((sector[sectNum].floorz-pSprite->z) < ZOFFSET2) if ((sector[sectNum].floorz-pSprite->z) < ZOFFSET2)
{ {
for (bsize_t x=0; x<1+(krand()&7); ++x) for (bssize_t x=0; x<1+(krand()&7); ++x)
RANDOMSCRAP(pSprite, spriteNum); RANDOMSCRAP(pSprite, spriteNum);
DELETE_SPRITE_AND_CONTINUE(spriteNum); DELETE_SPRITE_AND_CONTINUE(spriteNum);
} }

View file

@ -1604,7 +1604,7 @@ void A_DamageWall(int spriteNum, int wallNum, const vec3_t *vPos, int weaponNum)
A_PlaySound(GLASS_BREAKING, spriteNum); A_PlaySound(GLASS_BREAKING, spriteNum);
return; return;
} }
} }
switch (DYNAMICTILEMAP(pWall->picnum)) switch (DYNAMICTILEMAP(pWall->picnum))
{ {
@ -1755,17 +1755,17 @@ void A_DamageWall(int spriteNum, int wallNum, const vec3_t *vPos, int weaponNum)
} }
// NOTE: return value never examined in any of the callers. // NOTE: return value never examined in any of the callers.
int Sect_DamageCeilingOrFloor(int damageFloor, int const sectNum) int Sect_DamageCeilingOrFloor(int const dmgFloor, int const sectNum)
{ {
// NOTE: pass RETURN in the dist argument, too. // NOTE: pass RETURN in the dist argument, too.
int const RETURN_in = damageFloor ? 131072 + sectNum : 65536 + sectNum; int const RETURN_in = dmgFloor ? 131072 + sectNum : 65536 + sectNum;
int32_t const returnValue = int32_t const returnValue =
VM_OnEventWithBoth(EVENT_DAMAGEHPLANE, g_player[screenpeek].ps->i, screenpeek, RETURN_in, RETURN_in); VM_OnEventWithBoth(EVENT_DAMAGEHPLANE, g_player[screenpeek].ps->i, screenpeek, RETURN_in, RETURN_in);
if (returnValue < 0) if (returnValue < 0)
return 0; return 0;
if (damageFloor) if (dmgFloor)
return 0; return 0;
int16_t * const pPicnum = &sector[sectNum].ceilingpicnum; int16_t * const pPicnum = &sector[sectNum].ceilingpicnum;
@ -1822,21 +1822,19 @@ int Sect_DamageCeilingOrFloor(int damageFloor, int const sectNum)
} }
// hard coded props... :( // hard coded props... :(
void A_DamageObject(int32_t spriteNum, int32_t damageSrc) void A_DamageObject(int spriteNum, int const dmgSrc)
{ {
int32_t isRPG=0;
spritetype *pSprite;
if (g_netClient) if (g_netClient)
{
return; return;
}
int radiusDamage = 0;
spriteNum &= (MAXSPRITES-1); spriteNum &= (MAXSPRITES-1);
spritetype *pSprite = &sprite[spriteNum];
if (A_CheckSpriteFlags(damageSrc,SFLAG_PROJECTILE)) if (A_CheckSpriteFlags(dmgSrc,SFLAG_PROJECTILE))
if (SpriteProjectile[damageSrc].workslike & PROJECTILE_RPG) if (SpriteProjectile[dmgSrc].workslike & PROJECTILE_RPG)
isRPG = 1; radiusDamage = 1;
switch (DYNAMICTILEMAP(PN(spriteNum))) switch (DYNAMICTILEMAP(PN(spriteNum)))
{ {
@ -1851,11 +1849,11 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc)
case QUEBALL__STATIC: case QUEBALL__STATIC:
case STRIPEBALL__STATIC: case STRIPEBALL__STATIC:
if (sprite[damageSrc].picnum == QUEBALL || sprite[damageSrc].picnum == STRIPEBALL) if (sprite[dmgSrc].picnum == QUEBALL || sprite[dmgSrc].picnum == STRIPEBALL)
{ {
sprite[damageSrc].xvel = (sprite[spriteNum].xvel>>1)+(sprite[spriteNum].xvel>>2); sprite[dmgSrc].xvel = (sprite[spriteNum].xvel>>1)+(sprite[spriteNum].xvel>>2);
sprite[damageSrc].ang -= (SA(spriteNum)<<1)+1024; sprite[dmgSrc].ang -= (SA(spriteNum)<<1)+1024;
SA(spriteNum) = getangle(SX(spriteNum)-sprite[damageSrc].x,SY(spriteNum)-sprite[damageSrc].y)-512; SA(spriteNum) = getangle(SX(spriteNum)-sprite[dmgSrc].x,SY(spriteNum)-sprite[dmgSrc].y)-512;
if (S_CheckSoundPlaying(spriteNum,POOLBALLHIT) < 2) if (S_CheckSoundPlaying(spriteNum,POOLBALLHIT) < 2)
A_PlaySound(POOLBALLHIT,spriteNum); A_PlaySound(POOLBALLHIT,spriteNum);
} }
@ -1864,7 +1862,7 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc)
if (krand()&3) if (krand()&3)
{ {
sprite[spriteNum].xvel = 164; sprite[spriteNum].xvel = 164;
sprite[spriteNum].ang = sprite[damageSrc].ang; sprite[spriteNum].ang = sprite[dmgSrc].ang;
} }
else else
{ {
@ -1880,62 +1878,53 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc)
case CONE__STATIC: case CONE__STATIC:
case BOX__STATIC: case BOX__STATIC:
{ {
if (isRPG == 1) switch (DYNAMICTILEMAP(sprite[dmgSrc].picnum))
if (T1(spriteNum) == 0)
{
CS(spriteNum) &= ~257;
T1(spriteNum) = 1;
A_Spawn(spriteNum,BURNING);
}
switch (DYNAMICTILEMAP(sprite[damageSrc].picnum))
{ {
case RADIUSEXPLOSION__STATIC: case RADIUSEXPLOSION__STATIC:
case RPG__STATIC: case RPG__STATIC:
case FIRELASER__STATIC: case FIRELASER__STATIC:
case HYDRENT__STATIC: case HYDRENT__STATIC:
case HEAVYHBOMB__STATIC: case HEAVYHBOMB__STATIC:
radiusDamage = 1;
break;
}
if (radiusDamage == 1)
if (T1(spriteNum) == 0) if (T1(spriteNum) == 0)
{ {
CS(spriteNum) &= ~257; CS(spriteNum) &= ~257;
T1(spriteNum) = 1; T1(spriteNum) = 1;
A_Spawn(spriteNum,BURNING); A_Spawn(spriteNum,BURNING);
} }
break;
}
break; break;
} }
case CACTUS__STATIC: case CACTUS__STATIC:
{ {
if (isRPG == 1) switch (DYNAMICTILEMAP(sprite[dmgSrc].picnum))
for (bssize_t k=64; k>0; k--)
{
int newSprite =
A_InsertSprite(SECT(spriteNum), SX(spriteNum), SY(spriteNum), SZ(spriteNum) - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48,
krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (sprite[spriteNum].zvel >> 2), spriteNum, 5);
sprite[newSprite].pal = 8;
}
// case CACTUSBROKE:
switch (DYNAMICTILEMAP(sprite[damageSrc].picnum))
{ {
case RADIUSEXPLOSION__STATIC: case RADIUSEXPLOSION__STATIC:
case RPG__STATIC: case RPG__STATIC:
case FIRELASER__STATIC: case FIRELASER__STATIC:
case HYDRENT__STATIC: case HYDRENT__STATIC:
case HEAVYHBOMB__STATIC: case HEAVYHBOMB__STATIC:
radiusDamage = 1;
break;
}
if (radiusDamage == 1)
{
for (bssize_t k=64; k>0; k--) for (bssize_t k=64; k>0; k--)
{ {
int newSprite = int newSprite =
A_InsertSprite(SECT(spriteNum), SX(spriteNum), SY(spriteNum), SZ(spriteNum) - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, A_InsertSprite(SECT(spriteNum), SX(spriteNum), SY(spriteNum), SZ(spriteNum) - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48,
krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (sprite[spriteNum].zvel >> 2), spriteNum, 5); krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (sprite[spriteNum].zvel >> 2), spriteNum, 5);
sprite[newSprite].pal = 8; sprite[newSprite].pal = 8;
} }
// case CACTUSBROKE:
if (PN(spriteNum) == CACTUS) if (PN(spriteNum) == CACTUS)
PN(spriteNum) = CACTUSBROKE; PN(spriteNum) = CACTUSBROKE;
CS(spriteNum) &= ~257; CS(spriteNum) &= ~257;
// else A_DeleteSprite(i);
break;
} }
break; break;
} }
@ -1955,7 +1944,7 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc)
sector[SECT(spriteNum)].floorpicnum = FANSHADOWBROKE; sector[SECT(spriteNum)].floorpicnum = FANSHADOWBROKE;
A_PlaySound(GLASS_HEAVYBREAK,spriteNum); A_PlaySound(GLASS_HEAVYBREAK,spriteNum);
pSprite = &sprite[spriteNum];
for (bssize_t j=16; j>0; j--) for (bssize_t j=16; j>0; j--)
RANDOMSCRAP(pSprite, spriteNum); RANDOMSCRAP(pSprite, spriteNum);
@ -1972,7 +1961,7 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc)
case FUELPOD__STATIC: case FUELPOD__STATIC:
case SOLARPANNEL__STATIC: case SOLARPANNEL__STATIC:
case ANTENNA__STATIC: case ANTENNA__STATIC:
if (sprite[damageSrc].extra != G_DefaultActorHealth(SHOTSPARK1)) if (sprite[dmgSrc].extra != G_DefaultActorHealth(SHOTSPARK1))
{ {
for (bssize_t j=15; j>0; j--) for (bssize_t j=15; j>0; j--)
A_InsertSprite(SECT(spriteNum),SX(spriteNum),SY(spriteNum),sector[SECT(spriteNum)].floorz-ZOFFSET4-(j<<9),SCRAP1+(krand()&15),-8,64,64, A_InsertSprite(SECT(spriteNum),SX(spriteNum),SY(spriteNum),sector[SECT(spriteNum)].floorz-ZOFFSET4-(j<<9),SCRAP1+(krand()&15),-8,64,64,
@ -2162,7 +2151,7 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc)
A_Spawn(spriteNum,SHT(spriteNum)); A_Spawn(spriteNum,SHT(spriteNum));
/* fall-through */ /* fall-through */
case SPACEMARINE__STATIC: case SPACEMARINE__STATIC:
sprite[spriteNum].extra -= sprite[damageSrc].extra; sprite[spriteNum].extra -= sprite[dmgSrc].extra;
if (sprite[spriteNum].extra > 0) break; if (sprite[spriteNum].extra > 0) break;
SA(spriteNum) = krand()&2047; SA(spriteNum) = krand()&2047;
A_Shoot(spriteNum,BLOODSPLAT1); A_Shoot(spriteNum,BLOODSPLAT1);
@ -2207,7 +2196,6 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc)
case POT3__STATIC: case POT3__STATIC:
case TRIPODCAMERA__STATIC: case TRIPODCAMERA__STATIC:
A_PlaySound(GLASS_HEAVYBREAK,spriteNum); A_PlaySound(GLASS_HEAVYBREAK,spriteNum);
pSprite = &sprite[spriteNum];
for (bssize_t j=16; j>0; j--) for (bssize_t j=16; j>0; j--)
RANDOMSCRAP(pSprite, spriteNum); RANDOMSCRAP(pSprite, spriteNum);
A_DeleteSprite(spriteNum); A_DeleteSprite(spriteNum);
@ -2220,27 +2208,27 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc)
if ((sprite[spriteNum].cstat&16) && SHT(spriteNum) == 0 && SLT(spriteNum) == 0 && sprite[spriteNum].statnum == STAT_DEFAULT) if ((sprite[spriteNum].cstat&16) && SHT(spriteNum) == 0 && SLT(spriteNum) == 0 && sprite[spriteNum].statnum == STAT_DEFAULT)
break; break;
if ((sprite[damageSrc].picnum == FREEZEBLAST || sprite[damageSrc].owner != spriteNum) && sprite[spriteNum].statnum != STAT_PROJECTILE) 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[damageSrc].picnum == RPG) if (sprite[dmgSrc].picnum == RPG)
sprite[damageSrc].extra <<= 1; sprite[dmgSrc].extra <<= 1;
if ((PN(spriteNum) != DRONE) && (PN(spriteNum) != ROTATEGUN) && (PN(spriteNum) != COMMANDER) && (PN(spriteNum) < GREENSLIME || PN(spriteNum) > GREENSLIME+7)) if ((PN(spriteNum) != DRONE) && (PN(spriteNum) != ROTATEGUN) && (PN(spriteNum) != COMMANDER) && (PN(spriteNum) < GREENSLIME || PN(spriteNum) > GREENSLIME+7))
if (sprite[damageSrc].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(damageSrc, JIBS6); int const newSprite = A_Spawn(dmgSrc, JIBS6);
sprite[newSprite].z += ZOFFSET6; sprite[newSprite].z += ZOFFSET6;
if (sprite[damageSrc].pal == 6) if (sprite[dmgSrc].pal == 6)
sprite[newSprite].pal = 6; sprite[newSprite].pal = 6;
sprite[newSprite].xvel = 16; sprite[newSprite].xvel = 16;
sprite[newSprite].xrepeat = sprite[newSprite].yrepeat = 24; sprite[newSprite].xrepeat = sprite[newSprite].yrepeat = 24;
sprite[newSprite].ang += 32 - (krand() & 63); sprite[newSprite].ang += 32 - (krand() & 63);
} }
int const damageOwner = sprite[damageSrc].owner; int const damageOwner = sprite[dmgSrc].owner;
if (damageOwner >= 0 && sprite[damageOwner].picnum == APLAYER && PN(spriteNum) != ROTATEGUN && PN(spriteNum) != DRONE) 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 (g_player[P_Get(damageOwner)].ps->curr_weapon == SHOTGUN_WEAPON)
@ -2257,8 +2245,8 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc)
if (sprite[spriteNum].extra > 0) if (sprite[spriteNum].extra > 0)
{ {
if ((sprite[spriteNum].cstat & 48) == 0) if ((sprite[spriteNum].cstat & 48) == 0)
SA(spriteNum) = (sprite[damageSrc].ang + 1024) & 2047; SA(spriteNum) = (sprite[dmgSrc].ang + 1024) & 2047;
sprite[spriteNum].xvel = -(sprite[damageSrc].extra << 2); sprite[spriteNum].xvel = -(sprite[dmgSrc].extra << 2);
int16_t sectNum = SECT(spriteNum); int16_t sectNum = SECT(spriteNum);
pushmove((vec3_t *)&sprite[spriteNum], &sectNum, 128L, (4L << 8), (4L << 8), CLIPMASK0); pushmove((vec3_t *)&sprite[spriteNum], &sectNum, 128L, (4L << 8), (4L << 8), CLIPMASK0);
if (sectNum != SECT(spriteNum) && (unsigned)sectNum < MAXSECTORS) if (sectNum != SECT(spriteNum) && (unsigned)sectNum < MAXSECTORS)
@ -2272,19 +2260,19 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc)
actor[spriteNum].timetosleep = SLEEPTIME; actor[spriteNum].timetosleep = SLEEPTIME;
} }
if ((sprite[spriteNum].xrepeat < 24 || PN(spriteNum) == SHARK) && sprite[damageSrc].picnum == SHRINKSPARK) if ((sprite[spriteNum].xrepeat < 24 || PN(spriteNum) == SHARK) && sprite[dmgSrc].picnum == SHRINKSPARK)
return; return;
} }
if (sprite[spriteNum].statnum != STAT_ZOMBIEACTOR) if (sprite[spriteNum].statnum != STAT_ZOMBIEACTOR)
{ {
if (sprite[damageSrc].picnum == FREEZEBLAST && ((PN(spriteNum) == APLAYER && sprite[spriteNum].pal == 1) || (g_freezerSelfDamage == 0 && sprite[damageSrc].owner == spriteNum))) if (sprite[dmgSrc].picnum == FREEZEBLAST && ((PN(spriteNum) == APLAYER && sprite[spriteNum].pal == 1) || (g_freezerSelfDamage == 0 && sprite[dmgSrc].owner == spriteNum)))
return; return;
actor[spriteNum].picnum = sprite[damageSrc].picnum; actor[spriteNum].picnum = sprite[dmgSrc].picnum;
actor[spriteNum].extra += sprite[damageSrc].extra; actor[spriteNum].extra += sprite[dmgSrc].extra;
actor[spriteNum].ang = sprite[damageSrc].ang; actor[spriteNum].ang = sprite[dmgSrc].ang;
actor[spriteNum].owner = sprite[damageSrc].owner; actor[spriteNum].owner = sprite[dmgSrc].owner;
} }
if (sprite[spriteNum].statnum == STAT_PLAYER) if (sprite[spriteNum].statnum == STAT_PLAYER)
@ -2294,12 +2282,12 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc)
if (ps->newowner >= 0) if (ps->newowner >= 0)
G_ClearCameraView(ps); G_ClearCameraView(ps);
if (sprite[spriteNum].xrepeat < 24 && sprite[damageSrc].picnum == SHRINKSPARK) if (sprite[spriteNum].xrepeat < 24 && sprite[dmgSrc].picnum == SHRINKSPARK)
return; return;
if (sprite[actor[spriteNum].owner].picnum != APLAYER) if (sprite[actor[spriteNum].owner].picnum != APLAYER)
if (ud.player_skill >= 3) if (ud.player_skill >= 3)
sprite[damageSrc].extra += (sprite[damageSrc].extra>>1); sprite[dmgSrc].extra += (sprite[dmgSrc].extra>>1);
} }
} }

View file

@ -114,7 +114,7 @@ void G_ActivateBySector(int sect,int j);
int S_FindMusicSFX(int sectNum, int *sndptr); int S_FindMusicSFX(int sectNum, int *sndptr);
int A_CallSound(int sectNum,int spriteNum); int A_CallSound(int sectNum,int spriteNum);
int A_CheckHitSprite(int spriteNum,int16_t *hitSprite); int A_CheckHitSprite(int spriteNum,int16_t *hitSprite);
void A_DamageObject(int32_t i,int32_t sn); void A_DamageObject(int spriteNum,int const dmgSrc);
void A_DamageWall(int spr,int dawallnum,const vec3_t *pos,int atwith); void A_DamageWall(int spr,int dawallnum,const vec3_t *pos,int atwith);
int __fastcall A_FindPlayer(const spritetype *pSprite,int32_t *dist); int __fastcall A_FindPlayer(const spritetype *pSprite,int32_t *dist);
void G_AlignWarpElevators(void); void G_AlignWarpElevators(void);
@ -135,7 +135,7 @@ int isanearoperator(int lotag);
int isanunderoperator(int lotag); int isanunderoperator(int lotag);
int P_ActivateSwitch(int playerNum, int nObject, int nSwitchType); int P_ActivateSwitch(int playerNum, int nObject, int nSwitchType);
void P_CheckSectors(int snum); void P_CheckSectors(int snum);
int Sect_DamageCeilingOrFloor(int nDmgFloor, int const nSectnum); int Sect_DamageCeilingOrFloor(int const dmgFloor, int const sectNum);
int SetAnimation(int sectNum,int32_t *animPtr,int goalVal,int animVel); int SetAnimation(int sectNum,int32_t *animPtr,int goalVal,int animVel);
#define FORCEFIELD_CSTAT (64+16+4+1) #define FORCEFIELD_CSTAT (64+16+4+1)