Initially, I was going to approach engine internal variables from a fixed structure with different parts (video, opengl, console, etc.)
The only problem with this is that it will break modular design. In truth, I might want to take the console or some other piece of an engine and use it in another project that doesn't resemble Quake. I have the shell of the engine largely in one source file, which I've been splitting up a bit (mostly I had to take it apart to see what it does in detail).
Anyway, I've concluded the best way to keep modular design (i.e. console.c doesn't depend much on anything else and likewise the other pieces like video don't depend on anything else ... is to structure, say, the console to use a single structure and then pass that pointer back in the initialization, using that to hook it into the global structure.
Video Shutdown Notes .. OpenGL Vs. MH's Wrapper
Throw all the common OpenGL functions into an array and slightly rename the D3D wrapper functions and likewise throw them into an array. Create qGLfunctions and wire them up as appropriate.
MH's wrapper doesn't always immediately "wakeup", you have to kick it into action if you aren't actually binding a texture.
Video Modes
Width, height, bpp, refresh rates, aspect ratio, color depth, desktop color depth (can't do 32 bpp window if someone is using 16 bpp desktop) ... although bpp switching is a bit overrated these days. MH is dropping 16 bit support, for example. Hard to find a 16 bpp desktop. Going to let dual monitor support live in the command line as a cheaty hack. First, I don't want the headache of trying to figure out how to modify the D3D wrapper to support it. Second, with OpenGL, I don't think very many display setups really support it well.
Key Dest
Key destination in Quake is largely ... [game, menu, console, message] with the oddball state of conforcedup (console forced up because no game is going on). I'm in the headache of trying to figure out when the console being forced up is going to be temporary (in between demos in a multiple demo loop, in the period between maps particular when connected to a server) versus, say, a silent disconnect or QuakeC error. Now much of that is solved with the loading plaque, but also not quite. Plus if you allows demos to play and continue to the next one while the menu is up, it adds a bit of extra weirdness because you can't just simply assume exiting the menu will really take you back to "the game".
V_Renderview
In Quake is setup a bit stupid, at least for OpenGL. For software, it makes sense. But you have a part where it will immediately exit if the console is forced up, but calculate the view blends and then if the client isn't connected, bail. For software, I guess it is important to calculate the view blends when no map is running to reset the blends. For OpenGL, there is no reason to do that, just don't apply them.
A list of things about a map
Map bsp name: dm6
Map title: "The Dark Place"
Skill level: don't use the skill cvar, that could change. Use skill level
Maxplayers, deathmatch, coop, client state (connected, dedicated, etc) and server state (sv.active? Yes = single player or host, no = pure client)
Protocol
Entities count
Monsters (killed + total)
Secrets (killed + total)
Time in the level
Textures used (plus their names), # lightmaps, gamedir, sv_progs, world min/maxes
Models used (usually reliable), sounds used (unrelable?)
Date
Using external ents?
Other ...
Why don't any engine display the common commands when you press F1 (provided the gamedir is id1) and instead make you use the internets for that.
Frikbots
Thinking of the best and least hacky way for an engine to cause a certain number of bots to automatically connect. Maybe setting up a fake timer entity in QuakeC that fires 10 seconds into a game and counts the bots. That is actually a QuakeC solution and my QuakeC sucks, but still that is probably the least silly way. And I guess the least silly way is to use a cvar to tell the QuakeC how many bots are desired.
Gamedir changing
You can't trust cached models or sounds if the gamedir changes. They may not longer be valid. DarkPlaces actually takes that even further and essentially shuts down the engine and reads quake.rc and all that jazz. Which is the "right" way to do it. Except that is putting a lot of faith in mods being designed right and most of them really aren't. Warpspasm for example as I understand it tries to execute the config in id1 in possibly the autoexec.cfg. Sidestepping the issue that there is no standardized mod packaging ... like the foldername doesn't necessarily tell you anything about the mod. Too bad there wasn't a Spirit organizing stuff back n 1997, all that could have been avoided and standardized back then.
Depth Testing
The "keep the view model from poking into the wall" thing is an interesting piece of code. You always want the view model to show in the entirety. Part of me wonders why not clear the depth buffer there, it is the last step of 3D rendering anyways.
Still, I am wondering what the thought behind that code in that part is. It sets gldepthmax to some calculation that I'm not sure always works for all view models and gun placement settings (or maybe it does) that you might add in (gun positioning stuff, like r_viewmodelsize, to add or remove the gun placement hack or even side placement code that doesn't really fit since the projectiles don't come from there.
/Sure an unfocused post with a few different topics
The "keep the view model from poking into the wall" thing is an interesting piece of code. You always want the view model to show in the entirety. Part of me wonders why not clear the depth buffer there, it is the last step of 3D rendering anyways.
Still, I am wondering what the thought behind that code in that part is. It sets gldepthmax to some calculation that I'm not sure always works for all view models and gun placement settings (or maybe it does) that you might add in (gun positioning stuff, like r_viewmodelsize, to add or remove the gun placement hack or even side placement code that doesn't really fit since the projectiles don't come from there.
csqctest
I found myself looking at Spike's CSQC test code again since I was curious about the displaying of Quake .mdl in the HUD and the csqctest puts md3 in the hud from Open Arena.
After you play with the model drawing code a bit and viewports and such, you can pretty much draw models anywhere you want. I'm still not quite sure the "best" way to do this in a 2D setting to get the scaling right.
/Sure an unfocused post with a few different topics