From: Seth G. <sga...@li...> - 2002-01-16 03:04:04
|
I have implemented loading tga textures for sprites, gfx.wad images, .lmp files, and textures from bsp files. The last type were trickiest because you have to load the tga files after the whole bsp file is loaded, since both LoatTGA and the bsp file loader use Hunk_TempAlloc. Actually the implementation of tga texture loading for bsp files is quite simple. Just look at the Mod_LoadExternalTextures function. Alias model (.mdl) skins will probably need something similar (Mod_LoadExternalSkins?) and I think sprites need it too - it's probably just dumb luck that it didn't crash my single frame sprite test case. I'm a little confused about how to get the sprite and alias model (.spr and .mdl) file names, skin/frame names and gl_texnums (i.e. the info I need to load the tga textures) from the model_t *mod in Mod_RealLoadModel. If I knew how to do that, I could fix up sprites and implement tga skins pretty easily. Of course some folks will see tga textures as an obvious cheat (though your textures are in a pak file it is less obvious.) It has been suggested that checksums might discourage the casual cheater. I'm not able to implement something like that, but I don't think I've done anything that would make it particularly difficult to add. It's also been suggested that generating external texture names by slapping ".tga" on the end is a bit sloppy. I suppose the way to avoid that is a bit different for each case. I think textures should be in standard image formats where possible (i.e: .tga, .pcx or .png) with a 256 color fallback option if needed for 8 bit software rendering. I know standard image formats help casual cheaters, but they also lubricate the art path and to me that's a lot more important (there are lots of cheaters but not many artists.) I also understand that external textures don't fit everybody's idea of a nice map, sprite or model format. But I think it is actually better than putting the textures in the model/map/sprite file because the textures can be re-used in different models/map/sprites. So, what I would suggest is making the image loading part of the client side QC code, so for example the csQC would say something like "try to use gfx/conback.tga for the console background, then fall back to gfx/conback.pcx if that doesn't work" - not in plain english of course. This way you wouldn't get any weird results if somebody does something silly like trying to use a 32 bit tga for the non-image .lmp files. (Did I mention that it would also be nice to be able to draw 3D objects in menus and HUDs?) __ __ _ _ __ __ _/ \__/ \__/ Seth Galbraith "The Serpent Lord" \__/ \__/ \_ \__/ \__/ \_ sga...@kr... #2244199 on ICQ _/ \__/ \__/ _/ \__/ \__/ http://www.planetquake.com/gg \__/ \__/ \_ |