mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-29 13:00:43 +00:00
- experimented a bit with optimizing the spawn function's use.
This commit is contained in:
parent
356060e127
commit
87e4c0fa7d
2 changed files with 38 additions and 34 deletions
|
@ -1404,19 +1404,20 @@ void movetongue(int i, int tongue, int jaw)
|
|||
|
||||
void rpgexplode(int i, int j, const vec3_t &pos, int EXPLOSION2, int newextra, int playsound)
|
||||
{
|
||||
auto s = &sprite[i];
|
||||
int k = fi.spawn(i, EXPLOSION2);
|
||||
sprite[k].pos = pos;
|
||||
auto act = &hittype[i];
|
||||
auto s = &act->s;
|
||||
auto k = spawn(act, EXPLOSION2);
|
||||
k->s.pos = pos;
|
||||
|
||||
if (s->xrepeat < 10)
|
||||
{
|
||||
sprite[k].xrepeat = 6;
|
||||
sprite[k].yrepeat = 6;
|
||||
k->s.xrepeat = 6;
|
||||
k->s.yrepeat = 6;
|
||||
}
|
||||
else if ((j & kHitTypeMask) == kHitSector)
|
||||
{
|
||||
sprite[k].cstat |= 8;
|
||||
sprite[k].z += (48 << 8);
|
||||
k->s.cstat |= 8;
|
||||
k->s.z += (48 << 8);
|
||||
}
|
||||
if (newextra > 0) s->extra = newextra;
|
||||
S_PlayActorSound(playsound, i);
|
||||
|
@ -1596,8 +1597,9 @@ bool queball(int i, int pocket, int queball, int stripeball)
|
|||
|
||||
void forcesphere(int i, int forcesphere)
|
||||
{
|
||||
spritetype* s = &sprite[i];
|
||||
auto t = &hittype[i].temp_data[0];
|
||||
auto act = &hittype[i];
|
||||
auto s = &act->s;
|
||||
auto t = &act->temp_data[0];
|
||||
int sect = s->sectnum;
|
||||
if (s->yvel == 0)
|
||||
{
|
||||
|
@ -1606,13 +1608,13 @@ void forcesphere(int i, int forcesphere)
|
|||
for (int l = 512; l < (2048 - 512); l += 128)
|
||||
for (int j = 0; j < 2048; j += 128)
|
||||
{
|
||||
int k = fi.spawn(i, forcesphere);
|
||||
sprite[k].cstat = 257 + 128;
|
||||
sprite[k].clipdist = 64;
|
||||
sprite[k].ang = j;
|
||||
sprite[k].zvel = sintable[l & 2047] >> 5;
|
||||
sprite[k].xvel = sintable[(l + 512) & 2047] >> 9;
|
||||
sprite[k].owner = i;
|
||||
auto k = spawn(act, forcesphere);
|
||||
k->s.cstat = 257 + 128;
|
||||
k->s.clipdist = 64;
|
||||
k->s.ang = j;
|
||||
k->s.zvel = sintable[l & 2047] >> 5;
|
||||
k->s.xvel = sintable[(l + 512) & 2047] >> 9;
|
||||
k->s.owner = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4703,8 +4705,9 @@ void handle_se128(int i)
|
|||
|
||||
void handle_se130(int i, int countmax, int EXPLOSION2)
|
||||
{
|
||||
spritetype* s = &sprite[i];
|
||||
auto t = &hittype[i].temp_data[0];
|
||||
auto act = &hittype[i];
|
||||
spritetype* s = &act->s;
|
||||
auto t = &act->temp_data[0];
|
||||
auto sc = §or[s->sectnum];
|
||||
|
||||
if (t[0] > countmax)
|
||||
|
@ -4718,11 +4721,11 @@ void handle_se130(int i, int countmax, int EXPLOSION2)
|
|||
|
||||
if (rnd(64))
|
||||
{
|
||||
int k = fi.spawn(i, EXPLOSION2);
|
||||
sprite[k].xrepeat = sprite[k].yrepeat = 2 + (krand() & 7);
|
||||
sprite[k].z = sc->floorz - (krand() % x);
|
||||
sprite[k].ang += 256 - (krand() % 511);
|
||||
sprite[k].xvel = krand() & 127;
|
||||
auto k = spawn(act, EXPLOSION2);
|
||||
k->s.xrepeat = k->s.yrepeat = 2 + (krand() & 7);
|
||||
k->s.z = sc->floorz - (krand() % x);
|
||||
k->s.ang += 256 - (krand() % 511);
|
||||
k->s.xvel = krand() & 127;
|
||||
ssp(k, CLIPMASK0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1273,7 +1273,8 @@ static bool weaponhitsprite(int i, int j, const vec3_t &oldpos)
|
|||
|
||||
static bool weaponhitwall(int i, int j, const vec3_t& oldpos)
|
||||
{
|
||||
auto s = &sprite[i];
|
||||
auto act = &hittype[i];
|
||||
auto s = &act->s;
|
||||
|
||||
if (isRRRA() && sprite[s->owner].picnum == MAMA)
|
||||
{
|
||||
|
@ -1327,12 +1328,12 @@ static bool weaponhitwall(int i, int j, const vec3_t& oldpos)
|
|||
s->y += sintable[s->ang & 2047] >> 7;
|
||||
if (!isRRRA() || (sprite[s->owner].picnum != CHEER && sprite[s->owner].picnum != CHEERSTAYPUT))
|
||||
{
|
||||
j = fi.spawn(i, CIRCLESTUCK);
|
||||
sprite[j].xrepeat = 8;
|
||||
sprite[j].yrepeat = 8;
|
||||
sprite[j].cstat = 16;
|
||||
sprite[j].ang = (sprite[j].ang + 512) & 2047;
|
||||
sprite[j].clipdist = mulscale7(s->xrepeat, tilesiz[s->picnum].x);
|
||||
auto j = spawn(act, CIRCLESTUCK);
|
||||
j->s.xrepeat = 8;
|
||||
j->s.yrepeat = 8;
|
||||
j->s.cstat = 16;
|
||||
j->s.ang = (j->s.ang + 512) & 2047;
|
||||
j->s.clipdist = mulscale7(s->xrepeat, tilesiz[s->picnum].x);
|
||||
}
|
||||
deletesprite(i);
|
||||
return true;
|
||||
|
@ -2523,10 +2524,10 @@ void rr_specialstats()
|
|||
s->lotag--;
|
||||
if (s->lotag < 0)
|
||||
{
|
||||
guts_r(&sprite[i], JIBS1, 1, myconnectindex);
|
||||
guts_r(&sprite[i], JIBS2, 1, myconnectindex);
|
||||
guts_r(&sprite[i], JIBS3, 1, myconnectindex);
|
||||
guts_r(&sprite[i], JIBS4, 1, myconnectindex);
|
||||
guts_r(s, JIBS1, 1, myconnectindex);
|
||||
guts_r(s, JIBS2, 1, myconnectindex);
|
||||
guts_r(s, JIBS3, 1, myconnectindex);
|
||||
guts_r(s, JIBS4, 1, myconnectindex);
|
||||
s->lotag = 256;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue