Get rid of neartag* global variables. LunaCON: fix 'operate'.

git-svn-id: https://svn.eduke32.com/eduke32@4284 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-01-31 21:13:00 +00:00
parent aa547e8c16
commit 6d4f56c643
6 changed files with 27 additions and 21 deletions

View file

@ -39,9 +39,6 @@ typedef int32_t ofstype;
extern char *ScriptQuotes[MAXQUOTES+1], *ScriptQuoteRedefinitions[MAXQUOTES+1];
extern int32_t g_numQuoteRedefinitions;
//extern int16_t neartagsector, neartagwall, neartagsprite;
//extern int32_t neartaghitdist;
extern int32_t VM_Execute(int32_t once);
extern void VM_OnEvent(register int32_t iEventID, register int32_t iActor);

View file

@ -12707,8 +12707,9 @@ restart_grand:
//
// neartag
//
void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall,
int16_t *neartagsprite, int32_t *neartaghitdist, int32_t neartagrange, uint8_t tagsearch,
void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange,
int16_t *neartagsector, int16_t *neartagwall, int16_t *neartagsprite, int32_t *neartaghitdist, /* out */
int32_t neartagrange, uint8_t tagsearch,
int32_t (*blacklist_sprite_func)(int32_t))
{
int16_t tempshortcnt, tempshortnum;

View file

@ -3064,6 +3064,9 @@ nullquote:
int32_t neartagsectorvar=*insptr++, neartagwallvar=*insptr++, neartagspritevar=*insptr++, neartaghitdistvar=*insptr++;
int32_t neartagrange=Gv_GetVarX(*insptr++), tagsearch=Gv_GetVarX(*insptr++);
int16_t neartagsector, neartagwall, neartagsprite;
int32_t neartaghitdist;
if ((unsigned)sectnum >= (unsigned)numsectors)
{
CON_ERRPRINTF("Invalid sector %d\n", sectnum);
@ -3548,24 +3551,25 @@ nullquote:
insptr++;
if (sector[vm.g_sp->sectnum].lotag == 0)
{
int16_t neartagsector, neartagwall, neartagsprite;
int32_t neartaghitdist;
neartag(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(32<<8),vm.g_sp->sectnum,vm.g_sp->ang,
&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist, 768, 4+1, NULL);
if (neartagsector >= 0 && isanearoperator(sector[neartagsector].lotag))
if ((sector[neartagsector].lotag&0xff) == ST_23_SWINGING_DOOR || sector[neartagsector].floorz == sector[neartagsector].ceilingz)
if ((sector[neartagsector].lotag&16384) == 0)
if ((sector[neartagsector].lotag&32768) == 0)
{
int32_t j = headspritesect[neartagsector];
while (j >= 0)
{
if (sprite[j].picnum == ACTIVATOR)
break;
j = nextspritesect[j];
}
if (j == -1)
G_OperateSectors(neartagsector,vm.g_i);
}
if ((sector[neartagsector].lotag&(16384|32768)) == 0)
{
int32_t j;
for (SPRITES_OF_SECT(neartagsector, j))
if (sprite[j].picnum == ACTIVATOR)
break;
if (j == -1)
G_OperateSectors(neartagsector,vm.g_i);
}
}
continue;

View file

@ -82,7 +82,6 @@ G_EXTERN int16_t g_numAnimWalls;
G_EXTERN int16_t g_numClouds,clouds[128],cloudx[128],cloudy[128];
G_EXTERN int16_t myang,omyang,mycursectnum,myjumpingcounter;
G_EXTERN int16_t myhoriz,omyhoriz,myhorizoff,omyhorizoff;
G_EXTERN int16_t neartagsector,neartagwall,neartagsprite; // XXX: these ought to be globals?
G_EXTERN int32_t *animateptr[MAXANIMATES];
G_EXTERN int32_t animategoal[MAXANIMATES],animatevel[MAXANIMATES],g_animateCount;
G_EXTERN int32_t cloudtotalclock;

View file

@ -1281,8 +1281,10 @@ function _operate(spritenum)
if (tag.sector >= 0) then
local sect = sector[tag.sector]
local lotag = sect.lotag
if (NEAROP[band(lotag, 0xff)]) then
if (lotag==23 or sect.floorz==sect.ceilingz) then
local lotag_lo = band(lotag, 0xff)
if (NEAROP[lotag_lo]) then
if (lotag_lo == 23 or sect.floorz == sect.ceilingz) then
if (band(lotag, 32768+16384) == 0) then
for j in spritesofsect(tag.sector) do
if (ispic(sprite[j].picnum, "ACTIVATOR")) then

View file

@ -2993,6 +2993,9 @@ void P_CheckSectors(int32_t snum)
{
int16_t hitscanwall;
int16_t neartagsector, neartagwall, neartagsprite;
int32_t neartaghitdist;
if (TEST_SYNC_KEY(g_player[snum].sync->bits, SK_ESCAPE))
{
if (p->newowner >= 0)