mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 04:24:39 +00:00
- handled all sector iterators.
Again mostly cppy/paste.
This commit is contained in:
parent
0bd0477352
commit
a789fe97af
9 changed files with 115 additions and 98 deletions
|
@ -278,24 +278,25 @@ static void resurectfred(PLAYER& plr, short i) {
|
|||
|
||||
static void checkexplfred(PLAYER& plr, short i) {
|
||||
SPRITE& spr = sprite[i];
|
||||
short j = headspritesect[spr.sectnum];
|
||||
while (j != -1) {
|
||||
short nextj = nextspritesect[j];
|
||||
int dx = abs(spr.x - sprite[j].x); // x distance to sprite
|
||||
int dy = abs(spr.y - sprite[j].y); // y distance to sprite
|
||||
int dz = abs((spr.z >> 8) - (sprite[j].z >> 8)); // z distance to sprite
|
||||
int dh = tileHeight(sprite[j].picnum) >> 1; // height of sprite
|
||||
WHSectIterator it(spr.sectnum);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
SPRITE& tspr = actor->s();
|
||||
|
||||
int dx = abs(spr.x - tspr.x); // x distance to sprite
|
||||
int dy = abs(spr.y - tspr.y); // y distance to sprite
|
||||
int dz = abs((spr.z >> 8) - (tspr.z >> 8)); // z distance to sprite
|
||||
int dh = tileHeight(tspr.picnum) >> 1; // height of sprite
|
||||
if (dx + dy < PICKDISTANCE && dz - dh <= getPickHeight()) {
|
||||
if (sprite[j].picnum == EXPLO2
|
||||
|| sprite[j].picnum == SMOKEFX
|
||||
|| sprite[j].picnum == MONSTERBALL) {
|
||||
if (tspr.picnum == EXPLO2
|
||||
|| tspr.picnum == SMOKEFX
|
||||
|| tspr.picnum == MONSTERBALL) {
|
||||
spr.hitag -= TICSPERFRAME << 2;
|
||||
if (spr.hitag < 0) {
|
||||
newstatus(i, DIE);
|
||||
}
|
||||
}
|
||||
}
|
||||
j = nextj;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -673,23 +673,25 @@ static void gonzopike(short s, PLAYER& plr) {
|
|||
|
||||
static void checkexplgonzo(PLAYER& plr, short i) {
|
||||
SPRITE& spr = sprite[i];
|
||||
short j = headspritesect[spr.sectnum];
|
||||
while (j != -1) {
|
||||
short nextj = nextspritesect[j];
|
||||
long dx = abs(spr.x - sprite[j].x); // x distance to sprite
|
||||
long dy = abs(spr.y - sprite[j].y); // y distance to sprite
|
||||
long dz = abs((spr.z >> 8) - (sprite[j].z >> 8)); // z distance to sprite
|
||||
long dh = tileHeight(sprite[j].picnum) >> 1; // height of sprite
|
||||
WHSectIterator it(spr.sectnum);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
SPRITE& tspr = actor->s();
|
||||
int j = actor->GetSpriteIndex();
|
||||
|
||||
int dx = abs(spr.x - tspr.x); // x distance to sprite
|
||||
int dy = abs(spr.y - tspr.y); // y distance to sprite
|
||||
int dz = abs((spr.z >> 8) - (tspr.z >> 8)); // z distance to sprite
|
||||
int dh = tileHeight(tspr.picnum) >> 1; // height of sprite
|
||||
if (dx + dy < PICKDISTANCE && dz - dh <= getPickHeight()) {
|
||||
if (sprite[j].picnum == EXPLO2
|
||||
|| sprite[j].picnum == MONSTERBALL) {
|
||||
if (tspr.picnum == EXPLO2
|
||||
|| tspr.picnum == MONSTERBALL) {
|
||||
spr.hitag -= TICSPERFRAME << 2;
|
||||
if (spr.hitag < 0) {
|
||||
newstatus(i, DIE);
|
||||
}
|
||||
}
|
||||
}
|
||||
j = nextj;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -290,24 +290,26 @@ static void skirmishimp(PLAYER& plr, short i) {
|
|||
|
||||
static void checkexplimp(PLAYER& plr, short i) {
|
||||
SPRITE& spr = sprite[i];
|
||||
short j = headspritesect[spr.sectnum];
|
||||
while (j != -1) {
|
||||
short nextj = nextspritesect[j];
|
||||
int dx = abs(spr.x - sprite[j].x); // x distance to sprite
|
||||
int dy = abs(spr.y - sprite[j].y); // y distance to sprite
|
||||
int dz = abs((spr.z >> 8) - (sprite[j].z >> 8)); // z distance to sprite
|
||||
int dh = tileHeight(sprite[j].picnum) >> 1; // height of sprite
|
||||
WHSectIterator it(spr.sectnum);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
SPRITE& tspr = actor->s();
|
||||
int j = actor->GetSpriteIndex();
|
||||
|
||||
int dx = abs(spr.x - tspr.x); // x distance to sprite
|
||||
int dy = abs(spr.y - tspr.y); // y distance to sprite
|
||||
int dz = abs((spr.z >> 8) - (tspr.z >> 8)); // z distance to sprite
|
||||
int dh = tileHeight(tspr.picnum) >> 1; // height of sprite
|
||||
if (dx + dy < PICKDISTANCE && dz - dh <= getPickHeight()) {
|
||||
if (sprite[j].picnum == EXPLO2
|
||||
|| sprite[j].picnum == SMOKEFX
|
||||
|| sprite[j].picnum == MONSTERBALL) {
|
||||
if (tspr.picnum == EXPLO2
|
||||
|| tspr.picnum == SMOKEFX
|
||||
|| tspr.picnum == MONSTERBALL) {
|
||||
spr.hitag -= TICSPERFRAME << 2;
|
||||
if (spr.hitag < 0) {
|
||||
newstatus(i, DIE);
|
||||
}
|
||||
}
|
||||
}
|
||||
j = nextj;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -310,24 +310,26 @@ static void skirmishkobold(PLAYER& plr, short i) {
|
|||
|
||||
static void checkexplkobold(PLAYER& plr, short i) {
|
||||
SPRITE& spr = sprite[i];
|
||||
short j = headspritesect[spr.sectnum];
|
||||
while (j != -1) {
|
||||
short nextj = nextspritesect[j];
|
||||
int dx = abs(spr.x - sprite[j].x); // x distance to sprite
|
||||
int dy = abs(spr.y - sprite[j].y); // y distance to sprite
|
||||
int dz = abs((spr.z >> 8) - (sprite[j].z >> 8)); // z distance to sprite
|
||||
int dh = tileHeight(sprite[j].picnum) >> 1; // height of sprite
|
||||
WHSectIterator it(spr.sectnum);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
SPRITE& tspr = actor->s();
|
||||
int j = actor->GetSpriteIndex();
|
||||
|
||||
int dx = abs(spr.x - tspr.x); // x distance to sprite
|
||||
int dy = abs(spr.y - tspr.y); // y distance to sprite
|
||||
int dz = abs((spr.z >> 8) - (tspr.z >> 8)); // z distance to sprite
|
||||
int dh = tileHeight(tspr.picnum) >> 1; // height of sprite
|
||||
if (dx + dy < PICKDISTANCE && dz - dh <= getPickHeight()) {
|
||||
if (sprite[j].picnum == EXPLO2
|
||||
|| sprite[j].picnum == SMOKEFX
|
||||
|| sprite[j].picnum == MONSTERBALL) {
|
||||
if (tspr.picnum == EXPLO2
|
||||
|| tspr.picnum == SMOKEFX
|
||||
|| tspr.picnum == MONSTERBALL) {
|
||||
spr.hitag -= TICSPERFRAME << 2;
|
||||
if (spr.hitag < 0) {
|
||||
newstatus(i, DIE);
|
||||
}
|
||||
}
|
||||
}
|
||||
j = nextj;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,22 +34,24 @@ static void kurtExplo(PLAYER& plr, short i) {
|
|||
if (spr.lotag < 0)
|
||||
spr.lotag = 12;
|
||||
|
||||
short j = headspritesect[spr.sectnum];
|
||||
while (j != -1) {
|
||||
short nextj = nextspritesect[j];
|
||||
int dx = abs(spr.x - sprite[j].x); // x distance to sprite
|
||||
int dy = abs(spr.y - sprite[j].y); // y distance to sprite
|
||||
int dz = abs((spr.z >> 8) - (sprite[j].z >> 8)); // z distance to sprite
|
||||
int dh = tileHeight(sprite[j].picnum) >> 1; // height of sprite
|
||||
WHSectIterator it(spr.sectnum);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
SPRITE& tspr = actor->s();
|
||||
int j = actor->GetSpriteIndex();
|
||||
|
||||
int dx = abs(spr.x - tspr.x); // x distance to sprite
|
||||
int dy = abs(spr.y - tspr.y); // y distance to sprite
|
||||
int dz = abs((spr.z >> 8) - (tspr.z >> 8)); // z distance to sprite
|
||||
int dh = tileHeight(tspr.picnum) >> 1; // height of sprite
|
||||
if (dx + dy < PICKDISTANCE && dz - dh <= getPickHeight()) {
|
||||
if (sprite[j].detail == KURTTYPE) {
|
||||
sprite[j].hitag -= TICSPERFRAME << 4;
|
||||
if (sprite[j].hitag < 0) {
|
||||
if (tspr.detail == KURTTYPE) {
|
||||
tspr.hitag -= TICSPERFRAME << 4;
|
||||
if (tspr.hitag < 0) {
|
||||
newstatus(j, DIE);
|
||||
}
|
||||
}
|
||||
}
|
||||
j = nextj;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -307,24 +307,26 @@ static void searchminotaur(PLAYER& plr, short i) {
|
|||
|
||||
static void checkexplminotaur(PLAYER& plr, short i) {
|
||||
SPRITE& spr = sprite[i];
|
||||
short j = headspritesect[spr.sectnum];
|
||||
while (j != -1) {
|
||||
short nextj = nextspritesect[j];
|
||||
int dx = abs(spr.x - sprite[j].x); // x distance to sprite
|
||||
int dy = abs(spr.y - sprite[j].y); // y distance to sprite
|
||||
int dz = abs((spr.z >> 8) - (sprite[j].z >> 8)); // z distance to sprite
|
||||
int dh = tileHeight(sprite[j].picnum) >> 1; // height of sprite
|
||||
WHSectIterator it(spr.sectnum);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
SPRITE& tspr = actor->s();
|
||||
int j = actor->GetSpriteIndex();
|
||||
|
||||
int dx = abs(spr.x - tspr.x); // x distance to sprite
|
||||
int dy = abs(spr.y - tspr.y); // y distance to sprite
|
||||
int dz = abs((spr.z >> 8) - (tspr.z >> 8)); // z distance to sprite
|
||||
int dh = tileHeight(tspr.picnum) >> 1; // height of sprite
|
||||
if (dx + dy < PICKDISTANCE && dz - dh <= getPickHeight()) {
|
||||
if (sprite[j].picnum == EXPLO2
|
||||
|| sprite[j].picnum == SMOKEFX
|
||||
|| sprite[j].picnum == MONSTERBALL) {
|
||||
if (tspr.picnum == EXPLO2
|
||||
|| tspr.picnum == SMOKEFX
|
||||
|| tspr.picnum == MONSTERBALL) {
|
||||
spr.hitag -= TICSPERFRAME << 2;
|
||||
if (spr.hitag < 0) {
|
||||
newstatus(i, DIE);
|
||||
}
|
||||
}
|
||||
}
|
||||
j = nextj;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -331,24 +331,26 @@ void skeletonChill(PLAYER& plr, short i) {
|
|||
|
||||
static void checkexplskeleton(PLAYER& plr, short i) {
|
||||
SPRITE& spr = sprite[i];
|
||||
short j = headspritesect[spr.sectnum];
|
||||
while (j != -1) {
|
||||
short nextj = nextspritesect[j];
|
||||
int dx = abs(spr.x - sprite[j].x); // x distance to sprite
|
||||
int dy = abs(spr.y - sprite[j].y); // y distance to sprite
|
||||
int dz = abs((spr.z >> 8) - (sprite[j].z >> 8)); // z distance to sprite
|
||||
int dh = tileHeight(sprite[j].picnum) >> 1; // height of sprite
|
||||
WHSectIterator it(spr.sectnum);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
SPRITE& tspr = actor->s();
|
||||
int j = actor->GetSpriteIndex();
|
||||
|
||||
int dx = abs(spr.x - tspr.x); // x distance to sprite
|
||||
int dy = abs(spr.y - tspr.y); // y distance to sprite
|
||||
int dz = abs((spr.z >> 8) - (tspr.z >> 8)); // z distance to sprite
|
||||
int dh = tileHeight(tspr.picnum) >> 1; // height of sprite
|
||||
if (dx + dy < PICKDISTANCE && dz - dh <= getPickHeight()) {
|
||||
if (sprite[j].picnum == EXPLO2
|
||||
|| sprite[j].picnum == SMOKEFX
|
||||
|| sprite[j].picnum == MONSTERBALL) {
|
||||
if (tspr.picnum == EXPLO2
|
||||
|| tspr.picnum == SMOKEFX
|
||||
|| tspr.picnum == MONSTERBALL) {
|
||||
spr.hitag -= TICSPERFRAME << 2;
|
||||
if (spr.hitag < 0) {
|
||||
newstatus(i, DIE);
|
||||
}
|
||||
}
|
||||
}
|
||||
j = nextj;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -276,24 +276,26 @@ static void diespider(PLAYER& plr, short i) {
|
|||
|
||||
static void checkexplspider(PLAYER& plr, short i) {
|
||||
SPRITE& spr = sprite[i];
|
||||
short j = headspritesect[spr.sectnum];
|
||||
while (j != -1) {
|
||||
short nextj = nextspritesect[j];
|
||||
int dx = abs(spr.x - sprite[j].x); // x distance to sprite
|
||||
int dy = abs(spr.y - sprite[j].y); // y distance to sprite
|
||||
int dz = abs((spr.z >> 8) - (sprite[j].z >> 8)); // z distance to sprite
|
||||
int dh = tileHeight(sprite[j].picnum) >> 1; // height of sprite
|
||||
WHSectIterator it(spr.sectnum);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
SPRITE& tspr = actor->s();
|
||||
int j = actor->GetSpriteIndex();
|
||||
|
||||
int dx = abs(spr.x - tspr.x); // x distance to sprite
|
||||
int dy = abs(spr.y - tspr.y); // y distance to sprite
|
||||
int dz = abs((spr.z >> 8) - (tspr.z >> 8)); // z distance to sprite
|
||||
int dh = tileHeight(tspr.picnum) >> 1; // height of sprite
|
||||
if (dx + dy < PICKDISTANCE && dz - dh <= getPickHeight()) {
|
||||
if (sprite[j].picnum == EXPLO2
|
||||
|| sprite[j].picnum == SMOKEFX
|
||||
|| sprite[j].picnum == MONSTERBALL) {
|
||||
if (tspr.picnum == EXPLO2
|
||||
|| tspr.picnum == SMOKEFX
|
||||
|| tspr.picnum == MONSTERBALL) {
|
||||
spr.hitag -= TICSPERFRAME << 2;
|
||||
if (spr.hitag < 0) {
|
||||
newstatus(i, DIE);
|
||||
}
|
||||
}
|
||||
}
|
||||
j = nextj;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,27 +109,29 @@ int getPickHeight() {
|
|||
|
||||
void processobjs(PLAYER& plr) {
|
||||
|
||||
int dh, dx, dy, dz, i, nexti;
|
||||
int dh, dx, dy, dz;
|
||||
|
||||
if (plr.sector < 0 || plr.sector >= numsectors)
|
||||
return;
|
||||
|
||||
i = headspritesect[plr.sector];
|
||||
while (i != -1) {
|
||||
nexti = nextspritesect[i];
|
||||
dx = abs(plr.x - sprite[i].x); // x distance to sprite
|
||||
dy = abs(plr.y - sprite[i].y); // y distance to sprite
|
||||
dz = abs((plr.z >> 8) - (sprite[i].z >> 8)); // z distance to sprite
|
||||
dh = tileHeight(sprite[i].picnum) >> 1; // height of sprite
|
||||
WHSectIterator it(plr.sector);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
SPRITE& tspr = actor->s();
|
||||
int i = actor->GetSpriteIndex();
|
||||
|
||||
dx = abs(plr.x - tspr.x); // x distance to sprite
|
||||
dy = abs(plr.y - tspr.y); // y distance to sprite
|
||||
dz = abs((plr.z >> 8) - (tspr.z >> 8)); // z distance to sprite
|
||||
dh = tileHeight(tspr.picnum) >> 1; // height of sprite
|
||||
if (dx + dy < PICKDISTANCE && dz - dh <= getPickHeight()) {
|
||||
if(isItemSprite(i))
|
||||
items[(sprite[i].detail & 0xFF) - ITEMSBASE].pickup(plr, (short)i);
|
||||
items[(tspr.detail & 0xFF) - ITEMSBASE].pickup(plr, (short)i);
|
||||
|
||||
if (sprite[i].picnum >= EXPLOSTART && sprite[i].picnum <= EXPLOEND && sprite[i].owner != sprite[plr.spritenum].owner)
|
||||
if (tspr.picnum >= EXPLOSTART && tspr.picnum <= EXPLOEND && tspr.owner != sprite[plr.spritenum].owner)
|
||||
if (plr.manatime < 1)
|
||||
addhealth(plr, -1);
|
||||
}
|
||||
i = nexti;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue