]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make the Freeze function usable with freezetag
authorMario <mario.mario@y7mail.com>
Thu, 18 Apr 2013 09:26:37 +0000 (19:26 +1000)
committerMario <mario.mario@y7mail.com>
Thu, 18 Apr 2013 09:26:37 +0000 (19:26 +1000)
qcsrc/client/View.qc
qcsrc/server/cl_client.qc
qcsrc/server/g_damage.qc
qcsrc/server/monsters/lib/monsters.qc
qcsrc/server/monsters/monster/spider.qc
qcsrc/server/mutators/gamemode_freezetag.qc

index 4f00c55341639fbce6fd13122c29384a1db910b6..6aabdc24e3a075f228c0b97e746bcba3f12fbaae 100644 (file)
@@ -1064,15 +1064,12 @@ void CSQC_UpdateView(float w, float h)
 
        //else
        {
-               if(gametype == MAPINFO_TYPE_FREEZETAG)
+               if(getstati(STAT_FROZEN))
+                       drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
+               if(getstatf(STAT_REVIVE_PROGRESS))
                {
-                       if(getstati(STAT_FROZEN))
-                               drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
-                       if(getstatf(STAT_REVIVE_PROGRESS))
-                       {
-                               DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", getstatf(STAT_REVIVE_PROGRESS), '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
-                               drawstring_aspect(eY * 0.64 * vid_conheight, "Revival progress", eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL);
-                       }
+                       DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", getstatf(STAT_REVIVE_PROGRESS), '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
+                       drawstring_aspect(eY * 0.64 * vid_conheight, "Revival progress", eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL);
                }
 
                if(autocvar_r_letterbox == 0)
index bcff1babf0db1e8939db14cb2a390329ce5d74be..d96e14e72bbcf54aa91744a45ec1cdc808850023 100644 (file)
@@ -907,7 +907,7 @@ void PutClientInServer (void)
                        activator = world;
                self = oldself;
                
-               Unfreeze(self);
+               Unfreeze(self, frozen, revive_progress);
 
                spawn_spot = spot;
                MUTATOR_CALLHOOK(PlayerSpawn);
@@ -2599,7 +2599,7 @@ void PlayerPreThink (void)
                self.health = max(1, self.revive_progress * autocvar_g_balance_health_start);
 
                if(self.revive_progress >= 1)
-                       Unfreeze(self);
+                       Unfreeze(self, frozen, revive_progress);
        }
 
        MUTATOR_CALLHOOK(PlayerPreThink);
index 7196c7e18974b5783fca91bdfb25fc4c52b50b51..d98a097b1ab3f0c622fd30495422e9bc498a3674 100644 (file)
@@ -568,16 +568,11 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype)
 
 void Ice_Think()
 {
-       if(self.owner.health < 1)
-       {
-               remove(self);
-               return;
-       }
        setorigin(self, self.owner.origin - '0 0 16');
        self.nextthink = time;
 }
 
-void Freeze (entity targ, float freeze_time)
+void Freeze (entity targ, float freeze_time, .float frozen_flag, .float revive_flag)
 {
        float monster = (targ.flags & FL_MONSTER);
        float player = (targ.flags & FL_CLIENT);
@@ -585,11 +580,11 @@ void Freeze (entity targ, float freeze_time)
        if(!player && !monster) // only specified entities can be freezed
                return;
                
-       if(targ.frozen || targ.freezetag_frozen)
+       if(targ.frozen_flag)
                return;
                
-       targ.frozen = 1;
-       targ.revive_progress = 0;
+       targ.frozen_flag = 1;
+       targ.revive_flag = 0;
        targ.health = 1;
        targ.revive_speed = freeze_time;
 
@@ -612,10 +607,10 @@ void Freeze (entity targ, float freeze_time)
        RemoveGrapplingHook(targ);
 }
 
