mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 22:51:50 +00:00
- Duke: a large batch of quick'n easy sector[] replacements with pointers.
This commit is contained in:
parent
d45f687d4b
commit
8c5e4a7fa9
4 changed files with 96 additions and 94 deletions
|
@ -47,7 +47,6 @@ BEGIN_DUKE_NS
|
|||
void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int a, int smoothratio)
|
||||
{
|
||||
int i, j, k, p;
|
||||
short sect;
|
||||
int l, t1, t3, t4;
|
||||
spritetype* s;
|
||||
tspritetype* t;
|
||||
|
@ -186,7 +185,7 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int
|
|||
t->pos = s->interpolatedvec3(smoothratio);
|
||||
}
|
||||
|
||||
sect = s->sectnum;
|
||||
auto sectp = s->sector();
|
||||
t1 = h->temp_data[1];
|
||||
t3 = h->temp_data[3];
|
||||
t4 = h->temp_data[4];
|
||||
|
@ -438,8 +437,8 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int
|
|||
|
||||
PALONLY:
|
||||
|
||||
if (sector[sect].floorpal)
|
||||
copyfloorpal(t, §or[sect]);
|
||||
if (sectp->floorpal)
|
||||
copyfloorpal(t, sectp);
|
||||
|
||||
if (!h->GetOwner()) continue;
|
||||
|
||||
|
@ -484,8 +483,8 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int
|
|||
else t->picnum += h->temp_data[0];
|
||||
t->shade -= 6;
|
||||
|
||||
if (sector[sect].floorpal)
|
||||
copyfloorpal(t, §or[sect]);
|
||||
if (sectp->floorpal)
|
||||
copyfloorpal(t, sectp);
|
||||
break;
|
||||
|
||||
case WATERBUBBLE:
|
||||
|
@ -496,8 +495,8 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int
|
|||
}
|
||||
default:
|
||||
|
||||
if (sector[sect].floorpal)
|
||||
copyfloorpal(t, §or[sect]);
|
||||
if (sectp->floorpal)
|
||||
copyfloorpal(t, sectp);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -584,8 +583,8 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int
|
|||
{
|
||||
int daz;
|
||||
|
||||
if ((sector[sect].lotag & 0xff) > 2 || s->statnum == 4 || s->statnum == 5 || s->picnum == DRONE || s->picnum == COMMANDER)
|
||||
daz = sector[sect].floorz;
|
||||
if ((sectp->lotag & 0xff) > 2 || s->statnum == 4 || s->statnum == 5 || s->picnum == DRONE || s->picnum == COMMANDER)
|
||||
daz = sectp->floorz;
|
||||
else
|
||||
daz = h->floorz;
|
||||
|
||||
|
|
|
@ -1038,95 +1038,96 @@ void DoSector(char bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
|||
}
|
||||
|
||||
lValue = GetGameVarID(lVar2, sActor, sPlayer);
|
||||
auto sectp = §or[iSector];
|
||||
|
||||
// All fields affecting map geometry have been made read-only!
|
||||
switch (lLabelID)
|
||||
{
|
||||
case SECTOR_WALLPTR:
|
||||
if (!bSet) SetGameVarID(lVar2, sector[iSector].wallptr, sActor, sPlayer);
|
||||
if (!bSet) SetGameVarID(lVar2, sectp->wallptr, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_WALLNUM:
|
||||
if (!bSet) SetGameVarID(lVar2, sector[iSector].wallnum, sActor, sPlayer);
|
||||
if (!bSet) SetGameVarID(lVar2, sectp->wallnum, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_CEILINGZ:
|
||||
if (bSet) sector[iSector].ceilingz = lValue;
|
||||
else SetGameVarID(lVar2, sector[iSector].ceilingz, sActor, sPlayer);
|
||||
if (bSet) sectp->ceilingz = lValue;
|
||||
else SetGameVarID(lVar2, sectp->ceilingz, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_FLOORZ:
|
||||
if (bSet) sector[iSector].floorz = lValue;
|
||||
else SetGameVarID(lVar2, sector[iSector].floorz, sActor, sPlayer);
|
||||
if (bSet) sectp->floorz = lValue;
|
||||
else SetGameVarID(lVar2, sectp->floorz, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_CEILINGSTAT:
|
||||
if (bSet) sector[iSector].ceilingstat = lValue;
|
||||
else SetGameVarID(lVar2, sector[iSector].ceilingstat, sActor, sPlayer);
|
||||
if (bSet) sectp->ceilingstat = lValue;
|
||||
else SetGameVarID(lVar2, sectp->ceilingstat, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_FLOORSTAT:
|
||||
if (bSet) sector[iSector].floorstat = lValue;
|
||||
else SetGameVarID(lVar2, sector[iSector].floorstat, sActor, sPlayer);
|
||||
if (bSet) sectp->floorstat = lValue;
|
||||
else SetGameVarID(lVar2, sectp->floorstat, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_CEILINGPICNUM:
|
||||
if (bSet) sector[iSector].ceilingpicnum = lValue;
|
||||
else SetGameVarID(lVar2, sector[iSector].ceilingpicnum, sActor, sPlayer);
|
||||
if (bSet) sectp->ceilingpicnum = lValue;
|
||||
else SetGameVarID(lVar2, sectp->ceilingpicnum, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_CEILINGSLOPE:
|
||||
if (bSet) sector[iSector].ceilingheinum = lValue;
|
||||
else SetGameVarID(lVar2, sector[iSector].ceilingheinum, sActor, sPlayer);
|
||||
if (bSet) sectp->ceilingheinum = lValue;
|
||||
else SetGameVarID(lVar2, sectp->ceilingheinum, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_CEILINGSHADE:
|
||||
if (bSet) sector[iSector].ceilingshade = lValue;
|
||||
else SetGameVarID(lVar2, sector[iSector].ceilingshade, sActor, sPlayer);
|
||||
if (bSet) sectp->ceilingshade = lValue;
|
||||
else SetGameVarID(lVar2, sectp->ceilingshade, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_CEILINGPAL:
|
||||
if (bSet) sector[iSector].ceilingpal = lValue;
|
||||
else SetGameVarID(lVar2, sector[iSector].ceilingpal, sActor, sPlayer);
|
||||
if (bSet) sectp->ceilingpal = lValue;
|
||||
else SetGameVarID(lVar2, sectp->ceilingpal, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_CEILINGXPANNING:
|
||||
if (bSet) sector[iSector].ceilingxpan_ = (float)(lValue & 255);
|
||||
else SetGameVarID(lVar2, sector[iSector].ceilingxpan(), sActor, sPlayer);
|
||||
if (bSet) sectp->ceilingxpan_ = (float)(lValue & 255);
|
||||
else SetGameVarID(lVar2, sectp->ceilingxpan(), sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_CEILINGYPANNING:
|
||||
if (bSet) sector[iSector].ceilingypan_ = (float)(lValue & 255);
|
||||
else SetGameVarID(lVar2, sector[iSector].ceilingypan(), sActor, sPlayer);
|
||||
if (bSet) sectp->ceilingypan_ = (float)(lValue & 255);
|
||||
else SetGameVarID(lVar2, sectp->ceilingypan(), sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_FLOORPICNUM:
|
||||
if (bSet) sector[iSector].floorpicnum = lValue;
|
||||
else SetGameVarID(lVar2, sector[iSector].floorpicnum, sActor, sPlayer);
|
||||
if (bSet) sectp->floorpicnum = lValue;
|
||||
else SetGameVarID(lVar2, sectp->floorpicnum, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_FLOORSLOPE:
|
||||
if (bSet) sector[iSector].floorheinum = lValue;
|
||||
else SetGameVarID(lVar2, sector[iSector].floorheinum, sActor, sPlayer);
|
||||
if (bSet) sectp->floorheinum = lValue;
|
||||
else SetGameVarID(lVar2, sectp->floorheinum, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_FLOORSHADE:
|
||||
if (bSet) sector[iSector].floorshade = lValue;
|
||||
else SetGameVarID(lVar2, sector[iSector].floorshade, sActor, sPlayer);
|
||||
if (bSet) sectp->floorshade = lValue;
|
||||
else SetGameVarID(lVar2, sectp->floorshade, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_FLOORPAL:
|
||||
if (bSet) sector[iSector].floorpal = lValue;
|
||||
else SetGameVarID(lVar2, sector[iSector].floorpal, sActor, sPlayer);
|
||||
if (bSet) sectp->floorpal = lValue;
|
||||
else SetGameVarID(lVar2, sectp->floorpal, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_FLOORXPANNING:
|
||||
if (bSet) sector[iSector].floorxpan_ = (float)(lValue & 255);
|
||||
else SetGameVarID(lVar2, sector[iSector].floorxpan(), sActor, sPlayer);
|
||||
if (bSet) sectp->floorxpan_ = (float)(lValue & 255);
|
||||
else SetGameVarID(lVar2, sectp->floorxpan(), sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_FLOORYPANNING:
|
||||
if (bSet) sector[iSector].floorypan_ = (float)(lValue & 255);
|
||||
else SetGameVarID(lVar2, sector[iSector].floorypan(), sActor, sPlayer);
|
||||
if (bSet) sectp->floorypan_ = (float)(lValue & 255);
|
||||
else SetGameVarID(lVar2, sectp->floorypan(), sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_VISIBILITY:
|
||||
if (bSet) sector[iSector].visibility = lValue;
|
||||
else SetGameVarID(lVar2, sector[iSector].visibility, sActor, sPlayer);
|
||||
if (bSet) sectp->visibility = lValue;
|
||||
else SetGameVarID(lVar2, sectp->visibility, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_LOTAG:
|
||||
if (bSet) sector[iSector].lotag = lValue;
|
||||
else SetGameVarID(lVar2, sector[iSector].lotag, sActor, sPlayer);
|
||||
if (bSet) sectp->lotag = lValue;
|
||||
else SetGameVarID(lVar2, sectp->lotag, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_HITAG:
|
||||
if (bSet) sector[iSector].hitag = lValue;
|
||||
else SetGameVarID(lVar2, sector[iSector].hitag, sActor, sPlayer);
|
||||
if (bSet) sectp->hitag = lValue;
|
||||
else SetGameVarID(lVar2, sectp->hitag, sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_EXTRA:
|
||||
if (bSet) sector[iSector].extra = lValue;
|
||||
else SetGameVarID(lVar2, sector[iSector].extra, sActor, sPlayer);
|
||||
if (bSet) sectp->extra = lValue;
|
||||
else SetGameVarID(lVar2, sectp->extra, sActor, sPlayer);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -950,9 +950,10 @@ void checkplayerhurt_d(struct player_struct* p, const Collision& coll)
|
|||
|
||||
bool checkhitceiling_d(int sn)
|
||||
{
|
||||
auto sectp = §or[sn];
|
||||
int j;
|
||||
|
||||
switch (sector[sn].ceilingpicnum)
|
||||
switch (sectp->ceilingpicnum)
|
||||
{
|
||||
case WALLLIGHT1:
|
||||
case WALLLIGHT2:
|
||||
|
@ -964,26 +965,26 @@ bool checkhitceiling_d(int sn)
|
|||
ceilingglass(ps[myconnectindex].GetActor(), sn, 10);
|
||||
S_PlayActorSound(GLASS_BREAKING, ps[screenpeek].GetActor());
|
||||
|
||||
if (sector[sn].ceilingpicnum == WALLLIGHT1)
|
||||
sector[sn].ceilingpicnum = WALLLIGHTBUST1;
|
||||
if (sectp->ceilingpicnum == WALLLIGHT1)
|
||||
sectp->ceilingpicnum = WALLLIGHTBUST1;
|
||||
|
||||
if (sector[sn].ceilingpicnum == WALLLIGHT2)
|
||||
sector[sn].ceilingpicnum = WALLLIGHTBUST2;
|
||||
if (sectp->ceilingpicnum == WALLLIGHT2)
|
||||
sectp->ceilingpicnum = WALLLIGHTBUST2;
|
||||
|
||||
if (sector[sn].ceilingpicnum == WALLLIGHT3)
|
||||
sector[sn].ceilingpicnum = WALLLIGHTBUST3;
|
||||
if (sectp->ceilingpicnum == WALLLIGHT3)
|
||||
sectp->ceilingpicnum = WALLLIGHTBUST3;
|
||||
|
||||
if (sector[sn].ceilingpicnum == WALLLIGHT4)
|
||||
sector[sn].ceilingpicnum = WALLLIGHTBUST4;
|
||||
if (sectp->ceilingpicnum == WALLLIGHT4)
|
||||
sectp->ceilingpicnum = WALLLIGHTBUST4;
|
||||
|
||||
if (sector[sn].ceilingpicnum == TECHLIGHT2)
|
||||
sector[sn].ceilingpicnum = TECHLIGHTBUST2;
|
||||
if (sectp->ceilingpicnum == TECHLIGHT2)
|
||||
sectp->ceilingpicnum = TECHLIGHTBUST2;
|
||||
|
||||
if (sector[sn].ceilingpicnum == TECHLIGHT4)
|
||||
sector[sn].ceilingpicnum = TECHLIGHTBUST4;
|
||||
if (sectp->ceilingpicnum == TECHLIGHT4)
|
||||
sectp->ceilingpicnum = TECHLIGHTBUST4;
|
||||
|
||||
|
||||
if (!sector[sn].hitag)
|
||||
if (!sectp->hitag)
|
||||
{
|
||||
DukeSectIterator it(sn);
|
||||
while (auto act = it.Next())
|
||||
|
@ -1005,7 +1006,7 @@ bool checkhitceiling_d(int sn)
|
|||
DukeStatIterator it(STAT_EFFECTOR);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
if (act->s->hitag == (sector[sn].hitag) && act->s->lotag == 3)
|
||||
if (act->s->hitag == (sectp->hitag) && act->s->lotag == 3)
|
||||
{
|
||||
act->temp_data[2] = j;
|
||||
act->temp_data[4] = 1;
|
||||
|
|
|
@ -1433,9 +1433,10 @@ void checkplayerhurt_r(struct player_struct* p, const Collision &coll)
|
|||
|
||||
bool checkhitceiling_r(int sn)
|
||||
{
|
||||
auto sectp = §or[sn];
|
||||
short j;
|
||||
|
||||
switch (sector[sn].ceilingpicnum)
|
||||
switch (sectp->ceilingpicnum)
|
||||
{
|
||||
case WALLLIGHT1:
|
||||
case WALLLIGHT3:
|
||||
|
@ -1454,44 +1455,44 @@ bool checkhitceiling_r(int sn)
|
|||
ceilingglass(ps[myconnectindex].GetActor(), sn, 10);
|
||||
S_PlayActorSound(GLASS_BREAKING, ps[screenpeek].GetActor());
|
||||
|
||||
if (sector[sn].ceilingpicnum == WALLLIGHT1)
|
||||
sector[sn].ceilingpicnum = WALLLIGHTBUST1;
|
||||
if (sectp->ceilingpicnum == WALLLIGHT1)
|
||||
sectp->ceilingpicnum = WALLLIGHTBUST1;
|
||||
|
||||
if (sector[sn].ceilingpicnum == WALLLIGHT3)
|
||||
sector[sn].ceilingpicnum = WALLLIGHTBUST3;
|
||||
if (sectp->ceilingpicnum == WALLLIGHT3)
|
||||
sectp->ceilingpicnum = WALLLIGHTBUST3;
|
||||
|
||||
if (sector[sn].ceilingpicnum == WALLLIGHT4)
|
||||
sector[sn].ceilingpicnum = WALLLIGHTBUST4;
|
||||
if (sectp->ceilingpicnum == WALLLIGHT4)
|
||||
sectp->ceilingpicnum = WALLLIGHTBUST4;
|
||||
|
||||
if (sector[sn].ceilingpicnum == TECHLIGHT2)
|
||||
sector[sn].ceilingpicnum = TECHLIGHTBUST2;
|
||||
if (sectp->ceilingpicnum == TECHLIGHT2)
|
||||
sectp->ceilingpicnum = TECHLIGHTBUST2;
|
||||
|
||||
if (sector[sn].ceilingpicnum == TECHLIGHT4)
|
||||
sector[sn].ceilingpicnum = TECHLIGHTBUST4;
|
||||
if (sectp->ceilingpicnum == TECHLIGHT4)
|
||||
sectp->ceilingpicnum = TECHLIGHTBUST4;
|
||||
|
||||
if (sector[sn].ceilingpicnum == RRTILE1986)
|
||||
sector[sn].ceilingpicnum = RRTILE1987;
|
||||
if (sectp->ceilingpicnum == RRTILE1986)
|
||||
sectp->ceilingpicnum = RRTILE1987;
|
||||
|
||||
if (sector[sn].ceilingpicnum == RRTILE1939)
|
||||
sector[sn].ceilingpicnum = RRTILE2004;
|
||||
if (sectp->ceilingpicnum == RRTILE1939)
|
||||
sectp->ceilingpicnum = RRTILE2004;
|
||||
|
||||
if (sector[sn].ceilingpicnum == RRTILE1988)
|
||||
sector[sn].ceilingpicnum = RRTILE2005;
|
||||
if (sectp->ceilingpicnum == RRTILE1988)
|
||||
sectp->ceilingpicnum = RRTILE2005;
|
||||
|
||||
if (sector[sn].ceilingpicnum == RRTILE2898)
|
||||
sector[sn].ceilingpicnum = RRTILE2899;
|
||||
if (sectp->ceilingpicnum == RRTILE2898)
|
||||
sectp->ceilingpicnum = RRTILE2899;
|
||||
|
||||
if (sector[sn].ceilingpicnum == RRTILE2878)
|
||||
sector[sn].ceilingpicnum = RRTILE2879;
|
||||
if (sectp->ceilingpicnum == RRTILE2878)
|
||||
sectp->ceilingpicnum = RRTILE2879;
|
||||
|
||||
if (sector[sn].ceilingpicnum == RRTILE2123)
|
||||
sector[sn].ceilingpicnum = RRTILE2124;
|
||||
if (sectp->ceilingpicnum == RRTILE2123)
|
||||
sectp->ceilingpicnum = RRTILE2124;
|
||||
|
||||
if (sector[sn].ceilingpicnum == RRTILE2125)
|
||||
sector[sn].ceilingpicnum = RRTILE2126;
|
||||
if (sectp->ceilingpicnum == RRTILE2125)
|
||||
sectp->ceilingpicnum = RRTILE2126;
|
||||
|
||||
|
||||
if (!sector[sn].hitag)
|
||||
if (!sectp->hitag)
|
||||
{
|
||||
DukeSectIterator it(sn);
|
||||
while (auto act1 = it.Next())
|
||||
|
@ -1515,7 +1516,7 @@ bool checkhitceiling_r(int sn)
|
|||
while (auto act1 = it.Next())
|
||||
{
|
||||
auto spr1 = act1->s;
|
||||
if (spr1->hitag == (sector[sn].hitag) && spr1->lotag == 3)
|
||||
if (spr1->hitag == (sectp->hitag) && spr1->lotag == 3)
|
||||
{
|
||||
act1->temp_data[2] = j;
|
||||
act1->temp_data[4] = 1;
|
||||
|
|
Loading…
Reference in a new issue