mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-04-20 09:11:01 +00:00
Add barebones multitag lists. They are not yet used anywhere for now.
This commit is contained in:
parent
95c0b791b0
commit
4a609b5eef
3 changed files with 78 additions and 0 deletions
|
@ -377,6 +377,18 @@ UINT32 P_GetScoreForGrade(INT16 map, UINT8 mare, UINT8 grade)
|
|||
return mapheaderinfo[map-1]->grades[mare].grade[grade-1];
|
||||
}
|
||||
|
||||
static void Tags_Add (tags_t* itemtags, const UINT16 tag)
|
||||
{
|
||||
itemtags->numtags++;
|
||||
|
||||
if (itemtags->numtags)
|
||||
itemtags->tags = Z_Realloc(itemtags->tags, itemtags->numtags * sizeof(itemtags->tags), PU_LEVEL, NULL);
|
||||
else
|
||||
itemtags->tags = Z_Malloc(itemtags->numtags * sizeof(itemtags->tags), PU_LEVEL, NULL);
|
||||
|
||||
itemtags->tags[itemtags->numtags - 1] = tag;
|
||||
}
|
||||
|
||||
/** Loads the vertexes for a level.
|
||||
*
|
||||
* \param lump VERTEXES lump number.
|
||||
|
@ -685,6 +697,7 @@ static void P_LoadRawSectors(UINT8 *data)
|
|||
ss->spawn_lightlevel = SHORT(ms->lightlevel);
|
||||
ss->special = SHORT(ms->special);
|
||||
ss->tag = SHORT(ms->tag);
|
||||
Tags_Add(&(ss->tags), ss->tag);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1035,7 +1048,10 @@ static void TextmapSector(UINT32 i, char *param)
|
|||
else if (fastcmp(param, "special"))
|
||||
sectors[i].special = atol(M_GetToken(NULL));
|
||||
else if (fastcmp(param, "id"))
|
||||
{
|
||||
sectors[i].tag = atol(M_GetToken(NULL));
|
||||
Tags_Add(§ors[i].tags, sectors[i].tag);
|
||||
}
|
||||
else if (fastcmp(param, "xpanningfloor"))
|
||||
sectors[i].floor_xoffs = FLOAT_TO_FIXED(atof(M_GetToken(NULL)));
|
||||
else if (fastcmp(param, "ypanningfloor"))
|
||||
|
|
54
src/p_spec.c
54
src/p_spec.c
|
@ -1573,6 +1573,35 @@ void P_RunNightsCapsuleTouchExecutors(mobj_t *actor, boolean entering, boolean e
|
|||
}
|
||||
}
|
||||
|
||||
#define MAXTAGS 65536
|
||||
typedef struct{
|
||||
size_t* list;
|
||||
size_t size;
|
||||
} taggroup_t;
|
||||
|
||||
taggroup_t* taglist_sec[MAXTAGS];
|
||||
|
||||
/** Insert an item id into a given taglist.
|
||||
*/
|
||||
static void Taglist_AddTo (const size_t tag, const size_t itemid)
|
||||
{
|
||||
taggroup_t* group;
|
||||
if (!taglist_sec[tag])
|
||||
{
|
||||
taglist_sec[tag] = Z_Calloc(sizeof(taggroup_t), PU_LEVEL, NULL);
|
||||
group = taglist_sec[tag];
|
||||
group->size = 1;
|
||||
group->list = Z_Malloc(sizeof(size_t), PU_LEVEL, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
group = taglist_sec[tag];
|
||||
group->size++;
|
||||
group->list = Z_Realloc(group->list, group->size * sizeof(size_t), PU_LEVEL, NULL);
|
||||
}
|
||||
group->list[group->size - 1] = itemid;
|
||||
}
|
||||
|
||||
/** Hashes the sector tags across the sectors and linedefs.
|
||||
*
|
||||
* \sa P_FindSectorFromTag, P_ChangeSectorTag
|
||||
|
@ -1595,8 +1624,33 @@ static inline void P_InitTagLists(void)
|
|||
lines[i].nexttag = lines[j].firsttag;
|
||||
lines[j].firsttag = (INT32)i;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXTAGS; i++)
|
||||
taglist_sec[i] = NULL;
|
||||
|
||||
for (i = 0; i < numsectors; i++)
|
||||
{
|
||||
if (sectors[i].tag > 0)
|
||||
Taglist_AddTo(sectors[i].tag, i);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXTAGS; i++)
|
||||
{
|
||||
if (taglist_sec[i])
|
||||
{
|
||||
taggroup_t* group = taglist_sec[i];
|
||||
size_t j;
|
||||
CONS_Printf("Tag list for %u :\n", i);
|
||||
for (j = 0; j < group->size; j++)
|
||||
{
|
||||
CONS_Printf("Sector %d\n", group->list[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef MAXTAGS
|
||||
|
||||
/** Finds minimum light from an adjacent sector.
|
||||
*
|
||||
* \param sector Sector to start in.
|
||||
|
|
|
@ -75,6 +75,12 @@ typedef struct extracolormap_s
|
|||
struct extracolormap_s *prev;
|
||||
} extracolormap_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT16* tags;
|
||||
UINT16 numtags;
|
||||
} tags_t;
|
||||
|
||||
//
|
||||
// INTERNAL MAP TYPES used by play and refresh
|
||||
//
|
||||
|
@ -294,6 +300,7 @@ typedef struct sector_s
|
|||
INT16 special;
|
||||
UINT16 tag;
|
||||
INT32 nexttag, firsttag; // for fast tag searches
|
||||
tags_t tags;
|
||||
|
||||
// origin for any sounds played by the sector
|
||||
// also considered the center for e.g. Mario blocks
|
||||
|
@ -418,6 +425,7 @@ typedef struct line_s
|
|||
INT16 flags;
|
||||
INT16 special;
|
||||
INT16 tag;
|
||||
tags_t tags;
|
||||
|
||||
// Visual appearance: sidedefs.
|
||||
UINT16 sidenum[2]; // sidenum[1] will be 0xffff if one-sided
|
||||
|
|
Loading…
Reference in a new issue