From: TimePath <andrew.hardaker1995@gmail.com> 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 f528eee6db..5177c9dfd1 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 ab389278d1..b53a9ba0e9 100644 --- a/qcsrc/common/animdecide.qc +++ b/qcsrc/common/animdecide.qc @@ -1,6 +1,6 @@ #include "animdecide.qh" -#include <common/monsters/all.qh> +#include <common/monsters/_mod.qh> #if defined(SVQC) #include "util.qh" diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index f3213527ba..47104bb2dc 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 <common/monsters/all.qh> + #include <common/monsters/_mod.qh> #endif // generic string stuff diff --git a/qcsrc/common/monsters/_all.inc b/qcsrc/common/monsters/_all.inc deleted file mode 100644 index 8bc63f720a..0000000000 --- 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 947026dd59..0000000000 --- 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 0478f09eec..be50e5503f 100644 --- a/qcsrc/common/monsters/_mod.inc +++ b/qcsrc/common/monsters/_mod.inc @@ -1,6 +1,10 @@ // generated file; do not modify #include <common/monsters/all.qc> -#include <common/monsters/spawn.qc> #ifdef SVQC #include <common/monsters/sv_monsters.qc> #endif +#ifdef SVQC + #include <common/monsters/sv_spawn.qc> +#endif + +#include <common/monsters/monster/_mod.inc> diff --git a/qcsrc/common/monsters/_mod.qh b/qcsrc/common/monsters/_mod.qh index 39d594e4c5..55204bd1a7 100644 --- a/qcsrc/common/monsters/_mod.qh +++ b/qcsrc/common/monsters/_mod.qh @@ -1,6 +1,10 @@ // generated file; do not modify #include <common/monsters/all.qh> -#include <common/monsters/spawn.qh> #ifdef SVQC #include <common/monsters/sv_monsters.qh> #endif +#ifdef SVQC + #include <common/monsters/sv_spawn.qh> +#endif + +#include <common/monsters/monster/_mod.qh> diff --git a/qcsrc/common/monsters/all.qc b/qcsrc/common/monsters/all.qc index a262a23450..9dc09ca394 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 84f7a0d78f..89b5591b4d 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 628f3e5eaa..30d09807f2 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 1abe2e9c87..8f84bdce31 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 4a0c29a171..d2cb8313e3 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 a05b462a0e..3fd7ec9676 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 3f43ea0f09..c48c2108fa 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 6c72ada302..0000000000 --- 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 <server/autocvars.qh> - #include <server/defs.qh> -#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 0aba5c19d4..0000000000 --- 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 0000000000..50373cc2a2 --- /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 <server/autocvars.qh> + #include <server/defs.qh> +#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 0000000000..0aba5c19d4 --- /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 c8114694f5..c4e73d286d 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 <common/gamemodes/_mod.qh> -#include <common/monsters/spawn.qh> +#include <common/monsters/sv_spawn.qh> #include <common/monsters/sv_monsters.qh> #include <server/g_subs.qh> diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 6e4b05a912..8a44466785 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 <common/monsters/all.qh> + #include <common/monsters/_mod.qh> #include <common/weapons/_all.qh> diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index dfdbd76566..cf55aa6521 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 <server/weapons/csqcprojectile.qh> #include <server/weapons/tracing.qh> diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 185fe8fb4e..9f763a886d 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -14,7 +14,7 @@ #include <common/physics/player.qh> -#include "../common/monsters/all.qh" +#include "../common/monsters/_mod.qh" #include <common/weapons/_all.qh> diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index e23f9bc989..ce6592408c 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -30,8 +30,8 @@ #include <common/minigames/sv_minigames.qh> -#include <common/monsters/all.qc> -#include <common/monsters/spawn.qh> +#include <common/monsters/_mod.qh> +#include <common/monsters/sv_spawn.qh> #include <common/monsters/sv_monsters.qh> #include <lib/warpzone/common.qh> diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 357a33eba2..35418a02f0 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -4,7 +4,7 @@ #include "../scores.qh" -#include <common/monsters/all.qh> +#include <common/monsters/_mod.qh> #include <common/notifications/all.qh> #include <lib/warpzone/common.qh> diff --git a/qcsrc/server/command/common.qh b/qcsrc/server/command/common.qh index 7fbbddf7d7..978a92b14f 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 <common/monsters/spawn.qh> +#include <common/monsters/sv_spawn.qh> #include <common/command/_mod.qh> diff --git a/qcsrc/server/command/getreplies.qc b/qcsrc/server/command/getreplies.qc index 2598724717..9380fc4cde 100644 --- a/qcsrc/server/command/getreplies.qc +++ b/qcsrc/server/command/getreplies.qc @@ -8,7 +8,7 @@ #include <common/mapinfo.qh> #include <common/util.qh> -#include <common/monsters/all.qh> +#include <common/monsters/_mod.qh> // ========================================================= // Reply messages for common commands, re-worked by Samual diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 89e205c2b1..8e8afde9fd 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 05172241c3..d33fe87c2e 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 ba3e48f17c..9a473affdf 100644 --- a/qcsrc/server/mutators/gamemode.qh +++ b/qcsrc/server/mutators/gamemode.qh @@ -21,9 +21,9 @@ #include <common/command/_mod.qh> #include <common/net_notice.qh> #include <common/animdecide.qh> -#include <common/monsters/all.qh> +#include <common/monsters/_mod.qh> #include <common/monsters/sv_monsters.qh> -#include <common/monsters/spawn.qh> +#include <common/monsters/sv_spawn.qh> #include <common/weapons/config.qh> #include <common/weapons/_all.qh> #include <server/weapons/accuracy.qh> @@ -81,7 +81,7 @@ #include <server/command/_mod.qh> -#include <common/monsters/all.qh> +#include <common/monsters/_mod.qh> #include <server/weapons/tracing.qh> #include <server/weapons/weaponsystem.qh> diff --git a/qcsrc/server/mutators/mutator.qh b/qcsrc/server/mutators/mutator.qh index 9c13e1bb63..e051cd6978 100644 --- a/qcsrc/server/mutators/mutator.qh +++ b/qcsrc/server/mutators/mutator.qh @@ -27,7 +27,7 @@ #include <common/stats.qh> #include <common/teams.qh> -#include <common/monsters/all.qh> +#include <common/monsters/_mod.qh> #include <lib/warpzone/anglestransform.qh> #include <lib/warpzone/server.qh> diff --git a/qcsrc/server/mutators/mutator/gamemode_invasion.qc b/qcsrc/server/mutators/mutator/gamemode_invasion.qc index d43d504821..66cd022fd6 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 <common/monsters/spawn.qh> +#include <common/monsters/sv_spawn.qh> #include <common/monsters/sv_monsters.qh> #include <server/teamplay.qh> diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 13f32ee14d..2a6cd03a4d 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -8,7 +8,7 @@ #include <common/t_items.qh> #include <common/animdecide.qh> #include <common/constants.qh> -#include <common/monsters/all.qh> +#include <common/monsters/_mod.qh> #include <common/notifications/all.qh> #include <common/util.qh> #include <common/weapons/_all.qh>