diff --git a/TR5Main/Game/effect.cpp b/TR5Main/Game/effect.cpp index bdd8e31a6..055456a70 100644 --- a/TR5Main/Game/effect.cpp +++ b/TR5Main/Game/effect.cpp @@ -18,6 +18,8 @@ #include "tr5_bats_emitter.h" #include "tr5_spider_emitter.h" #include "pickup.h" +#include "larafire.h" + using std::function; constexpr auto ITEM_RADIUS_YMAX = SECTOR(3); int wf = 256; @@ -42,8 +44,8 @@ function effect_routines[59] = ExplosionFX, lara_hands_free, puzzle, - void_effect, - void_effect, + draw_right_pistol, + draw_left_pistol, shoot_right_gun, shoot_left_gun, void_effect, @@ -145,6 +147,34 @@ void SetFog(ITEM_INFO* item)//39A44(<), 39F44(<) (F) FlipEffect = -1; } +void draw_left_pistol(ITEM_INFO* item) +{ + if (Lara.meshPtrs[LM_LHAND] == Objects[ID_LARA_SKIN].meshIndex + LM_LHAND) + { + Lara.meshPtrs[LM_LHAND] = Objects[WeaponObjectMesh(WEAPON_PISTOLS)].meshIndex + LM_LHAND; + Lara.holsterInfo.leftHolster = HOLSTER_SLOT::Empty; + } + else + { + Lara.meshPtrs[LM_LHAND] = Objects[ID_LARA_SKIN].meshIndex + LM_LHAND; + Lara.holsterInfo.leftHolster = HolsterSlotForWeapon(static_cast(WEAPON_PISTOLS)); + } +} + +void draw_right_pistol(ITEM_INFO* item) +{ + if (Lara.meshPtrs[LM_RHAND] == Objects[ID_LARA_SKIN].meshIndex + LM_RHAND) + { + Lara.meshPtrs[LM_RHAND] = Objects[WeaponObjectMesh(WEAPON_PISTOLS)].meshIndex + LM_RHAND; + Lara.holsterInfo.rightHolster = HOLSTER_SLOT::Empty; + } + else + { + Lara.meshPtrs[LM_RHAND] = Objects[ID_LARA_SKIN].meshIndex + LM_RHAND; + Lara.holsterInfo.rightHolster = HolsterSlotForWeapon(static_cast(WEAPON_PISTOLS)); + } +} + void shoot_left_gun(ITEM_INFO* item)//39A34(<), 39F34(<) (F) { Lara.leftArm.flash_gun = 3; diff --git a/TR5Main/Game/effect.h b/TR5Main/Game/effect.h index 3be58d0db..6f0932a26 100644 --- a/TR5Main/Game/effect.h +++ b/TR5Main/Game/effect.h @@ -54,4 +54,6 @@ void reset_hair(ITEM_INFO* item); void Richochet(PHD_3DPOS* pos); void DoLotsOfBlood(int x, int y, int z, int speed, short direction, short roomNumber, int count); void pickup(ITEM_INFO* item); -void puzzle(ITEM_INFO* item); \ No newline at end of file +void puzzle(ITEM_INFO* item); +void draw_right_pistol(ITEM_INFO* item); +void draw_left_pistol(ITEM_INFO* item); \ No newline at end of file diff --git a/TR5Main/Game/lara2gun.cpp b/TR5Main/Game/lara2gun.cpp index 868a5d49c..039757aa2 100644 --- a/TR5Main/Game/lara2gun.cpp +++ b/TR5Main/Game/lara2gun.cpp @@ -364,21 +364,19 @@ void undraw_pistol_mesh_left(int weaponType) //LARA_MESHES(ID_LARA, LM_LHAND); Lara.meshPtrs[LM_LHAND] = Objects[ID_LARA_SKIN].meshIndex + LM_LHAND; - Lara.holsterInfo.leftHoster = HolsterSlotForWeapon(static_cast(weaponType)); + Lara.holsterInfo.leftHolster = HolsterSlotForWeapon(static_cast(weaponType)); } } void draw_pistol_meshes(int weaponType) { if(static_cast(weaponType) != LARA_WEAPON_TYPE::WEAPON_REVOLVER){ - Lara.holsterInfo.leftHoster = HOLSTER_SLOT::Empty; + Lara.holsterInfo.leftHolster = HOLSTER_SLOT::Empty; } Lara.holsterInfo.rightHolster = HOLSTER_SLOT::Empty; - //LARA_MESHES(WeaponObjectMesh(weaponType), LM_RHAND); Lara.meshPtrs[LM_RHAND] = Objects[WeaponObjectMesh(weaponType)].meshIndex + LM_RHAND; if (static_cast(weaponType) != LARA_WEAPON_TYPE::WEAPON_REVOLVER) - //LARA_MESHES(WeaponObjectMesh(weaponType), LM_LHAND); Lara.meshPtrs[LM_LHAND] = Objects[WeaponObjectMesh(weaponType)].meshIndex + LM_LHAND; } diff --git a/TR5Main/Game/lara_struct.h b/TR5Main/Game/lara_struct.h index 4fe4718b5..4d63754d8 100644 --- a/TR5Main/Game/lara_struct.h +++ b/TR5Main/Game/lara_struct.h @@ -777,7 +777,7 @@ enum class HOLSTER_SLOT : int { }; struct HolsterInfo { - HOLSTER_SLOT leftHoster; + HOLSTER_SLOT leftHolster; HOLSTER_SLOT rightHolster; HOLSTER_SLOT backHolster; }; diff --git a/TR5Main/Game/laramisc.cpp b/TR5Main/Game/laramisc.cpp index 60688066b..a412e9330 100644 --- a/TR5Main/Game/laramisc.cpp +++ b/TR5Main/Game/laramisc.cpp @@ -803,7 +803,7 @@ void InitialiseLara(int restore) Lara.dpoisoned = 0; Lara.poisoned = 0; Lara.waterSurfaceDist = 100; - Lara.holsterInfo.leftHoster = HOLSTER_SLOT::Pistols; + Lara.holsterInfo.leftHolster = HOLSTER_SLOT::Pistols; Lara.holsterInfo.rightHolster = HOLSTER_SLOT::Pistols; Lara.location = -1; Lara.highestLocation = -1; diff --git a/TR5Main/Renderer/Renderer11Lara.cpp b/TR5Main/Renderer/Renderer11Lara.cpp index 64a36d2aa..f62bfdbb0 100644 --- a/TR5Main/Renderer/Renderer11Lara.cpp +++ b/TR5Main/Renderer/Renderer11Lara.cpp @@ -285,7 +285,7 @@ void Renderer11::drawLaraHolsters(bool transparent) { int firstBucket = (transparent ? 2 : 0); int lastBucket = (transparent ? 4 : 2); - HOLSTER_SLOT leftHolsterID = Lara.holsterInfo.leftHoster; + HOLSTER_SLOT leftHolsterID = Lara.holsterInfo.leftHolster; HOLSTER_SLOT rightHolsterID = Lara.holsterInfo.rightHolster; HOLSTER_SLOT backHolsterID = Lara.holsterInfo.backHolster;