mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-12-11 13:21:56 +00:00
Add lookup tag tables construction.
This commit is contained in:
parent
38e92aecfd
commit
07b4d0ee3d
3 changed files with 80 additions and 6 deletions
35
src/p_spec.c
35
src/p_spec.c
|
@ -1578,6 +1578,7 @@ void P_RunNightsCapsuleTouchExecutors(mobj_t *actor, boolean entering, boolean e
|
|||
static inline void P_InitTagLists(void)
|
||||
{
|
||||
register size_t i;
|
||||
size_t j;
|
||||
|
||||
for (i = numsectors - 1; i != (size_t)-1; i--)
|
||||
{
|
||||
|
@ -1592,6 +1593,28 @@ static inline void P_InitTagLists(void)
|
|||
lines[i].nexttag = lines[j].firsttag;
|
||||
lines[j].firsttag = (INT32)i;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXTAGS; i++)
|
||||
{
|
||||
tags_sectors[i] = NULL;
|
||||
tags_lines[i] = NULL;
|
||||
tags_mapthings[i] = NULL;
|
||||
}
|
||||
for (i = 0; i < numsectors; i++)
|
||||
{
|
||||
for (j = 0; j < sectors[i].tags.count; j++)
|
||||
Taglist_AddToSectors(sectors[i].tags.tags[j], i);
|
||||
}
|
||||
for (i = 0; i < numlines; i++)
|
||||
{
|
||||
for (j = 0; j < lines[i].tags.count; j++)
|
||||
Taglist_AddToLines(lines[i].tags.tags[j], i);
|
||||
}
|
||||
for (i = 0; i < nummapthings; i++)
|
||||
{
|
||||
for (j = 0; j < mapthings[i].tags.count; j++)
|
||||
Taglist_AddToMapthings(mapthings[i].tags.tags[j], i);
|
||||
}
|
||||
}
|
||||
|
||||
/** Finds minimum light from an adjacent sector.
|
||||
|
@ -2025,7 +2048,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
|||
INT32 triggercolor = (INT32)sides[triggerline->sidenum[0]].toptexture;
|
||||
UINT8 color = (actor->player ? actor->player->powers[pw_dye] : actor->color);
|
||||
boolean invert = (triggerline->flags & ML_NOCLIMB ? true : false);
|
||||
|
||||
|
||||
if (invert ^ (triggercolor != color))
|
||||
return false;
|
||||
}
|
||||
|
@ -4034,23 +4057,23 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 463: // Dye object
|
||||
{
|
||||
INT32 color = sides[line->sidenum[0]].toptexture;
|
||||
|
||||
|
||||
if (mo)
|
||||
{
|
||||
if (color < 0 || color >= MAXTRANSLATIONS)
|
||||
return;
|
||||
|
||||
|
||||
var1 = 0;
|
||||
var2 = color;
|
||||
A_Dye(mo);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
case 480: // Polyobj_DoorSlide
|
||||
case 481: // Polyobj_DoorSwing
|
||||
|
@ -7271,7 +7294,7 @@ void P_SpawnSpecials(boolean fromnetsave)
|
|||
case 331:
|
||||
case 333:
|
||||
break;
|
||||
|
||||
|
||||
// Object dye executors
|
||||
case 334:
|
||||
case 336:
|
||||
|
|
|
@ -20,3 +20,39 @@ boolean Tag_Compare (const taglist_t* list1, const taglist_t* list2)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Taglist_AddToSectors (const size_t tag, const size_t itemid)
|
||||
{
|
||||
taggroup_t* tagelems;
|
||||
if (!tags_sectors[tag])
|
||||
tags_sectors[tag] = Z_Calloc(sizeof(taggroup_t), PU_LEVEL, NULL);
|
||||
|
||||
tagelems = tags_sectors[tag];
|
||||
tagelems->count++;
|
||||
tagelems->elements = Z_Realloc(tagelems->elements, tagelems->count * sizeof(size_t), PU_LEVEL, NULL);
|
||||
tagelems->elements[tagelems->count - 1] = itemid;
|
||||
}
|
||||
|
||||
void Taglist_AddToLines (const size_t tag, const size_t itemid)
|
||||
{
|
||||
taggroup_t* tagelems;
|
||||
if (!tags_lines[tag])
|
||||
tags_lines[tag] = Z_Calloc(sizeof(taggroup_t), PU_LEVEL, NULL);
|
||||
|
||||
tagelems = tags_lines[tag];
|
||||
tagelems->count++;
|
||||
tagelems->elements = Z_Realloc(tagelems->elements, tagelems->count * sizeof(size_t), PU_LEVEL, NULL);
|
||||
tagelems->elements[tagelems->count - 1] = itemid;
|
||||
}
|
||||
|
||||
void Taglist_AddToMapthings (const size_t tag, const size_t itemid)
|
||||
{
|
||||
taggroup_t* tagelems;
|
||||
if (!tags_mapthings[tag])
|
||||
tags_mapthings[tag] = Z_Calloc(sizeof(taggroup_t), PU_LEVEL, NULL);
|
||||
|
||||
tagelems = tags_mapthings[tag];
|
||||
tagelems->count++;
|
||||
tagelems->elements = Z_Realloc(tagelems->elements, tagelems->count * sizeof(size_t), PU_LEVEL, NULL);
|
||||
tagelems->elements[tagelems->count - 1] = itemid;
|
||||
}
|
||||
|
|
|
@ -12,4 +12,19 @@ typedef struct
|
|||
|
||||
void Tag_Add (taglist_t* list, const UINT16 tag);
|
||||
boolean Tag_Compare (const taglist_t* list1, const taglist_t* list2);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
size_t *elements;
|
||||
size_t count;
|
||||
} taggroup_t;
|
||||
|
||||
#define MAXTAGS 65536
|
||||
taggroup_t* tags_sectors[MAXTAGS];
|
||||
taggroup_t* tags_lines[MAXTAGS];
|
||||
taggroup_t* tags_mapthings[MAXTAGS];
|
||||
|
||||
void Taglist_AddToSectors (const size_t tag, const size_t itemid);
|
||||
void Taglist_AddToLines (const size_t tag, const size_t itemid);
|
||||
void Taglist_AddToMapthings (const size_t tag, const size_t itemid);
|
||||
#endif //__R_TAGLIST__
|
||||
|
|
Loading…
Reference in a new issue