diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index e52b05e18..81f4595a8 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -618,7 +618,10 @@ int32_t clipinsideboxline(int32_t x, int32_t y, int32_t x1, int32_t y1, int32_ int32_t pushmove(vec3_t *vect, int16_t *sectnum, int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype) ATTRIBUTE((nonnull(1,2))); void getzrange(const vec3_t *vect, int16_t sectnum, int32_t *ceilz, int32_t *ceilhit, int32_t *florz, int32_t *florhit, int32_t walldist, uint32_t cliptype) ATTRIBUTE((nonnull(1,3,4,5,6))); int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz, hitdata_t *hitinfo, uint32_t cliptype) ATTRIBUTE((nonnull(1,6))); -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) ATTRIBUTE((nonnull(6,7,8))); +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, + int32_t (*blacklist_sprite_func)(int32_t)) ATTRIBUTE((nonnull(6,7,8))); int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, int32_t y2, int32_t z2, int16_t sect2); void updatesector(int32_t x, int32_t y, int16_t *sectnum) ATTRIBUTE((nonnull(3))); void updatesector_onlynextwalls(int32_t x, int32_t y, int16_t *sectnum) ATTRIBUTE((nonnull(3))); diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 3b5df0210..e19f313f4 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -11456,7 +11456,8 @@ 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) + int16_t *neartagsprite, int32_t *neartaghitdist, int32_t neartagrange, uint8_t tagsearch, + int32_t (*blacklist_sprite_func)(int32_t)) { walltype *wal, *wal2; spritetype *spr; @@ -11526,6 +11527,9 @@ void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, for (z=headspritesect[dasector]; z>=0; z=nextspritesect[z]) { + if (blacklist_sprite_func && blacklist_sprite_func(z)) + continue; + spr = &sprite[z]; good = 0; diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 7d1623171..4b5e69f14 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -2735,7 +2735,8 @@ nullquote: OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); continue; } - neartag(x, y, z, sectnum, ang, &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, neartagrange, tagsearch); + neartag(x, y, z, sectnum, ang, &neartagsector, &neartagwall, &neartagsprite, + &neartaghitdist, neartagrange, tagsearch, NULL); Gv_SetVarX(neartagsectorvar, neartagsector); Gv_SetVarX(neartagwallvar, neartagwall); @@ -3264,7 +3265,8 @@ nullquote: if (sector[vm.g_sp->sectnum].lotag == 0) { 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,768L,5); + &neartagsector,&neartagwall,&neartagsprite,&neartaghitdist, 768, 4+1, NULL); + if (neartagsector >= 0 && isanearoperator(sector[neartagsector].lotag)) if ((sector[neartagsector].lotag&0xff) == 23 || sector[neartagsector].floorz == sector[neartagsector].ceilingz) if ((sector[neartagsector].lotag&16384) == 0) diff --git a/polymer/eduke32/source/m32exec.c b/polymer/eduke32/source/m32exec.c index a7c356332..37de2e5bb 100644 --- a/polymer/eduke32/source/m32exec.c +++ b/polymer/eduke32/source/m32exec.c @@ -1918,7 +1918,8 @@ badindex: int32_t neartaghitdist; X_ERROR_INVALIDSECT(sectnum); - neartag(x, y, z, sectnum, ang, &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, neartagrange, tagsearch); + neartag(x, y, z, sectnum, ang, &neartagsector, &neartagwall, &neartagsprite, + &neartaghitdist, neartagrange, tagsearch, NULL); Gv_SetVarX(neartagsectorvar, neartagsector); Gv_SetVarX(neartagwallvar, neartagwall); diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index dfc7f851a..3f6488c37 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -3052,6 +3052,11 @@ static int32_t P_FindWall(DukePlayer_t *p,int16_t *hitw) return (FindDistance2D(hitinfo.pos.x-p->pos.x,hitinfo.pos.y-p->pos.y)); } +// returns 1 if sprite i should not be considered by neartag +static int32_t our_neartag_blacklist(int32_t i) +{ + return sprite[i].picnum >= SECTOREFFECTOR__STATIC && sprite[i].picnum <= GPSPEED__STATIC; +} void P_CheckSectors(int32_t snum) { @@ -3163,17 +3168,22 @@ void P_CheckSectors(int32_t snum) } if (p->newowner >= 0) - neartag(p->opos.x,p->opos.y,p->opos.z,sprite[p->i].sectnum,p->oang,&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,1280L,1); + neartag(p->opos.x,p->opos.y,p->opos.z,sprite[p->i].sectnum,p->oang,&neartagsector, + &neartagwall,&neartagsprite,&neartaghitdist, 1280, 1, our_neartag_blacklist); else { - neartag(p->pos.x,p->pos.y,p->pos.z,sprite[p->i].sectnum,p->oang,&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,1280L,1); + neartag(p->pos.x,p->pos.y,p->pos.z,sprite[p->i].sectnum,p->oang,&neartagsector, + &neartagwall,&neartagsprite,&neartaghitdist, 1280, 1, our_neartag_blacklist); if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1) - neartag(p->pos.x,p->pos.y,p->pos.z+(8<<8),sprite[p->i].sectnum,p->oang,&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,1280L,1); + neartag(p->pos.x,p->pos.y,p->pos.z+(8<<8),sprite[p->i].sectnum,p->oang,&neartagsector, + &neartagwall,&neartagsprite,&neartaghitdist, 1280, 1, our_neartag_blacklist); if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1) - neartag(p->pos.x,p->pos.y,p->pos.z+(16<<8),sprite[p->i].sectnum,p->oang,&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,1280L,1); + neartag(p->pos.x,p->pos.y,p->pos.z+(16<<8),sprite[p->i].sectnum,p->oang,&neartagsector, + &neartagwall,&neartagsprite,&neartaghitdist, 1280, 1, our_neartag_blacklist); if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1) { - neartag(p->pos.x,p->pos.y,p->pos.z+(16<<8),sprite[p->i].sectnum,p->oang,&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,1280L,3); + neartag(p->pos.x,p->pos.y,p->pos.z+(16<<8),sprite[p->i].sectnum,p->oang,&neartagsector, + &neartagwall,&neartagsprite,&neartaghitdist, 1280, 3, our_neartag_blacklist); if (neartagsprite >= 0) { switch (DYNAMICTILEMAP(sprite[neartagsprite].picnum))