mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 12:47:58 +03:00
ui: port play any level dialog to trx
This commit is contained in:
parent
f23a777f64
commit
33617deba7
12 changed files with 234 additions and 135 deletions
68
src/libtrx/game/ui/dialogs/base_passport.c
Normal file
68
src/libtrx/game/ui/dialogs/base_passport.c
Normal file
|
@ -0,0 +1,68 @@
|
|||
#include "game/ui/dialogs/base_passport.h"
|
||||
|
||||
#include "game/inventory.h"
|
||||
#include "game/scaler.h"
|
||||
#include "game/ui/elements/modal.h"
|
||||
#include "game/ui/elements/requester.h"
|
||||
#include "game/ui/elements/resize.h"
|
||||
#include "game/viewport.h"
|
||||
|
||||
// TODO: consolidate this variable
|
||||
#if TR_VERSION == 1
|
||||
extern int32_t g_InvMode;
|
||||
#else
|
||||
extern int32_t g_Inv_Mode;
|
||||
#endif
|
||||
|
||||
static int32_t M_GetVisibleRows(void);
|
||||
|
||||
static int32_t M_GetVisibleRows(void)
|
||||
{
|
||||
if (TR_VERSION == 2) {
|
||||
return 10;
|
||||
} else {
|
||||
const int32_t res_h =
|
||||
Scaler_CalcInverse(Viewport_GetHeight(), SCALER_TARGET_TEXT);
|
||||
if (res_h <= 240) {
|
||||
return 5;
|
||||
} else if (res_h <= 384) {
|
||||
return 7;
|
||||
} else if (res_h <= 480) {
|
||||
return 10;
|
||||
} else {
|
||||
return 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UI_BasePassportDialog_Init(
|
||||
UI_REQUESTER_STATE *const req, const size_t max_rows)
|
||||
{
|
||||
UI_Requester_Init(req, M_GetVisibleRows(), max_rows, true);
|
||||
req->row_pad = 4.0f;
|
||||
req->row_spacing = TR_VERSION == 1 ? 2.0f : 3.0f;
|
||||
req->show_arrows = TR_VERSION == 1;
|
||||
req->reserve_space = true;
|
||||
}
|
||||
|
||||
void UI_BasePassportDialog_Control(UI_REQUESTER_STATE *const req)
|
||||
{
|
||||
UI_Requester_SetVisibleRows(req, M_GetVisibleRows());
|
||||
}
|
||||
|
||||
void UI_BeginBasePassportDialog(void)
|
||||
{
|
||||
#if TR_VERSION == 1
|
||||
const float modal_y = g_InvMode == INV_TITLE_MODE ? 0.72f : 0.55f;
|
||||
#else
|
||||
const float modal_y = g_Inv_Mode == INV_TITLE_MODE ? 0.8f : 0.65f;
|
||||
#endif
|
||||
UI_BeginModal(0.5f, modal_y);
|
||||
UI_BeginResize(300.0f, -1.0f);
|
||||
}
|
||||
|
||||
void UI_EndBasePassportDialog(void)
|
||||
{
|
||||
UI_EndResize();
|
||||
UI_EndModal();
|
||||
}
|
87
src/libtrx/game/ui/dialogs/play_any_level.c
Normal file
87
src/libtrx/game/ui/dialogs/play_any_level.c
Normal file
|
@ -0,0 +1,87 @@
|
|||
#include "game/ui/dialogs/play_any_level.h"
|
||||
|
||||
#include "game/game_flow.h"
|
||||
#include "game/game_string.h"
|
||||
#include "game/ui/common.h"
|
||||
#include "game/ui/dialogs/base_passport.h"
|
||||
#include "game/ui/elements/anchor.h"
|
||||
#include "game/ui/elements/hide.h"
|
||||
#include "game/ui/elements/label.h"
|
||||
#include "game/ui/elements/offset.h"
|
||||
#include "game/ui/elements/requester.h"
|
||||
#include "game/ui/elements/spacer.h"
|
||||
#include "game/ui/elements/stack.h"
|
||||
#include "memory.h"
|
||||
#include "vector.h"
|
||||
|
||||
typedef struct {
|
||||
int32_t level_num;
|
||||
const char *text;
|
||||
} M_ROW;
|
||||
|
||||
typedef struct UI_PLAY_ANY_LEVEL_DIALOG_STATE {
|
||||
VECTOR *rows;
|
||||
UI_REQUESTER_STATE req;
|
||||
} UI_PLAY_ANY_LEVEL_DIALOG_STATE;
|
||||
|
||||
UI_PLAY_ANY_LEVEL_DIALOG_STATE *UI_PlayAnyLevelDialog_Init(void)
|
||||
{
|
||||
UI_PLAY_ANY_LEVEL_DIALOG_STATE *const s =
|
||||
Memory_Alloc(sizeof(UI_PLAY_ANY_LEVEL_DIALOG_STATE));
|
||||
s->rows = Vector_Create(sizeof(M_ROW));
|
||||
|
||||
const GF_LEVEL_TABLE *const level_table = GF_GetLevelTable(GFLT_MAIN);
|
||||
for (int32_t i = 0; i < level_table->count; i++) {
|
||||
if (level_table->levels[i].type != GFL_GYM) {
|
||||
const M_ROW row = {
|
||||
.level_num = i,
|
||||
.text = level_table->levels[i].title,
|
||||
};
|
||||
Vector_Add(s->rows, &row);
|
||||
}
|
||||
}
|
||||
|
||||
UI_BasePassportDialog_Init(&s->req, s->rows->count);
|
||||
return s;
|
||||
}
|
||||
|
||||
void UI_PlayAnyLevelDialog_Free(UI_PLAY_ANY_LEVEL_DIALOG_STATE *const s)
|
||||
{
|
||||
Vector_Free(s->rows);
|
||||
UI_Requester_Free(&s->req);
|
||||
Memory_Free(s);
|
||||
}
|
||||
|
||||
int32_t UI_PlayAnyLevelDialog_Control(UI_PLAY_ANY_LEVEL_DIALOG_STATE *const s)
|
||||
{
|
||||
UI_BasePassportDialog_Control(&s->req);
|
||||
const int32_t choice = UI_Requester_Control(&s->req);
|
||||
switch (choice) {
|
||||
case UI_REQUESTER_NO_CHOICE:
|
||||
return UI_PLAY_ANY_LEVEL_CHOICE_NO_CHOICE;
|
||||
case UI_REQUESTER_CANCEL:
|
||||
return UI_PLAY_ANY_LEVEL_CHOICE_CANCEL;
|
||||
default:
|
||||
return ((M_ROW *)Vector_Get(s->rows, choice))->level_num;
|
||||
}
|
||||
}
|
||||
|
||||
void UI_PlayAnyLevelDialog(UI_PLAY_ANY_LEVEL_DIALOG_STATE *const s)
|
||||
{
|
||||
UI_BeginBasePassportDialog();
|
||||
UI_BeginRequester(&s->req, GS(PASSPORT_SELECT_LEVEL));
|
||||
|
||||
for (int32_t i = 0; i < s->rows->count; i++) {
|
||||
if (UI_Requester_IsRowVisible(&s->req, i)) {
|
||||
const M_ROW *const row = Vector_Get(s->rows, i);
|
||||
UI_BeginRequesterRow(&s->req, i);
|
||||
UI_BeginAnchor(0.5f, 0.5f);
|
||||
UI_Label(row->text);
|
||||
UI_EndAnchor();
|
||||
UI_EndRequesterRow(&s->req, i);
|
||||
}
|
||||
}
|
||||
|
||||
UI_EndRequester(&s->req);
|
||||
UI_EndBasePassportDialog();
|
||||
}
|
|
@ -2,17 +2,15 @@
|
|||
|
||||
#include "game/game_string.h"
|
||||
#include "game/input.h"
|
||||
#include "game/inventory.h"
|
||||
#include "game/savegame.h"
|
||||
#include "game/scaler.h"
|
||||
#include "game/ui/common.h"
|
||||
#include "game/ui/dialogs/base_passport.h"
|
||||
#include "game/ui/elements/anchor.h"
|
||||
#include "game/ui/elements/hide.h"
|
||||
#include "game/ui/elements/label.h"
|
||||
#include "game/ui/elements/modal.h"
|
||||
#include "game/ui/elements/offset.h"
|
||||
#include "game/ui/elements/requester.h"
|
||||
#include "game/ui/elements/resize.h"
|
||||
#include "game/ui/elements/spacer.h"
|
||||
#include "game/ui/elements/stack.h"
|
||||
#include "game/viewport.h"
|
||||
|
@ -33,32 +31,12 @@ typedef struct UI_SAVE_SLOT_DIALOG_STATE {
|
|||
UI_REQUESTER_STATE req;
|
||||
} UI_SAVE_SLOT_DIALOG_STATE;
|
||||
|
||||
static int32_t M_GetVisibleRows(void);
|
||||
static bool M_ShowDetails(const UI_SAVE_SLOT_DIALOG_STATE *s, int32_t slot_idx);
|
||||
static void M_NonEmptySlot(
|
||||
const UI_SAVE_SLOT_DIALOG_STATE *s, int32_t slot_idx,
|
||||
const SAVEGAME_INFO *info);
|
||||
static void M_EmptySlot(const UI_SAVE_SLOT_DIALOG_STATE *s, int32_t slot_idx);
|
||||
|
||||
static int32_t M_GetVisibleRows(void)
|
||||
{
|
||||
if (TR_VERSION == 2) {
|
||||
return 10;
|
||||
} else {
|
||||
const int32_t res_h =
|
||||
Scaler_CalcInverse(Viewport_GetHeight(), SCALER_TARGET_TEXT);
|
||||
if (res_h <= 240) {
|
||||
return 5;
|
||||
} else if (res_h <= 384) {
|
||||
return 7;
|
||||
} else if (res_h <= 480) {
|
||||
return 10;
|
||||
} else {
|
||||
return 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool M_ShowDetails(
|
||||
const UI_SAVE_SLOT_DIALOG_STATE *const s, const int32_t slot_idx)
|
||||
{
|
||||
|
@ -146,12 +124,7 @@ UI_SAVE_SLOT_DIALOG_STATE *UI_SaveSlotDialog_Init(
|
|||
Memory_Alloc(sizeof(UI_SAVE_SLOT_DIALOG_STATE));
|
||||
s->type = type;
|
||||
|
||||
UI_Requester_Init(
|
||||
&s->req, M_GetVisibleRows(), Savegame_GetSlotCount(), true);
|
||||
s->req.row_pad = 2.0f;
|
||||
s->req.row_spacing = TR_VERSION == 1 ? 2.0f : 3.0f;
|
||||
s->req.show_arrows = TR_VERSION == 1;
|
||||
s->req.reserve_space = true;
|
||||
UI_BasePassportDialog_Init(&s->req, Savegame_GetSlotCount());
|
||||
s->req.sel_row = save_slot;
|
||||
CLAMP(s->req.sel_row, 0, s->req.max_rows);
|
||||
return s;
|
||||
|
@ -165,7 +138,7 @@ void UI_SaveSlotDialog_Free(UI_SAVE_SLOT_DIALOG_STATE *const s)
|
|||
UI_SAVE_SLOT_DIALOG_CHOICE UI_SaveSlotDialog_Control(
|
||||
UI_SAVE_SLOT_DIALOG_STATE *const s)
|
||||
{
|
||||
UI_Requester_SetVisibleRows(&s->req, M_GetVisibleRows());
|
||||
UI_BasePassportDialog_Control(&s->req);
|
||||
const int32_t sel_row = UI_Requester_GetCurrentRow(&s->req);
|
||||
if (M_ShowDetails(s, sel_row) && g_InputDB.menu_right) {
|
||||
return (UI_SAVE_SLOT_DIALOG_CHOICE) {
|
||||
|
@ -194,14 +167,7 @@ UI_SAVE_SLOT_DIALOG_CHOICE UI_SaveSlotDialog_Control(
|
|||
|
||||
void UI_SaveSlotDialog(const UI_SAVE_SLOT_DIALOG_STATE *const s)
|
||||
{
|
||||
#if TR_VERSION == 1
|
||||
const float modal_y = g_InvMode == INV_TITLE_MODE ? 0.72f : 0.55f;
|
||||
#else
|
||||
const float modal_y = g_Inv_Mode == INV_TITLE_MODE ? 0.8f : 0.65f;
|
||||
#endif
|
||||
UI_BeginModal(0.5f, modal_y);
|
||||
UI_BeginResize(300.0f, -1.0f);
|
||||
|
||||
UI_BeginBasePassportDialog();
|
||||
const char *const title = (s->type == UI_SAVE_SLOT_DIALOG_SAVE_GAME)
|
||||
? GS(PASSPORT_SAVE_GAME)
|
||||
: GS(PASSPORT_LOAD_GAME);
|
||||
|
@ -221,6 +187,5 @@ void UI_SaveSlotDialog(const UI_SAVE_SLOT_DIALOG_STATE *const s)
|
|||
}
|
||||
|
||||
UI_EndRequester(&s->req);
|
||||
UI_EndResize();
|
||||
UI_EndModal();
|
||||
UI_EndBasePassportDialog();
|
||||
}
|
||||
|
|
|
@ -4,18 +4,15 @@
|
|||
#include "game/game_flow.h"
|
||||
#include "game/game_string.h"
|
||||
#include "game/savegame.h"
|
||||
#include "game/scaler.h"
|
||||
#include "game/ui/common.h"
|
||||
#include "game/ui/dialogs/base_passport.h"
|
||||
#include "game/ui/elements/anchor.h"
|
||||
#include "game/ui/elements/hide.h"
|
||||
#include "game/ui/elements/label.h"
|
||||
#include "game/ui/elements/modal.h"
|
||||
#include "game/ui/elements/offset.h"
|
||||
#include "game/ui/elements/requester.h"
|
||||
#include "game/ui/elements/resize.h"
|
||||
#include "game/ui/elements/spacer.h"
|
||||
#include "game/ui/elements/stack.h"
|
||||
#include "game/viewport.h"
|
||||
#include "memory.h"
|
||||
#include "vector.h"
|
||||
|
||||
|
@ -43,27 +40,6 @@ typedef struct UI_SELECT_LEVEL_DIALOG_STATE {
|
|||
UI_REQUESTER_STATE req;
|
||||
} UI_SELECT_LEVEL_DIALOG_STATE;
|
||||
|
||||
static int32_t M_GetVisibleRows(void);
|
||||
|
||||
static int32_t M_GetVisibleRows(void)
|
||||
{
|
||||
if (TR_VERSION == 2) {
|
||||
return 10;
|
||||
} else {
|
||||
const int32_t res_h =
|
||||
Scaler_CalcInverse(Viewport_GetHeight(), SCALER_TARGET_TEXT);
|
||||
if (res_h <= 240) {
|
||||
return 5;
|
||||
} else if (res_h <= 384) {
|
||||
return 7;
|
||||
} else if (res_h <= 480) {
|
||||
return 10;
|
||||
} else {
|
||||
return 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UI_SELECT_LEVEL_DIALOG_STATE *UI_SelectLevelDialog_Init(const int32_t save_slot)
|
||||
{
|
||||
UI_SELECT_LEVEL_DIALOG_STATE *const s =
|
||||
|
@ -73,11 +49,9 @@ UI_SELECT_LEVEL_DIALOG_STATE *UI_SelectLevelDialog_Init(const int32_t save_slot)
|
|||
|
||||
const SAVEGAME_INFO *const info = Savegame_GetSavegameInfo(save_slot);
|
||||
ASSERT(info != nullptr);
|
||||
if (!info->features.select_level) {
|
||||
s->is_active = false;
|
||||
} else {
|
||||
s->is_active = true;
|
||||
s->is_active = info->features.select_level;
|
||||
|
||||
if (s->is_active) {
|
||||
const GF_LEVEL_TABLE *const level_table = GF_GetLevelTable(GFLT_MAIN);
|
||||
for (int32_t i = 0; i <= info->level_num && i < level_table->count;
|
||||
i++) {
|
||||
|
@ -106,10 +80,7 @@ UI_SELECT_LEVEL_DIALOG_STATE *UI_SelectLevelDialog_Init(const int32_t save_slot)
|
|||
}
|
||||
}
|
||||
|
||||
UI_Requester_Init(&s->req, 0, s->rows->count, true);
|
||||
s->req.row_pad = 2.0f;
|
||||
s->req.show_arrows = true;
|
||||
s->req.reserve_space = true;
|
||||
UI_BasePassportDialog_Init(&s->req, s->rows->count);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -122,7 +93,7 @@ void UI_SelectLevelDialog_Free(UI_SELECT_LEVEL_DIALOG_STATE *const s)
|
|||
|
||||
int32_t UI_SelectLevelDialog_Control(UI_SELECT_LEVEL_DIALOG_STATE *const s)
|
||||
{
|
||||
UI_Requester_SetVisibleRows(&s->req, M_GetVisibleRows());
|
||||
UI_BasePassportDialog_Control(&s->req);
|
||||
const int32_t choice = UI_Requester_Control(&s->req);
|
||||
if (choice < 0 || !s->is_active) {
|
||||
return UI_SELECT_LEVEL_CHOICE_NOOP;
|
||||
|
@ -136,13 +107,7 @@ int32_t UI_SelectLevelDialog_Control(UI_SELECT_LEVEL_DIALOG_STATE *const s)
|
|||
|
||||
void UI_SelectLevelDialog(UI_SELECT_LEVEL_DIALOG_STATE *const s)
|
||||
{
|
||||
#if TR_VERSION == 1
|
||||
const float modal_y = g_InvMode == INV_TITLE_MODE ? 0.72f : 0.55f;
|
||||
#else
|
||||
const float modal_y = g_Inv_Mode == INV_TITLE_MODE ? 0.8f : 0.65f;
|
||||
#endif
|
||||
UI_BeginModal(0.5f, modal_y);
|
||||
UI_BeginResize(300.0f, -1.0f);
|
||||
UI_BeginBasePassportDialog();
|
||||
UI_BeginRequester(&s->req, GS(PASSPORT_SELECT_LEVEL));
|
||||
|
||||
const SAVEGAME_INFO *info = Savegame_GetSavegameInfo(s->save_slot);
|
||||
|
@ -182,6 +147,5 @@ void UI_SelectLevelDialog(UI_SELECT_LEVEL_DIALOG_STATE *const s)
|
|||
}
|
||||
|
||||
UI_EndRequester(&s->req);
|
||||
UI_EndResize();
|
||||
UI_EndModal();
|
||||
UI_EndBasePassportDialog();
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "./ui/dialogs/new_game.h"
|
||||
#include "./ui/dialogs/pause.h"
|
||||
#include "./ui/dialogs/photo_mode.h"
|
||||
#include "./ui/dialogs/play_any_level.h"
|
||||
#include "./ui/dialogs/save_slot.h"
|
||||
#include "./ui/dialogs/select_level.h"
|
||||
#include "./ui/dialogs/stats.h"
|
||||
|
|
16
src/libtrx/include/libtrx/game/ui/dialogs/base_passport.h
Normal file
16
src/libtrx/include/libtrx/game/ui/dialogs/base_passport.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Base passport dialog functions.
|
||||
// Does not implement a function on its own, and is used mostly for placement
|
||||
// and sizing of the larger dialogs such as load/save game.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../common.h"
|
||||
#include "../elements/requester.h"
|
||||
|
||||
// state functions
|
||||
void UI_BasePassportDialog_Init(UI_REQUESTER_STATE *req, size_t max_rows);
|
||||
void UI_BasePassportDialog_Control(UI_REQUESTER_STATE *req);
|
||||
|
||||
// draw functions
|
||||
void UI_BeginBasePassportDialog(void);
|
||||
void UI_EndBasePassportDialog(void);
|
20
src/libtrx/include/libtrx/game/ui/dialogs/play_any_level.h
Normal file
20
src/libtrx/include/libtrx/game/ui/dialogs/play_any_level.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
// UI dialog for selecting a level within a save slot
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define UI_PLAY_ANY_LEVEL_CHOICE_NO_CHOICE UI_REQUESTER_NO_CHOICE
|
||||
#define UI_PLAY_ANY_LEVEL_CHOICE_CANCEL UI_REQUESTER_CANCEL
|
||||
|
||||
typedef struct UI_PLAY_ANY_LEVEL_DIALOG_STATE UI_PLAY_ANY_LEVEL_DIALOG_STATE;
|
||||
|
||||
struct UI_PLAY_ANY_LEVEL_DIALOG_STATE *UI_PlayAnyLevelDialog_Init(void);
|
||||
|
||||
void UI_PlayAnyLevelDialog_Free(struct UI_PLAY_ANY_LEVEL_DIALOG_STATE *s);
|
||||
|
||||
int32_t UI_PlayAnyLevelDialog_Control(struct UI_PLAY_ANY_LEVEL_DIALOG_STATE *s);
|
||||
|
||||
void UI_PlayAnyLevelDialog(struct UI_PLAY_ANY_LEVEL_DIALOG_STATE *s);
|
|
@ -203,6 +203,7 @@ sources = [
|
|||
'game/sound.c',
|
||||
'game/text.c',
|
||||
'game/ui/common.c',
|
||||
'game/ui/dialogs/base_passport.c',
|
||||
'game/ui/dialogs/controls.c',
|
||||
'game/ui/dialogs/controls_backend.c',
|
||||
'game/ui/dialogs/controls_editor.c',
|
||||
|
@ -210,6 +211,7 @@ sources = [
|
|||
'game/ui/dialogs/new_game.c',
|
||||
'game/ui/dialogs/pause.c',
|
||||
'game/ui/dialogs/photo_mode.c',
|
||||
'game/ui/dialogs/play_any_level.c',
|
||||
'game/ui/dialogs/save_slot.c',
|
||||
'game/ui/dialogs/select_level.c',
|
||||
'game/ui/dialogs/stats.c',
|
||||
|
|
|
@ -44,6 +44,9 @@ static struct {
|
|||
bool is_ready;
|
||||
UI_NEW_GAME_STATE state;
|
||||
} new_game;
|
||||
struct {
|
||||
UI_PLAY_ANY_LEVEL_DIALOG_STATE *state;
|
||||
} play_any_level;
|
||||
struct {
|
||||
UI_SAVE_SLOT_DIALOG_STATE *state;
|
||||
} save_slot;
|
||||
|
@ -62,6 +65,7 @@ static void M_ShowSaves(INVENTORY_ITEM *inv_item);
|
|||
static void M_LoadGame(INVENTORY_ITEM *inv_item);
|
||||
static void M_SaveGame(INVENTORY_ITEM *inv_item);
|
||||
static void M_NewGame(void);
|
||||
static void M_PlayAnyLevel(INVENTORY_ITEM *inv_item);
|
||||
static void M_FlipLeft(INVENTORY_ITEM *inv_item);
|
||||
static void M_FlipRight(INVENTORY_ITEM *inv_item);
|
||||
static void M_Close(INVENTORY_ITEM *inv_item);
|
||||
|
@ -191,8 +195,9 @@ static void M_RemoveAllText(void)
|
|||
UI_SaveSlotDialog_Free(m_State.save_slot.state);
|
||||
m_State.save_slot.state = nullptr;
|
||||
}
|
||||
if (g_SaveGameRequester.ready) {
|
||||
Requester_Shutdown(&g_SaveGameRequester);
|
||||
if (m_State.play_any_level.state != nullptr) {
|
||||
UI_SaveSlotDialog_Free(m_State.save_slot.state);
|
||||
m_State.play_any_level.state = nullptr;
|
||||
}
|
||||
M_FreeRequesters();
|
||||
}
|
||||
|
@ -300,6 +305,19 @@ static void M_NewGame(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void M_PlayAnyLevel(INVENTORY_ITEM *const inv_item)
|
||||
{
|
||||
M_ChangePageTextContent(GS(PASSPORT_NEW_GAME));
|
||||
if (m_State.play_any_level.state == nullptr) {
|
||||
m_State.play_any_level.state = UI_PlayAnyLevelDialog_Init();
|
||||
}
|
||||
const int32_t choice =
|
||||
UI_PlayAnyLevelDialog_Control(m_State.play_any_level.state);
|
||||
if (choice != UI_PLAY_ANY_LEVEL_CHOICE_NO_CHOICE) {
|
||||
m_State.selection = choice;
|
||||
}
|
||||
}
|
||||
|
||||
static void M_FlipLeft(INVENTORY_ITEM *const inv_item)
|
||||
{
|
||||
M_RemoveAllText();
|
||||
|
@ -344,15 +362,9 @@ static void M_ShowPage(INVENTORY_ITEM *const inv_item)
|
|||
M_NewGame();
|
||||
break;
|
||||
|
||||
case M_ROLE_PLAY_ANY_LEVEL: {
|
||||
if (!g_SaveGameRequester.ready) {
|
||||
Savegame_FillAvailableLevels(&g_SaveGameRequester);
|
||||
}
|
||||
M_ChangePageTextContent(GS(PASSPORT_NEW_GAME));
|
||||
m_State.selection =
|
||||
Requester_Display(&g_SaveGameRequester, true, true) - 1;
|
||||
case M_ROLE_PLAY_ANY_LEVEL:
|
||||
M_PlayAnyLevel(inv_item);
|
||||
break;
|
||||
}
|
||||
|
||||
case M_ROLE_EXIT:
|
||||
if (g_Inv_Mode == INV_TITLE_MODE) {
|
||||
|
@ -442,6 +454,12 @@ void Option_Passport_Draw(INVENTORY_ITEM *const item)
|
|||
}
|
||||
break;
|
||||
|
||||
case M_ROLE_PLAY_ANY_LEVEL:
|
||||
if (m_State.play_any_level.state != nullptr) {
|
||||
UI_PlayAnyLevelDialog(m_State.play_any_level.state);
|
||||
}
|
||||
break;
|
||||
|
||||
case M_ROLE_LOAD_GAME:
|
||||
case M_ROLE_SAVE_GAME:
|
||||
if (m_State.is_ready && m_State.save_slot.state != nullptr) {
|
||||
|
|
|
@ -23,8 +23,6 @@ int32_t Savegame_GetSlotCount(void)
|
|||
|
||||
void Savegame_HighlightNewestSlot(void)
|
||||
{
|
||||
const int32_t slot = Savegame_GetMostRecentlyCreatedSlot();
|
||||
g_SaveGameRequester.selected = MAX(0, slot);
|
||||
}
|
||||
|
||||
void Savegame_ApplyLogicToCurrentInfo(const GF_LEVEL *const level)
|
||||
|
|
|
@ -175,45 +175,6 @@ int16_t g_FinalBossItem[5];
|
|||
static char m_LoadGameRequesterStrings1[MAX_LEVELS][50];
|
||||
static char m_LoadGameRequesterStrings2[MAX_LEVELS][50];
|
||||
|
||||
REQUEST_INFO g_SaveGameRequester = {
|
||||
.no_selector = 0,
|
||||
.ready = 0,
|
||||
.pad = 0,
|
||||
.items_count = 1,
|
||||
.selected = 0,
|
||||
.visible_count = 5,
|
||||
.line_offset = 0,
|
||||
.line_old_offset = 0,
|
||||
.pix_width = 272,
|
||||
.line_height = 18,
|
||||
.x_pos = 0,
|
||||
.y_pos = -32,
|
||||
.z_pos = 0,
|
||||
.item_string_len = 50,
|
||||
.pitem_strings1 = (char *)g_ValidLevelStrings1,
|
||||
.pitem_strings2 = (char *)g_ValidLevelStrings2,
|
||||
.pitem_flags1 = nullptr,
|
||||
.pitem_flags2 = nullptr,
|
||||
.heading_flags1 = 0,
|
||||
.heading_flags2 = 0,
|
||||
.background_flags = 0,
|
||||
.moreup_flags = 0,
|
||||
.moredown_flags = 0,
|
||||
.item_flags1 = {},
|
||||
.item_flags2 = {},
|
||||
.heading_text1 = nullptr,
|
||||
.heading_text2 = nullptr,
|
||||
.background_text = nullptr,
|
||||
.moreup_text = nullptr,
|
||||
.moredown_text = nullptr,
|
||||
.item_texts1 = { nullptr },
|
||||
.item_texts2 = { nullptr },
|
||||
.heading_string1 = {},
|
||||
.heading_string2 = {},
|
||||
.render_width = 0,
|
||||
.render_height = 0,
|
||||
};
|
||||
|
||||
bool g_GF_RemoveAmmo = false;
|
||||
bool g_GF_RemoveWeapons = false;
|
||||
int32_t g_GF_LaraStartAnim;
|
||||
|
|
|
@ -62,7 +62,6 @@ extern int16_t g_FinalBossActive;
|
|||
extern uint16_t g_FinalLevelCount;
|
||||
extern int16_t g_FinalBossCount;
|
||||
extern int16_t g_FinalBossItem[5];
|
||||
extern REQUEST_INFO g_SaveGameRequester;
|
||||
|
||||
extern bool g_GF_RemoveAmmo;
|
||||
extern bool g_GF_RemoveWeapons;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue