This commit is contained in:
k3tamina 2022-05-28 09:29:50 +02:00
commit 4a53e5c5ae
104 changed files with 55 additions and 253 deletions

View File

@ -2,9 +2,15 @@ cmake_minimum_required(VERSION 3.13)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
project(fallout2-ce LANGUAGES CXX)
set(EXECUTABLE_NAME fallout2-ce)
add_executable(fallout2-ce WIN32
project(${EXECUTABLE_NAME})
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)
add_executable(${EXECUTABLE_NAME} WIN32
"src/actions.cc"
"src/actions.h"
"src/animation.cc"
@ -226,22 +232,30 @@ add_executable(fallout2-ce WIN32
"src/xfile.h"
)
target_sources(fallout2-ce PUBLIC
target_sources(${EXECUTABLE_NAME} PUBLIC
"src/fps_limiter.cc"
"src/fps_limiter.h"
"src/sfall_config.cc"
"src/sfall_config.h"
)
target_compile_definitions(fallout2-ce PUBLIC
target_compile_definitions(${EXECUTABLE_NAME} PUBLIC
_CRT_SECURE_NO_WARNINGS
_CRT_NONSTDC_NO_WARNINGS
)
target_link_libraries(fallout2-ce
target_link_libraries(${EXECUTABLE_NAME}
winmm
)
add_subdirectory("third_party/fpattern")
target_link_libraries(${EXECUTABLE_NAME} ${FPATTERN_LIBRARY})
target_include_directories(${EXECUTABLE_NAME} PRIVATE ${FPATTERN_INCLUDE_DIR})
add_subdirectory("third_party/zlib")
target_link_libraries(${EXECUTABLE_NAME} ${ZLIB_LIBRARIES})
target_include_directories(${EXECUTABLE_NAME} PRIVATE ${ZLIB_INCLUDE_DIRS})
add_subdirectory("third_party/sdl2")
target_link_libraries(${EXECUTABLE_NAME} ${SDL2_LIBRARIES})
target_include_directories(${EXECUTABLE_NAME} PRIVATE ${SDL2_INCLUDE_DIRS})

View File

@ -5,8 +5,6 @@
#include "obj_types.h"
#include "proto_types.h"
#include <stdbool.h>
extern int _action_in_explode;
extern const int gNormalDeathAnimations[DAMAGE_TYPE_COUNT];
extern const int gMaximumBloodDeathAnimations[DAMAGE_TYPE_COUNT];

View File

@ -6,8 +6,6 @@
#include "obj_types.h"
#include "sound.h"
#include <stdbool.h>
#define ANIMATION_SEQUENCE_LIST_CAPACITY (32)
#define ANIMATION_DESCRIPTION_LIST_CAPACITY (55)
@ -196,8 +194,6 @@ typedef struct STRUCT_530014 {
};
} STRUCT_530014;
static_assert(sizeof(STRUCT_530014) == 3240, "wrong size");
typedef Object* PathBuilderCallback(Object* object, int tile, int elevation);
extern int _curr_sad;

View File

@ -80,8 +80,6 @@ typedef struct Art {
} Art;
#pragma pack()
static_assert(sizeof(Art) == 62, "wrong size");
typedef struct ArtFrame {
short width;
short height;

View File

@ -12,8 +12,6 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
static_assert(sizeof(AudioFile) == 28, "wrong size");
// 0x5108C0
AudioFileIsCompressedProc* _queryCompressedFunc_2 = _defaultCompressionFunc__;

View File

@ -3,8 +3,6 @@
#include "sound_decoder.h"
#include <stdbool.h>
typedef enum AudioFileFlags {
AUDIO_FILE_IN_USE = 0x01,
AUDIO_FILE_COMPRESSED = 0x02,

View File

@ -260,8 +260,6 @@ int _automapDisplayMap(int map)
void automapShow(bool isInGame, bool isUsingScanner)
{
int frmIds[AUTOMAP_FRM_COUNT];
static_assert(sizeof(frmIds) == sizeof(gAutomapFrmIds), "wrong size");
memcpy(frmIds, gAutomapFrmIds, sizeof(gAutomapFrmIds));
unsigned char* frmData[AUTOMAP_FRM_COUNT];

View File

@ -4,8 +4,6 @@
#include "db.h"
#include "map_defs.h"
#include <stdbool.h>
#define AUTOMAP_DB ("AUTOMAP.DB")
#define AUTOMAP_TMP ("AUTOMAP.TMP")

View File

@ -1,8 +1,6 @@
#ifndef AUTORUN_H
#define AUTORUN_H
#include <stdbool.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

View File

@ -8,9 +8,6 @@
#include <stdio.h>
#include <string.h>
static_assert(sizeof(CacheEntry) == 32, "wrong size");
static_assert(sizeof(Cache) == 84, "wrong size");
// 0x510938
int _lock_sound_ticker = 0;

View File

@ -3,8 +3,6 @@
#include "heap.h"
#include <stdbool.h>
#define INVALID_CACHE_ENTRY ((CacheEntry*)-1)
// The initial number of cache entries in new cache.

View File

@ -4477,7 +4477,6 @@ void _RestorePlayer()
char* _itostndn(int value, char* dest)
{
int v16[7];
static_assert(sizeof(v16) == sizeof(dword_431DD4), "wrong size");
memcpy(v16, dword_431DD4, sizeof(v16));
char* savedDest = dest;

View File

@ -3,8 +3,6 @@
#include "art.h"
#include <stdbool.h>
#define CS_WINDOW_WIDTH (640)
#define CS_WINDOW_HEIGHT (480)

View File

@ -3,7 +3,6 @@
#include "memory_defs.h"
#include <stdbool.h>
#include <stdlib.h>
typedef const char*(ColorFileNameManger)(const char*);

View File

@ -8,8 +8,6 @@
#include "obj_types.h"
#include "party_member.h"
#include <stdbool.h>
#define AI_PACKET_CHEM_PRIMARY_DESIRE_COUNT (3)
typedef enum AiMessageType {

View File

@ -104,8 +104,6 @@ typedef struct STRUCT_664980 {
int field_24; // flags on defender
} STRUCT_664980;
static_assert(sizeof(STRUCT_664980) == 40, "wrong size");
typedef struct Attack {
Object* attacker;
int hitMode;
@ -130,8 +128,6 @@ typedef struct Attack {
int extrasKnockback[EXPLOSION_TARGET_COUNT];
} Attack;
static_assert(sizeof(Attack) == 184, "wrong size");
// Provides metadata about critical hit effect.
typedef struct CriticalHitDescription {
int damageMultiplier;

View File

@ -3,8 +3,6 @@
#include "dictionary.h"
#include <stdbool.h>
#define CONFIG_FILE_MAX_LINE_LENGTH (256)
// The initial number of sections (or key-value) pairs in the config.

View File

@ -540,8 +540,7 @@ void tickersExecute()
return;
}
#pragma warning(suppress : 28159)
gTickerLastTimestamp = GetTickCount();
gTickerLastTimestamp = SDL_GetTicks();
TickerListNode* curr = gTickerListHead;
TickerListNode** currPtr = &(gTickerListHead);
@ -839,8 +838,7 @@ void screenshotHandlerConfigure(int keyCode, ScreenshotHandler* handler)
// 0x4C9370
unsigned int _get_time()
{
#pragma warning(suppress : 28159)
return GetTickCount();
return SDL_GetTicks();
}
// 0x4C937C
@ -865,8 +863,7 @@ void coreDelayProcessingEvents(unsigned int delay)
// 0x4C93B8
void coreDelay(unsigned int ms)
{
#pragma warning(suppress : 28159)
unsigned int start = GetTickCount();
unsigned int start = SDL_GetTicks();
unsigned int diff;
do {
// NOTE: Uninline
@ -877,8 +874,7 @@ void coreDelay(unsigned int ms)
// 0x4C93E0
unsigned int getTicksSince(unsigned int start)
{
#pragma warning(suppress : 28159)
unsigned int end = GetTickCount();
unsigned int end = SDL_GetTicks();
// NOTE: Uninline.
return getTicksBetween(end, start);

View File

@ -8,8 +8,6 @@
#include <SDL.h>
#include <stdbool.h>
#define MOUSE_DEFAULT_CURSOR_WIDTH 8
#define MOUSE_DEFAULT_CURSOR_HEIGHT 8
#define MOUSE_DEFAULT_CURSOR_SIZE (MOUSE_DEFAULT_CURSOR_WIDTH * MOUSE_DEFAULT_CURSOR_HEIGHT)
@ -406,8 +404,6 @@ typedef struct STRUCT_51E2F0 {
};
} STRUCT_51E2F0;
static_assert(sizeof(STRUCT_51E2F0) == 24, "wrong size");
typedef struct LogicalKeyEntry {
short field_0;
short unmodified;

View File

@ -3,8 +3,6 @@
#include "db.h"
#include <stdbool.h>
#define CREDITS_WINDOW_WIDTH (640)
#define CREDITS_WINDOW_HEIGHT (480)
#define CREDITS_WINDOW_SCROLLING_DELAY (38)

View File

@ -6,8 +6,6 @@
#include "obj_types.h"
#include "proto_types.h"
#include <stdbool.h>
// Maximum length of dude's name length.
#define DUDE_NAME_MAX_LENGTH (32)

View File

@ -1,8 +1,6 @@
#ifndef CYCLE_H
#define CYCLE_H
#include <stdbool.h>
#define COLOR_CYCLE_PERIOD_1 (200U)
#define COLOR_CYCLE_PERIOD_2 (142U)
#define COLOR_CYCLE_PERIOD_3 (100U)

View File

@ -4,7 +4,6 @@
#include "memory_defs.h"
#include "xfile.h"
#include <stdbool.h>
#include <stddef.h>
typedef XFile File;

View File

@ -1,6 +1,6 @@
#include "dfile.h"
#include "fpattern.h"
#include <fpattern.h>
#include <assert.h>
#include <io.h>
@ -8,11 +8,6 @@
#include <stdlib.h>
#include <string.h>
static_assert(sizeof(DBase) == 20, "wrong size");
static_assert(sizeof(DBaseEntry) == 20, "wrong size");
static_assert(sizeof(DFile) == 44, "wrong size");
static_assert(sizeof(DFileFindData) == 524, "wrong size");
// Reads .DAT file contents.
//
// 0x4E4F58

View File

@ -4,7 +4,6 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdbool.h>
#include <stdio.h>
#include <zlib.h>

View File

@ -1,7 +1,6 @@
#include "dictionary.h"
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>

View File

@ -3,8 +3,6 @@
#include "geometry.h"
#include <stdbool.h>
// The maximum number of lines display monitor can hold. Once this value
// is reached earlier messages are thrown away.
#define DISPLAY_MONITOR_LINES_CAPACITY (100)

View File

@ -33,6 +33,9 @@
// The maximum number of subtitle lines per slide.
#define ENDGAME_ENDING_MAX_SUBTITLES (50)
#define ENDGAME_ENDING_WINDOW_WIDTH 640
#define ENDGAME_ENDING_WINDOW_HEIGHT 480
// 0x50B00C
char _aEnglish_2[] = ENGLISH;
@ -270,7 +273,7 @@ void endgameEndingRenderPanningScene(int direction, const char* narratorFileName
int width = artGetWidth(background, 0, 0);
int height = artGetHeight(background, 0, 0);
unsigned char* backgroundData = artGetFrameData(background, 0, 0);
bufferFill(gEndgameEndingSlideshowWindowBuffer, 640, 480, 640, _colorTable[0]);
bufferFill(gEndgameEndingSlideshowWindowBuffer, ENDGAME_ENDING_WINDOW_WIDTH, ENDGAME_ENDING_WINDOW_HEIGHT, ENDGAME_ENDING_WINDOW_WIDTH, _colorTable[0]);
endgameEndingLoadPalette(6, 327);
unsigned char palette[768];
@ -312,7 +315,7 @@ void endgameEndingRenderPanningScene(int direction, const char* narratorFileName
// TODO: Complex math, setup scene in debugger.
if (getTicksSince(since) >= v9) {
blitBufferToBuffer(backgroundData + start, 640, 480, width, gEndgameEndingSlideshowWindowBuffer, 640);
blitBufferToBuffer(backgroundData + start, ENDGAME_ENDING_WINDOW_WIDTH, ENDGAME_ENDING_WINDOW_HEIGHT, width, gEndgameEndingSlideshowWindowBuffer, ENDGAME_ENDING_WINDOW_WIDTH);
if (subtitlesLoaded) {
endgameEndingRefreshSubtitles();
@ -371,7 +374,7 @@ void endgameEndingRenderPanningScene(int direction, const char* narratorFileName
artUnlock(backgroundHandle);
paletteFadeTo(gPaletteBlack);
bufferFill(gEndgameEndingSlideshowWindowBuffer, 640, 480, 640, _colorTable[0]);
bufferFill(gEndgameEndingSlideshowWindowBuffer, ENDGAME_ENDING_WINDOW_WIDTH, ENDGAME_ENDING_WINDOW_HEIGHT, ENDGAME_ENDING_WINDOW_WIDTH, _colorTable[0]);
windowRefresh(gEndgameEndingSlideshowWindow);
}
@ -391,7 +394,7 @@ void endgameEndingRenderStaticScene(int fid, const char* narratorFileName)
unsigned char* backgroundData = artGetFrameData(background, 0, 0);
if (backgroundData != NULL) {
blitBufferToBuffer(backgroundData, 640, 480, 640, gEndgameEndingSlideshowWindowBuffer, 640);
blitBufferToBuffer(backgroundData, ENDGAME_ENDING_WINDOW_WIDTH, ENDGAME_ENDING_WINDOW_HEIGHT, ENDGAME_ENDING_WINDOW_WIDTH, gEndgameEndingSlideshowWindowBuffer, ENDGAME_ENDING_WINDOW_WIDTH);
windowRefresh(gEndgameEndingSlideshowWindow);
endgameEndingLoadPalette((fid & 0xF000000) >> 24, fid & 0xFFF);
@ -434,7 +437,7 @@ void endgameEndingRenderStaticScene(int fid, const char* narratorFileName)
break;
}
blitBufferToBuffer(backgroundData, 640, 480, 640, gEndgameEndingSlideshowWindowBuffer, 640);
blitBufferToBuffer(backgroundData, ENDGAME_ENDING_WINDOW_WIDTH, ENDGAME_ENDING_WINDOW_HEIGHT, ENDGAME_ENDING_WINDOW_WIDTH, gEndgameEndingSlideshowWindowBuffer, ENDGAME_ENDING_WINDOW_WIDTH);
endgameEndingRefreshSubtitles();
windowRefresh(gEndgameEndingSlideshowWindow);
soundContinueAll();
@ -487,7 +490,9 @@ int endgameEndingSlideshowWindowInit()
paletteFadeTo(gPaletteBlack);
gEndgameEndingSlideshowWindow = windowCreate(0, 0, 640, 480, _colorTable[0], 4);
int windowEndgameEndingX = (screenGetWidth() - ENDGAME_ENDING_WINDOW_WIDTH) / 2;
int windowEndgameEndingY = (screenGetHeight() - ENDGAME_ENDING_WINDOW_HEIGHT) / 2;
gEndgameEndingSlideshowWindow = windowCreate(windowEndgameEndingX, windowEndgameEndingY, ENDGAME_ENDING_WINDOW_WIDTH, ENDGAME_ENDING_WINDOW_HEIGHT, _colorTable[0], 4);
if (gEndgameEndingSlideshowWindow == -1) {
return -1;
}

View File

@ -5,8 +5,6 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdbool.h>
typedef enum EndgameDeathEndingReason {
// Dude died.
ENDGAME_DEATH_ENDING_REASON_DEATH = 0,

View File

@ -1,8 +1,6 @@
#ifndef FILE_FIND_H
#define FILE_FIND_H
#include <stdbool.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

View File

@ -3,7 +3,6 @@
#include "file_utils.h"
#include <stdbool.h>
#include <stdio.h>
#include <zlib.h>

View File

@ -3,8 +3,6 @@
#include "text_font.h"
#include <stdbool.h>
// The maximum number of interface fonts.
#define INTERFACE_FONT_MAX (16)

View File

@ -1055,7 +1055,9 @@ void showHelp()
bool colorCycleWasEnabled = colorCycleEnabled();
colorCycleDisable();
int win = windowCreate(0, 0, HELP_SCREEN_WIDTH, HELP_SCREEN_HEIGHT, 0, WINDOW_HIDDEN | WINDOW_FLAG_0x04);
int helpWindowX = (screenGetWidth() - HELP_SCREEN_WIDTH) / 2;
int helpWindowY = (screenGetHeight() - HELP_SCREEN_HEIGHT) / 2;
int win = windowCreate(helpWindowX, helpWindowY, HELP_SCREEN_WIDTH, HELP_SCREEN_HEIGHT, 0, WINDOW_HIDDEN | WINDOW_FLAG_0x04);
if (win != -1) {
unsigned char* windowBuffer = windowGetBuffer(win);
if (windowBuffer != NULL) {

View File

@ -4,8 +4,6 @@
#include "game_vars.h"
#include "message.h"
#include <stdbool.h>
extern char _aGame_0[];
extern bool gGameUiDisabled;

View File

@ -3,8 +3,6 @@
#include "config.h"
#include <stdbool.h>
// The file name of the main config file.
#define GAME_CONFIG_FILE_NAME "fallout2.cfg"

View File

@ -3410,7 +3410,6 @@ void gameDialogCombatControlButtonOnMouseUp(int btn, int keyCode)
int _gdPickAIUpdateMsg(Object* critter)
{
int pids[3];
static_assert(sizeof(pids) == sizeof(_Dogs), "wrong size");
memcpy(pids, _Dogs, sizeof(pids));
for (int index = 0; index < 3; index++) {

View File

@ -8,8 +8,6 @@
#include "message.h"
#include "obj_types.h"
#include <stdbool.h>
#define DIALOG_REVIEW_ENTRIES_CAPACITY 80
#define DIALOG_OPTION_ENTRIES_CAPACITY 30

View File

@ -5,8 +5,6 @@
#include "geometry.h"
#include "obj_types.h"
#include <stdbool.h>
typedef enum ScrollableDirections {
SCROLLABLE_W = 0x01,
SCROLLABLE_E = 0x02,

View File

@ -3,8 +3,6 @@
#include "db.h"
#include <stdbool.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

View File

@ -21,7 +21,6 @@
#include "window_manager.h"
#include "world_map.h"
#include <stdbool.h>
#include <stdio.h>
#include <string.h>

View File

@ -4,8 +4,6 @@
#include "obj_types.h"
#include "sound.h"
#include <stdbool.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

View File

@ -7,12 +7,6 @@
#include <stdlib.h>
#include <string.h>
static_assert(sizeof(HeapBlockHeader) == 16, "wrong size");
static_assert(sizeof(HeapBlockFooter) == 4, "wrong size");
static_assert(sizeof(HeapMoveableExtent) == 16, "wrong size");
static_assert(sizeof(HeapHandle) == 8, "wrong size");
static_assert(sizeof(Heap) == 48, "wrong size");
// An array of pointers to free heap blocks.
//
// 0x518E9C

View File

@ -1,8 +1,6 @@
#ifndef HEAP_H
#define HEAP_H
#include <stdbool.h>
#define HEAP_BLOCK_HEADER_GUARD (0xDEADC0DE)
#define HEAP_BLOCK_FOOTER_GUARD (0xACDCACDC)

View File

@ -6,8 +6,6 @@
#include "geometry.h"
#include "obj_types.h"
#include <stdbool.h>
typedef enum Hand {
// Item1 (Punch)
HAND_LEFT,

View File

@ -127,7 +127,7 @@ char* programGetCurrentProcedureName(Program* program)
}
// 0x4671F0
__declspec(noreturn) void programFatalError(const char* format, ...)
[[noreturn]] void programFatalError(const char* format, ...)
{
char string[260];

View File

@ -2,7 +2,6 @@
#define INTERPRETER_H
#include <setjmp.h>
#include <stdbool.h>
// The maximum number of opcodes.
#define OPCODE_MAX_COUNT (342)
@ -190,7 +189,7 @@ int _checkWait(Program* program);
void _interpretOutputFunc(int (*func)(char*));
int _interpretOutput(const char* format, ...);
char* programGetCurrentProcedureName(Program* s);
__declspec(noreturn) void programFatalError(const char* str, ...);
[[noreturn]] void programFatalError(const char* str, ...);
opcode_t stackReadInt16(unsigned char* data, int pos);
int stackReadInt32(unsigned char* a1, int a2);
void stackWriteInt16(int value, unsigned char* a2, int a3);

View File

@ -6,8 +6,6 @@
#include "interpreter.h"
#include "obj_types.h"
#include <stdbool.h>
typedef enum ScriptError {
SCRIPT_ERROR_NOT_IMPLEMENTED,
SCRIPT_ERROR_OBJECT_IS_NULL,

View File

@ -2198,11 +2198,9 @@ int objectGetCarriedQuantityByPid(Object* object, int pid)
void inventoryRenderSummary()
{
int v56[7];
static_assert(sizeof(v56) == sizeof(dword_46E6D0), "wrong size");
memcpy(v56, dword_46E6D0, sizeof(v56));
int v57[7];
static_assert(sizeof(v57) == sizeof(dword_46E6EC), "wrong size");
memcpy(v57, dword_46E6EC, sizeof(v57));
char formattedText[80];
@ -3278,7 +3276,6 @@ int inventoryOpenLooting(Object* a1, Object* a2)
CacheEntry* arrowFrmHandles[INVENTORY_ARROW_FRM_COUNT];
MessageListItem messageListItem;
static_assert(sizeof(arrowFrmIds) == sizeof(gInventoryArrowFrmIds), "wrong size");
memcpy(arrowFrmIds, gInventoryArrowFrmIds, sizeof(gInventoryArrowFrmIds));
if (a1 != _inven_dude) {

View File

@ -6,8 +6,6 @@
#include "message.h"
#include "obj_types.h"
#include <stdbool.h>
#define INVENTORY_NORMAL_WINDOW_PC_ROTATION_DELAY (1000U / ROTATION_COUNT)
#define OFF_59E7BC_COUNT 12

View File

@ -372,7 +372,6 @@ void _item_compact(int inventoryItemIndex, Inventory* inventory)
for (int index = inventoryItemIndex + 1; index < inventory->length; index++) {
InventoryItem* prev = &(inventory->items[index - 1]);
InventoryItem* curr = &(inventory->items[index]);
static_assert(sizeof(*prev) == sizeof(*curr), "wrong size");
memcpy(prev, curr, sizeof(*prev));
}
inventory->length--;

View File

@ -5,8 +5,6 @@
#include "message.h"
#include "obj_types.h"
#include <stdbool.h>
#define ADDICTION_COUNT (9)
typedef enum _WeaponClass {

View File

@ -3,8 +3,6 @@
#include "map_defs.h"
#include <stdbool.h>
#define LIGHT_LEVEL_MIN (65536 / 4)
#define LIGHT_LEVEL_MAX 65536

View File

@ -4,7 +4,6 @@
#include "db.h"
#include "sound.h"
#include <stdbool.h>
#include <stddef.h>
#define PHONEME_COUNT (42)

View File

@ -6,8 +6,6 @@
#include "geometry.h"
#include "message.h"
#include <stdbool.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

View File

@ -4,8 +4,6 @@
#include "art.h"
#include "fps_limiter.h"
#include <stdbool.h>
typedef enum MainMenuButton {
MAIN_MENU_BUTTON_INTRO,
MAIN_MENU_BUTTON_NEW_GAME,

View File

@ -7,8 +7,6 @@
#include "map_defs.h"
#include "message.h"
#include <stdbool.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

View File

@ -1,8 +1,6 @@
#ifndef MAPDEFS_H
#define MAPDEFS_H
#include <stdbool.h>
#define ELEVATION_COUNT (3)
#define SQUARE_GRID_WIDTH (100)

View File

@ -44,7 +44,7 @@ int memoryManagerPrintError(const char* format, ...)
}
// 0x484610
__declspec(noreturn) void memoryManagerFatalAllocationError(const char* func, size_t size, const char* file, int line)
[[noreturn]] void memoryManagerFatalAllocationError(const char* func, size_t size, const char* file, int line)
{
memoryManagerPrintError("%s: Error allocating block of size %ld (%x), %s %d\n", func, size, size, file, line);
exit(1);

View File

@ -15,7 +15,7 @@ extern char gMemoryManagerLastError[256];
void memoryManagerDefaultPrintErrorImpl(const char* string);
int memoryManagerPrintError(const char* format, ...);
__declspec(noreturn) void memoryManagerFatalAllocationError(const char* func, size_t size, const char* file, int line);
[[noreturn]] void memoryManagerFatalAllocationError(const char* func, size_t size, const char* file, int line);
void* memoryManagerDefaultMallocImpl(size_t size);
void* memoryManagerDefaultReallocImpl(void* ptr, size_t size);
void memoryManagerDefaultFreeImpl(void* ptr);

View File

@ -3,8 +3,6 @@
#include "db.h"
#include <stdbool.h>
#define BADWORD_LENGTH_MAX 80
#define MESSAGE_LIST_ITEM_TEXT_FILTERED 0x01

View File

@ -1,8 +1,6 @@
#ifndef MMX_H
#define MMX_H
#include <stdbool.h>
bool mmxIsSupported();
void mmxBlit(unsigned char* dest, int destPitch, unsigned char* src, int srcPitch, int width, int height);
void mmxBlitTrans(unsigned char* dest, int destPitch, unsigned char* src, int srcPitch, int width, int height);

View File

@ -1,8 +1,6 @@
#ifndef MOVIE_EFFECT_H
#define MOVIE_EFFECT_H
#include <stdbool.h>
typedef enum MovieEffectType {
MOVIE_EFFECT_TYPE_NONE = 0,
MOVIE_EFFECT_TYPE_FADE_IN = 1,

View File

@ -8,8 +8,6 @@
#define DIRECTSOUND_VERSION 0x0300
#include <dsound.h>
#include <stdbool.h>
typedef struct STRUCT_6B3690 {
void* field_0;
int field_4;

View File

@ -6,8 +6,6 @@
#include <stdlib.h>
#include <string.h>
static_assert(sizeof(Nevs) == 60, "wrong size");
// 0x6391C8
Nevs* _nevs;

View File

@ -245,10 +245,6 @@ typedef struct Object {
int field_80;
} Object;
#ifdef _WIN32
static_assert(sizeof(Object) == 132, "wrong size");
#endif
typedef struct ObjectListNode {
Object* obj;
struct ObjectListNode* next;

View File

@ -599,7 +599,6 @@ int showPause(bool a1)
CacheEntry* frmHandles[PAUSE_WINDOW_FRM_COUNT];
Size frmSizes[PAUSE_WINDOW_FRM_COUNT];
static_assert(sizeof(graphicIds) == sizeof(gPauseWindowFrmIds), "wrong size");
memcpy(graphicIds, gPauseWindowFrmIds, sizeof(gPauseWindowFrmIds));
bool gameMouseWasVisible;

View File

@ -6,8 +6,6 @@
#include "message.h"
#include "geometry.h"
#include <stdbool.h>
#define OPTIONS_WINDOW_BUTTONS_COUNT (10)
#define PRIMARY_OPTION_VALUE_COUNT (4)
#define SECONDARY_OPTION_VALUE_COUNT (2)
@ -101,8 +99,6 @@ typedef struct PreferenceDescription {
} PreferenceDescription;
#pragma pack()
static_assert(sizeof(PreferenceDescription) == 76, "wrong size");
extern const int _row1Ytab[5];
extern const int _row2Ytab[6];
extern const int _row3Ytab[8];

View File

@ -6,8 +6,6 @@
#include "obj_types.h"
#include "scripts.h"
#include <stdbool.h>
typedef struct PartyMemberDescription {
bool areaAttackMode[AREA_ATTACK_MODE_COUNT];
bool runAwayMode[RUN_AWAY_MODE_COUNT];

View File

@ -7,8 +7,6 @@
#include "perk_defs.h"
#include "stat_defs.h"
#include <stdbool.h>
typedef struct PerkDescription {
char* name;
char* description;

View File

@ -6,8 +6,6 @@
#include "geometry.h"
#include "message.h"
#include <stdbool.h>
#define PIPBOY_WINDOW_WIDTH (640)
#define PIPBOY_WINDOW_HEIGHT (480)

View File

@ -916,7 +916,6 @@ int _obj_use_power_on_car(Object* item)
MessageListItem messageListItem;
int messageNum;
static_assert(sizeof(messageListItem) == sizeof(stru_49A990), "wrong size");
memcpy(&messageListItem, &stru_49A990, sizeof(messageListItem));
bool isEnergy = false;

View File

@ -4,8 +4,6 @@
#include "message.h"
#include "obj_types.h"
#include <stdbool.h>
extern MessageListItem stru_49A990;
int _obj_sid(Object* object, int* sidPtr);

View File

@ -324,8 +324,6 @@ typedef struct ItemProto {
unsigned char field_80;
} ItemProto;
static_assert(sizeof(ItemProto) == 0x84, "wrong size");
typedef struct CritterProtoData {
int flags; // d.flags
int baseStats[35]; // d.stat_base
@ -353,8 +351,6 @@ typedef struct CritterProto {
int team; // team_num
} CritterProto;
static_assert(sizeof(CritterProto) == 0x1A0, "wrong size");
typedef struct {
int openFlags; // d.open_flags
int keyCode; // d.key_code
@ -404,8 +400,6 @@ typedef struct SceneryProto {
unsigned char field_34;
} SceneryProto;
static_assert(sizeof(SceneryProto) == 0x38, "wrong size");
typedef struct WallProto {
int pid; // id
int messageId; // message_num
@ -418,8 +412,6 @@ typedef struct WallProto {
int material; // material
} WallProto;
static_assert(sizeof(WallProto) == 0x24, "wrong size");
typedef struct TileProto {
int pid; // id
int messageId; // message_num
@ -430,8 +422,6 @@ typedef struct TileProto {
int material; // material
} TileProto;
static_assert(sizeof(TileProto) == 0x1C, "wrong size");
typedef struct MiscProto {
int pid; // id
int messageId; // message_num
@ -442,8 +432,6 @@ typedef struct MiscProto {
int extendedFlags; // flags_ext
} MiscProto;
static_assert(sizeof(MiscProto) == 0x1C, "wrong size");
typedef union Proto {
struct {
int pid; // pid

View File

@ -4,8 +4,6 @@
#include "db.h"
#include "obj_types.h"
#include <stdbool.h>
typedef enum EventType {
EVENT_TYPE_DRUG = 0,
EVENT_TYPE_KNOCKOUT = 1,

View File

@ -6,8 +6,6 @@
#include <limits.h>
#include <string.h>
static_assert(sizeof(Region) == 140, "wrong size");
char _aNull[] = "<null>";
// Probably recalculates bounding box of the region.

View File

@ -1040,7 +1040,6 @@ int scriptsRequestCombat(STRUCT_664980* a1)
}
if (a1) {
static_assert(sizeof(stru_664958) == sizeof(*a1), "wrong size");
memcpy(&stru_664958, a1, sizeof(stru_664958));
} else {
gScriptsRequests |= SCRIPT_REQUEST_0x40;

View File

@ -7,8 +7,6 @@
#include "message.h"
#include "obj_types.h"
#include <stdbool.h>
#define SCRIPT_LIST_EXTENT_SIZE 16
#define SCRIPT_FLAG_0x01 (0x01)
@ -78,8 +76,6 @@ typedef enum ScriptProc {
SCRIPT_PROC_COUNT,
} ScriptProc;
static_assert(SCRIPT_PROC_COUNT == 28, "wrong count");
typedef struct ScriptsListEntry {
char name[16];
int local_vars_num;
@ -152,8 +148,6 @@ typedef struct Script {
int field_DC;
} Script;
static_assert(sizeof(Script) == 0xE0, "wrong size");
typedef struct ScriptListExtent {
Script scripts[SCRIPT_LIST_EXTENT_SIZE];
// Number of scripts in the extent
@ -161,8 +155,6 @@ typedef struct ScriptListExtent {
struct ScriptListExtent* next;
} ScriptListExtent;
static_assert(sizeof(ScriptListExtent) == 0xE08, "wrong size");
typedef struct ScriptList {
ScriptListExtent* head;
ScriptListExtent* tail;
@ -171,8 +163,6 @@ typedef struct ScriptList {
int nextScriptId;
} ScriptList;
static_assert(sizeof(ScriptList) == 0x10, "wrong size");
extern char _Error_2[];
extern char byte_50D6C0[];

View File

@ -3,8 +3,6 @@
#include "config.h"
#include <stdbool.h>
#define SFALL_CONFIG_FILE_NAME "ddraw.ini"
#define SFALL_CONFIG_MISC_KEY "Misc"

View File

@ -667,7 +667,6 @@ int skillUse(Object* obj, Object* a2, int skill, int criticalChanceModifier)
if (critterGetBodyType(a2) != BODY_TYPE_ROBOTIC && critterIsCrippled(a2)) {
int flags[HEALABLE_DAMAGE_FLAGS_LENGTH];
static_assert(sizeof(flags) == sizeof(gHealableDamageFlags), "wrong size");
memcpy(flags, gHealableDamageFlags, sizeof(gHealableDamageFlags));
for (int index = 0; index < HEALABLE_DAMAGE_FLAGS_LENGTH; index++) {
@ -852,7 +851,6 @@ int skillUse(Object* obj, Object* a2, int skill, int criticalChanceModifier)
if (currentHp < maximumHp || critterIsCrippled(a2)) {
int flags[REPAIRABLE_DAMAGE_FLAGS_LENGTH];
static_assert(sizeof(flags) == sizeof(gRepairableDamageFlags), "wrong size");
memcpy(flags, gRepairableDamageFlags, sizeof(gRepairableDamageFlags));
paletteFadeTo(gPaletteBlack);

View File

@ -7,8 +7,6 @@
#include "proto_types.h"
#include "skill_defs.h"
#include <stdbool.h>
#define SKILLS_MAX_USES_PER_DAY (3)
#define REPAIRABLE_DAMAGE_FLAGS_LENGTH (5)

View File

@ -5,8 +5,6 @@
#include "geometry.h"
#include "message.h"
#include <stdbool.h>
#define SKILLDEX_SKILL_BUTTON_BUFFER_COUNT (SKILLDEX_SKILL_COUNT * 2)
typedef enum SkilldexFrm {

View File

@ -9,8 +9,6 @@
#include <mmsystem.h>
#include <stdlib.h>
static_assert(sizeof(Sound) == 156, "wrong size");
// 0x51D478
STRUCT_51D478* _fadeHead = NULL;

View File

@ -1,7 +1,6 @@
#ifndef SOUND_DECODER_H
#define SOUND_DECODER_H
#include <stdbool.h>
#include <stddef.h>
#define SOUND_DECODER_IN_BUFFER_SIZE (512)
@ -40,10 +39,6 @@ typedef struct SoundDecoder {
int field_50;
} SoundDecoder;
#if _WIN32
static_assert(sizeof(SoundDecoder) == 84, "wrong size");
#endif
typedef int (*DECODINGPROC)(SoundDecoder* soundDecoder, int offset, int bits);
extern int gSoundDecodersCount;

View File

@ -12,8 +12,6 @@
#include <stdlib.h>
#include <string.h>
static_assert(sizeof(SoundEffect) == 32, "wrong size");
// 0x50DE04
const char* off_50DE04 = "";

View File

@ -3,8 +3,6 @@
#include "cache.h"
#include <stdbool.h>
// The maximum number of sound effects that can be loaded and played
// simultaneously.
#define SOUND_EFFECTS_MAX_COUNT (4)

View File

@ -1,8 +1,6 @@
#ifndef SOUND_EFFECTS_LIST_H
#define SOUND_EFFECTS_LIST_H
#include <stdbool.h>
#define SFXL_OK (0)
#define SFXL_ERR (1)
#define SFXL_ERR_TAG_INVALID (2)

View File

@ -7,8 +7,6 @@
#include "proto_types.h"
#include "stat_defs.h"
#include <stdbool.h>
#define STAT_ERR_INVALID_STAT (-5)
// Provides metadata about stats.

View File

@ -70,7 +70,6 @@ int textFontsInit()
int currentFont = -1;
FontManager fontManager;
static_assert(sizeof(fontManager) == sizeof(gTextFontManager), "wrong size");
memcpy(&fontManager, &gTextFontManager, sizeof(fontManager));
for (int font = 0; font < TEXT_FONT_MAX; font++) {
@ -192,7 +191,6 @@ int fontManagerAdd(FontManager* fontManager)
}
}
static_assert(sizeof(*gFontManagers) == sizeof(*fontManager), "wrong size");
memcpy(&(gFontManagers[gFontManagersCount]), fontManager, sizeof(*fontManager));
gFontManagersCount++;

View File

@ -1,8 +1,6 @@
#ifndef TEXT_FONT_H
#define TEXT_FONT_H
#include <stdbool.h>
// The maximum number of text fonts.
#define TEXT_FONT_MAX (10)
@ -33,8 +31,6 @@ typedef struct FontManager {
FontManagerGetMonospacedCharacterWidth* getMonospacedCharacterWidthProc;
} FontManager;
static_assert(sizeof(FontManager) == 44, "wrong size");
typedef struct TextFontGlyph {
// The width of the glyph in pixels.
int width;

View File

@ -10,8 +10,6 @@
#include "tile.h"
#include "word_wrap.h"
static_assert(sizeof(TextObject) == 48, "wrong size");
// 0x51D944
int gTextObjectsCount = 0;

View File

@ -4,8 +4,6 @@
#include "geometry.h"
#include "obj_types.h"
#include <stdbool.h>
// The maximum number of text objects that can exist at the same time.
#define TEXT_OBJECTS_MAX_COUNT (20)

View File

@ -5,8 +5,6 @@
#include "map.h"
#include "obj_types.h"
#include <stdbool.h>
#define TILE_SET_CENTER_FLAG_0x01 0x01
#define TILE_SET_CENTER_FLAG_0x02 0x02

View File

@ -5,8 +5,6 @@
#include "message.h"
#include "trait_defs.h"
#include <stdbool.h>
// Provides metadata about traits.
typedef struct TraitDescription {
// The name of trait.

View File

@ -9,8 +9,6 @@
#define DIRECTSOUND_VERSION 0x0300
#include <dsound.h>
#include <stdbool.h>
typedef HRESULT(__stdcall DirectSoundCreateProc)(GUID*, LPDIRECTSOUND*, IUnknown*);
extern DirectSoundCreateProc* gDirectSoundCreateProc;

View File

@ -5,8 +5,6 @@
#include "interpreter.h"
#include "region.h"
#include <stdbool.h>
#define MANAGED_WINDOW_COUNT (16)
typedef void (*WINDOWDRAWINGPROC)(unsigned char* src, int src_pitch, int a3, int src_x, int src_y, int src_width, int src_height, int dest_x, int dest_y);
@ -44,7 +42,6 @@ typedef struct ManagedButton {
int field_74;
int field_78;
} ManagedButton;
static_assert(sizeof(ManagedButton) == 0x7C, "wrong size");
typedef struct ManagedWindow {
char name[32];

View File

@ -12,10 +12,6 @@
#include <SDL.h>
static_assert(sizeof(struc_177) == 572, "wrong size");
static_assert(sizeof(Window) == 68, "wrong size");
static_assert(sizeof(Button) == 124, "wrong size");
// 0x50FA30
char _path_patches[] = "";

View File

@ -3,7 +3,6 @@
#include "geometry.h"
#include <stdbool.h>
#include <stddef.h>
#define WIN32_LEAN_AND_MEAN

View File

@ -1,8 +1,6 @@
#ifndef WINDOW_MANAGER_PRIVATE_H
#define WINDOW_MANAGER_PRIVATE_H
#include <stdbool.h>
typedef struct struc_177 struc_177;
typedef struct STRUCT_6B2340 {

View File

@ -37,10 +37,6 @@
#include <stdio.h>
#include <string.h>
static_assert(sizeof(Terrain) == 128, "wrong size");
static_assert(sizeof(ENC_BASE_TYPE) == 3056, "wrong size");
static_assert(sizeof(EncounterTable) == 7460, "wrong size");
#define WM_TILE_WIDTH (350)
#define WM_TILE_HEIGHT (300)
@ -2693,7 +2689,6 @@ bool _wmMapCanRestHere(int elevation)
int flags[3];
// NOTE: I'm not sure why they're copied.
static_assert(sizeof(flags) == sizeof(_can_rest_here), "wrong size");
memcpy(flags, _can_rest_here, sizeof(flags));
MapInfo* map = &(gMaps[gMapHeader.field_34]);
@ -3250,7 +3245,6 @@ int _wmRndEncounterOccurred()
int modifiers[DAY_PART_COUNT];
// NOTE: I'm not sure why they're copied.
static_assert(sizeof(modifiers) == sizeof(gDayPartEncounterFrequencyModifiers), "wrong size");
memcpy(modifiers, gDayPartEncounterFrequencyModifiers, sizeof(gDayPartEncounterFrequencyModifiers));
frequency -= modifiers[dayPart];
@ -5958,7 +5952,6 @@ int carGetCity()
int _wmCarGiveToParty()
{
MessageListItem messageListItem;
static_assert(sizeof(messageListItem) == sizeof(stru_4BC880), "wrong size");
memcpy(&messageListItem, &stru_4BC880, sizeof(MessageListItem));
if (gWorldmapCarFuel <= 0) {

View File

@ -8,8 +8,6 @@
#include "message.h"
#include "obj_types.h"
#include <stdbool.h>
#define CITY_NAME_SIZE (40)
#define TILE_WALK_MASK_NAME_SIZE (40)
#define ENTRANCE_LIST_CAPACITY (10)

Some files were not shown because too many files have changed in this diff Show More