Add namespace (#155)

This commit is contained in:
Alexander Batalov 2022-09-23 15:43:44 +03:00 committed by GitHub
parent 3168c2ec09
commit 9bb053b3ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
231 changed files with 931 additions and 0 deletions

View File

@ -35,6 +35,8 @@
#include "tile.h"
#include "trait.h"
namespace fallout {
#define MAX_KNOCKDOWN_DISTANCE 20
typedef enum ScienceRepairTargetType {
@ -2114,3 +2116,5 @@ int _action_can_talk_to(Object* a1, Object* a2)
return 0;
}
} // namespace fallout

View File

@ -4,6 +4,8 @@
#include "combat_defs.h"
#include "obj_types.h"
namespace fallout {
int _action_attack(Attack* attack);
int _action_use_an_item_on_object(Object* a1, Object* a2, Object* a3);
int _action_use_an_object(Object* a1, Object* a2);
@ -21,4 +23,6 @@ bool actionCheckPush(Object* a1, Object* a2);
int actionPush(Object* a1, Object* a2);
int _action_can_talk_to(Object* a1, Object* a2);
} // namespace fallout
#endif /* ACTIONS_H */

View File

@ -31,6 +31,8 @@
#include "tile.h"
#include "trait.h"
namespace fallout {
#define ANIMATION_SEQUENCE_LIST_CAPACITY 32
#define ANIMATION_DESCRIPTION_LIST_CAPACITY 55
#define ANIMATION_SAD_LIST_CAPACITY 24
@ -3362,3 +3364,5 @@ int animationRegisterSetLightIntensity(Object* owner, int lightDistance, int lig
return 0;
}
} // namespace fallout

View File

@ -4,6 +4,8 @@
#include "combat_defs.h"
#include "obj_types.h"
namespace fallout {
typedef enum AnimationRequestOptions {
ANIMATION_REQUEST_UNRESERVED = 0x01,
ANIMATION_REQUEST_RESERVED = 0x02,
@ -156,4 +158,6 @@ void animationStop();
int animationRegisterSetLightIntensity(Object* owner, int lightDistance, int lightIntensity, int delay);
} // namespace fallout
#endif /* ANIMATION_H */

View File

@ -14,6 +14,8 @@
#include "proto.h"
#include "sfall_config.h"
namespace fallout {
typedef struct ArtListDescription {
int flags;
char name[16];
@ -1228,3 +1230,5 @@ int artWrite(const char* path, unsigned char* data)
fileClose(stream);
return 0;
}
} // namespace fallout

View File

@ -8,6 +8,8 @@
#include "platform_compat.h"
#include "proto_types.h"
namespace fallout {
typedef enum Head {
HEAD_INVALID,
HEAD_MARCUS,
@ -149,4 +151,6 @@ int buildFid(int objectType, int frmId, int animType, int a4, int rotation);
int artRead(const char* path, unsigned char* data);
int artWrite(const char* path, unsigned char* data);
} // namespace fallout
#endif

View File

@ -10,6 +10,8 @@
#include "pointer_registry.h"
#include "sound.h"
namespace fallout {
static bool _defaultCompressionFunc(char* filePath);
static int audioSoundDecoderReadHandler(int fileHandle, void* buf, unsigned int size);
@ -252,3 +254,5 @@ void audioExit()
gAudioListLength = 0;
gAudioList = NULL;
}
} // namespace fallout

View File

@ -3,6 +3,8 @@
#include "audio_file.h"
namespace fallout {
int audioOpen(const char* fname, int mode, ...);
int audioClose(int fileHandle);
int audioRead(int fileHandle, void* buffer, unsigned int size);
@ -13,4 +15,6 @@ int audioWrite(int handle, const void* buf, unsigned int size);
int audioInit(AudioFileIsCompressedProc* isCompressedProc);
void audioExit();
} // namespace fallout
#endif /* AUDIO_H */

View File

@ -6,6 +6,8 @@
#include <SDL.h>
namespace fallout {
#define AUDIO_ENGINE_SOUND_BUFFERS 8
struct AudioEngineSoundBuffer {
@ -430,3 +432,5 @@ bool audioEngineSoundBufferGetStatus(int soundBufferIndex, unsigned int* statusP
return true;
}
} // namespace fallout

View File

@ -1,6 +1,8 @@
#ifndef AUDIO_ENGINE_H
#define AUDIO_ENGINE_H
namespace fallout {
#define AUDIO_ENGINE_SOUND_BUFFER_LOCK_FROM_WRITE_POS 0x00000001
#define AUDIO_ENGINE_SOUND_BUFFER_LOCK_ENTIRE_BUFFER 0x00000002
@ -26,4 +28,6 @@ bool audioEngineSoundBufferLock(int soundBufferIndex, unsigned int writePos, uns
bool audioEngineSoundBufferUnlock(int soundBufferIndex, void* audioPtr1, unsigned int audioBytes1, void* audioPtr2, unsigned int audioBytes2);
bool audioEngineSoundBufferGetStatus(int soundBufferIndex, unsigned int* status);
} // namespace fallout
#endif /* AUDIO_ENGINE_H */

View File

@ -10,6 +10,8 @@
#include "pointer_registry.h"
#include "sound.h"
namespace fallout {
static bool _defaultCompressionFunc__(char* filePath);
static int audioFileSoundDecoderReadHandler(int fileHandle, void* buffer, unsigned int size);
@ -249,3 +251,5 @@ void audioFileExit()
gAudioFileListLength = 0;
gAudioFileList = NULL;
}
} // namespace fallout

View File

@ -3,6 +3,8 @@
#include "sound_decoder.h"
namespace fallout {
typedef enum AudioFileFlags {
AUDIO_FILE_IN_USE = 0x01,
AUDIO_FILE_COMPRESSED = 0x02,
@ -30,4 +32,6 @@ int audioFileWrite(int handle, const void* buf, unsigned int size);
int audioFileInit(AudioFileIsCompressedProc* isCompressedProc);
void audioFileExit();
} // namespace fallout
#endif /* AUDIO_FILE_H */

View File

@ -25,6 +25,8 @@
#include "text_font.h"
#include "window_manager.h"
namespace fallout {
#define AUTOMAP_OFFSET_COUNT (AUTOMAP_MAP_COUNT * ELEVATION_COUNT)
#define AUTOMAP_WINDOW_WIDTH (519)
@ -1160,3 +1162,5 @@ void automapSetDisplayMap(int map, bool available)
_displayMapList[map] = available ? 0 : -1;
}
}
} // namespace fallout

View File

@ -4,6 +4,8 @@
#include "db.h"
#include "map_defs.h"
namespace fallout {
#define AUTOMAP_DB ("AUTOMAP.DB")
#define AUTOMAP_TMP ("AUTOMAP.TMP")
@ -56,4 +58,6 @@ int automapGetHeader(AutomapHeader** automapHeaderPtr);
void automapSetDisplayMap(int map, bool available);
} // namespace fallout
#endif /* AUTOMAP_H */

View File

@ -11,6 +11,8 @@
static HANDLE gInterplayGenericAutorunMutex;
#endif
namespace fallout {
// 0x4139C0
bool autorunMutexCreate()
{
@ -34,3 +36,5 @@ void autorunMutexClose()
}
#endif
}
} // namespace fallout

View File

@ -1,7 +1,11 @@
#ifndef AUTORUN_H
#define AUTORUN_H
namespace fallout {
bool autorunMutexCreate();
void autorunMutexClose();
} // namespace fallout
#endif /* AUTORUN_H */

View File

@ -9,6 +9,8 @@
#include "memory.h"
#include "sound.h"
namespace fallout {
// The initial number of cache entries in new cache.
#define CACHE_ENTRIES_INITIAL_CAPACITY (100)
@ -613,3 +615,5 @@ static int cacheEntriesCompareByMostRecentHit(const void* a1, const void* a2)
return 0;
}
}
} // namespace fallout

