mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-29 15:42:03 +00:00
Merge branch 'taglists-refactor' into 'next'
Speed up taglist creation See merge request STJr/SRB2!1702
This commit is contained in:
commit
af925c1742
4 changed files with 76 additions and 3 deletions
|
@ -245,6 +245,7 @@
|
||||||
<ClInclude Include="..\i_sound.h" />
|
<ClInclude Include="..\i_sound.h" />
|
||||||
<ClInclude Include="..\i_system.h" />
|
<ClInclude Include="..\i_system.h" />
|
||||||
<ClInclude Include="..\i_tcp.h" />
|
<ClInclude Include="..\i_tcp.h" />
|
||||||
|
<ClInclude Include="..\i_threads.h" />
|
||||||
<ClInclude Include="..\i_video.h" />
|
<ClInclude Include="..\i_video.h" />
|
||||||
<ClInclude Include="..\keys.h" />
|
<ClInclude Include="..\keys.h" />
|
||||||
<ClInclude Include="..\libdivide.h" />
|
<ClInclude Include="..\libdivide.h" />
|
||||||
|
@ -304,6 +305,7 @@
|
||||||
<ClInclude Include="..\st_stuff.h" />
|
<ClInclude Include="..\st_stuff.h" />
|
||||||
<ClInclude Include="..\s_sound.h" />
|
<ClInclude Include="..\s_sound.h" />
|
||||||
<ClInclude Include="..\tables.h" />
|
<ClInclude Include="..\tables.h" />
|
||||||
|
<ClInclude Include="..\taglist.h" />
|
||||||
<ClInclude Include="..\v_video.h" />
|
<ClInclude Include="..\v_video.h" />
|
||||||
<ClInclude Include="..\w_wad.h" />
|
<ClInclude Include="..\w_wad.h" />
|
||||||
<ClInclude Include="..\y_inter.h" />
|
<ClInclude Include="..\y_inter.h" />
|
||||||
|
@ -415,6 +417,7 @@
|
||||||
<ClCompile Include="..\lua_polyobjlib.c" />
|
<ClCompile Include="..\lua_polyobjlib.c" />
|
||||||
<ClCompile Include="..\lua_script.c" />
|
<ClCompile Include="..\lua_script.c" />
|
||||||
<ClCompile Include="..\lua_skinlib.c" />
|
<ClCompile Include="..\lua_skinlib.c" />
|
||||||
|
<ClCompile Include="..\lua_taglib.c" />
|
||||||
<ClCompile Include="..\lua_thinkerlib.c" />
|
<ClCompile Include="..\lua_thinkerlib.c" />
|
||||||
<ClCompile Include="..\lzf.c" />
|
<ClCompile Include="..\lzf.c" />
|
||||||
<ClCompile Include="..\md5.c" />
|
<ClCompile Include="..\md5.c" />
|
||||||
|
@ -475,10 +478,12 @@
|
||||||
<ClCompile Include="..\r_things.c" />
|
<ClCompile Include="..\r_things.c" />
|
||||||
<ClCompile Include="..\screen.c" />
|
<ClCompile Include="..\screen.c" />
|
||||||
<ClCompile Include="..\sounds.c" />
|
<ClCompile Include="..\sounds.c" />
|
||||||
|
<ClCompile Include="..\strcasestr.c" />
|
||||||
<ClCompile Include="..\string.c" />
|
<ClCompile Include="..\string.c" />
|
||||||
<ClCompile Include="..\st_stuff.c" />
|
<ClCompile Include="..\st_stuff.c" />
|
||||||
<ClCompile Include="..\s_sound.c" />
|
<ClCompile Include="..\s_sound.c" />
|
||||||
<ClCompile Include="..\tables.c" />
|
<ClCompile Include="..\tables.c" />
|
||||||
|
<ClCompile Include="..\taglist.c" />
|
||||||
<ClCompile Include="..\t_facon.c">
|
<ClCompile Include="..\t_facon.c">
|
||||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -135,6 +135,16 @@
|
||||||
<ClInclude Include="..\dehacked.h">
|
<ClInclude Include="..\dehacked.h">
|
||||||
<Filter>D_Doom</Filter>
|
<Filter>D_Doom</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\deh_lua.h">
|
||||||
|
<Filter>D_Doom</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\deh_soc.h">
|
||||||
|
<Filter>D_Doom</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\deh_tables.h">
|
||||||
|
<Filter>D_Doom</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
|
||||||
<ClInclude Include="..\doomdata.h">
|
<ClInclude Include="..\doomdata.h">
|
||||||
<Filter>D_Doom</Filter>
|
<Filter>D_Doom</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -288,6 +298,9 @@
|
||||||
<ClInclude Include="..\i_tcp.h">
|
<ClInclude Include="..\i_tcp.h">
|
||||||
<Filter>I_Interface</Filter>
|
<Filter>I_Interface</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\i_threads.h">
|
||||||
|
<Filter>I_Interface</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\i_video.h">
|
<ClInclude Include="..\i_video.h">
|
||||||
<Filter>I_Interface</Filter>
|
<Filter>I_Interface</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -402,6 +415,9 @@
|
||||||
<ClInclude Include="..\tables.h">
|
<ClInclude Include="..\tables.h">
|
||||||
<Filter>P_Play</Filter>
|
<Filter>P_Play</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\taglist.h">
|
||||||
|
<Filter>P_Play</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\libdivide.h">
|
<ClInclude Include="..\libdivide.h">
|
||||||
<Filter>R_Rend</Filter>
|
<Filter>R_Rend</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -600,6 +616,16 @@
|
||||||
<ClCompile Include="..\dehacked.c">
|
<ClCompile Include="..\dehacked.c">
|
||||||
<Filter>D_Doom</Filter>
|
<Filter>D_Doom</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\deh_lua.c">
|
||||||
|
<Filter>D_Doom</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\deh_soc.c">
|
||||||
|
<Filter>D_Doom</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\deh_tables.c">
|
||||||
|
<Filter>D_Doom</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
|
||||||
<ClCompile Include="..\d_clisrv.c">
|
<ClCompile Include="..\d_clisrv.c">
|
||||||
<Filter>D_Doom</Filter>
|
<Filter>D_Doom</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -747,6 +773,9 @@
|
||||||
<ClCompile Include="..\lua_skinlib.c">
|
<ClCompile Include="..\lua_skinlib.c">
|
||||||
<Filter>LUA</Filter>
|
<Filter>LUA</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\lua_taglib.c">
|
||||||
|
<Filter>LUA</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\lua_thinkerlib.c">
|
<ClCompile Include="..\lua_thinkerlib.c">
|
||||||
<Filter>LUA</Filter>
|
<Filter>LUA</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -792,6 +821,9 @@
|
||||||
<ClCompile Include="..\string.c">
|
<ClCompile Include="..\string.c">
|
||||||
<Filter>M_Misc</Filter>
|
<Filter>M_Misc</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\strcasestr.c">
|
||||||
|
<Filter>M_Misc</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\comptime.c">
|
<ClCompile Include="..\comptime.c">
|
||||||
<Filter>O_Other</Filter>
|
<Filter>O_Other</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -852,6 +884,9 @@
|
||||||
<ClCompile Include="..\tables.c">
|
<ClCompile Include="..\tables.c">
|
||||||
<Filter>P_Play</Filter>
|
<Filter>P_Play</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\taglist.c">
|
||||||
|
<Filter>P_Play</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\t_facon.c">
|
<ClCompile Include="..\t_facon.c">
|
||||||
<Filter>P_Play</Filter>
|
<Filter>P_Play</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -191,6 +191,38 @@ void Taggroup_Add (taggroup_t *garray[], const mtag_t tag, size_t id)
|
||||||
group->elements[i] = id;
|
group->elements[i] = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Taggroup_Add_Init(taggroup_t *garray[], const mtag_t tag, size_t id)
|
||||||
|
{
|
||||||
|
taggroup_t *group;
|
||||||
|
|
||||||
|
if (tag == MTAG_GLOBAL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
group = garray[(UINT16)tag];
|
||||||
|
|
||||||
|
if (! in_bit_array(tags_available, tag))
|
||||||
|
{
|
||||||
|
num_tags++;
|
||||||
|
set_bit_array(tags_available, tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create group if empty.
|
||||||
|
if (!group)
|
||||||
|
group = garray[(UINT16)tag] = Z_Calloc(sizeof(taggroup_t), PU_LEVEL, NULL);
|
||||||
|
else if (group->elements[group->count - 1] == id)
|
||||||
|
return; // Don't add duplicates
|
||||||
|
|
||||||
|
group->count++;
|
||||||
|
|
||||||
|
if (group->count > group->capacity)
|
||||||
|
{
|
||||||
|
group->capacity = 2 * group->count;
|
||||||
|
group->elements = Z_Realloc(group->elements, group->capacity * sizeof(size_t), PU_LEVEL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
group->elements[group->count - 1] = id;
|
||||||
|
}
|
||||||
|
|
||||||
static size_t total_elements_with_tag (const mtag_t tag)
|
static size_t total_elements_with_tag (const mtag_t tag)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
|
@ -250,17 +282,17 @@ void Taggroup_Remove (taggroup_t *garray[], const mtag_t tag, size_t id)
|
||||||
|
|
||||||
static void Taglist_AddToSectors (const mtag_t tag, const size_t itemid)
|
static void Taglist_AddToSectors (const mtag_t tag, const size_t itemid)
|
||||||
{
|
{
|
||||||
Taggroup_Add(tags_sectors, tag, itemid);
|
Taggroup_Add_Init(tags_sectors, tag, itemid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Taglist_AddToLines (const mtag_t tag, const size_t itemid)
|
static void Taglist_AddToLines (const mtag_t tag, const size_t itemid)
|
||||||
{
|
{
|
||||||
Taggroup_Add(tags_lines, tag, itemid);
|
Taggroup_Add_Init(tags_lines, tag, itemid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Taglist_AddToMapthings (const mtag_t tag, const size_t itemid)
|
static void Taglist_AddToMapthings (const mtag_t tag, const size_t itemid)
|
||||||
{
|
{
|
||||||
Taggroup_Add(tags_mapthings, tag, itemid);
|
Taggroup_Add_Init(tags_mapthings, tag, itemid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// After all taglists have been built for each element (sectors, lines, things),
|
/// After all taglists have been built for each element (sectors, lines, things),
|
||||||
|
|
|
@ -41,6 +41,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
size_t *elements;
|
size_t *elements;
|
||||||
size_t count;
|
size_t count;
|
||||||
|
size_t capacity;
|
||||||
} taggroup_t;
|
} taggroup_t;
|
||||||
|
|
||||||
extern bitarray_t tags_available[];
|
extern bitarray_t tags_available[];
|
||||||
|
|
Loading…
Reference in a new issue