set g_monsters_skill_hard 5 "Monster hard skill level (used for skill based functions)"
set g_monsters_skill_insane 7 "Monster insane skill level (used for skill based functions)"
set g_monsters_skill_nightmare 10 "Monster nightmare skill level (used for skill based functions)"
-set g_monsters_spawn_list "brute animus shambler bruiser wyvern cerberus slime knight stingray mage zombie spider" "monsters not listed here will spawn as bruisers"
// Brute
set g_monster_brute 1 "Enable Brutes"
float autocvar_g_monsters_skill_hard;
float autocvar_g_monsters_skill_insane;
float autocvar_g_monsters_skill_nightmare;
-string autocvar_g_monsters_spawn_list;
float autocvar_g_touchexplode_radius;
float autocvar_g_touchexplode_damage;
float autocvar_g_touchexplode_edgedamage;
if(tospawn == "list")
{
- sprint(self, "Available monsters:\n");
- sprint(self, strcat(autocvar_g_monsters_spawn_list, "\n"));
+ float i;
+ string list = "Available monsters:";
+
+ for(i = MONSTER_FIRST + 1; i < MONSTER_LAST; ++i)
+ list = strcat(list, " ", monster_id2string(i));
+
+ sprint(self, strcat(list, "\n"));
+
return;
}
makevectors(self.v_angle);
WarpZone_TraceLine(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 150, MOVE_NORMAL, self);
- e = spawnmonster(tospawn, self, self, trace_endpos, FALSE, moveflag);
+ e = spawnmonster(tospawn, 0, self, self, trace_endpos, FALSE, moveflag);
if(mname) e.netname = strzone(mname);
sprint(self, strcat("Spawned 1 ", tospawn, "\n"));
string MapVote_Suggest(string m);
-entity spawnmonster(string monster, entity spawnedby, entity own, vector orig, float respwn, float moveflag);
+entity spawnmonster(string monster, float mnster, entity spawnedby, entity own, vector orig, float respwn, float moveflag);
// used by common/command/generic.qc:GenericCommand_dumpcommands to list all commands into a .txt file
void ClientCommand_macro_write_aliases(float fh);
float MONSTER_SPIDER = 13;
float MONSTER_LAST = 14;
+// id-string converters (TODO: remove these!)
+string monster_id2string(float mnster)
+{
+ switch(mnster)
+ {
+ case MONSTER_ZOMBIE: return "zombie";
+ case MONSTER_BRUTE: return "brute";
+ case MONSTER_ANIMUS: return "animus";
+ case MONSTER_SHAMBLER: return "shambler";
+ case MONSTER_BRUISER: return "bruiser";
+ case MONSTER_WYVERN: return "wyvern";
+ case MONSTER_CERBERUS: return "cerberus";
+ case MONSTER_SLIME: return "slime";
+ case MONSTER_KNIGHT: return "knight";
+ case MONSTER_STINGRAY: return "stingray";
+ case MONSTER_MAGE: return "mage";
+ case MONSTER_SPIDER: return "spider";
+ default: return "";
+ }
+}
+float monster_string2id(string monster)
+{
+ switch(monster)
+ {
+ case "zombie": return MONSTER_ZOMBIE;
+ case "brute": return MONSTER_BRUTE;
+ case "animus": return MONSTER_ANIMUS;
+ case "shambler": return MONSTER_SHAMBLER;
+ case "bruiser": return MONSTER_BRUISER;
+ case "wyvern": return MONSTER_WYVERN;
+ case "cerberus": return MONSTER_CERBERUS;
+ case "slime": return MONSTER_SLIME;
+ case "knight": return MONSTER_KNIGHT;
+ case "stingray": return MONSTER_STINGRAY;
+ case "mage": return MONSTER_MAGE;
+ case "spider": return MONSTER_SPIDER;
+ default: return 0;
+ }
+}
+
float MSF_UPDATE = 2;
float MSF_STATUS = 4;
float MSF_SETUP = 8;
-float spawnmonster_checkinlist(string monster, string list)
-{
- string l = strcat(" ", list, " ");
-
- if(strstrofs(l, strcat(" ", monster, " "), 0) >= 0)
- return TRUE;
-
- return FALSE;
-}
-
-entity spawnmonster (string monster, entity spawnedby, entity own, vector orig, float respwn, float moveflag)
+entity spawnmonster (string monster, float mnster, entity spawnedby, entity own, vector orig, float respwn, float moveflag)
{
if(!spawncode_first_load)
{
setorigin(e, orig);
- if not(spawnmonster_checkinlist(monster, autocvar_g_monsters_spawn_list))
+ if(monster != "")
+ if not(monster_string2id(monster))
monster = "bruiser";
+
+ if(monster == "")
+ if(mnster)
+ monster = monster_id2string(mnster);
e.realowner = spawnedby;
return RandomSelection_chosen_ent;
}
-void TD_SpawnMonster(float tm, string mnster)
+void TD_SpawnMonster(float tm, float monster)
{
entity e, mon;
return;
}
- mon = spawnmonster(mnster, e, e, e.origin, FALSE, 2);
+ mon = spawnmonster("", monster, e, e, e.origin, FALSE, 2);
if(e.target2)
{
if(random() <= 0.5 && e.target)
mon.target2 = e.target;
}
-string monster_type2string(float mnster)
-{
- switch(mnster)
- {
- case MONSTER_ZOMBIE: return "zombie";
- case MONSTER_BRUTE: return "brute";
- case MONSTER_ANIMUS: return "animus";
- case MONSTER_SHAMBLER: return "shambler";
- case MONSTER_BRUISER: return "bruiser";
- case MONSTER_WYVERN: return "wyvern";
- case MONSTER_CERBERUS: return "cerberus";
- case MONSTER_SLIME: return "slime";
- case MONSTER_KNIGHT: return "knight";
- case MONSTER_STINGRAY: return "stingray";
- case MONSTER_MAGE: return "mage";
- case MONSTER_SPIDER: return "spider";
- default: return "";
- }
-}
-
float RandomMonster()
{
RandomSelection_Init();
whichmon = RandomMonster();
- TD_SpawnMonster(tm, monster_type2string(whichmon));
+ TD_SpawnMonster(tm, whichmon);
}
entity PickGenerator(float tm)