}
}
-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)
#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") \
+++ /dev/null
-// ==========================
-// 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));
-}
+++ /dev/null
-// ==========================
-// 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
/* 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;
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);
}
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)
{
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)
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);
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 = "";
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:
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;
}
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);
}
}
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()
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;
}
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;
}
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))
{
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();
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:
}
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;
precache_sound ("weapons/tagexp1.wav");
return TRUE;
}
- case MR_CONFIG:
- {
- MON_CONFIG_SETTINGS(MAGE_SETTINGS(mage))
- return TRUE;
- }
}
return TRUE;
/* 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;
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);
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;
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;
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;
{
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:
}
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;
precache_model ("models/monsters/shambler.mdl");
return TRUE;
}
- case MR_CONFIG:
- {
- MON_CONFIG_SETTINGS(SHAMBLER_SETTINGS(shambler))
- return TRUE;
- }
}
return TRUE;
/* 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;
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);
}
//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;
{
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;
{
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:
}
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;
precache_sound ("weapons/electro_fire2.wav");
return TRUE;
}
- case MR_CONFIG:
- {
- MON_CONFIG_SETTINGS(SPIDER_SETTINGS(spider))
- return TRUE;
- }
}
return TRUE;
/* 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;
{
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);
}
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;
{
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:
}
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;
precache_model ("models/monsters/wizard.mdl");
return TRUE;
}
- case MR_CONFIG:
- {
- MON_CONFIG_SETTINGS(WYVERN_SETTINGS(wyvern))
- return TRUE;
- }
}
return TRUE;
/* 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;
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
}
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));
}
}
{
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:
}
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
precache_model ("models/monsters/zombie.dpm");
return TRUE;
}
- case MR_CONFIG:
- {
- MON_CONFIG_SETTINGS(ZOMBIE_SETTINGS(zombie))
- return TRUE;
- }
}
return TRUE;
#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);
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);
../common/net_notice.qh
../common/animdecide.qh
-../common/monsters/config.qh
../common/monsters/monsters.qh
../common/monsters/sv_monsters.qh
../common/monsters/spawn.qh
../common/explosion_equation.qc
../common/monsters/sv_monsters.qc
-../common/monsters/config.qc
../common/monsters/monsters.qc
../common/monsters/spawn.qc