mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 20:42:11 +00:00
- use provided sector/wall iterators in cacheit functions
This commit is contained in:
parent
aadbca8e5d
commit
58a091067f
4 changed files with 35 additions and 23 deletions
|
@ -51,6 +51,12 @@ public:
|
|||
assert(stat >= 0 && stat < MAXSECTORS);
|
||||
next = headspritesect[stat];
|
||||
}
|
||||
|
||||
SectIterator(sectortype* sect)
|
||||
{
|
||||
assert(sect);
|
||||
next = headspritesect[sect - sector];
|
||||
}
|
||||
|
||||
void Reset(int stat)
|
||||
{
|
||||
|
@ -58,6 +64,12 @@ public:
|
|||
next = headspritesect[stat];
|
||||
}
|
||||
|
||||
void Reset(sectortype* sect)
|
||||
{
|
||||
assert(sect);
|
||||
next = headspritesect[sect - sector];
|
||||
}
|
||||
|
||||
int NextIndex()
|
||||
{
|
||||
int n = next;
|
||||
|
|
|
@ -33,6 +33,10 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
DukeSectIterator(sectortype* stat) : SectIterator(stat)
|
||||
{
|
||||
}
|
||||
|
||||
DDukeActor *Next()
|
||||
{
|
||||
int n = NextIndex();
|
||||
|
|
|
@ -233,29 +233,27 @@ static void cachegoodsprites(void)
|
|||
void cacheit_d(void)
|
||||
{
|
||||
if (!r_precache) return;
|
||||
int i;
|
||||
|
||||
cachegoodsprites();
|
||||
|
||||
for (i = 0; i < numwalls; i++)
|
||||
for (auto& wal : walls())
|
||||
{
|
||||
tloadtile(wall[i].picnum, wall[i].pal);
|
||||
if (wall[i].overpicnum >= 0)
|
||||
tloadtile(wall[i].overpicnum, wall[i].pal);
|
||||
tloadtile(wal.picnum, wal.pal);
|
||||
if (wal.overpicnum >= 0)
|
||||
tloadtile(wal.overpicnum, wal.pal);
|
||||
}
|
||||
|
||||
for (i = 0; i < numsectors; i++)
|
||||
for (auto& sect : sectors())
|
||||
{
|
||||
auto sectp = §or[i];
|
||||
tloadtile(sectp->floorpicnum, sectp->floorpal);
|
||||
tloadtile(sectp->ceilingpicnum, sectp->ceilingpal);
|
||||
if (sectp->ceilingpicnum == LA)
|
||||
tloadtile(sect.floorpicnum, sect.floorpal);
|
||||
tloadtile(sect.ceilingpicnum, sect.ceilingpal);
|
||||
if (sect.ceilingpicnum == LA)
|
||||
{
|
||||
tloadtile(LA + 1);
|
||||
tloadtile(LA + 2);
|
||||
}
|
||||
|
||||
DukeSectIterator it(i);
|
||||
DukeSectIterator it(§);
|
||||
while (auto j = it.Next())
|
||||
{
|
||||
if (j->s->xrepeat != 0 && j->s->yrepeat != 0 && (j->s->cstat & 32768) == 0)
|
||||
|
@ -510,4 +508,4 @@ void prelevel_d(int g)
|
|||
}
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -377,29 +377,27 @@ static void cachegoodsprites(void)
|
|||
void cacheit_r(void)
|
||||
{
|
||||
if (!r_precache) return;
|
||||
int i;
|
||||
|
||||
cachegoodsprites();
|
||||
|
||||
for(i=0;i<numwalls;i++)
|
||||
for (auto& wal : walls())
|
||||
{
|
||||
tloadtile(wall[i].picnum, wall[i].pal);
|
||||
if(wall[i].overpicnum >= 0)
|
||||
tloadtile(wall[i].overpicnum, wall[i].pal);
|
||||
tloadtile(wal.picnum, wal.pal);
|
||||
if(wal.overpicnum >= 0)
|
||||
tloadtile(wal.overpicnum, wal.pal);
|
||||
}
|
||||
|
||||
for (i = 0; i < numsectors; i++)
|
||||
for (auto& sect : sectors())
|
||||
{
|
||||
auto sectp = §or[i];
|
||||
tloadtile(sectp->floorpicnum, sectp->floorpal);
|
||||
tloadtile(sectp->ceilingpicnum, sectp->ceilingpal);
|
||||
if (sectp->ceilingpicnum == LA)
|
||||
tloadtile(sect.floorpicnum, sect.floorpal);
|
||||
tloadtile(sect.ceilingpicnum, sect.ceilingpal);
|
||||
if (sect.ceilingpicnum == LA)
|
||||
{
|
||||
tloadtile(LA + 1);
|
||||
tloadtile(LA + 2);
|
||||
}
|
||||
|
||||
DukeSectIterator it(i);
|
||||
DukeSectIterator it(§);
|
||||
while (auto j = it.Next())
|
||||
{
|
||||
if(j->s->xrepeat != 0 && j->s->yrepeat != 0 && (j->s->cstat&32768) == 0)
|
||||
|
|
Loading…
Reference in a new issue