- handle the cheap-ass ROR code.

This commit is contained in:
Christoph Oelckers 2020-11-02 18:41:01 +01:00
parent 10d4f92232
commit 4d4cb2da9b
2 changed files with 67 additions and 53 deletions

View file

@ -180,7 +180,7 @@ void fakedomovethings(void)
psectlotag = 0; psectlotag = 0;
spritebridge = 1; spritebridge = 1;
} }
if(badguy(chz.actor) && sprite[j].xrepeat > 24 && klabs(p->GetActor()->s.z- chz.actor->s.z) < (84<<8) ) if(badguy(chz.actor) && chz.actor->s.xrepeat > 24 && klabs(p->GetActor()->s.z- chz.actor->s.z) < (84<<8) )
{ {
j = getangle(chz.actor->s.x-myx, chz.actor->s.y-myy); j = getangle(chz.actor->s.x-myx, chz.actor->s.y-myy);
myxvel -= sintable[(j+512)&2047]<<4; myxvel -= sintable[(j+512)&2047]<<4;

View file

@ -58,104 +58,118 @@ static int tempsectorz[MAXSECTORS];
static int tempsectorpicnum[MAXSECTORS]; static int tempsectorpicnum[MAXSECTORS];
//short tempcursectnum; //short tempcursectnum;
void SE40_Draw(int tag, int spnum, int x, int y, int z, binangle a, fixedhoriz h, int smoothratio) void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedhoriz h, int smoothratio)
{ {
int i, j = 0, k = 0; int i, j = 0, k = 0;
int floor1, floor2 = 0, ok = 0, fofmode = 0; int ok = 0, fofmode = 0;
int offx, offy; int offx, offy;
spritetype* floor1, *floor2 = nullptr;
if (sprite[spnum].ang != 512) return; if (spr->ang != 512) return;
i = FOF; //Effect TILE i = FOF; //Effect TILE
tileDelete(FOF); tileDelete(FOF);
if (!(gotpic[i >> 3] & (1 << (i & 7)))) return; if (!(gotpic[i >> 3] & (1 << (i & 7)))) return;
gotpic[i >> 3] &= ~(1 << (i & 7)); gotpic[i >> 3] &= ~(1 << (i & 7));
floor1 = spnum; floor1 = spr;
if (sprite[spnum].lotag == tag + 2) fofmode = tag + 0; if (spr->lotag == tag + 2) fofmode = tag + 0;
if (sprite[spnum].lotag == tag + 3) fofmode = tag + 1; if (spr->lotag == tag + 3) fofmode = tag + 1;
if (sprite[spnum].lotag == tag + 4) fofmode = tag + 0; if (spr->lotag == tag + 4) fofmode = tag + 0;
if (sprite[spnum].lotag == tag + 5) fofmode = tag + 1; if (spr->lotag == tag + 5) fofmode = tag + 1;
ok++; ok++;
for (j = 0; j < MAXSPRITES; j++) DukeStatIterator it(STAT_RAROR);
while (auto act = it.Next())
{ {
auto spr = &act->s;
if ( if (
sprite[j].picnum == 1 && spr->picnum == SECTOREFFECTOR &&
sprite[j].lotag == fofmode && spr->lotag == fofmode &&
sprite[j].hitag == sprite[floor1].hitag spr->hitag == floor1->hitag
) { )
floor1 = j; fofmode = sprite[j].lotag; ok++; break; {
floor1 = spr;
fofmode = spr->lotag;
ok++;
break;
} }
} }
// if(ok==1) { Message("no floor1",RED); return; } // if(ok==1) { Message("no floor1",RED); return; }
if (fofmode == tag + 0) k = tag + 1; else k = tag + 0; if (fofmode == tag + 0) k = tag + 1; else k = tag + 0;
for (j = 0; j < MAXSPRITES; j++) it.Reset(STAT_RAROR);
while (auto act = it.Next())
{ {
auto spr = &act->s;
if ( if (
sprite[j].picnum == 1 && spr->picnum == SECTOREFFECTOR &&
sprite[j].lotag == k && spr->lotag == k &&
sprite[j].hitag == sprite[floor1].hitag spr->hitag == floor1->hitag
) { )
floor2 = j; ok++; break; {
floor2 = spr;
ok++;
break;
} }
} }
// if(ok==2) { Message("no floor2",RED); return; } // if(ok==2) { Message("no floor2",RED); return; }
for (j = 0; j < MAXSPRITES; j++) // raise ceiling or floor it.Reset(STAT_RAROR);
while (auto act = it.Next())
{ {
if (sprite[j].picnum == 1 && auto spr = &act->s;
sprite[j].lotag == k + 2 && if (spr->picnum == SECTOREFFECTOR &&
sprite[j].hitag == sprite[floor1].hitag spr->lotag == k + 2 &&
spr->hitag == floor1->hitag
) )
{ {
if (k == tag + 0) if (k == tag + 0)
{ {
tempsectorz[sprite[j].sectnum] = sector[sprite[j].sectnum].floorz; tempsectorz[spr->sectnum] = sector[spr->sectnum].floorz;
sector[sprite[j].sectnum].floorz += (((z - sector[sprite[j].sectnum].floorz) / 32768) + 1) * 32768; sector[spr->sectnum].floorz += (((z - sector[spr->sectnum].floorz) / 32768) + 1) * 32768;
tempsectorpicnum[sprite[j].sectnum] = sector[sprite[j].sectnum].floorpicnum; tempsectorpicnum[spr->sectnum] = sector[spr->sectnum].floorpicnum;
sector[sprite[j].sectnum].floorpicnum = 13; sector[spr->sectnum].floorpicnum = 13;
} }
if (k == tag + 1) if (k == tag + 1)
{ {
tempsectorz[sprite[j].sectnum] = sector[sprite[j].sectnum].ceilingz; tempsectorz[spr->sectnum] = sector[spr->sectnum].ceilingz;
sector[sprite[j].sectnum].ceilingz += (((z - sector[sprite[j].sectnum].ceilingz) / 32768) - 1) * 32768; sector[spr->sectnum].ceilingz += (((z - sector[spr->sectnum].ceilingz) / 32768) - 1) * 32768;
tempsectorpicnum[sprite[j].sectnum] = sector[sprite[j].sectnum].ceilingpicnum; tempsectorpicnum[spr->sectnum] = sector[spr->sectnum].ceilingpicnum;
sector[sprite[j].sectnum].ceilingpicnum = 13; sector[spr->sectnum].ceilingpicnum = 13;
} }
} }
} }
i = floor1; offx = x - floor1->x;
offx = x - sprite[i].x; offy = y - floor1->y;
offy = y - sprite[i].y;
i = floor2;
renderDrawRoomsQ16(sprite[i].x + offx, sprite[i].y + offy, z, a.asq16(), h.asq16(), sprite[i].sectnum); renderDrawRoomsQ16(floor2->x + offx, floor2->y + offy, z, a.asq16(), h.asq16(), floor2->sectnum);
fi.animatesprites(offx + sprite[i].x, offy + sprite[i].y, a.asbuild(), smoothratio); fi.animatesprites(offx + floor2->x, offy + floor2->y, a.asbuild(), smoothratio);
renderDrawMasks(); renderDrawMasks();
for (j = 0; j < MAXSPRITES; j++) // restore ceiling or floor it.Reset(STAT_RAROR);
while (auto act = it.Next())
{ {
if (sprite[j].picnum == 1 && auto spr = &act->s;
sprite[j].lotag == k + 2 && if (spr->picnum == 1 &&
sprite[j].hitag == sprite[floor1].hitag spr->lotag == k + 2 &&
spr->hitag == floor1->hitag
) )
{ {
if (k == tag + 0) if (k == tag + 0)
{ {
sector[sprite[j].sectnum].floorz = tempsectorz[sprite[j].sectnum]; sector[spr->sectnum].floorz = tempsectorz[spr->sectnum];
sector[sprite[j].sectnum].floorpicnum = tempsectorpicnum[sprite[j].sectnum]; sector[spr->sectnum].floorpicnum = tempsectorpicnum[spr->sectnum];
} }
if (k == tag + 1) if (k == tag + 1)
{ {
sector[sprite[j].sectnum].ceilingz = tempsectorz[sprite[j].sectnum]; sector[spr->sectnum].ceilingz = tempsectorz[spr->sectnum];
sector[sprite[j].sectnum].ceilingpicnum = tempsectorpicnum[sprite[j].sectnum]; sector[spr->sectnum].ceilingpicnum = tempsectorpicnum[spr->sectnum];
} }
}// end if }// end if
}// end for }// end for
@ -171,15 +185,15 @@ void SE40_Draw(int tag, int spnum, int x, int y, int z, binangle a, fixedhoriz h
void se40code(int x, int y, int z, binangle a, fixedhoriz h, int smoothratio) void se40code(int x, int y, int z, binangle a, fixedhoriz h, int smoothratio)
{ {
int i, tag; int tag;
if (!isRR()) tag = 40; if (!isRR()) tag = 40;
else if (isRRRA()) tag = 150; else if (isRRRA()) tag = 150;
else return; else return;
StatIterator it(STAT_RAROR); DukeStatIterator it(STAT_RAROR);
while ((i = it.NextIndex()) >= 0) while (auto act = it.Next())
{ {
switch (sprite[i].lotag - tag + 40) switch (act->s.lotag - tag + 40)
{ {
// case 40: // case 40:
// case 41: // case 41:
@ -189,8 +203,8 @@ void se40code(int x, int y, int z, binangle a, fixedhoriz h, int smoothratio)
case 43: case 43:
case 44: case 44:
case 45: case 45:
if (ps[screenpeek].cursectnum == sprite[i].sectnum) if (ps[screenpeek].cursectnum == act->s.sectnum)
SE40_Draw(tag, i, x, y, z, a, h, smoothratio); SE40_Draw(tag, &act->s, x, y, z, a, h, smoothratio);
break; break;
} }
} }