Instrument the code to build without the struct trackers and disable them when the build options eliminate all uses of them (currently USE_OPENGL=0).

git-svn-id: https://svn.eduke32.com/eduke32@6769 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2018-03-17 03:26:01 +00:00
parent 9462ad4076
commit 01606bb6fb
3 changed files with 27 additions and 1 deletions

View file

@ -261,11 +261,19 @@ enum {
#endif
#ifdef __cplusplus
}
#endif
#if defined __cplusplus && (defined USE_OPENGL || defined POLYMER)
# define STRUCT_TRACKERS_ENABLED
#endif
#ifdef STRUCT_TRACKERS_ENABLED
extern "C" {
static FORCE_INLINE void sector_tracker_hook(uintptr_t address);
static FORCE_INLINE void wall_tracker_hook(uintptr_t address);
static FORCE_INLINE void sprite_tracker_hook(uintptr_t address);
}
#define TRACKER_NAME_ SectorTracker
@ -585,9 +593,11 @@ EXTERN spritetype sprite[MAXSPRITES];
EXTERN uspritetype tsprite[MAXSPRITESONSCREEN];
#endif
#ifdef STRUCT_TRACKERS_ENABLED
EXTERN uint32_t sectorchanged[MAXSECTORS + M32_FIXME_SECTORS];
EXTERN uint32_t wallchanged[MAXWALLS + M32_FIXME_WALLS];
EXTERN uint32_t spritechanged[MAXSPRITES];
#endif
#ifdef NEW_MAP_FORMAT
static FORCE_INLINE int16_t yax_getbunch(int16_t i, int16_t cf)
@ -612,6 +622,7 @@ static FORCE_INLINE void yax_setnextwall(int16_t wal, int16_t cf, int16_t thenex
}
#endif
#ifdef STRUCT_TRACKERS_ENABLED
static FORCE_INLINE void sector_tracker_hook(uintptr_t const address)
{
uintptr_t const usector = address - (uintptr_t)sector;
@ -644,6 +655,7 @@ static FORCE_INLINE void sprite_tracker_hook(uintptr_t const address)
++spritechanged[usprite / sizeof(spritetype)];
}
#endif
EXTERN int16_t maskwall[MAXWALLSB], maskwallcnt;

View file

@ -8978,9 +8978,11 @@ static void prepare_loadboard(int32_t fil, vec3_t *dapos, int16_t *daang, int16_
Bmemset(show2dsector, 0, sizeof(show2dsector));
Bmemset(show2dsprite, 0, sizeof(show2dsprite));
Bmemset(show2dwall, 0, sizeof(show2dwall));
#ifdef STRUCT_TRACKERS_ENABLED
Bmemset(sectorchanged, 0, sizeof(sectorchanged));
Bmemset(spritechanged, 0, sizeof(spritechanged));
Bmemset(wallchanged, 0, sizeof(wallchanged));
#endif
#ifdef USE_OPENGL
Polymost_prepare_loadboard();

View file

@ -2921,42 +2921,54 @@ dodefault:
X_ERROR_INVALIDSP();
vm.pSprite->xrepeat = (uint8_t) Gv_GetVarX(*(insptr-2));
vm.pSprite->yrepeat = (uint8_t) Gv_GetVarX(*(insptr-1));
#ifdef STRUCT_TRACKERS_ENABLED
if (vm.spriteNum != -1) spritechanged[vm.spriteNum]++;
#endif
continue;
case CON_CSTAT:
insptr += 2;
X_ERROR_INVALIDSP();
vm.pSprite->cstat = (int16_t) *(insptr-1);
#ifdef STRUCT_TRACKERS_ENABLED
if (vm.spriteNum != -1) spritechanged[vm.spriteNum]++;
#endif
continue;
case CON_CSTATOR:
insptr += 2;
X_ERROR_INVALIDSP();
vm.pSprite->cstat |= (int16_t) Gv_GetVarX(*(insptr-1));
#ifdef STRUCT_TRACKERS_ENABLED
if (vm.spriteNum != -1) spritechanged[vm.spriteNum]++;
#endif
continue;
case CON_CLIPDIST:
insptr += 2;
X_ERROR_INVALIDSP();
vm.pSprite->clipdist = (uint8_t) Gv_GetVarX(*(insptr-1));
#ifdef STRUCT_TRACKERS_ENABLED
if (vm.spriteNum != -1) spritechanged[vm.spriteNum]++;
#endif
continue;
case CON_SPRITEPAL:
insptr += 2;
X_ERROR_INVALIDSP();
vm.pSprite->pal = Gv_GetVarX(*(insptr-1));
#ifdef STRUCT_TRACKERS_ENABLED
if (vm.spriteNum != -1) spritechanged[vm.spriteNum]++;
#endif
continue;
case CON_CACTOR:
insptr += 2;
X_ERROR_INVALIDSP();
vm.pSprite->picnum = Gv_GetVarX(*(insptr-1));
#ifdef STRUCT_TRACKERS_ENABLED
if (vm.spriteNum != -1) spritechanged[vm.spriteNum]++;
#endif
continue;
case CON_SPGETLOTAG: