Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
gun: fix M16 accuracy while running
Browse files Browse the repository at this point in the history
Resolves #45.
  • Loading branch information
rr- committed Aug 25, 2024
1 parent ff4ec67 commit daf81e9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## [Unreleased](https://github.com/LostArtefacts/TR2X/compare/stable...develop) - ××××-××-××
- added an option to fix M16 accuracy while running (#45)
- fixed sounds not playing under certain circumstances (#113, regression from 0.2)
- fixed the excessive pitch and playback speed correction for music files with sampling rate other than 44100 Hz (LostArtefacts/TR1X#1417)
- fixed a crash potential with certain music files
- fixed the excessive pitch and playback speed correction for music files with sampling rate other than 44100 Hz (LostArtefacts/TR1X#1417, regression from 0.2)
- fixed a crash potential with certain music files (regression from 0.2)
- fixed enemy movement patterns in demo 1 and demo 3 (#98, regression from 0.1)
- fixed underwater creatures dying (#98, regression from 0.1)
- fixed a crash when spawning enemy drops (#125, regression from 0.1)
Expand Down
4 changes: 4 additions & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

typedef struct {
bool loaded;

struct {
bool fix_m16_accuracy;
} gameplay;
} CONFIG;

extern CONFIG g_Config;
Expand Down
1 change: 1 addition & 0 deletions src/config_map.def
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CFG_BOOL(g_Config, gameplay.fix_m16_accuracy, true)
15 changes: 9 additions & 6 deletions src/game/gun/gun_rifle.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "game/gun/gun_rifle.h"

#include "config.h"
#include "game/gun/gun.h"
#include "game/gun/gun_misc.h"
#include "game/math.h"
Expand Down Expand Up @@ -111,12 +112,14 @@ void __cdecl Gun_Rifle_FireM16(const bool running)
angles[0] = g_Lara.left_arm.rot.y + g_LaraItem->rot.y;
angles[1] = g_Lara.left_arm.rot.x;

if (running) {
g_Weapons[O_LARA_M16].shot_accuracy = PHD_DEGREE * 12;
g_Weapons[O_LARA_M16].damage = 1;
} else {
g_Weapons[O_LARA_M16].shot_accuracy = PHD_DEGREE * 4;
g_Weapons[O_LARA_M16].damage = 3;
if (g_Config.gameplay.fix_m16_accuracy) {
if (running) {
g_Weapons[LGT_M16].shot_accuracy = PHD_DEGREE * 12;
g_Weapons[LGT_M16].damage = 1;
} else {
g_Weapons[LGT_M16].shot_accuracy = PHD_DEGREE * 4;
g_Weapons[LGT_M16].damage = 3;
}
}

if (Gun_FireWeapon(LGT_M16, g_Lara.target, g_LaraItem, angles)) {
Expand Down

0 comments on commit daf81e9

Please sign in to comment.