adds missing fatalerror constant usage

This commit is contained in:
Dethrace Labs 2025-05-11 14:06:05 +12:00
parent bcbecb372b
commit 51c839f07f
12 changed files with 1233 additions and 32 deletions

View File

@ -164,21 +164,18 @@ target_sources(dethrace_obj PRIVATE
# dethrace-added cross platform sys and network implementation
pc-all/allnet.c
# added in future PR
# pc-all/allsys.c
pc-all/allsys.c
# original win95 sys and network
# pc-win95/win95sys.c
# pc-win95/ssdx.c
# pc-win95/ssdx.h
# todo remove from normal compile
pc-win95/dinput.h
# original dos sys and network
#pc-dos/dosnet.c
# todo remove from normal compile
pc-dos/dossys.c
# pc-dos/dossys.c
)
# Create our main game binary.

View File

@ -234,7 +234,7 @@ void DeviouslyDimRectangle(br_pixelmap* pPixelmap, int pLeft, int pTop, int pRig
LOG_TRACE("(%p, %d, %d, %d, %d, %d)", pPixelmap, pLeft, pTop, pRight, pBottom, pKnock_out_corners);
if (pPixelmap != gBack_screen) {
FatalError(124);
FatalError(kFatalError_CanOnlyDimRectanglesOfgBack_screen);
}
gDim_model->vertices[1].p.v[0] = pLeft;

View File

@ -354,7 +354,7 @@ void InitLineStuff(void) {
gLine_material = BrMaterialAllocate("gLine_material");
gLine_actor = BrActorAllocate(BR_ACTOR_MODEL, NULL);
if (!gLine_model || !gLine_material || !gLine_actor) {
FatalError(94);
FatalError(kFatalError_OOMCarmageddon_S);
}
gLine_actor->identifier = "gLine_actor";
gLine_actor->render_style = BR_RSTYLE_EDGES;
@ -387,7 +387,7 @@ void InitSmokeStuff(void) {
gBlend_material = BrMaterialAllocate("gBlend_material");
gBlend_actor = BrActorAllocate(BR_ACTOR_MODEL, NULL);
if (!gBlend_model || !gBlend_material || !gBlend_actor) {
FatalError(94);
FatalError(kFatalError_OOMCarmageddon_S);
}
gBlend_actor->identifier = "gBlend_actor";
gBlend_actor->model = gBlend_model;
@ -418,7 +418,7 @@ void InitSmokeStuff(void) {
PathCat(path, path, "SMOKE.PIX");
gBlend_material->colour_map = DRPixelmapLoad(path);
if (!gBlend_material->colour_map) {
FatalError(79, path);
FatalError(kFatalError_LoadPixelmapFile_S, path);
}
gBlend_material->colour_map->map = gRender_palette;
BrMapAdd(gBlend_material->colour_map);
@ -452,7 +452,7 @@ void Init2DStuff(void) {
gPrat_material = BrMaterialAllocate("gPrat_material");
gPrat_actor = BrActorAllocate(BR_ACTOR_MODEL, NULL);
if (!gDim_model || !gDim_material || !gDim_actor || !gPrat_model || !gPrat_material || !gPrat_actor || !g2d_camera) {
FatalError(94);
FatalError(kFatalError_OOMCarmageddon_S);
}
g2d_camera->identifier = "g2d_camera";
camera = g2d_camera->type_data;

View File

@ -64,8 +64,6 @@ void QuitGame(void) {
#endif
PDShutdownSystem();
CloseDiagnostics();
exit(0);
}
// IDA: tU32 __cdecl TrackCount(br_actor *pActor, tU32 *pCount)

View File

@ -1063,7 +1063,7 @@ br_pixelmap* PaletteOf16Bits(br_pixelmap* pSrc) {
if (g16bit_palette == NULL) {
g16bit_palette = BrPixelmapAllocate(BR_PMT_RGB_565, 1, 256, g16bit_palette, 0);
if (g16bit_palette == NULL) {
FatalError(94, "16-bit palette");
FatalError(kFatalError_OOMCarmageddon_S, "16-bit palette");
}
}
if (!g16bit_palette_valid || pSrc != gSource_for_16bit_palette) {

View File

@ -2425,11 +2425,11 @@ void LoadExceptionsFile(char* pName) {
GetALineAndDontArgue(f, line);
tok = strtok(line, delimiters);
if (DRStricmp(tok, "VERSION")) {
FatalError(120, pName, "VERSION");
FatalError(kFatalError_FileMustStartWith_S, pName, "VERSION");
}
tok = strtok(NULL, delimiters);
if (sscanf(tok, "%d", &file_version) == 0 || file_version != 1) {
FatalError(121, tok, pName);
FatalError(kFatalError_CantCopeWithVersionFor_S, tok, pName);
}
while (1) {
@ -2456,7 +2456,7 @@ void LoadExceptionsFile(char* pName) {
} else if (DRStricmp(tok, "quadruple") == 0) {
e->flags |= ExceptionFlag_Quadruple;
} else {
FatalError(123, tok, pName);
FatalError(kFatalError_Mysterious_S_S, tok, pName);
}
}
AddExceptionToList(&gExceptions, e);

View File

@ -470,6 +470,17 @@ enum {
kFatalError_NetContentsTooBig_S = 114,
kFatalError_FileCorrupt_S = 115,
kFatalError_RandomNumberOutOfRange_S = 116,
#ifdef DETHRACE_3DFX_PATCH
kFatalError_CouldntLockPixelmap_S = 117,
kFatalError_ShouldBeLockedButIsnt_S = 118,
kFatalError_CannotPurifyPixelmap_S = 119,
kFatalError_FileMustStartWith_S = 120,
kFatalError_CantCopeWithVersionFor_S = 121,
kFatalError_CannotTilePixelmap_S = 122,
kFatalError_Mysterious_S_S = 123,
kFatalError_CanOnlyDimRectanglesOfgBack_screen = 124,
kFatalError_InvalidMaterialAlpha = 125
#endif
};
enum {

1193
src/DETHRACE/pc-all/allsys.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -395,7 +395,7 @@ void PDLockRealBackScreen(int lock) {
sub_B4DB4();
BrPixelmapDirectLock(gReal_back_screen, 1);
if (!gReal_back_screen->pixels)
FatalError(117, "gReal_back_screen");
FatalError(kFatalError_CouldntLockPixelmap_S, "gReal_back_screen");
gReal_back_screen_locked = 1;
}
}
@ -541,7 +541,7 @@ void Double8BitTo16BitPixelmap(br_pixelmap* pDst, br_pixelmap* pSrc, br_pixelmap
palette_entry = PaletteOf16Bits(pPalette)->pixels;
if (pSrc_width > 640) {
FatalError(94, "Double8BitTo16BitPixelmap");
FatalError(kFatalError_OOMCarmageddon_S, "Double8BitTo16BitPixelmap");
}
dst_y = 0;
for (y = 0; y < pSrc_height; y++) {

View File

@ -69,7 +69,7 @@ void PDSetKeyArray(int* pKeys, int pMark);
int PDGetASCIIFromKey(int pKey);
HARNESS_NORETURN void PDFatalError(char* pThe_str);
void PDFatalError(char* pThe_str);
void PDNonFatalError(char* pThe_str);

View File

@ -54,8 +54,8 @@ enum {
};
typedef struct tPlatform_bootstrap {
const char *name;
const char *description;
const char* name;
const char* description;
uint32_t capabilities;
int (*init)(tHarness_platform* platform);
} tPlatform_bootstrap;

View File

@ -35,14 +35,14 @@ extern br_pixelmap* gBack_screen;
#ifdef DETHRACE_SDL_DYNAMIC
#ifdef _WIN32
static const char * const possible_locations[] = {
static const char* const possible_locations[] = {
"SDL2.dll",
};
#elif defined(__APPLE__)
#define SHARED_OBJECT_NAME "libSDL2"
#define SDL2_LIBNAME "libSDL2.dylib"
#define SDL2_FRAMEWORK "SDL2.framework/Versions/A/SDL2"
static const char * const possible_locations[] = {
static const char* const possible_locations[] = {
"@loader_path/" SDL2_LIBNAME, /* MyApp.app/Contents/MacOS/libSDL2_dylib */
"@loader_path/../Frameworks/" SDL2_FRAMEWORK, /* MyApp.app/Contents/Frameworks/SDL2_framework */
"@executable_path/" SDL2_LIBNAME, /* MyApp.app/Contents/MacOS/libSDL2_dylib */
@ -52,7 +52,7 @@ static const char * const possible_locations[] = {
SDL2_LIBNAME /* oh well, anywhere the system can see the .dylib (/usr/local/lib or whatever) */
};
#else
static const char * const possible_locations[] = {
static const char* const possible_locations[] = {
"libSDL2-2.0.so.0",
"libSDL2-2.0.so",
};
@ -60,7 +60,7 @@ static const char * const possible_locations[] = {
#endif
#ifdef DETHRACE_SDL_DYNAMIC
static void *sdl2_so;
static void* sdl2_so;
#endif
#define OBJECT_NAME sdl2_so
@ -104,7 +104,9 @@ static int SDL2_Harness_SetWindowPos(void* hWnd, int x, int y, int nWidth, int n
static void SDL2_Harness_DestroyWindow(void* hWnd) {
// SDL2_GL_DeleteContext(context);
if (window != NULL) {
SDL2_DestroyWindow(window);
}
SDL2_Quit();
window = NULL;
}