From: Mario Date: Thu, 24 Oct 2013 10:46:27 +0000 (+1100) Subject: Remove monster config system to fix compile X-Git-Tag: xonotic-v0.8.0~241^2^2~31 X-Git-Url: https://de.git.xonotic.org/?a=commitdiff_plain;h=981bf0bd7fcd4f69b3ae896a79b2095ff3c81a0d;p=xonotic%2Fxonotic-data.pk3dir.git Remove monster config system to fix compile --- diff --git a/qcsrc/common/command/generic.qc b/qcsrc/common/command/generic.qc index 8a564b8e7..4ca8b3780 100644 --- a/qcsrc/common/command/generic.qc +++ b/qcsrc/common/command/generic.qc @@ -227,59 +227,6 @@ void GenericCommand_dumpcommands(float request) } } -void GenericCommand_dumpmonsters(float request) -{ - switch(request) - { - case CMD_REQUEST_COMMAND: - { - #ifdef SVQC - mon_config_file = -1; - mon_config_alsoprint = -1; - string filename = argv(1); - - if(filename == "") - { - filename = "monsters_dump.cfg"; - mon_config_alsoprint = FALSE; - } - else if(filename == "-") - { - filename = "monsters_dump.cfg"; - mon_config_alsoprint = TRUE; - } - mon_config_file = fopen(filename, FILE_WRITE); - - if(mon_config_file >= 0) - { - Dump_Monster_Settings(); - print(sprintf("Dumping monsters... File located in ^2data/data/%s^7.\n", filename)); - fclose(mon_config_file); - mon_config_file = -1; - mon_config_alsoprint = -1; - } - else - { - print(sprintf("^1Error: ^7Could not open file '%s'!\n", filename)); - } - #else - print(_("Monsters dump command only works with sv_cmd.\n")); - #endif - return; - } - - default: - case CMD_REQUEST_USAGE: - { - print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpmonsters [filename]")); - print(" Where 'filename' is the file to write (default is monsters_dump.cfg),\n"); - print(" if supplied with '-' output to console as well as default,\n"); - print(" if left blank, it will only write to default.\n"); - return; - } - } -} - void GenericCommand_dumpnotifs(float request) { switch(request) @@ -637,7 +584,6 @@ void GenericCommand_(float request) #define GENERIC_COMMANDS(request,arguments,command) \ GENERIC_COMMAND("addtolist", GenericCommand_addtolist(request, arguments), "Add a string to a cvar") \ GENERIC_COMMAND("dumpcommands", GenericCommand_dumpcommands(request), "Dump all commands on the program to *_cmd_dump.txt") \ - GENERIC_COMMAND("dumpmonsters", GenericCommand_dumpmonsters(request), "Dump all monsters into monsters_dump.cfg") \ GENERIC_COMMAND("dumpnotifs", GenericCommand_dumpnotifs(request), "Dump all notifications into notifications_dump.txt") \ GENERIC_COMMAND("maplist", GenericCommand_maplist(request, arguments), "Automatic control of maplist") \ GENERIC_COMMAND("nextframe", GenericCommand_nextframe(request, arguments, command), "Execute the given command next frame of this VM") \ diff --git a/qcsrc/common/monsters/config.qc b/qcsrc/common/monsters/config.qc deleted file mode 100644 index a568db3d3..000000000 --- a/qcsrc/common/monsters/config.qc +++ /dev/null @@ -1,62 +0,0 @@ -// ========================== -// Monster Config Generator -// ========================== - -void M_Config_Queue_Swap(float root, float child, entity pass) -{ - string oldroot = mon_config_queue[root]; - mon_config_queue[root] = mon_config_queue[child]; - mon_config_queue[child] = oldroot; -} - -float M_Config_Queue_Compare(float root, float child, entity pass) -{ - float i, r, c; - - for(i = 1; i <= 100; ++i) - { - r = str2chr(mon_config_queue[root], i); - c = str2chr(mon_config_queue[child], i); - if(r == c) { continue; } - else if(c > r) { return -1; } - else { return 1; } - } - - return 0; -} - -void Dump_Monster_Settings(void) -{ - float i, x, totalsettings = 0; - for(i = MON_FIRST; i <= MON_LAST; ++i) - { - // step 1: clear the queue - MON_CONFIG_COUNT = 0; - for(x = 0; x <= MAX_MON_CONFIG; ++x) - { mon_config_queue[x] = string_null; } - - // step 2: build new queue - MON_ACTION(i, MR_CONFIG); - - // step 3: sort queue - heapsort(MON_CONFIG_COUNT, M_Config_Queue_Swap, M_Config_Queue_Compare, world); - - // step 4: write queue - MON_CONFIG_WRITETOFILE(sprintf("// {{{ #%d: %s\n", i, M_NAME(i))) - for(x = 0; x <= MON_CONFIG_COUNT; ++x) - { MON_CONFIG_WRITETOFILE(mon_config_queue[x]) } - MON_CONFIG_WRITETOFILE("// }}}\n") - - // step 5: debug info - print(sprintf("#%d: %s: %d settings...\n", i, M_NAME(i), MON_CONFIG_COUNT)); - totalsettings += MON_CONFIG_COUNT; - } - - // clear queue now that we're finished - MON_CONFIG_COUNT = 0; - for(x = 0; x <= MAX_MON_CONFIG; ++x) - { mon_config_queue[x] = string_null; } - - // extra information - print(sprintf("Totals: %d monsters, %d settings\n", (i - 1), totalsettings)); -} diff --git a/qcsrc/common/monsters/config.qh b/qcsrc/common/monsters/config.qh deleted file mode 100644 index 5a44c178b..000000000 --- a/qcsrc/common/monsters/config.qh +++ /dev/null @@ -1,29 +0,0 @@ -// ========================== -// Monster Config Generator -// ========================== - -void Dump_Monster_Settings(void); -float mon_config_file; -float mon_config_alsoprint; - -#define MAX_MON_CONFIG 256 -float MON_CONFIG_COUNT; -string mon_config_queue[MAX_MON_CONFIG]; - -#define MON_CONFIG_QUEUE(a) { \ - mon_config_queue[MON_CONFIG_COUNT] = a; \ - ++MON_CONFIG_COUNT; } - -#define MON_CONFIG_WRITETOFILE(a) { \ - fputs(mon_config_file, a); \ - if(mon_config_alsoprint) { print(a); } } - -#define MON_CONFIG_WRITE_CVARS(monster,name) \ - { MON_CONFIG_QUEUE( \ - sprintf("set g_monster_%s_%s %g\n", #monster, #name, \ - cvar(sprintf("g_monster_%s_%s", #monster, #name)))) } \ - -#define MON_CONFIG_SETTINGS(monsettings) \ - #define MON_ADD_CVAR(monster,name) MON_CONFIG_WRITE_CVARS(monster,name) \ - monsettings \ - #undef MON_ADD_CVAR diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index cd7cf6210..83b079749 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -9,40 +9,36 @@ REGISTER_MONSTER( /* fullname */ _("Mage") ); -#define MAGE_SETTINGS(monster) \ - MON_ADD_CVAR(monster, health) \ - MON_ADD_CVAR(monster, attack_spike_damage) \ - MON_ADD_CVAR(monster, attack_spike_radius) \ - MON_ADD_CVAR(monster, attack_spike_delay) \ - MON_ADD_CVAR(monster, attack_spike_accel) \ - MON_ADD_CVAR(monster, attack_spike_decel) \ - MON_ADD_CVAR(monster, attack_spike_turnrate) \ - MON_ADD_CVAR(monster, attack_spike_speed_max) \ - MON_ADD_CVAR(monster, attack_spike_smart) \ - MON_ADD_CVAR(monster, attack_spike_smart_trace_min) \ - MON_ADD_CVAR(monster, attack_spike_smart_trace_max) \ - MON_ADD_CVAR(monster, attack_spike_smart_mindist) \ - MON_ADD_CVAR(monster, attack_push_damage) \ - MON_ADD_CVAR(monster, attack_push_radius) \ - MON_ADD_CVAR(monster, attack_push_delay) \ - MON_ADD_CVAR(monster, attack_push_force) \ - MON_ADD_CVAR(monster, heal_self) \ - MON_ADD_CVAR(monster, heal_allies) \ - MON_ADD_CVAR(monster, heal_minhealth) \ - MON_ADD_CVAR(monster, heal_range) \ - MON_ADD_CVAR(monster, heal_delay) \ - MON_ADD_CVAR(monster, shield_time) \ - MON_ADD_CVAR(monster, shield_delay) \ - MON_ADD_CVAR(monster, shield_blockpercent) \ - MON_ADD_CVAR(monster, speed_stop) \ - MON_ADD_CVAR(monster, speed_run) \ - MON_ADD_CVAR(monster, speed_walk) - -#ifdef SVQC -MAGE_SETTINGS(mage) -#endif // SVQC #else #ifdef SVQC +float autocvar_g_monster_mage_health; +float autocvar_g_monster_mage_attack_spike_damage; +float autocvar_g_monster_mage_attack_spike_radius; +float autocvar_g_monster_mage_attack_spike_delay; +float autocvar_g_monster_mage_attack_spike_accel; +float autocvar_g_monster_mage_attack_spike_decel; +float autocvar_g_monster_mage_attack_spike_turnrate; +float autocvar_g_monster_mage_attack_spike_speed_max; +float autocvar_g_monster_mage_attack_spike_smart; +float autocvar_g_monster_mage_attack_spike_smart_trace_min; +float autocvar_g_monster_mage_attack_spike_smart_trace_max; +float autocvar_g_monster_mage_attack_spike_smart_mindist; +float autocvar_g_monster_mage_attack_push_damage; +float autocvar_g_monster_mage_attack_push_radius; +float autocvar_g_monster_mage_attack_push_delay; +float autocvar_g_monster_mage_attack_push_force; +float autocvar_g_monster_mage_heal_self; +float autocvar_g_monster_mage_heal_allies; +float autocvar_g_monster_mage_heal_minhealth; +float autocvar_g_monster_mage_heal_range; +float autocvar_g_monster_mage_heal_delay; +float autocvar_g_monster_mage_shield_time; +float autocvar_g_monster_mage_shield_delay; +float autocvar_g_monster_mage_shield_blockpercent; +float autocvar_g_monster_mage_speed_stop; +float autocvar_g_monster_mage_speed_run; +float autocvar_g_monster_mage_speed_walk; + const float mage_anim_idle = 0; const float mage_anim_walk = 1; const float mage_anim_attack = 2; @@ -91,7 +87,7 @@ void mage_spike_explode() self.realowner.mage_spike = world; pointparticles(particleeffectnum("explosion_small"), self.origin, '0 0 0', 1); - RadiusDamage (self, self.realowner, MON_CVAR(mage, attack_spike_damage), MON_CVAR(mage, attack_spike_damage) * 0.5, MON_CVAR(mage, attack_spike_radius), world, 0, DEATH_MONSTER_MAGE, other); + RadiusDamage (self, self.realowner, (autocvar_g_monster_mage_attack_spike_damage), (autocvar_g_monster_mage_attack_spike_damage) * 0.5, (autocvar_g_monster_mage_attack_spike_radius), world, 0, DEATH_MONSTER_MAGE, other); remove (self); } @@ -120,9 +116,9 @@ void mage_spike_think() spd = vlen(self.velocity); spd = bound( - spd - MON_CVAR(mage, attack_spike_decel) * frametime, - MON_CVAR(mage, attack_spike_speed_max), - spd + MON_CVAR(mage, attack_spike_accel) * frametime + spd - (autocvar_g_monster_mage_attack_spike_decel) * frametime, + (autocvar_g_monster_mage_attack_spike_speed_max), + spd + (autocvar_g_monster_mage_attack_spike_accel) * frametime ); if (self.enemy != world) @@ -133,13 +129,13 @@ void mage_spike_think() { e = self.enemy; eorg = 0.5 * (e.absmin + e.absmax); - turnrate = MON_CVAR(mage, attack_spike_turnrate); // how fast to turn + turnrate = (autocvar_g_monster_mage_attack_spike_turnrate); // how fast to turn desireddir = normalize(eorg - self.origin); olddir = normalize(self.velocity); // get my current direction dist = vlen(eorg - self.origin); // Do evasive maneuvers for world objects? ( this should be a cpu hog. :P ) - if (MON_CVAR(mage, attack_spike_smart) && (dist > MON_CVAR(mage, attack_spike_smart_mindist))) + if ((autocvar_g_monster_mage_attack_spike_smart) && (dist > (autocvar_g_monster_mage_attack_spike_smart_mindist))) { // Is it a better idea (shorter distance) to trace to the target itself? if ( vlen(self.origin + olddir * self.wait) < dist) @@ -148,7 +144,7 @@ void mage_spike_think() traceline(self.origin, eorg, FALSE, self); // Setup adaptive tracelength - self.wait = bound(MON_CVAR(mage, attack_spike_smart_trace_min), vlen(self.origin - trace_endpos), self.wait = MON_CVAR(mage, attack_spike_smart_trace_max)); + self.wait = bound((autocvar_g_monster_mage_attack_spike_smart_trace_min), vlen(self.origin - trace_endpos), self.wait = (autocvar_g_monster_mage_attack_spike_smart_trace_max)); // Calc how important it is that we turn and add this to the desierd (enemy) dir. desireddir = normalize(((trace_plane_normal * (1 - trace_fraction)) + (desireddir * trace_fraction)) * 0.5); @@ -199,7 +195,7 @@ void mage_heal() entity head; float washealed = FALSE; - for(head = findradius(self.origin, MON_CVAR(mage, heal_range)); head; head = head.chain) if(friend_needshelp(head)) + for(head = findradius(self.origin, (autocvar_g_monster_mage_heal_range)); head; head = head.chain) if(friend_needshelp(head)) { washealed = TRUE; string fx = ""; @@ -208,7 +204,7 @@ void mage_heal() switch(self.skin) { case 0: - if(head.health < autocvar_g_balance_health_regenstable) head.health = bound(0, head.health + MON_CVAR(mage, heal_allies), autocvar_g_balance_health_regenstable); + if(head.health < autocvar_g_balance_health_regenstable) head.health = bound(0, head.health + (autocvar_g_monster_mage_heal_allies), autocvar_g_balance_health_regenstable); fx = "healing_fx"; break; case 1: @@ -221,12 +217,12 @@ void mage_heal() case 2: if(head.armorvalue < autocvar_g_balance_armor_regenstable) { - head.armorvalue = bound(0, head.armorvalue + MON_CVAR(mage, heal_allies), autocvar_g_balance_armor_regenstable); + head.armorvalue = bound(0, head.armorvalue + (autocvar_g_monster_mage_heal_allies), autocvar_g_balance_armor_regenstable); fx = "armorrepair_fx"; } break; case 3: - head.health = bound(0, head.health - ((head == self) ? MON_CVAR(mage, heal_self) : MON_CVAR(mage, heal_allies)), autocvar_g_balance_health_regenstable); + head.health = bound(0, head.health - ((head == self) ? (autocvar_g_monster_mage_heal_self) : (autocvar_g_monster_mage_heal_allies)), autocvar_g_balance_health_regenstable); fx = "rage"; break; } @@ -236,7 +232,7 @@ void mage_heal() else { pointparticles(particleeffectnum("healing_fx"), head.origin, '0 0 0', 1); - head.health = bound(0, head.health + MON_CVAR(mage, heal_allies), head.max_health); + head.health = bound(0, head.health + (autocvar_g_monster_mage_heal_allies), head.max_health); WaypointSprite_UpdateHealth(head.sprite, head.health); } } @@ -244,18 +240,18 @@ void mage_heal() if(washealed) { self.frame = mage_anim_attack; - self.attack_finished_single = time + MON_CVAR(mage, heal_delay); + self.attack_finished_single = time + (autocvar_g_monster_mage_heal_delay); } } void mage_push() { sound(self, CH_SHOTS, "weapons/tagexp1.wav", 1, ATTEN_NORM); - RadiusDamage (self, self, MON_CVAR(mage, attack_push_damage), MON_CVAR(mage, attack_push_damage), MON_CVAR(mage, attack_push_radius), world, MON_CVAR(mage, attack_push_force), DEATH_MONSTER_MAGE, self.enemy); + RadiusDamage (self, self, (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_radius), world, (autocvar_g_monster_mage_attack_push_force), DEATH_MONSTER_MAGE, self.enemy); pointparticles(particleeffectnum("TE_EXPLOSION"), self.origin, '0 0 0', 1); self.frame = mage_anim_attack; - self.attack_finished_single = time + MON_CVAR(mage, attack_push_delay); + self.attack_finished_single = time + (autocvar_g_monster_mage_attack_push_delay); } void mage_teleport() @@ -285,10 +281,10 @@ void mage_shield_remove() void mage_shield() { self.effects |= (EF_ADDITIVE | EF_BLUE); - self.lastshielded = time + MON_CVAR(mage, shield_delay); - self.m_armor_blockpercent = MON_CVAR(mage, shield_blockpercent); + self.lastshielded = time + (autocvar_g_monster_mage_shield_delay); + self.m_armor_blockpercent = (autocvar_g_monster_mage_shield_blockpercent); self.armorvalue = self.health; - self.shield_ltime = time + MON_CVAR(mage, shield_time); + self.shield_ltime = time + (autocvar_g_monster_mage_shield_time); self.frame = mage_anim_attack; self.attack_finished_single = time + 1; } @@ -319,7 +315,7 @@ float mage_attack(float attack_type) else { self.frame = mage_anim_attack; - self.attack_finished_single = time + MON_CVAR(mage, attack_spike_delay); + self.attack_finished_single = time + (autocvar_g_monster_mage_attack_spike_delay); defer(0.2, mage_attack_spike); return TRUE; } @@ -359,7 +355,7 @@ float m_mage(float req) entity head; float need_help = FALSE; - for(head = findradius(self.origin, MON_CVAR(mage, heal_range)); head; head = head.chain) + for(head = findradius(self.origin, (autocvar_g_monster_mage_heal_range)); head; head = head.chain) if(head != self) if(friend_needshelp(head)) { @@ -367,7 +363,7 @@ float m_mage(float req) break; } - if(self.health < MON_CVAR(mage, heal_minhealth) || need_help) + if(self.health < (autocvar_g_monster_mage_heal_minhealth) || need_help) if(time >= self.attack_finished_single) if(random() < 0.5) mage_heal(); @@ -381,7 +377,7 @@ float m_mage(float req) if(random() < 0.5) mage_shield(); - monster_move(MON_CVAR(mage, speed_run), MON_CVAR(mage, speed_walk), MON_CVAR(mage, speed_stop), mage_anim_walk, mage_anim_run, mage_anim_idle); + monster_move((autocvar_g_monster_mage_speed_run), (autocvar_g_monster_mage_speed_walk), (autocvar_g_monster_mage_speed_stop), mage_anim_walk, mage_anim_run, mage_anim_idle); return TRUE; } case MR_DEATH: @@ -391,7 +387,7 @@ float m_mage(float req) } case MR_SETUP: { - if not(self.health) self.health = MON_CVAR(mage, health); + if not(self.health) self.health = (autocvar_g_monster_mage_health); self.monster_loot = spawnfunc_item_health_large; self.monster_attackfunc = mage_attack; @@ -406,11 +402,6 @@ float m_mage(float req) precache_sound ("weapons/tagexp1.wav"); return TRUE; } - case MR_CONFIG: - { - MON_CONFIG_SETTINGS(MAGE_SETTINGS(mage)) - return TRUE; - } } return TRUE; diff --git a/qcsrc/common/monsters/monster/shambler.qc b/qcsrc/common/monsters/monster/shambler.qc index d3e4504fe..e1515c336 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -9,25 +9,21 @@ REGISTER_MONSTER( /* fullname */ _("Shambler") ); -#define SHAMBLER_SETTINGS(monster) \ - MON_ADD_CVAR(monster, health) \ - MON_ADD_CVAR(monster, attack_smash_damage) \ - MON_ADD_CVAR(monster, attack_claw_damage) \ - MON_ADD_CVAR(monster, attack_lightning_damage) \ - MON_ADD_CVAR(monster, attack_lightning_force) \ - MON_ADD_CVAR(monster, attack_lightning_radius) \ - MON_ADD_CVAR(monster, attack_lightning_radius_zap) \ - MON_ADD_CVAR(monster, attack_lightning_speed) \ - MON_ADD_CVAR(monster, attack_lightning_speed_up) \ - MON_ADD_CVAR(monster, speed_stop) \ - MON_ADD_CVAR(monster, speed_run) \ - MON_ADD_CVAR(monster, speed_walk) - -#ifdef SVQC -SHAMBLER_SETTINGS(shambler) -#endif // SVQC #else #ifdef SVQC +float autocvar_g_monster_shambler_health; +float autocvar_g_monster_shambler_attack_smash_damage; +float autocvar_g_monster_shambler_attack_claw_damage; +float autocvar_g_monster_shambler_attack_lightning_damage; +float autocvar_g_monster_shambler_attack_lightning_force; +float autocvar_g_monster_shambler_attack_lightning_radius; +float autocvar_g_monster_shambler_attack_lightning_radius_zap; +float autocvar_g_monster_shambler_attack_lightning_speed; +float autocvar_g_monster_shambler_attack_lightning_speed_up; +float autocvar_g_monster_shambler_speed_stop; +float autocvar_g_monster_shambler_speed_run; +float autocvar_g_monster_shambler_speed_walk; + const float shambler_anim_stand = 0; const float shambler_anim_walk = 1; const float shambler_anim_run = 2; @@ -49,13 +45,13 @@ void shambler_smash() tracebox(self.origin + v_forward * 50, self.mins * 0.5, self.maxs * 0.5, self.origin + v_forward * 500, MOVE_NORMAL, self); if(trace_ent.takedamage) - Damage(trace_ent, self, self, MON_CVAR(shambler, attack_smash_damage) * Monster_SkillModifier(), DEATH_MONSTER_SHAMBLER_SMASH, trace_ent.origin, normalize(trace_ent.origin - self.origin)); + Damage(trace_ent, self, self, (autocvar_g_monster_shambler_attack_smash_damage) * Monster_SkillModifier(), DEATH_MONSTER_SHAMBLER_SMASH, trace_ent.origin, normalize(trace_ent.origin - self.origin)); } void shambler_swing() { float r = (random() < 0.5); - monster_melee(self.enemy, MON_CVAR(shambler, attack_claw_damage), ((r) ? shambler_anim_swingr : shambler_anim_swingl), self.attack_range, 0.8, DEATH_MONSTER_SHAMBLER_CLAW, TRUE); + monster_melee(self.enemy, (autocvar_g_monster_shambler_attack_claw_damage), ((r) ? shambler_anim_swingr : shambler_anim_swingl), self.attack_range, 0.8, DEATH_MONSTER_SHAMBLER_CLAW, TRUE); if(r) { defer(0.5, shambler_swing); @@ -78,12 +74,12 @@ void shambler_lightning_explode() if(self.movetype == MOVETYPE_NONE) self.velocity = self.oldvelocity; - RadiusDamage (self, self.realowner, MON_CVAR(shambler, attack_lightning_damage), MON_CVAR(shambler, attack_lightning_damage), MON_CVAR(shambler, attack_lightning_radius), world, MON_CVAR(shambler, attack_lightning_force), self.projectiledeathtype, other); + RadiusDamage (self, self.realowner, (autocvar_g_monster_shambler_attack_lightning_damage), (autocvar_g_monster_shambler_attack_lightning_damage), (autocvar_g_monster_shambler_attack_lightning_radius), world, (autocvar_g_monster_shambler_attack_lightning_force), self.projectiledeathtype, other); - for(head = findradius(self.origin, MON_CVAR(shambler, attack_lightning_radius_zap)); head; head = head.chain) if(head != self.realowner) if(head.takedamage) + for(head = findradius(self.origin, (autocvar_g_monster_shambler_attack_lightning_radius_zap)); head; head = head.chain) if(head != self.realowner) if(head.takedamage) { te_csqc_lightningarc(self.origin, head.origin); - Damage(head, self, self.realowner, MON_CVAR(shambler, attack_lightning_damage) * Monster_SkillModifier(), DEATH_MONSTER_SHAMBLER_ZAP, head.origin, '0 0 0'); + Damage(head, self, self.realowner, (autocvar_g_monster_shambler_attack_lightning_damage) * Monster_SkillModifier(), DEATH_MONSTER_SHAMBLER_ZAP, head.origin, '0 0 0'); } self.think = SUB_Remove; @@ -132,7 +128,7 @@ void shambler_lightning() gren.owner = gren.realowner = self; gren.classname = "grenade"; gren.bot_dodge = TRUE; - gren.bot_dodgerating = MON_CVAR(shambler, attack_lightning_damage); + gren.bot_dodgerating = (autocvar_g_monster_shambler_attack_lightning_damage); gren.movetype = MOVETYPE_BOUNCE; PROJECTILE_MAKETRIGGER(gren); gren.projectiledeathtype = DEATH_MONSTER_SHAMBLER_ZAP; @@ -152,7 +148,7 @@ void shambler_lightning() gren.event_damage = shambler_lightning_damage; gren.damagedbycontents = TRUE; gren.missile_flags = MIF_SPLASH | MIF_ARC; - W_SetupProjectileVelocityEx(gren, v_forward, v_up, MON_CVAR(shambler, attack_lightning_speed), MON_CVAR(shambler, attack_lightning_speed_up), 0, 0, FALSE); + W_SetupProjectileVelocityEx(gren, v_forward, v_up, (autocvar_g_monster_shambler_attack_lightning_speed), (autocvar_g_monster_shambler_attack_lightning_speed_up), 0, 0, FALSE); gren.angles = vectoangles (gren.velocity); gren.flags = FL_PROJECTILE; @@ -214,7 +210,7 @@ float m_shambler(float req) { case MR_THINK: { - monster_move(MON_CVAR(shambler, speed_run), MON_CVAR(shambler, speed_walk), MON_CVAR(shambler, speed_stop), shambler_anim_run, shambler_anim_walk, shambler_anim_stand); + monster_move((autocvar_g_monster_shambler_speed_run), (autocvar_g_monster_shambler_speed_walk), (autocvar_g_monster_shambler_speed_stop), shambler_anim_run, shambler_anim_walk, shambler_anim_stand); return TRUE; } case MR_DEATH: @@ -224,7 +220,7 @@ float m_shambler(float req) } case MR_SETUP: { - if not(self.health) self.health = MON_CVAR(shambler, health); + if not(self.health) self.health = (autocvar_g_monster_shambler_health); if not(self.attack_range) self.attack_range = 150; self.monster_loot = spawnfunc_item_health_mega; @@ -239,11 +235,6 @@ float m_shambler(float req) precache_model ("models/monsters/shambler.mdl"); return TRUE; } - case MR_CONFIG: - { - MON_CONFIG_SETTINGS(SHAMBLER_SETTINGS(shambler)) - return TRUE; - } } return TRUE; diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index 4c52c07dc..48ca45b74 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -9,23 +9,19 @@ REGISTER_MONSTER( /* fullname */ _("Spider") ); -#define SPIDER_SETTINGS(monster) \ - MON_ADD_CVAR(monster, health) \ - MON_ADD_CVAR(monster, attack_bite_damage) \ - MON_ADD_CVAR(monster, attack_bite_delay) \ - MON_ADD_CVAR(monster, attack_web_damagetime) \ - MON_ADD_CVAR(monster, attack_web_speed) \ - MON_ADD_CVAR(monster, attack_web_speed_up) \ - MON_ADD_CVAR(monster, attack_web_delay) \ - MON_ADD_CVAR(monster, speed_stop) \ - MON_ADD_CVAR(monster, speed_run) \ - MON_ADD_CVAR(monster, speed_walk) - -#ifdef SVQC -SPIDER_SETTINGS(spider) -#endif // SVQC #else #ifdef SVQC +float autocvar_g_monster_spider_health; +float autocvar_g_monster_spider_attack_bite_damage; +float autocvar_g_monster_spider_attack_bite_delay; +float autocvar_g_monster_spider_attack_web_damagetime; +float autocvar_g_monster_spider_attack_web_speed; +float autocvar_g_monster_spider_attack_web_speed_up; +float autocvar_g_monster_spider_attack_web_delay; +float autocvar_g_monster_spider_speed_stop; +float autocvar_g_monster_spider_speed_run; +float autocvar_g_monster_spider_speed_walk; + const float spider_anim_idle = 0; const float spider_anim_walk = 1; const float spider_anim_attack = 2; @@ -42,7 +38,7 @@ void spider_web_explode() RadiusDamage(self, self.realowner, 0, 0, 25, world, 25, self.projectiledeathtype, world); for(e = findradius(self.origin, 25); e; e = e.chain) if(e != self) if(e.takedamage && e.deadflag == DEAD_NO) if(e.health > 0) - e.spider_slowness = time + MON_CVAR(spider, attack_web_damagetime); + e.spider_slowness = time + (autocvar_g_monster_spider_attack_web_damagetime); remove(self); } @@ -76,7 +72,7 @@ void spider_shootweb() //proj.glow_size = 50; //proj.glow_color = 45; proj.movetype = MOVETYPE_BOUNCE; - W_SetupProjectileVelocityEx(proj, v_forward, v_up, MON_CVAR(spider, attack_web_speed), MON_CVAR(spider, attack_web_speed_up), 0, 0, FALSE); + W_SetupProjectileVelocityEx(proj, v_forward, v_up, (autocvar_g_monster_spider_attack_web_speed), (autocvar_g_monster_spider_attack_web_speed_up), 0, 0, FALSE); proj.touch = spider_web_touch; setsize(proj, '-4 -4 -4', '4 4 4'); proj.takedamage = DAMAGE_NO; @@ -99,14 +95,14 @@ float spider_attack(float attack_type) { case MONSTER_ATTACK_MELEE: { - return monster_melee(self.enemy, MON_CVAR(spider, attack_bite_damage), ((random() > 0.5) ? spider_anim_attack : spider_anim_attack2), self.attack_range, MON_CVAR(spider, attack_bite_delay), DEATH_MONSTER_SPIDER, TRUE); + return monster_melee(self.enemy, (autocvar_g_monster_spider_attack_bite_damage), ((random() > 0.5) ? spider_anim_attack : spider_anim_attack2), self.attack_range, (autocvar_g_monster_spider_attack_bite_delay), DEATH_MONSTER_SPIDER, TRUE); } case MONSTER_ATTACK_RANGED: { if(time >= self.spider_web_delay) { self.frame = spider_anim_attack2; - self.attack_finished_single = time + MON_CVAR(spider, attack_web_delay); + self.attack_finished_single = time + (autocvar_g_monster_spider_attack_web_delay); spider_shootweb(); self.spider_web_delay = time + 3; return TRUE; @@ -137,7 +133,7 @@ float m_spider(float req) { case MR_THINK: { - monster_move(MON_CVAR(spider, speed_run), MON_CVAR(spider, speed_walk), MON_CVAR(spider, speed_stop), spider_anim_walk, spider_anim_walk, spider_anim_idle); + monster_move((autocvar_g_monster_spider_speed_run), (autocvar_g_monster_spider_speed_walk), (autocvar_g_monster_spider_speed_stop), spider_anim_walk, spider_anim_walk, spider_anim_idle); return TRUE; } case MR_DEATH: @@ -148,7 +144,7 @@ float m_spider(float req) } case MR_SETUP: { - if not(self.health) self.health = MON_CVAR(spider, health); + if not(self.health) self.health = (autocvar_g_monster_spider_health); self.monster_loot = spawnfunc_item_health_medium; self.monster_attackfunc = spider_attack; @@ -162,11 +158,6 @@ float m_spider(float req) precache_sound ("weapons/electro_fire2.wav"); return TRUE; } - case MR_CONFIG: - { - MON_CONFIG_SETTINGS(SPIDER_SETTINGS(spider)) - return TRUE; - } } return TRUE; diff --git a/qcsrc/common/monsters/monster/wyvern.qc b/qcsrc/common/monsters/monster/wyvern.qc index 162331a11..69a950852 100644 --- a/qcsrc/common/monsters/monster/wyvern.qc +++ b/qcsrc/common/monsters/monster/wyvern.qc @@ -9,23 +9,19 @@ REGISTER_MONSTER( /* fullname */ _("Wyvern") ); -#define WYVERN_SETTINGS(monster) \ - MON_ADD_CVAR(monster, health) \ - MON_ADD_CVAR(monster, attack_fireball_damage) \ - MON_ADD_CVAR(monster, attack_fireball_edgedamage) \ - MON_ADD_CVAR(monster, attack_fireball_damagetime) \ - MON_ADD_CVAR(monster, attack_fireball_force) \ - MON_ADD_CVAR(monster, attack_fireball_radius) \ - MON_ADD_CVAR(monster, attack_fireball_speed) \ - MON_ADD_CVAR(monster, speed_stop) \ - MON_ADD_CVAR(monster, speed_run) \ - MON_ADD_CVAR(monster, speed_walk) - -#ifdef SVQC -WYVERN_SETTINGS(wyvern) -#endif // SVQC #else #ifdef SVQC +float autocvar_g_monster_wyvern_health; +float autocvar_g_monster_wyvern_attack_fireball_damage; +float autocvar_g_monster_wyvern_attack_fireball_edgedamage; +float autocvar_g_monster_wyvern_attack_fireball_damagetime; +float autocvar_g_monster_wyvern_attack_fireball_force; +float autocvar_g_monster_wyvern_attack_fireball_radius; +float autocvar_g_monster_wyvern_attack_fireball_speed; +float autocvar_g_monster_wyvern_speed_stop; +float autocvar_g_monster_wyvern_speed_run; +float autocvar_g_monster_wyvern_speed_walk; + const float wyvern_anim_hover = 0; const float wyvern_anim_fly = 1; const float wyvern_anim_magic = 2; @@ -39,10 +35,10 @@ void wyvern_fireball_explode() { pointparticles(particleeffectnum("fireball_explode"), self.origin, '0 0 0', 1); - RadiusDamage(self, self.realowner, MON_CVAR(wyvern, attack_fireball_damage), MON_CVAR(wyvern, attack_fireball_edgedamage), MON_CVAR(wyvern, attack_fireball_force), world, MON_CVAR(wyvern, attack_fireball_radius), self.projectiledeathtype, world); + RadiusDamage(self, self.realowner, (autocvar_g_monster_wyvern_attack_fireball_damage), (autocvar_g_monster_wyvern_attack_fireball_edgedamage), (autocvar_g_monster_wyvern_attack_fireball_force), world, (autocvar_g_monster_wyvern_attack_fireball_radius), self.projectiledeathtype, world); - for(e = world; (e = findfloat(e, takedamage, DAMAGE_AIM)); ) if(vlen(e.origin - self.origin) <= MON_CVAR(wyvern, attack_fireball_radius)) - Fire_AddDamage(e, self, 5 * Monster_SkillModifier(), MON_CVAR(wyvern, attack_fireball_damagetime), self.projectiledeathtype); + for(e = world; (e = findfloat(e, takedamage, DAMAGE_AIM)); ) if(vlen(e.origin - self.origin) <= (autocvar_g_monster_wyvern_attack_fireball_radius)) + Fire_AddDamage(e, self, 5 * Monster_SkillModifier(), (autocvar_g_monster_wyvern_attack_fireball_damagetime), self.projectiledeathtype); remove(self); } @@ -69,7 +65,7 @@ void wyvern_fireball() setsize(missile, '-6 -6 -6', '6 6 6'); setorigin(missile, self.origin + self.view_ofs + v_forward * 14); missile.flags = FL_PROJECTILE; - missile.velocity = dir * MON_CVAR(wyvern, attack_fireball_speed); + missile.velocity = dir * (autocvar_g_monster_wyvern_attack_fireball_speed); missile.avelocity = '300 300 300'; missile.nextthink = time + 5; missile.think = wyvern_fireball_explode; @@ -117,7 +113,7 @@ float m_wyvern(float req) { case MR_THINK: { - monster_move(MON_CVAR(wyvern, speed_run), MON_CVAR(wyvern, speed_walk), MON_CVAR(wyvern, speed_stop), wyvern_anim_fly, wyvern_anim_hover, wyvern_anim_hover); + monster_move((autocvar_g_monster_wyvern_speed_run), (autocvar_g_monster_wyvern_speed_walk), (autocvar_g_monster_wyvern_speed_stop), wyvern_anim_fly, wyvern_anim_hover, wyvern_anim_hover); return TRUE; } case MR_DEATH: @@ -130,7 +126,7 @@ float m_wyvern(float req) } case MR_SETUP: { - if not(self.health) self.health = MON_CVAR(wyvern, health); + if not(self.health) self.health = (autocvar_g_monster_wyvern_health); self.monster_loot = spawnfunc_item_cells; self.monster_attackfunc = wyvern_attack; @@ -143,11 +139,6 @@ float m_wyvern(float req) precache_model ("models/monsters/wizard.mdl"); return TRUE; } - case MR_CONFIG: - { - MON_CONFIG_SETTINGS(WYVERN_SETTINGS(wyvern)) - return TRUE; - } } return TRUE; diff --git a/qcsrc/common/monsters/monster/zombie.qc b/qcsrc/common/monsters/monster/zombie.qc index 8670e8454..7295578b6 100644 --- a/qcsrc/common/monsters/monster/zombie.qc +++ b/qcsrc/common/monsters/monster/zombie.qc @@ -9,23 +9,19 @@ REGISTER_MONSTER( /* fullname */ _("Zombie") ); -#define ZOMBIE_SETTINGS(monster) \ - MON_ADD_CVAR(monster, health) \ - MON_ADD_CVAR(monster, attack_melee_damage) \ - MON_ADD_CVAR(monster, attack_melee_delay) \ - MON_ADD_CVAR(monster, attack_leap_damage) \ - MON_ADD_CVAR(monster, attack_leap_force) \ - MON_ADD_CVAR(monster, attack_leap_speed) \ - MON_ADD_CVAR(monster, attack_leap_delay) \ - MON_ADD_CVAR(monster, speed_stop) \ - MON_ADD_CVAR(monster, speed_run) \ - MON_ADD_CVAR(monster, speed_walk) - -#ifdef SVQC -ZOMBIE_SETTINGS(zombie) -#endif // SVQC #else #ifdef SVQC +float autocvar_g_monster_zombie_health; +float autocvar_g_monster_zombie_attack_melee_damage; +float autocvar_g_monster_zombie_attack_melee_delay; +float autocvar_g_monster_zombie_attack_leap_damage; +float autocvar_g_monster_zombie_attack_leap_force; +float autocvar_g_monster_zombie_attack_leap_speed; +float autocvar_g_monster_zombie_attack_leap_delay; +float autocvar_g_monster_zombie_speed_stop; +float autocvar_g_monster_zombie_speed_run; +float autocvar_g_monster_zombie_speed_walk; + const float zombie_anim_attackleap = 0; const float zombie_anim_attackrun1 = 1; const float zombie_anim_attackrun2 = 2; @@ -68,8 +64,8 @@ void zombie_attack_leap_touch() if(other.takedamage) { angles_face = vectoangles(self.moveto - self.origin); - angles_face = normalize(angles_face) * MON_CVAR(zombie, attack_leap_force); - Damage(other, self, self, MON_CVAR(zombie, attack_leap_damage) * Monster_SkillModifier(), DEATH_MONSTER_ZOMBIE_JUMP, other.origin, angles_face); + angles_face = normalize(angles_face) * (autocvar_g_monster_zombie_attack_leap_force); + Damage(other, self, self, (autocvar_g_monster_zombie_attack_leap_damage) * Monster_SkillModifier(), DEATH_MONSTER_ZOMBIE_JUMP, other.origin, angles_face); self.touch = MonsterTouch; // instantly turn it off to stop damage spam } @@ -118,12 +114,12 @@ float zombie_attack(float attack_type) if(random() < 0.3 && self.health < 75 && self.enemy.health > 10) return zombie_block(); - return monster_melee(self.enemy, MON_CVAR(zombie, attack_melee_damage), chosen_anim, self.attack_range, MON_CVAR(zombie, attack_melee_delay), DEATH_MONSTER_ZOMBIE_MELEE, TRUE); + return monster_melee(self.enemy, (autocvar_g_monster_zombie_attack_melee_damage), chosen_anim, self.attack_range, (autocvar_g_monster_zombie_attack_melee_delay), DEATH_MONSTER_ZOMBIE_MELEE, TRUE); } case MONSTER_ATTACK_RANGED: { makevectors(self.angles); - return monster_leap(zombie_anim_attackleap, zombie_attack_leap_touch, v_forward * MON_CVAR(zombie, attack_leap_speed) + '0 0 200', MON_CVAR(zombie, attack_leap_delay)); + return monster_leap(zombie_anim_attackleap, zombie_attack_leap_touch, v_forward * (autocvar_g_monster_zombie_attack_leap_speed) + '0 0 200', (autocvar_g_monster_zombie_attack_leap_delay)); } } @@ -150,7 +146,7 @@ float m_zombie(float req) { case MR_THINK: { - monster_move(MON_CVAR(zombie, speed_run), MON_CVAR(zombie, speed_walk), MON_CVAR(zombie, speed_stop), zombie_anim_runforward, zombie_anim_runforward, zombie_anim_idle); + monster_move((autocvar_g_monster_zombie_speed_run), (autocvar_g_monster_zombie_speed_walk), (autocvar_g_monster_zombie_speed_stop), zombie_anim_runforward, zombie_anim_runforward, zombie_anim_idle); return TRUE; } case MR_DEATH: @@ -162,7 +158,7 @@ float m_zombie(float req) } case MR_SETUP: { - if not(self.health) self.health = MON_CVAR(zombie, health); + if not(self.health) self.health = (autocvar_g_monster_zombie_health); if(self.spawnflags & MONSTERFLAG_NORESPAWN) self.spawnflags &= ~MONSTERFLAG_NORESPAWN; // zombies always respawn @@ -181,11 +177,6 @@ float m_zombie(float req) precache_model ("models/monsters/zombie.dpm"); return TRUE; } - case MR_CONFIG: - { - MON_CONFIG_SETTINGS(ZOMBIE_SETTINGS(zombie)) - return TRUE; - } } return TRUE; diff --git a/qcsrc/common/monsters/monsters.qh b/qcsrc/common/monsters/monsters.qh index e9a942b45..f6db09c89 100644 --- a/qcsrc/common/monsters/monsters.qh +++ b/qcsrc/common/monsters/monsters.qh @@ -3,7 +3,6 @@ #define MR_THINK 2 // (SERVER) logic to run every frame #define MR_DEATH 3 // (SERVER) called when monster dies #define MR_PRECACHE 4 // (BOTH) precaches models/sounds used by this monster -#define MR_CONFIG 5 // (ALL) // functions: entity get_monsterinfo(float id); @@ -62,21 +61,7 @@ float MON_LAST; REGISTER_MONSTER_2(MON_##id,func,monsterflags,min_s,max_s,modelname,shortname,mname) #endif -#define MON_DUPECHECK(dupecheck,cvar) \ - #ifndef dupecheck \ - #define dupecheck \ - float cvar; \ - #else \ - #error DUPLICATE MONSTER CVAR: cvar \ - #endif - -#define MON_ADD_CVAR(monster,name) \ - MON_DUPECHECK(MON_CVAR_##monster##_##name, autocvar_g_monster_##monster##_##name) - -#define MON_CVAR(monster,name) autocvar_g_monster_##monster##_##name - #include "all.qh" -#undef MON_ADD_CVAR #undef REGISTER_MONSTER ACCUMULATE_FUNCTION(RegisterMonsters, register_monsters_done); diff --git a/qcsrc/server/progs.src b/qcsrc/server/progs.src index 68f465cc0..c082d09fa 100644 --- a/qcsrc/server/progs.src +++ b/qcsrc/server/progs.src @@ -27,7 +27,6 @@ sys-post.qh ../common/net_notice.qh ../common/animdecide.qh -../common/monsters/config.qh ../common/monsters/monsters.qh ../common/monsters/sv_monsters.qh ../common/monsters/spawn.qh @@ -234,7 +233,6 @@ round_handler.qc ../common/explosion_equation.qc ../common/monsters/sv_monsters.qc -../common/monsters/config.qc ../common/monsters/monsters.qc ../common/monsters/spawn.qc