- handle the clipmove result in processinput.

This commit is contained in:
Christoph Oelckers 2020-10-25 08:50:03 +01:00
parent 419cf9af5e
commit 87e8801531
7 changed files with 48 additions and 56 deletions

View file

@ -49,8 +49,6 @@ void activatebysector_d(int sect, int j);
void activatebysector_r(int sect, int j); void activatebysector_r(int sect, int j);
void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith); void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith);
void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith); void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith);
void checkplayerhurt_d(struct player_struct* p, int j);
void checkplayerhurt_r(struct player_struct* p, int j);
bool checkhitceiling_d(int sn); bool checkhitceiling_d(int sn);
bool checkhitceiling_r(int sn); bool checkhitceiling_r(int sn);
void checkhitsprite_d(DDukeActor* i, DDukeActor* sn); void checkhitsprite_d(DDukeActor* i, DDukeActor* sn);
@ -137,7 +135,6 @@ void SetDispatcher()
checkhitswitch_d, checkhitswitch_d,
activatebysector_d, activatebysector_d,
checkhitwall_d, checkhitwall_d,
checkplayerhurt_d,
checkhitceiling_d, checkhitceiling_d,
checkhitsprite_d, checkhitsprite_d,
checksectors_d, checksectors_d,
@ -187,7 +184,6 @@ void SetDispatcher()
checkhitswitch_r, checkhitswitch_r,
activatebysector_r, activatebysector_r,
checkhitwall_r, checkhitwall_r,
checkplayerhurt_r,
checkhitceiling_r, checkhitceiling_r,
checkhitsprite_r, checkhitsprite_r,
checksectors_r, checksectors_r,

View file

@ -79,7 +79,6 @@ struct Dispatcher
bool (*checkhitswitch)(int snum, int w, int switchtype); bool (*checkhitswitch)(int snum, int w, int switchtype);
void (*activatebysector)(int sect, int j); void (*activatebysector)(int sect, int j);
void (*checkhitwall)(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith); void (*checkhitwall)(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith);
void (*checkplayerhurt)(struct player_struct* p, int j);
bool (*checkhitceiling)(int sn); bool (*checkhitceiling)(int sn);
void (*checkhitsprite)(DDukeActor* i, DDukeActor* sn); void (*checkhitsprite)(DDukeActor* i, DDukeActor* sn);
void (*checksectors)(int low); void (*checksectors)(int low);

View file

@ -180,6 +180,8 @@ void ceilingglass(int snum, int sectnum, int cnt);
void spriteglass(DDukeActor* snum, int cnt); void spriteglass(DDukeActor* snum, int cnt);
void lotsofcolourglass(int snum, int wallNum, int cnt); void lotsofcolourglass(int snum, int wallNum, int cnt);
void lotsofglass(int snum, int wallnum, int cnt); void lotsofglass(int snum, int wallnum, int cnt);
void checkplayerhurt_d(struct player_struct* p, const Collision& coll);
void checkplayerhurt_r(struct player_struct* p, const Collision& coll);
void addspritetodelete(int spnum=0); void addspritetodelete(int spnum=0);
void checkavailinven(struct player_struct* p); void checkavailinven(struct player_struct* p);

View file

@ -3024,24 +3024,24 @@ HORIZONLY:
if (sector[p->cursectnum].lotag == 2) k = 0; if (sector[p->cursectnum].lotag == 2) k = 0;
else k = 1; else k = 1;
Collision clip{};
if (ud.clipping) if (ud.clipping)
{ {
j = 0;
p->posx += p->posxv >> 14; p->posx += p->posxv >> 14;
p->posy += p->posyv >> 14; p->posy += p->posyv >> 14;
updatesector(p->posx, p->posy, &p->cursectnum); updatesector(p->posx, p->posy, &p->cursectnum);
changespritesect(pi, p->cursectnum); changespritesect(pi, p->cursectnum);
} }
else else
j = clipmove(&p->posx, &p->posy, clipmove_ex(&p->posx, &p->posy,
&p->posz, &p->cursectnum, &p->posz, &p->cursectnum,
p->posxv, p->posyv, 164L, (4L << 8), i, CLIPMASK0); p->posxv, p->posyv, 164L, (4L << 8), i, CLIPMASK0, clip);
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk) if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
p->posz += 32 << 8; p->posz += 32 << 8;
if (j) if (clip.type != kHitNone)
fi.checkplayerhurt(p, j); checkplayerhurt_d(p, clip);
if (p->jetpack_on == 0) if (p->jetpack_on == 0)
{ {
@ -3077,8 +3077,8 @@ HORIZONLY:
} }
if (truefdist < PHEIGHT && p->on_ground && psectlotag != 1 && shrunk == 0 && sector[p->cursectnum].lotag == 1) if (truefdist < PHEIGHT && p->on_ground && psectlotag != 1 && shrunk == 0 && sector[p->cursectnum].lotag == 1)
if (!S_CheckActorSoundPlaying(pi, DUKE_ONWATER)) if (!S_CheckActorSoundPlaying(pact, DUKE_ONWATER))
S_PlayActorSound(DUKE_ONWATER, pi); S_PlayActorSound(DUKE_ONWATER, pact);
if (p->cursectnum != s->sectnum) if (p->cursectnum != s->sectnum)
changespritesect(pi, p->cursectnum); changespritesect(pi, p->cursectnum);

View file

@ -3915,7 +3915,6 @@ HORIZONLY:
else k = 1; else k = 1;
Collision clip{}; Collision clip{};
int j;
if (ud.clipping) if (ud.clipping)
{ {
p->posx += p->posxv >> 14; p->posx += p->posxv >> 14;
@ -3924,38 +3923,38 @@ HORIZONLY:
changespritesect(pact, p->cursectnum); changespritesect(pact, p->cursectnum);
} }
else else
clipmove(&p->posx, &p->posy, clipmove_ex(&p->posx, &p->posy,
&p->posz, &p->cursectnum, &p->posz, &p->cursectnum,
p->posxv, p->posyv, 164L, (4L << 8), i, CLIPMASK0);//, clip); p->posxv, p->posyv, 164L, (4L << 8), i, CLIPMASK0, clip);
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk) if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
p->posz += 32 << 8; p->posz += 32 << 8;
if (j) if (clip.type != kHitNone)
fi.checkplayerhurt(p, j); checkplayerhurt_r(p, clip);
else if (isRRRA() && p->hurt_delay2 > 0) else if (isRRRA() && p->hurt_delay2 > 0)
p->hurt_delay2--; p->hurt_delay2--;
if ((j & 49152) == 32768) if (clip.type == kHitWall)
{ {
int var60 = wall[j & (MAXWALLS - 1)].lotag; int var60 = wall[clip.index].lotag;
if (p->OnMotorcycle) if (p->OnMotorcycle)
{ {
onMotorcycleMove(snum, psect, j & (MAXWALLS-1)); onMotorcycleMove(snum, psect, clip.index);
} }
else if (p->OnBoat) else if (p->OnBoat)
{ {
onBoatMove(snum, psect, j& (MAXWALLS - 1)); onBoatMove(snum, psect, clip.index);
} }
else else
{ {
if (wall[j & (MAXWALLS - 1)].lotag >= 40 && wall[j & (MAXWALLS - 1)].lotag <= 44) if (wall[clip.index].lotag >= 40 && wall[clip.index].lotag <= 44)
{ {
if (wall[j & (MAXWALLS - 1)].lotag < 44) if (wall[clip.index].lotag < 44)
{ {
dofurniture(j & (MAXWALLS - 1), p->cursectnum, snum); dofurniture(clip.index, p->cursectnum, snum);
pushmove(&p->posx, &p->posy, &p->posz, &p->cursectnum, 172L, (4L << 8), (4L << 8), CLIPMASK0); pushmove(&p->posx, &p->posy, &p->posz, &p->cursectnum, 172L, (4L << 8), (4L << 8), CLIPMASK0);
} }
else else
@ -3964,41 +3963,40 @@ HORIZONLY:
} }
} }
if ((j & 49152) == 49152) if (clip.type == kHitSprite)
{ {
int var60 = j & (MAXSPRITES - 1);
if (p->OnMotorcycle) if (p->OnMotorcycle)
{ {
onMotorcycleHit(snum, &hittype[var60]); onMotorcycleHit(snum, clip.actor);
} }
else if (p->OnBoat) else if (p->OnBoat)
{ {
onBoatHit(snum, &hittype[var60]); onBoatHit(snum, clip.actor);
} }
else else
if (badguy(&sprite[var60])) if (badguy(clip.actor))
{ {
if (sprite[var60].statnum != 1) if (clip.actor->s.statnum != 1)
{ {
hittype[var60].timetosleep = 0; clip.actor->timetosleep = 0;
if (sprite[var60].picnum == BILLYRAY) if (clip.actor->s.picnum == BILLYRAY)
S_PlayActorSound(404, var60); S_PlayActorSound(404, clip.actor);
else else
check_fta_sounds_r(&hittype[var60]); check_fta_sounds_r(clip.actor);
changespritestat(var60, 1); changespritestat(clip.actor, 1);
} }
} }
else else
if (sprite[var60].picnum == RRTILE3410) if (clip.actor->s.picnum == RRTILE3410)
{ {
quickkill(p); quickkill(p);
S_PlayActorSound(446, pact); S_PlayActorSound(446, pact);
} }
else if (isRRRA() && sprite[var60].picnum == RRTILE2443 && sprite[var60].pal == 19) else if (isRRRA() && clip.actor->s.picnum == RRTILE2443 && clip.actor->s.pal == 19)
{ {
sprite[var60].pal = 0; clip.actor->s.pal = 0;
p->DrugMode = 5; p->DrugMode = 5;
sprite[ps[snum].i].extra = max_player_health; ps[snum].GetActor()->s.extra = max_player_health;
} }
} }
@ -4050,6 +4048,7 @@ HORIZONLY:
if (p->cursectnum != s->sectnum) if (p->cursectnum != s->sectnum)
changespritesect(pact, p->cursectnum); changespritesect(pact, p->cursectnum);
int j;
if (ud.clipping == 0) if (ud.clipping == 0)
{ {
if (s->clipdist == 64) if (s->clipdist == 64)

View file

@ -887,13 +887,11 @@ void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void checkplayerhurt_d(struct player_struct* p, int j) void checkplayerhurt_d(struct player_struct* p, const Collision& coll)
{ {
if ((j & 49152) == 49152) if (coll.type == kHitSprite)
{ {
j &= (MAXSPRITES - 1); switch (coll.actor->s.picnum)
switch (sprite[j].picnum)
{ {
case CACTUS: case CACTUS:
if (p->hurt_delay < 8) if (p->hurt_delay < 8)
@ -901,15 +899,15 @@ void checkplayerhurt_d(struct player_struct* p, int j)
p->GetActor()->s.extra -= 5; p->GetActor()->s.extra -= 5;
p->hurt_delay = 16; p->hurt_delay = 16;
SetPlayerPal(p, PalEntry(32, 32, 0, 0)); SetPlayerPal(p, PalEntry(32, 32, 0, 0));
S_PlayActorSound(DUKE_LONGTERM_PAIN, p->i); S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor());
} }
break; break;
} }
return; return;
} }
if ((j & 49152) != 32768) return; if (coll.type != kHitWall) return;
j &= (MAXWALLS - 1); int j = coll.index;
if (p->hurt_delay > 0) p->hurt_delay--; if (p->hurt_delay > 0) p->hurt_delay--;
else if (wall[j].cstat & 85) switch (wall[j].overpicnum) else if (wall[j].cstat & 85) switch (wall[j].overpicnum)
@ -924,7 +922,7 @@ void checkplayerhurt_d(struct player_struct* p, int j)
p->posxv = -(sintable[(p->angle.ang.asbuild() + 512) & 2047] << 8); p->posxv = -(sintable[(p->angle.ang.asbuild() + 512) & 2047] << 8);
p->posyv = -(sintable[(p->angle.ang.asbuild()) & 2047] << 8); p->posyv = -(sintable[(p->angle.ang.asbuild()) & 2047] << 8);
S_PlayActorSound(DUKE_LONGTERM_PAIN, p->i); S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor());
fi.checkhitwall(p->GetActor(), j, fi.checkhitwall(p->GetActor(), j,
p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 9), p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 9),

View file

@ -1371,13 +1371,11 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void checkplayerhurt_r(struct player_struct* p, int j) void checkplayerhurt_r(struct player_struct* p, const Collision &coll)
{ {
if ((j & 49152) == 49152) if (coll.type == kHitSprite)
{ {
j &= (MAXSPRITES - 1); switch (coll.actor->s.picnum)
switch (sprite[j].picnum)
{ {
case RRTILE2430: case RRTILE2430:
case RRTILE2431: case RRTILE2431:
@ -1391,7 +1389,7 @@ void checkplayerhurt_r(struct player_struct* p, int j)
p->GetActor()->s.extra -= 2; p->GetActor()->s.extra -= 2;
p->hurt_delay2 = 16; p->hurt_delay2 = 16;
SetPlayerPal(p, PalEntry(32, 32, 0, 0)); SetPlayerPal(p, PalEntry(32, 32, 0, 0));
S_PlayActorSound(DUKE_LONGTERM_PAIN, p->i); S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor());
} }
break; break;
case CACTUS: case CACTUS:
@ -1407,8 +1405,8 @@ void checkplayerhurt_r(struct player_struct* p, int j)
return; return;
} }
if ((j & 49152) != 32768) return; if (coll.type != kHitWall) return;
j &= (MAXWALLS - 1); int j = coll.index;
if (p->hurt_delay > 0) p->hurt_delay--; if (p->hurt_delay > 0) p->hurt_delay--;
else if (wall[j].cstat & 85) switch (wall[j].overpicnum) else if (wall[j].cstat & 85) switch (wall[j].overpicnum)