//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)
activator = world;
self = oldself;
- Unfreeze(self);
+ Unfreeze(self, frozen, revive_progress);
spawn_spot = spot;
MUTATOR_CALLHOOK(PlayerSpawn);
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);
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);
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;
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
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;
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);
{
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)
{
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)
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;