- handle_se20-26.

This commit is contained in:
Christoph Oelckers 2020-10-22 00:35:30 +02:00
parent 5d837176de
commit 769bc3bd22
4 changed files with 51 additions and 55 deletions

View file

@ -4278,10 +4278,10 @@ void handle_se19(DDukeActor *actor, int BIGFORCE)
//
//---------------------------------------------------------------------------
void handle_se20(int i)
void handle_se20(DDukeActor* actor)
{
spritetype* s = &sprite[i];
auto t = &hittype[i].temp_data[0];
auto s = &actor->s;
int* t = &actor->temp_data[0];
auto sc = &sector[s->sectnum];
int st = s->lotag;
int sh = s->hitag;
@ -4300,28 +4300,26 @@ void handle_se20(int i)
s->x += x;
s->y += l;
if (t[3] <= 0 || (t[3] >> 6) >= (sprite[i].yvel >> 6))
if (t[3] <= 0 || (t[3] >> 6) >= (s->yvel >> 6))
{
s->x -= x;
s->y -= l;
t[0] = 0;
callsound(s->sectnum, i);
callsound(s->sectnum, actor->GetIndex());
return;
}
SectIterator it(s->sectnum);
int j;
while ((j = it.NextIndex()) >= 0)
DukeSectIterator it(s->sectnum);
while (auto a2 = it.Next())
{
auto sj = &sprite[j];
if (sj->statnum != 3 && sj->zvel == 0)
if (a2->s.statnum != 3 && a2->s.zvel == 0)
{
sj->x += x;
sj->y += l;
setsprite(j, sj->x, sj->y, sj->z);
if (sector[sj->sectnum].floorstat & 2)
if (sj->statnum == 2)
makeitfall(j);
a2->s.x += x;
a2->s.y += l;
setsprite(a2, a2->s.pos);
if (sector[a2->s.sectnum].floorstat & 2)
if (a2->s.statnum == 2)
makeitfall(a2);
}
}
@ -4337,7 +4335,7 @@ void handle_se20(int i)
ps[p].oposx = ps[p].posx;
ps[p].oposy = ps[p].posy;
setsprite(ps[p].i, ps[p].posx, ps[p].posy, ps[p].posz + PHEIGHT);
setsprite(ps[p].GetActor(), ps[p].posx, ps[p].posy, ps[p].posz + PHEIGHT);
}
sc->floorxpanning -= x >> 3;
@ -4354,10 +4352,10 @@ void handle_se20(int i)
//
//---------------------------------------------------------------------------
void handle_se21(int i)
void handle_se21(DDukeActor* actor)
{
spritetype* s = &sprite[i];
auto t = &hittype[i].temp_data[0];
auto s = &actor->s;
int* t = &actor->temp_data[0];
auto sc = &sector[s->sectnum];
int st = s->lotag;
int sh = s->hitag;
@ -4372,7 +4370,7 @@ void handle_se21(int i)
if (t[0] == 1) //Decide if the s->sectnum should go up or down
{
s->zvel = ksgn(s->z - *lp) * (sprite[i].yvel << 4);
s->zvel = ksgn(s->z - *lp) * (s->yvel << 4);
t[0]++;
}
@ -4383,7 +4381,7 @@ void handle_se21(int i)
if (abs(*lp - s->z) < 1024)
{
*lp = s->z;
deletesprite(i);
deletesprite(actor);
}
}
else sc->extra--;
@ -4395,11 +4393,10 @@ void handle_se21(int i)
//
//---------------------------------------------------------------------------
void handle_se22(int i)
void handle_se22(DDukeActor* actor)
{
spritetype* s = &sprite[i];
auto t = &hittype[i].temp_data[0];
auto sc = &sector[s->sectnum];
int* t = &actor->temp_data[0];
auto sc = &sector[actor->s.sectnum];
if (t[1])
{
if (getanimationgoal(anim_ceilingz, t[0]) >= 0)
@ -4414,12 +4411,12 @@ void handle_se22(int i)
//
//---------------------------------------------------------------------------
void handle_se26(int i)
void handle_se26(DDukeActor* actor)
{
spritetype* s = &sprite[i];
auto t = &hittype[i].temp_data[0];
auto s = &actor->s;
int* t = &actor->temp_data[0];
auto sc = &sector[s->sectnum];
int x, j, l;
int x, l;
s->xvel = 32;
l = (s->xvel * sintable[(s->ang + 512) & 2047]) >> 14;
@ -4436,33 +4433,32 @@ void handle_se26(int i)
else
sc->floorz += s->zvel;
SectIterator it(s->sectnum);
while ((j = it.NextIndex()) >= 0)
DukeSectIterator it(s->sectnum);
while (auto a2 = it.Next())
{
auto sj = &sprite[j];
if (sj->statnum != 3 && sj->statnum != 10)
if (a2->s.statnum != 3 && a2->s.statnum != 10)
{
hittype[j].bposx = sj->x;
hittype[j].bposy = sj->y;
a2->bposx = a2->s.x;
a2->bposy = a2->s.y;
sj->x += l;
sj->y += x;
a2->s.x += l;
a2->s.y += x;
sj->z += s->zvel;
setsprite(j, sj->x, sj->y, sj->z);
a2->s.z += s->zvel;
setsprite(a2, a2->s.pos);
}
}
for (int p = connecthead; p >= 0; p = connectpoint2[p])
if (sprite[ps[p].i].sectnum == s->sectnum && ps[p].on_ground)
if (ps[p].GetActor()->s.sectnum == s->sectnum && ps[p].on_ground)
{
ps[p].fric.x += l << 5;
ps[p].fric.y += x << 5;
ps[p].posz += s->zvel;
}
ms(i);
setsprite(i, s->x, s->y, s->z);
ms(actor);
setsprite(actor, s->pos);
}
//---------------------------------------------------------------------------

View file

@ -3660,15 +3660,15 @@ void moveeffectors_d(void) //STATNUM 3
break;
case SE_20_STRETCH_BRIDGE:
handle_se20(i);
handle_se20(&hittype[i]);
break;
case SE_21_DROP_FLOOR:
handle_se21(i);
handle_se21(&hittype[i]);
break;
case SE_22_TEETH_DOOR:
handle_se22(i);
handle_se22(&hittype[i]);
break;
@ -3791,7 +3791,7 @@ void moveeffectors_d(void) //STATNUM 3
break;
case 26:
handle_se26(i);
handle_se26(&hittype[i]);
break;
case SE_27_DEMO_CAM:

View file

@ -3631,15 +3631,15 @@ void moveeffectors_r(void) //STATNUM 3
break;
case SE_20_STRETCH_BRIDGE:
handle_se20(i);
handle_se20(&hittype[i]);
break;
case SE_21_DROP_FLOOR:
handle_se21(i);
handle_se21(&hittype[i]);
break;
case SE_22_TEETH_DOOR:
handle_se22(i);
handle_se22(&hittype[i]);
break;
@ -3761,7 +3761,7 @@ void moveeffectors_r(void) //STATNUM 3
break;
case 26:
handle_se26(i);
handle_se26(&hittype[i]);
break;
case SE_27_DEMO_CAM:

View file

@ -81,10 +81,10 @@ void handle_se16(DDukeActor* i, int REACTOR, int REACTOR2);
void handle_se17(DDukeActor* i);
void handle_se18(DDukeActor* i, bool morecheck);
void handle_se19(DDukeActor* i, int BIGFORCE);
void handle_se20(int i);
void handle_se21(int i);
void handle_se22(int i);
void handle_se26(int i);
void handle_se20(DDukeActor* i);
void handle_se21(DDukeActor* i);
void handle_se22(DDukeActor* i);
void handle_se26(DDukeActor* i);
void handle_se27(int i);
void handle_se32(int i);
void handle_se35(int i, int SMALLSMOKE, int EXPLOSION2);