[nexuiz-commits] r7158 - in trunk/data: models/sprites qcsrc/client qcsrc/server scripts
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Jul 8 11:09:03 EDT 2009
Author: div0
Date: 2009-07-08 11:09:02 -0400 (Wed, 08 Jul 2009)
New Revision: 7158
Added:
trunk/data/models/sprites/race-start_frame0.tga
Modified:
trunk/data/models/sprites/make-sprites.sh
trunk/data/qcsrc/client/Main.qc
trunk/data/qcsrc/client/sbar.qc
trunk/data/qcsrc/server/race.qc
trunk/data/qcsrc/server/t_teleporters.qc
trunk/data/scripts/entities.def
Log:
race: checkpoints with spawnflag FINISH are now a separate finish CP
teleport: fix typo
Modified: trunk/data/models/sprites/make-sprites.sh
===================================================================
--- trunk/data/models/sprites/make-sprites.sh 2009-07-08 13:25:07 UTC (rev 7157)
+++ trunk/data/models/sprites/make-sprites.sh 2009-07-08 15:09:02 UTC (rev 7158)
@@ -168,6 +168,7 @@
sprite ons-cp-dfnd-blue "Control point" 0050ff 000000 0.5 0050ff ffffff 0.5
sprite race-checkpoint "Checkpoint" ff8000 000000 0.0
sprite race-finish "Finish" ff8000 000000 0.0
+sprite race-start "Start" ff8000 000000 0.0
sprite nb-ball "Ball" e8d8a0 000000 0.0
sprite wpn-laser "Laser" ff8080 000000 0.0 # bright red
Added: trunk/data/models/sprites/race-start_frame0.tga
===================================================================
(Binary files differ)
Property changes on: trunk/data/models/sprites/race-start_frame0.tga
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/data/qcsrc/client/Main.qc
===================================================================
--- trunk/data/qcsrc/client/Main.qc 2009-07-08 13:25:07 UTC (rev 7157)
+++ trunk/data/qcsrc/client/Main.qc 2009-07-08 15:09:02 UTC (rev 7158)
@@ -918,7 +918,7 @@
race_checkpointtime = time;
- if(race_checkpoint == 0)
+ if(race_checkpoint == 0 || race_checkpoint == 254)
race_laptime = time; // valid
break;
Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc 2009-07-08 13:25:07 UTC (rev 7157)
+++ trunk/data/qcsrc/client/sbar.qc 2009-07-08 15:09:02 UTC (rev 7158)
@@ -1229,7 +1229,11 @@
else
col = "^7";
- if(cp)
+ if(cp == 254)
+ cpname = "Start line";
+ else if(cp == 255)
+ cpname = "Finish line";
+ else if(cp)
cpname = strcat("Intermediate ", ftos(cp));
else
cpname = "Finish line";
@@ -1469,16 +1473,19 @@
forcetime = "";
if(a > 0) // just hit a checkpoint?
{
- if(race_time && race_previousbesttime)
- s = MakeRaceString(race_checkpoint, race_time / 10 - race_previousbesttime / 10, 0, 0, race_previousbestname);
- else
- s = MakeRaceString(race_checkpoint, 0, -1, 0, race_previousbestname);
- if(race_time)
- forcetime = mmsss(race_time);
+ if(race_checkpoint != 254)
+ {
+ if(race_time && race_previousbesttime)
+ s = MakeRaceString(race_checkpoint, race_time / 10 - race_previousbesttime / 10, 0, 0, race_previousbestname);
+ else
+ s = MakeRaceString(race_checkpoint, 0, -1, 0, race_previousbestname);
+ if(race_time)
+ forcetime = mmsss(race_time);
+ }
}
else
{
- if(race_laptime && race_nextbesttime)
+ if(race_laptime && race_nextbesttime && race_nextcheckpoint != 254)
{
a = bound(0, 2 - ((race_laptime + race_nextbesttime/10) - time), 1);
if(a > 0) // next one?
@@ -1502,7 +1509,7 @@
else
a = 1;
- if(race_laptime)
+ if(race_laptime && race_checkpoint != 255)
{
s = mmsss(10*(time - race_laptime));
drawstring(m - '16 0 0' * stringwidth(s, FALSE), s, '32 32 0', '1 1 1', sbar_alpha_fg * a, DRAWFLAG_NORMAL);
Modified: trunk/data/qcsrc/server/race.qc
===================================================================
--- trunk/data/qcsrc/server/race.qc 2009-07-08 13:25:07 UTC (rev 7157)
+++ trunk/data/qcsrc/server/race.qc 2009-07-08 15:09:02 UTC (rev 7158)
@@ -12,6 +12,7 @@
entity race_checkpoint_lastplayers[MAX_CHECKPOINTS];
float race_highest_checkpoint;
+float race_timed_checkpoint;
float race_NextCheckpoint(float f)
{
@@ -31,6 +32,22 @@
return f - 1;
}
+// encode as:
+// 0 = common start/finish
+// 254 = start
+// 255 = finish
+float race_CheckpointNetworkID(float f)
+{
+ if(race_timed_checkpoint)
+ {
+ if(f == 0)
+ return 254; // start
+ else if(f == race_timed_checkpoint)
+ return 255; // finish
+ }
+ return f;
+}
+
void race_SendNextCheckpoint(entity e, float spec)
{
float recordtime;
@@ -62,7 +79,7 @@
}
else
WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_NEXT_QUALIFYING);
- WriteByte(MSG_ONE, cp); // checkpoint the player will be at next
+ WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player will be at next
WriteShort(MSG_ONE, recordtime);
WriteString(MSG_ONE, recordholder);
});
@@ -84,7 +101,7 @@
// adding just 0.4 so it rounds down in the .5 case (matching the timer display)
if(tvalid)
- if(cp == 0) // finish line
+ if(cp == race_timed_checkpoint) // finish line
if not(e.race_completed)
{
float s;
@@ -139,7 +156,7 @@
if(race_checkpoint_recordholders[cp])
strunzone(race_checkpoint_recordholders[cp]);
race_checkpoint_recordholders[cp] = strzone(e.netname);
- if(cp == 0)
+ if(cp == race_timed_checkpoint)
{
float grecordtime;
string grecordholder;
@@ -196,7 +213,7 @@
WriteByte(MSG_ONE, SVC_TEMPENTITY);
WriteByte(MSG_ONE, TE_CSQC_RACE);
WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_QUALIFYING);
- WriteByte(MSG_ONE, cp); // checkpoint the player now is at
+ WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at
WriteShort(MSG_ONE, t); // time to that intermediate
WriteShort(MSG_ONE, recordtime); // previously best time
WriteString(MSG_ONE, recordholder); // record holder
@@ -222,7 +239,7 @@
WriteByte(MSG_ONE, SVC_TEMPENTITY);
WriteByte(MSG_ONE, TE_CSQC_RACE);
WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_RACE);
- WriteByte(MSG_ONE, cp); // checkpoint the player now is at
+ WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at
if(e == oth)
{
WriteShort(MSG_ONE, 0);
@@ -246,7 +263,7 @@
WriteByte(MSG_ONE, SVC_TEMPENTITY);
WriteByte(MSG_ONE, TE_CSQC_RACE);
WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT);
- WriteByte(MSG_ONE, cp); // checkpoint the player now is at
+ WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at
if(e == oth)
{
WriteShort(MSG_ONE, 0);
@@ -353,7 +370,7 @@
race_SendTime(other, self.race_checkpoint, time - other.race_laptime, !!other.race_laptime);
- if(!self.race_checkpoint) // finish line
+ if(!self.race_checkpoint) // start line
other.race_laptime = time;
if(g_race_qualifying)
@@ -398,7 +415,7 @@
float have_verified;
void trigger_race_checkpoint_verify()
{
- entity oldself;
+ entity oldself, cp;
float i, p;
float qual;
@@ -443,6 +460,13 @@
g_race_qualifying = qual;
+ if(race_timed_checkpoint)
+ for(cp = world; (cp = find(cp, classname, "trigger_race_checkpoint")); )
+ if(cp.race_checkpoint == 0)
+ WaypointSprite_UpdateSprites(cp.sprite, "race-start", "", "");
+ else if(cp.race_checkpoint == race_timed_checkpoint)
+ WaypointSprite_UpdateSprites(cp.sprite, "race-finish", "", "");
+
remove(self);
self = oldself;
}
@@ -475,16 +499,19 @@
self.race_checkpoint = self.cnt;
if(self.race_checkpoint > race_highest_checkpoint)
+ {
race_highest_checkpoint = self.race_checkpoint;
+ if(self.spawnflags & 8)
+ race_timed_checkpoint = self.race_checkpoint;
+ else
+ race_timed_checkpoint = 0;
+ }
if(self.race_checkpoint)
- {
WaypointSprite_SpawnFixed("race-checkpoint", o, self, sprite);
- }
else
- {
WaypointSprite_SpawnFixed("race-finish", o, self, sprite);
- }
+
self.sprite.waypointsprite_visible_for_player = race_waypointsprite_visible_for_player;
InitializeEntity(self, trigger_race_checkpoint_verify, INITPRIO_FINDTARGET);
Modified: trunk/data/qcsrc/server/t_teleporters.qc
===================================================================
--- trunk/data/qcsrc/server/t_teleporters.qc 2009-07-08 13:25:07 UTC (rev 7157)
+++ trunk/data/qcsrc/server/t_teleporters.qc 2009-07-08 15:09:02 UTC (rev 7158)
@@ -159,7 +159,7 @@
}
if(e.speed)
- if(vlen(other.velocity > e.speed)
+ if(vlen(other.velocity) > e.speed)
other.velocity = normalize(other.velocity) * max(0, e.speed);
TeleportPlayer(self, other, e.origin + '0 0 1' * (1 - other.mins_z - 24), e.mangle, v_forward * vlen(other.velocity), '0 0 0', '0 0 0');
Modified: trunk/data/scripts/entities.def
===================================================================
--- trunk/data/scripts/entities.def 2009-07-08 13:25:07 UTC (rev 7157)
+++ trunk/data/scripts/entities.def 2009-07-08 15:09:02 UTC (rev 7158)
@@ -1220,10 +1220,10 @@
_celshader: Sets the cel shader used for this geometry. Note: omit the "textures/" prefix.
*/
-/*QUAKED trigger_race_checkpoint (0 1 0) ? NOTOUCH STRICTTRIGGER CRUSH
+/*QUAKED trigger_race_checkpoint (0 1 0) ? NOTOUCH STRICTTRIGGER CRUSH FINISH
A checkpoint, for the race game mode. Be sure to make them quite long, so they actually catch a player reliably!
-------- KEYS --------
-cnt: Number of the checkpoint. 0 for finish line, and at least two other checkpoints have to exist. They MUST be touched in sequential order!
+cnt: Number of the checkpoint. 0 for start/finish line, and at least two other checkpoints have to exist. They MUST be touched in sequential order!
message: Death message, when touching checkpoints in the wrong order.
message2: Death message when someone gets pushed into this (default: "was thrown into a world of hurt by"). The # character is replaced by the attacker name if present (and it instead does not get appended to the end)
targetname: Name of the checkpoint. info_player_race can target this to assign a spawn to a checkpoint. Also used for triggering a checkpoint by an event.
@@ -1232,6 +1232,7 @@
NOTOUCH: the checkpoint will not become active when touched, it HAS to be targeted
STRICTTRIGGER: only trigger the targets when the checkpoint actually was reached in a valid way (that is, not when going back)
CRUSH: the checkpoint kills when used at the wrong time
+FINISH: when set on the last checkpoint (i.e. the one with highest cnt), it is marked as finish line and the CP with cnt=0 is the start line
*/
/*QUAKED info_player_race (1 0.5 0) (-16 -16 -24) (16 16 45)
More information about the nexuiz-commits
mailing list