diff --git a/src/actions.cc b/src/actions.cc index 1ca3f52..87a2999 100644 --- a/src/actions.cc +++ b/src/actions.cc @@ -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 diff --git a/src/actions.h b/src/actions.h index 521840a..67d425f 100644 --- a/src/actions.h +++ b/src/actions.h @@ -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 */ diff --git a/src/animation.cc b/src/animation.cc index 5af3bb0..e91968d 100644 --- a/src/animation.cc +++ b/src/animation.cc @@ -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 diff --git a/src/animation.h b/src/animation.h index c4b2c10..6c1e5bc 100644 --- a/src/animation.h +++ b/src/animation.h @@ -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 */ diff --git a/src/art.cc b/src/art.cc index 2920bd7..51d1cb6 100644 --- a/src/art.cc +++ b/src/art.cc @@ -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 diff --git a/src/art.h b/src/art.h index 2bf1af7..de5d64a 100644 --- a/src/art.h +++ b/src/art.h @@ -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 diff --git a/src/audio.cc b/src/audio.cc index 6b008d1..38176b7 100644 --- a/src/audio.cc +++ b/src/audio.cc @@ -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 diff --git a/src/audio.h b/src/audio.h index 0e43c8f..d68f0db 100644 --- a/src/audio.h +++ b/src/audio.h @@ -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 */ diff --git a/src/audio_engine.cc b/src/audio_engine.cc index d3a63ca..462f7fe 100644 --- a/src/audio_engine.cc +++ b/src/audio_engine.cc @@ -6,6 +6,8 @@ #include +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 diff --git a/src/audio_engine.h b/src/audio_engine.h index b8eb69e..8720eba 100644 --- a/src/audio_engine.h +++ b/src/audio_engine.h @@ -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 */ diff --git a/src/audio_file.cc b/src/audio_file.cc index 04f3488..beaaedb 100644 --- a/src/audio_file.cc +++ b/src/audio_file.cc @@ -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 diff --git a/src/audio_file.h b/src/audio_file.h index ab60602..8ea794b 100644 --- a/src/audio_file.h +++ b/src/audio_file.h @@ -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 */ diff --git a/src/automap.cc b/src/automap.cc index bbe5178..94788f5 100644 --- a/src/automap.cc +++ b/src/automap.cc @@ -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 diff --git a/src/automap.h b/src/automap.h index 05a2353..6fe5506 100644 --- a/src/automap.h +++ b/src/automap.h @@ -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 */ diff --git a/src/autorun.cc b/src/autorun.cc index 2b49822..5bb9bed 100644 --- a/src/autorun.cc +++ b/src/autorun.cc @@ -11,6 +11,8 @@ static HANDLE gInterplayGenericAutorunMutex; #endif +namespace fallout { + // 0x4139C0 bool autorunMutexCreate() { @@ -34,3 +36,5 @@ void autorunMutexClose() } #endif } + +} // namespace fallout diff --git a/src/autorun.h b/src/autorun.h index c479849..58d6076 100644 --- a/src/autorun.h +++ b/src/autorun.h @@ -1,7 +1,11 @@ #ifndef AUTORUN_H #define AUTORUN_H +namespace fallout { + bool autorunMutexCreate(); void autorunMutexClose(); +} // namespace fallout + #endif /* AUTORUN_H */ diff --git a/src/cache.cc b/src/cache.cc index c550810..199f2d5 100644 --- a/src/cache.cc +++ b/src/cache.cc @@ -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 diff --git a/src/cache.h b/src/cache.h index 49c3d42..3fd25db 100644 --- a/src/cache.h +++ b/src/cache.h @@ -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 */ diff --git a/src/character_editor.cc b/src/character_editor.cc index 25e72b6..9103081 100644 --- a/src/character_editor.cc +++ b/src/character_editor.cc @@ -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 diff --git a/src/character_editor.h b/src/character_editor.h index 48f02e5..af69e84 100644 --- a/src/character_editor.h +++ b/src/character_editor.h @@ -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 */ diff --git a/src/character_selector.cc b/src/character_selector.cc index 8efc783..11926de 100644 --- a/src/character_selector.cc +++ b/src/character_selector.cc @@ -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 diff --git a/src/character_selector.h b/src/character_selector.h index 5a4a0e6..f410fdf 100644 --- a/src/character_selector.h +++ b/src/character_selector.h @@ -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 */ diff --git a/src/color.cc b/src/color.cc index b09351d..9faad68 100644 --- a/src/color.cc +++ b/src/color.cc @@ -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 diff --git a/src/color.h b/src/color.h index 3976115..d673720 100644 --- a/src/color.h +++ b/src/color.h @@ -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 */ diff --git a/src/combat.cc b/src/combat.cc index 1afd8e7..101e983 100644 --- a/src/combat.cc +++ b/src/combat.cc @@ -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 diff --git a/src/combat.h b/src/combat.h index 11a361d..a648662 100644 --- a/src/combat.h +++ b/src/combat.h @@ -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 */ diff --git a/src/combat_ai.cc b/src/combat_ai.cc index fb7c303..d616279 100644 --- a/src/combat_ai.cc +++ b/src/combat_ai.cc @@ -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 diff --git a/src/combat_ai.h b/src/combat_ai.h index 48cb157..9ab10e8 100644 --- a/src/combat_ai.h +++ b/src/combat_ai.h @@ -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 */ diff --git a/src/combat_ai_defs.h b/src/combat_ai_defs.h index 444c960..8e98352 100644 --- a/src/combat_ai_defs.h +++ b/src/combat_ai_defs.h @@ -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 */ diff --git a/src/combat_defs.h b/src/combat_defs.h index 8f0bd0f..b726418 100644 --- a/src/combat_defs.h +++ b/src/combat_defs.h @@ -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 */ diff --git a/src/config.cc b/src/config.cc index 2c8ff67..161b68a 100644 --- a/src/config.cc +++ b/src/config.cc @@ -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 diff --git a/src/config.h b/src/config.h index f07880d..4e8192c 100644 --- a/src/config.h +++ b/src/config.h @@ -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 */ diff --git a/src/core.cc b/src/core.cc index 14849bb..9246142 100644 --- a/src/core.cc +++ b/src/core.cc @@ -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 diff --git a/src/core.h b/src/core.h index 80bd68d..35ed6b0 100644 --- a/src/core.h +++ b/src/core.h @@ -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 */ diff --git a/src/credits.cc b/src/credits.cc index 3b6e8eb..f3bf5d7 100644 --- a/src/credits.cc +++ b/src/credits.cc @@ -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 diff --git a/src/credits.h b/src/credits.h index 96a2e06..0281d9a 100644 --- a/src/credits.h +++ b/src/credits.h @@ -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 */ diff --git a/src/critter.cc b/src/critter.cc index c78e223..d61c261 100644 --- a/src/critter.cc +++ b/src/critter.cc @@ -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 diff --git a/src/critter.h b/src/critter.h index 78ef891..7423834 100644 --- a/src/critter.h +++ b/src/critter.h @@ -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 */ diff --git a/src/cycle.cc b/src/cycle.cc index 134de39..36b63a9 100644 --- a/src/cycle.cc +++ b/src/cycle.cc @@ -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 diff --git a/src/cycle.h b/src/cycle.h index 986b95d..769aa4d 100644 --- a/src/cycle.h +++ b/src/cycle.h @@ -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 */ diff --git a/src/datafile.cc b/src/datafile.cc index 00e9824..081f8a7 100644 --- a/src/datafile.cc +++ b/src/datafile.cc @@ -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 diff --git a/src/datafile.h b/src/datafile.h index bee2d39..b04f856 100644 --- a/src/datafile.h +++ b/src/datafile.h @@ -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 */ diff --git a/src/db.cc b/src/db.cc index b667ec1..3cf178b 100644 --- a/src/db.cc +++ b/src/db.cc @@ -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 diff --git a/src/db.h b/src/db.h index dd0305d..d41d676 100644 --- a/src/db.h +++ b/src/db.h @@ -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 */ diff --git a/src/dbox.cc b/src/dbox.cc index ac4b8bf..15f89d1 100644 --- a/src/dbox.cc +++ b/src/dbox.cc @@ -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 diff --git a/src/dbox.h b/src/dbox.h index 208e67d..571b824 100644 --- a/src/dbox.h +++ b/src/dbox.h @@ -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 */ diff --git a/src/debug.cc b/src/debug.cc index 8ffebae..fe17a60 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -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 diff --git a/src/debug.h b/src/debug.h index a95207d..0b32ce7 100644 --- a/src/debug.h +++ b/src/debug.h @@ -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 */ diff --git a/src/dfile.cc b/src/dfile.cc index 74da663..6e8e69f 100644 --- a/src/dfile.cc +++ b/src/dfile.cc @@ -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 diff --git a/src/dfile.h b/src/dfile.h index fe652c4..e4b8c6d 100644 --- a/src/dfile.h +++ b/src/dfile.h @@ -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 */ diff --git a/src/dialog.cc b/src/dialog.cc index 3d7d548..4ba7691 100644 --- a/src/dialog.cc +++ b/src/dialog.cc @@ -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 diff --git a/src/dialog.h b/src/dialog.h index 7545591..62d88c5 100644 --- a/src/dialog.h +++ b/src/dialog.h @@ -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 */ diff --git a/src/dictionary.cc b/src/dictionary.cc index 599d5a1..14d8604 100644 --- a/src/dictionary.cc +++ b/src/dictionary.cc @@ -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 diff --git a/src/dictionary.h b/src/dictionary.h index 4cbdb93..826a8bf 100644 --- a/src/dictionary.h +++ b/src/dictionary.h @@ -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 */ diff --git a/src/dinput.cc b/src/dinput.cc index 8aa7a9f..d84b9f3 100644 --- a/src/dinput.cc +++ b/src/dinput.cc @@ -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 diff --git a/src/dinput.h b/src/dinput.h index 9a16a0d..51e76e7 100644 --- a/src/dinput.h +++ b/src/dinput.h @@ -3,6 +3,8 @@ #include +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 */ diff --git a/src/display_monitor.cc b/src/display_monitor.cc index 57fd585..02a52f4 100644 --- a/src/display_monitor.cc +++ b/src/display_monitor.cc @@ -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 diff --git a/src/display_monitor.h b/src/display_monitor.h index 7fbe0ad..39d5a19 100644 --- a/src/display_monitor.h +++ b/src/display_monitor.h @@ -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 */ diff --git a/src/draw.cc b/src/draw.cc index 32b52ef..8fa1b00 100644 --- a/src/draw.cc +++ b/src/draw.cc @@ -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 diff --git a/src/draw.h b/src/draw.h index 2679315..49d068b 100644 --- a/src/draw.h +++ b/src/draw.h @@ -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 */ diff --git a/src/electronic_registration.cc b/src/electronic_registration.cc index 2eb0b34..72b8602 100644 --- a/src/electronic_registration.cc +++ b/src/electronic_registration.cc @@ -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 diff --git a/src/electronic_registration.h b/src/electronic_registration.h index 84aa9b4..90dd5bc 100644 --- a/src/electronic_registration.h +++ b/src/electronic_registration.h @@ -1,6 +1,10 @@ #ifndef ELECTRONIC_REGISTRATION_H #define ELECTRONIC_REGISTRATION_H +namespace fallout { + void runElectronicRegistration(); +} // namespace fallout + #endif /* ELECTRONIC_REGISTRATION_H */ diff --git a/src/elevator.cc b/src/elevator.cc index df47652..7e4a7db 100644 --- a/src/elevator.cc +++ b/src/elevator.cc @@ -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 diff --git a/src/elevator.h b/src/elevator.h index ba1985c..a495aa0 100644 --- a/src/elevator.h +++ b/src/elevator.h @@ -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 */ diff --git a/src/endgame.cc b/src/endgame.cc index 475ca34..40ac7e7 100644 --- a/src/endgame.cc +++ b/src/endgame.cc @@ -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 diff --git a/src/endgame.h b/src/endgame.h index 02874a4..d21cadc 100644 --- a/src/endgame.h +++ b/src/endgame.h @@ -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 */ diff --git a/src/export.cc b/src/export.cc index bc345c4..5995c68 100644 --- a/src/export.cc +++ b/src/export.cc @@ -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 diff --git a/src/export.h b/src/export.h index 4cdbbba..7e3e61e 100644 --- a/src/export.h +++ b/src/export.h @@ -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 */ diff --git a/src/file_find.cc b/src/file_find.cc index 85e7bf3..0c622fc 100644 --- a/src/file_find.cc +++ b/src/file_find.cc @@ -5,6 +5,8 @@ #include +namespace fallout { + // 0x4E6380 bool fileFindFirst(const char* path, DirectoryFileFindData* findData) { @@ -95,3 +97,5 @@ bool findFindClose(DirectoryFileFindData* findData) return true; } + +} // namespace fallout diff --git a/src/file_find.h b/src/file_find.h index 0205757..112c51d 100644 --- a/src/file_find.h +++ b/src/file_find.h @@ -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 */ diff --git a/src/file_utils.cc b/src/file_utils.cc index c121535..3c47e5b 100644 --- a/src/file_utils.cc +++ b/src/file_utils.cc @@ -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 diff --git a/src/file_utils.h b/src/file_utils.h index 10f626a..b58f0b3 100644 --- a/src/file_utils.h +++ b/src/file_utils.h @@ -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 */ diff --git a/src/font_manager.cc b/src/font_manager.cc index c9cfa8b..a9c5a1a 100644 --- a/src/font_manager.cc +++ b/src/font_manager.cc @@ -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 diff --git a/src/font_manager.h b/src/font_manager.h index 556cbdc..1d8c78e 100644 --- a/src/font_manager.h +++ b/src/font_manager.h @@ -3,9 +3,13 @@ #include "text_font.h" +namespace fallout { + extern FontManager gModernFontManager; int interfaceFontsInit(); void interfaceFontsExit(); +} // namespace fallout + #endif /* FONT_MANAGER_H */ diff --git a/src/fps_limiter.cc b/src/fps_limiter.cc index 5c1897a..8ac9a56 100644 --- a/src/fps_limiter.cc +++ b/src/fps_limiter.cc @@ -2,6 +2,8 @@ #include +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 diff --git a/src/fps_limiter.h b/src/fps_limiter.h index 9617154..95df0aa 100644 --- a/src/fps_limiter.h +++ b/src/fps_limiter.h @@ -3,6 +3,8 @@ #include +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 */ diff --git a/src/game.cc b/src/game.cc index c0f1870..b33faff 100644 --- a/src/game.cc +++ b/src/game.cc @@ -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 diff --git a/src/game.h b/src/game.h index 27a1178..992958e 100644 --- a/src/game.h +++ b/src/game.h @@ -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 */ diff --git a/src/game_config.cc b/src/game_config.cc index 5403fff..a6b2a0c 100644 --- a/src/game_config.cc +++ b/src/game_config.cc @@ -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 diff --git a/src/game_config.h b/src/game_config.h index 5f5e11f..a444762 100644 --- a/src/game_config.h +++ b/src/game_config.h @@ -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 */ diff --git a/src/game_dialog.cc b/src/game_dialog.cc index 88562d2..5a4ac63 100644 --- a/src/game_dialog.cc +++ b/src/game_dialog.cc @@ -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 diff --git a/src/game_dialog.h b/src/game_dialog.h index 7181e9b..fbff109 100644 --- a/src/game_dialog.h +++ b/src/game_dialog.h @@ -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 */ diff --git a/src/game_memory.cc b/src/game_memory.cc index 942bf27..c88c60d 100644 --- a/src/game_memory.cc +++ b/src/game_memory.cc @@ -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 diff --git a/src/game_memory.h b/src/game_memory.h index 1923eb7..1fe8874 100644 --- a/src/game_memory.h +++ b/src/game_memory.h @@ -1,6 +1,10 @@ #ifndef GAME_MEMORY_H #define GAME_MEMORY_H +namespace fallout { + int gameMemoryInit(); +} // namespace fallout + #endif /* GAME_MEMORY_H */ diff --git a/src/game_mouse.cc b/src/game_mouse.cc index 001f774..01caf3d 100644 --- a/src/game_mouse.cc +++ b/src/game_mouse.cc @@ -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 diff --git a/src/game_mouse.h b/src/game_mouse.h index b546e78..f898b69 100644 --- a/src/game_mouse.h +++ b/src/game_mouse.h @@ -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 */ diff --git a/src/game_movie.cc b/src/game_movie.cc index 31dc904..a0b6cca 100644 --- a/src/game_movie.cc +++ b/src/game_movie.cc @@ -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 diff --git a/src/game_movie.h b/src/game_movie.h index 9a45da8..b448e4e 100644 --- a/src/game_movie.h +++ b/src/game_movie.h @@ -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 */ diff --git a/src/game_palette.cc b/src/game_palette.cc index 09cd371..bef78c1 100644 --- a/src/game_palette.cc +++ b/src/game_palette.cc @@ -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 diff --git a/src/game_palette.h b/src/game_palette.h index 774ea34..cd809b2 100644 --- a/src/game_palette.h +++ b/src/game_palette.h @@ -1,6 +1,10 @@ #ifndef GAME_PALETTE_H #define GAME_PALETTE_H +namespace fallout { + int _HighRGB_(int a1); +} // namespace fallout + #endif /* GAME_PALETTE_H */ diff --git a/src/game_sound.cc b/src/game_sound.cc index 8a499ad..a9510ca 100644 --- a/src/game_sound.cc +++ b/src/game_sound.cc @@ -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 diff --git a/src/game_sound.h b/src/game_sound.h index 87209d1..b6f98f1 100644 --- a/src/game_sound.h +++ b/src/game_sound.h @@ -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 */ diff --git a/src/game_vars.h b/src/game_vars.h index 5751d5f..245a6ee 100644 --- a/src/game_vars.h +++ b/src/game_vars.h @@ -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 */ diff --git a/src/geometry.cc b/src/geometry.cc index 22d6c92..e18eabb 100644 --- a/src/geometry.cc +++ b/src/geometry.cc @@ -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 diff --git a/src/geometry.h b/src/geometry.h index 2896065..da322fe 100644 --- a/src/geometry.h +++ b/src/geometry.h @@ -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 */ diff --git a/src/graph_lib.cc b/src/graph_lib.cc index e9f58cc..8f3adaf 100644 --- a/src/graph_lib.cc +++ b/src/graph_lib.cc @@ -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 diff --git a/src/graph_lib.h b/src/graph_lib.h index 2b38ea7..487c7c1 100644 --- a/src/graph_lib.h +++ b/src/graph_lib.h @@ -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 */ diff --git a/src/grayscale.cc b/src/grayscale.cc index 5c52f6a..ecc2b3f 100644 --- a/src/grayscale.cc +++ b/src/grayscale.cc @@ -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 diff --git a/src/grayscale.h b/src/grayscale.h index f17dd0d..9492cc3 100644 --- a/src/grayscale.h +++ b/src/grayscale.h @@ -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 */ diff --git a/src/heap.cc b/src/heap.cc index 7831b2c..51236c2 100644 --- a/src/heap.cc +++ b/src/heap.cc @@ -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 diff --git a/src/heap.h b/src/heap.h index e703586..f6cdca7 100644 --- a/src/heap.h +++ b/src/heap.h @@ -1,6 +1,8 @@ #ifndef HEAP_H #define HEAP_H +namespace fallout { + typedef struct HeapHandle { unsigned int state; unsigned char* data; @@ -29,4 +31,6 @@ bool heapLock(Heap* heap, int handleIndex, unsigned char** bufferPtr); bool heapUnlock(Heap* heap, int handleIndex); bool heapValidate(Heap* heap); +} // namespace fallout + #endif /* HEAP_H */ diff --git a/src/interface.cc b/src/interface.cc index 58a0bfa..d472abf 100644 --- a/src/interface.cc +++ b/src/interface.cc @@ -33,6 +33,8 @@ #include "tile.h" #include "window_manager.h" +namespace fallout { + // The width of connectors in the indicator box. // // There are male connectors on the left, and female connectors on the right. @@ -2723,3 +2725,5 @@ bool indicatorBarHide() return oldIsVisible; } + +} // namespace fallout diff --git a/src/interface.h b/src/interface.h index 08382f5..bbc9d2a 100644 --- a/src/interface.h +++ b/src/interface.h @@ -4,6 +4,8 @@ #include "db.h" #include "obj_types.h" +namespace fallout { + typedef enum Hand { // Item1 (Punch) HAND_LEFT, @@ -63,4 +65,6 @@ int indicatorBarRefresh(); bool indicatorBarShow(); bool indicatorBarHide(); +} // namespace fallout + #endif /* INTERFACE_H */ diff --git a/src/interpreter.cc b/src/interpreter.cc index 1b5ab9a..36c7c1a 100644 --- a/src/interpreter.cc +++ b/src/interpreter.cc @@ -15,6 +15,8 @@ #include "memory_manager.h" #include "platform_compat.h" +namespace fallout { + typedef struct ProgramListNode { Program* program; struct ProgramListNode* next; // next @@ -3239,3 +3241,5 @@ bool ProgramValue::isEmpty() // Should be unreachable. return true; } + +} // namespace fallout diff --git a/src/interpreter.h b/src/interpreter.h index ae0dc32..764d14e 100644 --- a/src/interpreter.h +++ b/src/interpreter.h @@ -5,6 +5,8 @@ #include +namespace fallout { + // The maximum number of opcodes. #define OPCODE_MAX_COUNT (342) @@ -225,4 +227,6 @@ ProgramValue programReturnStackPopValue(Program* program); int programReturnStackPopInteger(Program* program); void* programReturnStackPopPointer(Program* program); +} // namespace fallout + #endif /* INTERPRETER_H */ diff --git a/src/interpreter_extra.cc b/src/interpreter_extra.cc index 1fce8bc..05df191 100644 --- a/src/interpreter_extra.cc +++ b/src/interpreter_extra.cc @@ -44,6 +44,8 @@ #include "trait.h" #include "worldmap.h" +namespace fallout { + typedef enum ScriptError { SCRIPT_ERROR_NOT_IMPLEMENTED, SCRIPT_ERROR_OBJECT_IS_NULL, @@ -5039,3 +5041,5 @@ void intExtraUpdate() void intExtraRemoveProgramReferences(Program* program) { } + +} // namespace fallout diff --git a/src/interpreter_extra.h b/src/interpreter_extra.h index b884185..475aed2 100644 --- a/src/interpreter_extra.h +++ b/src/interpreter_extra.h @@ -3,9 +3,13 @@ #include "interpreter.h" +namespace fallout { + void _intExtraClose_(); void _initIntExtra(); void intExtraUpdate(); void intExtraRemoveProgramReferences(Program* program); +} // namespace fallout + #endif /* INTERPRETER_EXTRA_H */ diff --git a/src/interpreter_lib.cc b/src/interpreter_lib.cc index a47dd12..4abe7ed 100644 --- a/src/interpreter_lib.cc +++ b/src/interpreter_lib.cc @@ -15,6 +15,8 @@ #include "window.h" #include "window_manager_private.h" +namespace fallout { + #define INT_LIB_SOUNDS_CAPACITY (32) #define INT_LIB_KEY_HANDLERS_CAPACITY (256) @@ -2306,3 +2308,5 @@ void intLibRemoveProgramReferences(Program* program) } } } + +} // namespace fallout diff --git a/src/interpreter_lib.h b/src/interpreter_lib.h index 2b22e8d..c56c208 100644 --- a/src/interpreter_lib.h +++ b/src/interpreter_lib.h @@ -3,6 +3,8 @@ #include "interpreter.h" +namespace fallout { + typedef void(IntLibProgramDeleteCallback)(Program*); void intLibUpdate(); @@ -11,4 +13,6 @@ void intLibInit(); void intLibRegisterProgramDeleteCallback(IntLibProgramDeleteCallback* callback); void intLibRemoveProgramReferences(Program* program); +} // namespace fallout + #endif /* INTERPRETER_LIB_H */ diff --git a/src/inventory.cc b/src/inventory.cc index 61d2a4a..4652d62 100644 --- a/src/inventory.cc +++ b/src/inventory.cc @@ -43,6 +43,8 @@ #include "tile.h" #include "window_manager.h" +namespace fallout { + #define INVENTORY_WINDOW_X 80 #define INVENTORY_WINDOW_Y 0 @@ -5466,3 +5468,5 @@ int _inven_set_timer(Object* a1) return seconds; } + +} // namespace fallout diff --git a/src/inventory.h b/src/inventory.h index 3afb6eb..58dcf31 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -3,6 +3,8 @@ #include "obj_types.h" +namespace fallout { + typedef void InventoryPrintItemDescriptionHandler(char* string); void _inven_reset_dude(); @@ -26,4 +28,6 @@ int inventoryOpenStealing(Object* a1, Object* a2); void inventoryOpenTrade(int win, Object* a2, Object* a3, Object* a4, int a5); int _inven_set_timer(Object* a1); +} // namespace fallout + #endif /* INVENTORY_H */ diff --git a/src/item.cc b/src/item.cc index c4bbf19..383fd18 100644 --- a/src/item.cc +++ b/src/item.cc @@ -33,6 +33,8 @@ #include "tile.h" #include "trait.h" +namespace fallout { + #define ADDICTION_COUNT (9) // Max number of books that can be loaded from books.ini. This limit is imposed @@ -3603,3 +3605,5 @@ bool itemIsHealing(int pid) return false; } + +} // namespace fallout diff --git a/src/item.h b/src/item.h index 538f8f5..a79f852 100644 --- a/src/item.h +++ b/src/item.h @@ -4,6 +4,8 @@ #include "db.h" #include "obj_types.h" +namespace fallout { + typedef enum AttackType { ATTACK_TYPE_NONE, ATTACK_TYPE_UNARMED, @@ -152,4 +154,6 @@ int explosionGetMaxTargets(); void explosionSetMaxTargets(int maxTargets); bool itemIsHealing(int pid); +} // namespace fallout + #endif /* ITEM_H */ diff --git a/src/light.cc b/src/light.cc index 844b5a1..48f3a84 100644 --- a/src/light.cc +++ b/src/light.cc @@ -7,6 +7,8 @@ #include "perk.h" #include "tile.h" +namespace fallout { + // 20% of max light per "Night Vision" rank #define LIGHT_LEVEL_NIGHT_VISION_BONUS (65536 / 5) @@ -138,3 +140,5 @@ void lightResetIntensity() } } } + +} // namespace fallout diff --git a/src/light.h b/src/light.h index 253beb7..414754e 100644 --- a/src/light.h +++ b/src/light.h @@ -1,6 +1,8 @@ #ifndef LIGHT_H #define LIGHT_H +namespace fallout { + #define LIGHT_LEVEL_MIN (65536 / 4) #define LIGHT_LEVEL_MAX 65536 @@ -16,4 +18,6 @@ void lightIncreaseIntensity(int elevation, int tile, int intensity); void lightDecreaseIntensity(int elevation, int tile, int intensity); void lightResetIntensity(); +} // namespace fallout + #endif /* LIGHT_H */ diff --git a/src/lips.cc b/src/lips.cc index de2e9b7..d08275a 100644 --- a/src/lips.cc +++ b/src/lips.cc @@ -12,6 +12,8 @@ #include "platform_compat.h" #include "sound.h" +namespace fallout { + static char* _lips_fix_string(const char* fileName, size_t length); static int lipsReadV1(LipsData* a1, File* stream); static int _lips_make_speech(); @@ -467,3 +469,5 @@ int lipsFree() return 0; } + +} // namespace fallout diff --git a/src/lips.h b/src/lips.h index f2a2f0d..99552f7 100644 --- a/src/lips.h +++ b/src/lips.h @@ -5,6 +5,8 @@ #include "sound.h" +namespace fallout { + #define PHONEME_COUNT (42) typedef enum LipsFlags { @@ -54,4 +56,6 @@ int lipsStart(); int lipsLoad(const char* audioFileName, const char* headFileName); int lipsFree(); +} // namespace fallout + #endif /* LIPS_H */ diff --git a/src/loadsave.cc b/src/loadsave.cc index 2742af4..ce84f82 100644 --- a/src/loadsave.cc +++ b/src/loadsave.cc @@ -53,6 +53,8 @@ #include "word_wrap.h" #include "worldmap.h" +namespace fallout { + #define LS_WINDOW_WIDTH 640 #define LS_WINDOW_HEIGHT 480 @@ -2778,3 +2780,5 @@ static int _EraseSave() return 0; } + +} // namespace fallout diff --git a/src/loadsave.h b/src/loadsave.h index dc50ec0..77e6757 100644 --- a/src/loadsave.h +++ b/src/loadsave.h @@ -1,6 +1,8 @@ #ifndef LOAD_SAVE_GAME_H #define LOAD_SAVE_GAME_H +namespace fallout { + typedef enum LoadSaveMode { // Special case - loading game from main menu. LOAD_SAVE_MODE_FROM_MAIN_MENU, @@ -20,4 +22,6 @@ int _isLoadingGame(); void lsgInit(); int _MapDirEraseFile_(const char* a1, const char* a2); +} // namespace fallout + #endif /* LOAD_SAVE_GAME_H */ diff --git a/src/main.cc b/src/main.cc index c2ec317..f2a4c00 100644 --- a/src/main.cc +++ b/src/main.cc @@ -40,6 +40,8 @@ #include "word_wrap.h" #include "worldmap.h" +namespace fallout { + #define MAIN_MENU_WINDOW_WIDTH 640 #define MAIN_MENU_WINDOW_HEIGHT 480 @@ -1112,3 +1114,5 @@ static void main_menu_play_sound(const char* fileName) { soundPlayFile(fileName); } + +} // namespace fallout diff --git a/src/main.h b/src/main.h index a4bcf77..bd63c8e 100644 --- a/src/main.h +++ b/src/main.h @@ -1,6 +1,10 @@ #ifndef MAIN_H #define MAIN_H +namespace fallout { + int falloutMain(int argc, char** argv); +} // namespace fallout + #endif /* MAIN_H */ diff --git a/src/map.cc b/src/map.cc index 1d3cff8..64d72e6 100644 --- a/src/map.cc +++ b/src/map.cc @@ -42,6 +42,8 @@ #include "window_manager_private.h" #include "worldmap.h" +namespace fallout { + static char* mapBuildPath(char* name); static int mapLoad(File* stream); static int _map_age_dead_critters(); @@ -1741,3 +1743,5 @@ static int mapHeaderRead(MapHeader* ptr, File* stream) return 0; } + +} // namespace fallout diff --git a/src/map.h b/src/map.h index 81f5364..4b95b89 100644 --- a/src/map.h +++ b/src/map.h @@ -9,6 +9,8 @@ #include "message.h" #include "platform_compat.h" +namespace fallout { + #define ORIGINAL_ISO_WINDOW_WIDTH 640 #define ORIGINAL_ISO_WINDOW_HEIGHT 380 @@ -107,4 +109,6 @@ int mapSetTransition(MapTransition* transition); int mapHandleTransition(); int _map_save_in_game(bool a1); +} // namespace fallout + #endif /* MAP_H */ diff --git a/src/map_defs.h b/src/map_defs.h index 33124bd..354698c 100644 --- a/src/map_defs.h +++ b/src/map_defs.h @@ -1,6 +1,8 @@ #ifndef MAPDEFS_H #define MAPDEFS_H +namespace fallout { + #define ELEVATION_COUNT (3) #define SQUARE_GRID_WIDTH (100) @@ -26,4 +28,6 @@ static inline bool hexGridTileIsValid(int tile) return tile >= 0 && tile < HEX_GRID_SIZE; } +} // namespace fallout + #endif /* MAPDEFS_H */ diff --git a/src/memory.cc b/src/memory.cc index 0ca4ccf..75e9ca9 100644 --- a/src/memory.cc +++ b/src/memory.cc @@ -6,6 +6,8 @@ #include "debug.h" +namespace fallout { + // A special value that denotes a beginning of a memory block data. #define MEMORY_BLOCK_HEADER_GUARD (0xFEEDFACE) @@ -218,3 +220,5 @@ static void memoryBlockValidate(void* block) debugPrint("Memory footer stomped.\n"); } } + +} // namespace fallout diff --git a/src/memory.h b/src/memory.h index 44a7129..facaa54 100644 --- a/src/memory.h +++ b/src/memory.h @@ -3,9 +3,13 @@ #include "memory_defs.h" +namespace fallout { + char* internal_strdup(const char* string); void* internal_malloc(size_t size); void* internal_realloc(void* ptr, size_t size); void internal_free(void* ptr); +} // namespace fallout + #endif /* MEMORY_H */ diff --git a/src/memory_defs.h b/src/memory_defs.h index 3ef090f..78c49c9 100644 --- a/src/memory_defs.h +++ b/src/memory_defs.h @@ -3,8 +3,12 @@ #include +namespace fallout { + typedef void*(MallocProc)(size_t size); typedef void*(ReallocProc)(void* ptr, size_t newSize); typedef void(FreeProc)(void* ptr); +} // namespace fallout + #endif /* MEMORY_DEFS_H */ diff --git a/src/memory_manager.cc b/src/memory_manager.cc index 98b7759..cc06e39 100644 --- a/src/memory_manager.cc +++ b/src/memory_manager.cc @@ -5,6 +5,8 @@ #include #include +namespace fallout { + typedef void(MemoryManagerPrintErrorProc)(const char* string); static void memoryManagerDefaultPrintErrorImpl(const char* string); @@ -144,3 +146,5 @@ char* strdup_safe(const char* string, const char* file, int line) return copy; } + +} // namespace fallout diff --git a/src/memory_manager.h b/src/memory_manager.h index 3fea361..ae39d66 100644 --- a/src/memory_manager.h +++ b/src/memory_manager.h @@ -3,6 +3,8 @@ #include "memory_defs.h" +namespace fallout { + void memoryManagerSetProcs(MallocProc* mallocProc, ReallocProc* reallocProc, FreeProc* freeProc); void* internal_malloc_safe(size_t size, const char* file, int line); void* internal_realloc_safe(void* ptr, size_t size, const char* file, int line); @@ -10,4 +12,6 @@ void internal_free_safe(void* ptr, const char* file, int line); void* internal_calloc_safe(int count, int size, const char* file, int line); char* strdup_safe(const char* string, const char* file, int line); +} // namespace fallout + #endif /* MEMORY_MANAGER_H */ diff --git a/src/message.cc b/src/message.cc index ddd7725..938c2ab 100644 --- a/src/message.cc +++ b/src/message.cc @@ -13,6 +13,8 @@ #include "random.h" #include "sfall_config.h" +namespace fallout { + #define BADWORD_LENGTH_MAX 80 static bool _message_find(MessageList* msg, int num, int* out_index); @@ -614,3 +616,5 @@ void messageListFilterGenderWords(MessageList* messageList, int gender) } } } + +} // namespace fallout diff --git a/src/message.h b/src/message.h index ff70d76..b39d591 100644 --- a/src/message.h +++ b/src/message.h @@ -1,6 +1,8 @@ #ifndef MESSAGE_H #define MESSAGE_H +namespace fallout { + #define MESSAGE_LIST_ITEM_TEXT_FILTERED 0x01 #define MESSAGE_LIST_ITEM_FIELD_MAX_SIZE 1024 @@ -29,4 +31,6 @@ bool messageListFilterBadwords(MessageList* messageList); void messageListFilterGenderWords(MessageList* messageList, int gender); +} // namespace fallout + #endif /* MESSAGE_H */ diff --git a/src/mmx.cc b/src/mmx.cc index ce328ac..7b143e5 100644 --- a/src/mmx.cc +++ b/src/mmx.cc @@ -4,6 +4,8 @@ #include "core.h" +namespace fallout { + // Return `true` if CPU supports MMX. // // 0x4E08A0 @@ -54,3 +56,5 @@ void mmxBlitTrans(unsigned char* dest, int destPitch, unsigned char* src, int sr } } } + +} // namespace fallout diff --git a/src/mmx.h b/src/mmx.h index 4c97a29..051397b 100644 --- a/src/mmx.h +++ b/src/mmx.h @@ -1,8 +1,12 @@ #ifndef MMX_H #define MMX_H +namespace fallout { + 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); +} // namespace fallout + #endif /* MMX_H */ diff --git a/src/mouse_manager.cc b/src/mouse_manager.cc index 472f250..c197dbc 100644 --- a/src/mouse_manager.cc +++ b/src/mouse_manager.cc @@ -9,6 +9,8 @@ #include "memory_manager.h" #include "platform_compat.h" +namespace fallout { + // 0x5195A8 MouseManagerNameMangler* gMouseManagerNameMangler = mouseManagerNameManglerDefaultImpl; @@ -639,3 +641,5 @@ void mouseManagerShowMouse() { mouseShowCursor(); } + +} // namespace fallout diff --git a/src/mouse_manager.h b/src/mouse_manager.h index 22b6778..4f82094 100644 --- a/src/mouse_manager.h +++ b/src/mouse_manager.h @@ -1,6 +1,8 @@ #ifndef MOUSE_MANAGER_H #define MOUSE_MANAGER_H +namespace fallout { + #define MOUSE_MGR_CACHE_CAPACITY 32 typedef char*(MouseManagerNameMangler)(char* fileName); @@ -78,4 +80,6 @@ void mouseManagerResetMouse(); void mouseManagerHideMouse(); void mouseManagerShowMouse(); +} // namespace fallout + #endif /* MOUSE_MANAGER_H */ diff --git a/src/movie.cc b/src/movie.cc index 4676e72..7f93bce 100644 --- a/src/movie.cc +++ b/src/movie.cc @@ -21,6 +21,8 @@ #include "window.h" #include "window_manager.h" +namespace fallout { + typedef struct MovieSubtitleListNode { int num; char* text; @@ -1011,3 +1013,5 @@ int _moviePlaying() { return _running; } + +} // namespace fallout diff --git a/src/movie.h b/src/movie.h index b478f55..686b83b 100644 --- a/src/movie.h +++ b/src/movie.h @@ -3,6 +3,8 @@ #include "geometry.h" +namespace fallout { + typedef enum MovieFlags { MOVIE_FLAG_0x01 = 0x01, MOVIE_FLAG_0x02 = 0x02, @@ -42,4 +44,6 @@ void movieSetVolume(int volume); void _movieUpdate(); int _moviePlaying(); +} // namespace fallout + #endif /* MOVIE_H */ diff --git a/src/movie_effect.cc b/src/movie_effect.cc index 799f3ef..1774f56 100644 --- a/src/movie_effect.cc +++ b/src/movie_effect.cc @@ -11,6 +11,8 @@ #include "palette.h" #include "platform_compat.h" +namespace fallout { + typedef enum MovieEffectType { MOVIE_EFFECT_TYPE_NONE = 0, MOVIE_EFFECT_TYPE_FADE_IN = 1, @@ -295,3 +297,5 @@ static void movieEffectsClear() gMovieEffectHead = NULL; } + +} // namespace fallout diff --git a/src/movie_effect.h b/src/movie_effect.h index 621d90c..dda1332 100644 --- a/src/movie_effect.h +++ b/src/movie_effect.h @@ -1,10 +1,14 @@ #ifndef MOVIE_EFFECT_H #define MOVIE_EFFECT_H +namespace fallout { + int movieEffectsInit(); void movieEffectsReset(); void movieEffectsExit(); int movieEffectsLoad(const char* fileName); void _moviefx_stop(); +} // namespace fallout + #endif /* MOVIE_EFFECT_H */ diff --git a/src/movie_lib.cc b/src/movie_lib.cc index e31eec3..e407ce1 100644 --- a/src/movie_lib.cc +++ b/src/movie_lib.cc @@ -11,6 +11,8 @@ #include "audio_engine.h" #include "platform_compat.h" +namespace fallout { + typedef struct STRUCT_6B3690 { void* field_0; unsigned int field_4; @@ -2791,3 +2793,5 @@ static void _nfPkDecomp(unsigned char* a1, unsigned char* a2, int a3, int a4, in dest += var_8; } } + +} // namespace fallout diff --git a/src/movie_lib.h b/src/movie_lib.h index 6997299..2e2e5d5 100644 --- a/src/movie_lib.h +++ b/src/movie_lib.h @@ -5,6 +5,8 @@ #include "memory_defs.h" +namespace fallout { + typedef bool MovieReadProc(int fileHandle, void* buffer, int count); typedef void(MovieShowFrameProc)(SDL_Surface*, int, int, int, int, int, int, int, int); @@ -23,4 +25,6 @@ int _MVE_rmStepMovie(); void _MVE_rmEndMovie(); void _MVE_ReleaseMem(); +} // namespace fallout + #endif /* MOVIE_LIB_H */ diff --git a/src/nevs.cc b/src/nevs.cc index 1857bb1..a51b766 100644 --- a/src/nevs.cc +++ b/src/nevs.cc @@ -8,6 +8,8 @@ #include "memory_manager.h" #include "platform_compat.h" +namespace fallout { + #define NEVS_COUNT 40 typedef struct Nevs { @@ -220,3 +222,5 @@ void _nevs_update() } } } + +} // namespace fallout diff --git a/src/nevs.h b/src/nevs.h index 2ab0c52..757227a 100644 --- a/src/nevs.h +++ b/src/nevs.h @@ -3,6 +3,8 @@ #include "interpreter.h" +namespace fallout { + typedef enum NevsType { NEVS_TYPE_EVENT = 0, NEVS_TYPE_HANDLER = 1, @@ -15,4 +17,6 @@ int _nevs_clearevent(const char* name); int _nevs_signal(const char* name); void _nevs_update(); +} // namespace fallout + #endif /* NEVS_H */ diff --git a/src/obj_types.h b/src/obj_types.h index c63e14c..28824dc 100644 --- a/src/obj_types.h +++ b/src/obj_types.h @@ -1,6 +1,8 @@ #ifndef OBJ_TYPES_H #define OBJ_TYPES_H +namespace fallout { + // Rotation typedef enum Rotation { ROTATION_NE, // 0 @@ -299,4 +301,6 @@ static inline int builtTileCreate(int tile, int elevation) return tile | ((elevation << BUILT_TILE_ELEVATION_SHIFT) & BUILT_TILE_ELEVATION_MASK); } +} // namespace fallout + #endif /* OBJ_TYPES_H */ diff --git a/src/object.cc b/src/object.cc index 018a9b6..a2dd933 100644 --- a/src/object.cc +++ b/src/object.cc @@ -26,6 +26,8 @@ #include "tile.h" #include "worldmap.h" +namespace fallout { + static int objectLoadAllInternal(File* stream); static void _obj_fix_combat_cid_for_dude(); static void _object_fix_weapon_ammo(Object* obj); @@ -5235,3 +5237,5 @@ Object* objectTypedFindById(int id, int type) return NULL; } + +} // namespace fallout diff --git a/src/object.h b/src/object.h index 18ae033..95b1bcb 100644 --- a/src/object.h +++ b/src/object.h @@ -7,6 +7,8 @@ #include "map_defs.h" #include "obj_types.h" +namespace fallout { + typedef struct ObjectWithFlags { int flags; Object* object; @@ -98,4 +100,6 @@ void _obj_fix_violence_settings(int* fid); Object* objectTypedFindById(int id, int type); +} // namespace fallout + #endif /* OBJECT_H */ diff --git a/src/options.cc b/src/options.cc index 4bf97af..5374915 100644 --- a/src/options.cc +++ b/src/options.cc @@ -30,6 +30,8 @@ #include "tile.h" #include "window_manager.h" +namespace fallout { + #define PREFERENCES_WINDOW_WIDTH 640 #define PREFERENCES_WINDOW_HEIGHT 480 @@ -2070,3 +2072,5 @@ int _do_options() { return showOptionsWithInitialKeyCode(-1); } + +} // namespace fallout diff --git a/src/options.h b/src/options.h index e91120e..0571a6e 100644 --- a/src/options.h +++ b/src/options.h @@ -3,6 +3,8 @@ #include "db.h" +namespace fallout { + extern int gPreferencesSoundEffectsVolume1; extern int gPreferencesSubtitles1; extern int gPreferencesLanguageFilter1; @@ -31,4 +33,6 @@ void brightnessIncrease(); void brightnessDecrease(); int _do_options(); +} // namespace fallout + #endif /* OPTIONS_H */ diff --git a/src/palette.cc b/src/palette.cc index b3edb18..6d28b46 100644 --- a/src/palette.cc +++ b/src/palette.cc @@ -8,6 +8,8 @@ #include "debug.h" #include "game_sound.h" +namespace fallout { + static void _palette_reset_(); // 0x6639D0 @@ -106,3 +108,5 @@ void paletteSetEntriesInRange(unsigned char* palette, int start, int end) memcpy(gPalette + 3 * start, palette, 3 * (end - start + 1)); _setSystemPaletteEntries(palette, start, end); } + +} // namespace fallout diff --git a/src/palette.h b/src/palette.h index 6052cdc..d55ce5a 100644 --- a/src/palette.h +++ b/src/palette.h @@ -1,6 +1,8 @@ #ifndef PALETTE_H #define PALETTE_H +namespace fallout { + extern unsigned char gPaletteWhite[256 * 3]; extern unsigned char gPaletteBlack[256 * 3]; @@ -11,4 +13,6 @@ void paletteFadeTo(unsigned char* palette); void paletteSetEntries(unsigned char* palette); void paletteSetEntriesInRange(unsigned char* palette, int start, int end); +} // namespace fallout + #endif /* PALETTE_H */ diff --git a/src/party_member.cc b/src/party_member.cc index bb3b5f1..8f558ee 100644 --- a/src/party_member.cc +++ b/src/party_member.cc @@ -32,6 +32,8 @@ #include "tile.h" #include "window_manager.h" +namespace fallout { + typedef struct PartyMemberDescription { bool areaAttackMode[AREA_ATTACK_MODE_COUNT]; bool runAwayMode[RUN_AWAY_MODE_COUNT]; @@ -1667,3 +1669,5 @@ int partyGetMaxWoundToHealByRest() return maxWound; } + +} // namespace fallout diff --git a/src/party_member.h b/src/party_member.h index 1df09a1..84635aa 100644 --- a/src/party_member.h +++ b/src/party_member.h @@ -4,6 +4,8 @@ #include "db.h" #include "obj_types.h" +namespace fallout { + extern int gPartyMemberDescriptionsLength; extern int* gPartyMemberPids; @@ -41,4 +43,6 @@ int _partyMemberIncLevels(); bool partyIsAnyoneCanBeHealedByRest(); int partyGetMaxWoundToHealByRest(); +} // namespace fallout + #endif /* PARTY_MEMBER_H */ diff --git a/src/pcx.cc b/src/pcx.cc index c3ea7bf..5ea441f 100644 --- a/src/pcx.cc +++ b/src/pcx.cc @@ -2,6 +2,8 @@ #include "memory_manager.h" +namespace fallout { + // 0x519DC8 unsigned char gPcxLastRunLength = 0; @@ -176,3 +178,5 @@ unsigned char* pcxRead(const char* path, int* widthPtr, int* heightPtr, unsigned return data; } + +} // namespace fallout diff --git a/src/pcx.h b/src/pcx.h index 7900048..0f41d2f 100644 --- a/src/pcx.h +++ b/src/pcx.h @@ -3,6 +3,8 @@ #include "db.h" +namespace fallout { + typedef struct PcxHeader { unsigned char identifier; unsigned char version; @@ -32,4 +34,6 @@ int pcxReadLine(unsigned char* data, int size, File* stream); int pcxReadPalette(PcxHeader* pcxHeader, unsigned char* palette, File* stream); unsigned char* pcxRead(const char* path, int* widthPtr, int* heightPtr, unsigned char* palette); +} // namespace fallout + #endif /* PCX_H */ diff --git a/src/perk.cc b/src/perk.cc index 982db7e..e33f53d 100644 --- a/src/perk.cc +++ b/src/perk.cc @@ -13,6 +13,8 @@ #include "skill.h" #include "stat.h" +namespace fallout { + typedef struct PerkDescription { char* name; char* description; @@ -713,3 +715,5 @@ int perkGetSkillModifier(Object* critter, int skill) return modifier; } + +} // namespace fallout diff --git a/src/perk.h b/src/perk.h index 2c1dbac..b5a84bb 100644 --- a/src/perk.h +++ b/src/perk.h @@ -5,6 +5,8 @@ #include "obj_types.h" #include "perk_defs.h" +namespace fallout { + int perksInit(); void perksReset(); void perksExit(); @@ -43,4 +45,6 @@ static inline bool perkHasRank(Object* critter, int perk) return perkGetRank(critter, perk) != 0; } +} // namespace fallout + #endif /* PERK_H */ diff --git a/src/perk_defs.h b/src/perk_defs.h index bb97ebd..63ef673 100644 --- a/src/perk_defs.h +++ b/src/perk_defs.h @@ -1,6 +1,8 @@ #ifndef PERK_DEFS_H #define PERK_DEFS_H +namespace fallout { + typedef enum Perk { PERK_AWARENESS, PERK_BONUS_HTH_ATTACKS, @@ -124,4 +126,6 @@ typedef enum Perk { PERK_COUNT, } Perk; +} // namespace fallout + #endif /* PERK_DEFS_H */ diff --git a/src/pipboy.cc b/src/pipboy.cc index 78c4530..f5d6129 100644 --- a/src/pipboy.cc +++ b/src/pipboy.cc @@ -37,6 +37,8 @@ #include "word_wrap.h" #include "worldmap.h" +namespace fallout { + #define PIPBOY_WINDOW_WIDTH (640) #define PIPBOY_WINDOW_HEIGHT (480) @@ -2578,3 +2580,5 @@ static void holodiskFree() gHolodisksCount = 0; } + +} // namespace fallout diff --git a/src/pipboy.h b/src/pipboy.h index 93d61b3..bd17f64 100644 --- a/src/pipboy.h +++ b/src/pipboy.h @@ -3,6 +3,8 @@ #include "db.h" +namespace fallout { + typedef enum PipboyOpenIntent { PIPBOY_OPEN_INTENT_UNSPECIFIED = 0, PIPBOY_OPEN_INTENT_REST = 1, @@ -14,4 +16,6 @@ void pipboyReset(); int pipboySave(File* stream); int pipboyLoad(File* stream); +} // namespace fallout + #endif /* PIPBOY_H */ diff --git a/src/platform_compat.cc b/src/platform_compat.cc index 571af2c..ba49610 100644 --- a/src/platform_compat.cc +++ b/src/platform_compat.cc @@ -26,6 +26,8 @@ #include +namespace fallout { + int compat_stricmp(const char* string1, const char* string2) { return SDL_strcasecmp(string1, string2); @@ -303,3 +305,5 @@ long getFileSize(FILE* stream) fseek(stream, originalOffset, SEEK_SET); return filesize; } + +} // namespace fallout diff --git a/src/platform_compat.h b/src/platform_compat.h index 70807d4..4da0706 100644 --- a/src/platform_compat.h +++ b/src/platform_compat.h @@ -6,6 +6,8 @@ #include +namespace fallout { + // TODO: This is compatibility cross-platform layer. Designed to have minimal // impact on the codebase. Remove once it's no longer needed. @@ -42,4 +44,6 @@ void compat_windows_path_to_native(char* path); char* compat_strdup(const char* string); long getFileSize(FILE* stream); +} // namespace fallout + #endif /* PLATFORM_COMPAT_H */ diff --git a/src/pointer_registry.cc b/src/pointer_registry.cc index 7a14420..c88b072 100644 --- a/src/pointer_registry.cc +++ b/src/pointer_registry.cc @@ -1,5 +1,7 @@ #include "pointer_registry.h" +namespace fallout { + PointerRegistry* PointerRegistry::shared() { static PointerRegistry* shared = new PointerRegistry(); @@ -39,3 +41,5 @@ void* intToPtr(int ref, bool remove) { return PointerRegistry::shared()->fetch(ref, remove); } + +} // namespace fallout diff --git a/src/pointer_registry.h b/src/pointer_registry.h index 196ee46..ea27b93 100644 --- a/src/pointer_registry.h +++ b/src/pointer_registry.h @@ -3,6 +3,8 @@ #include +namespace fallout { + class PointerRegistry { public: static PointerRegistry* shared(); @@ -20,4 +22,6 @@ private: int ptrToInt(void* ptr); void* intToPtr(int ref, bool remove = false); +} // namespace fallout + #endif /* POINTER_REGISTRY_H */ diff --git a/src/proto.cc b/src/proto.cc index 3b13a1d..15afbcb 100644 --- a/src/proto.cc +++ b/src/proto.cc @@ -22,6 +22,8 @@ #include "stat.h" #include "trait.h" +namespace fallout { + static int _proto_critter_init(Proto* a1, int a2); static int objectCritterCombatDataRead(CritterCombatData* data, File* stream); static int objectCritterCombatDataWrite(CritterCombatData* data, File* stream); @@ -1876,3 +1878,5 @@ int _ResetPlayer() critterUpdateDerivedStats(gDude); return 0; } + +} // namespace fallout diff --git a/src/proto.h b/src/proto.h index 9c18257..1b27ce0 100644 --- a/src/proto.h +++ b/src/proto.h @@ -7,6 +7,8 @@ #include "platform_compat.h" #include "proto_types.h" +namespace fallout { + typedef enum ItemDataMember { ITEM_DATA_MEMBER_PID = 0, ITEM_DATA_MEMBER_NAME = 1, @@ -124,4 +126,6 @@ void _proto_remove_all(); int protoGetProto(int pid, Proto** out_proto); int _ResetPlayer(); +} // namespace fallout + #endif /* PROTO_H */ diff --git a/src/proto_instance.cc b/src/proto_instance.cc index 25d0ecf..ef4d7ae 100644 --- a/src/proto_instance.cc +++ b/src/proto_instance.cc @@ -32,6 +32,8 @@ #include "tile.h" #include "worldmap.h" +namespace fallout { + static int _obj_remove_from_inven(Object* critter, Object* item); static int _obj_use_book(Object* item_obj); static int _obj_use_flare(Object* critter_obj, Object* item_obj); @@ -2263,3 +2265,5 @@ int _objPMAttemptPlacement(Object* obj, int tile, int elevation) return 0; } + +} // namespace fallout diff --git a/src/proto_instance.h b/src/proto_instance.h index b1c40ac..8ef23b1 100644 --- a/src/proto_instance.h +++ b/src/proto_instance.h @@ -3,6 +3,8 @@ #include "obj_types.h" +namespace fallout { + int _obj_sid(Object* object, int* sidPtr); int _obj_new_sid(Object* object, int* sidPtr); int _obj_new_sid_inst(Object* obj, int a2, int a3); @@ -34,4 +36,6 @@ int objectUnjamAll(); int _obj_attempt_placement(Object* obj, int tile, int elevation, int a4); int _objPMAttemptPlacement(Object* obj, int tile, int elevation); +} // namespace fallout + #endif /* PROTOTYPE_INSTANCES_H */ diff --git a/src/proto_types.h b/src/proto_types.h index e42fb46..1095b5a 100644 --- a/src/proto_types.h +++ b/src/proto_types.h @@ -1,6 +1,8 @@ #ifndef PROTO_TYPES_H #define PROTO_TYPES_H +namespace fallout { + // Number of prototypes in prototype extent. #define PROTO_LIST_EXTENT_SIZE 16 @@ -474,4 +476,6 @@ typedef struct ProtoList { int max_entries_num; } ProtoList; +} // namespace fallout + #endif /* PROTO_TYPES_H */ diff --git a/src/queue.cc b/src/queue.cc index 091640d..96d1b62 100644 --- a/src/queue.cc +++ b/src/queue.cc @@ -15,6 +15,8 @@ #include "proto_instance.h" #include "scripts.h" +namespace fallout { + typedef struct QueueListNode { // TODO: Make unsigned. int time; @@ -570,3 +572,5 @@ void* queueFindNextEvent(Object* owner, int eventType) return NULL; } + +} // namespace fallout diff --git a/src/queue.h b/src/queue.h index ff3556a..d77179e 100644 --- a/src/queue.h +++ b/src/queue.h @@ -4,6 +4,8 @@ #include "db.h" #include "obj_types.h" +namespace fallout { + typedef enum EventType { EVENT_TYPE_DRUG = 0, EVENT_TYPE_KNOCKOUT = 1, @@ -70,4 +72,6 @@ bool queueIsEmpty(); void* queueFindFirstEvent(Object* owner, int eventType); void* queueFindNextEvent(Object* owner, int eventType); +} // namespace fallout + #endif /* QUEUE_H */ diff --git a/src/random.cc b/src/random.cc index 25cb662..427679e 100644 --- a/src/random.cc +++ b/src/random.cc @@ -8,6 +8,8 @@ #include "scripts.h" #include "sfall_config.h" +namespace fallout { + static int _roll_reset_(); static int randomTranslateRoll(int delta, int criticalSuccessModifier); static int getRandom(int max); @@ -252,3 +254,5 @@ static void randomValidatePrerandom() debugPrint("Warning! Sequence is not random, 95%% confidence.\n"); } } + +} // namespace fallout diff --git a/src/random.h b/src/random.h index 0917eb9..5a984dc 100644 --- a/src/random.h +++ b/src/random.h @@ -3,6 +3,8 @@ #include "db.h" +namespace fallout { + typedef enum Roll { ROLL_CRITICAL_FAILURE, ROLL_FAILURE, @@ -19,4 +21,6 @@ int randomRoll(int difficulty, int criticalSuccessModifier, int* howMuchPtr); int randomBetween(int min, int max); void randomSeedPrerandom(int seed); +} // namespace fallout + #endif /* RANDOM_H */ diff --git a/src/reaction.cc b/src/reaction.cc index 6a9c5fd..7515a02 100644 --- a/src/reaction.cc +++ b/src/reaction.cc @@ -2,6 +2,8 @@ #include "scripts.h" +namespace fallout { + // 0x4A29D0 int reactionSetValue(Object* critter, int value) { @@ -47,3 +49,5 @@ int reactionGetValue(Object* critter) return programValue.integerValue; } + +} // namespace fallout diff --git a/src/reaction.h b/src/reaction.h index 6dd3961..600ed6b 100644 --- a/src/reaction.h +++ b/src/reaction.h @@ -3,6 +3,8 @@ #include "obj_types.h" +namespace fallout { + typedef enum NpcReaction { NPC_REACTION_BAD, NPC_REACTION_NEUTRAL, @@ -14,4 +16,6 @@ int reactionTranslateValue(int a1); int _reaction_influence_(); int reactionGetValue(Object* critter); +} // namespace fallout + #endif /* REACTION_H */ diff --git a/src/region.cc b/src/region.cc index 131e869..c68fbf1 100644 --- a/src/region.cc +++ b/src/region.cc @@ -6,6 +6,8 @@ #include "debug.h" #include "memory_manager.h" +namespace fallout { + // 0x50D394 static char _aNull[] = ""; @@ -266,3 +268,5 @@ void regionAddFlag(Region* region, int value) { region->field_74 |= value; } + +} // namespace fallout diff --git a/src/region.h b/src/region.h index a53c054..bde61c6 100644 --- a/src/region.h +++ b/src/region.h @@ -4,6 +4,8 @@ #include "geometry.h" #include "interpreter.h" +namespace fallout { + #define REGION_NAME_LENGTH (32) typedef struct Region Region; @@ -45,4 +47,6 @@ void* regionGetUserData(Region* region); void regionSetUserData(Region* region, void* data); void regionAddFlag(Region* region, int value); +} // namespace fallout + #endif /* REGION_H */ diff --git a/src/scripts.cc b/src/scripts.cc index 88f21ed..d993c16 100644 --- a/src/scripts.cc +++ b/src/scripts.cc @@ -35,6 +35,8 @@ #include "window_manager_private.h" #include "worldmap.h" +namespace fallout { + #define SCRIPT_LIST_EXTENT_SIZE 16 // SFALL: Increase number of message lists for scripted dialogs. @@ -2917,3 +2919,5 @@ int _scr_explode_scenery(Object* a1, int tile, int radius, int elevation) return 0; } + +} // namespace fallout diff --git a/src/scripts.h b/src/scripts.h index 7ff7b7d..eeb8033 100644 --- a/src/scripts.h +++ b/src/scripts.h @@ -6,6 +6,8 @@ #include "interpreter.h" #include "obj_types.h" +namespace fallout { + #define SCRIPT_FLAG_0x01 (0x01) #define SCRIPT_FLAG_0x02 (0x02) #define SCRIPT_FLAG_0x04 (0x04) @@ -220,4 +222,6 @@ int scriptSetLocalVar(int sid, int var, ProgramValue& value); bool _scr_end_combat(); int _scr_explode_scenery(Object* a1, int tile, int radius, int elevation); +} // namespace fallout + #endif /* SCRIPTS_H */ diff --git a/src/select_file_list.cc b/src/select_file_list.cc index 6dd455f..d64147c 100644 --- a/src/select_file_list.cc +++ b/src/select_file_list.cc @@ -5,6 +5,8 @@ #include "db.h" +namespace fallout { + // 0x4AA250 int _compare(const void* a1, const void* a2) { @@ -33,3 +35,5 @@ void _freeFileList(char** fileList) { fileNameListFree(&fileList, 0); } + +} // namespace fallout diff --git a/src/select_file_list.h b/src/select_file_list.h index 31849d9..6d3f206 100644 --- a/src/select_file_list.h +++ b/src/select_file_list.h @@ -1,8 +1,12 @@ #ifndef SELECT_FILE_LIST_H #define SELECT_FILE_LIST_H +namespace fallout { + int _compare(const void* a1, const void* a2); char** _getFileList(const char* pattern, int* fileNameListLengthPtr); void _freeFileList(char** fileList); +} // namespace fallout + #endif /* SELECT_FILE_LIST_H */ diff --git a/src/selfrun.cc b/src/selfrun.cc index eeb2cd0..2d21ba3 100644 --- a/src/selfrun.cc +++ b/src/selfrun.cc @@ -8,6 +8,8 @@ #include "game_config.h" #include "platform_compat.h" +namespace fallout { + // 0x51C8D8 int gSelfrunState = SELFRUN_STATE_TURNED_OFF; @@ -234,3 +236,5 @@ int selfrunWriteData(const char* path, SelfrunData* selfrunData) return rc; } + +} // namespace fallout diff --git a/src/selfrun.h b/src/selfrun.h index 756304e..0905c74 100644 --- a/src/selfrun.h +++ b/src/selfrun.h @@ -1,6 +1,8 @@ #ifndef SELFRUN_H #define SELFRUN_H +namespace fallout { + #define SELFRUN_RECORDING_FILE_NAME_LENGTH 13 #define SELFRUN_MAP_FILE_NAME_LENGTH 13 @@ -30,4 +32,6 @@ void selfrunPlaybackCompleted(int reason); int selfrunReadData(const char* path, SelfrunData* selfrunData); int selfrunWriteData(const char* path, SelfrunData* selfrunData); +} // namespace fallout + #endif /* SELFRUN_H */ diff --git a/src/sfall_config.cc b/src/sfall_config.cc index 1cf9f09..3a6b0af 100644 --- a/src/sfall_config.cc +++ b/src/sfall_config.cc @@ -5,6 +5,8 @@ #include "platform_compat.h" +namespace fallout { + #define SFALL_CONFIG_FILE_NAME "ddraw.ini" bool gSfallConfigInitialized = false; @@ -75,3 +77,5 @@ void sfallConfigExit() gSfallConfigInitialized = false; } } + +} // namespace fallout diff --git a/src/sfall_config.h b/src/sfall_config.h index c6a64fd..7b4f83e 100644 --- a/src/sfall_config.h +++ b/src/sfall_config.h @@ -3,6 +3,8 @@ #include "config.h" +namespace fallout { + #define SFALL_CONFIG_FILE_NAME "ddraw.ini" #define SFALL_CONFIG_MISC_KEY "Misc" @@ -69,4 +71,6 @@ extern Config gSfallConfig; bool sfallConfigInit(int argc, char** argv); void sfallConfigExit(); +} // namespace fallout + #endif /* SFALL_CONFIG_H */ diff --git a/src/skill.cc b/src/skill.cc index 75b7037..8695408 100644 --- a/src/skill.cc +++ b/src/skill.cc @@ -27,6 +27,8 @@ #include "stat.h" #include "trait.h" +namespace fallout { + #define SKILLS_MAX_USES_PER_DAY (3) #define REPAIRABLE_DAMAGE_FLAGS_LENGTH (5) @@ -1216,3 +1218,5 @@ char* skillsGetGenericResponse(Object* critter, bool isDude) char* msg = getmsg(&gSkillsMessageList, &messageListItem, baseMessageId + messageId); return msg; } + +} // namespace fallout diff --git a/src/skill.h b/src/skill.h index a828012..991d363 100644 --- a/src/skill.h +++ b/src/skill.h @@ -6,6 +6,8 @@ #include "proto_types.h" #include "skill_defs.h" +namespace fallout { + extern int _gIsSteal; extern int _gStealCount; extern int _gStealSize; @@ -46,4 +48,6 @@ static inline bool skillIsValid(int skill) return skill >= 0 && skill < SKILL_COUNT; } +} // namespace fallout + #endif /* SKILL_H */ diff --git a/src/skill_defs.h b/src/skill_defs.h index 94b51ef..9342078 100644 --- a/src/skill_defs.h +++ b/src/skill_defs.h @@ -1,6 +1,8 @@ #ifndef SKILL_DEFS_H #define SKILL_DEFS_H +namespace fallout { + // max number of tagged skills #define NUM_TAGGED_SKILLS 4 @@ -29,4 +31,6 @@ typedef enum Skill { SKILL_COUNT, } Skill; +} // namespace fallout + #endif /* SKILL_DEFS_H */ diff --git a/src/skilldex.cc b/src/skilldex.cc index 69eabba..0e30069 100644 --- a/src/skilldex.cc +++ b/src/skilldex.cc @@ -23,6 +23,8 @@ #include "text_font.h" #include "window_manager.h" +namespace fallout { + #define SKILLDEX_WINDOW_RIGHT_MARGIN 4 #define SKILLDEX_WINDOW_BOTTOM_MARGIN 6 @@ -410,3 +412,5 @@ static void skilldexWindowFree() gameMouseSetCursor(MOUSE_CURSOR_ARROW); } + +} // namespace fallout diff --git a/src/skilldex.h b/src/skilldex.h index bd449d6..3c1b65c 100644 --- a/src/skilldex.h +++ b/src/skilldex.h @@ -1,6 +1,8 @@ #ifndef SKILLDEX_H #define SKILLDEX_H +namespace fallout { + typedef enum SkilldexRC { SKILLDEX_RC_ERROR = -1, SKILLDEX_RC_CANCELED, @@ -16,4 +18,6 @@ typedef enum SkilldexRC { int skilldexOpen(); +} // namespace fallout + #endif /* SKILLDEX_H */ diff --git a/src/sound.cc b/src/sound.cc index 10b650b..0c7d47e 100644 --- a/src/sound.cc +++ b/src/sound.cc @@ -20,6 +20,8 @@ #include "debug.h" #include "platform_compat.h" +namespace fallout { + #define SOUND_FLAG_SOUND_IS_DONE (0x01) #define SOUND_FLAG_SOUND_IS_PLAYING (0x02) #define SOUND_FLAG_SOUND_IS_FADING (0x04) @@ -1602,3 +1604,5 @@ int soundSetDefaultFileIO(SoundOpenProc* openProc, SoundCloseProc* closeProc, So gSoundLastError = SOUND_NO_ERROR; return gSoundLastError; } + +} // namespace fallout diff --git a/src/sound.h b/src/sound.h index 07f88bd..34a5712 100644 --- a/src/sound.h +++ b/src/sound.h @@ -4,6 +4,8 @@ #include "memory_defs.h" #include "win32.h" +namespace fallout { + #define VOLUME_MIN (0) #define VOLUME_MAX (0x7FFF) @@ -133,4 +135,6 @@ void soundDeleteAll(); void soundContinueAll(); int soundSetDefaultFileIO(SoundOpenProc* openProc, SoundCloseProc* closeProc, SoundReadProc* readProc, SoundWriteProc* writeProc, SoundSeekProc* seekProc, SoundTellProc* tellProc, SoundFileLengthProc* fileLengthProc); +} // namespace fallout + #endif /* SOUND_H */ diff --git a/src/sound_decoder.cc b/src/sound_decoder.cc index 626fa19..d41b717 100644 --- a/src/sound_decoder.cc +++ b/src/sound_decoder.cc @@ -11,6 +11,8 @@ #include #include +namespace fallout { + #define SOUND_DECODER_IN_BUFFER_SIZE (512) typedef int (*DECODINGPROC)(SoundDecoder* soundDecoder, int offset, int bits); @@ -1256,3 +1258,5 @@ static inline void soundDecoderDropBits(SoundDecoder* soundDecoder, int bits) soundDecoder->hold >>= bits; soundDecoder->bits -= bits; } + +} // namespace fallout diff --git a/src/sound_decoder.h b/src/sound_decoder.h index 3e09bca..4a08c29 100644 --- a/src/sound_decoder.h +++ b/src/sound_decoder.h @@ -3,6 +3,8 @@ #include +namespace fallout { + typedef int(SoundDecoderReadProc)(int fileHandle, void* buffer, unsigned int size); typedef struct SoundDecoder { @@ -41,4 +43,6 @@ size_t soundDecoderDecode(SoundDecoder* soundDecoder, void* buffer, size_t size) void soundDecoderFree(SoundDecoder* soundDecoder); SoundDecoder* soundDecoderInit(SoundDecoderReadProc* readProc, int fileHandle, int* out_a3, int* out_a4, int* out_a5); +} // namespace fallout + #endif /* SOUND_DECODER_H */ diff --git a/src/sound_effects_cache.cc b/src/sound_effects_cache.cc index 608723f..3308224 100644 --- a/src/sound_effects_cache.cc +++ b/src/sound_effects_cache.cc @@ -13,6 +13,8 @@ #include "sound_decoder.h" #include "sound_effects_list.h" +namespace fallout { + #define SOUND_EFFECTS_CACHE_MIN_SIZE (0x40000) typedef struct SoundEffect { @@ -524,3 +526,5 @@ static int _sfxc_ad_reader(int handle, void* buf, unsigned int size) return bytesToRead; } + +} // namespace fallout diff --git a/src/sound_effects_cache.h b/src/sound_effects_cache.h index cd554d5..3650bcd 100644 --- a/src/sound_effects_cache.h +++ b/src/sound_effects_cache.h @@ -1,6 +1,8 @@ #ifndef SOUND_EFFECTS_CACHE_H #define SOUND_EFFECTS_CACHE_H +namespace fallout { + // The maximum number of sound effects that can be loaded and played // simultaneously. #define SOUND_EFFECTS_MAX_COUNT (4) @@ -17,4 +19,6 @@ long soundEffectsCacheFileSeek(int handle, long offset, int origin); long soundEffectsCacheFileTell(int handle); long soundEffectsCacheFileLength(int handle); +} // namespace fallout + #endif /* SOUND_EFFECTS_CACHE_H */ diff --git a/src/sound_effects_list.cc b/src/sound_effects_list.cc index 4a9be42..b2a5aad 100644 --- a/src/sound_effects_list.cc +++ b/src/sound_effects_list.cc @@ -12,6 +12,8 @@ #include "pointer_registry.h" #include "sound_decoder.h" +namespace fallout { + typedef struct SoundEffectsListEntry { char* name; int dataSize; @@ -470,3 +472,5 @@ static int _sfxl_ad_reader(int fileHandle, void* buf, unsigned int size) { return fileRead(buf, 1, size, (File*)intToPtr(fileHandle)); } + +} // namespace fallout diff --git a/src/sound_effects_list.h b/src/sound_effects_list.h index 5062a79..26c6e7f 100644 --- a/src/sound_effects_list.h +++ b/src/sound_effects_list.h @@ -1,6 +1,8 @@ #ifndef SOUND_EFFECTS_LIST_H #define SOUND_EFFECTS_LIST_H +namespace fallout { + #define SFXL_OK (0) #define SFXL_ERR (1) #define SFXL_ERR_TAG_INVALID (2) @@ -13,4 +15,6 @@ int soundEffectsListGetFilePath(int tag, char** pathPtr); int soundEffectsListGetDataSize(int tag, int* sizePtr); int soundEffectsListGetFileSize(int tag, int* sizePtr); +} // namespace fallout + #endif /* SOUND_EFFECTS_LIST_H */ diff --git a/src/stat.cc b/src/stat.cc index 03308e0..dbf5dd3 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -26,6 +26,8 @@ #include "tile.h" #include "trait.h" +namespace fallout { + // Provides metadata about stats. typedef struct StatDescription { char* name; @@ -826,3 +828,5 @@ int pcSetExperience(int xp) return 0; } + +} // namespace fallout diff --git a/src/stat.h b/src/stat.h index afe5444..ade6efe 100644 --- a/src/stat.h +++ b/src/stat.h @@ -6,6 +6,8 @@ #include "proto_types.h" #include "stat_defs.h" +namespace fallout { + #define STAT_ERR_INVALID_STAT (-5) int statsInit(); @@ -49,4 +51,6 @@ static inline bool pcStatIsValid(int pcStat) return pcStat >= 0 && pcStat < PC_STAT_COUNT; } +} // namespace fallout + #endif /* STAT_H */ diff --git a/src/stat_defs.h b/src/stat_defs.h index 7ef2a78..ca3c94a 100644 --- a/src/stat_defs.h +++ b/src/stat_defs.h @@ -1,6 +1,8 @@ #ifndef STAT_DEFS #define STAT_DEFS +namespace fallout { + // The minimum value of SPECIAL stat. #define PRIMARY_STAT_MIN (1) @@ -80,4 +82,6 @@ typedef enum PcStat { PC_STAT_COUNT, } PcStat; +} // namespace fallout + #endif /* STAT_DEFS */ diff --git a/src/string_parsers.cc b/src/string_parsers.cc index 1ea7d57..e0d4b62 100644 --- a/src/string_parsers.cc +++ b/src/string_parsers.cc @@ -6,6 +6,8 @@ #include "debug.h" #include "platform_compat.h" +namespace fallout { + // strParseInt // 0x4AFD10 int strParseInt(char** stringPtr, int* valuePtr) @@ -258,3 +260,5 @@ int strParseKeyValue(char** stringPtr, char* key, int* valuePtr, const char* del return 0; } + +} // namespace fallout diff --git a/src/string_parsers.h b/src/string_parsers.h index 84f573c..a4fc521 100644 --- a/src/string_parsers.h +++ b/src/string_parsers.h @@ -1,6 +1,8 @@ #ifndef STRING_PARSERS_H #define STRING_PARSERS_H +namespace fallout { + typedef int(StringParserCallback)(char* string, int* valuePtr); int strParseInt(char** stringPtr, int* valuePtr); @@ -9,4 +11,6 @@ int strParseStrFromFunc(char** stringPtr, int* valuePtr, StringParserCallback* c int strParseIntWithKey(char** stringPtr, const char* key, int* valuePtr, const char* delimeter); int strParseKeyValue(char** stringPtr, char* key, int* valuePtr, const char* delimeter); +} // namespace fallout + #endif /* STRING_PARSERS_H */ diff --git a/src/text_font.cc b/src/text_font.cc index ba5bc83..7bf1377 100644 --- a/src/text_font.cc +++ b/src/text_font.cc @@ -8,6 +8,8 @@ #include "memory.h" #include "platform_compat.h" +namespace fallout { + // The maximum number of text fonts. #define TEXT_FONT_MAX (10) @@ -425,3 +427,5 @@ static int textFontGetMonospacedCharacterWidthImpl() return width + gCurrentTextFontDescriptor->letterSpacing; } + +} // namespace fallout diff --git a/src/text_font.h b/src/text_font.h index b2290ce..2ea5360 100644 --- a/src/text_font.h +++ b/src/text_font.h @@ -1,6 +1,8 @@ #ifndef TEXT_FONT_H #define TEXT_FONT_H +namespace fallout { + typedef void FontManagerSetCurrentFontProc(int font); typedef void FontManagerDrawTextProc(unsigned char* buffer, const char* string, int length, int pitch, int color); typedef int FontManagerGetLineHeightProc(); @@ -48,4 +50,6 @@ int fontManagerAdd(FontManager* fontManager); int fontGetCurrent(); void fontSetCurrent(int font); +} // namespace fallout + #endif /* TEXT_FONT_H */ diff --git a/src/text_object.cc b/src/text_object.cc index 4a87dbd..2ada2dd 100644 --- a/src/text_object.cc +++ b/src/text_object.cc @@ -12,6 +12,8 @@ #include "tile.h" #include "word_wrap.h" +namespace fallout { + // The maximum number of text objects that can exist at the same time. #define TEXT_OBJECTS_MAX_COUNT (20) @@ -475,3 +477,5 @@ void textObjectsRemoveByOwner(Object* object) } } } + +} // namespace fallout diff --git a/src/text_object.h b/src/text_object.h index 4e088d7..08f3b84 100644 --- a/src/text_object.h +++ b/src/text_object.h @@ -4,6 +4,8 @@ #include "geometry.h" #include "obj_types.h" +namespace fallout { + int textObjectsInit(unsigned char* windowBuffer, int width, int height); int textObjectsReset(); void textObjectsFree(); @@ -16,4 +18,6 @@ void textObjectsRenderInRect(Rect* rect); int textObjectsGetCount(); void textObjectsRemoveByOwner(Object* object); +} // namespace fallout + #endif /* TEXT_OBJECT_H */ diff --git a/src/tile.cc b/src/tile.cc index f301a70..10a370b 100644 --- a/src/tile.cc +++ b/src/tile.cc @@ -17,6 +17,8 @@ #include "object.h" #include "platform_compat.h" +namespace fallout { + typedef struct STRUCT_51D99C { int field_0; int field_4; @@ -1972,3 +1974,5 @@ int _tile_scroll_to(int tile, int flags) return rc; } + +} // namespace fallout diff --git a/src/tile.h b/src/tile.h index 3c12ab5..83f2070 100644 --- a/src/tile.h +++ b/src/tile.h @@ -4,6 +4,8 @@ #include "geometry.h" #include "map.h" +namespace fallout { + #define TILE_SET_CENTER_FLAG_0x01 0x01 #define TILE_SET_CENTER_FLAG_0x02 0x02 @@ -57,4 +59,6 @@ static bool tileIsValid(int tile) return tile >= 0 && tile < gHexGridSize; } +} // namespace fallout + #endif /* TILE_H */ diff --git a/src/trait.cc b/src/trait.cc index c1dab3e..636c58c 100644 --- a/src/trait.cc +++ b/src/trait.cc @@ -9,6 +9,8 @@ #include "skill.h" #include "stat.h" +namespace fallout { + // Provides metadata about traits. typedef struct TraitDescription { // The name of trait. @@ -305,3 +307,5 @@ int traitGetSkillModifier(int skill) return modifier; } + +} // namespace fallout diff --git a/src/trait.h b/src/trait.h index ee3fd2f..cf964e1 100644 --- a/src/trait.h +++ b/src/trait.h @@ -4,6 +4,8 @@ #include "db.h" #include "trait_defs.h" +namespace fallout { + int traitsInit(); void traitsReset(); void traitsExit(); @@ -18,4 +20,6 @@ bool traitIsSelected(int trait); int traitGetStatModifier(int stat); int traitGetSkillModifier(int skill); +} // namespace fallout + #endif /* TRAIT_H */ diff --git a/src/trait_defs.h b/src/trait_defs.h index 8b11634..cd362de 100644 --- a/src/trait_defs.h +++ b/src/trait_defs.h @@ -1,6 +1,8 @@ #ifndef TRAIT_DEFS #define TRAIT_DEFS +namespace fallout { + // The maximum number of traits a player is allowed to select. #define TRAITS_MAX_SELECTED_COUNT 2 @@ -25,4 +27,6 @@ typedef enum Trait { TRAIT_COUNT, } Trait; +} // namespace fallout + #endif /* TRAIT_DEFS */ diff --git a/src/trap.cc b/src/trap.cc index 631a57b..6e1581e 100644 --- a/src/trap.cc +++ b/src/trap.cc @@ -1,8 +1,12 @@ #include "trap.h" +namespace fallout { + // NOTE: Likely collapsed trapInit/trapExit. // // 0x4B4190 void _trap_init() { } + +} // namespace fallout diff --git a/src/trap.h b/src/trap.h index f53a924..c182d0e 100644 --- a/src/trap.h +++ b/src/trap.h @@ -1,6 +1,10 @@ #ifndef TRAP_H #define TRAP_H +namespace fallout { + void _trap_init(); +} // namespace fallout + #endif /* TRAP_H */ diff --git a/src/version.cc b/src/version.cc index 2c4f033..c28e62a 100644 --- a/src/version.cc +++ b/src/version.cc @@ -2,8 +2,12 @@ #include +namespace fallout { + // 0x4B4580 void versionGetVersion(char* dest) { sprintf(dest, "FALLOUT II %d.%02d", VERSION_MAJOR, VERSION_MINOR); } + +} // namespace fallout diff --git a/src/version.h b/src/version.h index 0c54965..ee5e95c 100644 --- a/src/version.h +++ b/src/version.h @@ -1,6 +1,8 @@ #ifndef VERSION_H #define VERSION_H +namespace fallout { + // The size of buffer for version string. #define VERSION_MAX (32) @@ -11,4 +13,6 @@ void versionGetVersion(char* dest); +} // namespace fallout + #endif /* VERSION_H */ diff --git a/src/widget.cc b/src/widget.cc index 34db14d..0c43192 100644 --- a/src/widget.cc +++ b/src/widget.cc @@ -1,5 +1,7 @@ #include "widget.h" +namespace fallout { + static void _showRegion(int a1); // 0x66E6A0 @@ -28,3 +30,5 @@ void sub_4B5998(int win) { // TODO: Incomplete. } + +} // namespace fallout diff --git a/src/widget.h b/src/widget.h index 4edae67..a3c3765 100644 --- a/src/widget.h +++ b/src/widget.h @@ -1,7 +1,11 @@ #ifndef WIDGET_H #define WIDGET_H +namespace fallout { + int _update_widgets(); void sub_4B5998(int win); +} // namespace fallout + #endif /* WIDGET_H */ diff --git a/src/win32.cc b/src/win32.cc index 1fb4c81..6727d5b 100644 --- a/src/win32.cc +++ b/src/win32.cc @@ -8,6 +8,8 @@ #include "main.h" #include "window_manager.h" +namespace fallout { + #ifdef _WIN32 // 0x51E444 bool gProgramIsActive = false; @@ -51,3 +53,10 @@ int main(int argc, char* argv[]) return falloutMain(argc, argv); } #endif + +} // namespace fallout + +int main(int argc, char* argv[]) +{ + return fallout::main(argc, argv); +} diff --git a/src/win32.h b/src/win32.h index f152cf2..6742458 100644 --- a/src/win32.h +++ b/src/win32.h @@ -5,11 +5,17 @@ #define WIN32_LEAN_AND_MEAN #define NOMINMAX #include +#endif +namespace fallout { + +#ifdef _WIN32 extern bool gProgramIsActive; extern HANDLE _GNW95_mutex; #else extern bool gProgramIsActive; #endif +} // namespace fallout + #endif /* WIN32_H */ diff --git a/src/window.cc b/src/window.cc index 193fd23..6a64836 100644 --- a/src/window.cc +++ b/src/window.cc @@ -18,6 +18,8 @@ #include "widget.h" #include "window_manager.h" +namespace fallout { + #define MANAGED_WINDOW_COUNT (16) typedef struct ManagedButton { @@ -2639,3 +2641,5 @@ void _fillBuf3x3(unsigned char* src, int srcWidth, int srcHeight, unsigned char* dest + destWidth * (destHeight - chunkHeight) + (destWidth - chunkWidth), destWidth); } + +} // namespace fallout diff --git a/src/window.h b/src/window.h index 2799d6e..2ae415c 100644 --- a/src/window.h +++ b/src/window.h @@ -6,6 +6,8 @@ #include "region.h" #include "window_manager.h" +namespace fallout { + 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); typedef void WindowDrawingProc2(unsigned char* buf, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, unsigned char a10); typedef bool(WindowInputHandler)(int key); @@ -125,4 +127,6 @@ void _drawScaledBuf(unsigned char* dest, int destWidth, int destHeight, unsigned void _alphaBltBuf(unsigned char* src, int srcWidth, int srcHeight, int srcPitch, unsigned char* alphaWindowBuffer, unsigned char* alphaBuffer, unsigned char* dest, int destPitch); void _fillBuf3x3(unsigned char* src, int srcWidth, int srcHeight, unsigned char* dest, int destWidth, int destHeight); +} // namespace fallout + #endif /* WINDOW_H */ diff --git a/src/window_manager.cc b/src/window_manager.cc index fef9e6d..bf50212 100644 --- a/src/window_manager.cc +++ b/src/window_manager.cc @@ -17,6 +17,8 @@ #include "win32.h" #include "window_manager_private.h" +namespace fallout { + #define MAX_WINDOW_COUNT (50) // The maximum number of radio groups. @@ -2558,3 +2560,5 @@ int _win_button_press_and_release(int btn) return 0; } + +} // namespace fallout diff --git a/src/window_manager.h b/src/window_manager.h index 7e368d3..9d7f33a 100644 --- a/src/window_manager.h +++ b/src/window_manager.h @@ -11,6 +11,8 @@ #include "geometry.h" +namespace fallout { + // The maximum number of buttons in one radio group. #define RADIO_GROUP_BUTTON_LIST_CAPACITY (64) @@ -195,4 +197,6 @@ int _win_set_button_rest_state(int btn, bool a2, int a3); int _win_group_radio_buttons(int a1, int* a2); int _win_button_press_and_release(int btn); +} // namespace fallout + #endif /* WINDOW_MANAGER_H */ diff --git a/src/window_manager_private.cc b/src/window_manager_private.cc index f3d487a..fbeee5e 100644 --- a/src/window_manager_private.cc +++ b/src/window_manager_private.cc @@ -12,6 +12,8 @@ #include "text_font.h" #include "window_manager.h" +namespace fallout { + typedef struct STRUCT_6B2340 { int field_0; int field_4; @@ -1333,3 +1335,5 @@ int _tm_index_active(int a1) } return 1; } + +} // namespace fallout diff --git a/src/window_manager_private.h b/src/window_manager_private.h index 55353c1..0802090 100644 --- a/src/window_manager_private.h +++ b/src/window_manager_private.h @@ -3,6 +3,8 @@ #include "geometry.h" +namespace fallout { + typedef struct MenuBar MenuBar; typedef void(ListSelectionHandler)(char** items, int index); @@ -34,4 +36,6 @@ void _tm_kill_out_of_order(int a1); void _tm_click_response(int btn); int _tm_index_active(int a1); +} // namespace fallout + #endif /* WINDOW_MANAGER_PRIVATE_H */ diff --git a/src/word_wrap.cc b/src/word_wrap.cc index 5456d59..9953418 100644 --- a/src/word_wrap.cc +++ b/src/word_wrap.cc @@ -6,6 +6,8 @@ #include "text_font.h" +namespace fallout { + // 0x4BC6F0 int wordWrap(const char* string, int width, short* breakpoints, short* breakpointsLengthPtr) { @@ -72,3 +74,5 @@ int wordWrap(const char* string, int width, short* breakpoints, short* breakpoin return 0; } + +} // namespace fallout diff --git a/src/word_wrap.h b/src/word_wrap.h index 46c87f6..1f720d1 100644 --- a/src/word_wrap.h +++ b/src/word_wrap.h @@ -1,8 +1,12 @@ #ifndef WORD_WRAP_H #define WORD_WRAP_H +namespace fallout { + #define WORD_WRAP_MAX_COUNT (64) int wordWrap(const char* string, int width, short* breakpoints, short* breakpointsLengthPtr); +} // namespace fallout + #endif /* WORD_WRAP_H */ diff --git a/src/worldmap.cc b/src/worldmap.cc index 03f581a..a5f01d9 100644 --- a/src/worldmap.cc +++ b/src/worldmap.cc @@ -43,6 +43,8 @@ #include "tile.h" #include "window_manager.h" +namespace fallout { + #define CITY_NAME_SIZE (40) #define TILE_WALK_MASK_NAME_SIZE (40) #define ENTRANCE_LIST_CAPACITY (10) @@ -6880,3 +6882,5 @@ int wmTeleportToArea(int areaIdx) return 0; } + +} // namespace fallout diff --git a/src/worldmap.h b/src/worldmap.h index 2d3d081..b6c5fcd 100644 --- a/src/worldmap.h +++ b/src/worldmap.h @@ -3,6 +3,8 @@ #include "db.h" +namespace fallout { + #define CAR_FUEL_MAX (80000) typedef enum MapFlags { @@ -275,4 +277,6 @@ int wmSetMapMusic(int mapIdx, const char* name); int wmMatchAreaContainingMapIdx(int mapIdx, int* areaIdxPtr); int wmTeleportToArea(int areaIdx); +} // namespace fallout + #endif /* WORLD_MAP_H */ diff --git a/src/xfile.cc b/src/xfile.cc index 9c1a42a..a7b7472 100644 --- a/src/xfile.cc +++ b/src/xfile.cc @@ -13,6 +13,8 @@ #include "file_find.h" +namespace fallout { + typedef enum XFileEnumerationEntryType { XFILE_ENUMERATION_ENTRY_TYPE_FILE, XFILE_ENUMERATION_ENTRY_TYPE_DIRECTORY, @@ -826,3 +828,5 @@ static bool xlistEnumerateHandler(XListEnumerationContext* context) return true; } + +} // namespace fallout diff --git a/src/xfile.h b/src/xfile.h index ba10b66..8605ae3 100644 --- a/src/xfile.h +++ b/src/xfile.h @@ -8,6 +8,8 @@ #include "dfile.h" #include "platform_compat.h" +namespace fallout { + typedef enum XFileType { XFILE_TYPE_FILE, XFILE_TYPE_DFILE, @@ -66,4 +68,6 @@ bool xbaseOpen(const char* path); bool xlistInit(const char* pattern, XList* xlist); void xlistFree(XList* xlist); +} // namespace fallout + #endif /* XFILE_H */