View File

@ -3,6 +3,8 @@
#include "heap.h"
namespace fallout {
#define INVALID_CACHE_ENTRY ((CacheEntry*)-1)
typedef enum CacheEntryFlags {
@ -66,4 +68,6 @@ bool cacheUnlock(Cache* cache, CacheEntry* cacheEntry);
bool cacheFlush(Cache* cache);
bool cachePrintStats(Cache* cache, char* dest);
} // namespace fallout
#endif /* CACHE_H */

View File

@ -42,6 +42,8 @@
#include "word_wrap.h"
#include "worldmap.h"
namespace fallout {
#define RENDER_ALL_STATS 7
#define EDITOR_WINDOW_WIDTH 640
@ -7239,3 +7241,5 @@ static void customTownReputationFree()
{
gCustomTownReputationEntries.clear();
}
} // namespace fallout

View File

@ -3,6 +3,8 @@
#include "db.h"
namespace fallout {
extern int gCharacterEditorRemainingCharacterPoints;
int characterEditorShow(bool isCreationMode);
@ -13,4 +15,6 @@ int characterEditorSave(File* stream);
int characterEditorLoad(File* stream);
void characterEditorReset();
} // namespace fallout
#endif /* CHARACTER_EDITOR_H */

View File

@ -31,6 +31,8 @@
#include "trait.h"
#include "window_manager.h"
namespace fallout {
#define CS_WINDOW_WIDTH (640)
#define CS_WINDOW_HEIGHT (480)
@ -1122,3 +1124,5 @@ static void premadeCharactersLocalizePath(char* path)
strcpy(path, localizedPath);
}
}
} // namespace fallout

View File

@ -1,9 +1,13 @@
#ifndef CHARACTER_SELECTOR_H
#define CHARACTER_SELECTOR_H
namespace fallout {
int characterSelectorOpen();
void premadeCharactersInit();
void premadeCharactersExit();
} // namespace fallout
#endif /* CHARACTER_SELECTOR_H */

View File

@ -7,6 +7,8 @@
#include "core.h"
namespace fallout {
#define COLOR_PALETTE_STACK_CAPACITY 16
typedef struct ColorPaletteStackEntry {
@ -679,3 +681,5 @@ void _colorsClose()
gColorPaletteStackSize = 0;
}
} // namespace fallout

View File

@ -3,6 +3,8 @@
#include "memory_defs.h"
namespace fallout {
typedef const char*(ColorFileNameManger)(const char*);
typedef void(ColorTransitionCallback)();
@ -40,4 +42,6 @@ bool colorPopColorPalette();
bool _initColors();
void _colorsClose();
} // namespace fallout
#endif /* COLOR_H */

View File

@ -43,6 +43,8 @@
#include "trait.h"
#include "window_manager.h"
namespace fallout {
#define CALLED_SHOT_WINDOW_Y (20)
#define CALLED_SHOT_WINDOW_WIDTH (504)
#define CALLED_SHOT_WINDOW_HEIGHT (309)
@ -6779,3 +6781,5 @@ static void damageModCalculateYaam(DamageCalculationContext* context)
}
}
}
} // namespace fallout

View File

@ -6,6 +6,8 @@
#include "obj_types.h"
#include "proto_types.h"
namespace fallout {
extern int _combatNumTurns;
extern unsigned int gCombatState;
@ -81,4 +83,6 @@ static inline bool isUnarmedHitMode(int hitMode)
|| (hitMode >= FIRST_ADVANCED_UNARMED_HIT_MODE && hitMode <= LAST_ADVANCED_UNARMED_HIT_MODE);
}
} // namespace fallout
#endif /* COMBAT_H */

View File

@ -34,6 +34,8 @@
#include "text_object.h"
#include "tile.h"
namespace fallout {
#define AI_PACKET_CHEM_PRIMARY_DESIRE_COUNT (3)
typedef struct AiMessageRange {
@ -3518,3 +3520,5 @@ void _combatai_delete_critter(Object* obj)
}
}
}
} // namespace fallout

View File

@ -6,6 +6,8 @@
#include "db.h"
#include "obj_types.h"
namespace fallout {
typedef enum AiMessageType {
AI_MESSAGE_TYPE_RUN,
AI_MESSAGE_TYPE_MOVE,
@ -66,4 +68,6 @@ void _combatai_notify_onlookers(Object* a1);
void _combatai_notify_friends(Object* a1);
void _combatai_delete_critter(Object* obj);
} // namespace fallout
#endif /* COMBAT_AI_H */

View File

@ -1,6 +1,8 @@
#ifndef COMBAT_AI_DEFS_H
#define COMBAT_AI_DEFS_H
namespace fallout {
typedef enum AreaAttackMode {
AREA_ATTACK_MODE_ALWAYS,
AREA_ATTACK_MODE_SOMETIMES,
@ -79,4 +81,6 @@ typedef enum HurtTooMuch {
HURT_COUNT,
} HurtTooMuch;
} // namespace fallout
#endif /* COMBAT_AI_DEFS_H */

View File

@ -10,6 +10,8 @@
#define WEAPON_CRITICAL_FAILURE_TYPE_COUNT (7)
#define WEAPON_CRITICAL_FAILURE_EFFECT_COUNT (5)
namespace fallout {
typedef enum CombatState {
COMBAT_STATE_0x01 = 0x01,
COMBAT_STATE_0x02 = 0x02,
@ -169,4 +171,6 @@ typedef enum CombatBadShot {
COMBAT_BAD_SHOT_BOTH_ARMS_CRIPPLED = 7,
} CombatBadShot;
} // namespace fallout
#endif /* COMBAT_DEFS_H */

View File

@ -11,6 +11,8 @@
#include "memory.h"
#include "platform_compat.h"
namespace fallout {
#define CONFIG_FILE_MAX_LINE_LENGTH (256)
// The initial number of sections (or key-value) pairs in the config.
@ -547,3 +549,5 @@ bool configSetBool(Config* config, const char* sectionKey, const char* key, bool
{
return configSetInt(config, sectionKey, key, value ? 1 : 0);
}
} // namespace fallout

View File

@ -3,6 +3,8 @@
#include "dictionary.h"
namespace fallout {
// A representation of .INI file.
//
// It's implemented as a [Dictionary] whos keys are section names of .INI file,
@ -31,4 +33,6 @@ bool configSetDouble(Config* config, const char* sectionKey, const char* key, do
bool configGetBool(Config* config, const char* sectionKey, const char* key, bool* valuePtr);
bool configSetBool(Config* config, const char* sectionKey, const char* key, bool value);
} // namespace fallout
#endif /* CONFIG_H */

View File

@ -18,6 +18,8 @@
#include "window_manager.h"
#include "window_manager_private.h"
namespace fallout {
static void idleImpl();
// 0x51E234
@ -4916,3 +4918,5 @@ static void idleImpl()
{
SDL_Delay(125);
}
} // namespace fallout

View File

@ -8,6 +8,8 @@
#include "geometry.h"
#include "window.h"
namespace fallout {
#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)
@ -696,4 +698,6 @@ bool mouseHitTestInWindow(int win, int left, int top, int right, int bottom);
void mouseGetWheel(int* x, int* y);
void convertMouseWheelToArrowKey(int* keyCodePtr);
} // namespace fallout
#endif /* CORE_H */

View File

@ -18,6 +18,8 @@
#include "text_font.h"
#include "window_manager.h"
namespace fallout {
#define CREDITS_WINDOW_WIDTH (640)
#define CREDITS_WINDOW_HEIGHT (480)
#define CREDITS_WINDOW_SCROLLING_DELAY (38)
@ -274,3 +276,5 @@ static bool creditsFileParseNextLine(char* dest, int* font, int* color)
return false;
}
} // namespace fallout

View File

@ -1,6 +1,10 @@
#ifndef CREDITS_H
#define CREDITS_H
namespace fallout {
void creditsOpen(const char* path, int fid, bool useReversedStyle);
} // namespace fallout
#endif /* CREDITS_H */

View File

@ -31,6 +31,8 @@
#include "trait.h"
#include "worldmap.h"
namespace fallout {
// Maximum length of dude's name length.
#define DUDE_NAME_MAX_LENGTH (32)
@ -1390,3 +1392,5 @@ bool _critter_flag_check(int pid, int flag)
protoGetProto(pid, &proto);
return (proto->critter.data.flags & flag) != 0;
}
} // namespace fallout

View File

@ -5,6 +5,8 @@
#include "obj_types.h"
#include "proto_types.h"
namespace fallout {
typedef enum DudeState {
DUDE_STATE_SNEAKING = 0,
DUDE_STATE_LEVEL_UP_AVAILABLE = 3,
@ -69,4 +71,6 @@ bool critterIsEncumbered(Object* critter);
bool critterIsFleeing(Object* a1);
bool _critter_flag_check(int pid, int flag);
} // namespace fallout
#endif /* CRITTER_H */

View File

@ -5,6 +5,8 @@
#include "game_config.h"
#include "palette.h"
namespace fallout {
#define COLOR_CYCLE_PERIOD_1 (200U)
#define COLOR_CYCLE_PERIOD_2 (142U)
#define COLOR_CYCLE_PERIOD_3 (100U)
@ -332,3 +334,5 @@ void colorCycleTicker()
paletteSetEntriesInRange(palette + 229 * 3, 229, 255);
}
}
} // namespace fallout

View File

@ -1,6 +1,8 @@
#ifndef CYCLE_H
#define CYCLE_H
namespace fallout {
void colorCycleInit();
void colorCycleReset();
void colorCycleFree();
@ -10,4 +12,6 @@ bool colorCycleEnabled();
void cycleSetSpeedFactor(int value);
void colorCycleTicker();
} // namespace fallout
#endif /* CYCLE_H */

View File

@ -8,6 +8,8 @@
#include "pcx.h"
#include "platform_compat.h"
namespace fallout {
// 0x5184AC
DatafileLoader* gDatafileLoader = NULL;
@ -193,3 +195,5 @@ unsigned char* datafileLoad(char* path, int* sizePtr)
*sizePtr = size;
return data;
}
} // namespace fallout

View File

@ -1,6 +1,8 @@
#ifndef DATAFILE_H
#define DATAFILE_H
namespace fallout {
typedef unsigned char*(DatafileLoader)(char* path, unsigned char* palette, int* widthPtr, int* heightPtr);
typedef char*(DatafileNameMangler)(char* path);
@ -21,4 +23,6 @@ void sub_42F024(unsigned char* data, int* widthPtr, int* heightPtr);
unsigned char* datafileGetPalette();
unsigned char* datafileLoad(char* path, int* sizePtr);
} // namespace fallout
#endif /* DATAFILE_H */

View File

@ -7,6 +7,8 @@
#include "platform_compat.h"
#include "xfile.h"
namespace fallout {
typedef struct FileList {
XList xlist;
struct FileList* next;
@ -738,3 +740,5 @@ int _db_list_compare(const void* p1, const void* p2)
{
return compat_stricmp(*(const char**)p1, *(const char**)p2);
}
} // namespace fallout

View File

@ -6,6 +6,8 @@
#include "memory_defs.h"
#include "xfile.h"
namespace fallout {
typedef XFile File;
typedef void FileReadProgressHandler();
typedef char* StrdupProc(const char* string);
@ -66,4 +68,6 @@ int fileGetSize(File* stream);
void fileSetReadProgressHandler(FileReadProgressHandler* handler, int size);
void _db_enable_hash_table_();
} // namespace fallout
#endif /* DB_H */

View File

@ -19,6 +19,8 @@
#include "window_manager.h"
#include "word_wrap.h"
namespace fallout {
#define FILE_DIALOG_LINE_COUNT 12
#define FILE_DIALOG_DOUBLE_CLICK_DELAY 32
@ -1403,3 +1405,5 @@ static void fileDialogRenderFileList(unsigned char* buffer, char** fileList, int
}
}
}
} // namespace fallout

