diff --git a/README.md b/README.md
index de0fd561a..0fdb08499 100644
--- a/README.md
+++ b/README.md
@@ -33,6 +33,7 @@ Currently the following configuration options are supported:
etc. (similar to TR2 style).
- `enable_enhanced_ui`: enables UI scaling of in-game inventory text and ammo
text (useful for 4k screens).
+- `enable_shotgun_flash`: draws flame when firing a shotgun, like for other guns.
- `enable_numeric_keys`: enables quick weapon draws and medpack usage.
- 1: draw pistols
- 2: draw shotgun
diff --git a/Tomb1Main.json b/Tomb1Main.json
index 4ae8f1ee8..8cfff0622 100644
--- a/Tomb1Main.json
+++ b/Tomb1Main.json
@@ -8,6 +8,7 @@
"enable_enemy_healthbar": true,
"enable_enhanced_look": true,
"enable_enhanced_ui": true,
+ "enable_shotgun_flash": true,
"enable_numeric_keys": true,
"healthbar_showing_mode": "flashing",
"fix_end_of_level_freeze": true,
diff --git a/src/game/draw.c b/src/game/draw.c
index ea5c549ba..d673679d0 100644
--- a/src/game/draw.c
+++ b/src/game/draw.c
@@ -7,6 +7,7 @@
#include "game/health.h"
#include "specific/game.h"
#include "specific/output.h"
+#include "mod.h"
#include "util.h"
int32_t __cdecl DrawPhaseCinematic()
@@ -656,18 +657,7 @@ void __cdecl DrawLara(ITEM_INFO* item)
phd_PutPolygons(Lara.mesh_ptrs[LM_HAND_R], clip);
if (Lara.right_arm.flash_gun) {
- saved_matrix._00 = PhdMatrixPtr->_00;
- saved_matrix._01 = PhdMatrixPtr->_01;
- saved_matrix._02 = PhdMatrixPtr->_02;
- saved_matrix._03 = PhdMatrixPtr->_03;
- saved_matrix._10 = PhdMatrixPtr->_10;
- saved_matrix._11 = PhdMatrixPtr->_11;
- saved_matrix._12 = PhdMatrixPtr->_12;
- saved_matrix._13 = PhdMatrixPtr->_13;
- saved_matrix._20 = PhdMatrixPtr->_20;
- saved_matrix._21 = PhdMatrixPtr->_21;
- saved_matrix._22 = PhdMatrixPtr->_22;
- saved_matrix._23 = PhdMatrixPtr->_23;
+ saved_matrix = *PhdMatrixPtr;
}
phd_PopMatrix();
@@ -705,18 +695,7 @@ void __cdecl DrawLara(ITEM_INFO* item)
DrawGunFlash(fire_arms, clip);
}
if (Lara.right_arm.flash_gun) {
- PhdMatrixPtr->_00 = saved_matrix._00;
- PhdMatrixPtr->_01 = saved_matrix._01;
- PhdMatrixPtr->_02 = saved_matrix._02;
- PhdMatrixPtr->_03 = saved_matrix._03;
- PhdMatrixPtr->_10 = saved_matrix._10;
- PhdMatrixPtr->_11 = saved_matrix._11;
- PhdMatrixPtr->_12 = saved_matrix._12;
- PhdMatrixPtr->_13 = saved_matrix._13;
- PhdMatrixPtr->_20 = saved_matrix._20;
- PhdMatrixPtr->_21 = saved_matrix._21;
- PhdMatrixPtr->_22 = saved_matrix._22;
- PhdMatrixPtr->_23 = saved_matrix._23;
+ *PhdMatrixPtr = saved_matrix;
DrawGunFlash(fire_arms, clip);
}
@@ -740,6 +719,10 @@ void __cdecl DrawLara(ITEM_INFO* item)
phd_RotYXZpack(packed_rotation[LM_HAND_R]);
phd_PutPolygons(Lara.mesh_ptrs[LM_HAND_R], clip);
+ if (Tomb1MConfig.enable_shotgun_flash && Lara.right_arm.flash_gun) {
+ saved_matrix = *PhdMatrixPtr;
+ }
+
phd_PopMatrix();
phd_PushMatrix();
@@ -758,6 +741,11 @@ void __cdecl DrawLara(ITEM_INFO* item)
phd_RotYXZpack(packed_rotation[LM_HAND_L]);
phd_PutPolygons(Lara.mesh_ptrs[LM_HAND_L], clip);
+ if (Tomb1MConfig.enable_shotgun_flash && Lara.right_arm.flash_gun) {
+ *PhdMatrixPtr = saved_matrix;
+ DrawGunFlash(fire_arms, clip);
+ }
+
phd_PopMatrix();
break;
}
@@ -772,27 +760,37 @@ void __cdecl DrawLara(ITEM_INFO* item)
void __cdecl DrawGunFlash(int32_t weapon_type, int32_t clip)
{
- int light;
- int g_len;
+ int32_t light;
+ int32_t len;
+ int32_t off;
switch (weapon_type) {
case LGT_MAGNUMS:
light = 16 * 256;
- g_len = 155;
+ len = 155;
+ off = 55;
break;
case LGT_UZIS:
light = 10 * 256;
- g_len = 180;
+ len = 180;
+ off = 55;
break;
default:
light = 20 * 256;
- g_len = 155;
+ len = 155;
+ off = 55;
break;
}
- phd_TranslateRel(0, g_len, 55);
+ if (Tomb1MConfig.enable_shotgun_flash && weapon_type == LGT_SHOTGUN) {
+ light = 10 * 256;
+ len = 285;
+ off = 0;
+ }
+
+ phd_TranslateRel(0, len, off);
phd_RotYXZ(0, -90 * ONE_DEGREE, (PHD_ANGLE)(GetRandomDraw() * 2));
S_CalculateStaticLight(light);
phd_PutPolygons(Meshes[Objects[O_GUN_FLASH].mesh_index], clip);
@@ -980,18 +978,7 @@ void __cdecl DrawLaraInt(
phd_PutPolygons(Lara.mesh_ptrs[LM_HAND_R], clip);
if (Lara.right_arm.flash_gun) {
- saved_matrix._00 = PhdMatrixPtr->_00;
- saved_matrix._01 = PhdMatrixPtr->_01;
- saved_matrix._02 = PhdMatrixPtr->_02;
- saved_matrix._03 = PhdMatrixPtr->_03;
- saved_matrix._10 = PhdMatrixPtr->_10;
- saved_matrix._11 = PhdMatrixPtr->_11;
- saved_matrix._12 = PhdMatrixPtr->_12;
- saved_matrix._13 = PhdMatrixPtr->_13;
- saved_matrix._20 = PhdMatrixPtr->_20;
- saved_matrix._21 = PhdMatrixPtr->_21;
- saved_matrix._22 = PhdMatrixPtr->_22;
- saved_matrix._23 = PhdMatrixPtr->_23;
+ saved_matrix = *PhdMatrixPtr;
}
phd_PopMatrix_I();
@@ -1021,18 +1008,7 @@ void __cdecl DrawLaraInt(
}
if (Lara.right_arm.flash_gun) {
- PhdMatrixPtr->_00 = saved_matrix._00;
- PhdMatrixPtr->_01 = saved_matrix._01;
- PhdMatrixPtr->_02 = saved_matrix._02;
- PhdMatrixPtr->_03 = saved_matrix._03;
- PhdMatrixPtr->_10 = saved_matrix._10;
- PhdMatrixPtr->_11 = saved_matrix._11;
- PhdMatrixPtr->_12 = saved_matrix._12;
- PhdMatrixPtr->_13 = saved_matrix._13;
- PhdMatrixPtr->_20 = saved_matrix._20;
- PhdMatrixPtr->_21 = saved_matrix._21;
- PhdMatrixPtr->_22 = saved_matrix._22;
- PhdMatrixPtr->_23 = saved_matrix._23;
+ *PhdMatrixPtr = saved_matrix;
DrawGunFlash(fire_arms, clip);
}
@@ -1057,6 +1033,10 @@ void __cdecl DrawLaraInt(
phd_RotYXZpack(packed_rotation1[LM_HAND_R]);
phd_PutPolygons(Lara.mesh_ptrs[LM_HAND_R], clip);
+ if (Tomb1MConfig.enable_shotgun_flash && Lara.right_arm.flash_gun) {
+ saved_matrix = *PhdMatrixPtr;
+ }
+
phd_PopMatrix();
phd_PushMatrix();
@@ -1075,6 +1055,11 @@ void __cdecl DrawLaraInt(
phd_RotYXZpack(packed_rotation1[LM_HAND_L]);
phd_PutPolygons(Lara.mesh_ptrs[LM_HAND_L], clip);
+ if (Tomb1MConfig.enable_shotgun_flash && Lara.right_arm.flash_gun) {
+ *PhdMatrixPtr = saved_matrix;
+ DrawGunFlash(fire_arms, clip);
+ }
+
phd_PopMatrix_I();
break;
}
diff --git a/src/game/lara1gun.c b/src/game/lara1gun.c
index 955728c7e..87b9a2fef 100644
--- a/src/game/lara1gun.c
+++ b/src/game/lara1gun.c
@@ -3,6 +3,7 @@
#include "game/lara.h"
#include "specific/game.h"
#include "specific/input.h"
+#include "mod.h"
void __cdecl RifleHandler(int32_t weapon_type)
{
@@ -118,6 +119,9 @@ void __cdecl FireShotgun()
}
}
if (fired) {
+ if (Tomb1MConfig.enable_shotgun_flash) {
+ Lara.right_arm.flash_gun = Weapons[LGT_SHOTGUN].flash_time;
+ }
SoundEffect(Weapons[LGT_SHOTGUN].sample_num, &LaraItem->pos, 0);
}
}
diff --git a/src/main.c b/src/main.c
index 4be7051ef..f684e25ce 100644
--- a/src/main.c
+++ b/src/main.c
@@ -85,6 +85,8 @@ static int Tomb1MReadConfig()
tr1m_json_get_boolean_value(json, "enable_enhanced_look");
Tomb1MConfig.enable_enhanced_ui =
tr1m_json_get_boolean_value(json, "enable_enhanced_ui");
+ Tomb1MConfig.enable_shotgun_flash =
+ tr1m_json_get_boolean_value(json, "enable_shotgun_flash");
const char* healthbar_showing_mode =
tr1m_json_get_string_value(json, "healthbar_showing_mode");
diff --git a/src/mod.h b/src/mod.h
index bee440c69..66cb7d43e 100644
--- a/src/mod.h
+++ b/src/mod.h
@@ -17,19 +17,20 @@ typedef enum {
} Tomb1M_BAR_SHOW_MODE;
struct {
- int disable_healing_between_levels;
- int disable_medpacks;
- int disable_magnums;
- int disable_uzis;
- int disable_shotgun;
- int enable_red_healthbar;
- int enable_enemy_healthbar;
- int enable_enhanced_look;
- int enable_enhanced_ui;
- int enable_numeric_keys;
- int healthbar_showing_mode;
- int fix_end_of_level_freeze;
- int fix_tihocan_secret_sound;
+ int8_t disable_healing_between_levels;
+ int8_t disable_medpacks;
+ int8_t disable_magnums;
+ int8_t disable_uzis;
+ int8_t disable_shotgun;
+ int8_t enable_red_healthbar;
+ int8_t enable_enemy_healthbar;
+ int8_t enable_enhanced_look;
+ int8_t enable_enhanced_ui;
+ int8_t enable_numeric_keys;
+ int8_t enable_shotgun_flash;
+ int8_t healthbar_showing_mode;
+ int8_t fix_end_of_level_freeze;
+ int8_t fix_tihocan_secret_sound;
} Tomb1MConfig;
struct {