Generalize Sect_DamageCeiling to Sect_DamageCeilingOrFloor, use appropriately.

- in the function itself: for floor, currently, do nothing (but this commit
  is in preparation of the next one, again)
- In Proj_MaybeDamageCF(), Proj_MaybeDamageCF2() and the A_RadiusDamage() use
  if the function, generalize to floors, but with the special case that
  parallaxed floors keep blocking projectiles, as before (in constrast to
  parallaxed ceilings). However, Sect_DamageCeilingOrFloor() is only
  called for non-parallaxed ceilings *and* floors.

git-svn-id: https://svn.eduke32.com/eduke32@4205 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-12-20 18:31:29 +00:00
parent 99894812d8
commit f10e1b1a16
4 changed files with 41 additions and 10 deletions

View file

@ -143,15 +143,19 @@ void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t hp3,
const int32_t dasect = sectorlist[sectcnt++];
const int32_t startwall = sector[dasect].wallptr;
const int32_t endwall = startwall+sector[dasect].wallnum;
int32_t w;
if (((sector[dasect].ceilingz-s->z)>>8) < r)
{
int32_t w;
const int32_t w2 = wall[startwall].point2;
// Check if "hit" 1st or 3rd wall-point. This mainly makes sense
// for rectangular "ceiling light"-style sectors.
if (G_WallSpriteDist(&wall[startwall], s) < r ||
G_WallSpriteDist(&wall[wall[w2].point2], s) < r)
Sect_DamageCeiling(dasect);
{
if (((sector[dasect].ceilingz-s->z)>>8) < r)
Sect_DamageCeilingOrFloor(0, dasect);
if (((s->z-sector[dasect].floorz)>>8) < r)
Sect_DamageCeilingOrFloor(1, dasect);
}
for (w=startwall,wal=&wall[startwall]; w<endwall; w++,wal++)
@ -2662,7 +2666,18 @@ static int32_t Proj_MaybeDamageCF(const spritetype *s)
if ((sector[s->sectnum].ceilingstat&1) && sector[s->sectnum].ceilingpal == 0)
return 1;
Sect_DamageCeiling(s->sectnum);
Sect_DamageCeilingOrFloor(0, s->sectnum);
}
else if (s->zvel > 0)
{
if ((sector[s->sectnum].floorstat&1) && sector[s->sectnum].floorpal == 0)
{
// Keep original Duke3D behavior: pass projectiles through
// parallaxed ceilings, but NOT through such floors.
return 0;
}
Sect_DamageCeilingOrFloor(1, s->sectnum);
}
return 0;

View file

@ -611,7 +611,20 @@ static int32_t Proj_MaybeDamageCF2(int32_t zvel, int32_t hitsect)
if (sector[hitsect].ceilingstat&1)
return 1;
Sect_DamageCeiling(hitsect);
Sect_DamageCeilingOrFloor(0, hitsect);
}
else if (zvel > 0)
{
Bassert(hitsect >= 0);
if (sector[hitsect].floorstat&1)
{
// Keep original Duke3D behavior: pass projectiles through
// parallaxed ceilings, but NOT through such floors.
return 0;
}
Sect_DamageCeilingOrFloor(1, hitsect);
}
return 0;

View file

@ -1874,10 +1874,13 @@ void A_DamageWall(int32_t spr,int32_t dawallnum,const vec3_t *pos,int32_t atwith
}
}
int32_t Sect_DamageCeiling(int32_t sn)
int32_t Sect_DamageCeilingOrFloor(int32_t floorp, int32_t sn)
{
int32_t i, j;
if (floorp)
return 0;
switch (DYNAMICTILEMAP(sector[sn].ceilingpicnum))
{
case WALLLIGHT1__STATIC:

View file

@ -128,7 +128,7 @@ int32_t ldist(const spritetype *s1, const spritetype *s2);
int32_t dist(const spritetype *s1, const spritetype *s2);
int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchissprite);
void P_CheckSectors(int32_t snum);
int32_t Sect_DamageCeiling(int32_t sn);
int32_t Sect_DamageCeilingOrFloor(int32_t floorp, int32_t sn);
int32_t SetAnimation(int32_t animsect,int32_t *animptr,int32_t thegoal,int32_t thevel);
#include "sector_inline.h"