mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
- optimized another batch of array accesses in the spawn functions.
This commit is contained in:
parent
6311898152
commit
356060e127
2 changed files with 57 additions and 55 deletions
|
@ -49,6 +49,7 @@ int spawn_d(int j, int pn)
|
||||||
if (!(i & 0x1000000)) return i;
|
if (!(i & 0x1000000)) return i;
|
||||||
i &= 0xffffff;
|
i &= 0xffffff;
|
||||||
auto sp = &sprite[i];
|
auto sp = &sprite[i];
|
||||||
|
auto spj = &sprite[j];
|
||||||
auto t = hittype[i].temp_data;
|
auto t = hittype[i].temp_data;
|
||||||
int sect = sp->sectnum;
|
int sect = sp->sectnum;
|
||||||
|
|
||||||
|
@ -65,8 +66,8 @@ int spawn_d(int j, int pn)
|
||||||
case BOSS5:
|
case BOSS5:
|
||||||
if (sp->picnum != FIREFLY)
|
if (sp->picnum != FIREFLY)
|
||||||
{
|
{
|
||||||
if (j >= 0 && sprite[j].picnum == RESPAWN)
|
if (j >= 0 && spj->picnum == RESPAWN)
|
||||||
sp->pal = sprite[j].pal;
|
sp->pal = spj->pal;
|
||||||
if (sp->pal != 0)
|
if (sp->pal != 0)
|
||||||
{
|
{
|
||||||
sp->clipdist = 80;
|
sp->clipdist = 80;
|
||||||
|
@ -118,7 +119,7 @@ int spawn_d(int j, int pn)
|
||||||
sp->yrepeat = 16;
|
sp->yrepeat = 16;
|
||||||
return i;
|
return i;
|
||||||
case LAVAPOOLBUBBLE:
|
case LAVAPOOLBUBBLE:
|
||||||
if (sprite[j].xrepeat < 30)
|
if (spj->xrepeat < 30)
|
||||||
return i;
|
return i;
|
||||||
sp->owner = j;
|
sp->owner = j;
|
||||||
changespritestat(i, STAT_MISC);
|
changespritestat(i, STAT_MISC);
|
||||||
|
@ -154,7 +155,7 @@ int spawn_d(int j, int pn)
|
||||||
case WATERSPLASH2:
|
case WATERSPLASH2:
|
||||||
if(j >= 0)
|
if(j >= 0)
|
||||||
{
|
{
|
||||||
setsprite(i,sprite[j].x,sprite[j].y,sprite[j].z);
|
setsprite(i,spj->x,spj->y,spj->z);
|
||||||
sp->xrepeat = sp->yrepeat = 8+(krand()&7);
|
sp->xrepeat = sp->yrepeat = 8+(krand()&7);
|
||||||
}
|
}
|
||||||
else sp->xrepeat = sp->yrepeat = 16+(krand()&15);
|
else sp->xrepeat = sp->yrepeat = 16+(krand()&15);
|
||||||
|
@ -163,12 +164,12 @@ int spawn_d(int j, int pn)
|
||||||
sp->cstat |= 128;
|
sp->cstat |= 128;
|
||||||
if(j >= 0)
|
if(j >= 0)
|
||||||
{
|
{
|
||||||
if(sector[sprite[j].sectnum].lotag == 2)
|
if(sector[spj->sectnum].lotag == 2)
|
||||||
{
|
{
|
||||||
sp->z = getceilzofslope(sp->sectnum,sp->x,sp->y)+(16<<8);
|
sp->z = getceilzofslope(sp->sectnum,sp->x,sp->y)+(16<<8);
|
||||||
sp->cstat |= 8;
|
sp->cstat |= 8;
|
||||||
}
|
}
|
||||||
else if( sector[sprite[j].sectnum].lotag == 1)
|
else if( sector[spj->sectnum].lotag == 1)
|
||||||
sp->z = getflorzofslope(sp->sectnum,sp->x,sp->y);
|
sp->z = getflorzofslope(sp->sectnum,sp->x,sp->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +207,7 @@ int spawn_d(int j, int pn)
|
||||||
break;
|
break;
|
||||||
case TONGUE:
|
case TONGUE:
|
||||||
if(j >= 0)
|
if(j >= 0)
|
||||||
sp->ang = sprite[j].ang;
|
sp->ang = spj->ang;
|
||||||
sp->z -= 38<<8;
|
sp->z -= 38<<8;
|
||||||
sp->zvel = 256-(krand()&511);
|
sp->zvel = 256-(krand()&511);
|
||||||
sp->xvel = 64-(krand()&127);
|
sp->xvel = 64-(krand()&127);
|
||||||
|
@ -224,9 +225,9 @@ int spawn_d(int j, int pn)
|
||||||
case FRAMEEFFECT1:
|
case FRAMEEFFECT1:
|
||||||
if(j >= 0)
|
if(j >= 0)
|
||||||
{
|
{
|
||||||
sp->xrepeat = sprite[j].xrepeat;
|
sp->xrepeat = spj->xrepeat;
|
||||||
sp->yrepeat = sprite[j].yrepeat;
|
sp->yrepeat = spj->yrepeat;
|
||||||
t[1] = sprite[j].picnum;
|
t[1] = spj->picnum;
|
||||||
}
|
}
|
||||||
else sp->xrepeat = sp->yrepeat = 0;
|
else sp->xrepeat = sp->yrepeat = 0;
|
||||||
|
|
||||||
|
@ -268,7 +269,7 @@ int spawn_d(int j, int pn)
|
||||||
case BLOOD:
|
case BLOOD:
|
||||||
sp->xrepeat = sp->yrepeat = 16;
|
sp->xrepeat = sp->yrepeat = 16;
|
||||||
sp->z -= (26<<8);
|
sp->z -= (26<<8);
|
||||||
if( j >= 0 && sprite[j].pal == 6 )
|
if( j >= 0 && spj->pal == 6 )
|
||||||
sp->pal = 6;
|
sp->pal = 6;
|
||||||
changespritestat(i, STAT_MISC);
|
changespritestat(i, STAT_MISC);
|
||||||
break;
|
break;
|
||||||
|
@ -282,17 +283,17 @@ int spawn_d(int j, int pn)
|
||||||
|
|
||||||
if(j >= 0 && sp->picnum != PUKE)
|
if(j >= 0 && sp->picnum != PUKE)
|
||||||
{
|
{
|
||||||
if( sprite[j].pal == 1)
|
if( spj->pal == 1)
|
||||||
sp->pal = 1;
|
sp->pal = 1;
|
||||||
else if( sprite[j].pal != 6 && sprite[j].picnum != NUKEBARREL && sprite[j].picnum != TIRE )
|
else if( spj->pal != 6 && spj->picnum != NUKEBARREL && spj->picnum != TIRE )
|
||||||
{
|
{
|
||||||
if(sprite[j].picnum == FECES)
|
if(spj->picnum == FECES)
|
||||||
sp->pal = 7; // Brown
|
sp->pal = 7; // Brown
|
||||||
else sp->pal = 2; // Red
|
else sp->pal = 2; // Red
|
||||||
}
|
}
|
||||||
else sp->pal = 0; // green
|
else sp->pal = 0; // green
|
||||||
|
|
||||||
if(sprite[j].picnum == TIRE)
|
if(spj->picnum == TIRE)
|
||||||
sp->shade = 127;
|
sp->shade = 127;
|
||||||
}
|
}
|
||||||
sp->cstat |= 32;
|
sp->cstat |= 32;
|
||||||
|
@ -318,7 +319,7 @@ int spawn_d(int j, int pn)
|
||||||
sp->xrepeat = 7+(krand()&7);
|
sp->xrepeat = 7+(krand()&7);
|
||||||
sp->yrepeat = 7+(krand()&7);
|
sp->yrepeat = 7+(krand()&7);
|
||||||
sp->z -= (16<<8);
|
sp->z -= (16<<8);
|
||||||
if(j >= 0 && sprite[j].pal == 6)
|
if(j >= 0 && spj->pal == 6)
|
||||||
sp->pal = 6;
|
sp->pal = 6;
|
||||||
insertspriteq(i);
|
insertspriteq(i);
|
||||||
changespritestat(i, STAT_MISC);
|
changespritestat(i, STAT_MISC);
|
||||||
|
@ -501,12 +502,12 @@ int spawn_d(int j, int pn)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DUKELYINGDEAD:
|
case DUKELYINGDEAD:
|
||||||
if(j >= 0 && sprite[j].picnum == APLAYER)
|
if(j >= 0 && spj->picnum == APLAYER)
|
||||||
{
|
{
|
||||||
sp->xrepeat = sprite[j].xrepeat;
|
sp->xrepeat = spj->xrepeat;
|
||||||
sp->yrepeat = sprite[j].yrepeat;
|
sp->yrepeat = spj->yrepeat;
|
||||||
sp->shade = sprite[j].shade;
|
sp->shade = spj->shade;
|
||||||
sp->pal = ps[sprite[j].yvel].palookup;
|
sp->pal = ps[spj->yvel].palookup;
|
||||||
}
|
}
|
||||||
case DUKECAR:
|
case DUKECAR:
|
||||||
case HELECOPT:
|
case HELECOPT:
|
||||||
|
@ -597,7 +598,7 @@ int spawn_d(int j, int pn)
|
||||||
|
|
||||||
if(j >= 0)
|
if(j >= 0)
|
||||||
{
|
{
|
||||||
sp->ang = sprite[j].ang;
|
sp->ang = spj->ang;
|
||||||
sp->shade = -64;
|
sp->shade = -64;
|
||||||
sp->cstat = 128|(krand()&4);
|
sp->cstat = 128|(krand()&4);
|
||||||
}
|
}
|
||||||
|
@ -648,8 +649,8 @@ int spawn_d(int j, int pn)
|
||||||
case PLAYERONWATER:
|
case PLAYERONWATER:
|
||||||
if(j >= 0)
|
if(j >= 0)
|
||||||
{
|
{
|
||||||
sp->xrepeat = sprite[j].xrepeat;
|
sp->xrepeat = spj->xrepeat;
|
||||||
sp->yrepeat = sprite[j].yrepeat;
|
sp->yrepeat = spj->yrepeat;
|
||||||
sp->zvel = 128;
|
sp->zvel = 128;
|
||||||
if(sector[sp->sectnum].lotag != 2)
|
if(sector[sp->sectnum].lotag != 2)
|
||||||
sp->cstat |= 32768;
|
sp->cstat |= 32768;
|
||||||
|
@ -668,12 +669,12 @@ int spawn_d(int j, int pn)
|
||||||
changespritestat(i, STAT_PLAYER);
|
changespritestat(i, STAT_PLAYER);
|
||||||
break;
|
break;
|
||||||
case WATERBUBBLE:
|
case WATERBUBBLE:
|
||||||
if(j >= 0 && sprite[j].picnum == APLAYER)
|
if(j >= 0 && spj->picnum == APLAYER)
|
||||||
sp->z -= (16<<8);
|
sp->z -= (16<<8);
|
||||||
if( sp->picnum == WATERBUBBLE)
|
if( sp->picnum == WATERBUBBLE)
|
||||||
{
|
{
|
||||||
if( j >= 0 )
|
if( j >= 0 )
|
||||||
sp->ang = sprite[j].ang;
|
sp->ang = spj->ang;
|
||||||
sp->xrepeat = sp->yrepeat = 4;
|
sp->xrepeat = sp->yrepeat = 4;
|
||||||
}
|
}
|
||||||
else sp->xrepeat = sp->yrepeat = 32;
|
else sp->xrepeat = sp->yrepeat = 32;
|
||||||
|
@ -816,8 +817,8 @@ int spawn_d(int j, int pn)
|
||||||
|
|
||||||
if( sp->picnum == BOSS4STAYPUT || sp->picnum == BOSS1 || sp->picnum == BOSS2 || sp->picnum == BOSS1STAYPUT || sp->picnum == BOSS3 || sp->picnum == BOSS4 )
|
if( sp->picnum == BOSS4STAYPUT || sp->picnum == BOSS1 || sp->picnum == BOSS2 || sp->picnum == BOSS1STAYPUT || sp->picnum == BOSS3 || sp->picnum == BOSS4 )
|
||||||
{
|
{
|
||||||
if(j >= 0 && sprite[j].picnum == RESPAWN)
|
if(j >= 0 && spj->picnum == RESPAWN)
|
||||||
sp->pal = sprite[j].pal;
|
sp->pal = spj->pal;
|
||||||
if(sp->pal)
|
if(sp->pal)
|
||||||
{
|
{
|
||||||
sp->clipdist = 80;
|
sp->clipdist = 80;
|
||||||
|
@ -914,7 +915,7 @@ int spawn_d(int j, int pn)
|
||||||
|
|
||||||
if(j >= 0)
|
if(j >= 0)
|
||||||
{
|
{
|
||||||
if( sprite[j].picnum == NUKEBARREL )
|
if( spj->picnum == NUKEBARREL )
|
||||||
sp->pal = 8;
|
sp->pal = 8;
|
||||||
insertspriteq(i);
|
insertspriteq(i);
|
||||||
}
|
}
|
||||||
|
@ -1084,7 +1085,7 @@ int spawn_d(int j, int pn)
|
||||||
case STEAM:
|
case STEAM:
|
||||||
if(j >= 0)
|
if(j >= 0)
|
||||||
{
|
{
|
||||||
sp->ang = sprite[j].ang;
|
sp->ang = spj->ang;
|
||||||
sp->cstat = 16+128+2;
|
sp->cstat = 16+128+2;
|
||||||
sp->xrepeat=sp->yrepeat=1;
|
sp->xrepeat=sp->yrepeat=1;
|
||||||
sp->xvel = -8;
|
sp->xvel = -8;
|
||||||
|
|
|
@ -44,6 +44,7 @@ int spawn_r(int j, int pn)
|
||||||
if (!(i & 0x1000000)) return i;
|
if (!(i & 0x1000000)) return i;
|
||||||
i &= 0xffffff;
|
i &= 0xffffff;
|
||||||
auto sp = &sprite[i];
|
auto sp = &sprite[i];
|
||||||
|
auto spj = &sprite[j];
|
||||||
auto t = hittype[i].temp_data;
|
auto t = hittype[i].temp_data;
|
||||||
int sect = sp->sectnum;
|
int sect = sp->sectnum;
|
||||||
|
|
||||||
|
@ -209,7 +210,7 @@ int spawn_r(int j, int pn)
|
||||||
case MUD:
|
case MUD:
|
||||||
if (j >= 0)
|
if (j >= 0)
|
||||||
{
|
{
|
||||||
setsprite(i, sprite[j].x, sprite[j].y, sprite[j].z);
|
setsprite(i, spj->x, spj->y, spj->z);
|
||||||
sp->xrepeat = sp->yrepeat = 8+(krand()&7);
|
sp->xrepeat = sp->yrepeat = 8+(krand()&7);
|
||||||
}
|
}
|
||||||
else sp->xrepeat = sp->yrepeat = 16+(krand()&15);
|
else sp->xrepeat = sp->yrepeat = 16+(krand()&15);
|
||||||
|
@ -218,12 +219,12 @@ int spawn_r(int j, int pn)
|
||||||
sp->cstat |= 128;
|
sp->cstat |= 128;
|
||||||
if (j >= 0)
|
if (j >= 0)
|
||||||
{
|
{
|
||||||
if (sector[sprite[j].sectnum].lotag == 2)
|
if (sector[spj->sectnum].lotag == 2)
|
||||||
{
|
{
|
||||||
sp->z = getceilzofslope(sp->sectnum, sp->x, sp->y) + (16 << 8);
|
sp->z = getceilzofslope(sp->sectnum, sp->x, sp->y) + (16 << 8);
|
||||||
sp->cstat |= 8;
|
sp->cstat |= 8;
|
||||||
}
|
}
|
||||||
else if (sector[sprite[j].sectnum].lotag == 1)
|
else if (sector[spj->sectnum].lotag == 1)
|
||||||
sp->z = getflorzofslope(sp->sectnum, sp->x, sp->y);
|
sp->z = getflorzofslope(sp->sectnum, sp->x, sp->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,7 +290,7 @@ int spawn_r(int j, int pn)
|
||||||
break;
|
break;
|
||||||
case TONGUE:
|
case TONGUE:
|
||||||
if(j >= 0)
|
if(j >= 0)
|
||||||
sp->ang = sprite[j].ang;
|
sp->ang = spj->ang;
|
||||||
sp->z -= 38<<8;
|
sp->z -= 38<<8;
|
||||||
sp->zvel = 256-(krand()&511);
|
sp->zvel = 256-(krand()&511);
|
||||||
sp->xvel = 64-(krand()&127);
|
sp->xvel = 64-(krand()&127);
|
||||||
|
@ -303,12 +304,12 @@ int spawn_r(int j, int pn)
|
||||||
case FRAMEEFFECT1:
|
case FRAMEEFFECT1:
|
||||||
if (j >= 0)
|
if (j >= 0)
|
||||||
{
|
{
|
||||||
sp->xrepeat = sprite[j].xrepeat;
|
sp->xrepeat = spj->xrepeat;
|
||||||
sp->yrepeat = sprite[j].yrepeat;
|
sp->yrepeat = spj->yrepeat;
|
||||||
if (sprite[j].picnum == APLAYER)
|
if (spj->picnum == APLAYER)
|
||||||
t[1] = SMALLSMOKE;
|
t[1] = SMALLSMOKE;
|
||||||
else
|
else
|
||||||
t[1] = sprite[j].picnum;
|
t[1] = spj->picnum;
|
||||||
}
|
}
|
||||||
else sp->xrepeat = sp->yrepeat = 0;
|
else sp->xrepeat = sp->yrepeat = 0;
|
||||||
|
|
||||||
|
@ -338,15 +339,15 @@ int spawn_r(int j, int pn)
|
||||||
|
|
||||||
if(j >= 0)
|
if(j >= 0)
|
||||||
{
|
{
|
||||||
if( sprite[j].pal == 1)
|
if( spj->pal == 1)
|
||||||
sp->pal = 1;
|
sp->pal = 1;
|
||||||
else if( sprite[j].pal != 6 && sprite[j].picnum != NUKEBARREL && sprite[j].picnum != TIRE )
|
else if( spj->pal != 6 && spj->picnum != NUKEBARREL && spj->picnum != TIRE )
|
||||||
{
|
{
|
||||||
sp->pal = 2; // Red
|
sp->pal = 2; // Red
|
||||||
}
|
}
|
||||||
else sp->pal = 0; // green
|
else sp->pal = 0; // green
|
||||||
|
|
||||||
if(sprite[j].picnum == TIRE)
|
if(spj->picnum == TIRE)
|
||||||
sp->shade = 127;
|
sp->shade = 127;
|
||||||
}
|
}
|
||||||
sp->cstat |= 32;
|
sp->cstat |= 32;
|
||||||
|
@ -359,7 +360,7 @@ int spawn_r(int j, int pn)
|
||||||
sp->xrepeat = 7+(krand()&7);
|
sp->xrepeat = 7+(krand()&7);
|
||||||
sp->yrepeat = 7+(krand()&7);
|
sp->yrepeat = 7+(krand()&7);
|
||||||
sp->z -= (16<<8);
|
sp->z -= (16<<8);
|
||||||
if(j >= 0 && sprite[j].pal == 6)
|
if(j >= 0 && spj->pal == 6)
|
||||||
sp->pal = 6;
|
sp->pal = 6;
|
||||||
insertspriteq(i);
|
insertspriteq(i);
|
||||||
changespritestat(i, STAT_MISC);
|
changespritestat(i, STAT_MISC);
|
||||||
|
@ -540,12 +541,12 @@ int spawn_r(int j, int pn)
|
||||||
changespritestat(i,2);
|
changespritestat(i,2);
|
||||||
break;
|
break;
|
||||||
case DUKELYINGDEAD:
|
case DUKELYINGDEAD:
|
||||||
if(j >= 0 && sprite[j].picnum == APLAYER)
|
if(j >= 0 && spj->picnum == APLAYER)
|
||||||
{
|
{
|
||||||
sp->xrepeat = sprite[j].xrepeat;
|
sp->xrepeat = spj->xrepeat;
|
||||||
sp->yrepeat = sprite[j].yrepeat;
|
sp->yrepeat = spj->yrepeat;
|
||||||
sp->shade = sprite[j].shade;
|
sp->shade = spj->shade;
|
||||||
sp->pal = ps[sprite[j].yvel].palookup;
|
sp->pal = ps[spj->yvel].palookup;
|
||||||
}
|
}
|
||||||
sp->cstat = 0;
|
sp->cstat = 0;
|
||||||
sp->extra = 1;
|
sp->extra = 1;
|
||||||
|
@ -618,7 +619,7 @@ int spawn_r(int j, int pn)
|
||||||
case SMALLSMOKE:
|
case SMALLSMOKE:
|
||||||
if(j >= 0)
|
if(j >= 0)
|
||||||
{
|
{
|
||||||
sp->ang = sprite[j].ang;
|
sp->ang = spj->ang;
|
||||||
sp->shade = -64;
|
sp->shade = -64;
|
||||||
sp->cstat = 128|(krand()&4);
|
sp->cstat = 128|(krand()&4);
|
||||||
}
|
}
|
||||||
|
@ -662,8 +663,8 @@ int spawn_r(int j, int pn)
|
||||||
case PLAYERONWATER:
|
case PLAYERONWATER:
|
||||||
if(j >= 0)
|
if(j >= 0)
|
||||||
{
|
{
|
||||||
sp->xrepeat = sprite[j].xrepeat;
|
sp->xrepeat = spj->xrepeat;
|
||||||
sp->yrepeat = sprite[j].yrepeat;
|
sp->yrepeat = spj->yrepeat;
|
||||||
sp->zvel = 128;
|
sp->zvel = 128;
|
||||||
if(sector[sp->sectnum].lotag != 2)
|
if(sector[sp->sectnum].lotag != 2)
|
||||||
sp->cstat |= 32768;
|
sp->cstat |= 32768;
|
||||||
|
@ -683,12 +684,12 @@ int spawn_r(int j, int pn)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WATERBUBBLE:
|
case WATERBUBBLE:
|
||||||
if(j >= 0 && sprite[j].picnum == APLAYER)
|
if(j >= 0 && spj->picnum == APLAYER)
|
||||||
sp->z-= (16<<8);
|
sp->z-= (16<<8);
|
||||||
if(sp->picnum == WATERBUBBLE)
|
if(sp->picnum == WATERBUBBLE)
|
||||||
{
|
{
|
||||||
if(j >= 0)
|
if(j >= 0)
|
||||||
sp->ang = sprite[j].ang;
|
sp->ang = spj->ang;
|
||||||
sp->xrepeat = sp->yrepeat = 1+(krand()&7);
|
sp->xrepeat = sp->yrepeat = 1+(krand()&7);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1053,7 +1054,7 @@ int spawn_r(int j, int pn)
|
||||||
}
|
}
|
||||||
else changespritestat(i,2);
|
else changespritestat(i,2);
|
||||||
|
|
||||||
sp->shade = sprite[j].shade;
|
sp->shade = spj->shade;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -1082,7 +1083,7 @@ int spawn_r(int j, int pn)
|
||||||
sp->shade = -12;
|
sp->shade = -12;
|
||||||
|
|
||||||
if(j >= 0)
|
if(j >= 0)
|
||||||
if( sprite[j].picnum == NUKEBARREL )
|
if( spj->picnum == NUKEBARREL )
|
||||||
sp->pal = 8;
|
sp->pal = 8;
|
||||||
|
|
||||||
changespritestat(i,1);
|
changespritestat(i,1);
|
||||||
|
@ -1348,7 +1349,7 @@ int spawn_r(int j, int pn)
|
||||||
case STEAM:
|
case STEAM:
|
||||||
if(j >= 0)
|
if(j >= 0)
|
||||||
{
|
{
|
||||||
sp->ang = sprite[j].ang;
|
sp->ang = spj->ang;
|
||||||
sp->cstat = 16+128+2;
|
sp->cstat = 16+128+2;
|
||||||
sp->xrepeat=sp->yrepeat=1;
|
sp->xrepeat=sp->yrepeat=1;
|
||||||
sp->xvel = -8;
|
sp->xvel = -8;
|
||||||
|
|
Loading…
Reference in a new issue