qbsp: remove unnecessary num*() helpers from mapdata_t
This commit is contained in:
parent
e577fba343
commit
8a71b372bd
|
|
@ -132,16 +132,8 @@ struct mapdata_t
|
|||
/* map from plane hash code to list of indicies in `planes` vector */
|
||||
std::unordered_map<int, std::vector<int>> planehash;
|
||||
|
||||
/* Number of items currently used */
|
||||
int numfaces() const { return faces.size(); };
|
||||
int numbrushes() const { return brushes.size(); };
|
||||
int numentities() const { return entities.size(); };
|
||||
int numplanes() const { return planes.size(); };
|
||||
int nummiptex() const { return miptex.size(); };
|
||||
int numtexinfo() const { return mtexinfos.size(); };
|
||||
|
||||
/* Misc other global state for the compile process */
|
||||
bool leakfile; /* Flag once we've written a leak (.por/.pts) file */
|
||||
bool leakfile = false; /* Flag once we've written a leak (.por/.pts) file */
|
||||
|
||||
// Final, exported BSP
|
||||
mbsp_t bsp;
|
||||
|
|
@ -152,7 +144,7 @@ struct mapdata_t
|
|||
std::vector<uint8_t> exported_bspxbrushes;
|
||||
|
||||
// Q2 stuff
|
||||
int32_t numareaportals;
|
||||
int32_t numareaportals = 0;
|
||||
|
||||
// misc
|
||||
int start_spots = 0;
|
||||
|
|
|
|||
|
|
@ -995,7 +995,7 @@ brush_stats_t Brush_LoadEntity(mapentity_t *entity, const int hullnum)
|
|||
* We no longer care about the order of adding func_detail and func_group,
|
||||
* Entity_SortBrushes will sort the brushes
|
||||
*/
|
||||
for (int i = 1; i < map.numentities(); i++) {
|
||||
for (int i = 1; i < map.entities.size(); i++) {
|
||||
mapentity_t *source = &map.entities.at(i);
|
||||
|
||||
/* Load external .map and change the classname, if needed */
|
||||
|
|
|
|||
18
qbsp/map.cc
18
qbsp/map.cc
|
|
@ -122,11 +122,11 @@ static void AddAnimTex(const char *name)
|
|||
snprintf(framename, sizeof(framename), "%s", name);
|
||||
for (i = 0; i < frame; i++) {
|
||||
framename[1] = basechar + i;
|
||||
for (j = 0; j < map.nummiptex(); j++) {
|
||||
for (j = 0; j < map.miptex.size(); j++) {
|
||||
if (!Q_strcasecmp(framename, map.miptex.at(j).name.c_str()))
|
||||
break;
|
||||
}
|
||||
if (j < map.nummiptex())
|
||||
if (j < map.miptex.size())
|
||||
continue;
|
||||
|
||||
map.miptex.push_back({framename});
|
||||
|
|
@ -171,7 +171,7 @@ int FindMiptex(const char *name, std::optional<extended_texinfo_t> &extended_inf
|
|||
extended_info = extended_texinfo_t{};
|
||||
}
|
||||
|
||||
for (i = 0; i < map.nummiptex(); i++) {
|
||||
for (i = 0; i < map.miptex.size(); i++) {
|
||||
const texdata_t &tex = map.miptex.at(i);
|
||||
|
||||
if (!Q_strcasecmp(name, tex.name.c_str())) {
|
||||
|
|
@ -198,7 +198,7 @@ int FindMiptex(const char *name, std::optional<extended_texinfo_t> &extended_inf
|
|||
extended_info = extended_texinfo_t{};
|
||||
}
|
||||
|
||||
for (i = 0; i < map.nummiptex(); i++) {
|
||||
for (i = 0; i < map.miptex.size(); i++) {
|
||||
const texdata_t &tex = map.miptex.at(i);
|
||||
|
||||
if (!Q_strcasecmp(name, tex.name.c_str()) && tex.flags.native == extended_info->flags.native &&
|
||||
|
|
@ -1899,11 +1899,11 @@ void LoadMapFile(void)
|
|||
// if (!(map.start_spots & info_player_coop))
|
||||
// logging::print("WARNING: No info_player_coop entities in level\n");
|
||||
|
||||
logging::print(logging::flag::STAT, " {:8} faces\n", map.numfaces());
|
||||
logging::print(logging::flag::STAT, " {:8} brushes\n", map.numbrushes());
|
||||
logging::print(logging::flag::STAT, " {:8} entities\n", map.numentities());
|
||||
logging::print(logging::flag::STAT, " {:8} unique texnames\n", map.nummiptex());
|
||||
logging::print(logging::flag::STAT, " {:8} texinfo\n", map.numtexinfo());
|
||||
logging::print(logging::flag::STAT, " {:8} faces\n", map.faces.size());
|
||||
logging::print(logging::flag::STAT, " {:8} brushes\n", map.brushes.size());
|
||||
logging::print(logging::flag::STAT, " {:8} entities\n", map.entities.size());
|
||||
logging::print(logging::flag::STAT, " {:8} unique texnames\n", map.miptex.size());
|
||||
logging::print(logging::flag::STAT, " {:8} texinfo\n", map.mtexinfos.size());
|
||||
logging::print(logging::flag::STAT, "\n");
|
||||
|
||||
if (options.expand.value()) {
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ std::vector<node_t *> FindOccupiedClusters(node_t *headnode)
|
|||
{
|
||||
std::vector<node_t *> result;
|
||||
|
||||
for (int i = 1; i < map.numentities(); i++) {
|
||||
for (int i = 1; i < map.entities.size(); i++) {
|
||||
mapentity_t *entity = &map.entities.at(i);
|
||||
|
||||
/* skip entities at (0 0 0) (bmodels) */
|
||||
|
|
|
|||
21
qbsp/qbsp.cc
21
qbsp/qbsp.cc
|
|
@ -648,7 +648,7 @@ static void ProcessEntity(mapentity_t *entity, const int hullnum)
|
|||
logging::print(logging::flag::STAT, " {:8} liquid brushes\n", stats.liquid);
|
||||
}
|
||||
|
||||
logging::print(logging::flag::STAT, " {:8} planes\n", map.numplanes());
|
||||
logging::print(logging::flag::STAT, " {:8} planes\n", map.planes.size());
|
||||
|
||||
if (hullnum > 0) {
|
||||
nodes = SolidBSP(entity, true);
|
||||
|
|
@ -757,14 +757,14 @@ UpdateEntLump
|
|||
*/
|
||||
static void UpdateEntLump(void)
|
||||
{
|
||||
int modnum, i;
|
||||
int modnum;
|
||||
char modname[10];
|
||||
mapentity_t *entity;
|
||||
|
||||
logging::print(logging::flag::STAT, " Updating entities lump...\n");
|
||||
|
||||
modnum = 1;
|
||||
for (i = 1; i < map.numentities(); i++) {
|
||||
for (int i = 1; i < map.entities.size(); i++) {
|
||||
entity = &map.entities.at(i);
|
||||
|
||||
/* Special handling for misc_external_map.
|
||||
|
|
@ -922,10 +922,6 @@ static void BSPX_Brushes_AddModel(struct bspxbrushes_s *ctx, int modelnum, std::
|
|||
/* for generating BRUSHLIST bspx lump */
|
||||
static void BSPX_CreateBrushList(void)
|
||||
{
|
||||
mapentity_t *ent;
|
||||
int entnum;
|
||||
int modelnum;
|
||||
const char *mod;
|
||||
struct bspxbrushes_s ctx;
|
||||
|
||||
if (!options.wrbrushes.value())
|
||||
|
|
@ -933,12 +929,13 @@ static void BSPX_CreateBrushList(void)
|
|||
|
||||
BSPX_Brushes_Init(&ctx);
|
||||
|
||||
for (entnum = 0; entnum < map.numentities(); entnum++) {
|
||||
ent = &map.entities.at(entnum);
|
||||
if (ent == map.world_entity())
|
||||
for (int entnum = 0; entnum < map.entities.size(); ++entnum) {
|
||||
mapentity_t *ent = &map.entities.at(entnum);
|
||||
int modelnum;
|
||||
if (ent == map.world_entity()) {
|
||||
modelnum = 0;
|
||||
else {
|
||||
mod = ValueForKey(ent, "model");
|
||||
} else {
|
||||
const char *mod = ValueForKey(ent, "model");
|
||||
if (*mod != '*')
|
||||
continue;
|
||||
modelnum = atoi(mod + 1);
|
||||
|
|
|
|||
10
qbsp/wad.cc
10
qbsp/wad.cc
|
|
@ -264,7 +264,7 @@ static bool WAD_LoadLump(const wad_t &wad, const char *name, miptexhl_t &dest)
|
|||
|
||||
static void WADList_LoadTextures()
|
||||
{
|
||||
for (size_t i = 0; i < map.nummiptex(); i++) {
|
||||
for (size_t i = 0; i < map.miptex.size(); i++) {
|
||||
// already loaded?
|
||||
if (map.bsp.dtex.textures[i].data[0])
|
||||
continue;
|
||||
|
|
@ -278,7 +278,7 @@ static void WADList_LoadTextures()
|
|||
|
||||
static void WADList_AddAnimationFrames()
|
||||
{
|
||||
size_t oldcount = map.nummiptex();
|
||||
size_t oldcount = map.miptex.size();
|
||||
|
||||
for (size_t i = 0; i < oldcount; i++) {
|
||||
const std::string &existing_name = map.miptexTextureName(i);
|
||||
|
|
@ -294,7 +294,7 @@ static void WADList_AddAnimationFrames()
|
|||
}
|
||||
}
|
||||
|
||||
logging::print(logging::flag::STAT, " {:8} texture frames added\n", map.nummiptex() - oldcount);
|
||||
logging::print(logging::flag::STAT, " {:8} texture frames added\n", map.miptex.size() - oldcount);
|
||||
}
|
||||
|
||||
void WADList_Process()
|
||||
|
|
@ -307,12 +307,12 @@ void WADList_Process()
|
|||
}
|
||||
|
||||
/* Default texture data to store in worldmodel */
|
||||
map.bsp.dtex.textures.resize(map.nummiptex());
|
||||
map.bsp.dtex.textures.resize(map.miptex.size());
|
||||
|
||||
WADList_LoadTextures();
|
||||
|
||||
/* Last pass, mark unfound textures as such */
|
||||
for (size_t i = 0; i < map.nummiptex(); i++) {
|
||||
for (size_t i = 0; i < map.miptex.size(); i++) {
|
||||
if (!map.bsp.dtex.textures[i].data[0]) {
|
||||
logging::print("WARNING: Texture {} not found\n", map.miptexTextureName(i));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue