- shared SE25 code.

This commit is contained in:
Christoph Oelckers 2020-10-22 00:59:42 +02:00
parent 00f5a08390
commit 21fb3fb7bb
4 changed files with 43 additions and 50 deletions

View file

@ -4613,6 +4613,44 @@ void handle_se24(DDukeActor *actor, int16_t *list1, int16_t *list2, int TRIPBOMB
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void handle_se25(DDukeActor* actor, int t_index, int snd1, int snd2)
{
int* t = &actor->temp_data[0];
auto sec = &sector[actor->s.sectnum];
if (sec->floorz <= sec->ceilingz)
actor->s.shade = 0;
else if (sec->ceilingz <= t[t_index])
actor->s.shade = 1;
if (actor->s.shade)
{
sec->ceilingz += actor->s.yvel << 4;
if (sec->ceilingz > sec->floorz)
{
sec->ceilingz = sec->floorz;
if (pistonsound && snd1 >= 0)
S_PlayActorSound(snd1, actor);
}
}
else
{
sec->ceilingz -= actor->s.yvel << 4;
if (sec->ceilingz < t[t_index])
{
sec->ceilingz = t[t_index];
if (pistonsound && snd2 >= 0)
S_PlayActorSound(snd2, actor);
}
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void handle_se32(DDukeActor *actor) void handle_se32(DDukeActor *actor)
{ {
auto s = &actor->s; auto s = &actor->s;

View file

@ -3685,27 +3685,8 @@ void moveeffectors_d(void) //STATNUM 3
break; break;
case 25: //PISTONS case 25: //PISTONS
if (hittype[i].temp_data[4] == 0) break;
if (t[4] == 0) break; handle_se25(&hittype[i], 3, -1, -1);
if (sc->floorz <= sc->ceilingz)
s->shade = 0;
else if (sc->ceilingz <= t[3])
s->shade = 1;
if (s->shade)
{
sc->ceilingz += sprite[i].yvel << 4;
if (sc->ceilingz > sc->floorz)
sc->ceilingz = sc->floorz;
}
else
{
sc->ceilingz -= sprite[i].yvel << 4;
if (sc->ceilingz < t[3])
sc->ceilingz = t[3];
}
break; break;
case 26: case 26:

View file

@ -3421,7 +3421,7 @@ void moveexplosions_r(void) // STATNUM 5
void moveeffectors_r(void) //STATNUM 3 void moveeffectors_r(void) //STATNUM 3
{ {
int l, x, st, j, * t; int l, x, st, j, * t;
int p, sh, ns, pn; int sh, ns, pn;
short k; short k;
spritetype* s; spritetype* s;
sectortype* sc; sectortype* sc;
@ -3659,35 +3659,8 @@ void moveeffectors_r(void) //STATNUM 3
break; break;
case 25: //PISTONS case 25: //PISTONS
if (t[4] == 0) break; if (t[4] == 0) break;
handle_se25(&hittype[i], 4, isRRRA() ? 371 : -1, isRRRA() ? 167 : -1);
if (sc->floorz <= sc->ceilingz)
s->shade = 0;
else if (sc->ceilingz <= t[4])
s->shade = 1;
if (s->shade)
{
sc->ceilingz += sprite[i].yvel << 4;
if (sc->ceilingz > sc->floorz)
{
sc->ceilingz = sc->floorz;
if (isRRRA() && pistonsound)
S_PlayActorSound(371, i);
}
}
else
{
sc->ceilingz -= sprite[i].yvel << 4;
if (sc->ceilingz < t[4])
{
sc->ceilingz = t[4];
if (isRRRA() && pistonsound)
S_PlayActorSound(167, i);
}
}
break; break;
case 26: case 26:

View file

@ -85,6 +85,7 @@ void handle_se20(DDukeActor* i);
void handle_se21(DDukeActor* i); void handle_se21(DDukeActor* i);
void handle_se22(DDukeActor* i); void handle_se22(DDukeActor* i);
void handle_se24(DDukeActor* actor, int16_t* list1, int16_t* list2, int TRIPBOMB, int LASERLINE, int CRANE, int shift); void handle_se24(DDukeActor* actor, int16_t* list1, int16_t* list2, int TRIPBOMB, int LASERLINE, int CRANE, int shift);
void handle_se25(DDukeActor* a, int t_index, int snd1, int snd2);
void handle_se26(DDukeActor* i); void handle_se26(DDukeActor* i);
void handle_se27(DDukeActor* i); void handle_se27(DDukeActor* i);
void handle_se32(DDukeActor* i); void handle_se32(DDukeActor* i);