From: TimePath Date: Sat, 27 Aug 2016 01:49:25 +0000 (+1000) Subject: Monsters: #undef IMPLEMENTATION X-Git-Tag: xonotic-v0.8.2~662 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7659c838b7bae69973b91f527c7ca67911f0d858;p=xonotic%2Fxonotic-data.pk3dir.git Monsters: #undef IMPLEMENTATION --- diff --git a/qcsrc/common/_all.inc b/qcsrc/common/_all.inc index f528eee6d..5177c9dfd 100644 --- a/qcsrc/common/_all.inc +++ b/qcsrc/common/_all.inc @@ -43,7 +43,7 @@ float autocvar_net_connecttimeout = 30; #include "items/_mod.inc" #include "weapons/_all.inc" - #include "monsters/all.qc" + #include "monsters/_mod.inc" #include "turrets/all.qc" #include "vehicles/all.qc" diff --git a/qcsrc/common/animdecide.qc b/qcsrc/common/animdecide.qc index ab389278d..b53a9ba0e 100644 --- a/qcsrc/common/animdecide.qc +++ b/qcsrc/common/animdecide.qc @@ -1,6 +1,6 @@ #include "animdecide.qh" -#include +#include #if defined(SVQC) #include "util.qh" diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index f3213527b..47104bb2d 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -6,7 +6,7 @@ #elif defined(MENUQC) #elif defined(SVQC) #include "util.qh" - #include + #include #endif // generic string stuff diff --git a/qcsrc/common/monsters/_all.inc b/qcsrc/common/monsters/_all.inc deleted file mode 100644 index 8bc63f720..000000000 --- a/qcsrc/common/monsters/_all.inc +++ /dev/null @@ -1,2 +0,0 @@ -#include "_all.qh" -#include "_mod.inc" diff --git a/qcsrc/common/monsters/_all.qh b/qcsrc/common/monsters/_all.qh deleted file mode 100644 index 947026dd5..000000000 --- a/qcsrc/common/monsters/_all.qh +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -#include "_mod.qh" diff --git a/qcsrc/common/monsters/_mod.inc b/qcsrc/common/monsters/_mod.inc index 0478f09ee..be50e5503 100644 --- a/qcsrc/common/monsters/_mod.inc +++ b/qcsrc/common/monsters/_mod.inc @@ -1,6 +1,10 @@ // generated file; do not modify #include -#include #ifdef SVQC #include #endif +#ifdef SVQC + #include +#endif + +#include diff --git a/qcsrc/common/monsters/_mod.qh b/qcsrc/common/monsters/_mod.qh index 39d594e4c..55204bd1a 100644 --- a/qcsrc/common/monsters/_mod.qh +++ b/qcsrc/common/monsters/_mod.qh @@ -1,6 +1,10 @@ // generated file; do not modify #include -#include #ifdef SVQC #include #endif +#ifdef SVQC + #include +#endif + +#include diff --git a/qcsrc/common/monsters/all.qc b/qcsrc/common/monsters/all.qc index a262a2345..9dc09ca39 100644 --- a/qcsrc/common/monsters/all.qc +++ b/qcsrc/common/monsters/all.qc @@ -1,6 +1,4 @@ #include "all.qh" -#ifndef MONSTERS_ALL_C -#define MONSTERS_ALL_C string M_Model(string m_mdl) { @@ -12,16 +10,3 @@ string M_Model(string m_mdl) return output; #endif } - -#include "all.qh" - -#define IMPLEMENTATION -#include "monster/_mod.inc" -#undef IMPLEMENTATION - -#ifdef SVQC -#include "spawn.qc" -#include "sv_monsters.qc" -#endif - -#endif diff --git a/qcsrc/common/monsters/all.qh b/qcsrc/common/monsters/all.qh index 84f7a0d78..89b5591b4 100644 --- a/qcsrc/common/monsters/all.qh +++ b/qcsrc/common/monsters/all.qh @@ -14,6 +14,3 @@ const int MON_FIRST = 1; #define REGISTER_MONSTER(id, inst) REGISTER(Monsters, MON, id, monsterid, inst) REGISTER_MONSTER(Null, NEW(Monster)); - - -#include "monster/_mod.inc" diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index 628f3e5ea..30d09807f 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -1,7 +1,5 @@ #include "mage.qh" -#ifdef IMPLEMENTATION - #ifdef SVQC SOUND(MageSpike_FIRE, W_Sound("electro_fire")); @@ -475,5 +473,3 @@ METHOD(Mage, mr_precache, bool(Mage this)) return true; } #endif - -#endif diff --git a/qcsrc/common/monsters/monster/shambler.qc b/qcsrc/common/monsters/monster/shambler.qc index 1abe2e9c8..8f84bdce3 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -1,7 +1,5 @@ #include "shambler.qh" -#ifdef IMPLEMENTATION - #ifdef SVQC float autocvar_g_monster_shambler_health; float autocvar_g_monster_shambler_damageforcescale = 0.1; @@ -274,5 +272,3 @@ METHOD(Shambler, mr_precache, bool(Shambler this)) return true; } #endif - -#endif diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index 4a0c29a17..d2cb8313e 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -1,7 +1,5 @@ #include "spider.qh" -#ifdef IMPLEMENTATION - #ifdef SVQC .float spider_slowness; // effect time of slowness inflicted by spiders @@ -252,5 +250,3 @@ METHOD(Spider, mr_precache, bool(Spider this)) return true; } #endif - -#endif diff --git a/qcsrc/common/monsters/monster/wyvern.qc b/qcsrc/common/monsters/monster/wyvern.qc index a05b462a0..3fd7ec967 100644 --- a/qcsrc/common/monsters/monster/wyvern.qc +++ b/qcsrc/common/monsters/monster/wyvern.qc @@ -1,7 +1,5 @@ #include "wyvern.qh" -#ifdef IMPLEMENTATION - #ifdef SVQC float autocvar_g_monster_wyvern_attack_fireball_damage; @@ -173,5 +171,3 @@ METHOD(Wyvern, mr_precache, bool(Wyvern this)) return true; } #endif - -#endif diff --git a/qcsrc/common/monsters/monster/zombie.qc b/qcsrc/common/monsters/monster/zombie.qc index 3f43ea0f0..c48c2108f 100644 --- a/qcsrc/common/monsters/monster/zombie.qc +++ b/qcsrc/common/monsters/monster/zombie.qc @@ -1,7 +1,5 @@ #include "zombie.qh" -#ifdef IMPLEMENTATION - #ifdef SVQC float autocvar_g_monster_zombie_health; float autocvar_g_monster_zombie_damageforcescale = 0.55; @@ -210,5 +208,3 @@ METHOD(Zombie, mr_precache, bool(Zombie this)) return true; } #endif - -#endif diff --git a/qcsrc/common/monsters/spawn.qc b/qcsrc/common/monsters/spawn.qc deleted file mode 100644 index 6c72ada30..000000000 --- a/qcsrc/common/monsters/spawn.qc +++ /dev/null @@ -1,70 +0,0 @@ -#include "spawn.qh" -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../util.qh" - #include "all.qh" - #include "sv_monsters.qh" - #include "spawn.qh" - #include - #include -#endif -entity spawnmonster (string monster, float monster_id, entity spawnedby, entity own, vector orig, float respwn, float invincible, float moveflag) -{ - float i; - entity e = spawn(); - - e.spawnflags = MONSTERFLAG_SPAWNED; - - if(!respwn) { e.spawnflags |= MONSTERFLAG_NORESPAWN; } - if(invincible) { e.spawnflags |= MONSTERFLAG_INVINCIBLE; } - - setorigin(e, orig); - - if(monster == "random") - { - RandomSelection_Init(); - for(i = MON_FIRST; i <= MON_LAST; ++i) - RandomSelection_Add(NULL, i, string_null, 1, 1); - - monster_id = RandomSelection_chosen_float; - } - else if(monster != "") - { - float found = 0; - entity mon; - for(i = MON_FIRST; i <= MON_LAST; ++i) - { - mon = get_monsterinfo(i); - if(mon.netname == monster) - { - found = true; - monster_id = mon.monsterid; // we have the monster, old monster id is no longer required - break; - } - } - if(!found) - monster_id = ((monster_id > 0) ? monster_id : MON_FIRST); - } - - e.realowner = spawnedby; - - if(moveflag) - e.monster_moveflags = moveflag; - - if(IS_PLAYER(spawnedby)) - { - if(teamplay && autocvar_g_monsters_teams) - e.team = spawnedby.team; // colors handled in spawn code - - if(autocvar_g_monsters_owners) - e.monster_follow = own; // using .owner makes the monster non-solid for its master - - e.angles_y = spawnedby.angles_y; - } - - // Monster_Spawn checks if monster is valid - Monster_Spawn(e, monster_id); - - return e; -} diff --git a/qcsrc/common/monsters/spawn.qh b/qcsrc/common/monsters/spawn.qh deleted file mode 100644 index 0aba5c19d..000000000 --- a/qcsrc/common/monsters/spawn.qh +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -entity spawnmonster (string monster, float monster_id, entity spawnedby, entity own, vector orig, float respwn, float invincible, float moveflag); diff --git a/qcsrc/common/monsters/sv_spawn.qc b/qcsrc/common/monsters/sv_spawn.qc new file mode 100644 index 000000000..50373cc2a --- /dev/null +++ b/qcsrc/common/monsters/sv_spawn.qc @@ -0,0 +1,69 @@ +#include "sv_spawn.qh" +#if defined(CSQC) +#elif defined(MENUQC) +#elif defined(SVQC) + #include "../util.qh" + #include "all.qh" + #include "sv_monsters.qh" + #include + #include +#endif +entity spawnmonster (string monster, float monster_id, entity spawnedby, entity own, vector orig, float respwn, float invincible, float moveflag) +{ + float i; + entity e = spawn(); + + e.spawnflags = MONSTERFLAG_SPAWNED; + + if(!respwn) { e.spawnflags |= MONSTERFLAG_NORESPAWN; } + if(invincible) { e.spawnflags |= MONSTERFLAG_INVINCIBLE; } + + setorigin(e, orig); + + if(monster == "random") + { + RandomSelection_Init(); + for(i = MON_FIRST; i <= MON_LAST; ++i) + RandomSelection_Add(NULL, i, string_null, 1, 1); + + monster_id = RandomSelection_chosen_float; + } + else if(monster != "") + { + float found = 0; + entity mon; + for(i = MON_FIRST; i <= MON_LAST; ++i) + { + mon = get_monsterinfo(i); + if(mon.netname == monster) + { + found = true; + monster_id = mon.monsterid; // we have the monster, old monster id is no longer required + break; + } + } + if(!found) + monster_id = ((monster_id > 0) ? monster_id : MON_FIRST); + } + + e.realowner = spawnedby; + + if(moveflag) + e.monster_moveflags = moveflag; + + if(IS_PLAYER(spawnedby)) + { + if(teamplay && autocvar_g_monsters_teams) + e.team = spawnedby.team; // colors handled in spawn code + + if(autocvar_g_monsters_owners) + e.monster_follow = own; // using .owner makes the monster non-solid for its master + + e.angles_y = spawnedby.angles_y; + } + + // Monster_Spawn checks if monster is valid + Monster_Spawn(e, monster_id); + + return e; +} diff --git a/qcsrc/common/monsters/sv_spawn.qh b/qcsrc/common/monsters/sv_spawn.qh new file mode 100644 index 000000000..0aba5c19d --- /dev/null +++ b/qcsrc/common/monsters/sv_spawn.qh @@ -0,0 +1,3 @@ +#pragma once + +entity spawnmonster (string monster, float monster_id, entity spawnedby, entity own, vector orig, float respwn, float invincible, float moveflag); diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index c8114694f..c4e73d286 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -146,7 +146,7 @@ void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expan #ifdef SVQC #include -#include +#include #include #include diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 6e4b05a91..8a4446678 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -18,7 +18,7 @@ #include "triggers/subs.qh" #include "util.qh" - #include + #include #include diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index dfdbd7656..cf55aa652 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -27,7 +27,7 @@ #include "../stats.qh" #include "../teams.qh" #include "../util.qh" - #include "../monsters/all.qh" + #include "../monsters/_mod.qh" #include "config.qh" #include #include diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 185fe8fb4..9f763a886 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -14,7 +14,7 @@ #include -#include "../common/monsters/all.qh" +#include "../common/monsters/_mod.qh" #include diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index e23f9bc98..ce6592408 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -30,8 +30,8 @@ #include -#include -#include +#include +#include #include #include diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 357a33eba..35418a02f 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -4,7 +4,7 @@ #include "../scores.qh" -#include +#include #include #include diff --git a/qcsrc/server/command/common.qh b/qcsrc/server/command/common.qh index 7fbbddf7d..978a92b14 100644 --- a/qcsrc/server/command/common.qh +++ b/qcsrc/server/command/common.qh @@ -19,7 +19,7 @@ STATIC_INIT(COMMON_COMMANDS_aliases) { } #include "vote.qh" -#include +#include #include diff --git a/qcsrc/server/command/getreplies.qc b/qcsrc/server/command/getreplies.qc index 259872471..9380fc4cd 100644 --- a/qcsrc/server/command/getreplies.qc +++ b/qcsrc/server/command/getreplies.qc @@ -8,7 +8,7 @@ #include #include -#include +#include // ========================================================= // Reply messages for common commands, re-worked by Samual diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 89e205c2b..8e8afde9f 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -21,7 +21,7 @@ #include "../common/constants.qh" #include "../common/deathtypes/all.qh" #include "../common/mapinfo.qh" -#include "../common/monsters/all.qh" +#include "../common/monsters/_mod.qh" #include "../common/monsters/sv_monsters.qh" #include "../common/vehicles/all.qh" #include "../common/notifications/all.qh" diff --git a/qcsrc/server/item_key.qc b/qcsrc/server/item_key.qc index 05172241c..d33fe87c2 100644 --- a/qcsrc/server/item_key.qc +++ b/qcsrc/server/item_key.qc @@ -1,7 +1,7 @@ #include "item_key.qh" #include "../common/triggers/subs.qh" -#include "../common/monsters/all.qh" +#include "../common/monsters/_mod.qh" #include "../common/notifications/all.qh" #include "../common/util.qh" #include "../lib/warpzone/util_server.qh" diff --git a/qcsrc/server/mutators/gamemode.qh b/qcsrc/server/mutators/gamemode.qh index ba3e48f17..9a473affd 100644 --- a/qcsrc/server/mutators/gamemode.qh +++ b/qcsrc/server/mutators/gamemode.qh @@ -21,9 +21,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include @@ -81,7 +81,7 @@ #include -#include +#include #include #include diff --git a/qcsrc/server/mutators/mutator.qh b/qcsrc/server/mutators/mutator.qh index 9c13e1bb6..e051cd697 100644 --- a/qcsrc/server/mutators/mutator.qh +++ b/qcsrc/server/mutators/mutator.qh @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include diff --git a/qcsrc/server/mutators/mutator/gamemode_invasion.qc b/qcsrc/server/mutators/mutator/gamemode_invasion.qc index d43d50482..66cd022fd 100644 --- a/qcsrc/server/mutators/mutator/gamemode_invasion.qc +++ b/qcsrc/server/mutators/mutator/gamemode_invasion.qc @@ -1,6 +1,6 @@ #include "gamemode_invasion.qh" -#include +#include #include #include diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 13f32ee14..2a6cd03a4 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include