X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmonsters%2Fsv_monsters.qc;h=b4861b917dd39e068cb816fc3253f89f9b7acf4a;hb=0076d3f631e54b908b7506883c75c6d28f6b9505;hp=695d1101952e9d3f531aceef9c073324322b1669;hpb=078dd992e6bb1094cfd86148cc4df33e8a62587b;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 695d11019..b4861b917 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -1,6 +1,5 @@ #include "sv_monsters.qh" -#include #include #include "../constants.qh" #include "../teams.qh" @@ -18,7 +17,7 @@ #include "../vehicles/all.qh" #include #include -#include "../triggers/triggers.qh" +#include "../mapobjects/triggers.qh" #include #include #include @@ -82,6 +81,7 @@ bool Monster_ValidTarget(entity this, entity targ) || (IS_VEHICLE(targ) && !((Monsters_from(this.monsterid)).spawnflags & MON_FLAG_RANGED)) // melee vs vehicle is useless || (time < game_starttime) // monsters do nothing before match has started || (targ.takedamage == DAMAGE_NO) + || (game_stopped) || (targ.items & IT_INVISIBILITY) || (IS_SPEC(targ) || IS_OBSERVER(targ)) // don't attack spectators || (!IS_VEHICLE(targ) && (IS_DEAD(targ) || IS_DEAD(this) || targ.health <= 0 || this.health <= 0)) @@ -275,7 +275,7 @@ void Monster_Sounds_Precache(entity this) void Monster_Sounds_Clear(entity this) { -#define _MSOUND(m) if(this.monstersound_##m) { strunzone(this.monstersound_##m); this.monstersound_##m = string_null; } +#define _MSOUND(m) strfree(this.monstersound_##m); ALLMONSTERSOUNDS #undef _MSOUND } @@ -310,9 +310,7 @@ bool Monster_Sounds_Load(entity this, string f, int first) field = Monster_Sound_SampleField(argv(0)); if(GetMonsterSoundSampleField_notFound) continue; - if (this.(field)) - strunzone(this.(field)); - this.(field) = strzone(strcat(argv(1), " ", argv(2))); + strcpy(this.(field), strcat(argv(1), " ", argv(2))); } fclose(fh); return true; @@ -1151,20 +1149,20 @@ void Monster_Frozen_Think(entity this) { if(STAT(FROZEN, this) == 2) { - this.revive_progress = bound(0, this.revive_progress + this.ticrate * this.revive_speed, 1); - this.health = max(1, this.revive_progress * this.max_health); - this.iceblock.alpha = bound(0.2, 1 - this.revive_progress, 1); + STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) + this.ticrate * this.revive_speed, 1); + this.health = max(1, STAT(REVIVE_PROGRESS, this) * this.max_health); + this.iceblock.alpha = bound(0.2, 1 - STAT(REVIVE_PROGRESS, this), 1); if(!(this.spawnflags & MONSTERFLAG_INVINCIBLE) && this.sprite) WaypointSprite_UpdateHealth(this.sprite, this.health); - if(this.revive_progress >= 1) + if(STAT(REVIVE_PROGRESS, this) >= 1) Unfreeze(this); } else if(STAT(FROZEN, this) == 3) { - this.revive_progress = bound(0, this.revive_progress - this.ticrate * this.revive_speed, 1); - this.health = max(0, autocvar_g_nades_ice_health + (this.max_health-autocvar_g_nades_ice_health) * this.revive_progress ); + STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) - this.ticrate * this.revive_speed, 1); + this.health = max(0, autocvar_g_nades_ice_health + (this.max_health-autocvar_g_nades_ice_health) * STAT(REVIVE_PROGRESS, this) ); if(!(this.spawnflags & MONSTERFLAG_INVINCIBLE) && this.sprite) WaypointSprite_UpdateHealth(this.sprite, this.health); @@ -1177,7 +1175,7 @@ void Monster_Frozen_Think(entity this) this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, DMG_NOWEP, this.origin, '0 0 0'); } - else if ( this.revive_progress <= 0 ) + else if ( STAT(REVIVE_PROGRESS, this) <= 0 ) Unfreeze(this); } // otherwise, no revival!