View File

@ -1,6 +1,8 @@
#ifndef DBOX_H
#define DBOX_H
namespace fallout {
typedef enum DialogBoxOptions {
DIALOG_BOX_LARGE = 0x01,
DIALOG_BOX_MEDIUM = 0x02,
@ -14,4 +16,6 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i
int showLoadFileDialog(char* title, char** fileList, char* dest, int fileListLength, int x, int y, int flags);
int showSaveFileDialog(char* title, char** fileList, char* dest, int fileListLength, int x, int y, int flags);
} // namespace fallout
#endif /* DBOX_H */

View File

@ -14,6 +14,8 @@
#include "platform_compat.h"
#include "window_manager_private.h"
namespace fallout {
static int _debug_puts(char* string);
static void _debug_clear();
static int _debug_mono(char* string);
@ -317,3 +319,5 @@ void _debug_exit(void)
fclose(_fd);
}
}
} // namespace fallout

View File

@ -1,6 +1,8 @@
#ifndef DEBUG_H
#define DEBUG_H
namespace fallout {
typedef int(DebugPrintProc)(char* string);
void _GNW_debug_init();
@ -12,4 +14,6 @@ void _debug_register_func(DebugPrintProc* proc);
int debugPrint(const char* format, ...);
void _debug_exit(void);
} // namespace fallout
#endif /* DEBUG_H */

