mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 20:58:07 +03:00
parent
936cd4a8fa
commit
f0a6fbd630
21 changed files with 139 additions and 64 deletions
|
@ -4,6 +4,7 @@
|
|||
- fixed cameras with glide values sometimes moving in the wrong direction (#1451, regression from 4.3)
|
||||
- fixed `/give` console command giving duplicate items under some circumstances (#1463, regression from 3.0)
|
||||
- fixed `/give` console command confusing logging around mismatched items (#1463, regression from 3.0)
|
||||
- fixed console commands causing improper ring shutdown with selected inventory item (#1460, regression from 3.0)
|
||||
- improved logs module names readability
|
||||
- improved crash debug information on Windows
|
||||
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
#include "config_map.h"
|
||||
#include "game/input.h"
|
||||
#include "game/music.h"
|
||||
#include "game/requester.h"
|
||||
#include "game/sound.h"
|
||||
#include "global/const.h"
|
||||
#include "global/enum_str.h"
|
||||
#include "global/types.h"
|
||||
#include "global/vars.h"
|
||||
|
||||
#include <libtrx/config/config_file.h>
|
||||
#include <libtrx/filesystem.h>
|
||||
|
@ -293,6 +295,8 @@ bool Config_Read(void)
|
|||
Input_CheckConflicts(CM_CONTROLLER, g_Config.input.cntlr_layout);
|
||||
Music_SetVolume(g_Config.music_volume);
|
||||
Sound_SetMasterVolume(g_Config.sound_volume);
|
||||
Requester_Shutdown(&g_SavegameRequester);
|
||||
Requester_Init(&g_SavegameRequester, g_Config.maximum_save_slots);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ void Inv_Ring_InitHeader(RING_INFO *ring)
|
|||
}
|
||||
}
|
||||
|
||||
void Inv_Ring_RemoveHeader(RING_INFO *ring)
|
||||
void Inv_Ring_RemoveHeader(void)
|
||||
{
|
||||
if (!g_InvRingText) {
|
||||
return;
|
||||
|
@ -152,6 +152,7 @@ void Inv_Ring_RemoveHeader(RING_INFO *ring)
|
|||
|
||||
void Inv_Ring_RemoveAllText(void)
|
||||
{
|
||||
Inv_Ring_RemoveHeader();
|
||||
for (int i = 0; i < IT_NUMBER_OF; i++) {
|
||||
if (g_InvItemText[i]) {
|
||||
Text_Remove(g_InvItemText[i]);
|
||||
|
@ -302,6 +303,21 @@ void Inv_Ring_Active(INVENTORY_ITEM *inv_item)
|
|||
}
|
||||
}
|
||||
|
||||
void Inv_Ring_ResetItem(INVENTORY_ITEM *const inv_item)
|
||||
{
|
||||
inv_item->drawn_meshes = inv_item->which_meshes;
|
||||
inv_item->current_frame = 0;
|
||||
inv_item->goal_frame = inv_item->current_frame;
|
||||
inv_item->pt_xrot = 0;
|
||||
inv_item->x_rot = 0;
|
||||
inv_item->y_rot = 0;
|
||||
inv_item->ytrans = 0;
|
||||
inv_item->ztrans = 0;
|
||||
if (inv_item->object_number == O_PASSPORT_OPTION) {
|
||||
inv_item->object_number = O_PASSPORT_CLOSED;
|
||||
}
|
||||
}
|
||||
|
||||
void Inv_Ring_GetView(RING_INFO *ring, XYZ_32 *view_pos, XYZ_16 *view_rot)
|
||||
{
|
||||
PHD_ANGLE angles[2];
|
||||
|
|
|
@ -9,9 +9,10 @@ void Inv_Ring_Init(
|
|||
int16_t current, IMOTION_INFO *imo);
|
||||
|
||||
void Inv_Ring_InitHeader(RING_INFO *ring);
|
||||
void Inv_Ring_RemoveHeader(RING_INFO *ring);
|
||||
void Inv_Ring_RemoveHeader(void);
|
||||
void Inv_Ring_RemoveAllText(void);
|
||||
void Inv_Ring_Active(INVENTORY_ITEM *inv_item);
|
||||
void Inv_Ring_ResetItem(INVENTORY_ITEM *inv_item);
|
||||
|
||||
void Inv_Ring_GetView(RING_INFO *ring, XYZ_32 *view_pos, XYZ_16 *view_rot);
|
||||
void Inv_Ring_Light(RING_INFO *ring);
|
||||
|
|
|
@ -3,5 +3,4 @@
|
|||
#include "global/types.h"
|
||||
|
||||
void Option_DoInventory(INVENTORY_ITEM *inv_item);
|
||||
void Option_Init(void);
|
||||
void Option_Shutdown(void);
|
||||
void Option_Shutdown(INVENTORY_ITEM *inv_item);
|
||||
|
|
|
@ -11,14 +11,36 @@
|
|||
|
||||
static CONTROL_MODE m_ControlMode = CM_PICK;
|
||||
|
||||
void Option_Init(void)
|
||||
void Option_Shutdown(INVENTORY_ITEM *inv_item)
|
||||
{
|
||||
Option_PassportInit();
|
||||
}
|
||||
switch (inv_item->object_number) {
|
||||
case O_PASSPORT_OPTION:
|
||||
Option_Passport_Shutdown();
|
||||
break;
|
||||
|
||||
void Option_Shutdown(void)
|
||||
{
|
||||
Option_PassportShutdown();
|
||||
case O_MAP_OPTION:
|
||||
Option_Compass_Shutdown();
|
||||
break;
|
||||
|
||||
case O_DETAIL_OPTION:
|
||||
Option_Graphics_Shutdown();
|
||||
break;
|
||||
|
||||
case O_SOUND_OPTION:
|
||||
Option_Sound_Shutdown();
|
||||
break;
|
||||
|
||||
case O_CONTROL_OPTION:
|
||||
if (m_ControlMode == CM_PICK) {
|
||||
Option_ControlPick_Shutdown();
|
||||
} else {
|
||||
Option_Control_Shutdown();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Option_DoInventory(INVENTORY_ITEM *inv_item)
|
||||
|
|
|
@ -104,6 +104,14 @@ static void Option_Compass_InitText(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void Option_Compass_ShutdownText(void)
|
||||
{
|
||||
for (int i = 0; i < TEXT_NUMBER_OF; i++) {
|
||||
Text_Remove(m_Text[i]);
|
||||
m_Text[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void Option_Compass(INVENTORY_ITEM *inv_item)
|
||||
{
|
||||
if (g_Config.enable_compass_stats) {
|
||||
|
@ -131,11 +139,13 @@ void Option_Compass(INVENTORY_ITEM *inv_item)
|
|||
}
|
||||
|
||||
if (g_InputDB.menu_confirm || g_InputDB.menu_back) {
|
||||
for (int i = 0; i < TEXT_NUMBER_OF; i++) {
|
||||
Text_Remove(m_Text[i]);
|
||||
m_Text[i] = NULL;
|
||||
}
|
||||
Option_Compass_ShutdownText();
|
||||
inv_item->goal_frame = inv_item->frames_total - 1;
|
||||
inv_item->anim_direction = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void Option_Compass_Shutdown(void)
|
||||
{
|
||||
Option_Compass_ShutdownText();
|
||||
}
|
||||
|
|
|
@ -3,3 +3,4 @@
|
|||
#include "global/types.h"
|
||||
|
||||
void Option_Compass(INVENTORY_ITEM *inv_item);
|
||||
void Option_Compass_Shutdown(void);
|
||||
|
|
|
@ -792,3 +792,8 @@ CONTROL_MODE Option_Control(INVENTORY_ITEM *inv_item, CONTROL_MODE mode)
|
|||
|
||||
return mode;
|
||||
}
|
||||
|
||||
void Option_Control_Shutdown(void)
|
||||
{
|
||||
Option_Control_ShutdownText();
|
||||
}
|
||||
|
|
|
@ -5,3 +5,4 @@
|
|||
#include <stdbool.h>
|
||||
|
||||
CONTROL_MODE Option_Control(INVENTORY_ITEM *inv_item, CONTROL_MODE mode);
|
||||
void Option_Control_Shutdown(void);
|
||||
|
|
|
@ -102,3 +102,8 @@ CONTROL_MODE Option_ControlPick(void)
|
|||
|
||||
return CM_PICK;
|
||||
}
|
||||
|
||||
void Option_ControlPick_Shutdown(void)
|
||||
{
|
||||
Option_ControlPick_ShutdownText();
|
||||
}
|
||||
|
|
|
@ -3,3 +3,4 @@
|
|||
#include "global/types.h"
|
||||
|
||||
CONTROL_MODE Option_ControlPick(void);
|
||||
void Option_ControlPick_Shutdown(void);
|
||||
|
|
|
@ -100,7 +100,6 @@ static void Option_Graphics_MenuUp(void);
|
|||
static void Option_Graphics_MenuDown(void);
|
||||
static void Option_Graphics_InitText(void);
|
||||
static void Option_Graphics_UpdateText(void);
|
||||
static void Option_Graphics_Shutdown(void);
|
||||
static void Option_Graphics_UpdateArrows(
|
||||
GRAPHICS_OPTION_NAME option_name, TEXTSTRING value_text, bool more_up,
|
||||
bool more_down);
|
||||
|
@ -248,24 +247,6 @@ static void Option_Graphics_UpdateText(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void Option_Graphics_Shutdown(void)
|
||||
{
|
||||
for (int i = 0; i < TEXT_NUMBER_OF; i++) {
|
||||
Text_Remove(m_Text[i]);
|
||||
m_Text[i] = NULL;
|
||||
}
|
||||
for (int i = 0; i < OPTION_NUMBER_OF; i++) {
|
||||
Text_Remove(m_GraphicsMenu.option_texts[i]);
|
||||
m_GraphicsMenu.option_texts[i] = NULL;
|
||||
Text_Remove(m_GraphicsMenu.value_texts[i]);
|
||||
m_GraphicsMenu.value_texts[i] = NULL;
|
||||
}
|
||||
m_IsTextInit = false;
|
||||
m_HideArrowLeft = false;
|
||||
m_HideArrowRight = false;
|
||||
Option_Graphics_InitMenu();
|
||||
}
|
||||
|
||||
static void Option_Graphics_UpdateArrows(
|
||||
GRAPHICS_OPTION_NAME option_name, TEXTSTRING value_text, bool more_up,
|
||||
bool more_down)
|
||||
|
@ -666,3 +647,21 @@ void Option_Graphics(INVENTORY_ITEM *inv_item)
|
|||
Config_Write();
|
||||
}
|
||||
}
|
||||
|
||||
void Option_Graphics_Shutdown(void)
|
||||
{
|
||||
for (int i = 0; i < TEXT_NUMBER_OF; i++) {
|
||||
Text_Remove(m_Text[i]);
|
||||
m_Text[i] = NULL;
|
||||
}
|
||||
for (int i = 0; i < OPTION_NUMBER_OF; i++) {
|
||||
Text_Remove(m_GraphicsMenu.option_texts[i]);
|
||||
m_GraphicsMenu.option_texts[i] = NULL;
|
||||
Text_Remove(m_GraphicsMenu.value_texts[i]);
|
||||
m_GraphicsMenu.value_texts[i] = NULL;
|
||||
}
|
||||
m_IsTextInit = false;
|
||||
m_HideArrowLeft = false;
|
||||
m_HideArrowRight = false;
|
||||
Option_Graphics_InitMenu();
|
||||
}
|
||||
|
|
|
@ -3,3 +3,4 @@
|
|||
#include "global/types.h"
|
||||
|
||||
void Option_Graphics(INVENTORY_ITEM *inv_item);
|
||||
void Option_Graphics_Shutdown(void);
|
||||
|
|
|
@ -96,6 +96,7 @@ REQUEST_INFO g_SavegameRequester = {
|
|||
.items = NULL,
|
||||
};
|
||||
|
||||
static void Option_Passport_InitRequesters(void);
|
||||
static void Option_Passport_InitText(void);
|
||||
static void Option_Passport_ShutdownText(void);
|
||||
static void Option_Passport_Close(INVENTORY_ITEM *inv_item);
|
||||
|
@ -113,18 +114,12 @@ static void Option_Passport_Restart(INVENTORY_ITEM *inv_item);
|
|||
static void Option_Passport_FlipRight(INVENTORY_ITEM *inv_item);
|
||||
static void Option_Passport_FlipLeft(INVENTORY_ITEM *inv_item);
|
||||
|
||||
void Option_Passport_Init(void)
|
||||
void Option_Passport_InitRequesters(void)
|
||||
{
|
||||
Requester_Init(&g_SavegameRequester, g_Config.maximum_save_slots);
|
||||
Requester_Init(&m_SelectLevelRequester, g_GameFlow.level_count + 1);
|
||||
Requester_Init(&m_NewGameRequester, MAX_GAME_MODES);
|
||||
}
|
||||
|
||||
void Option_Passport_Shutdown(void)
|
||||
{
|
||||
Requester_Shutdown(&g_SavegameRequester);
|
||||
Requester_Shutdown(&m_SelectLevelRequester);
|
||||
Requester_Shutdown(&m_NewGameRequester);
|
||||
Requester_Init(&m_SelectLevelRequester, g_GameFlow.level_count + 1);
|
||||
Requester_Init(&m_NewGameRequester, MAX_GAME_MODES);
|
||||
}
|
||||
|
||||
static void Option_Passport_InitText(void)
|
||||
|
@ -595,6 +590,7 @@ static void Option_Passport_FlipLeft(INVENTORY_ITEM *inv_item)
|
|||
void Option_Passport(INVENTORY_ITEM *inv_item)
|
||||
{
|
||||
if (!m_IsTextInit) {
|
||||
Option_Passport_InitRequesters();
|
||||
Text_Remove(g_InvItemText[IT_NAME]);
|
||||
g_InvItemText[IT_NAME] = NULL;
|
||||
Text_Remove(g_InvRingText);
|
||||
|
@ -690,3 +686,11 @@ void Option_Passport(INVENTORY_ITEM *inv_item)
|
|||
Option_Passport_Close(inv_item);
|
||||
}
|
||||
}
|
||||
|
||||
void Option_Passport_Shutdown(void)
|
||||
{
|
||||
Option_Passport_ShutdownText();
|
||||
Requester_Shutdown(&m_SelectLevelRequester);
|
||||
Requester_Shutdown(&m_NewGameRequester);
|
||||
Requester_ClearTextstrings(&g_SavegameRequester);
|
||||
}
|
||||
|
|
|
@ -3,5 +3,4 @@
|
|||
#include "global/types.h"
|
||||
|
||||
void Option_Passport(INVENTORY_ITEM *inv_item);
|
||||
void Option_Passport_Init(void);
|
||||
void Option_Passport_Shutdown(void);
|
||||
|
|
|
@ -163,9 +163,14 @@ void Option_Sound(INVENTORY_ITEM *inv_item)
|
|||
}
|
||||
|
||||
if (g_InputDB.menu_confirm || g_InputDB.menu_back) {
|
||||
for (int i = 0; i < TEXT_NUMBER_OF; i++) {
|
||||
Text_Remove(m_Text[i]);
|
||||
m_Text[i] = NULL;
|
||||
}
|
||||
Option_Sound_Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
void Option_Sound_Shutdown(void)
|
||||
{
|
||||
for (int i = 0; i < TEXT_NUMBER_OF; i++) {
|
||||
Text_Remove(m_Text[i]);
|
||||
m_Text[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,3 +3,4 @@
|
|||
#include "global/types.h"
|
||||
|
||||
void Option_Sound(INVENTORY_ITEM *inv_item);
|
||||
void Option_Sound_Shutdown(void);
|
||||
|
|
|
@ -176,18 +176,11 @@ static void Inv_Construct(void)
|
|||
}
|
||||
|
||||
for (int i = 0; i < g_InvMainObjects; i++) {
|
||||
INVENTORY_ITEM *inv_item = g_InvMainList[i];
|
||||
inv_item->drawn_meshes = inv_item->which_meshes;
|
||||
inv_item->current_frame = 0;
|
||||
inv_item->goal_frame = inv_item->current_frame;
|
||||
inv_item->y_rot = 0;
|
||||
Inv_Ring_ResetItem(g_InvMainList[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < g_InvOptionObjects; i++) {
|
||||
INVENTORY_ITEM *inv_item = g_InvOptionList[i];
|
||||
inv_item->current_frame = 0;
|
||||
inv_item->goal_frame = 0;
|
||||
inv_item->y_rot = 0;
|
||||
Inv_Ring_ResetItem(g_InvOptionList[i]);
|
||||
}
|
||||
|
||||
g_InvMainCurrent = 0;
|
||||
|
@ -1070,7 +1063,7 @@ static GAMEFLOW_COMMAND Phase_Inventory_ControlFrame(void)
|
|||
}
|
||||
Inv_Ring_InitHeader(ring);
|
||||
} else {
|
||||
Inv_Ring_RemoveHeader(ring);
|
||||
Inv_Ring_RemoveHeader();
|
||||
}
|
||||
|
||||
if (!motion->status || motion->status == RNG_CLOSING
|
||||
|
@ -1109,6 +1102,11 @@ static GAMEFLOW_COMMAND Phase_Inventory_Control(int32_t nframes)
|
|||
|
||||
static void Phase_Inventory_End(void)
|
||||
{
|
||||
INVENTORY_ITEM *const inv_item = m_Ring.list[m_Ring.current_object];
|
||||
if (inv_item != NULL) {
|
||||
Option_Shutdown(inv_item);
|
||||
}
|
||||
|
||||
Inv_Destroy();
|
||||
if (g_Config.enable_buffering) {
|
||||
g_OldInputDB.any = 0;
|
||||
|
|
|
@ -49,8 +49,10 @@ void Requester_Shutdown(REQUEST_INFO *req)
|
|||
Requester_ClearTextstrings(req);
|
||||
|
||||
Memory_FreePointer(&req->heading_text);
|
||||
for (int i = 0; i < req->max_items; i++) {
|
||||
Memory_FreePointer(&req->items[i].content_text);
|
||||
if (req->items != NULL) {
|
||||
for (int i = 0; i < req->max_items; i++) {
|
||||
Memory_FreePointer(&req->items[i].content_text);
|
||||
}
|
||||
}
|
||||
Memory_FreePointer(&req->items);
|
||||
}
|
||||
|
@ -66,9 +68,11 @@ void Requester_ClearTextstrings(REQUEST_INFO *req)
|
|||
Text_Remove(req->moredown);
|
||||
req->moredown = NULL;
|
||||
|
||||
for (int i = 0; i < req->max_items; i++) {
|
||||
Text_Remove(req->items[i].content);
|
||||
req->items[i].content = NULL;
|
||||
if (req->items != NULL) {
|
||||
for (int i = 0; i < req->max_items; i++) {
|
||||
Text_Remove(req->items[i].content);
|
||||
req->items[i].content = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
req->items_used = 0;
|
||||
|
|
|
@ -135,7 +135,6 @@ void Shell_Init(const char *gameflow_path)
|
|||
return;
|
||||
}
|
||||
|
||||
Option_Init();
|
||||
Savegame_ScanSavedGames();
|
||||
Savegame_HighlightNewestSlot();
|
||||
|
||||
|
@ -151,7 +150,6 @@ void Shell_Shutdown(void)
|
|||
Sound_Shutdown();
|
||||
Music_Shutdown();
|
||||
Savegame_Shutdown();
|
||||
Option_Shutdown();
|
||||
Console_Shutdown();
|
||||
Log_Shutdown();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue