Saturday, December 27, 2008

External textures!

While playing around with the save/load menu, I started adding mapshots to it. It began with writing-only code to just display the console image and get positioning right, then I had a look at D3DXCreateTextureFromFileInMemoryEx and thought about reading mapshots, so I wrote a simple loader for them, and realised I had an external texture loader ready to roll.

So the next one will have external texture support for BSPs and possibly a few other things. I haven't fine-tuned support for a lot of the custom wacko stuff Quake does, but that's going to be coming in the one after (I've enough to be doing to finish this one!)



That's sourced from a TGA screenshot, by the way. It's annoyed me a little (as you'll see from some of the comments in my code) that the D3DX library contains support for reading TGAs but not for writing them, so I wrote my own writer. Throw it a filepath and a LPDIRECT3DSURFACE9 and it will spit out a TGA.

While doing that I fell prey to "wouldn't it be cool if..." and quickly added a cvar to allow the user to select different screenshot formats; tga/bmp/dds/png/jpg (scr_screenshotformat, default TGA).

What else? Well, here's the latest batch of updates:

  • Replaced gl_warp_sin.h with internally generated sin table.
  • Finished render to texture for water surfs (we lose a few frames here but the improvement is worth it).
  • Expanded BSP light data to 3 component.
  • Removed interpolation from muzzleflashes on viewmodels.
  • Moved keybindings menu to framework.
  • Fixed FPS loss with render to texture.
  • Finished Multiplayer Setup Menu.
  • Switched cvars to static storage of name and string (code simplification).
  • Added more generally usable "Draw_TextBox" routine.
  • Fixed bug in Save/Load menu where this->CurrentOption == NULL would crash on an unhandled key.
  • Added sound/cdtracks as an optional music directory (first preference, fallback on music if not present).
  • Allowed spaces or non-alphanumeric characters in save/load names.
  • Added detection of invalid windows filename chars in save/load names.
  • Added con_lineheight cvar to control height of console lines (default 8, same as classic Quake).
  • Added external texture loader (not linked in to internal loader yet).
  • Added mapshot drawing system.
  • Added external BSP texture support: link, dds, tga, bmp, png and jpg formats supported.
  • Adjusted default vid_gamma to 1.0 (consistency between external and native textures).
  • Added scr_screenshotformat cvar (default tga), supports tga, bmp, png, jpg and dds.

The list doesn't really reflect it, but I resolved a major sticking point I had with menus, namely how to read back values of modified string cvars from textboxes. While cleaning up the class structure I had made this a little too private, and didn't really want to go back, nor did I want to allow in-place editing of string cvars (if nothing else, broadcast prints for name changes would break). Now I just copy the original cvar to a dummy cvar, edit that in-place, then write back and/or do whatever needs to be done in an "Apply" custom menu function. It's a hack, but so far it works very well.

I might miss my objective of a release before the new year, but it won't be too long after it (think in days rather than anything else).

0 comments: