mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-05-01 14:17:58 +03:00
vars: reduce access scope of globals
This commit is contained in:
parent
abbc03ee59
commit
e39bf22073
14 changed files with 71 additions and 73 deletions
|
@ -37,6 +37,8 @@
|
||||||
|
|
||||||
T1MConfigStruct T1MConfig = { 0 };
|
T1MConfigStruct T1MConfig = { 0 };
|
||||||
|
|
||||||
|
static const char *T1MGlobalSettingsPath = "cfg/Tomb1Main.json5";
|
||||||
|
|
||||||
static int8_t ReadBarShowingMode(
|
static int8_t ReadBarShowingMode(
|
||||||
struct json_object_s *obj, const char *name, int8_t default_value)
|
struct json_object_s *obj, const char *name, int8_t default_value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,6 +86,11 @@ typedef struct {
|
||||||
uint32_t fps_counter : 1;
|
uint32_t fps_counter : 1;
|
||||||
} render_flags;
|
} render_flags;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
double text_scale;
|
||||||
|
double bar_scale;
|
||||||
|
} ui;
|
||||||
|
|
||||||
int32_t sound_volume;
|
int32_t sound_volume;
|
||||||
int32_t music_volume;
|
int32_t music_volume;
|
||||||
} T1MConfigStruct;
|
} T1MConfigStruct;
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
static int32_t DemoLevel = -1;
|
||||||
|
|
||||||
int32_t StartDemo()
|
int32_t StartDemo()
|
||||||
{
|
{
|
||||||
TEXTSTRING *txt;
|
TEXTSTRING *txt;
|
||||||
|
|
|
@ -19,6 +19,7 @@ static PHD_MATRIX *IMMatrixPtr = NULL;
|
||||||
static PHD_MATRIX IMMatrixStack[MAX_NESTED_MATRICES] = { 0 };
|
static PHD_MATRIX IMMatrixStack[MAX_NESTED_MATRICES] = { 0 };
|
||||||
static int32_t IMRate = 0;
|
static int32_t IMRate = 0;
|
||||||
static int32_t IMFrac = 0;
|
static int32_t IMFrac = 0;
|
||||||
|
static bool CameraUnderwater = false;
|
||||||
|
|
||||||
int32_t DrawPhaseCinematic()
|
int32_t DrawPhaseCinematic()
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,7 +54,7 @@ int32_t Display_Inventory(int inv_mode)
|
||||||
int32_t pass_mode_open = 0;
|
int32_t pass_mode_open = 0;
|
||||||
if (AmmoText) {
|
if (AmmoText) {
|
||||||
T_RemovePrint(AmmoText);
|
T_RemovePrint(AmmoText);
|
||||||
AmmoText = 0;
|
AmmoText = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
AlterFOV(T1MConfig.fov_value * PHD_DEGREE);
|
AlterFOV(T1MConfig.fov_value * PHD_DEGREE);
|
||||||
|
@ -126,7 +126,7 @@ int32_t Display_Inventory(int inv_mode)
|
||||||
if (IDCount) {
|
if (IDCount) {
|
||||||
IDCount--;
|
IDCount--;
|
||||||
} else {
|
} else {
|
||||||
IDelay = 0;
|
IDelay = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Inv_RingDoMotions(&ring);
|
Inv_RingDoMotions(&ring);
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
static int32_t SlotsUsed = 0;
|
||||||
|
static CREATURE_INFO *BaddieSlots = NULL;
|
||||||
|
|
||||||
void InitialiseLOTArray()
|
void InitialiseLOTArray()
|
||||||
{
|
{
|
||||||
BaddieSlots =
|
BaddieSlots =
|
||||||
|
|
|
@ -74,6 +74,10 @@ typedef struct TEXT_COLUMN_PLACEMENT {
|
||||||
int col_num;
|
int col_num;
|
||||||
} TEXT_COLUMN_PLACEMENT;
|
} TEXT_COLUMN_PLACEMENT;
|
||||||
|
|
||||||
|
static int32_t PassportMode = 0;
|
||||||
|
static int32_t KeyMode = 0;
|
||||||
|
static int32_t KeyChange = 0;
|
||||||
|
|
||||||
static TEXTSTRING *PassportText = NULL;
|
static TEXTSTRING *PassportText = NULL;
|
||||||
static TEXTSTRING *DetailTextHW[DETAIL_HW_NUMBER_OF] = { 0 };
|
static TEXTSTRING *DetailTextHW[DETAIL_HW_NUMBER_OF] = { 0 };
|
||||||
static TEXTSTRING *SoundText[4] = { 0 };
|
static TEXTSTRING *SoundText[4] = { 0 };
|
||||||
|
@ -140,9 +144,6 @@ static const TEXT_COLUMN_PLACEMENT CtrlTextPlacementCheats[] = {
|
||||||
{ -1, -1 },
|
{ -1, -1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int32_t PassportMode = 0;
|
|
||||||
static int32_t KeyMode = 0;
|
|
||||||
|
|
||||||
static char NewGameStrings[MAX_GAME_MODES][MAX_GAME_MODE_LENGTH] = { 0 };
|
static char NewGameStrings[MAX_GAME_MODES][MAX_GAME_MODE_LENGTH] = { 0 };
|
||||||
REQUEST_INFO NewGameRequester = {
|
REQUEST_INFO NewGameRequester = {
|
||||||
MAX_GAME_MODES, // items
|
MAX_GAME_MODES, // items
|
||||||
|
@ -669,11 +670,15 @@ void DoDetailOption(INVENTORY_ITEM *inv_item)
|
||||||
DetailTextHW[DETAIL_HW_BILINEAR] = T_Print(0, y, buf);
|
DetailTextHW[DETAIL_HW_BILINEAR] = T_Print(0, y, buf);
|
||||||
y += DETAIL_HW_ROW_HEIGHT;
|
y += DETAIL_HW_ROW_HEIGHT;
|
||||||
|
|
||||||
sprintf(buf, GF.strings[GS_DETAIL_UI_TEXT_SCALE_FMT], UITextScale);
|
sprintf(
|
||||||
|
buf, GF.strings[GS_DETAIL_UI_TEXT_SCALE_FMT],
|
||||||
|
T1MConfig.ui.text_scale);
|
||||||
DetailTextHW[DETAIL_HW_UI_TEXT_SCALE] = T_Print(0, y, buf);
|
DetailTextHW[DETAIL_HW_UI_TEXT_SCALE] = T_Print(0, y, buf);
|
||||||
y += DETAIL_HW_ROW_HEIGHT;
|
y += DETAIL_HW_ROW_HEIGHT;
|
||||||
|
|
||||||
sprintf(buf, GF.strings[GS_DETAIL_UI_BAR_SCALE_FMT], UIBarScale);
|
sprintf(
|
||||||
|
buf, GF.strings[GS_DETAIL_UI_BAR_SCALE_FMT],
|
||||||
|
T1MConfig.ui.bar_scale);
|
||||||
DetailTextHW[DETAIL_HW_UI_BAR_SCALE] = T_Print(0, y, buf);
|
DetailTextHW[DETAIL_HW_UI_BAR_SCALE] = T_Print(0, y, buf);
|
||||||
y += DETAIL_HW_ROW_HEIGHT;
|
y += DETAIL_HW_ROW_HEIGHT;
|
||||||
|
|
||||||
|
@ -747,15 +752,15 @@ void DoDetailOption(INVENTORY_ITEM *inv_item)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DETAIL_HW_UI_TEXT_SCALE:
|
case DETAIL_HW_UI_TEXT_SCALE:
|
||||||
if (UITextScale < MAX_UI_SCALE) {
|
if (T1MConfig.ui.text_scale < MAX_UI_SCALE) {
|
||||||
UITextScale += 0.1;
|
T1MConfig.ui.text_scale += 0.1;
|
||||||
reset = 1;
|
reset = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DETAIL_HW_UI_BAR_SCALE:
|
case DETAIL_HW_UI_BAR_SCALE:
|
||||||
if (UIBarScale < MAX_UI_SCALE) {
|
if (T1MConfig.ui.bar_scale < MAX_UI_SCALE) {
|
||||||
UIBarScale += 0.1;
|
T1MConfig.ui.bar_scale += 0.1;
|
||||||
reset = 1;
|
reset = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -785,15 +790,15 @@ void DoDetailOption(INVENTORY_ITEM *inv_item)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DETAIL_HW_UI_TEXT_SCALE:
|
case DETAIL_HW_UI_TEXT_SCALE:
|
||||||
if (UITextScale > MIN_UI_SCALE) {
|
if (T1MConfig.ui.text_scale > MIN_UI_SCALE) {
|
||||||
UITextScale -= 0.1;
|
T1MConfig.ui.text_scale -= 0.1;
|
||||||
reset = 1;
|
reset = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DETAIL_HW_UI_BAR_SCALE:
|
case DETAIL_HW_UI_BAR_SCALE:
|
||||||
if (UIBarScale > MIN_UI_SCALE) {
|
if (T1MConfig.ui.bar_scale > MIN_UI_SCALE) {
|
||||||
UIBarScale -= 0.1;
|
T1MConfig.ui.bar_scale -= 0.1;
|
||||||
reset = 1;
|
reset = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -871,14 +876,14 @@ void DoSoundOption(INVENTORY_ITEM *inv_item)
|
||||||
case SOUND_MUSIC_VOLUME:
|
case SOUND_MUSIC_VOLUME:
|
||||||
if (Input.left && T1MConfig.music_volume > 0) {
|
if (Input.left && T1MConfig.music_volume > 0) {
|
||||||
T1MConfig.music_volume--;
|
T1MConfig.music_volume--;
|
||||||
IDelay = 1;
|
IDelay = true;
|
||||||
IDCount = 10;
|
IDCount = 10;
|
||||||
sprintf(buf, "| %2d", T1MConfig.music_volume);
|
sprintf(buf, "| %2d", T1MConfig.music_volume);
|
||||||
T_ChangeText(SoundText[SOUND_MUSIC_VOLUME], buf);
|
T_ChangeText(SoundText[SOUND_MUSIC_VOLUME], buf);
|
||||||
S_WriteUserSettings();
|
S_WriteUserSettings();
|
||||||
} else if (Input.right && T1MConfig.music_volume < 10) {
|
} else if (Input.right && T1MConfig.music_volume < 10) {
|
||||||
T1MConfig.music_volume++;
|
T1MConfig.music_volume++;
|
||||||
IDelay = 1;
|
IDelay = true;
|
||||||
IDCount = 10;
|
IDCount = 10;
|
||||||
sprintf(buf, "| %2d", T1MConfig.music_volume);
|
sprintf(buf, "| %2d", T1MConfig.music_volume);
|
||||||
T_ChangeText(SoundText[SOUND_MUSIC_VOLUME], buf);
|
T_ChangeText(SoundText[SOUND_MUSIC_VOLUME], buf);
|
||||||
|
@ -898,14 +903,14 @@ void DoSoundOption(INVENTORY_ITEM *inv_item)
|
||||||
case SOUND_SOUND_VOLUME:
|
case SOUND_SOUND_VOLUME:
|
||||||
if (Input.left && T1MConfig.sound_volume > 0) {
|
if (Input.left && T1MConfig.sound_volume > 0) {
|
||||||
T1MConfig.sound_volume--;
|
T1MConfig.sound_volume--;
|
||||||
IDelay = 1;
|
IDelay = true;
|
||||||
IDCount = 10;
|
IDCount = 10;
|
||||||
sprintf(buf, "} %2d", T1MConfig.sound_volume);
|
sprintf(buf, "} %2d", T1MConfig.sound_volume);
|
||||||
T_ChangeText(SoundText[SOUND_SOUND_VOLUME], buf);
|
T_ChangeText(SoundText[SOUND_SOUND_VOLUME], buf);
|
||||||
S_WriteUserSettings();
|
S_WriteUserSettings();
|
||||||
} else if (Input.right && T1MConfig.sound_volume < 10) {
|
} else if (Input.right && T1MConfig.sound_volume < 10) {
|
||||||
T1MConfig.sound_volume++;
|
T1MConfig.sound_volume++;
|
||||||
IDelay = 1;
|
IDelay = true;
|
||||||
IDCount = 10;
|
IDCount = 10;
|
||||||
sprintf(buf, "} %2d", T1MConfig.sound_volume);
|
sprintf(buf, "} %2d", T1MConfig.sound_volume);
|
||||||
T_ChangeText(SoundText[SOUND_SOUND_VOLUME], buf);
|
T_ChangeText(SoundText[SOUND_SOUND_VOLUME], buf);
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
static const char *ATIUserSettingsPath = "atiset.dat";
|
||||||
|
static const char *T1MUserSettingsPath = "cfg/Tomb1Main_runtime.json5";
|
||||||
|
|
||||||
static int32_t S_ReadUserSettingsATI();
|
static int32_t S_ReadUserSettingsATI();
|
||||||
static int32_t S_ReadUserSettingsT1M();
|
static int32_t S_ReadUserSettingsT1M();
|
||||||
static int32_t S_ReadUserSettingsT1MFromJson(const char *cfg_data);
|
static int32_t S_ReadUserSettingsT1MFromJson(const char *cfg_data);
|
||||||
|
@ -56,8 +59,8 @@ static int32_t S_ReadUserSettingsATI()
|
||||||
|
|
||||||
FileRead(&T1MConfig.input.layout, sizeof(int32_t), 1, fp);
|
FileRead(&T1MConfig.input.layout, sizeof(int32_t), 1, fp);
|
||||||
|
|
||||||
UITextScale = DEFAULT_UI_SCALE;
|
T1MConfig.ui.text_scale = DEFAULT_UI_SCALE;
|
||||||
UIBarScale = DEFAULT_UI_SCALE;
|
T1MConfig.ui.bar_scale = DEFAULT_UI_SCALE;
|
||||||
|
|
||||||
FileClose(fp);
|
FileClose(fp);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -109,13 +112,13 @@ static int32_t S_ReadUserSettingsT1MFromJson(const char *cfg_data)
|
||||||
json_object_get_number_int(root_obj, "layout_num", 0);
|
json_object_get_number_int(root_obj, "layout_num", 0);
|
||||||
CLAMP(T1MConfig.input.layout, 0, 1);
|
CLAMP(T1MConfig.input.layout, 0, 1);
|
||||||
|
|
||||||
UITextScale = json_object_get_number_double(
|
T1MConfig.ui.text_scale = json_object_get_number_double(
|
||||||
root_obj, "ui_text_scale", DEFAULT_UI_SCALE);
|
root_obj, "ui_text_scale", DEFAULT_UI_SCALE);
|
||||||
CLAMP(UITextScale, MIN_UI_SCALE, MAX_UI_SCALE);
|
CLAMP(T1MConfig.ui.text_scale, MIN_UI_SCALE, MAX_UI_SCALE);
|
||||||
|
|
||||||
UIBarScale = json_object_get_number_double(
|
T1MConfig.ui.bar_scale = json_object_get_number_double(
|
||||||
root_obj, "ui_bar_scale", DEFAULT_UI_SCALE);
|
root_obj, "ui_bar_scale", DEFAULT_UI_SCALE);
|
||||||
CLAMP(UIBarScale, MIN_UI_SCALE, MAX_UI_SCALE);
|
CLAMP(T1MConfig.ui.bar_scale, MIN_UI_SCALE, MAX_UI_SCALE);
|
||||||
|
|
||||||
struct json_array_s *layout_arr = json_object_get_array(root_obj, "layout");
|
struct json_array_s *layout_arr = json_object_get_array(root_obj, "layout");
|
||||||
for (int i = 0; i < KEY_NUMBER_OF; i++) {
|
for (int i = 0; i < KEY_NUMBER_OF; i++) {
|
||||||
|
@ -188,8 +191,10 @@ static int32_t S_WriteUserSettingsT1M()
|
||||||
root_obj, "sound_volume", T1MConfig.sound_volume);
|
root_obj, "sound_volume", T1MConfig.sound_volume);
|
||||||
json_object_append_number_int(
|
json_object_append_number_int(
|
||||||
root_obj, "layout_num", T1MConfig.input.layout);
|
root_obj, "layout_num", T1MConfig.input.layout);
|
||||||
json_object_append_number_double(root_obj, "ui_text_scale", UITextScale);
|
json_object_append_number_double(
|
||||||
json_object_append_number_double(root_obj, "ui_bar_scale", UIBarScale);
|
root_obj, "ui_text_scale", T1MConfig.ui.text_scale);
|
||||||
|
json_object_append_number_double(
|
||||||
|
root_obj, "ui_bar_scale", T1MConfig.ui.bar_scale);
|
||||||
|
|
||||||
struct json_array_s *layout_arr = json_array_new();
|
struct json_array_s *layout_arr = json_array_new();
|
||||||
for (int i = 0; i < KEY_NUMBER_OF; i++) {
|
for (int i = 0; i < KEY_NUMBER_OF; i++) {
|
||||||
|
|
|
@ -15,16 +15,7 @@
|
||||||
#include "game/effects/turn_180.h"
|
#include "game/effects/turn_180.h"
|
||||||
#include "global/vars.h"
|
#include "global/vars.h"
|
||||||
|
|
||||||
const char *ATIUserSettingsPath = "atiset.dat";
|
|
||||||
const char *T1MUserSettingsPath = "cfg/Tomb1Main_runtime.json5";
|
|
||||||
const char *T1MGlobalSettingsPath = "cfg/Tomb1Main.json5";
|
|
||||||
const char *T1MGameflowPath = "cfg/Tomb1Main_gameflow.json5";
|
|
||||||
const char *T1MGameflowGoldPath = "cfg/Tomb1Main_gameflow_ub.json5";
|
|
||||||
|
|
||||||
char *GameMemoryPointer = NULL;
|
char *GameMemoryPointer = NULL;
|
||||||
int8_t IsGameWindowActive = 1;
|
|
||||||
double UITextScale = 1.0;
|
|
||||||
double UIBarScale = 1.0;
|
|
||||||
TEXTSTRING *AmmoText = NULL;
|
TEXTSTRING *AmmoText = NULL;
|
||||||
TEXTSTRING *FPSText = NULL;
|
TEXTSTRING *FPSText = NULL;
|
||||||
int32_t FPSCounter = 0;
|
int32_t FPSCounter = 0;
|
||||||
|
@ -39,20 +30,17 @@ void (*EffectRoutines[])(ITEM_INFO *item) = {
|
||||||
bool SoundIsActive = true;
|
bool SoundIsActive = true;
|
||||||
int16_t SampleLUT[MAX_SAMPLES] = { 0 };
|
int16_t SampleLUT[MAX_SAMPLES] = { 0 };
|
||||||
SAMPLE_INFO *SampleInfos = NULL;
|
SAMPLE_INFO *SampleInfos = NULL;
|
||||||
SAMPLE_DATA **SampleData = NULL;
|
|
||||||
int32_t NumSampleData = 0;
|
int32_t NumSampleData = 0;
|
||||||
int16_t MusicTrack = 0;
|
int16_t MusicTrack = 0;
|
||||||
int16_t MusicTrackLooped = 0;
|
|
||||||
bool MusicLoop = false;
|
bool MusicLoop = false;
|
||||||
uint16_t MusicTrackFlags[MAX_CD_TRACKS] = { 0 };
|
uint16_t MusicTrackFlags[MAX_CD_TRACKS] = { 0 };
|
||||||
int32_t MnSoundMasterVolume = 32;
|
int32_t MnSoundMasterVolume = 32;
|
||||||
|
|
||||||
int32_t NoInputCount = 0;
|
int32_t NoInputCount = 0;
|
||||||
int32_t IDelay = 0;
|
bool IDelay = false;
|
||||||
int32_t IDCount = 0;
|
int32_t IDCount = 0;
|
||||||
INPUT_STATE Input = { 0 };
|
INPUT_STATE Input = { 0 };
|
||||||
INPUT_STATE InputDB = { 0 };
|
INPUT_STATE InputDB = { 0 };
|
||||||
int32_t KeyChange = 0;
|
|
||||||
int32_t OptionSelected = 0;
|
int32_t OptionSelected = 0;
|
||||||
|
|
||||||
int32_t PhdWinMaxX = 0;
|
int32_t PhdWinMaxX = 0;
|
||||||
|
@ -87,12 +75,10 @@ GAMEFLOW GF = { 0 };
|
||||||
LARA_INFO Lara = { 0 };
|
LARA_INFO Lara = { 0 };
|
||||||
ITEM_INFO *LaraItem = NULL;
|
ITEM_INFO *LaraItem = NULL;
|
||||||
CAMERA_INFO Camera = { 0 };
|
CAMERA_INFO Camera = { 0 };
|
||||||
bool CameraUnderwater = false;
|
|
||||||
SAVEGAME_INFO SaveGame = { 0 };
|
SAVEGAME_INFO SaveGame = { 0 };
|
||||||
int32_t SavedGamesCount = 0;
|
int32_t SavedGamesCount = 0;
|
||||||
int32_t SaveCounter = 0;
|
int32_t SaveCounter = 0;
|
||||||
int32_t CurrentLevel = -1;
|
int32_t CurrentLevel = -1;
|
||||||
int32_t DemoLevel = -1;
|
|
||||||
uint32_t *DemoPtr = NULL;
|
uint32_t *DemoPtr = NULL;
|
||||||
int32_t DemoCount = 0;
|
int32_t DemoCount = 0;
|
||||||
int32_t LevelComplete = 0;
|
int32_t LevelComplete = 0;
|
||||||
|
@ -125,8 +111,6 @@ uint16_t *Overlap = NULL;
|
||||||
int16_t *GroundZone[2] = { NULL };
|
int16_t *GroundZone[2] = { NULL };
|
||||||
int16_t *GroundZone2[2] = { NULL };
|
int16_t *GroundZone2[2] = { NULL };
|
||||||
int16_t *FlyZone[2] = { NULL };
|
int16_t *FlyZone[2] = { NULL };
|
||||||
int32_t SlotsUsed = 0;
|
|
||||||
CREATURE_INFO *BaddieSlots = NULL;
|
|
||||||
ANIM_STRUCT *Anims = NULL;
|
ANIM_STRUCT *Anims = NULL;
|
||||||
ANIM_CHANGE_STRUCT *AnimChanges = NULL;
|
ANIM_CHANGE_STRUCT *AnimChanges = NULL;
|
||||||
ANIM_RANGE_STRUCT *AnimRanges = NULL;
|
ANIM_RANGE_STRUCT *AnimRanges = NULL;
|
||||||
|
|
|
@ -37,33 +37,20 @@ extern RGB888 GamePalette[256];
|
||||||
extern bool ModeLock;
|
extern bool ModeLock;
|
||||||
|
|
||||||
extern int32_t NoInputCount;
|
extern int32_t NoInputCount;
|
||||||
extern int32_t IDelay;
|
extern bool IDelay;
|
||||||
extern int32_t IDCount;
|
extern int32_t IDCount;
|
||||||
extern INPUT_STATE Input;
|
extern INPUT_STATE Input;
|
||||||
extern INPUT_STATE InputDB;
|
extern INPUT_STATE InputDB;
|
||||||
extern int32_t KeyChange;
|
|
||||||
extern int32_t OptionSelected;
|
extern int32_t OptionSelected;
|
||||||
|
|
||||||
extern bool SoundIsActive;
|
extern bool SoundIsActive;
|
||||||
extern int16_t SampleLUT[MAX_SAMPLES];
|
extern int16_t SampleLUT[MAX_SAMPLES];
|
||||||
extern SAMPLE_INFO *SampleInfos;
|
extern SAMPLE_INFO *SampleInfos;
|
||||||
extern SAMPLE_DATA **SampleData;
|
|
||||||
extern int32_t NumSampleData;
|
|
||||||
extern int16_t MusicTrack;
|
extern int16_t MusicTrack;
|
||||||
extern int16_t MusicTrackLooped;
|
|
||||||
extern bool MusicLoop;
|
extern bool MusicLoop;
|
||||||
extern uint16_t MusicTrackFlags[MAX_CD_TRACKS];
|
extern uint16_t MusicTrackFlags[MAX_CD_TRACKS];
|
||||||
extern int32_t MnSoundMasterVolume;
|
extern int32_t MnSoundMasterVolume;
|
||||||
|
|
||||||
extern const char *ATIUserSettingsPath;
|
|
||||||
extern const char *T1MUserSettingsPath;
|
|
||||||
extern const char *T1MGlobalSettingsPath;
|
|
||||||
extern const char *T1MGameflowPath;
|
|
||||||
extern const char *T1MGameflowGoldPath;
|
|
||||||
|
|
||||||
extern int8_t IsGameWindowActive;
|
|
||||||
extern double UITextScale;
|
|
||||||
extern double UIBarScale;
|
|
||||||
extern TEXTSTRING *AmmoText;
|
extern TEXTSTRING *AmmoText;
|
||||||
extern TEXTSTRING *FPSText;
|
extern TEXTSTRING *FPSText;
|
||||||
extern int32_t FPSCounter;
|
extern int32_t FPSCounter;
|
||||||
|
@ -74,12 +61,10 @@ extern GAMEFLOW GF;
|
||||||
extern LARA_INFO Lara;
|
extern LARA_INFO Lara;
|
||||||
extern ITEM_INFO *LaraItem;
|
extern ITEM_INFO *LaraItem;
|
||||||
extern CAMERA_INFO Camera;
|
extern CAMERA_INFO Camera;
|
||||||
extern bool CameraUnderwater;
|
|
||||||
extern SAVEGAME_INFO SaveGame;
|
extern SAVEGAME_INFO SaveGame;
|
||||||
extern int32_t SavedGamesCount;
|
extern int32_t SavedGamesCount;
|
||||||
extern int32_t SaveCounter;
|
extern int32_t SaveCounter;
|
||||||
extern int32_t CurrentLevel;
|
extern int32_t CurrentLevel;
|
||||||
extern int32_t DemoLevel;
|
|
||||||
extern uint32_t *DemoPtr;
|
extern uint32_t *DemoPtr;
|
||||||
extern int32_t DemoCount;
|
extern int32_t DemoCount;
|
||||||
extern int32_t LevelComplete;
|
extern int32_t LevelComplete;
|
||||||
|
@ -109,8 +94,6 @@ extern uint16_t *Overlap;
|
||||||
extern int16_t *GroundZone[2];
|
extern int16_t *GroundZone[2];
|
||||||
extern int16_t *GroundZone2[2];
|
extern int16_t *GroundZone2[2];
|
||||||
extern int16_t *FlyZone[2];
|
extern int16_t *FlyZone[2];
|
||||||
extern int32_t SlotsUsed;
|
|
||||||
extern CREATURE_INFO *BaddieSlots;
|
|
||||||
extern ANIM_STRUCT *Anims;
|
extern ANIM_STRUCT *Anims;
|
||||||
extern ANIM_CHANGE_STRUCT *AnimChanges;
|
extern ANIM_CHANGE_STRUCT *AnimChanges;
|
||||||
extern ANIM_RANGE_STRUCT *AnimRanges;
|
extern ANIM_RANGE_STRUCT *AnimRanges;
|
||||||
|
|
|
@ -109,11 +109,11 @@ int32_t GetRenderScale(int32_t unit)
|
||||||
int32_t baseWidth = 640;
|
int32_t baseWidth = 640;
|
||||||
int32_t baseHeight = 480;
|
int32_t baseHeight = 480;
|
||||||
int32_t scale_x = PhdWinWidth > baseWidth
|
int32_t scale_x = PhdWinWidth > baseWidth
|
||||||
? ((double)PhdWinWidth * unit * UITextScale) / baseWidth
|
? ((double)PhdWinWidth * unit * T1MConfig.ui.text_scale) / baseWidth
|
||||||
: unit * UITextScale;
|
: unit * T1MConfig.ui.text_scale;
|
||||||
int32_t scale_y = PhdWinHeight > baseHeight
|
int32_t scale_y = PhdWinHeight > baseHeight
|
||||||
? ((double)PhdWinHeight * unit * UITextScale) / baseHeight
|
? ((double)PhdWinHeight * unit * T1MConfig.ui.text_scale) / baseHeight
|
||||||
: unit * UITextScale;
|
: unit * T1MConfig.ui.text_scale;
|
||||||
return MIN(scale_x, scale_y);
|
return MIN(scale_x, scale_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,8 @@ void BarLocation(
|
||||||
} else if (
|
} else if (
|
||||||
bar_location == T1M_BL_TOP_RIGHT
|
bar_location == T1M_BL_TOP_RIGHT
|
||||||
|| bar_location == T1M_BL_BOTTOM_RIGHT) {
|
|| bar_location == T1M_BL_BOTTOM_RIGHT) {
|
||||||
*x = GetRenderWidthDownscaled() - width * UIBarScale - screen_margin_h;
|
*x = GetRenderWidthDownscaled() - width * T1MConfig.ui.bar_scale
|
||||||
|
- screen_margin_h;
|
||||||
} else {
|
} else {
|
||||||
*x = (GetRenderWidthDownscaled() - width) / 2;
|
*x = (GetRenderWidthDownscaled() - width) / 2;
|
||||||
}
|
}
|
||||||
|
@ -138,8 +139,8 @@ void BarLocation(
|
||||||
|| bar_location == T1M_BL_TOP_RIGHT) {
|
|| bar_location == T1M_BL_TOP_RIGHT) {
|
||||||
*y = screen_margin_v + BarOffsetY[bar_location];
|
*y = screen_margin_v + BarOffsetY[bar_location];
|
||||||
} else {
|
} else {
|
||||||
*y = GetRenderHeightDownscaled() - height * UIBarScale - screen_margin_v
|
*y = GetRenderHeightDownscaled() - height * T1MConfig.ui.bar_scale
|
||||||
- BarOffsetY[bar_location];
|
- screen_margin_v - BarOffsetY[bar_location];
|
||||||
}
|
}
|
||||||
|
|
||||||
BarOffsetY[bar_location] += height + bar_spacing;
|
BarOffsetY[bar_location] += height + bar_spacing;
|
||||||
|
@ -182,8 +183,8 @@ void RenderBar(int32_t value, int32_t value_max, int32_t bar_type)
|
||||||
int32_t border = 1;
|
int32_t border = 1;
|
||||||
int32_t sx = GetRenderScale(x) - padding;
|
int32_t sx = GetRenderScale(x) - padding;
|
||||||
int32_t sy = GetRenderScale(y) - padding;
|
int32_t sy = GetRenderScale(y) - padding;
|
||||||
int32_t sw = GetRenderScale(width) * UIBarScale + padding * 2;
|
int32_t sw = GetRenderScale(width) * T1MConfig.ui.bar_scale + padding * 2;
|
||||||
int32_t sh = GetRenderScale(height) * UIBarScale + padding * 2;
|
int32_t sh = GetRenderScale(height) * T1MConfig.ui.bar_scale + padding * 2;
|
||||||
|
|
||||||
// border
|
// border
|
||||||
S_DrawScreenFlatQuad(
|
S_DrawScreenFlatQuad(
|
||||||
|
@ -204,8 +205,8 @@ void RenderBar(int32_t value, int32_t value_max, int32_t bar_type)
|
||||||
|
|
||||||
sx = GetRenderScale(x);
|
sx = GetRenderScale(x);
|
||||||
sy = GetRenderScale(y);
|
sy = GetRenderScale(y);
|
||||||
sw = GetRenderScale(width) * UIBarScale;
|
sw = GetRenderScale(width) * T1MConfig.ui.bar_scale;
|
||||||
sh = GetRenderScale(height) * UIBarScale;
|
sh = GetRenderScale(height) * T1MConfig.ui.bar_scale;
|
||||||
|
|
||||||
if (T1MConfig.enable_smooth_bars) {
|
if (T1MConfig.enable_smooth_bars) {
|
||||||
for (int i = 0; i < COLOR_STEPS - 1; i++) {
|
for (int i = 0; i < COLOR_STEPS - 1; i++) {
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
static const char *T1MGameflowPath = "cfg/Tomb1Main_gameflow.json5";
|
||||||
|
static const char *T1MGameflowGoldPath = "cfg/Tomb1Main_gameflow_ub.json5";
|
||||||
|
|
||||||
void GameMain()
|
void GameMain()
|
||||||
{
|
{
|
||||||
SoundIsActive = true;
|
SoundIsActive = true;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
static const char *ClassName = "TRClass";
|
static const char *ClassName = "TRClass";
|
||||||
static const char *WindowName = "Tomb Raider";
|
static const char *WindowName = "Tomb Raider";
|
||||||
static UINT CloseMsg = 0;
|
static UINT CloseMsg = 0;
|
||||||
|
static bool IsGameWindowActive = true;
|
||||||
|
|
||||||
static void WinGameFinish();
|
static void WinGameFinish();
|
||||||
static LRESULT CALLBACK
|
static LRESULT CALLBACK
|
||||||
|
|
|
@ -48,6 +48,9 @@ typedef struct WAVE_FILE_HEADER {
|
||||||
static DUPE_SOUND_BUFFER *DupeSoundBufferList = NULL;
|
static DUPE_SOUND_BUFFER *DupeSoundBufferList = NULL;
|
||||||
static int32_t DecibelLUT[DECIBEL_LUT_SIZE] = { 0 };
|
static int32_t DecibelLUT[DECIBEL_LUT_SIZE] = { 0 };
|
||||||
static int32_t MusicNumTracks = 0;
|
static int32_t MusicNumTracks = 0;
|
||||||
|
static int16_t MusicTrackLooped = 0;
|
||||||
|
extern int32_t NumSampleData;
|
||||||
|
static SAMPLE_DATA **SampleData = NULL;
|
||||||
|
|
||||||
int32_t ConvertVolumeToDecibel(int32_t volume)
|
int32_t ConvertVolumeToDecibel(int32_t volume)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue