Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inventory: reset selected item on closing inventory #1882

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/tr1/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- added a special target, "pickup", to item-based console commands
- added support for custom levels to enforce values for any config setting (#1846)
- added support for key/puzzle/pickup descriptions, allowing players to examine said items in the inventory (#1821)
- added an option to fix inventory item usage duplication (#1586)
- changed OpenGL backend to use version 3.3, with fallback to 2.1 if initialization fails (#1738)
- changed text backend to accept named sequences. Currently supported sequences (limited by the sprites available in OG):
- `\{umlaut}`
Expand Down
1 change: 1 addition & 0 deletions docs/tr2/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [Unreleased](https://github.com/LostArtefacts/TRX/compare/tr2-0.6...develop) - ××××-××-××
- added support for custom levels to enforce values for any config setting (#1846)
- added an option to fix inventory item usage duplication (#1586)
- fixed depth problems when drawing certain rooms (#1853, regression from 0.6)
- fixed Lara getting stuck in her hit animation if she is hit while mounting the boat or skidoo (#1606)
- fixed being unable to go from surface swimming to underwater swimming without first stopping (#1863, regression from 0.6)
Expand Down
1 change: 1 addition & 0 deletions src/tr1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ typedef struct {
bool fix_wall_jump_glitch;
bool fix_bridge_collision;
bool fix_qwop_glitch;
bool fix_item_duplication_glitch;
bool fix_alligator_ai;
bool change_pierre_spawn;
bool fix_bear_ai;
Expand Down
1 change: 1 addition & 0 deletions src/tr1/config_map.def
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ CFG_BOOL(g_Config, fix_descending_glitch, false)
CFG_BOOL(g_Config, fix_wall_jump_glitch, false)
CFG_BOOL(g_Config, fix_bridge_collision, true)
CFG_BOOL(g_Config, fix_qwop_glitch, false)
CFG_BOOL(g_Config, fix_item_duplication_glitch, false)
CFG_BOOL(g_Config, fix_alligator_ai, true)
CFG_BOOL(g_Config, change_pierre_spawn, true)
CFG_BOOL(g_Config, fix_bear_ai, true)
Expand Down
1 change: 1 addition & 0 deletions src/tr1/game/inventory.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ void Inv_AddItemNTimes(GAME_OBJECT_ID object_id, int32_t qty);
void Inv_InsertItem(INVENTORY_ITEM *inv_item);
int32_t Inv_RequestItem(GAME_OBJECT_ID object_id);
void Inv_RemoveAllItems(void);
void Inv_ClearSelection(void);
bool Inv_RemoveItem(GAME_OBJECT_ID object_id);
GAME_OBJECT_ID Inv_GetItemOption(GAME_OBJECT_ID object_id);
8 changes: 6 additions & 2 deletions src/tr1/game/inventory/inventory_func.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,13 @@ int32_t Inv_RequestItem(const GAME_OBJECT_ID object_id)
void Inv_RemoveAllItems(void)
{
g_InvMainObjects = 1;
g_InvMainCurrent = 0;

g_InvKeysObjects = 0;
Inv_ClearSelection();
}

void Inv_ClearSelection(void)
{
g_InvMainCurrent = 0;
g_InvKeysCurrent = 0;
}

Expand Down
4 changes: 4 additions & 0 deletions src/tr1/game/phase/phase_inventory.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ static void Inv_Destroy(void)
Inv_Ring_RemoveAllText();
m_InvChosen = NO_OBJECT;

if (g_Config.fix_item_duplication_glitch) {
Inv_ClearSelection();
}

if (m_VersionText) {
Text_Remove(m_VersionText);
m_VersionText = NULL;
Expand Down
1 change: 1 addition & 0 deletions src/tr2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ typedef struct {
struct {
bool fix_m16_accuracy;
bool enable_cheats;
bool fix_item_duplication_glitch;
} gameplay;

struct {
Expand Down
1 change: 1 addition & 0 deletions src/tr2/config_map.def
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CFG_BOOL(g_Config, gameplay.fix_m16_accuracy, true)
CFG_BOOL(g_Config, gameplay.enable_cheats, false)
CFG_BOOL(g_Config, gameplay.fix_item_duplication_glitch, false)
CFG_BOOL(g_Config, visuals.enable_3d_pickups, true)
CFG_ENUM(g_Config, rendering.screenshot_format, SCREENSHOT_FORMAT_JPEG, SCREENSHOT_FORMAT)
CFG_INT32(g_Config, rendering.turbo_speed, 0)
Expand Down
7 changes: 6 additions & 1 deletion src/tr2/game/inventory/backpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,13 @@ int32_t __cdecl Inv_RequestItem(const GAME_OBJECT_ID object_id)
void __cdecl Inv_RemoveAllItems(void)
{
g_Inv_MainObjectsCount = 0;
g_Inv_MainCurrent = 0;
g_Inv_KeyObjectsCount = 0;
Inv_ClearSelection();
}

void Inv_ClearSelection(void)
{
g_Inv_MainCurrent = 0;
g_Inv_KeysCurrent = 0;
}

Expand Down
1 change: 1 addition & 0 deletions src/tr2/game/inventory/backpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ int32_t __cdecl Inv_AddItem(GAME_OBJECT_ID object_id);
void Inv_AddItemNTimes(GAME_OBJECT_ID object_id, int32_t qty);
int32_t __cdecl Inv_RequestItem(GAME_OBJECT_ID object_id);
void __cdecl Inv_RemoveAllItems(void);
void Inv_ClearSelection(void);
int32_t __cdecl Inv_RemoveItem(GAME_OBJECT_ID object_id);
6 changes: 6 additions & 0 deletions src/tr2/game/inventory/common.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "game/inventory/common.h"

#include "config.h"
#include "decomp/decomp.h"
#include "game/clock.h"
#include "game/console/common.h"
Expand Down Expand Up @@ -810,6 +811,11 @@ int32_t __cdecl Inv_Display(int32_t inventory_mode)
if (inventory_mode != INV_TITLE_MODE) {
Music_Unpause();
}

if (g_Config.gameplay.fix_item_duplication_glitch) {
Inv_ClearSelection();
}

return 0;
}

Expand Down
4 changes: 4 additions & 0 deletions tools/tr1/config/TR1X_ConfigTool/Resources/Lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@
"Title": "Fix QWOP glitch",
"Description": "Fixes Lara jumping on small steps sometimes resulting in a weird running animation, known as a QWOP state."
},
"fix_item_duplication_glitch": {
"Title": "Fix item duplication glitch",
"Description": "Fixes the ability to duplicate usage of key items in the inventory."
},
"fix_tihocan_secret_sound": {
"Title": "Fix Tomb of Tihocan secret sound",
"Description": "Prevents the secret sound from incorrectly playing when using the golden key in Tomb of Tihocan."
Expand Down
4 changes: 4 additions & 0 deletions tools/tr1/config/TR1X_ConfigTool/Resources/Lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@
"Title": "Arreglar fallo de QWOP",
"Description": "Corrige que Lara salte en pequeños pasos, lo que a veces resulta en una animación extraña de carrera, conocida como estado QWOP."
},
"fix_item_duplication_glitch": {
"Title": "Arreglar fallo de duplicación de elementos",
"Description": "Corrige la capacidad de duplicar el uso de elementos clave en el inventario."
},
"fix_secrets_killing_music": {
"Title": "Evitar detener la música en recogidas de secretos",
"Description": "Corrige el sonido de recoger un secreto que detiene la pista de música activa."
Expand Down
4 changes: 4 additions & 0 deletions tools/tr1/config/TR1X_ConfigTool/Resources/Lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@
"Title": "Correction du glitch QWOP",
"Description": "Corrige le saut de Lara sur de petites étapes, entraînant parfois une animation de course étrange, connu sous le nom du glitch QWOP."
},
"fix_item_duplication_glitch": {
"Title": "Correction du glitch de duplication d'élément",
"Description": "Corrige la possibilité de dupliquer l'utilisation d'éléments clés dans l'inventaire."
},
"fix_tihocan_secret_sound": {
"Title": "Correction du son du secret dans le niveau de la tombe de Tihocan",
"Description": "Corrige le fait que le son du secret se joue de manière incorrecte lors de l'utilisation de la clé dorée dans le niveau de la tombe de Tihocan."
Expand Down
4 changes: 4 additions & 0 deletions tools/tr1/config/TR1X_ConfigTool/Resources/Lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@
"Title": "Correggi il glitch QWOP",
"Description": "Risolve il problema per cui a volte Lara, saltando da piccoli gradini, provoca una strana animazione di corsa nota come stato QWOP."
},
"fix_item_duplication_glitch": {
"Title": "Correggi il glitch duplicazione degli oggetti",
"Description": "Risolto il problema con la possibilità di duplicare l'utilizzo degli elementi chiave nell'inventario."
},
"fix_tihocan_secret_sound": {
"Title": "Correggi il suono dei segreti nella Tomba di Tihocan",
"Description": "Impedisce la riproduzione errata del suono dei segreti quando si utilizza la chiave dorata nella Tomba di Tihocan."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@
"DataType": "Bool",
"DefaultValue": false
},
{
"Field": "fix_item_duplication_glitch",
"DataType": "Bool",
"DefaultValue": false
},
{
"Field": "fix_tihocan_secret_sound",
"DataType": "Bool",
Expand Down
4 changes: 4 additions & 0 deletions tools/tr2/config/TR2X_ConfigTool/Resources/Lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
"Title": "Fix M16 accuracy",
"Description": "Fixes the accuracy of the M16 while Lara is running."
},
"fix_item_duplication_glitch": {
"Title": "Fix item duplication glitch",
"Description": "Fixes the ability to duplicate usage of key items in the inventory."
},
"screenshot_format": {
"Title": "Screenshot format",
"Description": "Screenshot file format."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
"Field": "fix_m16_accuracy",
"DataType": "Bool",
"DefaultValue": true
},
{
"Field": "fix_item_duplication_glitch",
"DataType": "Bool",
"DefaultValue": false
}
]
},
Expand Down