-void Unfreeze (entity targ)
+void Unfreeze (entity targ, .float frozen_flag, .float revive_flag)
 {
-       targ.frozen = 0;
-       targ.revive_progress = 0;
+       targ.frozen_flag = 0;
+       targ.revive_flag = 0;
        targ.health = ((targ.classname == STR_PLAYER) ? autocvar_g_balance_health_start : targ.max_health);
 
        // remove the ice block
index f234e900c5ac1ba7a85d4cbd8945b8d5f503eb2e..5e5ceb38d5f2715bd30df1afa83ad7ffeb7c20bf 100644 (file)
@@ -494,7 +494,7 @@ void monster_move(float runspeed, float walkspeed, float stopspeed, float manim_
                self.nextthink = time + 0.1;
                
                if(self.revive_progress >= 1)
-                       Unfreeze(self); // wait for next think before attacking
+                       Unfreeze(self, frozen, revive_progress); // wait for next think before attacking
                        
                self.SendFlags |= MSF_MOVE;
                        
index d4945915216d9f5c9a6e6c46a89fcff4bdbc0856..a08cdb87ded001525219bc0777130b882ef1faad 100644 (file)
@@ -65,7 +65,7 @@ void spider_web_touch ()
        switch(self.realowner.spider_type)
        {
                case SPIDER_TYPE_ICE:
-                       Freeze(other, 0.3);
+                       Freeze(other, 0.3, frozen, revive_progress);
                        break;
                case SPIDER_TYPE_FIRE:
                        Fire_AddDamage(other, self.realowner, 5 * monster_skill, autocvar_g_monster_spider_attack_fire_time, DEATH_MONSTER_SPIDER_FIRE);
index c43a398754c34b0e513e60f189423e2a12f78406..c73309b62756a7e1628ea15c4f0e9eecb03e0fa1 100644 (file)
@@ -56,29 +56,10 @@ void freezetag_Freeze(entity attacker)
 {
        if(self.freezetag_frozen)
                return;
-       self.freezetag_frozen = 1;
-       self.freezetag_revive_progress = 0;
+               
        self.health = 1;
-
-       entity ice;
-       ice = spawn();
-       ice.owner = self;
-       ice.classname = "freezetag_ice";
-       ice.think = freezetag_Ice_Think;
-       ice.nextthink = time;
-       ice.frame = floor(random() * 21); // ice model has 20 different looking frames
-       setmodel(ice, "models/ice/ice.md3");
-
-       entity oldself;
-       oldself = self;
-       self = ice;
-       freezetag_Ice_Think();
-       self = oldself;
-
-       RemoveGrapplingHook(self);
-
-       // add waypoint
-       WaypointSprite_Spawn("freezetag_frozen", 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attached, TRUE, RADARICON_WAYPOINT, '0.25 0.90 1');
+       
+       Freeze(self, 0, freezetag_frozen, freezetag_revive_progress);
 
        if(attacker == self)
        {
@@ -101,17 +82,7 @@ void freezetag_Freeze(entity attacker)
 
 void freezetag_Unfreeze(entity attacker)
 {
-       self.freezetag_frozen = 0;
-       self.freezetag_revive_progress = 0;
-       self.health = autocvar_g_balance_health_start;
-
-       // remove the ice block
-       entity ice;
-       for(ice = world; (ice = find(ice, classname, "freezetag_ice")); ) if(ice.owner == self)
-       {
-               remove(ice);
-               break;
-       }
+       Unfreeze(self, freezetag_frozen, freezetag_revive_progress);
 
        // remove waypoint
        if(self.waypointsprite_attached)
@@ -320,7 +291,11 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerPreThink)
        vector revive_extra_size;
 
        revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
-
+       
+       // add waypoint
+       if(self.freezetag_frozen && self.waypointsprite_attached == world)
+               WaypointSprite_Spawn("freezetag_frozen", 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attached, TRUE, RADARICON_WAYPOINT, '0.25 0.90 1');
+       
        entity o;
        o = world;
        n = 0;