mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-05-06 19:01:18 +03:00
g/screen: rename functions
This commit is contained in:
parent
a77fecd5f0
commit
ea98a91edf
13 changed files with 61 additions and 58 deletions
|
@ -124,7 +124,7 @@ void LevelStats(int32_t level_num)
|
|||
char time_str[100];
|
||||
TEXTSTRING *txt;
|
||||
|
||||
TempVideoAdjust(GetScreenSizeIdx());
|
||||
Screen_SetResolution(Screen_GetResIdx());
|
||||
Text_RemoveAll();
|
||||
|
||||
// heading
|
||||
|
@ -222,7 +222,7 @@ void LevelStats(int32_t level_num)
|
|||
|
||||
SaveGame.start[CurrentLevel].available = 0;
|
||||
S_FadeToBlack();
|
||||
TempVideoRemove();
|
||||
Screen_RestoreResolution();
|
||||
}
|
||||
|
||||
int32_t S_LoadGame(SAVEGAME_INFO *save, int32_t slot)
|
||||
|
@ -276,7 +276,7 @@ int32_t S_LoadGame(SAVEGAME_INFO *save, int32_t slot)
|
|||
|
||||
void GetSavedGamesList(REQUEST_INFO *req)
|
||||
{
|
||||
int32_t height = GetScreenHeight();
|
||||
int32_t height = Screen_GetResHeight();
|
||||
|
||||
if (height <= 200) {
|
||||
req->y = -32;
|
||||
|
|
|
@ -1049,7 +1049,7 @@ GF_InterpretSequence(int32_t level_num, GAMEFLOW_LEVEL_TYPE level_type)
|
|||
case GFS_DISPLAY_PICTURE:
|
||||
if (level_type != GFL_SAVED) {
|
||||
GAME_FLOW_DISPLAY_PICTURE_DATA *data = seq->data;
|
||||
TempVideoAdjust(2);
|
||||
Screen_SetResolution(2);
|
||||
S_DisplayPicture(data->path);
|
||||
S_InitialisePolyList();
|
||||
S_CopyBufferToScreen();
|
||||
|
|
|
@ -708,7 +708,7 @@ void Construct_Inventory()
|
|||
{
|
||||
S_SetupAboveWater(false);
|
||||
if (InvMode != INV_TITLE_MODE) {
|
||||
TempVideoAdjust(GetScreenSizeIdx());
|
||||
Screen_SetResolution(Screen_GetResIdx());
|
||||
}
|
||||
|
||||
PhdLeft = 0;
|
||||
|
|
|
@ -690,7 +690,8 @@ void DoDetailOption(INVENTORY_ITEM *inv_item)
|
|||
y += DETAIL_HW_ROW_HEIGHT;
|
||||
|
||||
char tmp[10];
|
||||
sprintf(tmp, "%dx%d", GetGameScreenWidth(), GetGameScreenHeight());
|
||||
sprintf(
|
||||
tmp, "%dx%d", Screen_GetGameResWidth(), Screen_GetGameResHeight());
|
||||
sprintf(buf, GF.strings[GS_DETAIL_VIDEO_MODE_FMT], tmp);
|
||||
DetailTextHW[DETAIL_HW_RESOLUTION] = Text_Create(0, y, buf);
|
||||
y += DETAIL_HW_ROW_HEIGHT;
|
||||
|
@ -779,7 +780,7 @@ void DoDetailOption(INVENTORY_ITEM *inv_item)
|
|||
break;
|
||||
|
||||
case DETAIL_HW_RESOLUTION:
|
||||
if (SetNextGameScreenSize()) {
|
||||
if (Screen_SetNextGameRes()) {
|
||||
reset = true;
|
||||
}
|
||||
break;
|
||||
|
@ -824,7 +825,7 @@ void DoDetailOption(INVENTORY_ITEM *inv_item)
|
|||
break;
|
||||
|
||||
case DETAIL_HW_RESOLUTION:
|
||||
if (SetPrevGameScreenSize()) {
|
||||
if (Screen_SetPrevGameRes()) {
|
||||
reset = true;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -150,7 +150,7 @@ static void Overlay_DrawBar(int32_t value, int32_t value_max, int32_t bar_type)
|
|||
bar_color = T1MConfig.enemy_healthbar_color;
|
||||
}
|
||||
|
||||
int32_t padding = GetScreenWidth() <= 800 ? 1 : 2;
|
||||
int32_t padding = Screen_GetResWidth() <= 800 ? 1 : 2;
|
||||
int32_t border = 1;
|
||||
int32_t sx = GetRenderScale(x) - padding;
|
||||
int32_t sy = GetRenderScale(y) - padding;
|
||||
|
|
|
@ -149,7 +149,7 @@ int8_t S_Pause()
|
|||
|
||||
Text_RemoveAll();
|
||||
S_FadeInInventory(1);
|
||||
TempVideoAdjust(GetScreenSizeIdx());
|
||||
Screen_SetResolution(Screen_GetResIdx());
|
||||
S_SetupAboveWater(false);
|
||||
|
||||
Music_Pause();
|
||||
|
@ -159,7 +159,7 @@ int8_t S_Pause()
|
|||
Music_Unpause();
|
||||
RemoveRequester(&PauseRequester);
|
||||
RemovePausedText();
|
||||
TempVideoRemove();
|
||||
Screen_RestoreResolution();
|
||||
S_FadeOutInventory(1);
|
||||
OverlayFlag = old_overlay_flag;
|
||||
return select < 0;
|
||||
|
|
|
@ -13,7 +13,16 @@ static int32_t m_HiRes = 0;
|
|||
// and the like.
|
||||
static int32_t m_GameHiRes = 0;
|
||||
|
||||
bool SetGameScreenSizeIdx(int32_t idx)
|
||||
void Screen_SetupSize()
|
||||
{
|
||||
int32_t width = Screen_GetResWidth();
|
||||
int32_t height = Screen_GetResHeight();
|
||||
int32_t x = (width - width) / 2;
|
||||
int32_t y = (height - height) / 2;
|
||||
phd_InitWindow(x, y, width, height);
|
||||
}
|
||||
|
||||
bool Screen_SetGameResIdx(int32_t idx)
|
||||
{
|
||||
if (idx >= 0 && idx < RESOLUTIONS_SIZE) {
|
||||
m_GameHiRes = idx;
|
||||
|
@ -22,7 +31,7 @@ bool SetGameScreenSizeIdx(int32_t idx)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool SetPrevGameScreenSize()
|
||||
bool Screen_SetPrevGameRes()
|
||||
{
|
||||
if (m_GameHiRes - 1 >= 0) {
|
||||
m_GameHiRes--;
|
||||
|
@ -31,7 +40,7 @@ bool SetPrevGameScreenSize()
|
|||
return false;
|
||||
}
|
||||
|
||||
bool SetNextGameScreenSize()
|
||||
bool Screen_SetNextGameRes()
|
||||
{
|
||||
if (m_GameHiRes + 1 < RESOLUTIONS_SIZE) {
|
||||
m_GameHiRes++;
|
||||
|
@ -40,46 +49,37 @@ bool SetNextGameScreenSize()
|
|||
return false;
|
||||
}
|
||||
|
||||
int32_t GetGameScreenSizeIdx()
|
||||
int32_t Screen_GetGameResIdx()
|
||||
{
|
||||
return m_GameHiRes;
|
||||
}
|
||||
|
||||
int32_t GetGameScreenWidth()
|
||||
int32_t Screen_GetGameResWidth()
|
||||
{
|
||||
return AvailableResolutions[m_GameHiRes].width;
|
||||
}
|
||||
|
||||
int32_t GetGameScreenHeight()
|
||||
int32_t Screen_GetGameResHeight()
|
||||
{
|
||||
return AvailableResolutions[m_GameHiRes].height;
|
||||
}
|
||||
|
||||
int32_t GetScreenSizeIdx()
|
||||
int32_t Screen_GetResIdx()
|
||||
{
|
||||
return m_HiRes;
|
||||
}
|
||||
|
||||
int32_t GetScreenWidth()
|
||||
int32_t Screen_GetResWidth()
|
||||
{
|
||||
return AvailableResolutions[m_HiRes].width;
|
||||
}
|
||||
|
||||
int32_t GetScreenHeight()
|
||||
int32_t Screen_GetResHeight()
|
||||
{
|
||||
return AvailableResolutions[m_HiRes].height;
|
||||
}
|
||||
|
||||
void SetupScreenSize()
|
||||
{
|
||||
int32_t width = GetScreenWidth();
|
||||
int32_t height = GetScreenHeight();
|
||||
int32_t x = (width - width) / 2;
|
||||
int32_t y = (height - height) / 2;
|
||||
phd_InitWindow(x, y, width, height);
|
||||
}
|
||||
|
||||
void TempVideoAdjust(int32_t hi_res)
|
||||
void Screen_SetResolution(int32_t hi_res)
|
||||
{
|
||||
ModeLock = true;
|
||||
if (hi_res == m_HiRes) {
|
||||
|
@ -90,7 +90,7 @@ void TempVideoAdjust(int32_t hi_res)
|
|||
HWR_SwitchResolution();
|
||||
}
|
||||
|
||||
void TempVideoRemove()
|
||||
void Screen_RestoreResolution()
|
||||
{
|
||||
ModeLock = false;
|
||||
if (m_GameHiRes == m_HiRes) {
|
||||
|
|
|
@ -4,18 +4,20 @@
|
|||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
void SetupScreenSize();
|
||||
bool SetGameScreenSizeIdx(int32_t idx);
|
||||
bool SetPrevGameScreenSize();
|
||||
bool SetNextGameScreenSize();
|
||||
int32_t GetGameScreenSizeIdx();
|
||||
int32_t GetGameScreenWidth();
|
||||
int32_t GetGameScreenHeight();
|
||||
int32_t GetScreenSizeIdx();
|
||||
int32_t GetScreenWidth();
|
||||
int32_t GetScreenHeight();
|
||||
void Screen_SetupSize();
|
||||
|
||||
void TempVideoAdjust(int32_t hi_res);
|
||||
void TempVideoRemove();
|
||||
bool Screen_SetGameResIdx(int32_t idx);
|
||||
bool Screen_SetPrevGameRes();
|
||||
bool Screen_SetNextGameRes();
|
||||
int32_t Screen_GetGameResIdx();
|
||||
int32_t Screen_GetGameResWidth();
|
||||
int32_t Screen_GetGameResHeight();
|
||||
|
||||
int32_t Screen_GetResIdx();
|
||||
int32_t Screen_GetResWidth();
|
||||
int32_t Screen_GetResHeight();
|
||||
|
||||
void Screen_SetResolution(int32_t hi_res);
|
||||
void Screen_RestoreResolution();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -49,7 +49,7 @@ static int32_t S_ReadUserSettingsATI()
|
|||
int32_t resolution_idx;
|
||||
File_Read(&resolution_idx, sizeof(int32_t), 1, fp);
|
||||
CLAMP(resolution_idx, 0, RESOLUTIONS_SIZE - 1);
|
||||
SetGameScreenSizeIdx(resolution_idx);
|
||||
Screen_SetGameResIdx(resolution_idx);
|
||||
}
|
||||
|
||||
// Skip GameSizer from TombATI, which is no longer used in T1M.
|
||||
|
@ -98,7 +98,7 @@ static int32_t S_ReadUserSettingsT1MFromJson(const char *cfg_data)
|
|||
int32_t resolution_idx = json_object_get_number_int(
|
||||
root_obj, "hi_res", RESOLUTIONS_SIZE - 1);
|
||||
CLAMP(resolution_idx, 0, RESOLUTIONS_SIZE - 1);
|
||||
SetGameScreenSizeIdx(resolution_idx);
|
||||
Screen_SetGameResIdx(resolution_idx);
|
||||
}
|
||||
|
||||
T1MConfig.music_volume =
|
||||
|
@ -184,7 +184,7 @@ static int32_t S_WriteUserSettingsT1M()
|
|||
root_obj, "bilinear", T1MConfig.render_flags.bilinear);
|
||||
json_object_append_bool(
|
||||
root_obj, "perspective", T1MConfig.render_flags.perspective);
|
||||
json_object_append_number_int(root_obj, "hi_res", GetGameScreenSizeIdx());
|
||||
json_object_append_number_int(root_obj, "hi_res", Screen_GetGameResIdx());
|
||||
json_object_append_number_int(
|
||||
root_obj, "music_volume", T1MConfig.music_volume);
|
||||
json_object_append_number_int(
|
||||
|
|
|
@ -102,7 +102,7 @@ int32_t InitialiseLevel(int32_t level_num, GAMEFLOW_LEVEL_TYPE level_type)
|
|||
|
||||
Lara.item_number = NO_ITEM;
|
||||
if (level_num != GF.title_level_num) {
|
||||
TempVideoRemove();
|
||||
Screen_RestoreResolution();
|
||||
}
|
||||
|
||||
if (!S_LoadLevel(CurrentLevel)) {
|
||||
|
|
|
@ -89,7 +89,7 @@ void Shell_Main()
|
|||
S_FrontEndCheck();
|
||||
S_ReadUserSettings();
|
||||
|
||||
TempVideoAdjust(2);
|
||||
Screen_SetResolution(2);
|
||||
S_DisplayPicture("data\\eidospc");
|
||||
S_InitialisePolyList();
|
||||
S_CopyBufferToScreen();
|
||||
|
@ -107,7 +107,7 @@ void Shell_Main()
|
|||
|
||||
bool loop_continue = true;
|
||||
while (loop_continue) {
|
||||
TempVideoRemove();
|
||||
Screen_RestoreResolution();
|
||||
int32_t gf_direction = gf_option & ~((1 << 6) - 1);
|
||||
int32_t gf_param = gf_option & ((1 << 6) - 1);
|
||||
LOG_INFO("%d %d", gf_direction, gf_param);
|
||||
|
@ -136,7 +136,7 @@ void Shell_Main()
|
|||
|
||||
case GF_EXIT_TO_TITLE:
|
||||
Text_RemoveAll();
|
||||
TempVideoAdjust(2);
|
||||
Screen_SetResolution(2);
|
||||
S_DisplayPicture("data\\titleh");
|
||||
NoInputCount = 0;
|
||||
if (!InitialiseLevel(GF.title_level_num, GFL_TITLE)) {
|
||||
|
|
|
@ -119,7 +119,7 @@ void S_DrawScreenSprite2d(
|
|||
void S_FinishInventory()
|
||||
{
|
||||
if (InvMode != INV_TITLE_MODE) {
|
||||
TempVideoRemove();
|
||||
Screen_RestoreResolution();
|
||||
}
|
||||
ModeLock = false;
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ int32_t S_PlayFMV(int32_t sequence, int32_t mode)
|
|||
{
|
||||
GameBuf_Shutdown();
|
||||
|
||||
TempVideoAdjust(2);
|
||||
Screen_SetResolution(2);
|
||||
HWR_PrepareFMV();
|
||||
|
||||
int32_t ret = WinPlayFMV(sequence, mode);
|
||||
|
@ -255,7 +255,7 @@ int32_t S_PlayFMV(int32_t sequence, int32_t mode)
|
|||
GameBuf_Init();
|
||||
|
||||
HWR_FMVDone();
|
||||
TempVideoRemove();
|
||||
Screen_RestoreResolution();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -1031,7 +1031,7 @@ void HWR_FadeWait()
|
|||
void HWR_SwitchResolution()
|
||||
{
|
||||
HWR_SetHardwareVideoMode();
|
||||
SetupScreenSize();
|
||||
Screen_SetupSize();
|
||||
}
|
||||
|
||||
int32_t HWR_SetHardwareVideoMode()
|
||||
|
@ -1042,12 +1042,12 @@ int32_t HWR_SetHardwareVideoMode()
|
|||
LOG_INFO("SetHardwareVideoMode:");
|
||||
HWR_ReleaseSurfaces();
|
||||
|
||||
DDrawSurfaceWidth = GetScreenWidth();
|
||||
DDrawSurfaceHeight = GetScreenHeight();
|
||||
DDrawSurfaceWidth = Screen_GetResWidth();
|
||||
DDrawSurfaceHeight = Screen_GetResHeight();
|
||||
DDrawSurfaceMinX = 0.0f;
|
||||
DDrawSurfaceMinY = 0.0f;
|
||||
DDrawSurfaceMaxX = GetScreenWidth() - 1.0f;
|
||||
DDrawSurfaceMaxY = GetScreenHeight() - 1.0f;
|
||||
DDrawSurfaceMaxX = Screen_GetResWidth() - 1.0f;
|
||||
DDrawSurfaceMaxY = Screen_GetResHeight() - 1.0f;
|
||||
|
||||
LOG_INFO(" Switching to %dx%d", DDrawSurfaceWidth, DDrawSurfaceHeight);
|
||||
result = IDirectDraw_SetDisplayMode(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue