gun/const: move gun constants to TRX
Some checks are pending
Run code linters / Run code linters (push) Waiting to run
Publish a pre-release / Build TR1 (push) Has been skipped
Publish a pre-release / Build TR2 (push) Has been skipped
Publish a pre-release / Create a prerelease (push) Has been skipped

This moves and combines gun constants into TRX.
This commit is contained in:
lahm86 2025-04-08 21:53:40 +01:00
parent bc31423029
commit d00c561a41
11 changed files with 52 additions and 46 deletions

View file

@ -1,3 +1,5 @@
#pragma once
#include "./gun/const.h"
void Gun_AddDynamicLight(void);

View file

@ -0,0 +1,39 @@
#pragma once
#define SHOTGUN_PELLET_SCATTER (DEG_1 * 20) // = 3640
#define GUN_AMMO_CLIP 16
#define GUN_AMMO_QTY (GUN_AMMO_CLIP * 2) // = 32
#define SHOTGUN_SHELL_COUNT 2
#define SHOTGUN_AMMO_CLIP 6
#define SHOTGUN_AMMO_QTY (SHOTGUN_AMMO_CLIP * SHOTGUN_SHELL_COUNT) // = 12
#if TR_VERSION == 1
#define MAGNUM_AMMO_CLIP 25
#define MAGNUM_AMMO_QTY (MAGNUM_AMMO_CLIP * 2) // = 50
#define UZI_AMMO_CLIP 50
#define UZI_AMMO_QTY (UZI_AMMO_CLIP * 2) // = 100
#elif TR_VERSION == 2
#define MAGNUM_AMMO_CLIP 20
#define MAGNUM_AMMO_QTY (MAGNUM_AMMO_CLIP * 2) // = 40
#define UZI_AMMO_CLIP 40
#define UZI_AMMO_QTY (UZI_AMMO_CLIP * 2) // = 80
#define M16_AMMO_CLIP 40
#define M16_AMMO_QTY M16_AMMO_CLIP // = 40
#define HARPOON_AMMO_CLIP 3
#define HARPOON_AMMO_QTY HARPOON_AMMO_CLIP // = 3
#define HARPOON_BOLT_SPEED 150
#define HARPOON_RECOIL 4
#define GRENADE_AMMO_CLIP 1
#define GRENADE_AMMO_QTY (GRENADE_AMMO_CLIP * 2) // = 2
#define GRENADE_SPEED 200
// TODO: Japanese version uses 8
#define FLARE_AMMO_QTY 6
#endif

View file

@ -255,9 +255,11 @@ void Gun_Rifle_Fire(const LARA_GUN_TYPE weapon_type)
for (int i = 0; i < SHOTGUN_AMMO_CLIP; i++) {
dangles[0] = angles[0]
+ (int)((Random_GetControl() - 16384) * PELLET_SCATTER) / 65536;
+ (int32_t)((Random_GetControl() - 16384) * SHOTGUN_PELLET_SCATTER)
/ 65536;
dangles[1] = angles[1]
+ (int)((Random_GetControl() - 16384) * PELLET_SCATTER) / 65536;
+ (int32_t)((Random_GetControl() - 16384) * SHOTGUN_PELLET_SCATTER)
/ 65536;
if (Gun_FireWeapon(weapon_type, g_Lara.target, g_LaraItem, dangles)) {
fired = true;
}

View file

@ -23,6 +23,7 @@
#include "global/vars.h"
#include <libtrx/config.h>
#include <libtrx/game/gun/const.h>
#include <libtrx/game/interpolation.h>
#include <libtrx/game/inventory_ring/priv.h>
#include <libtrx/memory.h>
@ -135,7 +136,7 @@ static void M_RingNotActive(const INVENTORY_ITEM *const inv_item)
break;
case O_SHOTGUN_AMMO_OPTION:
InvRing_ShowItemQuantity("%d", qty * NUM_SG_SHELLS);
InvRing_ShowItemQuantity("%d", qty * SHOTGUN_SHELL_COUNT);
break;
case O_MAGNUM_AMMO_OPTION:

View file

@ -17,6 +17,7 @@
#include "global/vars.h"
#include <libtrx/config.h>
#include <libtrx/game/gun/const.h>
#include <libtrx/game/matrix.h>
#include <libtrx/utils.h>

View file

@ -20,6 +20,7 @@
#include <libtrx/debug.h>
#include <libtrx/enum_map.h>
#include <libtrx/filesystem.h>
#include <libtrx/game/gun/const.h>
#include <libtrx/game/objects/traps/movable_block.h>
#include <libtrx/memory.h>
#include <libtrx/strings.h>

View file

@ -41,16 +41,6 @@
#define DAMAGE_START 140
#define DAMAGE_LENGTH 14
#define NO_CAMERA (-1)
#define PELLET_SCATTER (20 * DEG_1)
#define NUM_SG_SHELLS 2
#define GUN_AMMO_CLIP 16
#define MAGNUM_AMMO_CLIP 25
#define UZI_AMMO_CLIP 50
#define SHOTGUN_AMMO_CLIP 6
#define GUN_AMMO_QTY (GUN_AMMO_CLIP * 2)
#define MAGNUM_AMMO_QTY (MAGNUM_AMMO_CLIP * 2)
#define UZI_AMMO_QTY (UZI_AMMO_CLIP * 2)
#define SHOTGUN_AMMO_QTY (SHOTGUN_AMMO_CLIP * NUM_SG_SHELLS)
#define NUM_EFFECTS 1000
#define DEATH_WAIT (10 * LOGIC_FPS)
#define DEATH_WAIT_MIN (2 * LOGIC_FPS)

View file

@ -6,6 +6,7 @@
#include "game/stats.h"
#include "global/vars.h"
#include <libtrx/game/gun/const.h>
#include <libtrx/utils.h>
bool Inv_AddItem(const GAME_OBJECT_ID obj_id)

View file

@ -22,6 +22,7 @@
#include "global/vars.h"
#include <libtrx/config.h>
#include <libtrx/game/gun/const.h>
#include <libtrx/game/interpolation.h>
#include <libtrx/game/inventory_ring/priv.h>
#include <libtrx/game/matrix.h>

View file

@ -11,6 +11,7 @@
#include <libtrx/debug.h>
#include <libtrx/enum_map.h>
#include <libtrx/filesystem.h>
#include <libtrx/game/gun/const.h>
#include <libtrx/game/lara.h>
#include <libtrx/game/objects/traps/movable_block.h>
#include <libtrx/game/savegame.h>

View file

@ -157,38 +157,5 @@
#define MONK_FRIENDLY_FIRE_THRESHOLD 10
#define GUN_AMMO_CLIP 16
#define GUN_AMMO_QTY (GUN_AMMO_CLIP * 2) // = 32
#define MAGNUM_AMMO_CLIP 20
#define MAGNUM_AMMO_QTY (MAGNUM_AMMO_CLIP * 2) // = 40
#define UZI_AMMO_CLIP 40
#define UZI_AMMO_QTY (UZI_AMMO_CLIP * 2) // = 80
#define M16_AMMO_CLIP 40
#define M16_AMMO_QTY M16_AMMO_CLIP // = 40
#define SHOTGUN_SHELL_COUNT 2
#define SHOTGUN_AMMO_CLIP 6
#define SHOTGUN_AMMO_QTY (SHOTGUN_AMMO_CLIP * SHOTGUN_SHELL_COUNT) // = 12
#define SHOTGUN_PELLET_SCATTER (DEG_1 * 20) // = 3640
#define HARPOON_BOLT_SPEED 150
#define HARPOON_RECOIL 4
#define HARPOON_AMMO_CLIP 3
#define HARPOON_AMMO_QTY HARPOON_AMMO_CLIP // = 3
#define GRENADE_SPEED 200
#define GRENADE_AMMO_CLIP 1
#define GRENADE_AMMO_QTY (GRENADE_AMMO_CLIP * 2) // = 2
#if defined(PSX_VERSION) && defined(JAPAN)
#define FLARE_AMMO_BOX 8
#else
#define FLARE_AMMO_BOX 6
#endif
#define FLARE_AMMO_QTY FLARE_AMMO_BOX
#define LOW_LIGHT 5120
#define HIGH_LIGHT 4096