mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-04-23 10:41:51 +00:00
Partial usage of multitag lists for sectors. The game still accesses sector tags directly though so that needs to be addressed.
This commit is contained in:
parent
8c0a1aa4d3
commit
8b21b93fd9
5 changed files with 63 additions and 61 deletions
|
@ -376,7 +376,7 @@ 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++;
|
||||
|
@ -388,7 +388,7 @@ static void Tags_Add (tags_t* itemtags, const UINT16 tag)
|
|||
|
||||
itemtags->tags[itemtags->numtags - 1] = tag;
|
||||
}
|
||||
*/
|
||||
|
||||
/** Loads the vertexes for a level.
|
||||
*
|
||||
* \param lump VERTEXES lump number.
|
||||
|
@ -697,7 +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);
|
||||
Tags_Add(&(ss->tags), ss->tag);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1070,20 +1070,20 @@ static void TextmapSector(UINT32 i, char *param)
|
|||
sectors[i].special = atol(dat = M_GetToken(NULL));
|
||||
else if (fastcmp(param, "id"))
|
||||
{
|
||||
sectors[i].tag = atol(dat = M_GetToken(NULL));
|
||||
// Tags_Add(§ors[i].tags, sectors[i].tag);
|
||||
UINT16 tag = atol(dat = M_GetToken(NULL));
|
||||
sectors[i].tag = tag;
|
||||
Tags_Add(§ors[i].tags, tag);
|
||||
}
|
||||
/* else if (fastcmp(param, "moreids"))
|
||||
else if (fastcmp(param, "moreids"))
|
||||
{
|
||||
char* id = dat = M_GetToken(NULL);
|
||||
while (id)
|
||||
{
|
||||
CONS_Printf("Extra id: %d\n", atol(id));
|
||||
id = strchr(id, ' ');
|
||||
if (id)
|
||||
Tags_Add(§ors[i].tags, atol(id));
|
||||
if (id = strchr(id, ' '))
|
||||
id++;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else if (fastcmp(param, "xpanningfloor"))
|
||||
sectors[i].floor_xoffs = FLOAT_TO_FIXED(atof(dat = M_GetToken(NULL)));
|
||||
else if (fastcmp(param, "ypanningfloor"))
|
||||
|
|
93
src/p_spec.c
93
src/p_spec.c
|
@ -984,6 +984,16 @@ fixed_t P_GetSectorGravity(sector_t *sec)
|
|||
return sec->gravity;
|
||||
}
|
||||
|
||||
static INT32 tpos = -1;
|
||||
|
||||
#define MAXTAGS 65536
|
||||
typedef struct{
|
||||
INT32* list;
|
||||
size_t size;
|
||||
} taggroup_t;
|
||||
|
||||
taggroup_t* taglist_sec[MAXTAGS];
|
||||
|
||||
/** Searches the tag lists for the next sector tagged to a line.
|
||||
*
|
||||
* \param line Tagged line used as a reference.
|
||||
|
@ -994,23 +1004,7 @@ fixed_t P_GetSectorGravity(sector_t *sec)
|
|||
*/
|
||||
INT32 P_FindSectorFromLineTag(line_t *line, INT32 start)
|
||||
{
|
||||
if (line->tag == -1)
|
||||
{
|
||||
start++;
|
||||
|
||||
if (start >= (INT32)numsectors)
|
||||
return -1;
|
||||
|
||||
return start;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = start >= 0 ? sectors[start].nexttag :
|
||||
sectors[(unsigned)line->tag % numsectors].firsttag;
|
||||
while (start >= 0 && sectors[start].tag != line->tag)
|
||||
start = sectors[start].nexttag;
|
||||
return start;
|
||||
}
|
||||
return P_FindSectorFromTag(line->tag, start);
|
||||
}
|
||||
|
||||
/** Searches the tag lists for the next sector with a given tag.
|
||||
|
@ -1023,23 +1017,22 @@ INT32 P_FindSectorFromLineTag(line_t *line, INT32 start)
|
|||
*/
|
||||
INT32 P_FindSectorFromTag(INT16 tag, INT32 start)
|
||||
{
|
||||
if (tag == -1)
|
||||
{
|
||||
start++;
|
||||
tpos = 0;
|
||||
|
||||
if (start >= (INT32)numsectors)
|
||||
if (taglist_sec[tag])
|
||||
{
|
||||
if (start != -1)
|
||||
for (; tpos < taglist_sec[tag]->size;)
|
||||
if (start == taglist_sec[tag]->list[tpos++])
|
||||
break;
|
||||
|
||||
if (tpos >= taglist_sec[tag]->size)
|
||||
return -1;
|
||||
|
||||
return start;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = start >= 0 ? sectors[start].nexttag :
|
||||
sectors[(unsigned)tag % numsectors].firsttag;
|
||||
while (start >= 0 && sectors[start].tag != tag)
|
||||
start = sectors[start].nexttag;
|
||||
return start;
|
||||
return taglist_sec[tag]->list[tpos++];
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** Searches the tag lists for the next line tagged to a line.
|
||||
|
@ -1611,17 +1604,8 @@ 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;
|
||||
|
@ -1639,7 +1623,21 @@ static void Taglist_AddTo (const size_t tag, const size_t itemid)
|
|||
group->list = Z_Realloc(group->list, group->size * sizeof(size_t), PU_LEVEL, NULL);
|
||||
}
|
||||
group->list[group->size - 1] = itemid;
|
||||
}*/
|
||||
}
|
||||
|
||||
boolean Tags_Compare (const tags_t* tags1, const tags_t* tags2)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (tags1->numtags != tags2->numtags)
|
||||
return false;
|
||||
|
||||
for (i = 0; i < tags1->numtags; i++)
|
||||
if (tags1->tags[i] != tags2->tags[i])
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Hashes the sector tags across the sectors and linedefs.
|
||||
*
|
||||
|
@ -1663,16 +1661,20 @@ 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);
|
||||
if (sectors[i].tags.numtags)
|
||||
{
|
||||
size_t j;
|
||||
for (j = 0; j < sectors[i].tags.numtags; j++)
|
||||
Taglist_AddTo(sectors[i].tags.tags[j], i);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
for (i = 0; i < MAXTAGS; i++)
|
||||
{
|
||||
if (taglist_sec[i])
|
||||
|
@ -1685,8 +1687,7 @@ static inline void P_InitTagLists(void)
|
|||
CONS_Printf("Sector %d\n", group->list[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}*/
|
||||
}
|
||||
|
||||
#undef MAXTAGS
|
||||
|
|
|
@ -58,6 +58,7 @@ fixed_t P_GetSectorGravity(sector_t *sec);
|
|||
INT32 P_FindSectorFromLineTag(line_t *line, INT32 start);
|
||||
INT32 P_FindSectorFromTag(INT16 tag, INT32 start);
|
||||
INT32 P_FindSpecialLineFromTag(INT16 special, INT16 tag, INT32 start);
|
||||
boolean Tags_Compare (const tags_t* tags1, const tags_t* tags2);
|
||||
|
||||
INT32 P_FindMinSurroundingLight(sector_t *sector, INT32 max);
|
||||
|
||||
|
|
|
@ -378,7 +378,7 @@ boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back)
|
|||
// Consider colormaps
|
||||
&& back->extra_colormap == front->extra_colormap
|
||||
&& ((!front->ffloors && !back->ffloors)
|
||||
|| front->tag == back->tag));
|
||||
|| Tags_Compare(&front->tags, &back->tags)));
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -490,7 +490,7 @@ static void R_AddLine(seg_t *line)
|
|||
#endif
|
||||
!line->sidedef->midtexture
|
||||
&& ((!frontsector->ffloors && !backsector->ffloors)
|
||||
|| (frontsector->tag == backsector->tag)))
|
||||
|| !Tags_Compare(&frontsector->tags, &backsector->tags)))
|
||||
return; // line is empty, don't even bother
|
||||
|
||||
goto clippass; // treat like wide open window instead
|
||||
|
|
|
@ -2216,7 +2216,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||
|| backsector->floorlightsec != frontsector->floorlightsec
|
||||
//SoM: 4/3/2000: Check for colormaps
|
||||
|| frontsector->extra_colormap != backsector->extra_colormap
|
||||
|| (frontsector->ffloors != backsector->ffloors && frontsector->tag != backsector->tag)
|
||||
|| (frontsector->ffloors != backsector->ffloors && !Tags_Compare(&frontsector->tags, &backsector->tags))
|
||||
|| frontsector->floor_scalex != backsector->floor_scalex
|
||||
|| frontsector->floor_scaley != backsector->floor_scaley)
|
||||
{
|
||||
|
@ -2251,7 +2251,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||
|| backsector->ceilinglightsec != frontsector->ceilinglightsec
|
||||
//SoM: 4/3/2000: Check for colormaps
|
||||
|| frontsector->extra_colormap != backsector->extra_colormap
|
||||
|| (frontsector->ffloors != backsector->ffloors && frontsector->tag != backsector->tag)
|
||||
|| (frontsector->ffloors != backsector->ffloors && !Tags_Compare(&frontsector->tags, &backsector->tags))
|
||||
|| frontsector->ceiling_scalex != backsector->ceiling_scalex
|
||||
|| frontsector->ceiling_scaley != backsector->ceiling_scaley)
|
||||
{
|
||||
|
@ -2372,7 +2372,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||
rw_bottomtexturemid += sidedef->rowoffset;
|
||||
|
||||
// allocate space for masked texture tables
|
||||
if (frontsector && backsector && frontsector->tag != backsector->tag && (backsector->ffloors || frontsector->ffloors))
|
||||
if (frontsector && backsector && !Tags_Compare(&frontsector->tags, &backsector->tags) && (backsector->ffloors || frontsector->ffloors))
|
||||
{
|
||||
ffloor_t *rover;
|
||||
ffloor_t *r2;
|
||||
|
|
Loading…
Reference in a new issue