Add lunatic/test/thisactor_getzrange.con, providing 'state thisactor_getzrange'.

Also, note a place that is the real cause for "what makes the player slide off
enemies", as far as I can see.

git-svn-id: https://svn.eduke32.com/eduke32@5016 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2015-02-18 20:46:54 +00:00
parent b367d57845
commit 326ba366e9
3 changed files with 57 additions and 3 deletions

View file

@ -438,7 +438,7 @@ void A_GetZLimits(int32_t iActor)
|| (hitspr->picnum == APLAYER && A_CheckEnemySprite(s))) || (hitspr->picnum == APLAYER && A_CheckEnemySprite(s)))
{ {
actor[iActor].flags |= SFLAG_NOFLOORSHADOW; // No shadows on actors actor[iActor].flags |= SFLAG_NOFLOORSHADOW; // No shadows on actors
s->xvel = -256; s->xvel = -256; // SLIDE_ABOVE_ENEMY
A_SetSprite(iActor, CLIPMASK0); A_SetSprite(iActor, CLIPMASK0);
} }
else if (s->statnum == STAT_PROJECTILE && hitspr->picnum == APLAYER && s->owner==florhit) else if (s->statnum == STAT_PROJECTILE && hitspr->picnum == APLAYER && s->owner==florhit)

View file

@ -0,0 +1,51 @@
// This CON module provides 'state thisactor_getzrange', reimplementing
// VM_GetZRange() from the C source. This routine obtains actor[].ceilingz and
// actor[].floorz for the current actor (THISACTOR), using getzrange() with the
// initial z position displaced by -256.
//
// Original author: Helixhorned.
// In
gamevar tagz_x 0 0
gamevar tagz_y 0 0
gamevar tagz_z 0 0
gamevar tagz_sectnum 0 0
// Temp
gamevar tagz_cstat 0 0
// Out
gamevar tagz_ceilz 0 0
gamevar tagz_ceilhit 0 0
gamevar tagz_florz 0 0
gamevar tagz_florhit 0 0
// ZOFFSET in the EDuke32 source.
define TAGZ_ZOFFSET 256
// In the EDuke32 source, the <walldist> passed to VM_GetZRange().
define TAGZ_WALLDIST 127
// Updates the current actor's actor[].floorz and actor[].ceilngz members in
// the same way A_GetZRange() does.
state thisactor_getzrange
setvarvar tagz_x sprite[THISACTOR].x
setvarvar tagz_y sprite[THISACTOR].y
setvarvar tagz_z sprite[THISACTOR].z, subvar tagz_z TAGZ_ZOFFSET
setvarvar tagz_sectnum sprite[THISACTOR].sectnum
// Back up and clear cstat.
setvarvar tagz_cstat sprite[THISACTOR].cstat
setactor[THISACTOR].cstat 0
getzrange tagz_x tagz_y tagz_z tagz_sectnum
/*out:*/ tagz_ceilz tagz_ceilhit tagz_florz tagz_florhit
/*in:*/ TAGZ_WALLDIST CLIPMASK0
// Restore cstat.
setactor[THISACTOR].cstat tagz_cstat
// Set actor[] members for the current actor.
setactor[THISACTOR].htceilingz tagz_ceilz
setactor[THISACTOR].htfloorz tagz_florz
ends

View file

@ -4210,7 +4210,8 @@ void P_ProcessInput(int32_t snum)
if ((sprite[j].cstat&33) == 33 || (sprite[j].cstat&17) == 17 || if ((sprite[j].cstat&33) == 33 || (sprite[j].cstat&17) == 17 ||
clipshape_idx_for_sprite(&sprite[j], -1) >= 0) clipshape_idx_for_sprite(&sprite[j], -1) >= 0)
{ {
if ((sprite[j].xvel&1) == 0) // EDuke32 extension // EDuke32 extension: xvel of 1 makes a sprite be never regarded as a bridge.
if ((sprite[j].xvel&1) == 0)
{ {
psectlotag = 0; psectlotag = 0;
p->footprintcount = 0; p->footprintcount = 0;
@ -4220,7 +4221,9 @@ void P_ProcessInput(int32_t snum)
} }
else if (A_CheckEnemySprite(&sprite[j]) && sprite[j].xrepeat > 24 && klabs(s->z-sprite[j].z) < (84<<8)) else if (A_CheckEnemySprite(&sprite[j]) && sprite[j].xrepeat > 24 && klabs(s->z-sprite[j].z) < (84<<8))
{ {
// I think this is what makes the player slide off enemies... might be a good sprite flag to add later // TX: I think this is what makes the player slide off enemies... might
// be a good sprite flag to add later.
// Helix: there's also SLIDE_ABOVE_ENEMY.
j = getangle(sprite[j].x-p->pos.x,sprite[j].y-p->pos.y); j = getangle(sprite[j].x-p->pos.x,sprite[j].y-p->pos.y);
p->vel.x -= sintable[(j+512)&2047]<<4; p->vel.x -= sintable[(j+512)&2047]<<4;
p->vel.y -= sintable[j&2047]<<4; p->vel.y -= sintable[j&2047]<<4;