[Gtkradiant] [Bug 574] Add spritemodel support to all games, not just Halflife

gtkradiant@zerowing.idsoftware.com gtkradiant@zerowing.idsoftware.com
Mon, 10 Mar 2003 15:00:51 -0600


------- Additional Comments From mailinglist.gtkradiant@hydras-world.com  2003-03-10 15:00 -------
Here's the current todo list for the spritemodel module

* make sprites always face the camera (is this done in camwindow.cpp ?)
  but only if the entity model doesn't have "angle" keys.  At the moment
  it's better to rotate the model with the angles.

* maybe add an option to scale the sprites in the prefs?

* maybe convert to a new kind of class not based on model?

* allow sprites on non-fixedsize ents

* fix reversed alpha map in spr loader (in imagehl)
  -> is this actually broken?

* allow an entity to have multiple models (e.g .md3 and a sprite model)
  and allow the user to toggle either models on or off.

* dynamically add the api's depending on what image loading modules are 
supported by radiant.  Currently, we hard code to the list 
in "supportedmodelformats" (see below) but, all these extensions are stripped 
when the actual image is loaded.current the bit of code that decided what model 
api to use needs reworking as it decides by looking at the extension of the 
model name, when in fact we don't even need an extension.

Previously the code fell though to use this model as the default model plugin, 
but that also has issues.

What this means is, in the .def files you must specify an image filename that 
has one of the extensions listed below, but in actual fact radiant will use any 
available image module to load the image.

e.g. you could use a model name of "sprites/target_speaker.tga" and have a file 
called sprites/target_speaker.png and it would be correctly loaded even if it 
not listed below in "supportedmodelformats".

So, currently in the .def files you can just use the 
name "sprites/target_speaker.spr" and it will load the file 
from "sprites/target_speaker.*" which is what I propose anyone creating image 
sets for Q3/Wolf/etc does.

Here's the current definition of "supportedmodelformats"
char *supportedmodelformats[] = {"spr","bmp","tga","jpg","hlw",NULL}; // NULL 
is list delimiter

Here's an example of a quake3 entity definition with a sprite model
	/*QUAKED target_speaker (0 .7 .7) (-8 -8 -8) (8 8 8) LOOPED_ON 
	Sound generating entity that plays .wav files. Normal non-looping 
sounds play each time the target_speaker is triggered. Looping sounds can be 
set to play by themselves (no activating trigger) or be toggled on/off by a 
	-------- KEYS --------
	noise : path/name of .wav file to play (eg. sound/world/growl1.wav - 
see Notes).
	wait : delay in seconds between each time the sound is played ("random" 
key must be set - see Notes).
	random : random time variance in seconds added or subtracted 
from "wait" delay ("wait" key must be set - see Notes).
	targetname : the activating button or trigger points to this.
	notfree : when set to 1, entity will not spawn in "Free for all" 
and "Tournament" modes.
	notteam : when set to 1, entity will not spawn in "Teamplay" and "CTF" 
	notsingle : when set to 1, entity will not spawn in Single Player mode 
(bot play mode).
	-------- SPAWNFLAGS --------
	LOOPED_ON : sound will loop and initially start on in level (will 
toggle on/off when triggered).
	LOOPED_OFF : sound will loop and initially start off in level (will 
toggle on/off when triggered).
	GLOBAL : sound will play full volume throughout the level.
	ACTIVATOR : sound will play only for the player that activated the 
	-------- NOTES --------
	The path portion value of the "noise" key can be replaced by the 
implicit folder character "*" for triggered sounds that belong to a particular 
player model. For example, if you want to create a "bottomless pit" in which 
the player screams and dies when he falls into, you would place a 
trigger_multiple over the floor of the pit and target a target_speaker with it. 
Then, you would set the "noise" key to "*falling1.wav". The * character means 
the current player model's sound folder. So if your current player model is 
Visor, * = sound/player/visor, if your current player model is Sarge, * = 
sound/player/sarge, etc. This cool feature provides an excellent way to 
create "player-specific" triggered sounds in your levels.
	The combination of the "wait" and "random" keys can be used to play non-
looping sounds without requiring an activating trigger but both keys must be 
used together. The value of the "random" key is used to calculate a minimum and 
a maximum delay. The final time delay will be a random value anywhere between 
the minimum and maximum values: (min delay = wait - random) (max delay = wait + 

Note the last two lines.

All sprite files should be saved as <enginepath>/sprites/<entity_name>.spr

You can create a vfs file with them all in.  e.g for q3 you might 
create "sprites-hydra.pk3" in which you might have the following files:



For quake3, add this section to the synapse.config

  <client name="sprite">
    <api name="shaders">
    <api name="VFS">

Updated patch in a few minutes...