View File

@ -9,6 +9,8 @@
#include "platform_compat.h"
namespace fallout {
// The size of decompression buffer for reading compressed [DFile]s.
#define DFILE_DECOMPRESSION_BUFFER_SIZE (0x400)
@ -852,3 +854,5 @@ static void dfileUngetCompressed(DFile* stream, int ch)
stream->flags |= DFILE_HAS_COMPRESSED_UNGETC;
stream->position--;
}
} // namespace fallout

View File

@ -7,6 +7,8 @@
#include "platform_compat.h"
namespace fallout {
typedef struct DBase DBase;
typedef struct DBaseEntry DBaseEntry;
typedef struct DFile DFile;
@ -128,4 +130,6 @@ long dfileTell(DFile* stream);
void dfileRewind(DFile* stream);
int dfileEof(DFile* stream);
} // namespace fallout
#endif /* DFILE_H */

View File

@ -9,6 +9,8 @@
#include "text_font.h"
#include "window_manager.h"
namespace fallout {
// 0x501623
const float flt_501623 = 31.0;
@ -750,3 +752,5 @@ int _dialogGetMediaFlag()
{
return _mediaFlag;
}
} // namespace fallout

View File

@ -3,6 +3,8 @@
#include "interpreter.h"
namespace fallout {
typedef void DialogFunc1(int win);
typedef void DialogFunc2(int win);
@ -131,4 +133,6 @@ void _dialogRegisterWinDrawCallbacks(DialogFunc1* a1, DialogFunc2* a2);
int _dialogToggleMediaFlag(int a1);
int _dialogGetMediaFlag();
} // namespace fallout
#endif /* DIALOG_H */

View File

@ -6,6 +6,8 @@
#include "platform_compat.h"
namespace fallout {
// NOTE: I guess this marker is used as a type discriminator for implementing
// nested dictionaries. That's why every dictionary-related function starts
// with a check for this value.
@ -552,3 +554,5 @@ void dictionarySetMemoryProcs(MallocProc* mallocProc, ReallocProc* reallocProc,
gDictionaryFreeProc = dictionaryFreeDefaultImpl;
}
}
} // namespace fallout

View File

@ -5,6 +5,8 @@
#include "memory_defs.h"
namespace fallout {
typedef int(DictionaryReadProc)(FILE* stream, void* buffer, unsigned int size, int a4);
typedef int(DictionaryWriteProc)(FILE* stream, void* buffer, unsigned int size, int a4);
@ -63,4 +65,6 @@ int dictionaryWriteHeader(FILE* stream, Dictionary* dictionary);
int dictionaryWrite(FILE* stream, Dictionary* dictionary, int a3);
void dictionarySetMemoryProcs(MallocProc* mallocProc, ReallocProc* reallocProc, FreeProc* freeProc);
} // namespace fallout
#endif /* DICTIONARY_H */

View File

@ -1,5 +1,7 @@
#include "dinput.h"
namespace fallout {
enum InputType {
INPUT_TYPE_MOUSE,
INPUT_TYPE_TOUCH,
@ -237,3 +239,5 @@ void handleTouchEvent(SDL_Event* event)
gLastInputType = INPUT_TYPE_TOUCH;
}
}
} // namespace fallout

View File

@ -3,6 +3,8 @@
#include <SDL.h>
namespace fallout {
typedef struct MouseData {
int x;
int y;
@ -33,4 +35,6 @@ void keyboardDeviceFree();
void handleMouseEvent(SDL_Event* event);
void handleTouchEvent(SDL_Event* event);
} // namespace fallout
#endif /* DINPUT_H */

View File

@ -18,6 +18,8 @@
#include "text_font.h"
#include "window_manager.h"
namespace fallout {
// 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)
@ -468,3 +470,5 @@ static void consoleFileFlush()
gConsoleFileStream.flush();
}
}
} // namespace fallout

View File

@ -1,6 +1,8 @@
#ifndef DISPLAY_MONITOR_H
#define DISPLAY_MONITOR_H
namespace fallout {
int displayMonitorInit();
int displayMonitorReset();
void displayMonitorExit();
@ -8,4 +10,6 @@ void displayMonitorAddMessage(char* string);
void displayMonitorDisable();
void displayMonitorEnable();
} // namespace fallout
#endif /* DISPLAY_MONITOR_H */

View File

@ -6,6 +6,8 @@
#include "core.h"
#include "mmx.h"
namespace fallout {
// 0x4D2FC0
void bufferDrawLine(unsigned char* buf, int pitch, int x1, int y1, int x2, int y2, int color)
{
@ -326,3 +328,5 @@ void bufferOutline(unsigned char* buf, int width, int height, int pitch, int col
}
}
}
} // namespace fallout

View File

@ -1,6 +1,8 @@
#ifndef DRAW_H
#define DRAW_H
namespace fallout {
void bufferDrawLine(unsigned char* buf, int pitch, int left, int top, int right, int bottom, int color);
void bufferDrawRect(unsigned char* buf, int a2, int a3, int a4, int a5, int a6, int a7);
void bufferDrawRectShadowed(unsigned char* buf, int a2, int a3, int a4, int a5, int a6, int a7, int a8);
@ -14,4 +16,6 @@ void _lighten_buf(unsigned char* buf, int width, int height, int pitch);
void _swap_color_buf(unsigned char* buf, int width, int height, int pitch, int color1, int color2);
void bufferOutline(unsigned char* buf, int width, int height, int pitch, int a5);
} // namespace fallout
#endif /* DRAW_H */

