- forcesphere, watersplash2, frameeffect and money.

This commit is contained in:
Christoph Oelckers 2020-10-21 23:11:06 +02:00
parent 6e1d3a025a
commit 6cbe74e115
4 changed files with 57 additions and 60 deletions

View file

@ -2063,21 +2063,22 @@ void camera(DDukeActor *actor)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void forcesphere(int i) void forcesphereexplode(DDukeActor *actor)
{ {
spritetype* s = &sprite[i]; int* t = &actor->temp_data[0];
auto t = &hittype[i].temp_data[0]; int l = actor->s.xrepeat;
int l = s->xrepeat;
if (t[1] > 0) if (t[1] > 0)
{ {
t[1]--; t[1]--;
if (t[1] == 0) if (t[1] == 0)
{ {
deletesprite(i); deletesprite(actor);
return; return;
} }
} }
if (hittype[s->owner].temp_data[1] == 0) auto Owner = actor->GetOwner();
if (!Owner) return;
if (Owner->temp_data[1] == 0)
{ {
if (t[0] < 64) if (t[0] < 64)
{ {
@ -2092,20 +2093,20 @@ void forcesphere(int i)
l -= 3; l -= 3;
} }
s->x = sprite[s->owner].x; actor->s.x = Owner->s.x;
s->y = sprite[s->owner].y; actor->s.y = Owner->s.y;
s->z = sprite[s->owner].z; actor->s.z = Owner->s.z;
s->ang += hittype[s->owner].temp_data[0]; actor->s.ang += Owner->temp_data[0];
if (l > 64) l = 64; if (l > 64) l = 64;
else if (l < 1) l = 1; else if (l < 1) l = 1;
s->xrepeat = l; actor->s.xrepeat = l;
s->yrepeat = l; actor->s.yrepeat = l;
s->shade = (l >> 1) - 48; actor->s.shade = (l >> 1) - 48;
for (int j = t[0]; j > 0; j--) for (int j = t[0]; j > 0; j--)
ssp(i, CLIPMASK0); ssp(actor, CLIPMASK0);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -2114,21 +2115,20 @@ void forcesphere(int i)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void watersplash2(int i) void watersplash2(DDukeActor* actor)
{ {
spritetype* s = &sprite[i]; int sect = actor->s.sectnum;
int sect = s->sectnum; int* t = &actor->temp_data[0];
auto t = &hittype[i].temp_data[0];
t[0]++; t[0]++;
if (t[0] == 1) if (t[0] == 1)
{ {
if (sector[sect].lotag != 1 && sector[sect].lotag != 2) if (sector[sect].lotag != 1 && sector[sect].lotag != 2)
{ {
deletesprite(i); deletesprite(actor);
return; return;
} }
if (!S_CheckSoundPlaying(ITEM_SPLASH)) if (!S_CheckSoundPlaying(ITEM_SPLASH))
S_PlayActorSound(ITEM_SPLASH, i); S_PlayActorSound(ITEM_SPLASH, actor);
} }
if (t[0] == 3) if (t[0] == 3)
{ {
@ -2136,7 +2136,7 @@ void watersplash2(int i)
t[1]++; t[1]++;
} }
if (t[1] == 5) if (t[1] == 5)
deletesprite(i); deletesprite(actor);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -2145,25 +2145,23 @@ void watersplash2(int i)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void frameeffect1(int i) void frameeffect1(DDukeActor *actor)
{ {
spritetype* s = &sprite[i]; int* t = &actor->temp_data[0];
auto t = &hittype[i].temp_data[0]; auto Owner = actor->GetOwner();
if (s->owner >= 0) if (Owner)
{ {
t[0]++; t[0]++;
if (t[0] > 7) if (t[0] > 7)
{ {
deletesprite(i); deletesprite(actor);
return; return;
} }
else if (t[0] > 4) else if (t[0] > 4) actor->s.cstat |= 512 + 2;
s->cstat |= 512 + 2; else if (t[0] > 2) actor->s.cstat |= 2;
else if (t[0] > 2) actor->s.xoffset = Owner->s.xoffset;
s->cstat |= 2; actor->s.yoffset = Owner->s.yoffset;
s->xoffset = sprite[s->owner].xoffset;
s->yoffset = sprite[s->owner].yoffset;
} }
} }
@ -2173,15 +2171,15 @@ void frameeffect1(int i)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool money(int i, int BLOODPOOL) bool money(DDukeActor* actor, int BLOODPOOL)
{ {
spritetype* s = &sprite[i]; auto s = &actor->s;
int sect = s->sectnum; int sect = s->sectnum;
auto t = &hittype[i].temp_data[0]; int* t = &actor->temp_data[0];
s->xvel = (krand() & 7) + (sintable[hittype[i].temp_data[0] & 2047] >> 9); s->xvel = (krand() & 7) + (sintable[actor->temp_data[0] & 2047] >> 9);
hittype[i].temp_data[0] += (krand() & 63); actor->temp_data[0] += (krand() & 63);
if ((hittype[i].temp_data[0] & 2047) > 512 && (hittype[i].temp_data[0] & 2047) < 1596) if ((actor->temp_data[0] & 2047) > 512 && (actor->temp_data[0] & 2047) < 1596)
{ {
if (sector[sect].lotag == 2) if (sector[sect].lotag == 2)
{ {
@ -2193,14 +2191,14 @@ bool money(int i, int BLOODPOOL)
s->zvel += (gc >> 5) + (krand() & 7); s->zvel += (gc >> 5) + (krand() & 7);
} }
ssp(i, CLIPMASK0); ssp(actor, CLIPMASK0);
if ((krand() & 3) == 0) if ((krand() & 3) == 0)
setsprite(i, s->x, s->y, s->z); setsprite(actor, s->pos);
if (s->sectnum == -1) if (s->sectnum == -1)
{ {
deletesprite(i); deletesprite(actor);
return false; return false;
} }
int l = getflorzofslope(s->sectnum, s->x, s->y); int l = getflorzofslope(s->sectnum, s->x, s->y);
@ -2209,15 +2207,14 @@ bool money(int i, int BLOODPOOL)
{ {
s->z = l; s->z = l;
insertspriteq(&hittype[i]); insertspriteq(actor);
sprite[i].picnum++; s->picnum++;
StatIterator it(STAT_MISC); DukeStatIterator it(STAT_MISC);
int j; while (auto aa = it.Next())
while ((j = it.NextIndex()) >= 0)
{ {
if (sprite[j].picnum == BLOODPOOL) if (aa->s.picnum == BLOODPOOL)
if (ldist(s, &sprite[j]) < 348) if (ldist(actor, aa) < 348)
{ {
s->pal = 2; s->pal = 2;
break; break;

View file

@ -3428,14 +3428,14 @@ void moveexplosions_d(void) // STATNUM 5
continue; continue;
case FORCESPHERE: case FORCESPHERE:
forcesphere(i); forcesphereexplode(&hittype[i]);
continue; continue;
case WATERSPLASH2: case WATERSPLASH2:
watersplash2(i); watersplash2(&hittype[i]);
continue; continue;
case FRAMEEFFECT1: case FRAMEEFFECT1:
frameeffect1(i); frameeffect1(&hittype[i]);
continue; continue;
case INNERJAW: case INNERJAW:
case INNERJAW + 1: case INNERJAW + 1:
@ -3467,7 +3467,7 @@ void moveexplosions_d(void) // STATNUM 5
case MONEY: case MONEY:
case MAIL: case MAIL:
case PAPER: case PAPER:
money(i, BLOODPOOL); money(&hittype[i], BLOODPOOL);
break; break;

View file

@ -3269,7 +3269,7 @@ void moveexplosions_r(void) // STATNUM 5
case FORCESPHERE: case FORCESPHERE:
forcesphere(i); forcesphereexplode(&hittype[i]);
continue; continue;
case MUD: case MUD:
@ -3295,11 +3295,11 @@ void moveexplosions_r(void) // STATNUM 5
continue; continue;
case WATERSPLASH2: case WATERSPLASH2:
watersplash2(i); watersplash2(&hittype[i]);
continue; continue;
case FRAMEEFFECT1: case FRAMEEFFECT1:
frameeffect1(i); frameeffect1(&hittype[i]);
continue; continue;
case INNERJAW: case INNERJAW:
case INNERJAW + 1: case INNERJAW + 1:
@ -3335,7 +3335,7 @@ void moveexplosions_r(void) // STATNUM 5
} }
break; break;
case MONEY: case MONEY:
if (!money(i, BLOODPOOL)) continue; if (!money(&hittype[i], BLOODPOOL)) continue;
if (sector[s->sectnum].lotag == 800) if (sector[s->sectnum].lotag == 800)
if (s->z >= sector[s->sectnum].floorz - (8 << 8)) if (s->z >= sector[s->sectnum].floorz - (8 << 8))

View file

@ -53,10 +53,10 @@ void recon(DDukeActor* i, int explosion, int firelaser, int attacksnd, int pains
void ooz(DDukeActor* i); void ooz(DDukeActor* i);
void reactor(DDukeActor* i, int REACTOR, int REACTOR2, int REACTORBURNT, int REACTOR2BURNT, int REACTORSPARK, int REACTOR2SPARK); void reactor(DDukeActor* i, int REACTOR, int REACTOR2, int REACTORBURNT, int REACTOR2BURNT, int REACTORSPARK, int REACTOR2SPARK);
void camera(DDukeActor* i); void camera(DDukeActor* i);
void forcesphere(int i); void forcesphereexplode(DDukeActor* i);
void watersplash2(int i); void watersplash2(DDukeActor* i);
void frameeffect1(int i); void frameeffect1(DDukeActor* i);
bool money(int i, int BLOODPOOL); bool money(DDukeActor* i, int BLOODPOOL);
bool jibs(int i, int JIBS6, bool timeout, bool callsetsprite, bool floorcheck, bool zcheck1, bool zcheck2); bool jibs(int i, int JIBS6, bool timeout, bool callsetsprite, bool floorcheck, bool zcheck1, bool zcheck2);
bool bloodpool(int i, bool puke, int TIRE); bool bloodpool(int i, bool puke, int TIRE);
void shell(int i, bool morecheck); void shell(int i, bool morecheck);