mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-05-06 19:01:18 +03:00
g/shell: make S_Shell_Exit_* non-specific
This commit is contained in:
parent
8f50aca6f7
commit
f00afe1908
18 changed files with 89 additions and 87 deletions
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "log.h"
|
||||
#include "memory.h"
|
||||
#include "specific/s_shell.h"
|
||||
#include "specific/s_filesystem.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
#include "game/gamebuf.h"
|
||||
#include "game/items.h"
|
||||
#include "game/lot.h"
|
||||
#include "game/shell.h"
|
||||
#include "game/sound.h"
|
||||
#include "global/vars.h"
|
||||
#include "specific/s_shell.h"
|
||||
|
||||
void SetupStatue(OBJECT_INFO *obj)
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ void InitialiseStatue(int16_t item_num)
|
|||
|
||||
int16_t centaur_item_num = CreateItem();
|
||||
if (centaur_item_num == NO_ITEM) {
|
||||
S_Shell_ExitSystem("FATAL: Cannot create CENTAUR in STATUE");
|
||||
Shell_ExitSystem("FATAL: Cannot create CENTAUR in STATUE");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
#include "game/objects/puzzle_hole.h"
|
||||
#include "game/objects/switch.h"
|
||||
#include "game/pause.h"
|
||||
#include "game/shell.h"
|
||||
#include "game/sound.h"
|
||||
#include "game/traps/lava.h"
|
||||
#include "game/traps/movable_block.h"
|
||||
#include "global/const.h"
|
||||
#include "global/vars.h"
|
||||
#include "specific/s_shell.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
@ -697,7 +697,7 @@ int16_t GetHeight(FLOOR_INFO *floor, int32_t x, int32_t y, int32_t z)
|
|||
break;
|
||||
|
||||
default:
|
||||
S_Shell_ExitSystem("GetHeight(): Unknown type");
|
||||
Shell_ExitSystem("GetHeight(): Unknown type");
|
||||
break;
|
||||
}
|
||||
} while (!(type & END_BIT));
|
||||
|
@ -1139,7 +1139,7 @@ int16_t GetCeiling(FLOOR_INFO *floor, int32_t x, int32_t y, int32_t z)
|
|||
break;
|
||||
|
||||
default:
|
||||
S_Shell_ExitSystem("GetCeiling(): Unknown type");
|
||||
Shell_ExitSystem("GetCeiling(): Unknown type");
|
||||
break;
|
||||
}
|
||||
} while (!(type & END_BIT));
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
#include "game/savegame.h"
|
||||
#include "game/screen.h"
|
||||
#include "game/setup.h"
|
||||
#include "game/shell.h"
|
||||
#include "game/sound.h"
|
||||
#include "game/text.h"
|
||||
#include "global/const.h"
|
||||
#include "global/vars.h"
|
||||
#include "log.h"
|
||||
#include "specific/s_output.h"
|
||||
#include "specific/s_shell.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -213,7 +213,7 @@ int32_t S_LoadGame(SAVEGAME_INFO *save, int32_t slot)
|
|||
File_Read(&counter, sizeof(int32_t), 1, fp);
|
||||
|
||||
if (!save->start) {
|
||||
S_Shell_ExitSystem("null save->start");
|
||||
Shell_ExitSystem("null save->start");
|
||||
return 0;
|
||||
}
|
||||
File_Read(&save->start[0], sizeof(START_INFO), g_GameFlow.level_count, fp);
|
||||
|
@ -339,7 +339,7 @@ int32_t S_SaveGame(SAVEGAME_INFO *save, int32_t slot)
|
|||
File_Write(&g_SaveCounter, sizeof(int32_t), 1, fp);
|
||||
|
||||
if (!save->start) {
|
||||
S_Shell_ExitSystem("null save->start");
|
||||
Shell_ExitSystem("null save->start");
|
||||
return 0;
|
||||
}
|
||||
File_Write(&save->start[0], sizeof(START_INFO), g_GameFlow.level_count, fp);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "game/gamebuf.h"
|
||||
|
||||
#include "game/shell.h"
|
||||
#include "memory.h"
|
||||
#include "specific/s_shell.h"
|
||||
|
||||
#define MALLOC_SIZE 0x1000000 // 16 MB
|
||||
|
||||
|
@ -71,7 +71,7 @@ void *GameBuf_Alloc(int32_t alloc_size, GAME_BUFFER buffer)
|
|||
size_t aligned_size = (alloc_size + 3) & ~3;
|
||||
|
||||
if (aligned_size > m_GameAllocMemFree) {
|
||||
S_Shell_ExitSystemFmt(
|
||||
Shell_ExitSystemFmt(
|
||||
"GameBuf_Alloc(): OUT OF MEMORY %s %d",
|
||||
GameBuf_GetBufferName(buffer), aligned_size);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include "game/items.h"
|
||||
|
||||
#include "game/shell.h"
|
||||
#include "global/const.h"
|
||||
#include "global/vars.h"
|
||||
#include "specific/s_shell.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -124,7 +124,7 @@ void InitialiseItem(int16_t item_num)
|
|||
void RemoveActiveItem(int16_t item_num)
|
||||
{
|
||||
if (!g_Items[item_num].active) {
|
||||
S_Shell_ExitSystem("Item already deactive");
|
||||
Shell_ExitSystem("Item already deactive");
|
||||
}
|
||||
|
||||
g_Items[item_num].active = 0;
|
||||
|
@ -171,7 +171,7 @@ void AddActiveItem(int16_t item_num)
|
|||
}
|
||||
|
||||
if (item->active) {
|
||||
S_Shell_ExitSystemFmt(
|
||||
Shell_ExitSystemFmt(
|
||||
"Item(%d)(Obj%d) already Active\n", item_num, item->object_number);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,13 +8,13 @@
|
|||
#include "game/gameflow.h"
|
||||
#include "game/items.h"
|
||||
#include "game/setup.h"
|
||||
#include "game/shell.h"
|
||||
#include "game/sound.h"
|
||||
#include "game/viewport.h"
|
||||
#include "global/vars.h"
|
||||
#include "log.h"
|
||||
#include "memory.h"
|
||||
#include "specific/s_hwr.h"
|
||||
#include "specific/s_shell.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -61,14 +61,14 @@ static bool Level_LoadFromFile(const char *filename, int32_t level_num)
|
|||
GameBuf_Init();
|
||||
MYFILE *fp = File_Open(filename, FILE_OPEN_READ);
|
||||
if (!fp) {
|
||||
S_Shell_ExitSystemFmt(
|
||||
Shell_ExitSystemFmt(
|
||||
"Level_LoadFromFile(): Could not open %s", filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
File_Read(&version, sizeof(int32_t), 1, fp);
|
||||
if (version != 32) {
|
||||
S_Shell_ExitSystemFmt(
|
||||
Shell_ExitSystemFmt(
|
||||
"Level %d (%s) is version %d (this game code is version %d)",
|
||||
level_num, filename, version, 32);
|
||||
return false;
|
||||
|
@ -330,7 +330,7 @@ static bool Level_LoadObjects(MYFILE *fp)
|
|||
File_Read(&m_TextureCount, sizeof(int32_t), 1, fp);
|
||||
LOG_INFO("%d textures", m_TextureCount);
|
||||
if (m_TextureCount > MAX_TEXTURES) {
|
||||
S_Shell_ExitSystem("Too many Textures in level");
|
||||
Shell_ExitSystem("Too many Textures in level");
|
||||
return false;
|
||||
}
|
||||
File_Read(g_PhdTextureInfo, sizeof(PHD_TEXTURE), m_TextureCount, fp);
|
||||
|
@ -342,7 +342,7 @@ static bool Level_LoadSprites(MYFILE *fp)
|
|||
{
|
||||
File_Read(&m_SpriteInfoCount, sizeof(int32_t), 1, fp);
|
||||
if (m_SpriteInfoCount > MAX_SPRITES) {
|
||||
S_Shell_ExitSystem("Too many sprites in level");
|
||||
Shell_ExitSystem("Too many sprites in level");
|
||||
return false;
|
||||
}
|
||||
File_Read(&g_PhdSpriteInfo, sizeof(PHD_SPRITE), m_SpriteInfoCount, fp);
|
||||
|
@ -376,7 +376,7 @@ static bool Level_LoadItems(MYFILE *fp)
|
|||
|
||||
if (item_count) {
|
||||
if (item_count > MAX_ITEMS) {
|
||||
S_Shell_ExitSystem(
|
||||
Shell_ExitSystem(
|
||||
"Level_LoadItems(): Too Many g_Items being Loaded!!");
|
||||
return false;
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ static bool Level_LoadItems(MYFILE *fp)
|
|||
File_Read(&item->flags, sizeof(uint16_t), 1, fp);
|
||||
|
||||
if (item->object_number < 0 || item->object_number >= O_NUMBER_OF) {
|
||||
S_Shell_ExitSystemFmt(
|
||||
Shell_ExitSystemFmt(
|
||||
"Level_LoadItems(): Bad Object number (%d) on Item %d",
|
||||
item->object_number, i);
|
||||
}
|
||||
|
@ -465,14 +465,14 @@ static bool Level_LoadBoxes(MYFILE *fp)
|
|||
File_Read(&g_NumberBoxes, sizeof(int32_t), 1, fp);
|
||||
g_Boxes = GameBuf_Alloc(sizeof(BOX_INFO) * g_NumberBoxes, GBUF_BOXES);
|
||||
if (!File_Read(g_Boxes, sizeof(BOX_INFO), g_NumberBoxes, fp)) {
|
||||
S_Shell_ExitSystem("Level_LoadBoxes(): Unable to load boxes");
|
||||
Shell_ExitSystem("Level_LoadBoxes(): Unable to load boxes");
|
||||
return false;
|
||||
}
|
||||
|
||||
File_Read(&m_OverlapCount, sizeof(int32_t), 1, fp);
|
||||
g_Overlap = GameBuf_Alloc(sizeof(uint16_t) * m_OverlapCount, 22);
|
||||
if (!File_Read(g_Overlap, sizeof(uint16_t), m_OverlapCount, fp)) {
|
||||
S_Shell_ExitSystem("Level_LoadBoxes(): Unable to load box overlaps");
|
||||
Shell_ExitSystem("Level_LoadBoxes(): Unable to load box overlaps");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -482,8 +482,7 @@ static bool Level_LoadBoxes(MYFILE *fp)
|
|||
if (!g_GroundZone[i]
|
||||
|| !File_Read(
|
||||
g_GroundZone[i], sizeof(int16_t), g_NumberBoxes, fp)) {
|
||||
S_Shell_ExitSystem(
|
||||
"Level_LoadBoxes(): Unable to load 'ground_zone'");
|
||||
Shell_ExitSystem("Level_LoadBoxes(): Unable to load 'ground_zone'");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -492,7 +491,7 @@ static bool Level_LoadBoxes(MYFILE *fp)
|
|||
if (!g_GroundZone2[i]
|
||||
|| !File_Read(
|
||||
g_GroundZone2[i], sizeof(int16_t), g_NumberBoxes, fp)) {
|
||||
S_Shell_ExitSystem(
|
||||
Shell_ExitSystem(
|
||||
"Level_LoadBoxes(): Unable to load 'ground2_zone'");
|
||||
return false;
|
||||
}
|
||||
|
@ -501,7 +500,7 @@ static bool Level_LoadBoxes(MYFILE *fp)
|
|||
GameBuf_Alloc(sizeof(int16_t) * g_NumberBoxes, GBUF_FLYZONE);
|
||||
if (!g_FlyZone[i]
|
||||
|| !File_Read(g_FlyZone[i], sizeof(int16_t), g_NumberBoxes, fp)) {
|
||||
S_Shell_ExitSystem("Level_LoadBoxes(): Unable to load 'fly_zone'");
|
||||
Shell_ExitSystem("Level_LoadBoxes(): Unable to load 'fly_zone'");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -559,7 +558,7 @@ static bool Level_LoadSamples(MYFILE *fp)
|
|||
File_Read(&num_sample_infos, sizeof(int32_t), 1, fp);
|
||||
LOG_INFO("%d sample infos", num_sample_infos);
|
||||
if (!num_sample_infos) {
|
||||
S_Shell_ExitSystem("No Sample Infos");
|
||||
Shell_ExitSystem("No Sample Infos");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -571,7 +570,7 @@ static bool Level_LoadSamples(MYFILE *fp)
|
|||
File_Read(&sample_data_size, sizeof(int32_t), 1, fp);
|
||||
LOG_INFO("%d sample data size", sample_data_size);
|
||||
if (!sample_data_size) {
|
||||
S_Shell_ExitSystem("No Sample Data");
|
||||
Shell_ExitSystem("No Sample Data");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -582,7 +581,7 @@ static bool Level_LoadSamples(MYFILE *fp)
|
|||
File_Read(&num_samples, sizeof(int32_t), 1, fp);
|
||||
LOG_INFO("%d samples", num_samples);
|
||||
if (!num_samples) {
|
||||
S_Shell_ExitSystem("No Samples");
|
||||
Shell_ExitSystem("No Samples");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "game/lot.h"
|
||||
|
||||
#include "game/gamebuf.h"
|
||||
#include "game/shell.h"
|
||||
#include "global/const.h"
|
||||
#include "global/vars.h"
|
||||
#include "specific/s_shell.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
@ -48,7 +48,7 @@ int32_t EnableBaddieAI(int16_t item_num, int32_t always)
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
S_Shell_ExitSystem("UnpauseBaddie() grimmer!");
|
||||
Shell_ExitSystem("UnpauseBaddie() grimmer!");
|
||||
}
|
||||
|
||||
int32_t worst_dist = 0;
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
#include "game/lot.h"
|
||||
#include "game/objects/pickup.h"
|
||||
#include "game/objects/puzzle_hole.h"
|
||||
#include "game/shell.h"
|
||||
#include "game/traps/movable_block.h"
|
||||
#include "game/traps/rolling_block.h"
|
||||
#include "global/const.h"
|
||||
#include "global/vars.h"
|
||||
#include "specific/s_shell.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
@ -454,7 +454,7 @@ void WriteSG(void *pointer, int size)
|
|||
{
|
||||
m_SGCount += size;
|
||||
if (m_SGCount >= MAX_SAVEGAME_BUFFER) {
|
||||
S_Shell_ExitSystem("FATAL: Savegame is too big to fit in buffer");
|
||||
Shell_ExitSystem("FATAL: Savegame is too big to fit in buffer");
|
||||
}
|
||||
|
||||
char *data = (char *)pointer;
|
||||
|
|
|
@ -76,7 +76,7 @@ void Shell_Main()
|
|||
Shell_CalculateWibbleTable();
|
||||
|
||||
if (!HWR_Init()) {
|
||||
S_Shell_ExitSystem("Could not initialise video system");
|
||||
Shell_ExitSystem("Could not initialise video system");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ void Shell_Main()
|
|||
FMV_Init();
|
||||
|
||||
if (!GameFlow_LoadFromFile(gameflow_path)) {
|
||||
S_Shell_ExitSystem("MAIN: unable to load script file");
|
||||
Shell_ExitSystem("MAIN: unable to load script file");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ void Shell_Main()
|
|||
break;
|
||||
|
||||
default:
|
||||
S_Shell_ExitSystemFmt(
|
||||
Shell_ExitSystemFmt(
|
||||
"MAIN: Unknown request %x %d", gf_direction, gf_param);
|
||||
return;
|
||||
}
|
||||
|
@ -169,6 +169,26 @@ void Shell_Main()
|
|||
Settings_Write();
|
||||
}
|
||||
|
||||
void Shell_ExitSystem(const char *message)
|
||||
{
|
||||
while (g_Input.select) {
|
||||
Input_Update();
|
||||
}
|
||||
GameBuf_Shutdown();
|
||||
HWR_Shutdown();
|
||||
S_Shell_ShowFatalError(message);
|
||||
}
|
||||
|
||||
void Shell_ExitSystemFmt(const char *fmt, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
char message[150];
|
||||
vsnprintf(message, 150, fmt, va);
|
||||
va_end(va);
|
||||
Shell_ExitSystem(message);
|
||||
}
|
||||
|
||||
void Shell_Wait(int nticks)
|
||||
{
|
||||
for (int i = 0; i < nticks; i++) {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#define T1M_GAME_SHELL_H
|
||||
|
||||
void Shell_Main();
|
||||
void Shell_ExitSystem(const char *message);
|
||||
void Shell_ExitSystemFmt(const char *fmt, ...);
|
||||
void Shell_Wait(int nticks);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include "game/sound.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "3dsystem/phd_math.h"
|
||||
#include "game/random.h"
|
||||
#include "game/shell.h"
|
||||
#include "global/vars.h"
|
||||
#include "log.h"
|
||||
#include "specific/s_audio.h"
|
||||
#include "specific/s_shell.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <math.h>
|
||||
|
@ -474,7 +474,7 @@ void Sound_ResetEffects()
|
|||
}
|
||||
SAMPLE_INFO *s = &g_SampleInfos[g_SampleLUT[i]];
|
||||
if (s->volume < 0) {
|
||||
S_Shell_ExitSystemFmt(
|
||||
Shell_ExitSystemFmt(
|
||||
"sample info for effect %d has incorrect volume(%d)", i,
|
||||
s->volume);
|
||||
}
|
||||
|
@ -482,8 +482,8 @@ void Sound_ResetEffects()
|
|||
int32_t mode = s->flags & 3;
|
||||
if (mode == SOUND_MODE_AMBIENT) {
|
||||
if (m_AmbientLookupIdx >= MAX_AMBIENT_FX) {
|
||||
S_Shell_ExitSystem("Ran out of ambient fx slots in "
|
||||
"Sound_ResetEffects()");
|
||||
Shell_ExitSystem("Ran out of ambient fx slots in "
|
||||
"Sound_ResetEffects()");
|
||||
}
|
||||
m_AmbientLookup[m_AmbientLookupIdx] = i;
|
||||
m_AmbientLookupIdx++;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "memory.h"
|
||||
|
||||
#include "specific/s_shell.h"
|
||||
#include "game/shell.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -9,7 +9,7 @@ void *Memory_Alloc(size_t size)
|
|||
{
|
||||
void *result = malloc(size);
|
||||
if (!result) {
|
||||
S_Shell_ExitSystem("ERROR: Could not allocate enough memory");
|
||||
Shell_ExitSystem("ERROR: Could not allocate enough memory");
|
||||
}
|
||||
memset(result, 0, size);
|
||||
return result;
|
||||
|
@ -19,7 +19,7 @@ void *Memory_Realloc(void *memory, size_t size)
|
|||
{
|
||||
void *result = realloc(memory, size);
|
||||
if (!result) {
|
||||
S_Shell_ExitSystem("ERROR: Could not allocate enough memory");
|
||||
Shell_ExitSystem("ERROR: Could not allocate enough memory");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#define S_AUDIO_IMPL
|
||||
#include "specific/s_audio.h"
|
||||
|
||||
#include "game/shell.h"
|
||||
#include "log.h"
|
||||
#include "memory.h"
|
||||
#include "specific/s_shell.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <libavcodec/avcodec.h>
|
||||
|
@ -408,7 +408,7 @@ bool S_Audio_SamplesLoad(size_t count, const char **contents, size_t *sizes)
|
|||
}
|
||||
|
||||
if (count > MAX_SAMPLES) {
|
||||
S_Shell_ExitSystemFmt(
|
||||
Shell_ExitSystemFmt(
|
||||
"Trying to load too many samples (maximum supported count: %d)",
|
||||
MAX_SAMPLES);
|
||||
return false;
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
#include "3dsystem/3d_gen.h"
|
||||
#include "config.h"
|
||||
#include "game/screen.h"
|
||||
#include "game/shell.h"
|
||||
#include "game/viewport.h"
|
||||
#include "global/vars.h"
|
||||
#include "global/vars_platform.h"
|
||||
#include "log.h"
|
||||
#include "specific/s_ati.h"
|
||||
#include "specific/s_shell.h"
|
||||
|
||||
#include "ati3dcif/Interop.hpp"
|
||||
#include "ddraw/Interop.hpp"
|
||||
|
@ -20,7 +20,7 @@
|
|||
{ \
|
||||
if (result != DD_OK) { \
|
||||
LOG_ERROR("DirectDraw error code %x", result); \
|
||||
S_Shell_ExitSystem("Fatal DirectDraw error!"); \
|
||||
Shell_ExitSystem("Fatal DirectDraw error!"); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
@ -1606,13 +1606,13 @@ void HWR_DownloadTextures(int32_t pages)
|
|||
pages);
|
||||
|
||||
if (pages > MAX_TEXTPAGES) {
|
||||
S_Shell_ExitSystem("Attempt to download more than texture page limit");
|
||||
Shell_ExitSystem("Attempt to download more than texture page limit");
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_TEXTPAGES; i++) {
|
||||
if (m_ATITextureMap[i]) {
|
||||
if (ATI3DCIF_TextureUnreg(m_ATITextureMap[i])) {
|
||||
S_Shell_ExitSystem("ERROR: Could not unregister texture");
|
||||
Shell_ExitSystem("ERROR: Could not unregister texture");
|
||||
}
|
||||
m_ATITextureMap[i] = 0;
|
||||
}
|
||||
|
@ -1623,13 +1623,13 @@ void HWR_DownloadTextures(int32_t pages)
|
|||
LOG_INFO(" Resetting texture palette handle");
|
||||
if (m_ATITexturePalette) {
|
||||
if (ATI3DCIF_TexturePaletteDestroy(m_ATITexturePalette)) {
|
||||
S_Shell_ExitSystem("ERROR: Cannot release old texture palette");
|
||||
Shell_ExitSystem("ERROR: Cannot release old texture palette");
|
||||
}
|
||||
m_ATITexturePalette = NULL;
|
||||
}
|
||||
if (ATI3DCIF_TexturePaletteCreate(
|
||||
C3D_ECI_TMAP_8BIT, m_ATIPalette, &m_ATITexturePalette)) {
|
||||
S_Shell_ExitSystem("ERROR: Cannot create texture palette");
|
||||
Shell_ExitSystem("ERROR: Cannot create texture palette");
|
||||
}
|
||||
m_IsPaletteActive = false;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "config.h"
|
||||
#include "game/inv.h"
|
||||
#include "game/lara.h"
|
||||
#include "game/shell.h"
|
||||
#include "global/vars.h"
|
||||
#include "global/vars_platform.h"
|
||||
#include "log.h"
|
||||
|
@ -95,11 +96,11 @@ S_Input_EnumCallback(LPCDIDEVICEINSTANCE instance, LPVOID context);
|
|||
void S_Input_Init()
|
||||
{
|
||||
if (!S_Input_DInput_Create()) {
|
||||
S_Shell_ExitSystem("Fatal DirectInput error!");
|
||||
Shell_ExitSystem("Fatal DirectInput error!");
|
||||
}
|
||||
|
||||
if (!S_Input_DInput_KeyboardCreate()) {
|
||||
S_Shell_ExitSystem("Fatal DirectInput error!");
|
||||
Shell_ExitSystem("Fatal DirectInput error!");
|
||||
}
|
||||
|
||||
if (g_Config.enable_xbox_one_controller) {
|
||||
|
|
|
@ -23,7 +23,6 @@ static char **m_ArgStrings = NULL;
|
|||
static bool m_Fullscreen = true;
|
||||
static SDL_Window *m_Window = NULL;
|
||||
|
||||
static void S_Shell_ShowFatalError(const char *message);
|
||||
static void S_Shell_PostWindowResize();
|
||||
|
||||
void S_Shell_SeedRandom()
|
||||
|
@ -34,14 +33,6 @@ void S_Shell_SeedRandom()
|
|||
Random_SeedDraw(tptr->tm_sec + 43 * tptr->tm_min + 3477 * tptr->tm_hour);
|
||||
}
|
||||
|
||||
static void S_Shell_ShowFatalError(const char *message)
|
||||
{
|
||||
LOG_ERROR("%s", message);
|
||||
MessageBoxA(
|
||||
0, message, "Tomb Raider Error", MB_SETFOREGROUND | MB_ICONEXCLAMATION);
|
||||
S_Shell_TerminateGame(1);
|
||||
}
|
||||
|
||||
static void S_Shell_PostWindowResize()
|
||||
{
|
||||
int width;
|
||||
|
@ -50,6 +41,14 @@ static void S_Shell_PostWindowResize()
|
|||
HWR_SetViewport(width, height);
|
||||
}
|
||||
|
||||
void S_Shell_ShowFatalError(const char *message)
|
||||
{
|
||||
LOG_ERROR("%s", message);
|
||||
MessageBoxA(
|
||||
0, message, "Tomb Raider Error", MB_SETFOREGROUND | MB_ICONEXCLAMATION);
|
||||
S_Shell_TerminateGame(1);
|
||||
}
|
||||
|
||||
void S_Shell_ToggleFullscreen()
|
||||
{
|
||||
m_Fullscreen = !m_Fullscreen;
|
||||
|
@ -116,7 +115,9 @@ int main(int argc, char **argv)
|
|||
m_ArgStrings = argv;
|
||||
|
||||
if (SDL_Init(SDL_INIT_EVENTS) < 0) {
|
||||
S_Shell_ExitSystemFmt("Cannot initialize SDL: %s", SDL_GetError());
|
||||
char buf[256];
|
||||
sprintf(buf, "Cannot initialize SDL: %s", SDL_GetError());
|
||||
S_Shell_ShowFatalError(buf);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -151,26 +152,6 @@ int main(int argc, char **argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void S_Shell_ExitSystem(const char *message)
|
||||
{
|
||||
while (g_Input.select) {
|
||||
Input_Update();
|
||||
}
|
||||
GameBuf_Shutdown();
|
||||
HWR_Shutdown();
|
||||
S_Shell_ShowFatalError(message);
|
||||
}
|
||||
|
||||
void S_Shell_ExitSystemFmt(const char *fmt, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
char message[150];
|
||||
vsnprintf(message, 150, fmt, va);
|
||||
va_end(va);
|
||||
S_Shell_ExitSystem(message);
|
||||
}
|
||||
|
||||
bool S_Shell_GetCommandLine(int *arg_count, char ***args)
|
||||
{
|
||||
*arg_count = m_ArgCount;
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
void S_Shell_ShowFatalError(const char *message);
|
||||
|
||||
void S_Shell_SeedRandom();
|
||||
void S_Shell_ExitSystem(const char *message);
|
||||
void S_Shell_ExitSystemFmt(const char *fmt, ...);
|
||||
void S_Shell_SpinMessageLoop();
|
||||
bool S_Shell_GetCommandLine(int *arg_count, char ***args);
|
||||
void *S_Shell_GetWindowHandle();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue