]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/ons_camera 377/head
authorterencehill <piuntn@gmail.com>
Thu, 20 Oct 2016 13:54:18 +0000 (15:54 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 20 Oct 2016 13:54:18 +0000 (15:54 +0200)
17 files changed:
qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc
qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc
qcsrc/common/mapinfo.qc
qcsrc/common/monsters/monster.qh
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/monsters/monster/zombie.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/monsters/sv_monsters.qh
qcsrc/common/monsters/sv_spawn.qc
qcsrc/common/monsters/sv_spawn.qh
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/server/command/common.qc
qcsrc/server/mutators/mutator/gamemode_invasion.qc

index 491acdd007d8635cac7417c2bd5acdc11c6cff95..0941833de8acd7430cc7fb35cef56c104bf405bf 100644 (file)
@@ -5,6 +5,8 @@
 bool cpicon_send(entity this, entity to, int sf)
 {
        WriteHeader(MSG_ENTITY, ENT_CLIENT_CONTROLPOINT_ICON);
+       if(sf & CPSF_SETUP)
+               sf &= ~CPSF_STATUS;
        WriteByte(MSG_ENTITY, sf);
        if(sf & CPSF_SETUP)
        {
index f1e25736970113e2409abd759aa83c12638c78b8..572611c5d3f874169b7312c224888758d64f26a3 100644 (file)
@@ -979,7 +979,8 @@ void ons_GeneratorReset(entity this)
        this.lasthealth = this.max_health = this.health = autocvar_g_onslaught_gen_health;
        this.takedamage = DAMAGE_AIM;
        this.bot_attack = true;
-       IL_PUSH(g_bot_targets, this);
+       if(!IL_CONTAINS(g_bot_targets, this))
+               IL_PUSH(g_bot_targets, this);
        this.iscaptured = true;
        this.islinked = true;
        this.isshielded = true;
index 7120c61eda932fa46b9cc2313dc26c8854549293..2af3d90823e9dcddee7f187889ca50e2da4eddf2 100644 (file)
@@ -1151,12 +1151,14 @@ Gametype MapInfo_CurrentGametype()
        return prev ? prev : MAPINFO_TYPE_DEATHMATCH;
 }
 
-float _MapInfo_CheckMap(string s) // returns 0 if the map can't be played with the current settings, 1 otherwise
+float _MapInfo_CheckMap(string s, bool gametype_only) // returns 0 if the map can't be played with the current settings, 1 otherwise
 {
        if(!MapInfo_Get_ByName(s, 1, NULL))
                return 0;
        if((MapInfo_Map_supportedGametypes & MapInfo_CurrentGametype().m_flags) == 0)
                return 0;
+       if (gametype_only)
+               return 1;
        if((MapInfo_Map_supportedFeatures & MapInfo_CurrentFeatures()) != MapInfo_CurrentFeatures())
                return 0;
        return 1;
@@ -1165,7 +1167,7 @@ float _MapInfo_CheckMap(string s) // returns 0 if the map can't be played with t
 float MapInfo_CheckMap(string s) // returns 0 if the map can't be played with the current settings, 1 otherwise
 {
        float r;
-       r = _MapInfo_CheckMap(s);
+       r = _MapInfo_CheckMap(s, false);
        MapInfo_ClearTemps();
        return r;
 }
@@ -1237,7 +1239,7 @@ void MapInfo_LoadMapSettings(string s) // to be called from worldspawn
        Gametype t = MapInfo_CurrentGametype();
        MapInfo_LoadMapSettings_SaveGameType(t);
 
-       if(!_MapInfo_CheckMap(s)) // with underscore, it keeps temps
+       if(!_MapInfo_CheckMap(s, true)) // with underscore, it keeps temps
        {
                if(cvar("g_mapinfo_allow_unsupported_modes_and_let_stuff_break"))
                {
@@ -1268,6 +1270,9 @@ void MapInfo_LoadMapSettings(string s) // to be called from worldspawn
                LOG_WARNF("can't play the selected map in the given game mode (%s). Falling back to a supported mode (%s).", t_prev.mdl, t.mdl);
                MapInfo_LoadMapSettings_SaveGameType(t);
        }
+       if(!_MapInfo_CheckMap(s, false)) { // with underscore, it keeps temps
+               LOG_WARNF("the selected map lacks features required by current settings; playing anyway.");
+       }
        MapInfo_Get_ByName(s, 1, t);
 }
 
index babf6e4faf19a2f1e1879afd774693a05514c762..e579d7d87dbfd0360f1ae842404c69e51a98d6ca 100644 (file)
@@ -1,16 +1,17 @@
 #pragma once
 
 // special spawn flags
-const int MONSTER_RESPAWN_DEATHPOINT = 16; // re-spawn where we died
-const int MONSTER_TYPE_FLY = 32;
-const int MONSTER_TYPE_SWIM = 64;
-const int MONSTER_SIZE_BROKEN = 128; // TODO: remove when bad models are replaced
-const int MON_FLAG_SUPERMONSTER = 256; // incredibly powerful monster
-const int MON_FLAG_RANGED = 512; // monster shoots projectiles
-const int MON_FLAG_MELEE = 1024;
-const int MON_FLAG_CRUSH = 2048; // monster can be stomped in special modes
-const int MON_FLAG_RIDE = 4096; // monster can be ridden in special modes
-const int MONSTER_SIZE_QUAKE = 8192;
+const int MONSTER_RESPAWN_DEATHPOINT = BIT(4); // re-spawn where we died
+const int MONSTER_TYPE_FLY = BIT(5);
+const int MONSTER_TYPE_SWIM = BIT(6);
+const int MONSTER_SIZE_BROKEN = BIT(7); // TODO: remove when bad models are replaced
+const int MON_FLAG_SUPERMONSTER = BIT(8); // incredibly powerful monster
+const int MON_FLAG_RANGED = BIT(9); // monster shoots projectiles
+const int MON_FLAG_MELEE = BIT(10);
+const int MON_FLAG_CRUSH = BIT(11); // monster can be stomped in special modes
+const int MON_FLAG_RIDE = BIT(12); // monster can be ridden in special modes
+const int MONSTER_SIZE_QUAKE = BIT(13);
+const int MONSTER_TYPE_PASSIVE = BIT(14); // doesn't target or chase enemies
 
 // entity properties of monsterinfo:
 .bool(int, entity actor, entity targ) monster_attackfunc;
index 30d09807f2f9faf9c4462c30b07c36bb117983e9..2015bcc475363a907449e40c2fbb2887ff68a79a 100644 (file)
@@ -371,7 +371,7 @@ bool M_Mage_Attack(int attack_type, entity actor, entity targ)
        return false;
 }
 
-spawnfunc(monster_mage) { Monster_Spawn(this, MON_MAGE.monsterid); }
+spawnfunc(monster_mage) { Monster_Spawn(this, true, MON_MAGE.monsterid); }
 
 #endif // SVQC
 
index 8f84bdce31d70778f2989c696a14198f7aa29ac5..bbaf2e4696cf85949282cad609ee7e0f24a47b95 100644 (file)
@@ -200,7 +200,7 @@ bool M_Shambler_Attack(int attack_type, entity actor, entity targ)
        return false;
 }
 
-spawnfunc(monster_shambler) { Monster_Spawn(this, MON_SHAMBLER.monsterid); }
+spawnfunc(monster_shambler) { Monster_Spawn(this, true, MON_SHAMBLER.monsterid); }
 #endif // SVQC
 
 #ifdef SVQC
index d2cb8313e3f022402353736f94ac839da415114b..51122dfcf57d73a5575aff79dab4e8f25b31fdef 100644 (file)
@@ -190,7 +190,7 @@ bool M_Spider_Attack(int attack_type, entity actor, entity targ)
        return false;
 }
 
