From 326ba366e9c9466e0db7bf7459571fd250a28ce0 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Wed, 18 Feb 2015 20:46:54 +0000 Subject: [PATCH] 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 --- polymer/eduke32/source/gameexec.c | 2 +- .../lunatic/test/thisactor_getzrange.con | 51 +++++++++++++++++++ polymer/eduke32/source/player.c | 7 ++- 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 polymer/eduke32/source/lunatic/test/thisactor_getzrange.con diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index c5ba65349..518fc7920 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -438,7 +438,7 @@ void A_GetZLimits(int32_t iActor) || (hitspr->picnum == APLAYER && A_CheckEnemySprite(s))) { actor[iActor].flags |= SFLAG_NOFLOORSHADOW; // No shadows on actors - s->xvel = -256; + s->xvel = -256; // SLIDE_ABOVE_ENEMY A_SetSprite(iActor, CLIPMASK0); } else if (s->statnum == STAT_PROJECTILE && hitspr->picnum == APLAYER && s->owner==florhit) diff --git a/polymer/eduke32/source/lunatic/test/thisactor_getzrange.con b/polymer/eduke32/source/lunatic/test/thisactor_getzrange.con new file mode 100644 index 000000000..35003e55d --- /dev/null +++ b/polymer/eduke32/source/lunatic/test/thisactor_getzrange.con @@ -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 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 diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 73e369db1..9e72e3390 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -4210,7 +4210,8 @@ void P_ProcessInput(int32_t snum) if ((sprite[j].cstat&33) == 33 || (sprite[j].cstat&17) == 17 || 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; 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)) { - // 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); p->vel.x -= sintable[(j+512)&2047]<<4; p->vel.y -= sintable[j&2047]<<4;