[nexuiz-commits] r7044 - in trunk/data: . models/sprites qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Jun 15 15:32:07 EDT 2009


Author: mrbougo
Date: 2009-06-15 15:32:06 -0400 (Mon, 15 Jun 2009)
New Revision: 7044

Added:
   trunk/data/models/sprites/nb-ball.png
   trunk/data/models/sprites/nb-ball.sp2
   trunk/data/models/sprites/nb-ball.svg
   trunk/data/models/sprites/nb-ball.tga
Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/models/sprites/make-sprites.sh
   trunk/data/qcsrc/server/nexball.qc
Log:
nexball changes: tweak bounciness using the new DP extension, add waypoint sprites, and radar support

Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2009-06-15 15:14:51 UTC (rev 7043)
+++ trunk/data/defaultNexuiz.cfg	2009-06-15 19:32:06 UTC (rev 7044)
@@ -689,6 +689,10 @@
 //     The 1st Rev boost is always horizontal
 //     The 2nd Rev boost is always vertical
 set g_nexball_football_physics  2  "0: Revenant's original movement, 1: 0 but half independant of aiming height, 2: 1 fully independant, -1: first recode try"
+set g_nexball_basketball_bouncefactor 0.6    "velocity loss when the ball bounces"
+set g_nexball_basketball_bouncestop   0.075  "speed at which the ball stops when it hits the ground (multiplied by sv_gravity)"
+set g_nexball_football_bouncefactor   0.6    "velocity loss when the ball bounces"
+set g_nexball_football_bouncestop     0.075  "speed at which the ball stops when it hits the ground (multiplied by sv_gravity)"
 
 set g_nexball_football_boost_forward      100   "forward velocity boost when the ball is touched"
 set g_nexball_football_boost_up           200   "vertical velocity boost when the ball is touched"

Modified: trunk/data/models/sprites/make-sprites.sh
===================================================================
--- trunk/data/models/sprites/make-sprites.sh	2009-06-15 15:14:51 UTC (rev 7043)
+++ trunk/data/models/sprites/make-sprites.sh	2009-06-15 19:32:06 UTC (rev 7044)
@@ -169,6 +169,7 @@
 sprite ons-cp-dfnd-blue   "CONTROL POINT" 0000ff 000000 0.5 0000ff ffffff 0.5
 sprite race-checkpoint    "CHECKPOINT"    ff8000 000000 0.0
 sprite race-finish        "FINISH"        ff8000 000000 0.0
+sprite nb-ball            "BALL"          e8d8a0 000000 0.0
 
 sprite wpn-laser          "LASER"         ff8080 000000 0.0 # bright red
 sprite wpn-shotgun        "SG"            804000 000000 0.0 # brown

Added: trunk/data/models/sprites/nb-ball.png
===================================================================
(Binary files differ)


Property changes on: trunk/data/models/sprites/nb-ball.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/models/sprites/nb-ball.sp2
===================================================================
(Binary files differ)


Property changes on: trunk/data/models/sprites/nb-ball.sp2
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/models/sprites/nb-ball.svg
===================================================================
--- trunk/data/models/sprites/nb-ball.svg	                        (rev 0)
+++ trunk/data/models/sprites/nb-ball.svg	2009-06-15 19:32:06 UTC (rev 7044)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="512"
+   height="128"
+   id="svg2"
+   sodipodi:version="0.32"
+   inkscape:version="0.45"
+   version="1.0"
+   inkscape:export-filename="bluebase.tga"
+   inkscape:export-xdpi="90"
+   inkscape:export-ydpi="90"
+   sodipodi:docname="template.svg"
+   sodipodi:docbase="/home/rpolzer/software/games/nexuiz/data/models/sprites"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   sodipodi:modified="true">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#000000"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     gridtolerance="10000"
+     guidetolerance="10"
+     objecttolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="0.98994949"
+     inkscape:cx="375"
+     inkscape:cy="75.53288"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     width="512px"
+     height="128px"
+     showgrid="true"
+     gridspacingx="8px"
+     gridspacingy="8px"
+     gridempspacing="8"
+     inkscape:grid-points="true"
+     showguides="true"
+     inkscape:guide-bbox="true"
+     inkscape:window-width="849"
+     inkscape:window-height="590"
+     inkscape:window-x="198"
+     inkscape:window-y="66" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <path
+       style="opacity:1;fill:#e8d8a0;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.75294119"
+       d="M 256,126 L 280,102 L 264,102 L 264,62 L 248,62 L 248,102 L 232,102 L 256,126 z "
+       id="path1872"
+       sodipodi:nodetypes="cccccccc" />
+    <text
+       xml:space="preserve"
+       style="font-size:56px;font-weight:bold;text-align:center;text-anchor:middle;opacity:1;fill:#e8d8a0;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.75294118"
+       x="255.49414"
+       y="49.957031"
+       id="text1874"><tspan
+         sodipodi:role="line"
+         id="tspan1876"
+         x="255.49414"
+         y="49.957031">BALL</tspan></text>
+  </g>
+</svg>

Added: trunk/data/models/sprites/nb-ball.tga
===================================================================
(Binary files differ)


Property changes on: trunk/data/models/sprites/nb-ball.tga
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/data/qcsrc/server/nexball.qc
===================================================================
--- trunk/data/qcsrc/server/nexball.qc	2009-06-15 15:14:51 UTC (rev 7043)
+++ trunk/data/qcsrc/server/nexball.qc	2009-06-15 19:32:06 UTC (rev 7044)
@@ -3,6 +3,7 @@
 #define BALL_MINS '-16 -16 -16'  // The model is 24*24*24
 #define BALL_MAXS '16 16 16'
 #define BALL_ATTACHORG '3 0 16'
+#define BALL_SPRITECOLOR '.91 .85 .62'
 #define BALL_FOOT   1
 #define BALL_BASKET 2
 //spawnflags
@@ -114,11 +115,55 @@
 	ownr.flags &~= FL_ONGROUND;
 }
 
+void GiveBall (entity plyr, entity ball)
+{
+	local entity ownr;
+
+	if ((ownr = ball.owner))
+	{
+		ownr.effects &~= g_nexball_basketball_effects_default;
+		ownr.ballcarried = world;
+		if (ownr.metertime)
+		{
+			ownr.metertime = 0;
+			ownr.weaponentity.state = WS_READY;
+		}
+	}
+
+	setattachment(ball, plyr, "");
+	setorigin(ball, BALL_ATTACHORG);
+
+	if (ball.team != plyr.team)
+		ball.teamtime = time + g_nexball_basketball_delay_hold_forteam;
+
+	ball.owner = ball.pusher = plyr; //"owner" is set to the player carrying, "pusher" to the last player who touched it
+	ball.team = plyr.team;
+	plyr.ballcarried = ball;
+	ball.dropperid = plyr.playerid;
+
+	plyr.effects |= g_nexball_basketball_effects_default;
+	ball.effects &~= g_nexball_basketball_effects_default;
+
+	ball.velocity = '0 0 0';
+	ball.movetype = MOVETYPE_NONE;
+	ball.touch = SUB_Null;
+	ball.effects |= EF_NOSHADOW;
+	ball.scale = 1; // scale down.
+
+	ball.waypointsprite_attachedforcarrier.exteriormodeltoclient = plyr;
+
+	if (g_nexball_basketball_delay_hold)
+	{
+		ball.think = DropOwner;
+		ball.nextthink = time + g_nexball_basketball_delay_hold;
+	}
+}
+
 void DropBall (entity ball, vector org, vector vel)
 {
 	ball.effects |= g_nexball_basketball_effects_default;
 	ball.effects &~= EF_NOSHADOW;
-	ball.owner.effects &~= g_nexball_basketball_effects_default; // this may be problematic.
+	ball.owner.effects &~= g_nexball_basketball_effects_default;
 
 	setattachment(ball, world, "");
 	setorigin (ball, org);
@@ -137,6 +182,8 @@
 		ball.owner.weaponentity.state = WS_READY;
 	}
 
+	ball.waypointsprite_attachedforcarrier.exteriormodeltoclient = world;
+
 	ball.owner.ballcarried = world;
 	ball.owner = world;
 }
@@ -157,6 +204,7 @@
 	self.pusher = world;
 	self.team = FALSE;
 	sound (self, CHAN_PROJECTILE, self.noise1, VOL_BASE, ATTN_NORM);
+	WaypointSprite_Ping(self.waypointsprite_attachedforcarrier);
 	LogNB("init", world);
 }
 
@@ -239,28 +287,7 @@
 		if (other.health <= 0)
 			return;
 		LogNB("caught", other);
-
-		if (self.team != other.team)
-			self.teamtime = time + g_nexball_basketball_delay_hold_forteam;
-
-		self.owner = self.pusher = other; //"owner" is set to the player carrying, "pusher" to the last player who touched it
-		self.team = other.team;
-		other.ballcarried = self;
-		other.effects = other.effects | g_nexball_basketball_effects_default;
-		self.effects &~= g_nexball_basketball_effects_default;
-		self.effects |= EF_NOSHADOW;
-		self.scale = 1; // scale down.
-		self.dropperid = other.playerid;
-		setattachment(self, other, "");
-		setorigin(self, BALL_ATTACHORG);
-		self.velocity = '0 0 0';
-		self.movetype = MOVETYPE_NONE;
-		self.touch = SUB_Null;
-		if (g_nexball_basketball_delay_hold)
-		{
-			self.think = DropOwner;
-			self.nextthink = time + g_nexball_basketball_delay_hold;
-		}
+		GiveBall(other, self);
 	} else if (other.solid == SOLID_BSP) {
 		sound (self, CHAN_PROJECTILE, self.noise, VOL_BASE, ATTN_NORM);
 		if (vlen(self.velocity) && !self.cnt)
@@ -325,6 +352,9 @@
 
 	if (ball.owner) // Happens on spawnflag GOAL_TOUCHPLAYER
 		DropBall(ball, ball.owner.origin, ball.owner.velocity);
+
+	WaypointSprite_Ping(ball.waypointsprite_attachedforcarrier);
+
 	ball.cnt = 1;
 	ball.think = ResetBall;
 	if (ball.classname == "nexball_basketball")
@@ -384,6 +414,8 @@
 {
 	if(!g_nexball) { remove(self); return; }
 
+//	balls += 4; // using the remaining bits to count balls will leave more than the max edict count, so it's fine
+
 	if (!self.model) {
 		self.model = "models/nexball/ball.md3";
 		self.scale = 1.3;
@@ -422,6 +454,9 @@
 	precache_sound (self.noise1);
 	precache_sound (self.noise2);
 
+	WaypointSprite_AttachCarrier("nb-ball", self); // the ball's team is not set yet, no rule update needed
+	WaypointSprite_UpdateTeamRadar(self.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, BALL_SPRITECOLOR);
+
 	self.reset = ball_restart;
 	self.think = InitBall;
 	self.nextthink = game_starttime + cvar("g_nexball_delay_start");
@@ -442,6 +477,8 @@
 		self.effects = g_nexball_basketball_effects_default;
 	self.solid = SOLID_TRIGGER;
 	balls |= BALL_BASKET;
+	self.bouncefactor = cvar("g_nexball_basketball_bouncefactor");
+	self.bouncestop = cvar("g_nexball_basketball_bouncestop");
 	SpawnBall();
 }
 
@@ -450,6 +487,8 @@
 	self.classname = "nexball_football";
 	self.solid = SOLID_TRIGGER;
 	balls |= BALL_FOOT;
+	self.bouncefactor = cvar("g_nexball_football_bouncefactor");
+	self.bouncestop = cvar("g_nexball_football_bouncestop");
 	SpawnBall();
 }
 
@@ -531,31 +570,6 @@
 		other.flags &~= FL_ONGROUND;
 		if(!attacker.ballcarried)
 		{
-			other.effects &~= g_nexball_basketball_effects_default;
-			other.ballcarried = world;
-
-			if (g_nexball_basketball_delay_hold)
-			{
-				ball.think = DropOwner;
-				ball.nextthink = time + g_nexball_basketball_delay_hold;
-			}
-
-			attacker.effects = attacker.effects | g_nexball_basketball_effects_default;
-			attacker.ballcarried = ball;
-			if (other.metertime)
-			{
-				other.metertime = 0;
-				other.weaponentity.state = WS_READY;
-			}
-
-			setattachment(ball, attacker, "");
-			ball.owner = ball.pusher = attacker;
-			ball.team = attacker.team;
-			ball.dropperid = attacker.playerid;
-
-			if (other.team != attacker.team)
-				ball.teamtime = time + g_nexball_basketball_delay_hold_forteam;
-
 			LogNB("stole", attacker);
 			sound (other, CHAN_AUTO, ball.noise2, VOL_BASE, ATTN_NORM);
 
@@ -565,6 +579,8 @@
 				attacker.teamkill_soundtime = time + 0.4;
 				attacker.teamkill_soundsource = other;
 			}
+
+			GiveBall(attacker, other.ballcarried);
 		}
 	}
 	remove(self);



More information about the nexuiz-commits mailing list