diff --git a/CHANGELOG.md b/CHANGELOG.md index 267b0e289..139516a24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## [Unreleased](https://github.com/LostArtefacts/TR1X/compare/stable...develop) - ××××-××-×× - fixed double "Fly mode enabled" message when using `/fly` console command (regression from 4.0) +- changed the easter egg console command to pack more punch ## [4.4](https://github.com/LostArtefacts/TR1X/compare/4.3-102-g458cd96...4.4) - 2024-09-20 - added `/exit` command (#1462) diff --git a/data/ship/cfg/TR1X_gameflow.json5 b/data/ship/cfg/TR1X_gameflow.json5 index 30554c14c..f15a86613 100644 --- a/data/ship/cfg/TR1X_gameflow.json5 +++ b/data/ship/cfg/TR1X_gameflow.json5 @@ -20,6 +20,7 @@ "data/injections/lara_jumping.bin", "data/injections/purple_crystal.bin", "data/injections/uzi_sfx.bin", + "data/injections/explosion.bin", ], "convert_dropped_guns": false, @@ -38,6 +39,7 @@ "data/injections/lara_animations.bin", "data/injections/lara_jumping.bin", "data/injections/uzi_sfx.bin", + "data/injections/explosion.bin", ], "sequence": [ {"type": "play_fmv", "fmv_path": "fmv/mansion.avi"}, diff --git a/data/ship/data/injections/explosion.bin b/data/ship/data/injections/explosion.bin new file mode 100644 index 000000000..79be67718 Binary files /dev/null and b/data/ship/data/injections/explosion.bin differ diff --git a/src/game/effects/exploding_death.h b/src/game/effects/exploding_death.h index b592e7381..efce82520 100644 --- a/src/game/effects/exploding_death.h +++ b/src/game/effects/exploding_death.h @@ -2,5 +2,10 @@ #include +// Mesh_bits: which meshes to affect. +// Damage: +// * Positive values - deal damage, enable body part explosions. +// * Negative values - deal damage, disable body part explosions. +// * Zero - don't deal any damage, disable body part explosions. int32_t Effect_ExplodingDeath( int16_t item_num, int32_t mesh_bits, int16_t damage); diff --git a/src/game/level.c b/src/game/level.c index 703168139..39e1de4cb 100644 --- a/src/game/level.c +++ b/src/game/level.c @@ -12,6 +12,7 @@ #include "game/lara/common.h" #include "game/lot.h" #include "game/music.h" +#include "game/objects/creatures/mutant.h" #include "game/objects/creatures/pierre.h" #include "game/objects/setup.h" #include "game/output.h" @@ -919,6 +920,11 @@ static void M_CompleteSetup(int32_t level_num) } } + // We inject explosions sprites and sounds, although in the original game, + // some levels lack them, resulting in no audio or visual effects when + // killing mutants. This is to maintain that feature. + Mutant_ToggleExplosions(g_Objects[O_EXPLOSION_1].loaded); + Inject_AllInjections(&m_LevelInfo); M_MarkWaterEdgeVertices(); diff --git a/src/game/objects/creatures/mutant.c b/src/game/objects/creatures/mutant.c index 40aab6ffa..95cc152e9 100644 --- a/src/game/objects/creatures/mutant.c +++ b/src/game/objects/creatures/mutant.c @@ -56,10 +56,16 @@ enum FLYER_ANIM { FLYER_FLY = 13, }; +static bool m_EnableExplosions = true; static BITE_INFO m_WarriorBite = { -27, 98, 0, 10 }; static BITE_INFO m_WarriorRocket = { 51, 213, 0, 14 }; static BITE_INFO m_WarriorShard = { -35, 269, 0, 9 }; +void Mutant_ToggleExplosions(bool enable) +{ + m_EnableExplosions = enable; +} + void Mutant_Setup(OBJECT_INFO *obj) { if (!obj->loaded) { @@ -117,7 +123,9 @@ void Mutant_FlyerControl(int16_t item_num) int16_t angle = 0; if (item->hit_points <= 0) { - if (Effect_ExplodingDeath(item_num, -1, FLYER_PART_DAMAGE)) { + if (Effect_ExplodingDeath( + item_num, -1, + m_EnableExplosions ? FLYER_SMARTNESS : -FLYER_PART_DAMAGE)) { Sound_Effect(SFX_ATLANTEAN_DEATH, &item->pos, SPM_NORMAL); LOT_DisableBaddieAI(item_num); Item_Kill(item_num); diff --git a/src/game/objects/creatures/mutant.h b/src/game/objects/creatures/mutant.h index 9ec69a557..19f14e03c 100644 --- a/src/game/objects/creatures/mutant.h +++ b/src/game/objects/creatures/mutant.h @@ -6,6 +6,7 @@ void Mutant_Setup(OBJECT_INFO *obj); void Mutant_Setup2(OBJECT_INFO *obj); void Mutant_Setup3(OBJECT_INFO *obj); +void Mutant_ToggleExplosions(bool enable); void Mutant_FlyerControl(int16_t item_num); void Mutant_Initialise2(int16_t item_num); diff --git a/src/game/objects/effects/body_part.c b/src/game/objects/effects/body_part.c index 98b924786..fc4596510 100644 --- a/src/game/objects/effects/body_part.c +++ b/src/game/objects/effects/body_part.c @@ -39,7 +39,7 @@ void BodyPart_Control(int16_t fx_num) const int32_t height = Room_GetHeight(sector, fx->pos.x, fx->pos.y, fx->pos.z); if (fx->pos.y >= height) { - if (fx->counter) { + if (fx->counter > 0) { fx->speed = 0; fx->frame_num = 0; fx->counter = 0; @@ -51,10 +51,10 @@ void BodyPart_Control(int16_t fx_num) return; } - if (Lara_IsNearItem(&fx->pos, fx->counter * 2)) { - Lara_TakeDamage(fx->counter, true); + if (Lara_IsNearItem(&fx->pos, ABS(fx->counter) * 2)) { + Lara_TakeDamage(ABS(fx->counter), true); - if (fx->counter) { + if (fx->counter > 0) { fx->speed = 0; fx->frame_num = 0; fx->counter = 0;