]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Link control points as well
authorMario <mario.mario@y7mail.com>
Sun, 1 Sep 2013 15:15:21 +0000 (01:15 +1000)
committerMario <mario.mario@y7mail.com>
Sun, 1 Sep 2013 15:15:21 +0000 (01:15 +1000)
qcsrc/client/Main.qc
qcsrc/client/progs.src
qcsrc/common/constants.qh
qcsrc/server/command/cmd.qc
qcsrc/server/controlpoint.qc [new file with mode: 0644]
qcsrc/server/controlpoint.qh [new file with mode: 0644]
qcsrc/server/mutators/gamemode_onslaught.qc
qcsrc/server/progs.src

index 671b3f6d5b1ca9aabf169786380784f568a93057..fcb8709fcd6186799f9db5ce74db16e321ad46af 100644 (file)
@@ -827,6 +827,7 @@ void CSQC_Ent_Update(float bIsNewEntity)
                case ENT_CLIENT_TURRET: ent_turret(); break; 
                case ENT_CLIENT_MONSTER: ent_monster(); break;
                case ENT_CLIENT_GENERATOR: ent_generator(); break;
+               case ENT_CLIENT_CONTROLPOINT: ent_controlpoint(); break;
                case ENT_CLIENT_MODEL: CSQCModel_Read(bIsNewEntity); break;
                case ENT_CLIENT_ITEM: ItemRead(bIsNewEntity); break;  
                case ENT_CLIENT_BUMBLE_RAYGUN: bumble_raygun_read(bIsNewEntity); break;
index 0b68e7e965b4143b2152d9b595ce9f0dee338cb4..62332dcb422a5542652f9346f4db6c97af37f992 100644 (file)
@@ -52,6 +52,7 @@ tturrets.qh
 ../server/tturrets/include/turrets_early.qh
 ../server/movelib.qc
 ../server/generator.qh
+../server/controlpoint.qh
 main.qh
 vehicles/vehicles.qh
 ../common/csqcmodel_settings.qh
@@ -127,6 +128,7 @@ command/cl_cmd.qc
 tturrets.qc
 
 ../server/generator.qc
+../server/controlpoint.qc
 
 player_skeleton.qc
 ../common/animdecide.qc
index 385d3b2e123715baee2e654415b66ae1c86ffe11..aa9a2d29e6325c7315f9b050a4c85e4d5c20a858 100644 (file)
@@ -103,6 +103,7 @@ const float ENT_CLIENT_AUXILIARYXHAIR = 50;
 const float ENT_CLIENT_VEHICLE = 60;
 const float ENT_CLIENT_MONSTER = 70;
 const float ENT_CLIENT_GENERATOR = 80;
+const float ENT_CLIENT_CONTROLPOINT = 90;
 
 const float SPRITERULE_DEFAULT = 0;
 const float SPRITERULE_TEAMPLAY = 1;
index 88801e125da34374562780b2affadaa0251db1ce..ea72272210977694ca902ecdf83aed9cffe2451f 100644 (file)
@@ -280,7 +280,7 @@ void ClientCommand_mobspawn(float request, float argc)
                        else if not(autocvar_g_monsters) { Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_MONSTERS_DISABLED); }
                        else if(self.vehicle) { sprint(self, "You can't spawn monsters while driving a vehicle.\n"); }
                        else if(autocvar_g_campaign) { sprint(self, "You can't spawn monsters in campaign mode.\n"); }
-                       else if(self.deadflag) { sprint(self, "You can't spawn monsters while dead.\n"); }
+                       else if(self.deadflag != DEAD_NO) { sprint(self, "You can't spawn monsters while dead.\n"); }
                        else if(self.monstercount >= autocvar_g_monsters_max_perplayer) { sprint(self, "You have spawned too many monsters, kill some before trying to spawn any more.\n"); }
                        else if(totalspawned >= autocvar_g_monsters_max) { sprint(self, "The global maximum monster count has been reached, kill some before trying to spawn any more.\n"); }
                        else // all worked out, so continue
diff --git a/qcsrc/server/controlpoint.qc b/qcsrc/server/controlpoint.qc
new file mode 100644 (file)
index 0000000..ecf3fee
--- /dev/null
@@ -0,0 +1,120 @@
+#ifdef CSQC
+float controlpoint_precached;
+
+void controlpoint_precache()
+{
+       if(controlpoint_precached)
+               return; // already precached
+               
+       precache_model("models/onslaught/controlpoint_pad.md3");
+       precache_model("models/onslaught/controlpoint_pad2.md3");
+       
+       controlpoint_precached = TRUE;
+}
+
+void controlpoint_draw()
+{
+}
+
+void controlpoint_construct()
+{
+       self.netname = "Control Point";
+
+       setorigin(self, self.origin);
+       setmodel(self, "models/onslaught/controlpoint_pad.md3");
+       setsize(self, CONTROLPOINT_MIN, CONTROLPOINT_MAX);
+       
+       self.move_movetype      = MOVETYPE_NOCLIP;
+       self.solid                      = SOLID_BBOX;
+       self.movetype           = MOVETYPE_NOCLIP; 
+       self.move_origin        = self.origin;
+       self.move_time          = time;
+       self.drawmask           = MASK_NORMAL;  
+       self.alpha                      = 1;
+       self.draw                       = controlpoint_draw;
+       self.health                     = 255;
+}
+
+.vector glowmod;
+void controlpoint_changeteam()
+{
+       if(self.team)
+       {
+               self.glowmod = Team_ColorRGB(self.team - 1);
+               self.teamradar_color = Team_ColorRGB(self.team - 1);
+               self.colormap = 1024 + (self.team - 1) * 17;
+               setmodel(self, "models/onslaught/controlpoint_pad2.md3");
+               setsize(self, CONTROLPOINT_MIN, CONTROLPOINT_MAX);
+       }
+       else
+       {
+               self.colormap = 1024;
+               self.glowmod = '1 1 0';
+               self.teamradar_color = '1 1 0';
+               setmodel(self, "models/onslaught/controlpoint_pad.md3");
+               setsize(self, CONTROLPOINT_MIN, CONTROLPOINT_MAX);
+       }
+}
+
+void ent_controlpoint()
+{
+       float sf;
+       sf = ReadByte();
+
+       if(sf & CPSF_SETUP)
+       {
+               self.origin_x = ReadCoord();
+               self.origin_y = ReadCoord();
+               self.origin_z = ReadCoord();
+               setorigin(self, self.origin);
+               
+               self.team = ReadByte();
+               
+               if not(self.count)
+                       self.count = 40;
+               
+               controlpoint_changeteam();
+               controlpoint_precache();
+               controlpoint_construct();
+       }
+
+       if(sf & CPSF_STATUS)
+       {
+               float _tmp;
+               _tmp = ReadByte();
+               if(_tmp != self.team)
+               {                       
+                       self.team = _tmp;
+                       controlpoint_changeteam();
+               }
+       }
+}
+#endif // CSQC
+
+#ifdef SVQC
+float controlpoint_send(entity to, float sf)
+{
+       WriteByte(MSG_ENTITY, ENT_CLIENT_CONTROLPOINT);    
+       WriteByte(MSG_ENTITY, sf);
+       if(sf & CPSF_SETUP)
+       {
+           WriteCoord(MSG_ENTITY, self.origin_x);
+           WriteCoord(MSG_ENTITY, self.origin_y);
+           WriteCoord(MSG_ENTITY, self.origin_z);
+               
+               WriteByte(MSG_ENTITY, self.team);
+    }
+    
+    if(sf & CPSF_STATUS)
+    {
+               WriteByte(MSG_ENTITY, self.team);
+    }
+    
+       return TRUE;
+}
+
+void controlpoint_link()
+{
+    Net_LinkEntity(self, TRUE, 0, controlpoint_send);
+}
+#endif // SVQC
diff --git a/qcsrc/server/controlpoint.qh b/qcsrc/server/controlpoint.qh
new file mode 100644 (file)
index 0000000..88ae0f1
--- /dev/null
@@ -0,0 +1,10 @@
+const vector CONTROLPOINT_MIN = '-63 -63 -9';
+const vector CONTROLPOINT_MAX = '65 63 26';
+
+float CPSF_STATUS = 4;
+float CPSF_SETUP = 8;
+
+#ifdef CSQC
+void ent_controlpoint();
+void controlpoint_precache();
+#endif
\ No newline at end of file
index a30c6c6e6d1ae3daac0308c3cd68d868cbc8905c..5f4a7eede49be4dbee3bf12c2897f885aef44056 100644 (file)
@@ -832,8 +832,8 @@ void onslaught_generator_reset()
        self.enemy.solid = SOLID_NOT;
        self.think = onslaught_generator_delayed;
        self.nextthink = time + 0.2;
-       setmodel(self, "models/onslaught/generator.md3");
-       setsize(self, GENERATOR_MIN, GENERATOR_MAX);
+       //setmodel(self, "models/onslaught/generator.md3");
+       //setsize(self, GENERATOR_MIN, GENERATOR_MAX);
        
        self.SendFlags |= GSF_STATUS;
 
@@ -896,7 +896,7 @@ void spawnfunc_onslaught_generator()
        self.solid = SOLID_BBOX;
        self.movetype = MOVETYPE_NONE;
        self.lasthealth = self.max_health = self.health = autocvar_g_onslaught_gen_health;
-       setmodel(self, "models/onslaught/generator.md3");
+       //setmodel(self, "models/onslaught/generator.md3");
        setsize(self, GENERATOR_MIN, GENERATOR_MAX);
        setorigin(self, self.origin);
        self.takedamage = DAMAGE_AIM;
@@ -1039,8 +1039,9 @@ void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float
 
 
                self.owner.waslinked = self.owner.islinked;
-               if(self.owner.model != "models/onslaught/controlpoint_pad.md3")
-                       setmodel(self.owner, "models/onslaught/controlpoint_pad.md3");
+               self.owner.SendFlags |= CPSF_STATUS;
+               //if(self.owner.model != "models/onslaught/controlpoint_pad.md3")
+                       //setmodel(self.owner, "models/onslaught/controlpoint_pad.md3");
                //setsize(self, '-32 -32 0', '32 32 8');
 
                remove(self);
@@ -1230,8 +1231,9 @@ void onslaught_controlpoint_icon_buildthink()
        self.alpha = self.health / self.max_health;
        // colormod flash when shot
        self.colormod = '1 1 1' * (2 - bound(0, (self.pain_finished - time) / 10, 1));
-       if(self.owner.model != "models/onslaught/controlpoint_pad2.md3")
-               setmodel(self.owner, "models/onslaught/controlpoint_pad2.md3");
+       self.owner.SendFlags |= CPSF_STATUS;
+       //if(self.owner.model != "models/onslaught/controlpoint_pad2.md3")
+               //setmodel(self.owner, "models/onslaught/controlpoint_pad2.md3");
        //setsize(self, '-32 -32 0', '32 32 8');
 
        if(random() < 0.9 - self.health / self.max_health)
@@ -1292,12 +1294,14 @@ void onslaught_controlpoint_reset()
        self.enemy.colormap = self.colormap;
        self.think = self.enemy.think = func_null;
        self.nextthink = 0; // don't like func_null :P
-       setmodel(self, "models/onslaught/controlpoint_pad.md3");
+       //setmodel(self, "models/onslaught/controlpoint_pad.md3");
        //setsize(self, '-32 -32 0', '32 32 8');
 
        WaypointSprite_UpdateMaxHealth(self.sprite, 0);
 
        onslaught_updatelinks();
+       
+       self.SendFlags |= CPSF_STATUS;
 
        activator = self;
        SUB_UseTargets(); // to reset the structures, playerspawns etc.
@@ -1322,8 +1326,8 @@ void spawnfunc_onslaught_controlpoint()
                remove(self);
                return;
        }
-       precache_model("models/onslaught/controlpoint_pad.md3");
-       precache_model("models/onslaught/controlpoint_pad2.md3");
+       //precache_model("models/onslaught/controlpoint_pad.md3");
+       //precache_model("models/onslaught/controlpoint_pad2.md3");
        precache_model("models/onslaught/controlpoint_shield.md3");
        precache_model("models/onslaught/controlpoint_icon.md3");
        precache_model("models/onslaught/controlpoint_icon_dmg1.md3");
@@ -1342,8 +1346,8 @@ void spawnfunc_onslaught_controlpoint()
 
        self.solid = SOLID_BBOX;
        self.movetype = MOVETYPE_NONE;
-       setmodel(self, "models/onslaught/controlpoint_pad.md3");
-       //setsize(self, '-32 -32 0', '32 32 8');
+       //setmodel(self, "models/onslaught/controlpoint_pad.md3");
+       setsize(self, CONTROLPOINT_MIN, CONTROLPOINT_MAX);
        if(!self.noalign)
        {
                setorigin(self, self.origin + '0 0 20');
@@ -1374,6 +1378,8 @@ void spawnfunc_onslaught_controlpoint()
 
        WaypointSprite_SpawnFixed(string_null, self.origin + '0 0 128', self, sprite, RADARICON_NONE, '0 0 0');
        WaypointSprite_UpdateRule(self.sprite, NUM_TEAM_2, SPRITERULE_TEAMPLAY);
+       
+       controlpoint_link();
 
        onslaught_updatelinks();
 
index b8ce21ec2e18825e13500a33a4d7c911cf9e1480..fa85e4ba0d617701f1fe23adc8491cfbe39488b9 100644 (file)
@@ -60,6 +60,7 @@ tturrets/include/turrets_early.qh
 vehicles/vehicles_def.qh
 
 generator.qh
+controlpoint.qh
 
 campaign.qh
 ../common/campaign_common.qh
@@ -215,6 +216,7 @@ spawnpoints.qc
 portals.qc
 
 generator.qc
+controlpoint.qc
 
 target_spawn.qc
 func_breakable.qc