View File

@ -8,6 +8,8 @@
#include "game_config.h"
#include "platform_compat.h"
namespace fallout {
// 0x440DD0
void runElectronicRegistration()
{
@ -45,3 +47,5 @@ void runElectronicRegistration()
}
}
}
} // namespace fallout

View File

@ -1,6 +1,10 @@
#ifndef ELECTRONIC_REGISTRATION_H
#define ELECTRONIC_REGISTRATION_H
namespace fallout {
void runElectronicRegistration();
} // namespace fallout
#endif /* ELECTRONIC_REGISTRATION_H */

View File

@ -20,6 +20,8 @@
#include "sfall_config.h"
#include "window_manager.h"
namespace fallout {
// The maximum number of elevator levels.
#define ELEVATOR_LEVEL_MAX (4)
@ -751,3 +753,5 @@ void elevatorsInit()
}
}
}
} // namespace fallout

View File

@ -1,6 +1,8 @@
#ifndef ELEVATOR_H
#define ELEVATOR_H
namespace fallout {
typedef enum Elevator {
ELEVATOR_BROTHERHOOD_OF_STEEL_MAIN,
ELEVATOR_BROTHERHOOD_OF_STEEL_SURFACE,
@ -22,4 +24,6 @@ int elevatorSelectLevel(int elevator, int* mapPtr, int* elevationPtr, int* tileP
void elevatorsInit();
} // namespace fallout
#endif /* ELEVATOR_H */

View File

@ -33,6 +33,8 @@
#include "word_wrap.h"
#include "worldmap.h"
namespace fallout {
// The maximum number of subtitle lines per slide.
#define ENDGAME_ENDING_MAX_SUBTITLES (50)
@ -1197,3 +1199,5 @@ char* endgameDeathEndingGetFileName()
return gEndgameDeathEndingFileName;
}
} // namespace fallout

View File

@ -1,6 +1,8 @@
#ifndef ENDGAME_H
#define ENDGAME_H
namespace fallout {
typedef enum EndgameDeathEndingReason {
// Dude died.
ENDGAME_DEATH_ENDING_REASON_DEATH = 0,
@ -18,4 +20,6 @@ int endgameDeathEndingExit();
void endgameSetupDeathEnding(int reason);
char* endgameDeathEndingGetFileName();
} // namespace fallout
#endif /* ENDGAME_H */

View File

@ -7,6 +7,8 @@
#include "memory_manager.h"
#include "platform_compat.h"
namespace fallout {
typedef struct ExternalVariable {
char name[32];
char* programName;
@ -343,3 +345,5 @@ void _exportClearAllVariables()
}
}
}
} // namespace fallout

View File

@ -3,6 +3,8 @@
#include "interpreter.h"
namespace fallout {
int externalVariableSetValue(Program* program, const char* identifier, ProgramValue& value);
int externalVariableGetValue(Program* program, const char* name, ProgramValue& value);
int externalVariableCreate(Program* program, const char* identifier);
@ -12,4 +14,6 @@ Program* externalProcedureGetProgram(const char* identifier, int* addressPtr, in
int externalProcedureCreate(Program* program, const char* identifier, int address, int argumentCount);
void _exportClearAllVariables();
} // namespace fallout
#endif /* EXPORT_H */

View File

@ -5,6 +5,8 @@
#include <fpattern.h>
namespace fallout {
// 0x4E6380
bool fileFindFirst(const char* path, DirectoryFileFindData* findData)
{
@ -95,3 +97,5 @@ bool findFindClose(DirectoryFileFindData* findData)
return true;
}
} // namespace fallout

View File

@ -11,6 +11,8 @@
#include "platform_compat.h"
namespace fallout {
// NOTE: This structure is significantly different from what was in the
// original code. Watcom provides opendir/readdir/closedir implementations,
// that use Win32 FindFirstFile/FindNextFile under the hood, which in turn
@ -65,4 +67,6 @@ static inline char* fileFindGetName(DirectoryFileFindData* findData)
#endif
}
} // namespace fallout
#endif /* FILE_FIND_H */

View File

@ -11,6 +11,8 @@
#include "platform_compat.h"
namespace fallout {
static void fileCopy(const char* existingFilePath, const char* newFilePath);
// 0x452740
@ -185,3 +187,5 @@ static void fileCopy(const char* existingFilePath, const char* newFilePath)
fclose(out);
}
}
} // namespace fallout

View File

@ -1,8 +1,12 @@
#ifndef FILE_UTILS_H
#define FILE_UTILS_H
namespace fallout {
int fileCopyDecompressed(const char* existingFilePath, const char* newFilePath);
int fileCopyCompressed(const char* existingFilePath, const char* newFilePath);
int _gzdecompress_file(const char* existingFilePath, const char* newFilePath);
} // namespace fallout
#endif /* FILE_UTILS_H */

View File

