From e6f86e95bc5162aa11f0c27018bd5b91797d1bb5 Mon Sep 17 00:00:00 2001 From: Aaron Dean <8dino2@gmail.com> Date: Wed, 6 Sep 2023 15:18:06 -0400 Subject: [PATCH] Trying to remove more dependencies from xatrix and rogue --- actionlite/g_ai.cpp | 24 +- actionlite/g_combat.cpp | 48 +- actionlite/g_func.cpp | 4 +- actionlite/g_items.cpp | 108 +- actionlite/g_local.h | 107 +- actionlite/g_main.cpp | 4 +- actionlite/g_monster.cpp | 8 +- actionlite/g_phys.cpp | 8 +- actionlite/g_spawn.cpp | 148 +-- actionlite/m_infantry.cpp | 928 --------------- actionlite/m_infantry.h | 280 ----- actionlite/m_medic.cpp | 1643 -------------------------- actionlite/m_medic.h | 248 ---- actionlite/m_move.cpp | 6 +- actionlite/rogue/g_rogue_newai.cpp | 4 +- actionlite/rogue/m_rogue_stalker.cpp | 2 +- 16 files changed, 235 insertions(+), 3335 deletions(-) delete mode 100644 actionlite/m_infantry.cpp delete mode 100644 actionlite/m_infantry.h delete mode 100644 actionlite/m_medic.cpp delete mode 100644 actionlite/m_medic.h diff --git a/actionlite/g_ai.cpp b/actionlite/g_ai.cpp index b542b5e..e3ef4e6 100644 --- a/actionlite/g_ai.cpp +++ b/actionlite/g_ai.cpp @@ -838,13 +838,13 @@ bool FindTarget(edict_t *self) // // got one // - // ROGUE - if we got an enemy, we need to bail out of hint paths, so take over here - if (self->monsterinfo.aiflags & AI_HINT_PATH) - hintpath_stop(self); // this calls foundtarget for us - else - FoundTarget(self); + // // ROGUE - if we got an enemy, we need to bail out of hint paths, so take over here + // if (self->monsterinfo.aiflags & AI_HINT_PATH) + // //hintpath_stop(self); // this calls foundtarget for us + // else + // FoundTarget(self); - // ROGUE + // // ROGUE if (!(self->monsterinfo.aiflags & AI_SOUND_TARGET) && (self->monsterinfo.sight) && // Paril: adjust to prevent monsters getting stuck in sight loops !ignore_sight_sound) @@ -1136,7 +1136,7 @@ void ai_run_slide(edict_t *self, float distance) // PMM - if we're dodging, give up on it and go straight if (self->monsterinfo.aiflags & AI_DODGING) { - monster_done_dodge(self); + //monster_done_dodge(self); // by setting as_straight, caller will know to try straight move self->monsterinfo.attack_state = AS_STRAIGHT; return; @@ -1147,7 +1147,7 @@ void ai_run_slide(edict_t *self, float distance) return; // PMM - if we're dodging, give up on it and go straight if (self->monsterinfo.aiflags & AI_DODGING) - monster_done_dodge(self); + //monster_done_dodge(self); // PMM - the move failed, so signal the caller (ai_run) to try going straight self->monsterinfo.attack_state = AS_STRAIGHT; @@ -1435,20 +1435,20 @@ void ai_run(edict_t *self, float dist) else // uh oh, can't figure out enemy, bail { self->enemy = nullptr; - hintpath_stop(self); + //hintpath_stop(self); return; } } else { self->enemy = nullptr; - hintpath_stop(self); + //hintpath_stop(self); return; } } else { - hintpath_stop(self); + //hintpath_stop(self); return; } @@ -1469,7 +1469,7 @@ void ai_run(edict_t *self, float dist) // if we see the player, stop following hintpaths. if (gotcha) // disconnect from hintpaths and start looking normally for players. - hintpath_stop(self); + //hintpath_stop(self); return; } diff --git a/actionlite/g_combat.cpp b/actionlite/g_combat.cpp index a277589..336de0b 100644 --- a/actionlite/g_combat.cpp +++ b/actionlite/g_combat.cpp @@ -89,10 +89,10 @@ void Killed(edict_t *targ, edict_t *inflictor, edict_t *attacker, int damage, co // [Paril-KEX] if ((targ->svflags & SVF_MONSTER) && targ->monsterinfo.aiflags & AI_MEDIC) { - if (targ->enemy && targ->enemy->inuse && (targ->enemy->svflags & SVF_MONSTER)) // god, I hope so - { - cleanupHealTarget(targ->enemy); - } + // if (targ->enemy && targ->enemy->inuse && (targ->enemy->svflags & SVF_MONSTER)) // god, I hope so + // { + // cleanupHealTarget(targ->enemy); + // } // clean up self targ->monsterinfo.aiflags &= ~AI_MEDIC; @@ -306,13 +306,13 @@ void M_ReactToDamage(edict_t *targ, edict_t *attacker, edict_t *inflictor) // logic for tesla - if you are hit by a tesla, and can't see who you should be mad at (attacker) // attack the tesla // also, target the tesla if it's a "new" tesla - if ((inflictor) && (!strcmp(inflictor->classname, "tesla_mine"))) - { - new_tesla = MarkTeslaArea(targ, inflictor); - if ((new_tesla || brandom()) && (!targ->enemy || !targ->enemy->classname || strcmp(targ->enemy->classname, "tesla_mine"))) - TargetTesla(targ, inflictor); - return; - } + // if ((inflictor) && (!strcmp(inflictor->classname, "tesla_mine"))) + // { + // new_tesla = MarkTeslaArea(targ, inflictor); + // if ((new_tesla || brandom()) && (!targ->enemy || !targ->enemy->classname || strcmp(targ->enemy->classname, "tesla_mine"))) + // TargetTesla(targ, inflictor); + // return; + // } // ROGUE //======= @@ -363,7 +363,7 @@ void M_ReactToDamage(edict_t *targ, edict_t *attacker, edict_t *inflictor) return; // remove the medic flag - cleanupHealTarget(targ->enemy); + //cleanupHealTarget(targ->enemy); targ->monsterinfo.aiflags &= ~AI_MEDIC; } // PMM @@ -393,10 +393,10 @@ void M_ReactToDamage(edict_t *targ, edict_t *attacker, edict_t *inflictor) // [Paril-KEX] if ((targ->svflags & SVF_MONSTER) && targ->monsterinfo.aiflags & AI_MEDIC) { - if (targ->enemy && targ->enemy->inuse && (targ->enemy->svflags & SVF_MONSTER)) // god, I hope so - { - cleanupHealTarget(targ->enemy); - } + // if (targ->enemy && targ->enemy->inuse && (targ->enemy->svflags & SVF_MONSTER)) // god, I hope so + // { + // //cleanupHealTarget(targ->enemy); + // } // clean up self targ->monsterinfo.aiflags &= ~AI_MEDIC; @@ -421,10 +421,10 @@ void M_ReactToDamage(edict_t *targ, edict_t *attacker, edict_t *inflictor) // [Paril-KEX] if ((targ->svflags & SVF_MONSTER) && targ->monsterinfo.aiflags & AI_MEDIC) { - if (targ->enemy && targ->enemy->inuse && (targ->enemy->svflags & SVF_MONSTER)) // god, I hope so - { - cleanupHealTarget(targ->enemy); - } + // if (targ->enemy && targ->enemy->inuse && (targ->enemy->svflags & SVF_MONSTER)) // god, I hope so + // { + // cleanupHealTarget(targ->enemy); + // } // clean up self targ->monsterinfo.aiflags &= ~AI_MEDIC; @@ -445,10 +445,10 @@ void M_ReactToDamage(edict_t *targ, edict_t *attacker, edict_t *inflictor) // [Paril-KEX] if ((targ->svflags & SVF_MONSTER) && targ->monsterinfo.aiflags & AI_MEDIC) { - if (targ->enemy && targ->enemy->inuse && (targ->enemy->svflags & SVF_MONSTER)) // god, I hope so - { - cleanupHealTarget(targ->enemy); - } + // if (targ->enemy && targ->enemy->inuse && (targ->enemy->svflags & SVF_MONSTER)) // god, I hope so + // { + // cleanupHealTarget(targ->enemy); + // } // clean up self targ->monsterinfo.aiflags &= ~AI_MEDIC; diff --git a/actionlite/g_func.cpp b/actionlite/g_func.cpp index bca3b89..c0e7f52 100644 --- a/actionlite/g_func.cpp +++ b/actionlite/g_func.cpp @@ -434,7 +434,7 @@ MOVEINFO_ENDFUNC(plat_hit_bottom) (edict_t *ent) -> void ent->moveinfo.state = STATE_BOTTOM; // ROGUE - plat2_kill_danger_area(ent); + //plat2_kill_danger_area(ent); // ROGUE } @@ -466,7 +466,7 @@ void plat_go_up(edict_t *ent) Move_Calc(ent, ent->moveinfo.start_origin, plat_hit_top); // ROGUE - plat2_spawn_danger_area(ent); + //plat2_spawn_danger_area(ent); // ROGUE } diff --git a/actionlite/g_items.cpp b/actionlite/g_items.cpp index 33188f7..5973d5f 100644 --- a/actionlite/g_items.cpp +++ b/actionlite/g_items.cpp @@ -180,21 +180,21 @@ THINK(DoRespawn) (edict_t *ent) -> void ent->s.event = EV_ITEM_RESPAWN; // ROGUE - if (g_dm_random_items->integer) - { - item_id_t new_item = DoRandomRespawn(ent); + // if (g_dm_random_items->integer) + // { + // item_id_t new_item = DoRandomRespawn(ent); - // if we've changed entities, then do some sleight of hand. - // otherwise, the old entity will respawn - if (new_item) - { - ent->item = GetItemByIndex(new_item); + // // if we've changed entities, then do some sleight of hand. + // // otherwise, the old entity will respawn + // if (new_item) + // { + // ent->item = GetItemByIndex(new_item); - ent->classname = ent->item->classname; - ent->s.effects = ent->item->world_model_flags; - gi.setmodel(ent, ent->item->world_model); - } - } + // ent->classname = ent->item->classname; + // ent->s.effects = ent->item->world_model_flags; + // gi.setmodel(ent, ent->item->world_model); + // } + // } // ROGUE } @@ -1082,7 +1082,7 @@ void SpawnItem(edict_t *ent, gitem_t *item) // [Kex] In instagib, spawn no pickups! if (g_instagib->value) { - if (item->pickup == Pickup_Powerup || item->pickup == Pickup_Sphere || item->pickup == Pickup_Doppleganger || + if (item->pickup == Pickup_Powerup || (item->flags & IF_HEALTH) || (item->flags & IF_AMMO) || item->pickup == Pickup_Weapon || item->pickup == Pickup_Pack) { G_FreeEdict(ent); @@ -1097,21 +1097,21 @@ void SpawnItem(edict_t *ent, gitem_t *item) G_FreeEdict(ent); return; } - //===== - // ROGUE - if (item->pickup == Pickup_Sphere) - { - G_FreeEdict(ent); - return; - } - if (item->pickup == Pickup_Doppleganger) - { - G_FreeEdict(ent); - return; - } - // ROGUE - //===== - } + // //===== + // // ROGUE + // if (item->pickup == Pickup_Sphere) + // { + // G_FreeEdict(ent); + // return; + // } + // if (item->pickup == Pickup_Doppleganger) + // { + // G_FreeEdict(ent); + // return; + // } + // // ROGUE + // //===== + // } if (g_no_health->integer) { if (item->flags & IF_HEALTH) @@ -1129,14 +1129,14 @@ void SpawnItem(edict_t *ent, gitem_t *item) } } - if (g_no_spheres->integer) - { - if (item->pickup == Pickup_Sphere) - { - G_FreeEdict(ent); - return; - } - } + // if (g_no_spheres->integer) + // { + // if (item->pickup == Pickup_Sphere) + // { + // G_FreeEdict(ent); + // return; + // } + // } // ROGUE //========== } @@ -1144,21 +1144,21 @@ void SpawnItem(edict_t *ent, gitem_t *item) //========== // ROGUE // DM only items - if (!deathmatch->integer) - { - if (item->pickup == Pickup_Doppleganger || item->pickup == Pickup_Nuke) - { - gi.Com_PrintFmt("{} spawned in non-DM; freeing...\n", *ent); - G_FreeEdict(ent); - return; - } - if ((item->use == Use_Vengeance) || (item->use == Use_Hunter)) - { - gi.Com_PrintFmt("{} spawned in non-DM; freeing...\n", *ent); - G_FreeEdict(ent); - return; - } - } + // if (!deathmatch->integer) + // { + // if (item->pickup == Pickup_Doppleganger || item->pickup == Pickup_Nuke) + // { + // gi.Com_PrintFmt("{} spawned in non-DM; freeing...\n", *ent); + // G_FreeEdict(ent); + // return; + // } + // if ((item->use == Use_Vengeance) || (item->use == Use_Hunter)) + // { + // gi.Com_PrintFmt("{} spawned in non-DM; freeing...\n", *ent); + // G_FreeEdict(ent); + // return; + // } + // } // ZOID // Don't spawn the flags unless enabled if (!ctf->integer && (item->id == IT_FLAG1 || item->id == IT_FLAG2)) @@ -1188,8 +1188,8 @@ void SpawnItem(edict_t *ent, gitem_t *item) if (ent->model) gi.modelindex(ent->model); - if (ent->spawnflags.has(SPAWNFLAG_ITEM_TRIGGER_SPAWN)) - SetTriggeredSpawn(ent); + // if (ent->spawnflags.has(SPAWNFLAG_ITEM_TRIGGER_SPAWN)) + // SetTriggeredSpawn(ent); // ZOID // flags are server animated and have special handling diff --git a/actionlite/g_local.h b/actionlite/g_local.h index 136a0ad..c3d5217 100644 --- a/actionlite/g_local.h +++ b/actionlite/g_local.h @@ -2272,7 +2272,7 @@ void Killed(edict_t *targ, edict_t *inflictor, edict_t *attacker, int damage, co void T_RadiusNukeDamage(edict_t *inflictor, edict_t *attacker, float damage, edict_t *ignore, float radius, mod_t mod); void T_RadiusClassDamage(edict_t *inflictor, edict_t *attacker, float damage, char *ignoreClass, float radius, mod_t mod); -void cleanupHealTarget(edict_t *ent); +//void cleanupHealTarget(edict_t *ent); // ROGUE constexpr int32_t DEFAULT_BULLET_HSPREAD = 300; @@ -2310,8 +2310,7 @@ void monster_fire_shotgun(edict_t *self, const vec3_t &start, const vec3_t &aimd int vspread, int count, monster_muzzleflash_id_t flashtype); void monster_fire_blaster(edict_t *self, const vec3_t &start, const vec3_t &dir, int damage, int speed, monster_muzzleflash_id_t flashtype, effects_t effect); -void monster_fire_flechette(edict_t *self, const vec3_t &start, const vec3_t &dir, int damage, int speed, - monster_muzzleflash_id_t flashtype); +//void monster_fire_flechette(edict_t *self, const vec3_t &start, const vec3_t &dir, int damage, int speed, monster_muzzleflash_id_t flashtype); void monster_fire_grenade(edict_t *self, const vec3_t &start, const vec3_t &aimdir, int damage, int speed, monster_muzzleflash_id_t flashtype, float right_adjust, float up_adjust); void monster_fire_rocket(edict_t *self, const vec3_t &start, const vec3_t &dir, int damage, int speed, @@ -2369,7 +2368,7 @@ void monster_fire_tracker(edict_t *self, const vec3_t &start, const vec3_t &dir, void monster_fire_heatbeam(edict_t *self, const vec3_t &start, const vec3_t &dir, const vec3_t &offset, int damage, int kick, monster_muzzleflash_id_t flashtype); void stationarymonster_start(edict_t *self); -void monster_done_dodge(edict_t *self); +//void monster_done_dodge(edict_t *self); // ROGUE stuck_result_t G_FixStuckObject(edict_t *self, vec3_t check); @@ -2680,16 +2679,16 @@ void GetChaseTarget(edict_t *ent); // // g_newweap.c // -void fire_flechette(edict_t *self, const vec3_t &start, const vec3_t &dir, int damage, int speed, int kick); -void fire_prox(edict_t *self, const vec3_t &start, const vec3_t &aimdir, int damage, int speed); -void fire_nuke(edict_t *self, const vec3_t &start, const vec3_t &aimdir, int speed); -bool fire_player_melee(edict_t *self, const vec3_t &start, const vec3_t &aim, int reach, int damage, int kick, mod_t mod); -void fire_tesla(edict_t *self, const vec3_t &start, const vec3_t &aimdir, int damage, int speed); -void fire_blaster2(edict_t *self, const vec3_t &start, const vec3_t &aimdir, int damage, int speed, effects_t effect, - bool hyper); -void fire_heatbeam(edict_t *self, const vec3_t &start, const vec3_t &aimdir, const vec3_t &offset, int damage, int kick, - bool monster); -void fire_tracker(edict_t *self, const vec3_t &start, const vec3_t &dir, int damage, int speed, edict_t *enemy); +// void fire_flechette(edict_t *self, const vec3_t &start, const vec3_t &dir, int damage, int speed, int kick); +// void fire_prox(edict_t *self, const vec3_t &start, const vec3_t &aimdir, int damage, int speed); +// void fire_nuke(edict_t *self, const vec3_t &start, const vec3_t &aimdir, int speed); +// bool fire_player_melee(edict_t *self, const vec3_t &start, const vec3_t &aim, int reach, int damage, int kick, mod_t mod); +// void fire_tesla(edict_t *self, const vec3_t &start, const vec3_t &aimdir, int damage, int speed); +// void fire_blaster2(edict_t *self, const vec3_t &start, const vec3_t &aimdir, int damage, int speed, effects_t effect, +// bool hyper); +// void fire_heatbeam(edict_t *self, const vec3_t &start, const vec3_t &aimdir, const vec3_t &offset, int damage, int kick, +// bool monster); +// void fire_tracker(edict_t *self, const vec3_t &start, const vec3_t &dir, int damage, int speed, edict_t *enemy); // // g_newai.c @@ -2710,8 +2709,8 @@ bool inback(edict_t *self, edict_t *other); float realrange(edict_t *self, edict_t *other); edict_t *SpawnBadArea(const vec3_t &mins, const vec3_t &maxs, gtime_t lifespan, edict_t *owner); edict_t *CheckForBadArea(edict_t *ent); -bool MarkTeslaArea(edict_t *self, edict_t *tesla); -void InitHintPaths(); +//bool MarkTeslaArea(edict_t *self, edict_t *tesla); +//void InitHintPaths(); void PredictAim(edict_t *self, edict_t *target, const vec3_t &start, float bolt_speed, bool eye_height, float offset, vec3_t *aimdir, vec3_t *aimpoint); bool M_CalculatePitchToFire(edict_t *self, const vec3_t &target, const vec3_t &start, vec3_t &aim, float speed, float time_remaining, bool mortar, bool destroy_on_touch = false); @@ -2722,16 +2721,16 @@ void monster_duck_down(edict_t *self); void monster_duck_hold(edict_t *self); void monster_duck_up(edict_t *self); bool has_valid_enemy(edict_t *self); -void TargetTesla(edict_t *self, edict_t *tesla); -void hintpath_stop(edict_t *self); +//void TargetTesla(edict_t *self, edict_t *tesla); +//void hintpath_stop(edict_t *self); edict_t *PickCoopTarget(edict_t *self); int CountPlayers(); bool monster_jump_finished(edict_t *self); void BossExplode(edict_t *self); // g_rogue_func -void plat2_spawn_danger_area(edict_t *ent); -void plat2_kill_danger_area(edict_t *ent); +// void plat2_spawn_danger_area(edict_t *ent); +// void plat2_kill_danger_area(edict_t *ent); // g_rogue_spawn edict_t *CreateMonster(const vec3_t &origin, const vec3_t &angles, const char *classname); @@ -2748,18 +2747,18 @@ void SpawnGrow_Spawn(const vec3_t &startpos, float start_size, float end_size); void Widowlegs_Spawn(const vec3_t &startpos, const vec3_t &angles); // g_rogue_items -bool Pickup_Nuke(edict_t *ent, edict_t *other); -void Use_IR(edict_t *ent, gitem_t *item); -void Use_Double(edict_t *ent, gitem_t *item); -void Use_Nuke(edict_t *ent, gitem_t *item); -void Use_Doppleganger(edict_t *ent, gitem_t *item); -bool Pickup_Doppleganger(edict_t *ent, edict_t *other); -bool Pickup_Sphere(edict_t *ent, edict_t *other); -void Use_Defender(edict_t *ent, gitem_t *item); -void Use_Hunter(edict_t *ent, gitem_t *item); -void Use_Vengeance(edict_t *ent, gitem_t *item); -void Item_TriggeredSpawn(edict_t *self, edict_t *other, edict_t *activator); -void SetTriggeredSpawn(edict_t *ent); +// bool Pickup_Nuke(edict_t *ent, edict_t *other); +// void Use_IR(edict_t *ent, gitem_t *item); +// void Use_Double(edict_t *ent, gitem_t *item); +// void Use_Nuke(edict_t *ent, gitem_t *item); +// void Use_Doppleganger(edict_t *ent, gitem_t *item); +// bool Pickup_Doppleganger(edict_t *ent, edict_t *other); +// bool Pickup_Sphere(edict_t *ent, edict_t *other); +// void Use_Defender(edict_t *ent, gitem_t *item); +// void Use_Hunter(edict_t *ent, gitem_t *item); +// void Use_Vengeance(edict_t *ent, gitem_t *item); +// void Item_TriggeredSpawn(edict_t *self, edict_t *other, edict_t *activator); +// void SetTriggeredSpawn(edict_t *ent); // // g_sphere.c @@ -2771,12 +2770,12 @@ void Hunter_Launch(edict_t *self); // // g_newdm.c // -void InitGameRules(); -item_id_t DoRandomRespawn(edict_t *ent); -void PrecacheForRandomRespawn(); -bool Tag_PickupToken(edict_t *ent, edict_t *other); -void Tag_DropToken(edict_t *ent, gitem_t *item); -void fire_doppleganger(edict_t *ent, const vec3_t &start, const vec3_t &aimdir); +//void InitGameRules(); +//item_id_t DoRandomRespawn(edict_t *ent); +//void PrecacheForRandomRespawn(); +//bool Tag_PickupToken(edict_t *ent, edict_t *other); +//void Tag_DropToken(edict_t *ent, gitem_t *item); +//void fire_doppleganger(edict_t *ent, const vec3_t &start, const vec3_t &aimdir); // // p_client.c @@ -3636,23 +3635,23 @@ enum RDM_DEATHBALL = 3 }; -struct dm_game_rt -{ - void (*GameInit)(); - void (*PostInitSetup)(); - void (*ClientBegin)(edict_t *ent); - bool (*SelectSpawnPoint)(edict_t *ent, vec3_t &origin, vec3_t &angles, bool force_spawn); - void (*PlayerDeath)(edict_t *targ, edict_t *inflictor, edict_t *attacker); - void (*Score)(edict_t *attacker, edict_t *victim, int scoreChange, const mod_t &mod); - void (*PlayerEffects)(edict_t *ent); - void (*DogTag)(edict_t *ent, edict_t *killer, const char **pic); - void (*PlayerDisconnect)(edict_t *ent); - int (*ChangeDamage)(edict_t *targ, edict_t *attacker, int damage, mod_t mod); - int (*ChangeKnockback)(edict_t *targ, edict_t *attacker, int knockback, mod_t mod); - int (*CheckDMRules)(); -}; +// struct dm_game_rt +// { +// void (*GameInit)(); +// void (*PostInitSetup)(); +// void (*ClientBegin)(edict_t *ent); +// bool (*SelectSpawnPoint)(edict_t *ent, vec3_t &origin, vec3_t &angles, bool force_spawn); +// void (*PlayerDeath)(edict_t *targ, edict_t *inflictor, edict_t *attacker); +// void (*Score)(edict_t *attacker, edict_t *victim, int scoreChange, const mod_t &mod); +// void (*PlayerEffects)(edict_t *ent); +// void (*DogTag)(edict_t *ent, edict_t *killer, const char **pic); +// void (*PlayerDisconnect)(edict_t *ent); +// int (*ChangeDamage)(edict_t *targ, edict_t *attacker, int damage, mod_t mod); +// int (*ChangeKnockback)(edict_t *targ, edict_t *attacker, int knockback, mod_t mod); +// int (*CheckDMRules)(); +// }; -extern dm_game_rt DMGame; +// extern dm_game_rt DMGame; // ROGUE //============ diff --git a/actionlite/g_main.cpp b/actionlite/g_main.cpp index 11c5315..f8087b8 100644 --- a/actionlite/g_main.cpp +++ b/actionlite/g_main.cpp @@ -482,8 +482,8 @@ void InitGame() //====== // ROGUE - if (gamerules->integer) - InitGameRules(); // if there are game rules to set up, do so now. + // if (gamerules->integer) + // InitGameRules(); // if there are game rules to set up, do so now. // ROGUE //====== diff --git a/actionlite/g_monster.cpp b/actionlite/g_monster.cpp index 34e3265..bd9d6c4 100644 --- a/actionlite/g_monster.cpp +++ b/actionlite/g_monster.cpp @@ -644,10 +644,10 @@ void M_ProcessPain(edict_t *e) // ROGUE if (e->monsterinfo.aiflags & AI_MEDIC) { - if (e->enemy && e->enemy->inuse && (e->enemy->svflags & SVF_MONSTER)) // god, I hope so - { - cleanupHealTarget(e->enemy); - } + // if (e->enemy && e->enemy->inuse && (e->enemy->svflags & SVF_MONSTER)) // god, I hope so + // { + // cleanupHealTarget(e->enemy); + // } // clean up self e->monsterinfo.aiflags &= ~AI_MEDIC; diff --git a/actionlite/g_phys.cpp b/actionlite/g_phys.cpp index 3ba1daa..27eb6ba 100644 --- a/actionlite/g_phys.cpp +++ b/actionlite/g_phys.cpp @@ -23,7 +23,7 @@ solid_edge items only clip against bsp models. */ -void SV_Physics_NewToss(edict_t *ent); // PGM +//void SV_Physics_NewToss(edict_t *ent); // PGM // [Paril-KEX] fetch the clipmask for this entity; certain modifiers // affect the clipping behavior of objects. @@ -994,9 +994,9 @@ void G_RunEntity(edict_t *ent) SV_Physics_Toss(ent); break; // ROGUE - case MOVETYPE_NEWTOSS: - SV_Physics_NewToss(ent); - break; + // case MOVETYPE_NEWTOSS: + // SV_Physics_NewToss(ent); + // break; // ROGUE default: gi.Com_ErrorFmt("SV_Physics: bad movetype {}", (int32_t) ent->movetype); diff --git a/actionlite/g_spawn.cpp b/actionlite/g_spawn.cpp index e17a0fd..da55852 100644 --- a/actionlite/g_spawn.cpp +++ b/actionlite/g_spawn.cpp @@ -165,34 +165,34 @@ void SP_monster_medic(edict_t *self); // void SP_monster_chick_heat(edict_t *self); // void SP_monster_gladb(edict_t *self); // void SP_monster_boss5(edict_t *self); -void SP_rotating_light(edict_t *self); -void SP_object_repair(edict_t *self); -void SP_misc_crashviper(edict_t *ent); -void SP_misc_viper_missile(edict_t *self); -void SP_misc_amb4(edict_t *ent); -void SP_target_mal_laser(edict_t *ent); -void SP_misc_transport(edict_t *ent); +// void SP_rotating_light(edict_t *self); +// void SP_object_repair(edict_t *self); +// void SP_misc_crashviper(edict_t *ent); +// void SP_misc_viper_missile(edict_t *self); +// void SP_misc_amb4(edict_t *ent); +// void SP_target_mal_laser(edict_t *ent); +// void SP_misc_transport(edict_t *ent); // END 14-APR-98 void SP_misc_nuke(edict_t *ent); //=========== // ROGUE -void SP_func_plat2(edict_t *ent); -void SP_func_door_secret2(edict_t *ent); -void SP_func_force_wall(edict_t *ent); -void SP_info_player_coop_lava(edict_t *self); -void SP_info_teleport_destination(edict_t *self); -void SP_trigger_teleport(edict_t *self); -void SP_trigger_disguise(edict_t *self); +// void SP_func_plat2(edict_t *ent); +// void SP_func_door_secret2(edict_t *ent); +// void SP_func_force_wall(edict_t *ent); +// void SP_info_player_coop_lava(edict_t *self); +// void SP_info_teleport_destination(edict_t *self); +// void SP_trigger_teleport(edict_t *self); +// void SP_trigger_disguise(edict_t *self); // void SP_monster_stalker(edict_t *self); // void SP_monster_turret(edict_t *self); -void SP_target_steam(edict_t *self); -void SP_target_anger(edict_t *self); -void SP_target_killplayers(edict_t *self); +// void SP_target_steam(edict_t *self); +// void SP_target_anger(edict_t *self); +// void SP_target_killplayers(edict_t *self); // PMM - still experimental! -void SP_target_blacklight(edict_t *self); -void SP_target_orb(edict_t *self); +// void SP_target_blacklight(edict_t *self); +// void SP_target_orb(edict_t *self); // pmm void SP_hint_path(edict_t *self); // void SP_monster_carrier(edict_t *self); @@ -370,14 +370,14 @@ static const std::initializer_list spawns = { //{ "turret_driver", SP_turret_driver }, // RAFAEL - { "func_object_repair", SP_object_repair }, - { "rotating_light", SP_rotating_light }, - { "target_mal_laser", SP_target_mal_laser }, - { "misc_crashviper", SP_misc_crashviper }, - { "misc_viper_missile", SP_misc_viper_missile }, - { "misc_amb4", SP_misc_amb4 }, - { "misc_transport", SP_misc_transport }, - { "misc_nuke", SP_misc_nuke }, + // { "func_object_repair", SP_object_repair }, + // { "rotating_light", SP_rotating_light }, + // { "target_mal_laser", SP_target_mal_laser }, + // { "misc_crashviper", SP_misc_crashviper }, + // { "misc_viper_missile", SP_misc_viper_missile }, + // { "misc_amb4", SP_misc_amb4 }, + // { "misc_transport", SP_misc_transport }, + // { "misc_nuke", SP_misc_nuke }, // { "monster_soldier_hypergun", SP_monster_soldier_hypergun }, // { "monster_soldier_lasergun", SP_monster_soldier_lasergun }, // { "monster_soldier_ripper", SP_monster_soldier_ripper }, @@ -390,38 +390,38 @@ static const std::initializer_list spawns = { //============== // ROGUE - { "func_plat2", SP_func_plat2 }, - { "func_door_secret2", SP_func_door_secret2 }, - { "func_force_wall", SP_func_force_wall }, - { "trigger_teleport", SP_trigger_teleport }, - { "trigger_disguise", SP_trigger_disguise }, - { "info_teleport_destination", SP_info_teleport_destination }, - { "info_player_coop_lava", SP_info_player_coop_lava }, - // { "monster_stalker", SP_monster_stalker }, - // { "monster_turret", SP_monster_turret }, - { "target_steam", SP_target_steam }, - { "target_anger", SP_target_anger }, - { "target_killplayers", SP_target_killplayers }, - // PMM - experiment - { "target_blacklight", SP_target_blacklight }, - { "target_orb", SP_target_orb }, - // pmm - //{ "monster_daedalus", SP_monster_hover }, - { "hint_path", SP_hint_path }, + // { "func_plat2", SP_func_plat2 }, + // { "func_door_secret2", SP_func_door_secret2 }, + // { "func_force_wall", SP_func_force_wall }, + // { "trigger_teleport", SP_trigger_teleport }, + // { "trigger_disguise", SP_trigger_disguise }, + // { "info_teleport_destination", SP_info_teleport_destination }, + // { "info_player_coop_lava", SP_info_player_coop_lava }, + // // { "monster_stalker", SP_monster_stalker }, + // // { "monster_turret", SP_monster_turret }, + // { "target_steam", SP_target_steam }, + // { "target_anger", SP_target_anger }, + // { "target_killplayers", SP_target_killplayers }, + // // PMM - experiment + // { "target_blacklight", SP_target_blacklight }, + // { "target_orb", SP_target_orb }, + // // pmm + // //{ "monster_daedalus", SP_monster_hover }, + // { "hint_path", SP_hint_path }, // { "monster_carrier", SP_monster_carrier }, // { "monster_widow", SP_monster_widow }, // { "monster_widow2", SP_monster_widow2 }, // { "monster_medic_commander", SP_monster_medic }, - { "dm_tag_token", SP_dm_tag_token }, - { "dm_dball_goal", SP_dm_dball_goal }, - { "dm_dball_ball", SP_dm_dball_ball }, - { "dm_dball_team1_start", SP_dm_dball_team1_start }, - { "dm_dball_team2_start", SP_dm_dball_team2_start }, - { "dm_dball_ball_start", SP_dm_dball_ball_start }, - { "dm_dball_speed_change", SP_dm_dball_speed_change }, - //{ "monster_kamikaze", SP_monster_kamikaze }, - { "turret_invisible_brain", SP_turret_invisible_brain }, - { "misc_nuke_core", SP_misc_nuke_core }, + // { "dm_tag_token", SP_dm_tag_token }, + // { "dm_dball_goal", SP_dm_dball_goal }, + // { "dm_dball_ball", SP_dm_dball_ball }, + // { "dm_dball_team1_start", SP_dm_dball_team1_start }, + // { "dm_dball_team2_start", SP_dm_dball_team2_start }, + // { "dm_dball_ball_start", SP_dm_dball_ball_start }, + // { "dm_dball_speed_change", SP_dm_dball_speed_change }, + // //{ "monster_kamikaze", SP_monster_kamikaze }, + // { "turret_invisible_brain", SP_turret_invisible_brain }, + // { "misc_nuke_core", SP_misc_nuke_core }, // ROGUE //============== // ZOID @@ -482,17 +482,17 @@ void ED_CallSpawn(edict_t *ent) { // found it // before spawning, pick random item replacement - if (g_dm_random_items->integer) - { - ent->item = item; - item_id_t new_item = DoRandomRespawn(ent); + // if (g_dm_random_items->integer) + // { + // ent->item = item; + // item_id_t new_item = DoRandomRespawn(ent); - if (new_item) - { - item = GetItemByIndex(new_item); - ent->classname = item->classname; - } - } + // if (new_item) + // { + // item = GetItemByIndex(new_item); + // ent->classname = item->classname; + // } + // } SpawnItem(ent, item); return; @@ -1247,15 +1247,15 @@ void SpawnEntities(const char *mapname, const char *entities, const char *spawnp // ZOID // ROGUE - if (deathmatch->integer) - { - if (g_dm_random_items->integer) - PrecacheForRandomRespawn(); - } - else - { - InitHintPaths(); // if there aren't hintpaths on this map, enable quick aborts - } + // if (deathmatch->integer) + // { + // if (g_dm_random_items->integer) + // PrecacheForRandomRespawn(); + // } + // else + // { + // InitHintPaths(); // if there aren't hintpaths on this map, enable quick aborts + // } // ROGUE // ROGUE -- allow dm games to do init stuff right before game starts. diff --git a/actionlite/m_infantry.cpp b/actionlite/m_infantry.cpp deleted file mode 100644 index 18f9f20..0000000 --- a/actionlite/m_infantry.cpp +++ /dev/null @@ -1,928 +0,0 @@ -// Copyright (c) ZeniMax Media Inc. -// Licensed under the GNU General Public License 2.0. -/* -============================================================================== - -INFANTRY - -============================================================================== -*/ - -#include "g_local.h" -#include "m_infantry.h" -#include "m_flash.h" - -void InfantryMachineGun(edict_t *self); - -static int sound_pain1; -static int sound_pain2; -static int sound_die1; -static int sound_die2; - -static int sound_gunshot; -static int sound_weapon_cock; -static int sound_punch_swing; -static int sound_punch_hit; -static int sound_sight; -static int sound_search; -static int sound_idle; - -// range at which we'll try to initiate a run-attack to close distance -constexpr float RANGE_RUN_ATTACK = RANGE_NEAR * 0.75f; - -mframe_t infantry_frames_stand[] = { - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand } -}; -MMOVE_T(infantry_move_stand) = { FRAME_stand50, FRAME_stand71, infantry_frames_stand, nullptr }; - -MONSTERINFO_STAND(infantry_stand) (edict_t *self) -> void -{ - M_SetAnimation(self, &infantry_move_stand); -} - -mframe_t infantry_frames_fidget[] = { - { ai_stand, 1 }, - { ai_stand }, - { ai_stand, 1 }, - { ai_stand, 3 }, - { ai_stand, 6 }, - { ai_stand, 3, monster_footstep }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand, 1 }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand, 1 }, - { ai_stand }, - { ai_stand, -1 }, - { ai_stand }, - { ai_stand }, - { ai_stand, 1 }, - { ai_stand }, - { ai_stand, -2 }, - { ai_stand, 1 }, - { ai_stand, 1 }, - { ai_stand, 1 }, - { ai_stand, -1 }, - { ai_stand }, - { ai_stand }, - { ai_stand, -1 }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand, -1 }, - { ai_stand }, - { ai_stand }, - { ai_stand, 1 }, - { ai_stand }, - { ai_stand }, - { ai_stand, -1 }, - { ai_stand, -1 }, - { ai_stand }, - { ai_stand, -3 }, - { ai_stand, -2 }, - { ai_stand, -3 }, - { ai_stand, -3, monster_footstep }, - { ai_stand, -2 } -}; -MMOVE_T(infantry_move_fidget) = { FRAME_stand01, FRAME_stand49, infantry_frames_fidget, infantry_stand }; - -MONSTERINFO_IDLE(infantry_fidget) (edict_t *self) -> void -{ - if (self->enemy) - return; - - M_SetAnimation(self, &infantry_move_fidget); - gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0); -} - -mframe_t infantry_frames_walk[] = { - { ai_walk, 5, monster_footstep }, - { ai_walk, 4 }, - { ai_walk, 4 }, - { ai_walk, 5 }, - { ai_walk, 4 }, - { ai_walk, 5 }, - { ai_walk, 6, monster_footstep }, - { ai_walk, 4 }, - { ai_walk, 4 }, - { ai_walk, 4 }, - { ai_walk, 4 }, - { ai_walk, 5 } -}; -MMOVE_T(infantry_move_walk) = { FRAME_walk03, FRAME_walk14, infantry_frames_walk, nullptr }; - -MONSTERINFO_WALK(infantry_walk) (edict_t *self) -> void -{ - M_SetAnimation(self, &infantry_move_walk); -} - -mframe_t infantry_frames_run[] = { - { ai_run, 10 }, - { ai_run, 15, monster_footstep }, - { ai_run, 5 }, - { ai_run, 7, monster_done_dodge }, - { ai_run, 18 }, - { ai_run, 20, monster_footstep }, - { ai_run, 2 }, - { ai_run, 6 } -}; -MMOVE_T(infantry_move_run) = { FRAME_run01, FRAME_run08, infantry_frames_run, nullptr }; - -MONSTERINFO_RUN(infantry_run) (edict_t *self) -> void -{ - monster_done_dodge(self); - - if (self->monsterinfo.aiflags & AI_STAND_GROUND) - M_SetAnimation(self, &infantry_move_stand); - else - M_SetAnimation(self, &infantry_move_run); -} - -mframe_t infantry_frames_pain1[] = { - { ai_move, -3 }, - { ai_move, -2 }, - { ai_move, -1 }, - { ai_move, -2 }, - { ai_move, -1, monster_footstep }, - { ai_move, 1 }, - { ai_move, -1 }, - { ai_move, 1 }, - { ai_move, 6 }, - { ai_move, 2, monster_footstep } -}; -MMOVE_T(infantry_move_pain1) = { FRAME_pain101, FRAME_pain110, infantry_frames_pain1, infantry_run }; - -mframe_t infantry_frames_pain2[] = { - { ai_move, -3 }, - { ai_move, -3 }, - { ai_move }, - { ai_move, -1 }, - { ai_move, -2, monster_footstep }, - { ai_move }, - { ai_move }, - { ai_move, 2 }, - { ai_move, 5 }, - { ai_move, 2, monster_footstep } -}; -MMOVE_T(infantry_move_pain2) = { FRAME_pain201, FRAME_pain210, infantry_frames_pain2, infantry_run }; - -extern const mmove_t infantry_move_jump; -extern const mmove_t infantry_move_jump2; - -PAIN(infantry_pain) (edict_t *self, edict_t *other, float kick, int damage, const mod_t &mod) -> void -{ - int n; - - // allow turret to pain - if ((self->monsterinfo.active_move == &infantry_move_jump || - self->monsterinfo.active_move == &infantry_move_jump2) && self->think == monster_think) - return; - - monster_done_dodge(self); - - if (level.time < self->pain_debounce_time) - { - if (self->think == monster_think && frandom() < 0.33f) - self->monsterinfo.dodge(self, other, FRAME_TIME_S, nullptr, false); - - return; - } - - self->pain_debounce_time = level.time + 3_sec; - - n = brandom(); - - if (n == 0) - gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); - else - gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); - - if (self->think != monster_think) - return; - - if (!M_ShouldReactToPain(self, mod)) - { - if (self->think == monster_think && frandom() < 0.33f) - self->monsterinfo.dodge(self, other, FRAME_TIME_S, nullptr, false); - - return; // no pain anims in nightmare - } - - if (n == 0) - M_SetAnimation(self, &infantry_move_pain1); - else - M_SetAnimation(self, &infantry_move_pain2); - - // PMM - clear duck flag - if (self->monsterinfo.aiflags & AI_DUCKED) - monster_duck_up(self); -} - -MONSTERINFO_SETSKIN(infantry_setskin) (edict_t *self) -> void -{ - if (self->health < (self->max_health / 2)) - self->s.skinnum = 1; - else - self->s.skinnum = 0; -} - -constexpr vec3_t aimangles[] = { - { 0.0f, 5.0f, 0.0f }, - { 10.0f, 15.0f, 0.0f }, - { 20.0f, 25.0f, 0.0f }, - { 25.0f, 35.0f, 0.0f }, - { 30.0f, 40.0f, 0.0f }, - { 30.0f, 45.0f, 0.0f }, - { 25.0f, 50.0f, 0.0f }, - { 20.0f, 40.0f, 0.0f }, - { 15.0f, 35.0f, 0.0f }, - { 40.0f, 35.0f, 0.0f }, - { 70.0f, 35.0f, 0.0f }, - { 90.0f, 35.0f, 0.0f } -}; - -void InfantryMachineGun(edict_t *self) -{ - vec3_t start; - vec3_t forward, right; - vec3_t vec; - monster_muzzleflash_id_t flash_number; - - if (!self->enemy || !self->enemy->inuse) // PGM - return; // PGM - - bool is_run_attack = (self->s.frame >= FRAME_run201 && self->s.frame <= FRAME_run208); - - if (self->s.frame == FRAME_attak103 || self->s.frame == FRAME_attak311 || is_run_attack || self->s.frame == FRAME_attak416) - { - if (is_run_attack) - flash_number = static_cast(MZ2_INFANTRY_MACHINEGUN_14 + (self->s.frame - MZ2_INFANTRY_MACHINEGUN_14)); - else if (self->s.frame == FRAME_attak416) - flash_number = MZ2_INFANTRY_MACHINEGUN_22; - else - flash_number = MZ2_INFANTRY_MACHINEGUN_1; - AngleVectors(self->s.angles, forward, right, nullptr); - start = M_ProjectFlashSource(self, monster_flash_offset[flash_number], forward, right); - - if (self->enemy) - PredictAim(self, self->enemy, start, 0, true, -0.2f, &forward, nullptr); - else - { - AngleVectors(self->s.angles, forward, right, nullptr); - } - } - else - { - flash_number = static_cast(MZ2_INFANTRY_MACHINEGUN_2 + (self->s.frame - FRAME_death211)); - - AngleVectors(self->s.angles, forward, right, nullptr); - start = M_ProjectFlashSource(self, monster_flash_offset[flash_number], forward, right); - - vec = self->s.angles - aimangles[flash_number - MZ2_INFANTRY_MACHINEGUN_2]; - AngleVectors(vec, forward, nullptr, nullptr); - } - - monster_fire_bullet(self, start, forward, 3, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, flash_number); -} - -MONSTERINFO_SIGHT(infantry_sight) (edict_t *self, edict_t *other) -> void -{ - if (brandom()) - gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); - else - gi.sound(self, CHAN_VOICE, sound_search, 1, ATTN_NORM, 0); -} - -void infantry_dead(edict_t *self) -{ - self->mins = { -16, -16, -24 }; - self->maxs = { 16, 16, -8 }; - monster_dead(self); -} - -static void infantry_shrink(edict_t *self) -{ - self->maxs[2] = 0; - self->svflags |= SVF_DEADMONSTER; - gi.linkentity(self); -} - -mframe_t infantry_frames_death1[] = { - { ai_move, -4, nullptr, FRAME_death102 }, - { ai_move }, - { ai_move }, - { ai_move, -1 }, - { ai_move, -4, monster_footstep }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move, -1, monster_footstep }, - { ai_move, 3 }, - { ai_move, 1 }, - { ai_move, 1 }, - { ai_move, -2 }, - { ai_move, 2 }, - { ai_move, 2 }, - { ai_move, 9, [](edict_t *self) { infantry_shrink(self); monster_footstep(self); } }, - { ai_move, 9 }, - { ai_move, 5, monster_footstep }, - { ai_move, -3 }, - { ai_move, -3 } -}; -MMOVE_T(infantry_move_death1) = { FRAME_death101, FRAME_death120, infantry_frames_death1, infantry_dead }; - -// Off with his head -mframe_t infantry_frames_death2[] = { - { ai_move, 0, nullptr, FRAME_death202 }, - { ai_move, 1 }, - { ai_move, 5 }, - { ai_move, -1 }, - { ai_move }, - { ai_move, 1, monster_footstep }, - { ai_move, 1, monster_footstep }, - { ai_move, 4 }, - { ai_move, 3 }, - { ai_move }, - { ai_move, -2, InfantryMachineGun }, - { ai_move, -2, InfantryMachineGun }, - { ai_move, -3, InfantryMachineGun }, - { ai_move, -1, InfantryMachineGun }, - { ai_move, -2, InfantryMachineGun }, - { ai_move, 0, InfantryMachineGun }, - { ai_move, 2, InfantryMachineGun }, - { ai_move, 2, InfantryMachineGun }, - { ai_move, 3, InfantryMachineGun }, - { ai_move, -10, InfantryMachineGun }, - { ai_move, -7, InfantryMachineGun }, - { ai_move, -8, InfantryMachineGun }, - { ai_move, -6, [](edict_t *self) { infantry_shrink(self); monster_footstep(self); } }, - { ai_move, 4 }, - { ai_move } -}; -MMOVE_T(infantry_move_death2) = { FRAME_death201, FRAME_death225, infantry_frames_death2, infantry_dead }; - -mframe_t infantry_frames_death3[] = { - { ai_move, 0 }, - { ai_move }, - { ai_move, 0, [](edict_t *self) { infantry_shrink(self); monster_footstep(self); } }, - { ai_move, -6 }, - { ai_move, -11, [](edict_t *self) { self->monsterinfo.nextframe = FRAME_death307; } }, - { ai_move, -3 }, - { ai_move, -11 }, - { ai_move, 0, monster_footstep }, - { ai_move } -}; -MMOVE_T(infantry_move_death3) = { FRAME_death301, FRAME_death309, infantry_frames_death3, infantry_dead }; - -DIE(infantry_die) (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, const vec3_t &point, const mod_t &mod) -> void -{ - int n; - - // check for gib - if (M_CheckGib(self, mod)) - { - gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); - - const char *head_gib = (self->monsterinfo.active_move != &infantry_move_death3) ? "models/objects/gibs/sm_meat/tris.md2" : "models/monsters/infantry/gibs/head.md2"; - - self->s.skinnum /= 2; - - ThrowGibs(self, damage, { - { "models/objects/gibs/bone/tris.md2" }, - { 3, "models/objects/gibs/sm_meat/tris.md2" }, - { "models/monsters/infantry/gibs/chest.md2", GIB_SKINNED }, - { "models/monsters/infantry/gibs/gun.md2", GIB_SKINNED | GIB_UPRIGHT }, - { 2, "models/monsters/infantry/gibs/foot.md2", GIB_SKINNED }, - { 2, "models/monsters/infantry/gibs/arm.md2", GIB_SKINNED }, - { head_gib, GIB_HEAD | GIB_SKINNED } - }); - self->deadflag = true; - return; - } - - if (self->deadflag) - return; - - // regular death - self->deadflag = true; - self->takedamage = true; - - n = irandom(3); - - if (n == 0) - { - M_SetAnimation(self, &infantry_move_death1); - gi.sound(self, CHAN_VOICE, sound_die2, 1, ATTN_NORM, 0); - } - else if (n == 1) - { - M_SetAnimation(self, &infantry_move_death2); - gi.sound(self, CHAN_VOICE, sound_die1, 1, ATTN_NORM, 0); - } - else - { - M_SetAnimation(self, &infantry_move_death3); - gi.sound(self, CHAN_VOICE, sound_die2, 1, ATTN_NORM, 0); - } - - // don't always pop a head gib, it gets old - if (n != 2 && frandom() <= 0.25f) - { - edict_t *head = ThrowGib(self, "models/monsters/infantry/gibs/head.md2", damage, GIB_NONE, self->s.scale); - - if (head) - { - head->s.angles = self->s.angles; - head->s.origin = self->s.origin + vec3_t{0, 0, 32.f}; - vec3_t headDir = (self->s.origin - inflictor->s.origin); - head->velocity = headDir / headDir.length() * 100.0f; - head->velocity[2] = 200.0f; - head->avelocity *= 0.15f; - head->s.skinnum = 0; - gi.linkentity(head); - } - } -} - -mframe_t infantry_frames_duck[] = { - { ai_move, -2, monster_duck_down }, - { ai_move, -5, monster_duck_hold }, - { ai_move, 3 }, - { ai_move, 4, monster_duck_up }, - { ai_move } -}; -MMOVE_T(infantry_move_duck) = { FRAME_duck01, FRAME_duck05, infantry_frames_duck, infantry_run }; - -// PMM - dodge code moved below so I can see the attack frames - -extern const mmove_t infantry_move_attack4; - -void infantry_set_firetime(edict_t *self) -{ - self->monsterinfo.fire_wait = level.time + random_time(0.7_sec, 2_sec); - - if (!(self->monsterinfo.aiflags & AI_STAND_GROUND) && self->enemy && range_to(self, self->enemy) >= RANGE_RUN_ATTACK && ai_check_move(self, 8.0f)) - M_SetAnimation(self, &infantry_move_attack4, false); -} - -void infantry_cock_gun(edict_t *self) -{ - gi.sound(self, CHAN_WEAPON, sound_weapon_cock, 1, ATTN_NORM, 0); - - // gun cocked - self->count = 1; -} - -void infantry_fire(edict_t *self); - -// cock-less attack, used if he has already cocked his gun -mframe_t infantry_frames_attack1[] = { - { ai_charge }, - { ai_charge, 6, [](edict_t *self) { infantry_set_firetime(self); monster_footstep(self); } }, - { ai_charge, 0, infantry_fire }, - { ai_charge }, - { ai_charge, 1 }, - { ai_charge, -7 }, - { ai_charge, -6, [](edict_t *self) { self->monsterinfo.nextframe = FRAME_attak114; monster_footstep(self); } }, - // dead frames start - { ai_charge, -1 }, - { ai_charge, 0, infantry_cock_gun }, - { ai_charge }, - { ai_charge }, - { ai_charge }, - { ai_charge }, - // dead frames end - { ai_charge, -1 }, - { ai_charge, -1 } -}; -MMOVE_T(infantry_move_attack1) = { FRAME_attak101, FRAME_attak115, infantry_frames_attack1, infantry_run }; - -// old animation, full cock + shoot -mframe_t infantry_frames_attack3[] = { - { ai_charge, 4, NULL }, - { ai_charge, -1, NULL }, - { ai_charge, -1, NULL }, - { ai_charge, 0, infantry_cock_gun }, - { ai_charge, -1, NULL }, - { ai_charge, 1, NULL }, - { ai_charge, 1, NULL }, - { ai_charge, 2, NULL }, - { ai_charge, -2, NULL }, - { ai_charge, -3, [](edict_t *self) { infantry_set_firetime(self); monster_footstep(self); } }, - { ai_charge, 1, infantry_fire }, - { ai_charge, 5, NULL }, - { ai_charge, -1, NULL }, - { ai_charge, -2, NULL }, - { ai_charge, -3, NULL }, -}; -MMOVE_T(infantry_move_attack3) = { FRAME_attak301, FRAME_attak315, infantry_frames_attack3, infantry_run }; - -// even older animation, full cock + shoot -mframe_t infantry_frames_attack5[] = { - // skipped frames - { ai_charge, 0, NULL }, - { ai_charge, 0, NULL }, - { ai_charge, 0, NULL }, - { ai_charge, 0, NULL }, - - { ai_charge, 0, NULL }, - { ai_charge, 0, nullptr }, - { ai_charge, 0, monster_footstep }, - { ai_charge, 0, infantry_cock_gun }, - { ai_charge, 0, NULL }, - { ai_charge, 0, NULL }, - { ai_charge, 0, [](edict_t *self) { self->monsterinfo.nextframe = self->s.frame + 1; } }, - { ai_charge, 0, NULL }, // skipped frame - { ai_charge, 0, NULL }, - { ai_charge, 0, nullptr }, - { ai_charge, 0, infantry_set_firetime }, - { ai_charge, 0, infantry_fire }, - - // skipped frames - { ai_charge, 0, NULL }, - { ai_charge, 0, NULL }, - { ai_charge, 0, NULL }, - - { ai_charge, 0, NULL }, - { ai_charge, 0, NULL }, - { ai_charge, 0, NULL }, - { ai_charge, 0, monster_footstep } -}; -MMOVE_T(infantry_move_attack5) = { FRAME_attak401, FRAME_attak423, infantry_frames_attack5, infantry_run }; - -extern const mmove_t infantry_move_attack4; - -void infantry_fire(edict_t *self) -{ - InfantryMachineGun(self); - - // we fired, so we must cock again before firing - self->count = 0; - - // check if we ran out of firing time - if (self->monsterinfo.active_move == &infantry_move_attack4) - { - if (level.time >= self->monsterinfo.fire_wait) - { - monster_done_dodge(self); - M_SetAnimation(self, &infantry_move_attack1, false); - self->monsterinfo.nextframe = FRAME_attak114; - } - // got close to an edge - else if (!ai_check_move(self, 8.0f)) - { - M_SetAnimation(self, &infantry_move_attack1, false); - self->monsterinfo.nextframe = FRAME_attak103; - monster_done_dodge(self); - self->monsterinfo.attack_state = AS_STRAIGHT; - } - } - else if ((self->s.frame >= FRAME_attak101 && self->s.frame <= FRAME_attak115) || - (self->s.frame >= FRAME_attak301 && self->s.frame <= FRAME_attak315) || - (self->s.frame >= FRAME_attak401 && self->s.frame <= FRAME_attak424)) - { - if (level.time >= self->monsterinfo.fire_wait) - { - self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; - - if (self->s.frame == FRAME_attak416) - self->monsterinfo.nextframe = FRAME_attak420; - } - else - self->monsterinfo.aiflags |= AI_HOLD_FRAME; - } -} - -void infantry_swing(edict_t *self) -{ - gi.sound(self, CHAN_WEAPON, sound_punch_swing, 1, ATTN_NORM, 0); -} - -void infantry_smack(edict_t *self) -{ - vec3_t aim = { MELEE_DISTANCE, 0, 0 }; - - if (fire_hit(self, aim, irandom(5, 10), 50)) - gi.sound(self, CHAN_WEAPON, sound_punch_hit, 1, ATTN_NORM, 0); - else - self->monsterinfo.melee_debounce_time = level.time + 1.5_sec; -} - -mframe_t infantry_frames_attack2[] = { - { ai_charge, 3 }, - { ai_charge, 6 }, - { ai_charge, 0, infantry_swing }, - { ai_charge, 8, monster_footstep }, - { ai_charge, 5 }, - { ai_charge, 8, infantry_smack }, - { ai_charge, 6 }, - { ai_charge, 3 } -}; -MMOVE_T(infantry_move_attack2) = { FRAME_attak201, FRAME_attak208, infantry_frames_attack2, infantry_run }; - -// [Paril-KEX] run-attack, inspired by q2test -void infantry_attack4_refire(edict_t *self) -{ - // ran out of firing time - if (level.time >= self->monsterinfo.fire_wait) - { - monster_done_dodge(self); - M_SetAnimation(self, &infantry_move_attack1, false); - self->monsterinfo.nextframe = FRAME_attak114; - } - // we got too close, or we can't move forward, switch us back to regular attack - else if ((self->monsterinfo.aiflags & AI_STAND_GROUND) || (self->enemy && (range_to(self, self->enemy) < RANGE_RUN_ATTACK || !ai_check_move(self, 8.0f)))) - { - M_SetAnimation(self, &infantry_move_attack1, false); - self->monsterinfo.nextframe = FRAME_attak103; - monster_done_dodge(self); - self->monsterinfo.attack_state = AS_STRAIGHT; - } - else - self->monsterinfo.nextframe = FRAME_run201; - - infantry_fire(self); -} - -mframe_t infantry_frames_attack4[] = { - { ai_charge, 16, infantry_fire }, - { ai_charge, 16, [](edict_t *self) { monster_footstep(self); infantry_fire(self); } }, - { ai_charge, 13, infantry_fire }, - { ai_charge, 10, infantry_fire }, - { ai_charge, 16, infantry_fire }, - { ai_charge, 16, [](edict_t *self) { monster_footstep(self); infantry_fire(self); } }, - { ai_charge, 16, infantry_fire }, - { ai_charge, 16, infantry_attack4_refire } -}; -MMOVE_T(infantry_move_attack4) = { FRAME_run201, FRAME_run208, infantry_frames_attack4, infantry_run, 0.5f }; - -MONSTERINFO_ATTACK(infantry_attack) (edict_t *self) -> void -{ - monster_done_dodge(self); - - float r = range_to(self, self->enemy); - - if (r <= RANGE_MELEE && self->monsterinfo.melee_debounce_time <= level.time) - M_SetAnimation(self, &infantry_move_attack2); - else if (M_CheckClearShot(self, monster_flash_offset[MZ2_INFANTRY_MACHINEGUN_1])) - { - if (self->count) - M_SetAnimation(self, &infantry_move_attack1); - else - { - M_SetAnimation(self, frandom() <= 0.1f ? &infantry_move_attack5 : &infantry_move_attack3); - self->monsterinfo.nextframe = FRAME_attak405; - } - } -} - -//=========== -// PGM -void infantry_jump_now(edict_t *self) -{ - vec3_t forward, up; - - AngleVectors(self->s.angles, forward, nullptr, up); - self->velocity += (forward * 100); - self->velocity += (up * 300); -} - -void infantry_jump2_now(edict_t *self) -{ - vec3_t forward, up; - - AngleVectors(self->s.angles, forward, nullptr, up); - self->velocity += (forward * 150); - self->velocity += (up * 400); -} - -void infantry_jump_wait_land(edict_t *self) -{ - if (self->groundentity == nullptr) - { - self->monsterinfo.nextframe = self->s.frame; - - if (monster_jump_finished(self)) - self->monsterinfo.nextframe = self->s.frame + 1; - } - else - self->monsterinfo.nextframe = self->s.frame + 1; -} - -mframe_t infantry_frames_jump[] = { - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move, 0, infantry_jump_now }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move, 0, infantry_jump_wait_land }, - { ai_move }, - { ai_move } -}; -MMOVE_T(infantry_move_jump) = { FRAME_jump01, FRAME_jump10, infantry_frames_jump, infantry_run }; - -mframe_t infantry_frames_jump2[] = { - { ai_move, -8 }, - { ai_move, -4 }, - { ai_move, -4 }, - { ai_move, 0, infantry_jump2_now }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move, 0, infantry_jump_wait_land }, - { ai_move }, - { ai_move } -}; -MMOVE_T(infantry_move_jump2) = { FRAME_jump01, FRAME_jump10, infantry_frames_jump2, infantry_run }; - -void infantry_jump(edict_t *self, blocked_jump_result_t result) -{ - if (!self->enemy) - return; - - monster_done_dodge(self); - - if (result == blocked_jump_result_t::JUMP_JUMP_UP) - M_SetAnimation(self, &infantry_move_jump2); - else - M_SetAnimation(self, &infantry_move_jump); -} - -MONSTERINFO_BLOCKED(infantry_blocked) (edict_t *self, float dist) -> bool -{ - if (auto result = blocked_checkjump(self, dist); result != blocked_jump_result_t::NO_JUMP) - { - if (result != blocked_jump_result_t::JUMP_TURN) - infantry_jump(self, result); - return true; - } - - if (blocked_checkplat(self, dist)) - return true; - - return false; -} - -MONSTERINFO_DUCK(infantry_duck) (edict_t *self, gtime_t eta) -> bool -{ - // if we're jumping, don't dodge - if ((self->monsterinfo.active_move == &infantry_move_jump) || - (self->monsterinfo.active_move == &infantry_move_jump2)) - { - return false; - } - - // don't duck during our firing or melee frames - if (self->s.frame == FRAME_attak103 || - self->s.frame == FRAME_attak315 || - (self->monsterinfo.active_move == &infantry_move_attack2)) - { - self->monsterinfo.unduck(self); - return false; - } - - M_SetAnimation(self, &infantry_move_duck); - - return true; -} - -MONSTERINFO_SIDESTEP(infantry_sidestep) (edict_t *self) -> bool -{ - // if we're jumping, don't dodge - if ((self->monsterinfo.active_move == &infantry_move_jump) || - (self->monsterinfo.active_move == &infantry_move_jump2)) - { - return false; - } - - if (self->monsterinfo.active_move == &infantry_move_run) - return true; - - // Don't sidestep if we're already sidestepping, and def not unless we're actually shooting - // or if we already cocked - if (self->monsterinfo.active_move != &infantry_move_attack4 && - self->monsterinfo.next_move != &infantry_move_attack4 && - ((self->s.frame == FRAME_attak103 || - self->s.frame == FRAME_attak311 || - self->s.frame == FRAME_attak416) && - !self->count)) - { - // give us a fire time boost so we don't end up firing for 1 frame - self->monsterinfo.fire_wait += random_time(300_ms, 600_ms); - - M_SetAnimation(self, &infantry_move_attack4, false); - } - - return true; -} - -void InfantryPrecache() -{ - sound_pain1 = gi.soundindex("infantry/infpain1.wav"); - sound_pain2 = gi.soundindex("infantry/infpain2.wav"); - sound_die1 = gi.soundindex("infantry/infdeth1.wav"); - sound_die2 = gi.soundindex("infantry/infdeth2.wav"); - - sound_gunshot = gi.soundindex("infantry/infatck1.wav"); - sound_weapon_cock = gi.soundindex("infantry/infatck3.wav"); - sound_punch_swing = gi.soundindex("infantry/infatck2.wav"); - sound_punch_hit = gi.soundindex("infantry/melee2.wav"); - - sound_sight = gi.soundindex("infantry/infsght1.wav"); - sound_search = gi.soundindex("infantry/infsrch1.wav"); - sound_idle = gi.soundindex("infantry/infidle1.wav"); -} - -constexpr spawnflags_t SPAWNFLAG_INFANTRY_NOJUMPING = 8_spawnflag; - -/*QUAKED monster_infantry (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight NoJumping - */ -void SP_monster_infantry(edict_t *self) -{ - if ( !M_AllowSpawn( self ) ) { - G_FreeEdict( self ); - return; - } - - InfantryPrecache(); - - self->monsterinfo.aiflags |= AI_STINKY; - - self->movetype = MOVETYPE_STEP; - self->solid = SOLID_BBOX; - self->s.modelindex = gi.modelindex("models/monsters/infantry/tris.md2"); - - gi.modelindex("models/monsters/infantry/gibs/head.md2"); - gi.modelindex("models/monsters/infantry/gibs/chest.md2"); - gi.modelindex("models/monsters/infantry/gibs/gun.md2"); - gi.modelindex("models/monsters/infantry/gibs/arm.md2"); - gi.modelindex("models/monsters/infantry/gibs/foot.md2"); - - self->mins = { -16, -16, -24 }; - self->maxs = { 16, 16, 32 }; - - self->health = 100 * st.health_multiplier; - self->gib_health = -65; - self->mass = 200; - - self->pain = infantry_pain; - self->die = infantry_die; - - self->monsterinfo.combat_style = COMBAT_MIXED; - - self->monsterinfo.stand = infantry_stand; - self->monsterinfo.walk = infantry_walk; - self->monsterinfo.run = infantry_run; - // pmm - self->monsterinfo.dodge = M_MonsterDodge; - self->monsterinfo.duck = infantry_duck; - self->monsterinfo.unduck = monster_duck_up; - self->monsterinfo.sidestep = infantry_sidestep; - self->monsterinfo.blocked = infantry_blocked; - // pmm - self->monsterinfo.attack = infantry_attack; - self->monsterinfo.melee = nullptr; - self->monsterinfo.sight = infantry_sight; - self->monsterinfo.idle = infantry_fidget; - self->monsterinfo.setskin = infantry_setskin; - - gi.linkentity(self); - - M_SetAnimation(self, &infantry_move_stand); - self->monsterinfo.scale = MODEL_SCALE; - self->monsterinfo.can_jump = !self->spawnflags.has(SPAWNFLAG_INFANTRY_NOJUMPING); - self->monsterinfo.drop_height = 192; - self->monsterinfo.jump_height = 40; - - walkmonster_start(self); -} diff --git a/actionlite/m_infantry.h b/actionlite/m_infantry.h deleted file mode 100644 index 4912f83..0000000 --- a/actionlite/m_infantry.h +++ /dev/null @@ -1,280 +0,0 @@ -// Copyright (c) ZeniMax Media Inc. -// Licensed under the GNU General Public License 2.0. -// G:\quake2\baseq2\models/monsters/infantry - -// This file generated by ModelGen - Do NOT Modify - -enum -{ - FRAME_gun02, - FRAME_stand01, - FRAME_stand02, - FRAME_stand03, - FRAME_stand04, - FRAME_stand05, - FRAME_stand06, - FRAME_stand07, - FRAME_stand08, - FRAME_stand09, - FRAME_stand10, - FRAME_stand11, - FRAME_stand12, - FRAME_stand13, - FRAME_stand14, - FRAME_stand15, - FRAME_stand16, - FRAME_stand17, - FRAME_stand18, - FRAME_stand19, - FRAME_stand20, - FRAME_stand21, - FRAME_stand22, - FRAME_stand23, - FRAME_stand24, - FRAME_stand25, - FRAME_stand26, - FRAME_stand27, - FRAME_stand28, - FRAME_stand29, - FRAME_stand30, - FRAME_stand31, - FRAME_stand32, - FRAME_stand33, - FRAME_stand34, - FRAME_stand35, - FRAME_stand36, - FRAME_stand37, - FRAME_stand38, - FRAME_stand39, - FRAME_stand40, - FRAME_stand41, - FRAME_stand42, - FRAME_stand43, - FRAME_stand44, - FRAME_stand45, - FRAME_stand46, - FRAME_stand47, - FRAME_stand48, - FRAME_stand49, - FRAME_stand50, - FRAME_stand51, - FRAME_stand52, - FRAME_stand53, - FRAME_stand54, - FRAME_stand55, - FRAME_stand56, - FRAME_stand57, - FRAME_stand58, - FRAME_stand59, - FRAME_stand60, - FRAME_stand61, - FRAME_stand62, - FRAME_stand63, - FRAME_stand64, - FRAME_stand65, - FRAME_stand66, - FRAME_stand67, - FRAME_stand68, - FRAME_stand69, - FRAME_stand70, - FRAME_stand71, - FRAME_walk01, - FRAME_walk02, - FRAME_walk03, - FRAME_walk04, - FRAME_walk05, - FRAME_walk06, - FRAME_walk07, - FRAME_walk08, - FRAME_walk09, - FRAME_walk10, - FRAME_walk11, - FRAME_walk12, - FRAME_walk13, - FRAME_walk14, - FRAME_walk15, - FRAME_walk16, - FRAME_walk17, - FRAME_walk18, - FRAME_walk19, - FRAME_walk20, - FRAME_run01, - FRAME_run02, - FRAME_run03, - FRAME_run04, - FRAME_run05, - FRAME_run06, - FRAME_run07, - FRAME_run08, - FRAME_pain101, - FRAME_pain102, - FRAME_pain103, - FRAME_pain104, - FRAME_pain105, - FRAME_pain106, - FRAME_pain107, - FRAME_pain108, - FRAME_pain109, - FRAME_pain110, - FRAME_pain201, - FRAME_pain202, - FRAME_pain203, - FRAME_pain204, - FRAME_pain205, - FRAME_pain206, - FRAME_pain207, - FRAME_pain208, - FRAME_pain209, - FRAME_pain210, - FRAME_duck01, - FRAME_duck02, - FRAME_duck03, - FRAME_duck04, - FRAME_duck05, - FRAME_death101, - FRAME_death102, - FRAME_death103, - FRAME_death104, - FRAME_death105, - FRAME_death106, - FRAME_death107, - FRAME_death108, - FRAME_death109, - FRAME_death110, - FRAME_death111, - FRAME_death112, - FRAME_death113, - FRAME_death114, - FRAME_death115, - FRAME_death116, - FRAME_death117, - FRAME_death118, - FRAME_death119, - FRAME_death120, - FRAME_death201, - FRAME_death202, - FRAME_death203, - FRAME_death204, - FRAME_death205, - FRAME_death206, - FRAME_death207, - FRAME_death208, - FRAME_death209, - FRAME_death210, - FRAME_death211, - FRAME_death212, - FRAME_death213, - FRAME_death214, - FRAME_death215, - FRAME_death216, - FRAME_death217, - FRAME_death218, - FRAME_death219, - FRAME_death220, - FRAME_death221, - FRAME_death222, - FRAME_death223, - FRAME_death224, - FRAME_death225, - FRAME_death301, - FRAME_death302, - FRAME_death303, - FRAME_death304, - FRAME_death305, - FRAME_death306, - FRAME_death307, - FRAME_death308, - FRAME_death309, - FRAME_block01, - FRAME_block02, - FRAME_block03, - FRAME_block04, - FRAME_block05, - FRAME_attak101, - FRAME_attak102, - FRAME_attak103, - FRAME_attak104, - FRAME_attak105, - FRAME_attak106, - FRAME_attak107, - FRAME_attak108, - FRAME_attak109, - FRAME_attak110, - FRAME_attak111, - FRAME_attak112, - FRAME_attak113, - FRAME_attak114, - FRAME_attak115, - FRAME_attak201, - FRAME_attak202, - FRAME_attak203, - FRAME_attak204, - FRAME_attak205, - FRAME_attak206, - FRAME_attak207, - FRAME_attak208, - // ROGUE - FRAME_jump01, - FRAME_jump02, - FRAME_jump03, - FRAME_jump04, - FRAME_jump05, - FRAME_jump06, - FRAME_jump07, - FRAME_jump08, - FRAME_jump09, - FRAME_jump10, - // ROGUE - // [Paril-KEX] old attack, for demos - FRAME_attak301, - FRAME_attak302, - FRAME_attak303, - FRAME_attak304, - FRAME_attak305, - FRAME_attak306, - FRAME_attak307, - FRAME_attak308, - FRAME_attak309, - FRAME_attak310, - FRAME_attak311, - FRAME_attak312, - FRAME_attak313, - FRAME_attak314, - FRAME_attak315, - // [Paril-KEX] run attack - FRAME_run201, - FRAME_run202, - FRAME_run203, - FRAME_run204, - FRAME_run205, - FRAME_run206, - FRAME_run207, - FRAME_run208, - // [Paril-KEX] - FRAME_attak401, - FRAME_attak402, - FRAME_attak403, - FRAME_attak404, - FRAME_attak405, - FRAME_attak406, - FRAME_attak407, - FRAME_attak408, - FRAME_attak409, - FRAME_attak410, - FRAME_attak411, - FRAME_attak412, - FRAME_attak413, - FRAME_attak414, - FRAME_attak415, - FRAME_attak416, - FRAME_attak417, - FRAME_attak418, - FRAME_attak419, - FRAME_attak420, - FRAME_attak421, - FRAME_attak422, - FRAME_attak423, - FRAME_attak424 -}; - -constexpr float MODEL_SCALE = 1.000000f; diff --git a/actionlite/m_medic.cpp b/actionlite/m_medic.cpp deleted file mode 100644 index 2346a8c..0000000 --- a/actionlite/m_medic.cpp +++ /dev/null @@ -1,1643 +0,0 @@ -// Copyright (c) ZeniMax Media Inc. -// Licensed under the GNU General Public License 2.0. -/* -============================================================================== - -MEDIC - -============================================================================== -*/ - -#include "g_local.h" -#include "m_medic.h" -#include "m_flash.h" - -constexpr float MEDIC_MIN_DISTANCE = 32; -constexpr float MEDIC_MAX_HEAL_DISTANCE = 400; -constexpr gtime_t MEDIC_TRY_TIME = 10_sec; - -// FIXME - -// -// owner moved to monsterinfo.healer instead -// -// For some reason, the healed monsters are rarely ending up in the floor -// -// 5/15/1998 I think I fixed these, keep an eye on them - -void M_SetEffects(edict_t *ent); -bool FindTarget(edict_t *self); -void FoundTarget(edict_t *self); -void ED_CallSpawn(edict_t *ent); - -static int sound_idle1; -static int sound_pain1; -static int sound_pain2; -static int sound_die; -static int sound_sight; -static int sound_search; -static int sound_hook_launch; -static int sound_hook_hit; -static int sound_hook_heal; -static int sound_hook_retract; - -// PMM - commander sounds -static int commander_sound_idle1; -static int commander_sound_pain1; -static int commander_sound_pain2; -static int commander_sound_die; -static int commander_sound_sight; -static int commander_sound_search; -static int commander_sound_hook_launch; -static int commander_sound_hook_hit; -static int commander_sound_hook_heal; -static int commander_sound_hook_retract; -static int commander_sound_spawn; - -constexpr const char *default_reinforcements = "monster_soldier_light 1;monster_soldier 2;monster_soldier_ss 2;monster_infantry 3;monster_gunner 4;monster_medic 5;monster_gladiator 6"; -constexpr int32_t default_monster_slots_base = 3; - -static const float inverse_log_slots = pow(2, MAX_REINFORCEMENTS); - -constexpr std::array reinforcement_position = { - vec3_t { 80, 0, 0 }, - vec3_t { 40, 60, 0 }, - vec3_t { 40, -60, 0 }, - vec3_t { 0, 80, 0 }, - vec3_t { 0, -80, 0 } -}; - -// filter out the reinforcement indices we can pick given the space we have left -static void M_PickValidReinforcements(edict_t *self, int32_t space, std::vector &output) -{ - output.clear(); - - for (uint8_t i = 0; i < self->monsterinfo.reinforcements.num_reinforcements; i++) - if (self->monsterinfo.reinforcements.reinforcements[i].strength <= space) - output.push_back(i); -} - -// pick an array of reinforcements to use; note that this does not modify `self` -std::array M_PickReinforcements(edict_t *self, int32_t &num_chosen, int32_t max_slots = 0) -{ - static std::vector available; - std::array chosen; - chosen.fill(255); - - // decide how many things we want to spawn; - // this is on a logarithmic scale - // so we don't spawn too much too often. - int32_t num_slots = max(1, (int32_t) log2(frandom(inverse_log_slots))); - - // we only have this many slots left to use - int32_t remaining = self->monsterinfo.monster_slots - self->monsterinfo.monster_used; - - for (num_chosen = 0; num_chosen < num_slots; num_chosen++) - { - // ran out of slots! - if ((max_slots && num_chosen == max_slots) || !remaining) - break; - - // get everything we could choose - M_PickValidReinforcements(self, remaining, available); - - // can't pick any - if (!available.size()) - break; - - // select monster, TODO fairly - chosen[num_chosen] = random_element(available); - - remaining -= self->monsterinfo.reinforcements.reinforcements[chosen[num_chosen]].strength; - } - - return chosen; -} - -void M_SetupReinforcements(const char *reinforcements, reinforcement_list_t &list) -{ - // count up the semicolons - list.num_reinforcements = 0; - - if (!*reinforcements) - return; - - list.num_reinforcements++; - - for (size_t i = 0; i < strlen(reinforcements); i++) - if (reinforcements[i] == ';') - list.num_reinforcements++; - - // allocate - list.reinforcements = (reinforcement_t *) gi.TagMalloc(sizeof(reinforcement_t) * list.num_reinforcements, TAG_LEVEL); - - // parse - const char *p = reinforcements; - reinforcement_t *r = list.reinforcements; - - st = {}; - - while (true) - { - const char *token = COM_ParseEx(&p, "; "); - - if (!*token || r == list.reinforcements + list.num_reinforcements) - break; - - r->classname = G_CopyString(token, TAG_LEVEL); - - token = COM_ParseEx(&p, "; "); - - r->strength = atoi(token); - - edict_t *newEnt = G_Spawn(); - - newEnt->classname = r->classname; - - newEnt->monsterinfo.aiflags |= AI_DO_NOT_COUNT; - - ED_CallSpawn(newEnt); - - r->mins = newEnt->mins; - r->maxs = newEnt->maxs; - - G_FreeEdict(newEnt); - - r++; - } -} - -void cleanupHeal(edict_t *self, bool change_frame) -{ - // clean up target, if we have one and it's legit - if (self->enemy && self->enemy->inuse) - cleanupHealTarget(self->enemy); - - if (self->oldenemy && self->oldenemy->inuse && self->oldenemy->health > 0) - { - self->enemy = self->oldenemy; - HuntTarget(self, false); - } - else - { - self->enemy = self->goalentity = nullptr; - self->oldenemy = nullptr; - if (!FindTarget(self)) - { - // no valid enemy, so stop acting - self->monsterinfo.pausetime = HOLD_FOREVER; - self->monsterinfo.stand(self); - return; - } - } - - if (change_frame) - self->monsterinfo.nextframe = FRAME_attack52; -} - -void abortHeal(edict_t *self, bool change_frame, bool gib, bool mark) -{ - int hurt; - constexpr vec3_t pain_normal = { 0, 0, 1 }; - - cleanupHealTarget(self->enemy); - - // gib em! - if ((mark) && (self->enemy) && (self->enemy->inuse)) - { - // if the first badMedic slot is filled by a medic, skip it and use the second one - if ((self->enemy->monsterinfo.badMedic1) && (self->enemy->monsterinfo.badMedic1->inuse) && (!strncmp(self->enemy->monsterinfo.badMedic1->classname, "monster_medic", 13))) - { - self->enemy->monsterinfo.badMedic2 = self; - } - else - { - self->enemy->monsterinfo.badMedic1 = self; - } - } - if ((gib) && (self->enemy) && (self->enemy->inuse)) - { - if (self->enemy->gib_health) - hurt = -self->enemy->gib_health; - else - hurt = 500; - - T_Damage(self->enemy, self, self, vec3_origin, self->enemy->s.origin, - pain_normal, hurt, 0, DAMAGE_NONE, MOD_UNKNOWN); - } - // clean up self - - // clean up target - cleanupHeal(self, change_frame); - - self->monsterinfo.aiflags &= ~AI_MEDIC; - self->monsterinfo.medicTries = 0; -} - -bool canReach(edict_t *self, edict_t *other) -{ - vec3_t spot1; - vec3_t spot2; - trace_t trace; - - spot1 = self->s.origin; - spot1[2] += self->viewheight; - spot2 = other->s.origin; - spot2[2] += other->viewheight; - trace = gi.traceline(spot1, spot2, self, MASK_PROJECTILE | MASK_WATER); - return trace.fraction == 1.0f || trace.ent == other; -} - -edict_t *medic_FindDeadMonster(edict_t *self) -{ - float radius; - edict_t *ent = nullptr; - edict_t *best = nullptr; - - if (self->monsterinfo.react_to_damage_time > level.time) - return nullptr; - - if (self->monsterinfo.aiflags & AI_STAND_GROUND) - radius = MEDIC_MAX_HEAL_DISTANCE; - else - radius = 1024; - - while ((ent = findradius(ent, self->s.origin, radius)) != nullptr) - { - if (ent == self) - continue; - if (!(ent->svflags & SVF_MONSTER)) - continue; - if (ent->monsterinfo.aiflags & AI_GOOD_GUY) - continue; - // check to make sure we haven't bailed on this guy already - if ((ent->monsterinfo.badMedic1 == self) || (ent->monsterinfo.badMedic2 == self)) - continue; - if (ent->monsterinfo.healer) - // FIXME - this is correcting a bug that is somewhere else - // if the healer is a monster, and it's in medic mode .. continue .. otherwise - // we will override the healer, if it passes all the other tests - if ((ent->monsterinfo.healer->inuse) && (ent->monsterinfo.healer->health > 0) && - (ent->monsterinfo.healer->svflags & SVF_MONSTER) && (ent->monsterinfo.healer->monsterinfo.aiflags & AI_MEDIC)) - continue; - if (ent->health > 0) - continue; - if ((ent->nextthink) && (ent->think != monster_dead_think)) - continue; - if (!visible(self, ent)) - continue; - if (!strncmp(ent->classname, "player", 6)) // stop it from trying to heal player_noise entities - continue; - // FIXME - there's got to be a better way .. - // make sure we don't spawn people right on top of us - if (realrange(self, ent) <= MEDIC_MIN_DISTANCE) - continue; - if (!best) - { - best = ent; - continue; - } - if (ent->max_health <= best->max_health) - continue; - best = ent; - } - - if (best) - self->timestamp = level.time + MEDIC_TRY_TIME; - - return best; -} - -MONSTERINFO_IDLE(medic_idle) (edict_t *self) -> void -{ - edict_t *ent; - - // PMM - commander sounds - if (self->mass == 400) - gi.sound(self, CHAN_VOICE, sound_idle1, 1, ATTN_IDLE, 0); - else - gi.sound(self, CHAN_VOICE, commander_sound_idle1, 1, ATTN_IDLE, 0); - - if (!self->oldenemy) - { - ent = medic_FindDeadMonster(self); - if (ent) - { - self->oldenemy = self->enemy; - self->enemy = ent; - self->enemy->monsterinfo.healer = self; - self->monsterinfo.aiflags |= AI_MEDIC; - FoundTarget(self); - } - } -} - -MONSTERINFO_SEARCH(medic_search) (edict_t *self) -> void -{ - edict_t *ent; - - // PMM - commander sounds - if (self->mass == 400) - gi.sound(self, CHAN_VOICE, sound_search, 1, ATTN_IDLE, 0); - else - gi.sound(self, CHAN_VOICE, commander_sound_search, 1, ATTN_IDLE, 0); - - if (!self->oldenemy) - { - ent = medic_FindDeadMonster(self); - if (ent) - { - self->oldenemy = self->enemy; - self->enemy = ent; - self->enemy->monsterinfo.healer = self; - self->monsterinfo.aiflags |= AI_MEDIC; - FoundTarget(self); - } - } -} - -MONSTERINFO_SIGHT(medic_sight) (edict_t *self, edict_t *other) -> void -{ - // PMM - commander sounds - if (self->mass == 400) - gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0); - else - gi.sound(self, CHAN_VOICE, commander_sound_sight, 1, ATTN_NORM, 0); -} - -mframe_t medic_frames_stand[] = { - { ai_stand, 0, medic_idle }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, - { ai_stand }, -}; -MMOVE_T(medic_move_stand) = { FRAME_wait1, FRAME_wait90, medic_frames_stand, nullptr }; - -MONSTERINFO_STAND(medic_stand) (edict_t *self) -> void -{ - M_SetAnimation(self, &medic_move_stand); -} - -mframe_t medic_frames_walk[] = { - { ai_walk, 6.2f }, - { ai_walk, 18.1f, monster_footstep }, - { ai_walk, 1 }, - { ai_walk, 9 }, - { ai_walk, 10 }, - { ai_walk, 9 }, - { ai_walk, 11 }, - { ai_walk, 11.6f, monster_footstep }, - { ai_walk, 2 }, - { ai_walk, 9.9f }, - { ai_walk, 14 }, - { ai_walk, 9.3f } -}; -MMOVE_T(medic_move_walk) = { FRAME_walk1, FRAME_walk12, medic_frames_walk, nullptr }; - -MONSTERINFO_WALK(medic_walk) (edict_t *self) -> void -{ - M_SetAnimation(self, &medic_move_walk); -} - -mframe_t medic_frames_run[] = { - { ai_run, 18 }, - { ai_run, 22.5f, monster_footstep }, - { ai_run, 25.4f, monster_done_dodge }, - { ai_run, 23.4f, monster_footstep }, - { ai_run, 24 }, - { ai_run, 35.6f } -}; -MMOVE_T(medic_move_run) = { FRAME_run1, FRAME_run6, medic_frames_run, nullptr }; - -MONSTERINFO_RUN(medic_run) (edict_t *self) -> void -{ - monster_done_dodge(self); - - if (!(self->monsterinfo.aiflags & AI_MEDIC)) - { - edict_t *ent; - - ent = medic_FindDeadMonster(self); - if (ent) - { - self->oldenemy = self->enemy; - self->enemy = ent; - self->enemy->monsterinfo.healer = self; - self->monsterinfo.aiflags |= AI_MEDIC; - FoundTarget(self); - return; - } - } - - if (self->monsterinfo.aiflags & AI_STAND_GROUND) - M_SetAnimation(self, &medic_move_stand); - else - M_SetAnimation(self, &medic_move_run); -} - -mframe_t medic_frames_pain1[] = { - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move } -}; -MMOVE_T(medic_move_pain1) = { FRAME_paina2, FRAME_paina6, medic_frames_pain1, medic_run }; - -mframe_t medic_frames_pain2[] = { - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move, 0, monster_footstep }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move, 0, monster_footstep } -}; -MMOVE_T(medic_move_pain2) = { FRAME_painb2, FRAME_painb13, medic_frames_pain2, medic_run }; - -PAIN(medic_pain) (edict_t *self, edict_t *other, float kick, int damage, const mod_t &mod) -> void -{ - monster_done_dodge(self); - - if (level.time < self->pain_debounce_time) - return; - - self->pain_debounce_time = level.time + 3_sec; - - float r = frandom(); - - if (self->mass > 400) - { - if (damage < 35) - { - gi.sound(self, CHAN_VOICE, commander_sound_pain1, 1, ATTN_NORM, 0); - - if (mod.id != MOD_UNKNOWN) - return; - } - - gi.sound(self, CHAN_VOICE, commander_sound_pain2, 1, ATTN_NORM, 0); - } - else if (r < 0.5f) - gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0); - else - gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0); - - if (!M_ShouldReactToPain(self, mod)) - return; // no pain anims in nightmare - - // if we're healing someone, we ignore pain - if (mod.id != MOD_UNKNOWN && (self->monsterinfo.aiflags & AI_MEDIC)) - return; - - if (self->mass > 400) - { - self->monsterinfo.aiflags &= ~AI_MANUAL_STEERING; - self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; - - if (r < (min(((float) damage * 0.005f), 0.5f))) // no more than 50% chance of big pain - M_SetAnimation(self, &medic_move_pain2); - else - M_SetAnimation(self, &medic_move_pain1); - } - else if (r < 0.5f) - M_SetAnimation(self, &medic_move_pain1); - else - M_SetAnimation(self, &medic_move_pain2); - - // PMM - clear duck flag - if (self->monsterinfo.aiflags & AI_DUCKED) - monster_duck_up(self); - - abortHeal(self, false, false, false); -} - -MONSTERINFO_SETSKIN(medic_setskin) (edict_t *self) -> void -{ - if ((self->health < (self->max_health / 2))) - self->s.skinnum |= 1; - else - self->s.skinnum &= ~1; -} - -void medic_fire_blaster(edict_t *self) -{ - vec3_t start; - vec3_t forward, right; - vec3_t end; - vec3_t dir; - effects_t effect; - int damage = 2; - monster_muzzleflash_id_t mz; - - // paranoia checking - if (!(self->enemy && self->enemy->inuse)) - return; - - if ((self->s.frame == FRAME_attack9) || (self->s.frame == FRAME_attack12)) - { - effect = EF_BLASTER; - damage = 6; - mz = (self->mass > 400) ? MZ2_MEDIC_BLASTER_2 : MZ2_MEDIC_BLASTER_1; - } - else - { - static constexpr vec3_t hb_offsets[] = { - { 33.0f, 12.5f, 15.0f }, - { 32.4f, 11.2f, 15.0f }, - { 35.6f, 7.4f, 15.0f }, - { 34.0f, 4.1f, 15.0f }, - { 36.6f, 1.0f, 15.0f }, - { 34.7f, -1.9f, 15.0f }, - { 36.6f, -0.5f, 15.0f }, - { 34.2f, 2.8f, 15.0f }, - { 36.5f, 3.8f, 15.0f }, - { 33.5f, 6.9f, 15.0f }, - { 32.7f, 9.9f, 15.0f }, - { 34.5f, 11.0f, 15.0f } - }; - - effect = (self->s.frame % 4) ? EF_NONE : EF_HYPERBLASTER; - mz = static_cast(((self->mass > 400) ? MZ2_MEDIC_HYPERBLASTER2_1 : MZ2_MEDIC_HYPERBLASTER1_1) + (self->s.frame - FRAME_attack19)); - } - - AngleVectors(self->s.angles, forward, right, nullptr); - const vec3_t &offset = monster_flash_offset[mz]; - start = M_ProjectFlashSource(self, offset, forward, right); - - end = self->enemy->s.origin; - end[2] += self->enemy->viewheight; - dir = end - start; - dir.normalize(); - - if ( !strcmp( self->enemy->classname, "tesla_mine" ) ) - damage = 3; - - // medic commander shoots blaster2 - if (self->mass > 400) - monster_fire_blaster2(self, start, dir, damage, 1000, mz, effect); - else - monster_fire_blaster(self, start, dir, damage, 1000, mz, effect); -} - -void medic_dead(edict_t *self) -{ - self->mins = { -16, -16, -24 }; - self->maxs = { 16, 16, -8 }; - monster_dead(self); -} - -static void medic_shrink(edict_t *self) -{ - self->maxs[2] = -2; - self->svflags |= SVF_DEADMONSTER; - gi.linkentity(self); -} - -mframe_t medic_frames_death[] = { - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move, -18.f, monster_footstep }, - { ai_move, -10.f, medic_shrink }, - { ai_move, -6.f }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move, 0, monster_footstep }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move } -}; -MMOVE_T(medic_move_death) = { FRAME_death2, FRAME_death30, medic_frames_death, medic_dead }; - -DIE(medic_die) (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, const vec3_t &point, const mod_t &mod) -> void -{ - // if we had a pending patient, he was already freed up in Killed - - // check for gib - if (M_CheckGib(self, mod)) - { - gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0); - - self->s.skinnum /= 2; - - ThrowGibs(self, damage, { - { 2, "models/objects/gibs/bone/tris.md2" }, - { "models/objects/gibs/sm_meat/tris.md2" }, - { "models/objects/gibs/sm_metal/tris.md2", GIB_METALLIC }, - { "models/monsters/medic/gibs/chest.md2", GIB_SKINNED }, - { 2, "models/monsters/medic/gibs/leg.md2", GIB_SKINNED | GIB_UPRIGHT }, - { "models/monsters/medic/gibs/hook.md2", GIB_SKINNED | GIB_UPRIGHT }, - { "models/monsters/medic/gibs/gun.md2", GIB_SKINNED | GIB_UPRIGHT }, - { "models/monsters/medic/gibs/head.md2", GIB_SKINNED | GIB_HEAD } - }); - - self->deadflag = true; - return; - } - - if (self->deadflag) - return; - - // regular death - // PMM - if (self->mass == 400) - gi.sound(self, CHAN_VOICE, sound_die, 1, ATTN_NORM, 0); - else - gi.sound(self, CHAN_VOICE, commander_sound_die, 1, ATTN_NORM, 0); - // - self->deadflag = true; - self->takedamage = true; - - M_SetAnimation(self, &medic_move_death); -} - -mframe_t medic_frames_duck[] = { - { ai_move, -1 }, - { ai_move, -1, monster_duck_down }, - { ai_move, -1, monster_duck_hold }, - { ai_move, -1 }, - { ai_move, -1 }, - { ai_move, -1 }, // PMM - duck up used to be here - { ai_move, -1 }, - { ai_move, -1 }, - { ai_move, -1 }, - { ai_move, -1 }, - { ai_move, -1 }, - { ai_move, -1 }, - { ai_move, -1, monster_duck_up } -}; -MMOVE_T(medic_move_duck) = { FRAME_duck2, FRAME_duck14, medic_frames_duck, medic_run }; - -// PMM -- moved dodge code to after attack code so I can reference attack frames - -mframe_t medic_frames_attackHyperBlaster[] = { - { ai_charge }, - { ai_charge }, - { ai_charge }, - { ai_charge }, - { ai_charge, 0, medic_fire_blaster }, - { ai_charge, 0, medic_fire_blaster }, - { ai_charge, 0, medic_fire_blaster }, - { ai_charge, 0, medic_fire_blaster }, - { ai_charge, 0, medic_fire_blaster }, - { ai_charge, 0, medic_fire_blaster }, - { ai_charge, 0, medic_fire_blaster }, - { ai_charge, 0, medic_fire_blaster }, - { ai_charge, 0, medic_fire_blaster }, - { ai_charge, 0, medic_fire_blaster }, - { ai_charge, 0, medic_fire_blaster }, - { ai_charge, 0, medic_fire_blaster }, - { ai_charge }, - { ai_charge }, - // [Paril-KEX] end on 36 as intended - { ai_charge, 2.f }, // 33 - { ai_charge, 3.f, monster_footstep }, -}; -MMOVE_T(medic_move_attackHyperBlaster) = { FRAME_attack15, FRAME_attack34, medic_frames_attackHyperBlaster, medic_run }; - -static void medic_quick_attack(edict_t *self) -{ - if (frandom() < 0.5f) - { - M_SetAnimation(self, &medic_move_attackHyperBlaster, false); - self->monsterinfo.nextframe = FRAME_attack16; - } -} - -void medic_continue(edict_t *self) -{ - if (visible(self, self->enemy)) - if (frandom() <= 0.95f) - M_SetAnimation(self, &medic_move_attackHyperBlaster, false); -} - -mframe_t medic_frames_attackBlaster[] = { - { ai_charge, 5 }, - { ai_charge, 3 }, - { ai_charge, 2 }, - { ai_charge, 0, medic_quick_attack }, - { ai_charge, 0, monster_footstep }, - { ai_charge }, - { ai_charge, 0, medic_fire_blaster }, - { ai_charge }, - { ai_charge }, - { ai_charge, 0, medic_fire_blaster }, - { ai_charge }, - { ai_charge, 0, medic_continue } // Change to medic_continue... Else, go to frame 32 -}; -MMOVE_T(medic_move_attackBlaster) = { FRAME_attack3, FRAME_attack14, medic_frames_attackBlaster, medic_run }; - -void medic_hook_launch(edict_t *self) -{ - // PMM - commander sounds - if (self->mass == 400) - gi.sound(self, CHAN_WEAPON, sound_hook_launch, 1, ATTN_NORM, 0); - else - gi.sound(self, CHAN_WEAPON, commander_sound_hook_launch, 1, ATTN_NORM, 0); -} - -constexpr vec3_t medic_cable_offsets[] = { - { 45.0f, -9.2f, 15.5f }, - { 48.4f, -9.7f, 15.2f }, - { 47.8f, -9.8f, 15.8f }, - { 47.3f, -9.3f, 14.3f }, - { 45.4f, -10.1f, 13.1f }, - { 41.9f, -12.7f, 12.0f }, - { 37.8f, -15.8f, 11.2f }, - { 34.3f, -18.4f, 10.7f }, - { 32.7f, -19.7f, 10.4f }, - { 32.7f, -19.7f, 10.4f } -}; - -void medic_cable_attack(edict_t *self) -{ - vec3_t offset, start, end, f, r; - trace_t tr; - vec3_t dir; - float distance; - - if ((!self->enemy) || (!self->enemy->inuse) || (self->enemy->s.effects & EF_GIB)) - { - abortHeal(self, false, false, false); - return; - } - - // we switched back to a player; let the animation finish - if (self->enemy->client) - return; - - // see if our enemy has changed to a client, or our target has more than 0 health, - // abort it .. we got switched to someone else due to damage - if (self->enemy->health > 0) - { - abortHeal(self, false, false, false); - return; - } - - AngleVectors(self->s.angles, f, r, nullptr); - offset = medic_cable_offsets[self->s.frame - FRAME_attack42]; - start = M_ProjectFlashSource(self, offset, f, r); - - // check for max distance - // not needed, done in checkattack - // check for min distance - dir = start - self->enemy->s.origin; - distance = dir.length(); - if (distance < MEDIC_MIN_DISTANCE) - { - abortHeal(self, true, true, false); - return; - } - - tr = gi.traceline(start, self->enemy->s.origin, self, MASK_SOLID); - if (tr.fraction != 1.0f && tr.ent != self->enemy) - { - if (tr.ent == world) - { - // give up on second try - if (self->monsterinfo.medicTries > 1) - { - abortHeal(self, true, false, true); - return; - } - self->monsterinfo.medicTries++; - cleanupHeal(self, 1); - return; - } - abortHeal(self, true, false, false); - return; - } - - if (self->s.frame == FRAME_attack43) - { - // PMM - commander sounds - if (self->mass == 400) - gi.sound(self->enemy, CHAN_AUTO, sound_hook_hit, 1, ATTN_NORM, 0); - else - gi.sound(self->enemy, CHAN_AUTO, commander_sound_hook_hit, 1, ATTN_NORM, 0); - - self->enemy->monsterinfo.aiflags |= AI_RESURRECTING; - self->enemy->takedamage = false; - M_SetEffects(self->enemy); - } - else if (self->s.frame == FRAME_attack50) - { - vec3_t maxs; - self->enemy->spawnflags = SPAWNFLAG_NONE; - self->enemy->monsterinfo.aiflags &= AI_STINKY | AI_SPAWNED_MASK; - self->enemy->target = nullptr; - self->enemy->targetname = nullptr; - self->enemy->combattarget = nullptr; - self->enemy->deathtarget = nullptr; - self->enemy->healthtarget = nullptr; - self->enemy->itemtarget = nullptr; - self->enemy->monsterinfo.healer = self; - - maxs = self->enemy->maxs; - maxs[2] += 48; // compensate for change when they die - - tr = gi.trace(self->enemy->s.origin, self->enemy->mins, maxs, self->enemy->s.origin, self->enemy, MASK_MONSTERSOLID); - - if (tr.startsolid || tr.allsolid) - { - abortHeal(self, true, true, false); - return; - } - else if (tr.ent != world) - { - abortHeal(self, true, true, false); - return; - } - else - { - self->enemy->monsterinfo.aiflags |= AI_DO_NOT_COUNT; - - // backup & restore health stuff, because of multipliers - int32_t old_max_health = self->enemy->max_health; - item_id_t old_power_armor_type = self->enemy->monsterinfo.initial_power_armor_type; - int32_t old_power_armor_power = self->enemy->monsterinfo.max_power_armor_power; - int32_t old_base_health = self->enemy->monsterinfo.base_health; - int32_t old_health_scaling = self->enemy->monsterinfo.health_scaling; - auto reinforcements = self->enemy->monsterinfo.reinforcements; - int32_t monster_slots = self->enemy->monsterinfo.monster_slots; - int32_t monster_used = self->enemy->monsterinfo.monster_used; - int32_t old_gib_health = self->enemy->gib_health; - - st = {}; - st.keys_specified.emplace("reinforcements"); - st.reinforcements = ""; - - ED_CallSpawn(self->enemy); - - self->enemy->monsterinfo.reinforcements = reinforcements; - self->enemy->monsterinfo.monster_slots = monster_slots; - self->enemy->monsterinfo.monster_used = monster_used; - - self->enemy->gib_health = old_gib_health / 2; - self->enemy->health = self->enemy->max_health = old_max_health; - self->enemy->monsterinfo.power_armor_power = self->enemy->monsterinfo.max_power_armor_power = old_power_armor_power; - self->enemy->monsterinfo.power_armor_type = self->enemy->monsterinfo.initial_power_armor_type = old_power_armor_type; - self->enemy->monsterinfo.base_health = old_base_health; - self->enemy->monsterinfo.health_scaling = old_health_scaling; - - if (self->enemy->monsterinfo.setskin) - self->enemy->monsterinfo.setskin(self->enemy); - - if (self->enemy->think) - { - self->enemy->nextthink = level.time; - self->enemy->think(self->enemy); - } - self->enemy->monsterinfo.aiflags &= ~AI_RESURRECTING; - self->enemy->monsterinfo.aiflags |= AI_IGNORE_SHOTS | AI_DO_NOT_COUNT; - // turn off flies - self->enemy->s.effects &= ~EF_FLIES; - self->enemy->monsterinfo.healer = nullptr; - - if ((self->oldenemy) && (self->oldenemy->inuse) && (self->oldenemy->health > 0)) - { - self->enemy->enemy = self->oldenemy; - FoundTarget(self->enemy); - } - else - { - self->enemy->enemy = nullptr; - if (!FindTarget(self->enemy)) - { - // no valid enemy, so stop acting - self->enemy->monsterinfo.pausetime = HOLD_FOREVER; - self->enemy->monsterinfo.stand(self->enemy); - } - self->enemy = nullptr; - self->oldenemy = nullptr; - if (!FindTarget(self)) - { - // no valid enemy, so stop acting - self->monsterinfo.pausetime = HOLD_FOREVER; - self->monsterinfo.stand(self); - return; - } - } - - cleanupHeal(self, false); - return; - } - } - else - { - if (self->s.frame == FRAME_attack44) - { - // PMM - medic commander sounds - if (self->mass == 400) - gi.sound(self, CHAN_WEAPON, sound_hook_heal, 1, ATTN_NORM, 0); - else - gi.sound(self, CHAN_WEAPON, commander_sound_hook_heal, 1, ATTN_NORM, 0); - } - } - - // adjust start for beam origin being in middle of a segment - start += (f * 8); - - // adjust end z for end spot since the monster is currently dead - end = self->enemy->s.origin; - end[2] = (self->enemy->absmin[2] + self->enemy->absmax[2]) / 2; - - gi.WriteByte(svc_temp_entity); - gi.WriteByte(TE_MEDIC_CABLE_ATTACK); - gi.WriteEntity(self); - gi.WritePosition(start); - gi.WritePosition(end); - gi.multicast(self->s.origin, MULTICAST_PVS, false); -} - -void medic_hook_retract(edict_t *self) -{ - if (self->mass == 400) - gi.sound(self, CHAN_WEAPON, sound_hook_retract, 1, ATTN_NORM, 0); - else - gi.sound(self, CHAN_WEAPON, sound_hook_retract, 1, ATTN_NORM, 0); - - self->monsterinfo.aiflags &= ~AI_MEDIC; - - if (self->oldenemy && self->oldenemy->inuse && self->oldenemy->health > 0) - { - self->enemy = self->oldenemy; - HuntTarget(self, false); - } - else - { - self->enemy = self->goalentity = nullptr; - self->oldenemy = nullptr; - if (!FindTarget(self)) - { - // no valid enemy, so stop acting - self->monsterinfo.pausetime = HOLD_FOREVER; - self->monsterinfo.stand(self); - return; - } - } -} - -mframe_t medic_frames_attackCable[] = { - // ROGUE - negated 36-40 so he scoots back from his target a little - // ROGUE - switched 33-36 to ai_charge - // ROGUE - changed frame 52 to 60 to compensate for changes in 36-40 - // [Paril-KEX] started on 36 as they intended - { ai_charge, -4.7f }, // 37 - { ai_charge, -5.f }, - { ai_charge, -6.f }, - { ai_charge, -4.f }, // 40 - { ai_charge, 0, monster_footstep }, - { ai_move, 0, medic_hook_launch }, // 42 - { ai_move, 0, medic_cable_attack }, // 43 - { ai_move, 0, medic_cable_attack }, - { ai_move, 0, medic_cable_attack }, - { ai_move, 0, medic_cable_attack }, - { ai_move, 0, medic_cable_attack }, - { ai_move, 0, medic_cable_attack }, - { ai_move, 0, medic_cable_attack }, - { ai_move, 0, medic_cable_attack }, - { ai_move, 0, medic_cable_attack }, // 51 - { ai_move, 0, medic_hook_retract }, // 52 - { ai_move, -1.5f }, - { ai_move, -1.2f, monster_footstep }, - { ai_move, -3.f } -}; -MMOVE_T(medic_move_attackCable) = { FRAME_attack37, FRAME_attack55, medic_frames_attackCable, medic_run }; - -void medic_start_spawn(edict_t *self) -{ - gi.sound(self, CHAN_WEAPON, commander_sound_spawn, 1, ATTN_NORM, 0); - self->monsterinfo.nextframe = FRAME_attack48; -} - -void medic_determine_spawn(edict_t *self) -{ - vec3_t f, r, offset, startpoint, spawnpoint; - int count; - int num_success = 0; - - AngleVectors(self->s.angles, f, r, nullptr); - - int num_summoned; - self->monsterinfo.chosen_reinforcements = M_PickReinforcements(self, num_summoned); - - for (count = 0; count < num_summoned; count++) - { - offset = reinforcement_position[count]; - - if (self->s.scale) - offset *= self->s.scale; - - startpoint = M_ProjectFlashSource(self, offset, f, r); - // a little off the ground - startpoint[2] += 10 * (self->s.scale ? self->s.scale : 1.0f); - - auto &reinforcement = self->monsterinfo.reinforcements.reinforcements[self->monsterinfo.chosen_reinforcements[count]]; - - if (FindSpawnPoint(startpoint, reinforcement.mins, reinforcement.maxs, spawnpoint, 32)) - { - if (CheckGroundSpawnPoint(spawnpoint, reinforcement.mins, reinforcement.maxs, 256, -1)) - { - num_success++; - // we found a spot, we're done here - count = num_summoned; - } - } - } - - // see if we have any success by spinning around - if (num_success == 0) - { - for (count = 0; count < num_summoned; count++) - { - offset = reinforcement_position[count]; - - if (self->s.scale) - offset *= self->s.scale; - - // check behind - offset[0] *= -1.0f; - offset[1] *= -1.0f; - startpoint = M_ProjectFlashSource(self, offset, f, r); - // a little off the ground - startpoint[2] += 10; - - auto &reinforcement = self->monsterinfo.reinforcements.reinforcements[self->monsterinfo.chosen_reinforcements[count]]; - - if (FindSpawnPoint(startpoint, reinforcement.mins, reinforcement.maxs, spawnpoint, 32)) - { - if (CheckGroundSpawnPoint(spawnpoint, reinforcement.mins, reinforcement.maxs, 256, -1)) - { - num_success++; - // we found a spot, we're done here - count = num_summoned; - } - } - } - - if (num_success) - { - self->monsterinfo.aiflags |= AI_MANUAL_STEERING; - self->ideal_yaw = anglemod(self->s.angles[YAW]) + 180; - if (self->ideal_yaw > 360.0f) - self->ideal_yaw -= 360.0f; - } - } - - if (num_success == 0) - self->monsterinfo.nextframe = FRAME_attack53; -} - -void medic_spawngrows(edict_t *self) -{ - vec3_t f, r, offset, startpoint, spawnpoint; - int count; - int num_summoned; // should be 1, 3, or 5 - int num_success = 0; - float current_yaw; - - // if we've been directed to turn around - if (self->monsterinfo.aiflags & AI_MANUAL_STEERING) - { - current_yaw = anglemod(self->s.angles[YAW]); - if (fabsf(current_yaw - self->ideal_yaw) > 0.1f) - { - self->monsterinfo.aiflags |= AI_HOLD_FRAME; - return; - } - - // done turning around - self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; - self->monsterinfo.aiflags &= ~AI_MANUAL_STEERING; - } - - AngleVectors(self->s.angles, f, r, nullptr); - - num_summoned = 0; - - for (int32_t i = 0; i < MAX_REINFORCEMENTS; i++, num_summoned++) - if (self->monsterinfo.chosen_reinforcements[i] == 255) - break; - - for (count = 0; count < num_summoned; count++) - { - offset = reinforcement_position[count]; - - if (self->s.scale) - offset *= self->s.scale; - - startpoint = M_ProjectFlashSource(self, offset, f, r); - // a little off the ground - startpoint[2] += 10 * (self->s.scale ? self->s.scale : 1.0f); - - auto &reinforcement = self->monsterinfo.reinforcements.reinforcements[self->monsterinfo.chosen_reinforcements[count]]; - - if (FindSpawnPoint(startpoint, reinforcement.mins, reinforcement.maxs, spawnpoint, 32)) - { - if (CheckGroundSpawnPoint(spawnpoint, reinforcement.mins, reinforcement.maxs, 256, -1)) - { - num_success++; - float radius = (reinforcement.maxs - reinforcement.mins).length() * 0.5f; - SpawnGrow_Spawn(spawnpoint + (reinforcement.mins + reinforcement.maxs), radius, radius * 2.f); - } - } - } - - if (num_success == 0) - self->monsterinfo.nextframe = FRAME_attack53; -} - -void medic_finish_spawn(edict_t *self) -{ - edict_t *ent; - vec3_t f, r, offset, startpoint, spawnpoint; - int count; - int num_summoned; // should be 1, 3, or 5 - edict_t *designated_enemy; - - AngleVectors(self->s.angles, f, r, nullptr); - - num_summoned = 0; - - for (int32_t i = 0; i < MAX_REINFORCEMENTS; i++, num_summoned++) - if (self->monsterinfo.chosen_reinforcements[i] == 255) - break; - - for (count = 0; count < num_summoned; count++) - { - auto &reinforcement = self->monsterinfo.reinforcements.reinforcements[self->monsterinfo.chosen_reinforcements[count]]; - offset = reinforcement_position[count]; - - if (self->s.scale) - offset *= self->s.scale; - - startpoint = M_ProjectFlashSource(self, offset, f, r); - - // a little off the ground - startpoint[2] += 10 * (self->s.scale ? self->s.scale : 1.0f); - - ent = nullptr; - if (FindSpawnPoint(startpoint, reinforcement.mins, reinforcement.maxs, spawnpoint, 32)) - { - if (CheckSpawnPoint(spawnpoint, reinforcement.mins, reinforcement.maxs)) - ent = CreateGroundMonster(spawnpoint, self->s.angles, reinforcement.mins, reinforcement.maxs, reinforcement.classname, 256); - } - - if (!ent) - continue; - - if (ent->think) - { - ent->nextthink = level.time; - ent->think(ent); - } - - ent->monsterinfo.aiflags |= AI_IGNORE_SHOTS | AI_DO_NOT_COUNT | AI_SPAWNED_MEDIC_C; - ent->monsterinfo.commander = self; - ent->monsterinfo.monster_slots = reinforcement.strength; - self->monsterinfo.monster_used += reinforcement.strength; - - if (self->monsterinfo.aiflags & AI_MEDIC) - designated_enemy = self->oldenemy; - else - designated_enemy = self->enemy; - - if (coop->integer) - { - designated_enemy = PickCoopTarget(ent); - if (designated_enemy) - { - // try to avoid using my enemy - if (designated_enemy == self->enemy) - { - designated_enemy = PickCoopTarget(ent); - if (!designated_enemy) - designated_enemy = self->enemy; - } - } - else - designated_enemy = self->enemy; - } - - if ((designated_enemy) && (designated_enemy->inuse) && (designated_enemy->health > 0)) - { - ent->enemy = designated_enemy; - FoundTarget(ent); - } - else - { - ent->enemy = nullptr; - ent->monsterinfo.stand(ent); - } - } -} - -mframe_t medic_frames_callReinforcements[] = { - // ROGUE - 33-36 now ai_charge - { ai_charge, 2 }, // 33 - { ai_charge, 3 }, - { ai_charge, 5 }, - { ai_charge, 4.4f }, // 36 - { ai_charge, 4.7f }, - { ai_charge, 5 }, - { ai_charge, 6 }, - { ai_charge, 4 }, // 40 - { ai_charge, 0, monster_footstep }, - { ai_move, 0, medic_start_spawn }, // 42 - { ai_move }, // 43 -- 43 through 47 are skipped - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move }, - { ai_move, 0, medic_determine_spawn }, // 48 - { ai_charge, 0, medic_spawngrows }, // 49 - { ai_move }, // 50 - { ai_move }, // 51 - { ai_move, -15, medic_finish_spawn }, // 52 - { ai_move, -1.5f }, - { ai_move, -1.2f }, - { ai_move, -3, monster_footstep } -}; -MMOVE_T(medic_move_callReinforcements) = { FRAME_attack33, FRAME_attack55, medic_frames_callReinforcements, medic_run }; - -MONSTERINFO_ATTACK(medic_attack) (edict_t *self) -> void -{ - monster_done_dodge(self); - - float enemy_range = range_to(self, self->enemy); - - // signal from checkattack to spawn - if (self->monsterinfo.aiflags & AI_BLOCKED) - { - M_SetAnimation(self, &medic_move_callReinforcements); - self->monsterinfo.aiflags &= ~AI_BLOCKED; - } - - float r = frandom(); - if (self->monsterinfo.aiflags & AI_MEDIC) - { - if ((self->mass > 400) && (r > 0.8f) && M_SlotsLeft(self)) - M_SetAnimation(self, &medic_move_callReinforcements); - else - M_SetAnimation(self, &medic_move_attackCable); - } - else - { - if (self->monsterinfo.attack_state == AS_BLIND) - { - M_SetAnimation(self, &medic_move_callReinforcements); - return; - } - if ((self->mass > 400) && (r > 0.2f) && (enemy_range > RANGE_MELEE) && M_SlotsLeft(self)) - M_SetAnimation(self, &medic_move_callReinforcements); - else - M_SetAnimation(self, &medic_move_attackBlaster); - } -} - -MONSTERINFO_CHECKATTACK(medic_checkattack) (edict_t *self) -> bool -{ - if (self->monsterinfo.aiflags & AI_MEDIC) - { - // if our target went away - if ((!self->enemy) || (!self->enemy->inuse)) - { - abortHeal(self, true, false, false); - return false; - } - - // if we ran out of time, give up - if (self->timestamp < level.time) - { - abortHeal(self, true, false, true); - self->timestamp = 0_ms; - return false; - } - - if (realrange(self, self->enemy) < MEDIC_MAX_HEAL_DISTANCE + 10) - { - medic_attack(self); - return true; - } - else - { - self->monsterinfo.attack_state = AS_STRAIGHT; - return false; - } - } - - if (self->enemy->client && !visible(self, self->enemy) && M_SlotsLeft(self)) - { - self->monsterinfo.attack_state = AS_BLIND; - return true; - } - - // give a LARGE bias to spawning things when we have room - // use AI_BLOCKED as a signal to attack to spawn - if (self->monsterinfo.monster_slots && (frandom() < 0.8f) && (M_SlotsLeft(self) > self->monsterinfo.monster_slots * 0.8f) && (realrange(self, self->enemy) > 150)) - { - self->monsterinfo.aiflags |= AI_BLOCKED; - self->monsterinfo.attack_state = AS_MISSILE; - return true; - } - - // ROGUE - // since his idle animation looks kinda bad in combat, always attack - // when he's on a combat point - if (self->monsterinfo.aiflags & AI_STAND_GROUND) - { - self->monsterinfo.attack_state = AS_MISSILE; - return true; - } - - return M_CheckAttack(self); -} - -void MedicCommanderCache() -{ - gi.modelindex("models/items/spawngro3/tris.md2"); -} - -MONSTERINFO_DUCK(medic_duck) (edict_t *self, gtime_t eta) -> bool -{ - // don't dodge if you're healing - if (self->monsterinfo.aiflags & AI_MEDIC) - return false; - - if ((self->monsterinfo.active_move == &medic_move_attackHyperBlaster) || - (self->monsterinfo.active_move == &medic_move_attackCable) || - (self->monsterinfo.active_move == &medic_move_attackBlaster) || - (self->monsterinfo.active_move == &medic_move_callReinforcements)) - { - // he ignores skill - self->monsterinfo.unduck(self); - return false; - } - - M_SetAnimation(self, &medic_move_duck); - - return true; -} - -MONSTERINFO_SIDESTEP(medic_sidestep) (edict_t *self) -> bool -{ - if ((self->monsterinfo.active_move == &medic_move_attackHyperBlaster) || - (self->monsterinfo.active_move == &medic_move_attackCable) || - (self->monsterinfo.active_move == &medic_move_attackBlaster) || - (self->monsterinfo.active_move == &medic_move_callReinforcements)) - { - // if we're shooting, don't dodge - return false; - } - - if (self->monsterinfo.active_move != &medic_move_run) - M_SetAnimation(self, &medic_move_run); - - return true; -} - -//=========== -// PGM -MONSTERINFO_BLOCKED(medic_blocked) (edict_t *self, float dist) -> bool -{ - if (blocked_checkplat(self, dist)) - return true; - - return false; -} -// PGM -//=========== - -/*QUAKED monster_medic_commander (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight - */ -/*QUAKED monster_medic (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight -model="models/monsters/medic/tris.md2" -*/ -void SP_monster_medic(edict_t *self) -{ - if ( !M_AllowSpawn( self ) ) { - G_FreeEdict( self ); - return; - } - - self->movetype = MOVETYPE_STEP; - self->solid = SOLID_BBOX; - self->s.modelindex = gi.modelindex("models/monsters/medic/tris.md2"); - - gi.modelindex("models/monsters/medic/gibs/chest.md2"); - gi.modelindex("models/monsters/medic/gibs/gun.md2"); - gi.modelindex("models/monsters/medic/gibs/head.md2"); - gi.modelindex("models/monsters/medic/gibs/hook.md2"); - gi.modelindex("models/monsters/medic/gibs/leg.md2"); - - self->mins = { -24, -24, -24 }; - self->maxs = { 24, 24, 32 }; - - // PMM - if (strcmp(self->classname, "monster_medic_commander") == 0) - { - self->health = 600 * st.health_multiplier; - self->gib_health = -130; - self->mass = 600; - self->yaw_speed = 40; // default is 20 - MedicCommanderCache(); - } - else - { - // PMM - self->health = 300 * st.health_multiplier; - self->gib_health = -130; - self->mass = 400; - } - - self->pain = medic_pain; - self->die = medic_die; - - self->monsterinfo.stand = medic_stand; - self->monsterinfo.walk = medic_walk; - self->monsterinfo.run = medic_run; - // pmm - self->monsterinfo.dodge = M_MonsterDodge; - self->monsterinfo.duck = medic_duck; - self->monsterinfo.unduck = monster_duck_up; - self->monsterinfo.sidestep = medic_sidestep; - self->monsterinfo.blocked = medic_blocked; - // pmm - self->monsterinfo.attack = medic_attack; - self->monsterinfo.melee = nullptr; - self->monsterinfo.sight = medic_sight; - self->monsterinfo.idle = medic_idle; - self->monsterinfo.search = medic_search; - self->monsterinfo.checkattack = medic_checkattack; - self->monsterinfo.setskin = medic_setskin; - - gi.linkentity(self); - - M_SetAnimation(self, &medic_move_stand); - self->monsterinfo.scale = MODEL_SCALE; - - walkmonster_start(self); - - // PMM - self->monsterinfo.aiflags |= AI_IGNORE_SHOTS; - - if (self->mass > 400) - { - self->s.skinnum = 2; - - // commander sounds - commander_sound_idle1 = gi.soundindex("medic_commander/medidle.wav"); - commander_sound_pain1 = gi.soundindex("medic_commander/medpain1.wav"); - commander_sound_pain2 = gi.soundindex("medic_commander/medpain2.wav"); - commander_sound_die = gi.soundindex("medic_commander/meddeth.wav"); - commander_sound_sight = gi.soundindex("medic_commander/medsght.wav"); - commander_sound_search = gi.soundindex("medic_commander/medsrch.wav"); - commander_sound_hook_launch = gi.soundindex("medic_commander/medatck2c.wav"); - commander_sound_hook_hit = gi.soundindex("medic_commander/medatck3a.wav"); - commander_sound_hook_heal = gi.soundindex("medic_commander/medatck4a.wav"); - commander_sound_hook_retract = gi.soundindex("medic_commander/medatck5a.wav"); - commander_sound_spawn = gi.soundindex("medic_commander/monsterspawn1.wav"); - gi.soundindex("tank/tnkatck3.wav"); - - const char *reinforcements = default_reinforcements; - - if (!st.was_key_specified("monster_slots")) - self->monsterinfo.monster_slots = default_monster_slots_base; - if (st.was_key_specified("reinforcements")) - reinforcements = st.reinforcements; - - if (self->monsterinfo.monster_slots && reinforcements && *reinforcements) - { - if (skill->integer) - self->monsterinfo.monster_slots += floor(self->monsterinfo.monster_slots * (skill->value / 2.f)); - - M_SetupReinforcements(reinforcements, self->monsterinfo.reinforcements); - } - } - else - { - sound_idle1 = gi.soundindex("medic/idle.wav"); - sound_pain1 = gi.soundindex("medic/medpain1.wav"); - sound_pain2 = gi.soundindex("medic/medpain2.wav"); - sound_die = gi.soundindex("medic/meddeth1.wav"); - sound_sight = gi.soundindex("medic/medsght1.wav"); - sound_search = gi.soundindex("medic/medsrch1.wav"); - sound_hook_launch = gi.soundindex("medic/medatck2.wav"); - sound_hook_hit = gi.soundindex("medic/medatck3.wav"); - sound_hook_heal = gi.soundindex("medic/medatck4.wav"); - sound_hook_retract = gi.soundindex("medic/medatck5.wav"); - gi.soundindex("medic/medatck1.wav"); - - self->s.skinnum = 0; - } - // pmm -} diff --git a/actionlite/m_medic.h b/actionlite/m_medic.h deleted file mode 100644 index 388cd00..0000000 --- a/actionlite/m_medic.h +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright (c) ZeniMax Media Inc. -// Licensed under the GNU General Public License 2.0. -// G:\quake2\baseq2\models/monsters/medic - -// This file generated by ModelGen - Do NOT Modify - -enum -{ - FRAME_walk1, - FRAME_walk2, - FRAME_walk3, - FRAME_walk4, - FRAME_walk5, - FRAME_walk6, - FRAME_walk7, - FRAME_walk8, - FRAME_walk9, - FRAME_walk10, - FRAME_walk11, - FRAME_walk12, - FRAME_wait1, - FRAME_wait2, - FRAME_wait3, - FRAME_wait4, - FRAME_wait5, - FRAME_wait6, - FRAME_wait7, - FRAME_wait8, - FRAME_wait9, - FRAME_wait10, - FRAME_wait11, - FRAME_wait12, - FRAME_wait13, - FRAME_wait14, - FRAME_wait15, - FRAME_wait16, - FRAME_wait17, - FRAME_wait18, - FRAME_wait19, - FRAME_wait20, - FRAME_wait21, - FRAME_wait22, - FRAME_wait23, - FRAME_wait24, - FRAME_wait25, - FRAME_wait26, - FRAME_wait27, - FRAME_wait28, - FRAME_wait29, - FRAME_wait30, - FRAME_wait31, - FRAME_wait32, - FRAME_wait33, - FRAME_wait34, - FRAME_wait35, - FRAME_wait36, - FRAME_wait37, - FRAME_wait38, - FRAME_wait39, - FRAME_wait40, - FRAME_wait41, - FRAME_wait42, - FRAME_wait43, - FRAME_wait44, - FRAME_wait45, - FRAME_wait46, - FRAME_wait47, - FRAME_wait48, - FRAME_wait49, - FRAME_wait50, - FRAME_wait51, - FRAME_wait52, - FRAME_wait53, - FRAME_wait54, - FRAME_wait55, - FRAME_wait56, - FRAME_wait57, - FRAME_wait58, - FRAME_wait59, - FRAME_wait60, - FRAME_wait61, - FRAME_wait62, - FRAME_wait63, - FRAME_wait64, - FRAME_wait65, - FRAME_wait66, - FRAME_wait67, - FRAME_wait68, - FRAME_wait69, - FRAME_wait70, - FRAME_wait71, - FRAME_wait72, - FRAME_wait73, - FRAME_wait74, - FRAME_wait75, - FRAME_wait76, - FRAME_wait77, - FRAME_wait78, - FRAME_wait79, - FRAME_wait80, - FRAME_wait81, - FRAME_wait82, - FRAME_wait83, - FRAME_wait84, - FRAME_wait85, - FRAME_wait86, - FRAME_wait87, - FRAME_wait88, - FRAME_wait89, - FRAME_wait90, - FRAME_run1, - FRAME_run2, - FRAME_run3, - FRAME_run4, - FRAME_run5, - FRAME_run6, - FRAME_paina1, - FRAME_paina2, - FRAME_paina3, - FRAME_paina4, - FRAME_paina5, - FRAME_paina6, - FRAME_paina7, - FRAME_paina8, - FRAME_painb1, - FRAME_painb2, - FRAME_painb3, - FRAME_painb4, - FRAME_painb5, - FRAME_painb6, - FRAME_painb7, - FRAME_painb8, - FRAME_painb9, - FRAME_painb10, - FRAME_painb11, - FRAME_painb12, - FRAME_painb13, - FRAME_painb14, - FRAME_painb15, - FRAME_duck1, - FRAME_duck2, - FRAME_duck3, - FRAME_duck4, - FRAME_duck5, - FRAME_duck6, - FRAME_duck7, - FRAME_duck8, - FRAME_duck9, - FRAME_duck10, - FRAME_duck11, - FRAME_duck12, - FRAME_duck13, - FRAME_duck14, - FRAME_duck15, - FRAME_duck16, - FRAME_death1, - FRAME_death2, - FRAME_death3, - FRAME_death4, - FRAME_death5, - FRAME_death6, - FRAME_death7, - FRAME_death8, - FRAME_death9, - FRAME_death10, - FRAME_death11, - FRAME_death12, - FRAME_death13, - FRAME_death14, - FRAME_death15, - FRAME_death16, - FRAME_death17, - FRAME_death18, - FRAME_death19, - FRAME_death20, - FRAME_death21, - FRAME_death22, - FRAME_death23, - FRAME_death24, - FRAME_death25, - FRAME_death26, - FRAME_death27, - FRAME_death28, - FRAME_death29, - FRAME_death30, - FRAME_attack1, - FRAME_attack2, - FRAME_attack3, - FRAME_attack4, - FRAME_attack5, - FRAME_attack6, - FRAME_attack7, - FRAME_attack8, - FRAME_attack9, - FRAME_attack10, - FRAME_attack11, - FRAME_attack12, - FRAME_attack13, - FRAME_attack14, - FRAME_attack15, - FRAME_attack16, - FRAME_attack17, - FRAME_attack18, - FRAME_attack19, - FRAME_attack20, - FRAME_attack21, - FRAME_attack22, - FRAME_attack23, - FRAME_attack24, - FRAME_attack25, - FRAME_attack26, - FRAME_attack27, - FRAME_attack28, - FRAME_attack29, - FRAME_attack30, - FRAME_attack31, - FRAME_attack32, - FRAME_attack33, - FRAME_attack34, - FRAME_attack35, - FRAME_attack36, - FRAME_attack37, - FRAME_attack38, - FRAME_attack39, - FRAME_attack40, - FRAME_attack41, - FRAME_attack42, - FRAME_attack43, - FRAME_attack44, - FRAME_attack45, - FRAME_attack46, - FRAME_attack47, - FRAME_attack48, - FRAME_attack49, - FRAME_attack50, - FRAME_attack51, - FRAME_attack52, - FRAME_attack53, - FRAME_attack54, - FRAME_attack55, - FRAME_attack56, - FRAME_attack57, - FRAME_attack58, - FRAME_attack59, - FRAME_attack60 -}; - -constexpr float MODEL_SCALE = 1.000000f; diff --git a/actionlite/m_move.cpp b/actionlite/m_move.cpp index c36bd69..6299cbb 100644 --- a/actionlite/m_move.cpp +++ b/actionlite/m_move.cpp @@ -785,7 +785,7 @@ bool SV_movestep(edict_t *ent, vec3_t move, bool relink) { if ((!(ent->enemy)) || (!(ent->enemy->inuse))) { - TargetTesla(ent, new_bad->owner); + //TargetTesla(ent, new_bad->owner); ent->monsterinfo.aiflags |= AI_BLOCKED; } else if (!strcmp(ent->enemy->classname, "tesla_mine")) @@ -795,13 +795,13 @@ bool SV_movestep(edict_t *ent, vec3_t move, bool relink) { if (!visible(ent, ent->enemy)) { - TargetTesla(ent, new_bad->owner); + //TargetTesla(ent, new_bad->owner); ent->monsterinfo.aiflags |= AI_BLOCKED; } } else { - TargetTesla(ent, new_bad->owner); + //TargetTesla(ent, new_bad->owner); ent->monsterinfo.aiflags |= AI_BLOCKED; } } diff --git a/actionlite/rogue/g_rogue_newai.cpp b/actionlite/rogue/g_rogue_newai.cpp index c9df34c..cb6e191 100644 --- a/actionlite/rogue/g_rogue_newai.cpp +++ b/actionlite/rogue/g_rogue_newai.cpp @@ -93,7 +93,7 @@ bool blocked_checkplat(edict_t *self, float dist) inline void monster_jump_start(edict_t *self) { - monster_done_dodge(self); + //monster_done_dodge(self); self->monsterinfo.jump_time = level.time + 3_sec; } @@ -1400,7 +1400,7 @@ MONSTERINFO_DODGE(M_MonsterDodge) (edict_t *self, edict_t *attacker, gtime_t eta if (self->monsterinfo.next_duck_time > level.time) return; - monster_done_dodge(self); + //monster_done_dodge(self); if (self->monsterinfo.duck(self, eta)) { diff --git a/actionlite/rogue/m_rogue_stalker.cpp b/actionlite/rogue/m_rogue_stalker.cpp index 5a6a04a..979a436 100644 --- a/actionlite/rogue/m_rogue_stalker.cpp +++ b/actionlite/rogue/m_rogue_stalker.cpp @@ -716,7 +716,7 @@ mframe_t stalker_frames_dodge_run[] = { { ai_run, 13 }, { ai_run, 17 }, { ai_run, 21 }, - { ai_run, 18, monster_done_dodge } + { ai_run, 18 } }; MMOVE_T(stalker_move_dodge_run) = { FRAME_run01, FRAME_run04, stalker_frames_dodge_run, nullptr }; #endif