mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 20:58:07 +03:00
keep timer ticking in the inventory (closes #83)
This commit is contained in:
parent
58f739f342
commit
4731ae7ad1
7 changed files with 77 additions and 48 deletions
|
@ -60,6 +60,7 @@ Not all options are turned on by default. Refer to `Tomb1Main.json5` for details
|
|||
- you can offer a custom Gym level
|
||||
- added automatic calculation of secret numbers
|
||||
- added compass level stats
|
||||
- added ability to keep timer on in inventory
|
||||
- fixed skipping FMVs triggering inventory
|
||||
- fixed skipping credits working too fast
|
||||
- fixed setting user keys being very difficult
|
||||
|
|
|
@ -53,6 +53,10 @@
|
|||
// Enables showing level stats when selecting compass.
|
||||
"enable_compass_stats": true,
|
||||
|
||||
// Makes the ingame timer work even while the game is showing the
|
||||
// inventory.
|
||||
"enable_timer_in_inventory": true,
|
||||
|
||||
// Changes how the healthbar is displayed. Possible values:
|
||||
// - always: always show the healthbar
|
||||
// - default: show the healthbar at the beginning of a level, after
|
||||
|
|
|
@ -131,6 +131,7 @@ int8_t T1MReadConfigFromJson(const char *cfg_data)
|
|||
READ_BOOL(enable_tr3_sidesteps, 1);
|
||||
READ_BOOL(enable_braid, 0);
|
||||
READ_BOOL(enable_compass_stats, 1);
|
||||
READ_BOOL(enable_timer_in_inventory, 1);
|
||||
READ_BOOL(fix_key_triggers, 1);
|
||||
READ_BOOL(fix_end_of_level_freeze, 1);
|
||||
READ_BOOL(fix_tihocan_secret_sound, 1);
|
||||
|
|
|
@ -46,6 +46,7 @@ struct {
|
|||
int8_t enable_tr3_sidesteps;
|
||||
int8_t enable_braid;
|
||||
int8_t enable_compass_stats;
|
||||
int8_t enable_timer_in_inventory;
|
||||
int8_t healthbar_showing_mode;
|
||||
int8_t healthbar_location;
|
||||
int8_t healthbar_color;
|
||||
|
|
|
@ -240,6 +240,10 @@ int32_t Display_Inventory(int inv_mode)
|
|||
InvNFrames = S_DumpScreen();
|
||||
Camera.number_frames = InvNFrames;
|
||||
|
||||
if (T1MConfig.enable_timer_in_inventory) {
|
||||
SaveGame.timer += InvNFrames / 2;
|
||||
}
|
||||
|
||||
if (ring.rotating) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -24,17 +24,27 @@
|
|||
#define MAX_GAMMA_LEVEL 127
|
||||
#define PASSPORT_2FRONT IN_LEFT
|
||||
#define PASSPORT_2BACK IN_RIGHT
|
||||
#define MAX_MODES 4
|
||||
#define MAX_MODE_NAME_LENGTH 20
|
||||
|
||||
typedef enum COMPASS_TEXT {
|
||||
COMPASS_TITLE = 0,
|
||||
COMPASS_TITLE_BORDER = 1,
|
||||
COMPASS_TIME = 2,
|
||||
COMPASS_SECRETS = 3,
|
||||
COMPASS_PICKUPS = 4,
|
||||
COMPASS_KILLS = 5,
|
||||
COMPASS_NUMBER_OF = 6,
|
||||
} COMPASS_TEXT;
|
||||
|
||||
static TEXTSTRING *PassportText = NULL;
|
||||
static TEXTSTRING *DetailText[5] = { NULL, NULL, NULL, NULL, NULL };
|
||||
static TEXTSTRING *SoundText[4] = { NULL, NULL, NULL, NULL };
|
||||
static TEXTSTRING *CompassText[6] = { NULL, NULL, NULL, NULL, NULL, NULL };
|
||||
static TEXTSTRING *CompassText[COMPASS_NUMBER_OF] = { NULL, NULL, NULL,
|
||||
NULL, NULL, NULL };
|
||||
static int32_t PassportMode = 0;
|
||||
static int32_t SelectKey = 0;
|
||||
|
||||
#define MAX_MODES 4
|
||||
#define MAX_MODE_NAME_LENGTH 20
|
||||
|
||||
static char NewGameStrings[MAX_MODES][MAX_MODE_NAME_LENGTH];
|
||||
REQUEST_INFO NewGameRequester = {
|
||||
MAX_MODES, // items
|
||||
|
@ -737,12 +747,55 @@ void DoCompassOption(INVENTORY_ITEM *inv_item)
|
|||
const int32_t row_height = 25;
|
||||
const int32_t row_width = 225;
|
||||
|
||||
if (!CompassText[0] && T1MConfig.enable_compass_stats) {
|
||||
sprintf(string, "%s", GF.levels[CurrentLevel].level_title);
|
||||
int32_t y = top_y;
|
||||
CompassText[0] = T_Print(0, y - 2, 0, " ");
|
||||
CompassText[1] = T_Print(0, y, 0, string);
|
||||
y += row_height;
|
||||
if (T1MConfig.enable_compass_stats) {
|
||||
if (!CompassText[COMPASS_TITLE_BORDER]) {
|
||||
sprintf(string, "%s", GF.levels[CurrentLevel].level_title);
|
||||
int32_t y = top_y;
|
||||
CompassText[COMPASS_TITLE_BORDER] = T_Print(0, y - 2, 0, " ");
|
||||
CompassText[COMPASS_TITLE] = T_Print(0, y, 0, string);
|
||||
y += row_height;
|
||||
|
||||
CompassText[COMPASS_TIME] = T_Print(0, y, 0, " ");
|
||||
y += row_height;
|
||||
|
||||
int32_t secrets_taken = 0;
|
||||
int32_t secrets_total = MAX_SECRETS;
|
||||
do {
|
||||
if (SaveGame.secrets & 1) {
|
||||
secrets_taken++;
|
||||
}
|
||||
SaveGame.secrets >>= 1;
|
||||
secrets_total--;
|
||||
} while (secrets_total);
|
||||
sprintf(
|
||||
string, GF.strings[GS_STATS_SECRETS_FMT], secrets_taken,
|
||||
GF.levels[CurrentLevel].secrets);
|
||||
CompassText[COMPASS_SECRETS] = T_Print(0, y, 0, string);
|
||||
y += row_height;
|
||||
|
||||
sprintf(string, GF.strings[GS_STATS_PICKUPS_FMT], SaveGame.pickups);
|
||||
CompassText[COMPASS_PICKUPS] = T_Print(0, y, 0, string);
|
||||
y += row_height;
|
||||
|
||||
sprintf(string, GF.strings[GS_STATS_KILLS_FMT], SaveGame.kills);
|
||||
CompassText[COMPASS_KILLS] = T_Print(0, y, 0, string);
|
||||
y += row_height;
|
||||
|
||||
T_AddBackground(
|
||||
CompassText[COMPASS_TITLE_BORDER], row_width, y - top_y, 0, 0,
|
||||
8, IC_BLACK, NULL, 0);
|
||||
T_AddOutline(
|
||||
CompassText[COMPASS_TITLE_BORDER], 1, IC_BLUE, NULL, 0);
|
||||
T_AddBackground(
|
||||
CompassText[COMPASS_TITLE], row_width - 4, 0, 0, 0, 8, IC_BLACK,
|
||||
NULL, 0);
|
||||
T_AddOutline(CompassText[COMPASS_TITLE], 1, IC_BLUE, NULL, 0);
|
||||
|
||||
for (int i = 0; i < COMPASS_NUMBER_OF; i++) {
|
||||
T_CentreH(CompassText[i], 1);
|
||||
T_CentreV(CompassText[i], 1);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t seconds = SaveGame.timer / 30;
|
||||
int32_t hours = seconds / 3600;
|
||||
|
@ -756,47 +809,11 @@ void DoCompassOption(INVENTORY_ITEM *inv_item)
|
|||
sprintf(time_str, "%d:%d%d", minutes, seconds / 10, seconds % 10);
|
||||
}
|
||||
sprintf(string, GF.strings[GS_STATS_TIME_TAKEN_FMT], time_str);
|
||||
CompassText[2] = T_Print(0, y, 0, string);
|
||||
y += row_height;
|
||||
|
||||
int32_t secrets_taken = 0;
|
||||
int32_t secrets_total = MAX_SECRETS;
|
||||
do {
|
||||
if (SaveGame.secrets & 1) {
|
||||
secrets_taken++;
|
||||
}
|
||||
SaveGame.secrets >>= 1;
|
||||
secrets_total--;
|
||||
} while (secrets_total);
|
||||
sprintf(
|
||||
string, GF.strings[GS_STATS_SECRETS_FMT], secrets_taken,
|
||||
GF.levels[CurrentLevel].secrets);
|
||||
CompassText[3] = T_Print(0, y, 0, string);
|
||||
y += row_height;
|
||||
|
||||
sprintf(string, GF.strings[GS_STATS_PICKUPS_FMT], SaveGame.pickups);
|
||||
CompassText[4] = T_Print(0, y, 0, string);
|
||||
y += row_height;
|
||||
|
||||
sprintf(string, GF.strings[GS_STATS_KILLS_FMT], SaveGame.kills);
|
||||
CompassText[5] = T_Print(0, y, 0, string);
|
||||
y += row_height;
|
||||
|
||||
T_AddBackground(
|
||||
CompassText[0], row_width, y - top_y, 0, 0, 8, IC_BLACK, NULL, 0);
|
||||
T_AddOutline(CompassText[0], 1, IC_BLUE, NULL, 0);
|
||||
T_AddBackground(
|
||||
CompassText[1], row_width - 8, 0, 0, 0, 8, IC_BLACK, NULL, 0);
|
||||
T_AddOutline(CompassText[1], 1, IC_BLUE, NULL, 0);
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
T_CentreH(CompassText[i], 1);
|
||||
T_CentreV(CompassText[i], 1);
|
||||
}
|
||||
T_ChangeText(CompassText[COMPASS_TIME], string);
|
||||
}
|
||||
|
||||
if (CHK_ANY(InputDB, IN_DESELECT | IN_SELECT)) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (int i = 0; i < COMPASS_NUMBER_OF; i++) {
|
||||
T_RemovePrint(CompassText[i]);
|
||||
CompassText[i] = NULL;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ void test_empty_config()
|
|||
ASSERT_INT_EQUAL(T1MConfig.enable_cheats, 0);
|
||||
ASSERT_INT_EQUAL(T1MConfig.enable_braid, 0);
|
||||
ASSERT_INT_EQUAL(T1MConfig.enable_compass_stats, 1);
|
||||
ASSERT_INT_EQUAL(T1MConfig.enable_timer_in_inventory, 1);
|
||||
ASSERT_INT_EQUAL(
|
||||
T1MConfig.healthbar_showing_mode, T1M_BSM_FLASHING_OR_DEFAULT);
|
||||
ASSERT_INT_EQUAL(T1MConfig.healthbar_location, T1M_BL_TOP_LEFT);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue