From: Mario Date: Thu, 18 Apr 2013 09:26:37 +0000 (+1000) Subject: Make the Freeze function usable with freezetag X-Git-Tag: xonotic-v0.8.0~241^2^2~346 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f3286852de58ad63e16ae8a669356f73b991922e;p=xonotic%2Fxonotic-data.pk3dir.git Make the Freeze function usable with freezetag --- diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 4f00c5534..6aabdc24e 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -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) diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index bcff1babf..d96e14e72 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -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); diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 7196c7e18..d98a097b1 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -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 diff --git a/qcsrc/server/monsters/lib/monsters.qc b/qcsrc/server/monsters/lib/monsters.qc index f234e900c..5e5ceb38d 100644 --- a/qcsrc/server/monsters/lib/monsters.qc +++ b/qcsrc/server/monsters/lib/monsters.qc @@ -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; diff --git a/qcsrc/server/monsters/monster/spider.qc b/qcsrc/server/monsters/monster/spider.qc index d49459152..a08cdb87d 100644 --- a/qcsrc/server/monsters/monster/spider.qc +++ b/qcsrc/server/monsters/monster/spider.qc @@ -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); diff --git a/qcsrc/server/mutators/gamemode_freezetag.qc b/qcsrc/server/mutators/gamemode_freezetag.qc index c43a39875..c73309b62 100644 --- a/qcsrc/server/mutators/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/gamemode_freezetag.qc @@ -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;