- movefountain and moveflammable.

# Conflicts:
#	source/games/duke/src/actors.cpp
This commit is contained in:
Christoph Oelckers 2020-10-21 21:46:39 +02:00
parent 544078c9ba
commit 38e0ac1e3f
4 changed files with 23 additions and 21 deletions

View file

@ -837,26 +837,29 @@ void movecrane(DDukeActor *actor, int crane)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void movefountain(int i, int fountain) void movefountain(DDukeActor *actor, int fountain)
{ {
auto t = &hittype[i].temp_data[0]; int* t = &actor->temp_data[0];
auto &pn = sprite[i].picnum;
int x; int x;
if (t[0] > 0) if (t[0] > 0)
{ {
if (t[0] < 20) if (t[0] < 20)
{ {
t[0]++; t[0]++;
if (++pn == fountain + 3) pn = fountain + 1;
actor->s.picnum++;
if (actor->s.picnum == fountain + 3)
actor->s.picnum = fountain + 1;
} }
else else
{ {
findplayer(&sprite[i], &x); findplayer(actor, &x);
if (x > 512) if (x > 512)
{ {
t[0] = 0; t[0] = 0;
pn = fountain; actor->s.picnum = fountain;
} }
else t[0] = 1; else t[0] = 1;
} }
@ -868,10 +871,9 @@ void movefountain(int i, int fountain)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void moveflammable(int i, int tire, int box, int pool) void moveflammable(DDukeActor* actor, int tire, int box, int pool)
{ {
auto spri = &sprite[i]; auto spri = &actor->s;
auto actor = &hittype[i];
int j; int j;
if (actor->temp_data[0] == 1) if (actor->temp_data[0] == 1)
{ {
@ -881,15 +883,15 @@ void moveflammable(int i, int tire, int box, int pool)
if (!isRR() && spri->picnum == tire && actor->temp_data[1] == 32) if (!isRR() && spri->picnum == tire && actor->temp_data[1] == 32)
{ {
spri->cstat = 0; spri->cstat = 0;
j = fi.spawn(i, pool); auto spawned = spawn(actor, pool);
sprite[j].shade = 127; spawned->s.shade = 127;
} }
else else
{ {
if (spri->shade < 64) spri->shade++; if (spri->shade < 64) spri->shade++;
else else
{ {
deletesprite(i); deletesprite(actor);
return; return;
} }
} }
@ -897,7 +899,7 @@ void moveflammable(int i, int tire, int box, int pool)
j = spri->xrepeat - (krand() & 7); j = spri->xrepeat - (krand() & 7);
if (j < 10) if (j < 10)
{ {
deletesprite(i); deletesprite(actor);
return; return;
} }
@ -906,14 +908,14 @@ void moveflammable(int i, int tire, int box, int pool)
j = spri->yrepeat - (krand() & 7); j = spri->yrepeat - (krand() & 7);
if (j < 4) if (j < 4)
{ {
deletesprite(i); deletesprite(actor);
return; return;
} }
spri->yrepeat = j; spri->yrepeat = j;
} }
if (box >= 0 && spri->picnum == box) if (box >= 0 && spri->picnum == box)
{ {
makeitfall(i); makeitfall(actor);
actor->ceilingz = sector[spri->sectnum].ceilingz; actor->ceilingz = sector[spri->sectnum].ceilingz;
} }
} }

View file

@ -1507,12 +1507,12 @@ void movestandables_d(void)
else if (picnum >= WATERFOUNTAIN && picnum <= WATERFOUNTAIN + 3) else if (picnum >= WATERFOUNTAIN && picnum <= WATERFOUNTAIN + 3)
{ {
movefountain(i, WATERFOUNTAIN); movefountain(&hittype[i], WATERFOUNTAIN);
} }
else if (AFLAMABLE(picnum)) else if (AFLAMABLE(picnum))
{ {
moveflammable(i, TIRE, BOX, BLOODPOOL); moveflammable(&hittype[i], TIRE, BOX, BLOODPOOL);
} }
else if (picnum == TRIPBOMB) else if (picnum == TRIPBOMB)

View file

@ -1064,12 +1064,12 @@ void movestandables_r(void)
else if (picnum >= WATERFOUNTAIN && picnum <= WATERFOUNTAIN + 3) else if (picnum >= WATERFOUNTAIN && picnum <= WATERFOUNTAIN + 3)
{ {
movefountain(i, WATERFOUNTAIN); movefountain(&hittype[i], WATERFOUNTAIN);
} }
else if (AFLAMABLE(picnum)) else if (AFLAMABLE(picnum))
{ {
moveflammable(i, TIRE, BOX, BLOODPOOL); moveflammable(&hittype[i], TIRE, BOX, BLOODPOOL);
} }

View file

@ -31,8 +31,8 @@ void moveclouds(double smoothratio);
void RANDOMSCRAP(DDukeActor* i); void RANDOMSCRAP(DDukeActor* i);
void ms(DDukeActor* i); void ms(DDukeActor* i);
void movecrane(DDukeActor* i, int crane); void movecrane(DDukeActor* i, int crane);
void movefountain(int i, int fountain); void movefountain(DDukeActor* i, int fountain);
void moveflammable(int i, int tire, int box, int pool); void moveflammable(DDukeActor* i, int tire, int box, int pool);
void detonate(int i, int explosion); void detonate(int i, int explosion);
void movemasterswitch(int i, int spectype1, int spectype2); void movemasterswitch(int i, int spectype1, int spectype2);
void movetrash(int i); void movetrash(int i);