-spawnfunc(monster_spider) { Monster_Spawn(this, MON_SPIDER.monsterid); }
+spawnfunc(monster_spider) { Monster_Spawn(this, true, MON_SPIDER.monsterid); }
 #endif // SVQC
 
 #ifdef SVQC
index 3fd7ec967679e05b750349427f0b2b68d6bf1a32..cd53ff26f75aa2d483de2e55730fd56cce824962 100644 (file)
@@ -106,7 +106,7 @@ bool M_Wyvern_Attack(int attack_type, entity actor, entity targ)
        return false;
 }
 
-spawnfunc(monster_wyvern) { Monster_Spawn(this, MON_WYVERN.monsterid); }
+spawnfunc(monster_wyvern) { Monster_Spawn(this, true, MON_WYVERN.monsterid); }
 #endif // SVQC
 
 #ifdef SVQC
index c48c2108fa2299b80eee1aebdccf5a7da5f4d21b..8bbb300c76b6fc12cfae5ee55309c242d75a8115 100644 (file)
@@ -125,7 +125,7 @@ bool M_Zombie_Attack(int attack_type, entity actor, entity targ)
        return false;
 }
 
-spawnfunc(monster_zombie) { Monster_Spawn(this, MON_ZOMBIE.monsterid); }
+spawnfunc(monster_zombie) { Monster_Spawn(this, true, MON_ZOMBIE.monsterid); }
 #endif // SVQC
 
 #ifdef SVQC
@@ -188,6 +188,8 @@ METHOD(Zombie, mr_setup, bool(Zombie this, entity actor))
     if(actor.spawnflags & MONSTERFLAG_NORESPAWN)
         actor.spawnflags &= ~MONSTERFLAG_NORESPAWN; // zombies always respawn
 
+    actor.spawnflags &= ~MONSTERFLAG_APPEAR; // once it's appeared, it will respawn quickly, we don't want it to appear
+
     actor.spawnflags |= MONSTER_RESPAWN_DEATHPOINT;
 
     actor.monster_loot = spawnfunc_item_health_medium;
index 8fe84a3b62a268529fe46eb4fd8ae8dc7c55db1d..f680f118b3dd5acbe8a14093c03556173cf3cc21 100644 (file)
@@ -505,7 +505,7 @@ bool Monster_Respawn_Check(entity this)
        return true;
 }
 
-void Monster_Respawn(entity this) { Monster_Spawn(this, this.monsterid); }
+void Monster_Respawn(entity this) { Monster_Spawn(this, true, this.monsterid); }
 
 .vector        pos1, pos2;
 
@@ -934,8 +934,7 @@ void Monster_Dead_Think(entity this)
 void Monster_Appear(entity this, entity actor, entity trigger)
 {
        this.enemy = actor;
-       this.spawnflags &= ~MONSTERFLAG_APPEAR; // otherwise, we get an endless loop
-       Monster_Spawn(this, this.monsterid);
+       Monster_Spawn(this, false, this.monsterid);
 }
 
 bool Monster_Appear_Check(entity this, int monster_id)
@@ -1129,23 +1128,19 @@ void Monster_Move_2D(entity this, float mspeed, bool allow_jumpoff)
                return;
        }
 
-       float reverse = false;
-       vector a, b;
-
        makevectors(this.angles);
-       a = this.origin + '0 0 16';
-       b = this.origin + '0 0 16' + v_forward * 32;
+       vector a = CENTER_OR_VIEWOFS(this);
+       vector b = CENTER_OR_VIEWOFS(this) + v_forward * 32;
 
        traceline(a, b, MOVE_NORMAL, this);
 
+       bool reverse = false;
        if(trace_fraction != 1.0)
-       {
                reverse = true;
-
-               if(trace_ent)
-               if(IS_PLAYER(trace_ent) && !(trace_ent.items & IT_STRENGTH))
-                       reverse = false;
-       }
+       if(trace_ent && IS_PLAYER(trace_ent) && !(trace_ent.items & ITEM_Strength.m_itemid))
+               reverse = false;
+       if(trace_ent && IS_MONSTER(trace_ent))
+               reverse = true;
 
        // TODO: fix this... tracing is broken if the floor is thin
        /*
@@ -1292,7 +1287,7 @@ bool Monster_Spawn_Setup(entity this)
        return true;
 }
 
-bool Monster_Spawn(entity this, int mon_id)
+bool Monster_Spawn(entity this, bool check_appear, int mon_id)
 {
        // setup the basic required properties for a monster
        entity mon = Monsters_from(mon_id);
@@ -1303,7 +1298,7 @@ bool Monster_Spawn(entity this, int mon_id)
        if(!(this.spawnflags & MONSTERFLAG_RESPAWNED))
                IL_PUSH(g_monsters, this);
 
-       if(Monster_Appear_Check(this, mon_id)) { return true; } // return true so the monster isn't removed
+       if(check_appear && Monster_Appear_Check(this, mon_id)) { return true; } // return true so the monster isn't removed
 
        if(!this.monster_skill)
                this.monster_skill = cvar("g_monsters_skill");
@@ -1324,8 +1319,9 @@ bool Monster_Spawn(entity this, int mon_id)
        this.flags                              = FL_MONSTER;
        this.classname                  = "monster";
        this.takedamage                 = DAMAGE_AIM;
+       if(!this.bot_attack)
+               IL_PUSH(g_bot_targets, this);
        this.bot_attack                 = true;
-       IL_PUSH(g_bot_targets, this);
        this.iscreature                 = true;
        this.teleportable               = true;
        this.damagedbycontents  = true;
@@ -1350,13 +1346,13 @@ bool Monster_Spawn(entity this, int mon_id)
        this.oldtarget2                 = this.target2;
        this.pass_distance              = 0;
        this.deadflag                   = DEAD_NO;
-       this.noalign                    = ((mon.spawnflags & MONSTER_TYPE_FLY) || (mon.spawnflags & MONSTER_TYPE_SWIM));
        this.spawn_time                 = time;
        this.gravity                    = 1;
        this.monster_moveto             = '0 0 0';
        this.monster_face               = '0 0 0';
        this.dphitcontentsmask  = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_BOTCLIP | DPCONTENTS_MONSTERCLIP;
 
+       if(!this.noalign) { this.noalign = ((mon.spawnflags & MONSTER_TYPE_FLY) || (mon.spawnflags & MONSTER_TYPE_SWIM)); }
        if(!this.scale) { this.scale = 1; }
        if(autocvar_g_monsters_edit) { this.grab = 1; }
        if(autocvar_g_fullbrightplayers) { this.effects |= EF_FULLBRIGHT; }
index 56509cf66130287530503eed396bd3a32fc2d35b..b667373a0f7926496b4633dc16dbc29e69d2b167 100644 (file)
@@ -72,7 +72,7 @@ void Monster_Remove(entity this);
 
 void monsters_setstatus(entity this);
 
-bool Monster_Spawn(entity this, int mon_id);
+bool Monster_Spawn(entity this, bool check_appear, int mon_id);
 
 void monster_setupcolors(entity this);
 
index 9e87e488e624323d336ee9cfcedb36ec651b1ba9..056379dbc41f0a88c9e9f7f03026f694bd511778 100644 (file)
@@ -8,10 +8,8 @@
     #include <server/autocvars.qh>
     #include <server/defs.qh>
 #endif
-entity spawnmonster (string monster, int monster_id, entity spawnedby, entity own, vector orig, bool respwn, bool invincible, int moveflag)
+entity spawnmonster (entity e, string monster, int monster_id, entity spawnedby, entity own, vector orig, bool respwn, bool invincible, int moveflag)
 {
-       entity e = spawn();
-
        e.spawnflags = MONSTERFLAG_SPAWNED;
 
        if(!respwn) { e.spawnflags |= MONSTERFLAG_NORESPAWN; }
@@ -22,7 +20,7 @@ entity spawnmonster (string monster, int monster_id, entity spawnedby, entity ow
        if(monster == "random")
        {
                RandomSelection_Init(); 
-               FOREACH(Monsters, it != MON_Null,
+               FOREACH(Monsters, it != MON_Null && !(it.spawnflags & MONSTER_TYPE_PASSIVE),
                {
                        RandomSelection_AddEnt(it, 1, 1);
                });
@@ -62,7 +60,7 @@ entity spawnmonster (string monster, int monster_id, entity spawnedby, entity ow
        }
 
        // Monster_Spawn checks if monster is valid
-       Monster_Spawn(e, monster_id);
+       Monster_Spawn(e, false, monster_id);
 
        return e;
 }
index 00db84c1cb8372c14525b0bb8a98e5a9335fdfe3..8e4d480cd690ddfbab268494ee512090a74a2881 100644 (file)
@@ -1,3 +1,3 @@
 #pragma once
 
-entity spawnmonster (string monster, int monster_id, entity spawnedby, entity own, vector orig, bool respwn, bool invincible, int moveflag);
+entity spawnmonster (entity e, string monster, int monster_id, entity spawnedby, entity own, vector orig, bool respwn, bool invincible, int moveflag);
index b0c0e582aaa5aab136865d7805bc6a6001d0e1ec..d2094049438414112aab676a98ee430ffbd22cd8 100644 (file)
@@ -654,7 +654,7 @@ void nade_heal_boom(entity this)
 
 void nade_monster_boom(entity this)
 {
-       entity e = spawnmonster(this.pokenade_type, 0, this.realowner, this.realowner, this.origin, false, false, 1);
+       entity e = spawnmonster(spawn(), this.pokenade_type, 0, this.realowner, this.realowner, this.origin, false, false, 1);
 
        if(autocvar_g_nades_pokenade_monster_lifetime > 0)
                e.monster_lifetime = time + autocvar_g_nades_pokenade_monster_lifetime;
index 546e59f2410099f36f94129c8e2e51fca53409a1..7f1bce0ace2741c05340c025a1f49524ce4969e1 100644 (file)
@@ -419,6 +419,8 @@ NET_HANDLE(tuba_instrument, bool)
 void tuba_instrument_send(entity this, int instr)
 {
        msg_entity = this;
+       if (!IS_REAL_CLIENT(this))
+               return;
        int chan = MSG_ONE;
        WriteHeader(chan, tuba_instrument);
        WriteByte(chan, instr);
index ec1f9c89fa7adce3f5887a553f998c701faec3f7..01997d903a5f2e371c9bc2c3e2c77eadd3ed4043 100644 (file)
@@ -391,7 +391,7 @@ void CommonCommand_editmob(int request, entity caller, int argc)
 
                                        totalspawned += 1;
                                        WarpZone_TraceBox(CENTER_OR_VIEWOFS(caller), caller.mins, caller.maxs, CENTER_OR_VIEWOFS(caller) + v_forward * 150, true, caller);
-                                       mon = spawnmonster(arg_lower, 0, caller, caller, trace_endpos, false, false, moveflag);
+                                       mon = spawnmonster(spawn(), arg_lower, 0, caller, caller, trace_endpos, false, false, moveflag);
                                        print_to(caller, strcat("Spawned ", mon.monster_name));
                                        return;
                                }
index a057408b965846b31c1c2bd7e2486b9d03b1fcee..4c0976fe82a2ae58f87ee29ee324434019533cff 100644 (file)
@@ -34,21 +34,21 @@ spawnfunc(invasion_spawnpoint)
        }
 }
 
-int invasion_PickMonster(int supermonster_count)
+Monster invasion_PickMonster(int supermonster_count)
 {
        if(autocvar_g_invasion_zombies_only)
-               return MON_ZOMBIE.monsterid;
+               return MON_ZOMBIE;
 
        RandomSelection_Init();
 
        FOREACH(Monsters, it != MON_Null,
        {
-               if((it.spawnflags & MONSTER_TYPE_FLY) || (it.spawnflags & MONSTER_TYPE_SWIM) || (it.spawnflags & MONSTER_SIZE_QUAKE) || ((it.spawnflags & MON_FLAG_SUPERMONSTER) && supermonster_count >= 1))
+               if((it.spawnflags & MONSTER_TYPE_PASSIVE) || (it.spawnflags & MONSTER_TYPE_FLY) || (it.spawnflags & MONSTER_TYPE_SWIM) || (it.spawnflags & MONSTER_SIZE_QUAKE) || ((it.spawnflags & MON_FLAG_SUPERMONSTER) && supermonster_count >= 1))
                        continue;
-        RandomSelection_AddFloat(it.monsterid, 1, 1);
+        RandomSelection_AddEnt(it, 1, 1);
        });
 
-       return RandomSelection_chosen_float;
+       return RandomSelection_chosen_ent;
 }
 
 entity invasion_PickSpawn()
@@ -64,7 +64,7 @@ entity invasion_PickSpawn()
        return RandomSelection_chosen_ent;
 }
 
-void invasion_SpawnChosenMonster(int mon)
+void invasion_SpawnChosenMonster(Monster mon)
 {
        entity spawn_point, monster;
 
@@ -74,17 +74,17 @@ void invasion_SpawnChosenMonster(int mon)
        {
                LOG_TRACE("Warning: couldn't find any invasion_spawnpoint spawnpoints, attempting to spawn monsters in random locations");
                entity e = spawn();
-               setsize(e, (get_monsterinfo(mon)).mins, (get_monsterinfo(mon)).maxs);
+               setsize(e, mon.mins, mon.maxs);
 
                if(MoveToRandomMapLocation(e, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 10, 1024, 256))
-                       monster = spawnmonster("", mon, NULL, NULL, e.origin, false, false, 2);
+                       monster = spawnmonster(spawn(), "", mon.m_id, NULL, NULL, e.origin, false, false, 2);
                else return;
 
                setthink(e, SUB_Remove);
                e.nextthink = time + 0.1;
        }
        else // if spawnmob field falls through (unset), fallback to mon (relying on spawnmonster for that behaviour)
-               monster = spawnmonster(spawn_point.spawnmob, mon, spawn_point, spawn_point, spawn_point.origin, false, false, 2);
+               monster = spawnmonster(spawn(), spawn_point.spawnmob, mon.m_id, spawn_point, spawn_point, spawn_point.origin, false, false, 2);
 
        if(spawn_point) monster.target2 = spawn_point.target2;
        monster.spawnshieldtime = time;
@@ -125,7 +125,7 @@ void invasion_SpawnChosenMonster(int mon)
 
 void invasion_SpawnMonsters(int supermonster_count)
 {
-       int chosen_monster = invasion_PickMonster(supermonster_count);
+       Monster chosen_monster = invasion_PickMonster(supermonster_count);
 
        invasion_SpawnChosenMonster(chosen_monster);
 }