Module lhfire: Change committed

havoc at icculus.org havoc at icculus.org
Tue Jun 10 17:07:39 EDT 2003


Commiter   : havoc
CVSROOT    : /cvs/cvsroot/twilight
Module     : lhfire
Commit time: 2003-06-10 21:07:39 UTC

Log message:

added spritetype command to allow making sprite types other than vp_parallel (thanks to Gilgamesh for requesting this)
documented spritetype
documented worldbox

Modified files:
     framebuffer.c script.c scriptinginfo.txt

------=MIME.9e983f0c769cd6fe1ee4f782b69c4946
Content-Type: text/plain; name="lhfire.20030610.210739.havoc.diff"
Content-Disposition: attachment; filename="lhfire.20030610.210739.havoc.diff"
Content-Transfer-Encoding: 8bit

Index: lhfire/framebuffer.c
diff -u lhfire/framebuffer.c:1.1.1.1 lhfire/framebuffer.c:1.2
--- lhfire/framebuffer.c:1.1.1.1	Wed Jul 17 21:30:19 2002
+++ lhfire/framebuffer.c	Tue Jun 10 17:07:29 2003
@@ -15,6 +15,7 @@
 char *outputname; // setup by script.c
 
 extern float imagebrightness_min, imagebrightness_max;
+extern int spritetype;
 
 void framebuffer_free()
 {
@@ -220,11 +221,6 @@
 
 int spriteinitialized;
 
-#define SPR_VP_PARALLEL_UPRIGHT		0
-#define SPR_FACING_UPRIGHT			1
-#define SPR_VP_PARALLEL				2
-#define SPR_ORIENTED				3
-#define SPR_VP_PARALLEL_ORIENTED	4
 // frame types
 #define SPR_SINGLE					0
 #define SPR_GROUP					1
@@ -312,7 +308,7 @@
 				fput_littleint(32, file); // 32bit color
 			else
 				fput_littleint(1, file); // version
-			fput_littleint(SPR_VP_PARALLEL, file); // type
+			fput_littleint(spritetype, file); // type
 			fput_littlefloat((float) sqrt((FBWidth*0.5)*(FBWidth*0.5)+(FBHeight*0.5)*(FBHeight*0.5)), file); // boundingradius
 			fput_littleint(FBWidth, file); // width
 			fput_littleint(FBHeight, file); // height
Index: lhfire/script.c
diff -u lhfire/script.c:1.1.1.1 lhfire/script.c:1.2
--- lhfire/script.c:1.1.1.1	Wed Jul 17 21:30:22 2002
+++ lhfire/script.c	Tue Jun 10 17:07:29 2003
@@ -24,6 +24,7 @@
 int script_init; // render and frames do nothing unless this is set
 int script_commandcounter; // used to detect runaway loops
 
+int spritetype;
 int rendertype;
 float camera_x, camera_y, camera_z;
 float color1_r, color1_g, color1_b, color1_a;
@@ -749,6 +750,31 @@
 		printf("worldbox: wrong parameter types.  usage: worldbox minx miny minz maxx maxy maxz\n");
 }
 
+void sc_spritetype(int t)
+{
+	if (scwantstring(t+1))
+	{
+		script_token = t + 2;
+		if (!strcmp(token[t+1], "vp_parallel_upright"))
+			spritetype = 0;
+		else if (!strcmp(token[t+1], "facing_upright"))
+			spritetype = 1;
+		else if (!strcmp(token[t+1], "vp_parallel"))
+			spritetype = 2;
+		else if (!strcmp(token[t+1], "oriented"))
+			spritetype = 3;
+		else if (!strcmp(token[t+1], "vp_parallel_oriented"))
+			spritetype = 4;
+		else
+		{
+			printf("spritetype: unknown sprite type \"%s\" (valid sprite types: vp_parallel_upright facing_upright vp_parallel oriented vp_parallel_oriented)\n", token[t+1]);
+			spritetype = 2;
+		}
+	}
+	else
+		printf("spritetype: wrong parameter types.  usage: spritetype value (valid sprite types: vp_parallel_upright facing_upright vp_parallel oriented vp_parallel_oriented)\n");
+}
+
 void script_execute(int t)
 {
 //	printf("%s\n", token[t]);
@@ -781,6 +807,7 @@
 	else if (!strcmp(token[t], "rendertype")) sc_rendertype(t);
 	else if (!strcmp(token[t], "imagebrightness")) sc_imagebrightness(t);
 	else if (!strcmp(token[t], "worldbox")) sc_worldbox(t);
+	else if (!strcmp(token[t], "spritetype")) sc_spritetype(t);
 	else
 	{
 		script_time = script_endtime;
@@ -806,9 +833,10 @@
 // this merely finds the render and frames commands and interprets them
 int script_setup()
 {
+	spritetype = 2;
 	rendertype = 0;
 	camera_x = 0.0f;camera_y = 0.0f;camera_z = -128.0f;
-	color1_r = color2_r = 256.0f;color2_g = color2_g = 256.0f;color1_b = color2_b = 256.0f;color1_a = color2_a = 256.0f;
+	color1_r = color2_r = 256.0f;color1_g = color2_g = 256.0f;color1_b = color2_b = 256.0f;color1_a = color2_a = 256.0f;
 	minlife = 0.0f;maxlife = 1.0f;
 	minsize = 0.0f;maxsize = 1.0f;
 	area_x = 0.0f;area_y = 0.0f;area_z = 0.0f;area_minradius = 0.0f;area_maxradius = 16.0f;
@@ -880,5 +908,5 @@
 			break;
 		}
 	}
-//	printf("script done\n"); 
+//	printf("script done\n");
 }
Index: lhfire/scriptinginfo.txt
diff -u lhfire/scriptinginfo.txt:1.1.1.1 lhfire/scriptinginfo.txt:1.2
--- lhfire/scriptinginfo.txt:1.1.1.1	Wed Jul 17 21:30:22 2002
+++ lhfire/scriptinginfo.txt	Tue Jun 10 17:07:29 2003
@@ -11,6 +11,8 @@
 passes motionblurquality
 (not required) sets the number of rendering passes per frame, 4 or more is needed for smooth motion
 
+spritetype value
+(not required) sets the type of sprite to create, can be vp_parallel_upright, facing_upright, vp_parallel, oriented, or vp_parallel_oriented (default: vp_parallel  note that glquake only supports vp_parallel (explosion for example) and oriented (bullet holes on walls for example), darkplaces and software quake support all types)
 
 
 (all commands below this point are normal script commands and can be used at any time
@@ -26,7 +28,10 @@
 airfriction value
 sets the air friction of the scene, affecting all particles with a mass > 0, this is a deceleration, experiment to see how to use it, 1.0 airfriction * 1.0 mass means the particle will mostly stop moving after 1.0 units of time
 
+worldbox minx miny minz maxx maxy maxz
+defines a box that the particle simulation takes place in, particles will bounce off the sides of this box (losing no energy), this can be useful for some effects.
 
+
 (control commands for looping and such)
 label name
 sets a label in the script, this can be jumped to by goto, tell me if you need gosub or anything else more advanced (loops for example)
@@ -84,7 +89,11 @@
 spawn numberofparticles
 spawns the specified number of particles using the current settings
 
+boxspawn xparticles yparticles zparticles minx miny minz maxx maxy maxz
+creates a regular grid of particles (number of particles on each axis is controlled by <xyz>particles parameters) inside the specified box (min to max)
+
 clear
 destroys all particles instantly, mainly useful if you wish to render multiple scenes with one script
 
 if any other commands are desired, let me know.
+


More information about the twilight-commits mailing list