Better way to do this?
Moderator: InsideQC Admins
15 posts
• Page 1 of 1
Better way to do this?
- Code: Select all
if (!strcasecmp(mapname, "start") ||
!strcasecmp(mapname, "e1m1") ||
!strcasecmp(mapname, "e1m2") ||
!strcasecmp(mapname, "e1m3") ||
!strcasecmp(mapname, "e1m4") ||
!strcasecmp(mapname, "e1m5") ||
!strcasecmp(mapname, "e1m6") ||
!strcasecmp(mapname, "e1m7") ||
!strcasecmp(mapname, "e1m8") ||
!strcasecmp(mapname, "e2m1") ||
!strcasecmp(mapname, "e2m2") ||
!strcasecmp(mapname, "e2m3") ||
!strcasecmp(mapname, "e2m4") ||
!strcasecmp(mapname, "e2m5") ||
!strcasecmp(mapname, "e2m6") ||
!strcasecmp(mapname, "e2m7") ||
!strcasecmp(mapname, "e2m8") ||
!strcasecmp(mapname, "e3m1") ||
!strcasecmp(mapname, "e3m2") ||
!strcasecmp(mapname, "e3m3") ||
!strcasecmp(mapname, "e3m4") ||
!strcasecmp(mapname, "e3m5") ||
!strcasecmp(mapname, "e3m6") ||
!strcasecmp(mapname, "e3m7") ||
!strcasecmp(mapname, "e3m8") ||
!strcasecmp(mapname, "e4m1") ||
!strcasecmp(mapname, "e4m2") ||
!strcasecmp(mapname, "e4m3") ||
!strcasecmp(mapname, "e4m4") ||
!strcasecmp(mapname, "e4m5") ||
!strcasecmp(mapname, "e4m6") ||
!strcasecmp(mapname, "e4m7") ||
!strcasecmp(mapname, "e4m8") ||
!strcasecmp(mapname, "end") ||
!strcasecmp(mapname, "dm1") ||
!strcasecmp(mapname, "dm2") ||
!strcasecmp(mapname, "dm3") ||
!strcasecmp(mapname, "dm4") ||
!strcasecmp(mapname, "dm5") ||
!strcasecmp(mapname, "dm6"))
original_map = true;
else
original_map = false;
Is there a more efficient way to do this? This seems a bit unwieldy.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
original map? surely that should includes mission packs also?
you could check the hash of the pak file that it came from (at least just the pak directory).
Or you could make a list and a loop.
you could check the hash of the pak file that it came from (at least just the pak directory).
Or you could make a list and a loop.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Spike wrote:original map? surely that should includes mission packs also?
you could check the hash of the pak file that it came from (at least just the pak directory).
Or you could make a list and a loop.
I'm using this to not load custom textures meant for the id1 maps when a custom map is running. You know, to avoid the funky looking custom single player map with some id1 textures but mostly not.
Like the "textures\exmy" folder in, say, FuhQuake.
Technically, I need to ensure that the gamedir of the map is id1 (or strictly speaking either id1 or qw).
Eventually I'll do the mission packs, but then again is there a full mission pack retexture project really done?
Anyway, I want to not have the goofy looking maps with replacement textures where they shouldn't be in Engine X.
Really what I should be doing is reusing the "levels" array in menu.c and checking each iteration.
- Code: Select all
level_t levels[] =
{
{"start", "Entrance"}, // 0
{"e1m1", "Slipgate Complex"}, // 1
{"e1m2", "Castle of the Damned"},
{"e1m3", "The Necropolis"},
{"e1m4", "The Grisly Grotto"},
{"e1m5", "Gloom Keep"},
{"e1m6", "The Door To Chthon"},
{"e1m7", "The House of Chthon"},
{"e1m8", "Ziggurat Vertigo"},
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
If your maps look goofy, your replacement textures suck. If your replacement is meant to be map specific then it should be map specific, otherwise it ought to apply to all, at least in an ideal world. Disabling replacements on id's maps will prevent you from ever retexturing them (and vice versa).
What about maps that are combinations of other maps, like one of the slide maps that includes chunks of quake's deathmatch maps?
If your goal is to stop some-high-some-low-res textures on maps, just make sure that you can find a replacement texture for all textures before loading any, then you don't need to care if its a mission pack or not, so long as you make it dprint the missing textures. Then it can work with everything else that you're never going to directly work with. The alternative is that someone provides replacement textures for their custom map but your engine refuses to load them purely because its a custom map.
Anything that checks for specific map names is a hack, and hacks are bad!
But yeah, the easiest way is to use whichever is the active list in the menu.
What about maps that are combinations of other maps, like one of the slide maps that includes chunks of quake's deathmatch maps?
If your goal is to stop some-high-some-low-res textures on maps, just make sure that you can find a replacement texture for all textures before loading any, then you don't need to care if its a mission pack or not, so long as you make it dprint the missing textures. Then it can work with everything else that you're never going to directly work with. The alternative is that someone provides replacement textures for their custom map but your engine refuses to load them purely because its a custom map.
Anything that checks for specific map names is a hack, and hacks are bad!
But yeah, the easiest way is to use whichever is the active list in the menu.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
If I was going to do this, I'd open pak0.pak and pak1.pak in ID1, iterate through the BSPs in them, and add those to an array.
But otherwise what Spike said.
But otherwise what Spike said.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
Spike wrote:Anything that checks for specific map names is a hack, and hacks are bad!
But yeah, the easiest way is to use whichever is the active list in the menu.
It is a hack. And it is bad. And I agree hacks are bad.
But I sure don't plan to remaster the original Quake maps! And I like the "old" QRP texture set --- you know, the highly non-faithful one.
And I am having it check the mapname folder. In this case, the map name is a global folder for the original maps (exmy).
Plenty of important hacks and undesirable hacks are in the original GLQuake and derivatives:
1. The shotgun shell skin fix. Found in many modified engines. Not to mention the "muzzle flash remover from the skin" code used in some engines.
2. No interpolation on certain models (torches).
3. "Always some light on the gun"
4. Don't allow player models to go completely dark.
5. monster lerping
6. New games goes to the start map.
7. precaching dland.wav
8. The player model and eyes model must be precached before other models as part of the demo spec.
9. Particles built into the engine.
10. The 6 instances of same texture names being different textures.
11. Not interpolating the nail gun.
etc. etc.
I'm just saying! When working with the Quake engine, hacks do have their place.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
That being said ...
I've entirely dumped the JoeQuake/FuhQuake/ezQuake/Qrack way of handling external textures and have gone 100% DarkPlaces-style naming convention.
I've entirely dumped the JoeQuake/FuhQuake/ezQuake/Qrack way of handling external textures and have gone 100% DarkPlaces-style naming convention.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
It could be useful to have a cvar to not allow replacement textures on the map unless the replacement texture set for the map is complete; this would prevent mixing low-res textures with high-res ones.
Hmm, I don't remember if Makaqu does this, but I remember seeing code for this somewhere.
This is something I've never noticed.
Yes, this can be really annoying, specially for single-player botmatch mods.
I thought about creating a cvar that would store the initialization commands for single-player games once; calling a CFG file for this could be even more useful, maybe.
The hard-coded particle behavior is really annoying. However, the particle image itself can be rendered much faster when hard-coded in the engine as a dynamically-generated textureless primitive, specially in software-rendered engines; in my opinion, this is what makes them different from client-side sprite-based effects.
Agreed:
However, enabling muzzleflash hacks through a cvar could be helpful, since they could still be useful for some mods.
Baker wrote:3. "Always some light on the gun"
Hmm, I don't remember if Makaqu does this, but I remember seeing code for this somewhere.
Baker wrote:4. Don't allow player models to go completely dark.
This is something I've never noticed.
Baker wrote:6. New games goes to the start map.
Yes, this can be really annoying, specially for single-player botmatch mods.
I thought about creating a cvar that would store the initialization commands for single-player games once; calling a CFG file for this could be even more useful, maybe.
Baker wrote:9. Particles built into the engine.
The hard-coded particle behavior is really annoying. However, the particle image itself can be rendered much faster when hard-coded in the engine as a dynamically-generated textureless primitive, specially in software-rendered engines; in my opinion, this is what makes them different from client-side sprite-based effects.
Baker wrote:11. Not interpolating the nail gun.
etc. etc.
I'm just saying! When working with the Quake engine, hacks do have their place.
Agreed:
I feel that as long as possible, fixes should be made where the problem is. For example, this is why I chose to not add any engine hack for skipping frame interpolation of muzzleflashes; since the viewmodels included in Makaqu’s PAK10.PAK were made with frame interpolation in mind, their muzzleflashes works perfectly with it, and their animations looks a lot more smooth and fluid in Makaqu than in other engines - the super nailgun is a good example of this.
However, enabling muzzleflash hacks through a cvar could be helpful, since they could still be useful for some mods.
-

mankrip - Posts: 915
- Joined: Fri Jul 04, 2008 3:02 am
Agreed in principle, but - as you've correctly hinted at - sometimes it's not always possible, especially when you're dealing with legacy content that may not have been developed with certain engine features in mind. Chasing down the mod author and asking them to fix something that they may have made in 1996 is very rarely a viable option. A classic example of this is maps that were developed and tested on GLQuake only, and as a result may have textures that suffer from incorrect use of the fullbright range of the Quake palette.mk wrote:Agreed:I feel that as long as possible, fixes should be made where the problem is. For example, this is why I chose to not add any engine hack for skipping frame interpolation of muzzleflashes; since the viewmodels included in Makaqu’s PAK10.PAK were made with frame interpolation in mind, their muzzleflashes works perfectly with it, and their animations looks a lot more smooth and fluid in Makaqu than in other engines - the super nailgun is a good example of this.
However, enabling muzzleflash hacks through a cvar could be helpful, since they could still be useful for some mods.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
Re: Better way to do this?
Baker wrote:Is there a more efficient way to do this? This seems a bit unwieldy.
- Code: Select all
typedef struct
{
char *name;
char *description;
} idlevel_t;
idlevel_t idmaps[] =
{
{"start", "Entrance"},
{"e1m1", "Slipgate Complex"},
{"e1m2", "Castle of the Damned"},
{"e1m3", "The Necropolis"},
{"e1m4", "The Grisly Grotto"},
{"e1m5", "Gloom Keep"},
{"e1m6", "The Door To Chthon"},
{"e1m7", "The House of Chthon"},
{"e1m8", "Ziggurat Vertigo"},
{"e2m1", "The Installation"},
{"e2m2", "Ogre Citadel"},
{"e2m3", "Crypt of Decay"},
{"e2m4", "The Ebon Fortress"},
{"e2m5", "The Wizard's Manse"},
{"e2m6", "The Dismal Oubliette"},
{"e2m7", "Underearth"},
{"e3m1", "Termination Central"},
{"e3m2", "The Vaults of Zin"},
{"e3m3", "The Tomb of Terror"},
{"e3m4", "Satan's Dark Delight"},
{"e3m5", "Wind Tunnels"},
{"e3m6", "Chambers of Torment"},
{"e3m7", "The Haunted Halls"},
{"e4m1", "The Sewage System"},
{"e4m2", "The Tower of Despair"},
{"e4m3", "The Elder God Shrine"},
{"e4m4", "The Palace of Hate"},
{"e4m5", "Hell's Atrium"},
{"e4m6", "The Pain Maze"},
{"e4m7", "Azure Agony"},
{"e4m8", "The Nameless City"},
{"end", "Shub-Niggurath's Pit"},
{"dm1", "Place of Two Deaths"},
{"dm2", "Claustrophobopolis"},
{"dm3", "The Abandoned Base"},
{"dm4", "The Bad Place"},
{"dm5", "The Cistern"},
{"dm6", "The Dark Zone"}
{"start", "Command HQ"},
{"hip1m1", "The Pumping Station"},
{"hip1m2", "Storage Facility"},
{"hip1m3", "The Lost Mine"},
{"hip1m4", "Research Facility"},
{"hip1m5", "Military Complex"},
{"hip2m1", "Ancient Realms"},
{"hip2m2", "The Black Cathedral"},
{"hip2m3", "The Catacombs"},
{"hip2m4", "The Crypt"},
{"hip2m5", "Mortum's Keep"},
{"hip2m6", "The Gremlin's Domain"},
{"hip3m1", "Tur Torment"},
{"hip3m2", "Pandemonium"},
{"hip3m3", "Limbo"},
{"hip3m4", "The Gauntlet"},
{"hipend", "Armagon's Lair"},
{"hipdm1", "The Edge of Oblivion"}
{"start", "Split Decision"},
{"r1m1", "Deviant's Domain"},
{"r1m2", "Dread Portal"},
{"r1m3", "Judgement Call"},
{"r1m4", "Cave of Death"},
{"r1m5", "Towers of Wrath"},
{"r1m6", "Temple of Pain"},
{"r1m7", "Tomb of the Overlord"},
{"r2m1", "Tempus Fugit"},
{"r2m2", "Elemental Fury I"},
{"r2m3", "Elemental Fury II"},
{"r2m4", "Curse of Osiris"},
{"r2m5", "Wizard's Keep"},
{"r2m6", "Blood Sacrifice"},
{"r2m7", "Last Bastion"},
{"r2m8", "Source of Evil"},
};
int Findidmaps(char *map_name)
{
int i;
for (i = 0; i < 72; i++)
{
if (!strncmp(map_name, idmaps[i].name))
{
if (!strncmp(map_name, "start"))
{
if ((!strncmp(idmaps[i].description) == "Entrance") ||
(!strncmp(idmaps[i].description) == "Command HQ") ||
(!strncmp(idmaps[i].description) == "Split Decision"))
return true;
else
return false;
}
return true;
}
}
return false;
}
- r00k
- Posts: 1110
- Joined: Sat Nov 13, 2004 10:39 pm
I'd suggest to reuse the level_t structure from menu.c and compare the info there with cl.entities[0].model (of course, all of this during map loading, meaning you should place the conditional external texture loading after this test). The chance of an external map to have the same bspfile name and message of an original map is remote enough to turn the method effective.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
frag.machine wrote:I'd suggest to reuse the level_t structure from menu.c and compare the info there with cl.entities[0].model (of course, all of this during map loading, meaning you should place the conditional external texture loading after this test). The chance of an external map to have the same bspfile name and message of an original map is remote enough to turn the method effective.
Very true. But there are plenty of "start" maps for many mods. Like Zerstorer or almost every release with a skill selector map (Travail, Coagula contest, Lost Chapters, etc. etc. etc.) so an additional part would be a gamedir check.
I'm lazy, I haven't done it.
That being said, ima gonna mostly copy R00ks code and save myself 10 minutes
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
I think MH has the better idea. REMEMBER gpl'd id maps (yet to emerge from the jungle) may carry the same filenames! Instead of comparing JUST .name but also .checksum and nix the description field all together unless it's just for output to the user.
- r00k
- Posts: 1110
- Joined: Sat Nov 13, 2004 10:39 pm
FitzQuake 0.85 has some really great ideas on model flags. Far better than tons of "if (strcmp(model, "flame.mdl")) // Don't interpolate torch" code.
Context: glmodel.c
And gl_rmisc.c
- Code: Select all
/*
=================
Mod_SetExtraFlags -- johnfitz -- set up extra flags that aren't in the mdl
=================
*/
void Mod_SetExtraFlags (model_t *mod)
{
extern cvar_t r_nolerp_list;
char *s;
int i;
if (!mod || !mod->name || mod->type != mod_alias)
return;
mod->flags &= 0xFF; //only preserve first byte
// nolerp flag
for (s=r_nolerp_list.string; *s; s += i+1, i=0)
{
//search forwards to the next comma or end of string
for (i=0; s[i] != ',' && s[i] != 0; i++) ;
//compare it to the model name
if (!strncmp(mod->name, s, i))
{
mod->flags |= MOD_NOLERP;
break;
}
}
// noshadow flag (TODO: make this a cvar list)
if (!strcmp (mod->name, "progs/flame2.mdl") ||
!strcmp (mod->name, "progs/flame.mdl") ||
!strcmp (mod->name, "progs/bolt1.mdl") ||
!strcmp (mod->name, "progs/bolt2.mdl") ||
!strcmp (mod->name, "progs/bolt3.mdl") ||
!strcmp (mod->name, "progs/laser.mdl"))
mod->flags |= MOD_NOSHADOW;
// fullbright hack (TODO: make this a cvar list)
if (!strcmp (mod->name, "progs/flame2.mdl") ||
!strcmp (mod->name, "progs/flame.mdl") ||
!strcmp (mod->name, "progs/boss.mdl"))
mod->flags |= MOD_FBRIGHTHACK;
}
Context: glmodel.c
- Code: Select all
/*
=================
Mod_LoadAliasModel
=================
*/
void Mod_LoadAliasModel (model_t *mod, void *buffer)
{
.
.
.
//
// load the frames
//
posenum = 0;
pframetype = (daliasframetype_t *)&pintriangles[pheader->numtris];
for (i=0 ; i<numframes ; i++)
{
aliasframetype_t frametype;
frametype = LittleLong (pframetype->type);
if (frametype == ALIAS_SINGLE)
pframetype = (daliasframetype_t *) Mod_LoadAliasFrame (pframetype + 1, &pheader->frames[i]);
else
pframetype = (daliasframetype_t *) Mod_LoadAliasGroup (pframetype + 1, &pheader->frames[i]);
}
pheader->numposes = posenum;
mod->type = mod_alias;
Mod_SetExtraFlags (mod); //johnfitz
Mod_CalcAliasBounds (pheader); //johnfitz
//
// build the draw lists
//
GL_MakeAliasModelDisplayLists (mod, pheader);
.
.
.
.
And gl_rmisc.c
- Code: Select all
/*
===============
R_NoLerpList_f -- johnfitz -- called when r_nolerp_list cvar changes
===============
*/
void R_NoLerpList_f (void)
{
int i;
for (i=0; i < MAX_MODELS; i++)
Mod_SetExtraFlags (cl.model_precache[i]);
}
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
15 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest