[nexuiz-commits] r8726 - in trunk/data/qcsrc: server warpzonelib
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sun Feb 28 14:46:10 EST 2010
Author: div0
Date: 2010-02-28 14:46:10 -0500 (Sun, 28 Feb 2010)
New Revision: 8726
Modified:
trunk/data/qcsrc/server/t_teleporters.qc
trunk/data/qcsrc/warpzonelib/server.qc
trunk/data/qcsrc/warpzonelib/server.qh
Log:
warpzones: make warpzonelib depend less on Nexuiz
Modified: trunk/data/qcsrc/server/t_teleporters.qc
===================================================================
--- trunk/data/qcsrc/server/t_teleporters.qc 2010-02-28 19:46:06 UTC (rev 8725)
+++ trunk/data/qcsrc/server/t_teleporters.qc 2010-02-28 19:46:10 UTC (rev 8726)
@@ -307,10 +307,3 @@
pl.oldvelocity = pl.velocity;
}
}
-
-void spawnfunc_trigger_warpzone(void)
-{
- WarpZone_InitStep_SpawnFunc();
- InitializeEntity(self, WarpZone_InitStep_FindTarget, INITPRIO_FINDTARGET);
- InitializeEntity(self, WarpZone_InitStep_UpdateTransform, INITPRIO_LAST);
-}
Modified: trunk/data/qcsrc/warpzonelib/server.qc
===================================================================
--- trunk/data/qcsrc/warpzonelib/server.qc 2010-02-28 19:46:06 UTC (rev 8725)
+++ trunk/data/qcsrc/warpzonelib/server.qc 2010-02-28 19:46:10 UTC (rev 8726)
@@ -160,67 +160,6 @@
return TRUE;
}
-void WarpZone_InitStep_SpawnFunc()
-{
- // warp zone entities must have:
- // "killtarget" pointing to a target_position with a direction arrow
- // that points AWAY from the warp zone, and that is inside
- // the warp zone trigger
- // "target" pointing to an identical warp zone at another place in
- // the map, with another killtarget to designate its
- // orientation
-
- string m;
- m = self.model;
- WarpZoneLib_ExactTrigger_Init();
- setmodel(self, m);
- self.SendEntity = WarpZone_Send;
- self.SendFlags = 0xFFFFFF;
- self.effects |= EF_NODEPTHTEST;
-}
-
-void WarpZone_InitStep_FindTarget()
-{
- entity e;
-
- if(self.killtarget == "")
- {
- objerror("Warp zone with no killtarget");
- return;
- }
- self.aiment = find(world, targetname, self.killtarget);
- if(self.aiment == world)
- {
- objerror("Warp zone with nonexisting killtarget");
- return;
- }
-
- // this way only one of the two ents needs to target
- if(self.target != "")
- {
- e = find(world, targetname, self.target);
- if(e)
- {
- self.enemy = e;
- self.enemy.enemy = self;
- }
- }
-}
-
-void WarpZone_InitStep_UpdateTransform()
-{
- if(!self.enemy || self.enemy.enemy != self)
- {
- objerror("Invalid warp zone detected. Killed.");
- return;
- }
-
- WarpZone_SetUp(self, self.aiment.origin, self.aiment.angles, self.enemy.aiment.origin, self.enemy.aiment.angles);
-
- // now enable touch
- self.touch = WarpZone_Touch;
-}
-
float WarpZone_CheckProjectileImpact()
{
// if self hit a warpzone, abort
@@ -264,12 +203,6 @@
return TRUE;
}
-void WarpZone_StartFrame()
-{
- entity e;
- for(e = world; (e = nextent(e)); )
- WarpZone_StoreProjectileData(e);
-}
float WarpZone_Projectile_Touch()
{
if(other.classname == "trigger_warpzone")
@@ -288,3 +221,116 @@
return FALSE;
}
+
+void WarpZone_InitStep_FindTarget()
+{
+ entity e;
+
+ if(self.killtarget != "")
+ {
+ self.aiment = find(world, targetname, self.killtarget);
+ if(self.aiment == world)
+ {
+ error("Warp zone with nonexisting killtarget");
+ return;
+ }
+ }
+
+ // this way only one of the two ents needs to target
+ if(self.target != "")
+ {
+ e = find(world, targetname, self.target);
+ if(e)
+ {
+ self.enemy = e;
+ self.enemy.enemy = self;
+ }
+ }
+}
+
+void WarpZonePosition_InitStep_FindTarget()
+{
+ entity e;
+
+ if(self.target == "")
+ {
+ error("Warp zone position with no target");
+ return;
+ }
+ self.enemy = find(world, targetname, self.target);
+ if(self.enemy == world)
+ {
+ error("Warp zone position with nonexisting target");
+ return;
+ }
+ if(self.enemy.aiment)
+ {
+ // already is positioned
+ error("Warp zone position targeting already oriented warpzone");
+ return;
+ }
+ self.enemy.aiment = self;
+}
+
+void WarpZone_InitStep_UpdateTransform()
+{
+ if(!self.enemy || self.enemy.enemy != self || !self.aiment)
+ {
+ error("Invalid warp zone detected. Killed.");
+ return;
+ }
+
+ WarpZone_SetUp(self, self.aiment.origin, self.aiment.angles, self.enemy.aiment.origin, self.enemy.aiment.angles);
+
+ // now enable touch
+ self.touch = WarpZone_Touch;
+}
+
+float warpzone_initialized;
+entity warpzone_first;
+entity warpzone_position_first;
+.entity warpzone_next;
+void spawnfunc_trigger_warpzone_position(void)
+{
+ // "target", "angles", "origin"
+ self.warpzone_next = warpzone_position_first;
+ warpzone_position_first = self;
+}
+void spawnfunc_trigger_warpzone(void)
+{
+ // warp zone entities must have:
+ // "killtarget" pointing to a target_position with a direction arrow
+ // that points AWAY from the warp zone, and that is inside
+ // the warp zone trigger
+ // "target" pointing to an identical warp zone at another place in
+ // the map, with another killtarget to designate its
+ // orientation
+
+ string m;
+ m = self.model;
+ WarpZoneLib_ExactTrigger_Init();
+ setmodel(self, m);
+ self.SendEntity = WarpZone_Send;
+ self.SendFlags = 0xFFFFFF;
+ self.effects |= EF_NODEPTHTEST;
+ self.warpzone_next = warpzone_first;
+ warpzone_first = self;
+}
+void WarpZone_StartFrame()
+{
+ entity e;
+ if(warpzone_initialized == 0)
+ {
+ warpzone_initialized = 1;
+ e = self;
+ for(self = warpzone_first; self; self = self.warpzone_next)
+ WarpZone_InitStep_FindTarget();
+ for(self = warpzone_position_first; self; self = self.warpzone_next)
+ WarpZonePosition_InitStep_FindTarget();
+ for(self = warpzone_first; self; self = self.warpzone_next)
+ WarpZone_InitStep_UpdateTransform();
+ self = e;
+ }
+ for(e = world; (e = nextent(e)); )
+ WarpZone_StoreProjectileData(e);
+}
Modified: trunk/data/qcsrc/warpzonelib/server.qh
===================================================================
--- trunk/data/qcsrc/warpzonelib/server.qh 2010-02-28 19:46:06 UTC (rev 8725)
+++ trunk/data/qcsrc/warpzonelib/server.qh 2010-02-28 19:46:10 UTC (rev 8726)
@@ -1,12 +1,7 @@
-void WarpZone_InitStep_SpawnFunc();
-void WarpZone_InitStep_FindTarget();
-void WarpZone_InitStep_UpdateTransform();
-
void WarpZone_StartFrame();
float WarpZone_Projectile_Touch();
// THESE must be defined by calling QC code:
-void spawnfunc_trigger_warpzone(); // must call the init steps in order, first all spawnfunc init steps, then all findtarget init steps, then all updatetransform init steps
void WarpZone_PostTeleportPlayer_Callback(entity pl);
float WarpZone_Projectile_Touch_ImpactFilter_Callback();
More information about the nexuiz-commits
mailing list