@ -10,6 +10,8 @@
// The maximum number of interface fonts.
#define INTERFACE_FONT_MAX (16)
namespace fallout {
typedef struct InterfaceFontGlyph {
short width;
short height;
@ -405,3 +407,5 @@ static void interfaceFontByteSwapInt16(short* value)
{
interfaceFontByteSwapUInt16((unsigned short*)value);
}
} // namespace fallout

View File

@ -3,9 +3,13 @@
#include "text_font.h"
namespace fallout {
extern FontManager gModernFontManager;
int interfaceFontsInit();
void interfaceFontsExit();
} // namespace fallout
#endif /* FONT_MANAGER_H */

View File

@ -2,6 +2,8 @@
#include <SDL.h>
namespace fallout {
FpsLimiter::FpsLimiter(std::size_t fps)
: _fps(fps)
, _ticks(0)
@ -19,3 +21,5 @@ void FpsLimiter::throttle() const
SDL_Delay(1000 / _fps - (SDL_GetTicks() - _ticks));
}
}
} // namespace fallout

View File

@ -3,6 +3,8 @@
#include <cstddef>
namespace fallout {
class FpsLimiter {
public:
FpsLimiter(std::size_t fps = 60);
@ -14,4 +16,6 @@ private:
std::size_t _ticks;
};
} // namespace fallout
#endif /* FPS_LIMITER_H */

View File

@ -66,6 +66,8 @@
#include "window_manager.h"
#include "worldmap.h"
namespace fallout {
#define HELP_SCREEN_WIDTH (640)
#define HELP_SCREEN_HEIGHT (480)
@ -1405,3 +1407,5 @@ int gameShowDeathDialog(const char* message)
return rc;
}
} // namespace fallout

View File

@ -4,6 +4,8 @@
#include "game_vars.h"
#include "message.h"
namespace fallout {
typedef enum GameState {
GAME_STATE_0,
GAME_STATE_1,
@ -39,4 +41,6 @@ int showQuitConfirmationDialog();
int gameShowDeathDialog(const char* message);
} // namespace fallout
#endif /* GAME_H */

View File

@ -6,6 +6,8 @@
#include "main.h"
#include "platform_compat.h"
namespace fallout {
// A flag indicating if [gGameConfig] was initialized.
//
// 0x5186D0
@ -181,3 +183,5 @@ bool gameConfigExit(bool shouldSave)
return result;
}
} // namespace fallout

View File

@ -3,6 +3,8 @@
#include "config.h"
namespace fallout {
// The file name of the main config file.
#define GAME_CONFIG_FILE_NAME "fallout2.cfg"
@ -120,4 +122,6 @@ bool gameConfigInit(bool isMapper, int argc, char** argv);
bool gameConfigSave();
bool gameConfigExit(bool shouldSave);
} // namespace fallout
#endif /* GAME_CONFIG_H */

View File

@ -38,6 +38,8 @@
#include "tile.h"
#include "window_manager.h"
namespace fallout {
#define DIALOG_REVIEW_ENTRIES_CAPACITY 80
#define DIALOG_OPTION_ENTRIES_CAPACITY 30
@ -4734,3 +4736,5 @@ static void gameDialogRedButtonsExit()
gGameDialogRedButtonUpFrmData = NULL;
}
}
} // namespace fallout

View File

@ -4,6 +4,8 @@
#include "interpreter.h"
#include "obj_types.h"
namespace fallout {
extern Object* gGameDialogSpeaker;
extern bool gGameDialogSpeakerIsPartyMember;
extern int gGameDialogHeadFid;
@ -37,4 +39,6 @@ void gameDialogSetBarterModifier(int modifier);
int gameDialogBarter(int modifier);
void _barter_end_to_talk_to();
} // namespace fallout
#endif /* GAME_DIALOG_H */

View File

@ -6,6 +6,8 @@
#include "memory_defs.h"
#include "memory_manager.h"
namespace fallout {
static void* gameMemoryMalloc(size_t size);
static void* gameMemoryRealloc(void* ptr, size_t newSize);
static void gameMemoryFree(void* ptr);
@ -37,3 +39,5 @@ static void gameMemoryFree(void* ptr)
{
internal_free(ptr);
}
} // namespace fallout

View File

@ -1,6 +1,10 @@
#ifndef GAME_MEMORY_H
#define GAME_MEMORY_H
namespace fallout {
int gameMemoryInit();
} // namespace fallout
#endif /* GAME_MEMORY_H */

View File

@ -27,6 +27,8 @@
#include "tile.h"
#include "window_manager.h"
namespace fallout {
typedef enum ScrollableDirections {
SCROLLABLE_W = 0x01,
SCROLLABLE_E = 0x02,
@ -2454,3 +2456,5 @@ static void customMouseModeFrmsInit()
configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_USE_SCIENCE_FRM_KEY, &(gGameMouseModeFrmIds[GAME_MOUSE_MODE_USE_SCIENCE]));
configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_USE_REPAIR_FRM_KEY, &(gGameMouseModeFrmIds[GAME_MOUSE_MODE_USE_REPAIR]));
}
} // namespace fallout

View File

@ -3,6 +3,8 @@
#include "obj_types.h"
namespace fallout {
typedef enum GameMouseMode {
GAME_MOUSE_MODE_MOVE,
GAME_MOUSE_MODE_ARROW,
@ -99,4 +101,6 @@ int gameMouseHighlightActionMenuItemAtIndex(int menuItemIndex);
void gameMouseLoadItemHighlight();
void _gmouse_remove_item_outline(Object* object);
} // namespace fallout
#endif /* GAME_MOUSE_H */

View File

@ -18,6 +18,8 @@
#include "text_font.h"
#include "window_manager.h"
namespace fallout {
#define GAME_MOVIE_WINDOW_WIDTH 640
#define GAME_MOVIE_WINDOW_HEIGHT 480
@ -349,3 +351,5 @@ static char* gameMovieBuildSubtitlesFilePath(char* movieFilePath)
return gGameMovieSubtitlesFilePath;
}
} // namespace fallout

View File

@ -3,6 +3,8 @@
#include "db.h"
namespace fallout {
typedef enum GameMovieFlags {
GAME_MOVIE_FADE_IN = 0x01,
GAME_MOVIE_FADE_OUT = 0x02,
@ -40,4 +42,6 @@ void gameMovieFadeOut();
bool gameMovieIsSeen(int movie);
bool gameMovieIsPlaying();
} // namespace fallout
#endif /* GAME_MOVIE_H */

View File

@ -2,6 +2,8 @@
#include "color.h"
namespace fallout {
// 0x44EBC0
int _HighRGB_(int a1)
{
@ -23,3 +25,5 @@ int _HighRGB_(int a1)
return result;
}
} // namespace fallout

View File

@ -1,6 +1,10 @@
#ifndef GAME_PALETTE_H
#define GAME_PALETTE_H
namespace fallout {
int _HighRGB_(int a1);
} // namespace fallout
#endif /* GAME_PALETTE_H */

View File

@ -24,6 +24,8 @@
#include "window_manager.h"
#include "worldmap.h"
namespace fallout {
typedef enum SoundEffectActionType {
SOUND_EFFECT_ACTION_TYPE_ACTIVE,
SOUND_EFFECT_ACTION_TYPE_PASSIVE,
@ -2148,3 +2150,5 @@ int ambientSoundEffectEventProcess(Object* a1, void* data)
return 0;
}
} // namespace fallout

View File

@ -4,6 +4,8 @@
#include "obj_types.h"
#include "sound.h"
namespace fallout {
typedef enum WeaponSoundEffect {
WEAPON_SOUND_EFFECT_READY,
WEAPON_SOUND_EFFECT_ATTACK,
@ -83,4 +85,6 @@ int soundPlayFile(const char* name);
int _gsound_sfx_q_start();
int ambientSoundEffectEventProcess(Object* a1, void* a2);
} // namespace fallout
#endif /* GAME_SOUND_H */

View File

@ -1,6 +1,8 @@
#ifndef GAME_VARS_H
#define GAME_VARS_H
namespace fallout {
typedef enum GameGlobalVar {
GVAR_PLAYER_REPUTATION,
GVAR_CHILDKILLER_REPUTATION,
@ -700,4 +702,6 @@ typedef enum GameGlobalVar {
GVAR_PATCH_INVAIDITATOR,
} GameGlobalVar;
} // namespace fallout
#endif /* GAME_VARS_H */

View File

@ -6,6 +6,8 @@
#include "memory.h"
namespace fallout {
// 0x51DEF4
static RectListNode* _rectList = NULL;
@ -183,3 +185,5 @@ int rectIntersection(const Rect* s1, const Rect* s2, Rect* r)
return -1;
}
} // namespace fallout

View File

@ -1,6 +1,8 @@
#ifndef GEOMETRY_H
#define GEOMETRY_H
namespace fallout {
typedef struct Point {
int x;
int y;
@ -56,4 +58,6 @@ static inline void rectOffset(Rect* rect, int dx, int dy)
rect->bottom += dy;
}
} // namespace fallout
#endif /* GEOMETRY_H */

View File

@ -5,6 +5,8 @@
#include "debug.h"
#include "memory.h"
namespace fallout {
static void _InitTree();
static void _InsertNode(int a1);
static void _DeleteNode(int a1);
@ -382,3 +384,5 @@ int graphDecompress(unsigned char* src, unsigned char* dest, int length)
return 0;
}
} // namespace fallout

View File

@ -1,7 +1,11 @@
#ifndef GRAPH_LIB_H
#define GRAPH_LIB_H
namespace fallout {
int graphCompress(unsigned char* a1, unsigned char* a2, int a3);
int graphDecompress(unsigned char* a1, unsigned char* a2, int a3);
} // namespace fallout
#endif /* GRAPH_LIB_H */

View File

@ -4,6 +4,8 @@
#include "color.h"
namespace fallout {
// 0x596D90
static unsigned char _GreyTable[256];
@ -40,3 +42,5 @@ void grayscalePaletteApply(unsigned char* buffer, int width, int height, int pit
ptr += skip;
}
}
} // namespace fallout

View File

@ -1,7 +1,11 @@
#ifndef GRAYSCALE_H
#define GRAYSCALE_H
namespace fallout {
void grayscalePaletteUpdate(int a1, int a2);
void grayscalePaletteApply(unsigned char* surface, int width, int height, int pitch);
} // namespace fallout
#endif /* GRAYSCALE_H */

View File

@ -7,6 +7,8 @@
#include "debug.h"
#include "memory.h"
namespace fallout {
#define HEAP_BLOCK_HEADER_GUARD (0xDEADC0DE)
#define HEAP_BLOCK_FOOTER_GUARD (0xACDCACDC)
@ -1245,3 +1247,5 @@ bool heapValidate(Heap* heap)
return true;
}
} // namespace fallout

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