From 83fe44691d2e3f628d8ee13c19e650ff9d49d0d1 Mon Sep 17 00:00:00 2001 From: NeonKnightOA Date: Wed, 22 Jan 2020 12:37:33 -0300 Subject: [PATCH] Easier handling of skill levels by using defines instead of numbers --- src/g_ai.c | 6 +++--- src/g_combat.c | 4 ++-- src/g_items.c | 8 ++++---- src/g_spawn.c | 12 +++++------ src/g_weapon.c | 2 +- src/header/local.h | 6 ++++++ src/monster/berserker/berserker.c | 2 +- src/monster/boss3/boss31.c | 2 +- src/monster/boss3/boss32.c | 2 +- src/monster/brain/brain.c | 4 ++-- src/monster/carrier/carrier.c | 2 +- src/monster/chick/chick.c | 6 +++--- src/monster/flipper/flipper.c | 2 +- src/monster/float/float.c | 4 ++-- src/monster/flyer/flyer.c | 4 ++-- src/monster/gladiator/gladiator.c | 2 +- src/monster/gunner/gunner.c | 10 ++++----- src/monster/hover/hover.c | 4 ++-- src/monster/infantry/infantry.c | 8 ++++---- src/monster/insane/insane.c | 2 +- src/monster/medic/medic.c | 16 +++++++-------- src/monster/mutant/mutant.c | 4 ++-- src/monster/parasite/parasite.c | 2 +- src/monster/soldier/soldier.c | 18 ++++++++-------- src/monster/stalker/stalker.c | 6 +++--- src/monster/supertank/supertank.c | 4 ++-- src/monster/tank/tank.c | 8 ++++---- src/monster/turret/turret.c | 18 ++++++++-------- src/monster/widow/widow.c | 34 +++++++++++++++---------------- src/monster/widow/widow2.c | 10 ++++----- src/player/hud.c | 6 +++--- 31 files changed, 112 insertions(+), 106 deletions(-) diff --git a/src/g_ai.c b/src/g_ai.c index eb107c1..bc4621e 100644 --- a/src/g_ai.c +++ b/src/g_ai.c @@ -896,7 +896,7 @@ M_CheckAttack(edict_t *self) if (enemy_range == RANGE_MELEE) { /* don't always melee in easy mode */ - if ((skill->value == 0) && (rand() & 3)) + if ((skill->value == SKILL_EASY) && (rand() & 3)) { /* fix for melee only monsters & strafing */ self->monsterinfo.attack_state = AS_STRAIGHT; @@ -950,11 +950,11 @@ M_CheckAttack(edict_t *self) return false; } - if (skill->value == 0) + if (skill->value == SKILL_EASY) { chance *= 0.5; } - else if (skill->value >= 2) + else if (skill->value >= SKILL_HARD) { chance *= 2; } diff --git a/src/g_combat.c b/src/g_combat.c index 27d1801..f4d4b23 100644 --- a/src/g_combat.c +++ b/src/g_combat.c @@ -698,7 +698,7 @@ T_Damage(edict_t *targ, edict_t *inflictor, edict_t *attacker, vec3_t dir, } /* easy mode takes half damage */ - if ((skill->value == 0) && (deathmatch->value == 0) && targ->client) + if ((skill->value == SKILL_EASY) && (deathmatch->value == 0) && targ->client) { damage *= 0.5; @@ -917,7 +917,7 @@ T_Damage(edict_t *targ, edict_t *inflictor, edict_t *attacker, vec3_t dir, targ->pain(targ, attacker, knockback, take); /* nightmare mode monsters don't go into pain frames often */ - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { targ->pain_debounce_time = level.time + 5; } diff --git a/src/g_items.c b/src/g_items.c index b519153..ea78237 100644 --- a/src/g_items.c +++ b/src/g_items.c @@ -200,8 +200,8 @@ Pickup_Powerup(edict_t *ent, edict_t *other) quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)]; - if (((skill->value == 1) && - (quantity >= 2)) || ((skill->value >= 2) && (quantity >= 1))) + if (((skill->value == SKILL_MEDIUM) && + (quantity >= 2)) || ((skill->value >= SKILL_HARD) && (quantity >= 1))) { return false; } @@ -769,8 +769,8 @@ Pickup_Sphere(edict_t *ent, edict_t *other) quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)]; - if (((skill->value == 1) && - (quantity >= 2)) || ((skill->value >= 2) && (quantity >= 1))) + if (((skill->value == SKILL_MEDIUM) && + (quantity >= 2)) || ((skill->value >= SKILL_HARD) && (quantity >= 1))) { return false; } diff --git a/src/g_spawn.c b/src/g_spawn.c index 2ee32a7..fcd94e9 100644 --- a/src/g_spawn.c +++ b/src/g_spawn.c @@ -862,9 +862,9 @@ SpawnEntities(const char *mapname, char *entities, const char *spawnpoint) (ent->spawnflags & SPAWNFLAG_NOT_MEDIUM) && (ent->spawnflags & SPAWNFLAG_NOT_HARD))) { - if (((skill->value == 0) && (ent->spawnflags & SPAWNFLAG_NOT_EASY)) || - ((skill->value == 1) && (ent->spawnflags & SPAWNFLAG_NOT_MEDIUM)) || - (((skill->value == 2) || (skill->value == 3)) && (ent->spawnflags & SPAWNFLAG_NOT_HARD))) + if (((skill->value == SKILL_EASY) && (ent->spawnflags & SPAWNFLAG_NOT_EASY)) || + ((skill->value == SKILL_MEDIUM) && (ent->spawnflags & SPAWNFLAG_NOT_MEDIUM)) || + (((skill->value == SKILL_HARD) || (skill->value == SKILL_HARDPLUS)) && (ent->spawnflags & SPAWNFLAG_NOT_HARD))) { G_FreeEdict(ent); inhibit++; @@ -874,9 +874,9 @@ SpawnEntities(const char *mapname, char *entities, const char *spawnpoint) } else { - if (((skill->value == 0) && (ent->spawnflags & SPAWNFLAG_NOT_EASY)) || - ((skill->value == 1) && (ent->spawnflags & SPAWNFLAG_NOT_MEDIUM)) || - (((skill->value == 2) || (skill->value == 3)) && (ent->spawnflags & SPAWNFLAG_NOT_HARD))) + if (((skill->value == SKILL_EASY) && (ent->spawnflags & SPAWNFLAG_NOT_EASY)) || + ((skill->value == SKILL_MEDIUM) && (ent->spawnflags & SPAWNFLAG_NOT_MEDIUM)) || + (((skill->value == SKILL_HARD) || (skill->value == SKILL_HARDPLUS)) && (ent->spawnflags & SPAWNFLAG_NOT_HARD))) { G_FreeEdict(ent); inhibit++; diff --git a/src/g_weapon.c b/src/g_weapon.c index c2e74fd..f4fe418 100644 --- a/src/g_weapon.c +++ b/src/g_weapon.c @@ -26,7 +26,7 @@ check_dodge(edict_t *self, vec3_t start, vec3_t dir, int speed) } /* easy mode only ducks one quarter the time */ - if (skill->value == 0) + if (skill->value == SKILL_EASY) { if (random() > 0.25) { diff --git a/src/header/local.h b/src/header/local.h index 7171fae..ee305a2 100644 --- a/src/header/local.h +++ b/src/header/local.h @@ -562,6 +562,12 @@ extern int gibsthisframe; #define MOD_DOPPLE_VENGEANCE 54 #define MOD_DOPPLE_HUNTER 55 +/* Easier handling of AI skill levels */ +#define SKILL_EASY 0 +#define SKILL_MEDIUM 1 +#define SKILL_HARD 2 +#define SKILL_HARDPLUS 3 + extern int meansOfDeath; extern edict_t *g_edicts; diff --git a/src/monster/berserker/berserker.c b/src/monster/berserker/berserker.c index 5cdd363..b58de7c 100644 --- a/src/monster/berserker/berserker.c +++ b/src/monster/berserker/berserker.c @@ -382,7 +382,7 @@ berserk_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) self->pain_debounce_time = level.time + 3; gi.sound(self, CHAN_VOICE, sound_pain, 1, ATTN_NORM, 0); - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } diff --git a/src/monster/boss3/boss31.c b/src/monster/boss3/boss31.c index be6d349..7b84a90 100644 --- a/src/monster/boss3/boss31.c +++ b/src/monster/boss3/boss31.c @@ -579,7 +579,7 @@ jorg_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) self->pain_debounce_time = level.time + 3; - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } diff --git a/src/monster/boss3/boss32.c b/src/monster/boss3/boss32.c index eed6589..aa3b29c 100644 --- a/src/monster/boss3/boss32.c +++ b/src/monster/boss3/boss32.c @@ -718,7 +718,7 @@ makron_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) self->pain_debounce_time = level.time + 3; - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } diff --git a/src/monster/brain/brain.c b/src/monster/brain/brain.c index 1895619..f5545c1 100644 --- a/src/monster/brain/brain.c +++ b/src/monster/brain/brain.c @@ -582,7 +582,7 @@ brain_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */, self->pain_debounce_time = level.time + 3; - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } @@ -693,7 +693,7 @@ brain_duck(edict_t *self, float eta) /* has to be done immediately otherwise he can get stuck */ monster_duck_down(self); - if (skill->value == 0) + if (skill->value == SKILL_EASY) { /* PMM - stupid dodge */ self->monsterinfo.duck_wait_time = level.time + eta + 1; diff --git a/src/monster/carrier/carrier.c b/src/monster/carrier/carrier.c index c43fe01..05d4fca 100644 --- a/src/monster/carrier/carrier.c +++ b/src/monster/carrier/carrier.c @@ -1274,7 +1274,7 @@ carrier_pain(edict_t *self, edict_t *other /* unused */, float kick /* unused */ self->s.skinnum = 1; } - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } diff --git a/src/monster/chick/chick.c b/src/monster/chick/chick.c index c8d5f9e..2cd5d48 100644 --- a/src/monster/chick/chick.c +++ b/src/monster/chick/chick.c @@ -359,7 +359,7 @@ chick_pain(edict_t *self, edict_t *other /* other */, float kick /* other */, in gi.sound(self, CHAN_VOICE, sound_pain3, 1, ATTN_NORM, 0); } - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } @@ -1004,7 +1004,7 @@ chick_duck(edict_t *self, float eta) } } - if (skill->value == 0) + if (skill->value == SKILL_EASY) { /* stupid dodge */ self->monsterinfo.duck_wait_time = level.time + eta + 1; @@ -1034,7 +1034,7 @@ chick_sidestep(edict_t *self) (self->monsterinfo.currentmove == &chick_move_attack1)) { /* if we're shooting, and not on easy, don't dodge */ - if (skill->value) + if (skill->value > SKILL_EASY) { self->monsterinfo.aiflags &= ~AI_DODGING; return; diff --git a/src/monster/flipper/flipper.c b/src/monster/flipper/flipper.c index 9d1af96..115230e 100644 --- a/src/monster/flipper/flipper.c +++ b/src/monster/flipper/flipper.c @@ -307,7 +307,7 @@ flipper_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) self->pain_debounce_time = level.time + 3; - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } diff --git a/src/monster/float/float.c b/src/monster/float/float.c index 5897ca8..6af849a 100644 --- a/src/monster/float/float.c +++ b/src/monster/float/float.c @@ -687,7 +687,7 @@ floater_attack(edict_t *self) // 50% chance in normal // 75% chance in hard // 86.67% chance in nightmare - if (!skill->value) + if (skill->value == SKILL_EASY) { chance = 0; } @@ -753,7 +753,7 @@ floater_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) self->pain_debounce_time = level.time + 3; - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } diff --git a/src/monster/flyer/flyer.c b/src/monster/flyer/flyer.c index ff61577..2e920d9 100644 --- a/src/monster/flyer/flyer.c +++ b/src/monster/flyer/flyer.c @@ -789,7 +789,7 @@ flyer_attack(edict_t *self) return; } - if (!skill->value) + if (skill->value == SKILL_EASY) { chance = 0; } @@ -915,7 +915,7 @@ flyer_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) self->pain_debounce_time = level.time + 3; - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } diff --git a/src/monster/gladiator/gladiator.c b/src/monster/gladiator/gladiator.c index a925a29..ce5b6fd 100644 --- a/src/monster/gladiator/gladiator.c +++ b/src/monster/gladiator/gladiator.c @@ -359,7 +359,7 @@ gladiator_pain(edict_t *self, edict_t *other /* unused */, float kick, int damag gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); } - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } diff --git a/src/monster/gunner/gunner.c b/src/monster/gunner/gunner.c index 317c51a..6fcefbf 100644 --- a/src/monster/gunner/gunner.c +++ b/src/monster/gunner/gunner.c @@ -388,7 +388,7 @@ gunner_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); } - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } @@ -504,7 +504,7 @@ gunner_duck_down(edict_t *self) self->monsterinfo.aiflags |= AI_DUCKED; - if (skill->value >= 2) + if (skill->value >= SKILL_HARD) { if (random() > 0.5) { @@ -1136,14 +1136,14 @@ gunner_duck(edict_t *self, float eta) ) { /* if we're shooting, and not on easy, don't dodge */ - if (skill->value) + if (skill->value > SKILL_EASY) { self->monsterinfo.aiflags &= ~AI_DUCKED; return; } } - if (skill->value == 0) + if (skill->value == SKILL_EASY) { /* stupid dodge */ self->monsterinfo.duck_wait_time = level.time + eta + 1; @@ -1181,7 +1181,7 @@ gunner_sidestep(edict_t *self) ) { /* if we're shooting, and not on easy, don't dodge */ - if (skill->value) + if (skill->value > SKILL_EASY) { self->monsterinfo.aiflags &= ~AI_DODGING; return; diff --git a/src/monster/hover/hover.c b/src/monster/hover/hover.c index 9244741..0e6eb9d 100644 --- a/src/monster/hover/hover.c +++ b/src/monster/hover/hover.c @@ -535,7 +535,7 @@ hover_attack(edict_t *self) return; } - if (!skill->value) + if (skill->value == SKILL_EASY) { chance = 0; } @@ -586,7 +586,7 @@ hover_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) self->pain_debounce_time = level.time + 3; - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } diff --git a/src/monster/infantry/infantry.c b/src/monster/infantry/infantry.c index 54cb5fa..35cbdfa 100644 --- a/src/monster/infantry/infantry.c +++ b/src/monster/infantry/infantry.c @@ -277,7 +277,7 @@ infantry_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage self->pain_debounce_time = level.time + 3; - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } @@ -854,14 +854,14 @@ infantry_duck(edict_t *self, float eta) (self->monsterinfo.currentmove == &infantry_move_attack2)) { /* if we're shooting, and not on easy, don't dodge */ - if (skill->value) + if (skill->value > SKILL_EASY) { self->monsterinfo.aiflags &= ~AI_DUCKED; return; } } - if (skill->value == 0) + if (skill->value == SKILL_EASY) { /* stupid dodge */ self->monsterinfo.duck_wait_time = level.time + eta + 1; @@ -898,7 +898,7 @@ infantry_sidestep(edict_t *self) (self->monsterinfo.currentmove == &infantry_move_attack2)) { /* if we're shooting, and not on easy, don't dodge */ - if (skill->value) + if (skill->value > SKILL_EASY) { self->monsterinfo.aiflags &= ~AI_DODGING; return; diff --git a/src/monster/insane/insane.c b/src/monster/insane/insane.c index e9b4d85..257e339 100644 --- a/src/monster/insane/insane.c +++ b/src/monster/insane/insane.c @@ -660,7 +660,7 @@ insane_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) /* suppress screaming and moaning for 1 second so pain sound plays */ self->fly_sound_debounce_time = level.time + 1; - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } diff --git a/src/monster/medic/medic.c b/src/monster/medic/medic.c index 9e25995..8d04e9c 100644 --- a/src/monster/medic/medic.c +++ b/src/monster/medic/medic.c @@ -653,7 +653,7 @@ medic_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) self->pain_debounce_time = level.time + 3; - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } @@ -1752,7 +1752,7 @@ medic_checkattack(edict_t *self) return true; } - if (skill->value > 0) + if (skill->value > SKILL_EASY) { if (self->monsterinfo.aiflags & AI_STAND_GROUND) { @@ -1813,7 +1813,7 @@ medic_duck(edict_t *self, float eta) return; } - if (skill->value == 0) + if (skill->value == SKILL_EASY) { /* stupid dodge */ self->monsterinfo.duck_wait_time = level.time + eta + 1; @@ -1845,7 +1845,7 @@ medic_sidestep(edict_t *self) (self->monsterinfo.currentmove == &medic_move_callReinforcements)) { /* if we're shooting, and not on easy, don't dodge */ - if (skill->value) + if (skill->value > SKILL_EASY) { self->monsterinfo.aiflags &= ~AI_DODGING; return; @@ -1945,19 +1945,19 @@ SP_monster_medic(edict_t *self) { self->s.skinnum = 2; - if (skill->value == 0) + if (skill->value == SKILL_EASY) { self->monsterinfo.monster_slots = 3; } - else if (skill->value == 1) + else if (skill->value == SKILL_MEDIUM) { self->monsterinfo.monster_slots = 4; } - else if (skill->value == 2) + else if (skill->value == SKILL_HARD) { self->monsterinfo.monster_slots = 6; } - else if (skill->value == 3) + else if (skill->value == SKILL_HARDPLUS) { self->monsterinfo.monster_slots = 6; } diff --git a/src/monster/mutant/mutant.c b/src/monster/mutant/mutant.c index 7aafdf5..025cf89 100644 --- a/src/monster/mutant/mutant.c +++ b/src/monster/mutant/mutant.c @@ -358,7 +358,7 @@ mutant_check_refire(edict_t *self) return; } - if (((skill->value == 3) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) + if (((skill->value == SKILL_HARDPLUS) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attack09; } @@ -674,7 +674,7 @@ mutant_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) self->pain_debounce_time = level.time + 3; - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } diff --git a/src/monster/parasite/parasite.c b/src/monster/parasite/parasite.c index ea425bf..bb31830 100644 --- a/src/monster/parasite/parasite.c +++ b/src/monster/parasite/parasite.c @@ -421,7 +421,7 @@ parasite_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage self->pain_debounce_time = level.time + 3; - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } diff --git a/src/monster/soldier/soldier.c b/src/monster/soldier/soldier.c index 47a5432..c2c34fe 100644 --- a/src/monster/soldier/soldier.c +++ b/src/monster/soldier/soldier.c @@ -517,7 +517,7 @@ soldier_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) return; } - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } @@ -640,7 +640,7 @@ soldier_fire(edict_t *self, int in_flash_number) vectoangles(aim, dir); AngleVectors(dir, forward, right, up); - if (skill->value < 2) + if (skill->value < SKILL_HARD) { r = crandom() * 1000; u = crandom() * 500; @@ -740,7 +740,7 @@ soldier_attack1_refire1(edict_t *self) return; } - if (((skill->value == 3) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) + if (((skill->value == SKILL_HARDPLUS) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak102; } @@ -773,7 +773,7 @@ soldier_attack1_refire2(edict_t *self) return; } - if (((skill->value == 3) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) + if (((skill->value == SKILL_HARDPLUS) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak102; } @@ -835,7 +835,7 @@ soldier_attack2_refire1(edict_t *self) return; } - if (((skill->value == 3) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) + if (((skill->value == SKILL_HARDPLUS) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak204; } @@ -868,7 +868,7 @@ soldier_attack2_refire2(edict_t *self) return; } - if (((skill->value == 3) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) + if (((skill->value == SKILL_HARDPLUS) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE)) { self->monsterinfo.nextframe = FRAME_attak204; } @@ -1012,7 +1012,7 @@ soldier_attack6_refire(edict_t *self) return; } - if ((skill->value == 3) || ((random() < (0.25 * ((float)skill->value))))) + if ((skill->value == SKILL_HARDPLUS) || ((random() < (0.25 * ((float)skill->value))))) { self->monsterinfo.nextframe = FRAME_runs03; } @@ -1141,7 +1141,7 @@ soldier_sight(edict_t *self, edict_t *other /* unused */) gi.sound(self, CHAN_VOICE, sound_sight2, 1, ATTN_NORM, 0); } - if ((skill->value > 0) && (self->enemy) && + if ((skill->value > SKILL_EASY) && (self->enemy) && (range(self, self->enemy) >= RANGE_NEAR)) { /* don't let machinegunners run & shoot */ @@ -1666,7 +1666,7 @@ soldier_duck(edict_t *self, float eta) /* has to be done immediately otherwise he can get stuck */ monster_duck_down(self); - if (skill->value == 0) + if (skill->value == SKILL_EASY) { self->monsterinfo.currentmove = &soldier_move_duck; self->monsterinfo.duck_wait_time = level.time + eta + 1; diff --git a/src/monster/stalker/stalker.c b/src/monster/stalker/stalker.c index 417320f..dd5cbb1 100644 --- a/src/monster/stalker/stalker.c +++ b/src/monster/stalker/stalker.c @@ -423,11 +423,11 @@ stalker_heal(edict_t *self) return; } - if (skill->value == 2) + if (skill->value == SKILL_HARD) { self->health += 2; } - else if (skill->value == 3) + else if (skill->value == SKILL_HARDPLUS) { self->health += 3; } @@ -547,7 +547,7 @@ stalker_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) self->s.skinnum = 1; } - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } diff --git a/src/monster/supertank/supertank.c b/src/monster/supertank/supertank.c index a7782e7..dd933f6 100644 --- a/src/monster/supertank/supertank.c +++ b/src/monster/supertank/supertank.c @@ -574,7 +574,7 @@ supertank_pain(edict_t *self, edict_t *other /* unused */, float kick, int damag } /* Don't go into pain if he's firing his rockets */ - if (skill->value >= 2) + if (skill->value >= SKILL_HARD) { if ((self->s.frame >= FRAME_attak2_1) && (self->s.frame <= FRAME_attak2_14)) @@ -585,7 +585,7 @@ supertank_pain(edict_t *self, edict_t *other /* unused */, float kick, int damag self->pain_debounce_time = level.time + 3; - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } diff --git a/src/monster/tank/tank.c b/src/monster/tank/tank.c index 5215880..ea5f30c 100644 --- a/src/monster/tank/tank.c +++ b/src/monster/tank/tank.c @@ -371,7 +371,7 @@ tank_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) } /* If hard or nightmare, don't go into pain while attacking */ - if (skill->value >= 2) + if (skill->value >= SKILL_HARD) { if ((self->s.frame >= FRAME_attak301) && (self->s.frame <= FRAME_attak330)) @@ -389,7 +389,7 @@ tank_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) self->pain_debounce_time = level.time + 3; gi.sound(self, CHAN_VOICE, sound_pain, 1, ATTN_NORM, 0); - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } @@ -722,7 +722,7 @@ tank_reattack_blaster(edict_t *self) return; } - if (skill->value >= 2) + if (skill->value >= SKILL_HARD) { if (visible(self, self->enemy)) { @@ -942,7 +942,7 @@ tank_refire_rocket(edict_t *self) } /* Only on hard or nightmare */ - if (skill->value >= 2) + if (skill->value >= SKILL_HARD) { if (self->enemy->health > 0) { diff --git a/src/monster/turret/turret.c b/src/monster/turret/turret.c index 137ac5b..afc4d2d 100644 --- a/src/monster/turret/turret.c +++ b/src/monster/turret/turret.c @@ -495,22 +495,22 @@ TurretFire(edict_t *self) { rocketSpeed = 550; - if (skill->value == 2) + if (skill->value == SKILL_HARD) { rocketSpeed += 200 * random(); } - else if (skill->value == 3) + else if (skill->value == SKILL_HARDPLUS) { rocketSpeed += 100 + (200 * random()); } } else if (self->spawnflags & SPAWN_BLASTER) { - if (skill->value == 0) + if (skill->value == SKILL_EASY) { rocketSpeed = 600; } - else if (skill->value == 1) + else if (skill->value == SKILL_MEDIUM) { rocketSpeed = 800; } @@ -616,11 +616,11 @@ TurretFireBlind(edict_t *self) { rocketSpeed = 550; - if (skill->value == 2) + if (skill->value == SKILL_HARD) { rocketSpeed += 200 * random(); } - else if (skill->value == 3) + else if (skill->value == SKILL_HARDPLUS) { rocketSpeed += 100 + (200 * random()); } @@ -1053,7 +1053,7 @@ turret_checkattack(edict_t *self) if (enemy_range == RANGE_MELEE) { /* don't always melee in easy mode */ - if ((skill->value == 0) && (rand() & 3)) + if ((skill->value == SKILL_EASY) && (rand() & 3)) { return false; } @@ -1078,11 +1078,11 @@ turret_checkattack(edict_t *self) nexttime = (0.8 - (0.1 * skill->value)); } - if (skill->value == 0) + if (skill->value == SKILL_EASY) { chance *= 0.5; } - else if (skill->value > 1) + else if (skill->value > SKILL_MEDIUM) { chance *= 2; } diff --git a/src/monster/widow/widow.c b/src/monster/widow/widow.c index 621ddae..a9ef6e7 100644 --- a/src/monster/widow/widow.c +++ b/src/monster/widow/widow.c @@ -1313,7 +1313,7 @@ widow_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) self->s.skinnum = 1; } - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } @@ -1336,7 +1336,7 @@ widow_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) } else if (damage < 75) { - if ((skill->value < 3) && (random() < (0.6 - (0.2 * ((float)skill->value))))) + if ((skill->value < SKILL_HARDPLUS) && (random() < (0.6 - (0.2 * ((float)skill->value))))) { self->monsterinfo.currentmove = &widow_move_pain_light; self->monsterinfo.aiflags &= ~AI_MANUAL_STEERING; @@ -1346,7 +1346,7 @@ widow_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) } else { - if ((skill->value < 3) && (random() < (0.75 - (0.1 * ((float)skill->value))))) + if ((skill->value < SKILL_HARDPLUS) && (random() < (0.75 - (0.1 * ((float)skill->value))))) { self->monsterinfo.currentmove = &widow_move_pain_heavy; self->monsterinfo.aiflags &= ~AI_MANUAL_STEERING; @@ -1463,15 +1463,15 @@ WidowRespondPowerup(edict_t *self, edict_t *other) if (other->s.effects & EF_QUAD) { - if (skill->value == 1) + if (skill->value == SKILL_MEDIUM) { WidowDouble(self, other->client->quad_framenum); } - else if (skill->value == 2) + else if (skill->value == SKILL_HARD) { WidowGoinQuad(self, other->client->quad_framenum); } - else if (skill->value == 3) + else if (skill->value == SKILL_HARDPLUS) { WidowGoinQuad(self, other->client->quad_framenum); WidowPowerArmor(self); @@ -1479,11 +1479,11 @@ WidowRespondPowerup(edict_t *self, edict_t *other) } else if (other->s.effects & EF_DOUBLE) { - if (skill->value == 2) + if (skill->value == SKILL_HARD) { WidowDouble(self, other->client->double_framenum); } - else if (skill->value == 3) + else if (skill->value == SKILL_HARDPLUS) { WidowDouble(self, other->client->double_framenum); WidowPowerArmor(self); @@ -1496,15 +1496,15 @@ WidowRespondPowerup(edict_t *self, edict_t *other) if (other->s.effects & EF_PENT) { - if (skill->value == 1) + if (skill->value == SKILL_MEDIUM) { WidowPowerArmor(self); } - else if (skill->value == 2) + else if (skill->value == SKILL_HARD) { WidowPent(self, other->client->invincible_framenum); } - else if (skill->value == 3) + else if (skill->value == SKILL_HARDPLUS) { WidowPent(self, other->client->invincible_framenum); WidowPowerArmor(self); @@ -1688,7 +1688,7 @@ Widow_CheckAttack(edict_t *self) if (real_enemy_range <= (MELEE_DISTANCE + 20)) { /* don't always melee in easy mode */ - if ((skill->value == 0) && (rand() & 3)) + if ((skill->value == SKILL_EASY) && (rand() & 3)) { return false; } @@ -1778,14 +1778,14 @@ WidowCalcSlots(edict_t *self) switch ((int)skill->value) { - case 0: - case 1: + case SKILL_EASY: + case SKILL_MEDIUM: self->monsterinfo.monster_slots = 3; break; - case 2: + case SKILL_HARD: self->monsterinfo.monster_slots = 4; break; - case 3: + case SKILL_HARDPLUS: self->monsterinfo.monster_slots = 6; break; default: @@ -1872,7 +1872,7 @@ SP_monster_widow(edict_t *self) self->gib_health = -5000; self->mass = 1500; - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = 500; diff --git a/src/monster/widow/widow2.c b/src/monster/widow/widow2.c index f9b6785..f9eac96 100644 --- a/src/monster/widow/widow2.c +++ b/src/monster/widow/widow2.c @@ -1140,7 +1140,7 @@ widow2_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) self->s.skinnum = 1; } - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { return; /* no pain anims in nightmare */ } @@ -1160,7 +1160,7 @@ widow2_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) { gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NONE, 0); - if ((skill->value < 3) && + if ((skill->value < SKILL_HARDPLUS) && (random() < (0.6 - (0.2 * ((float)skill->value))))) { self->monsterinfo.aiflags &= ~AI_MANUAL_STEERING; @@ -1171,7 +1171,7 @@ widow2_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) { gi.sound(self, CHAN_VOICE, sound_pain3, 1, ATTN_NONE, 0); - if ((skill->value < 3) && + if ((skill->value < SKILL_HARDPLUS) && (random() < (0.75 - (0.1 * ((float)skill->value))))) { self->monsterinfo.aiflags &= ~AI_MANUAL_STEERING; @@ -1366,7 +1366,7 @@ Widow2_CheckAttack(edict_t *self) if (widow2_tongue_attack_ok(spot1, spot2, 256)) { /* be nice in easy mode */ - if ((skill->value == 0) && (rand() & 3)) + if ((skill->value == SKILL_EASY) && (rand() & 3)) { return false; } @@ -1488,7 +1488,7 @@ SP_monster_widow2(edict_t *self) self->gib_health = -900; self->mass = 2500; - if (skill->value == 3) + if (skill->value == SKILL_HARDPLUS) { self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD; self->monsterinfo.power_armor_power = 750; diff --git a/src/player/hud.c b/src/player/hud.c index ee71806..02a33ca 100644 --- a/src/player/hud.c +++ b/src/player/hud.c @@ -322,15 +322,15 @@ HelpComputerMessage(edict_t *ent) return; } - if (skill->value == 0) + if (skill->value == SKILL_EASY) { sk = "easy"; } - else if (skill->value == 1) + else if (skill->value == SKILL_MEDIUM) { sk = "medium"; } - else if (skill->value == 2) + else if (skill->value == SKILL_HARD) { sk = "hard"; }