From 5a074e6137dc8368132e4e192c018806c1723222 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 4 Oct 2003 00:52:27 +0000 Subject: added namespace Sword2 svn-id: r10581 --- sword2/anims.cpp | 4 ++++ sword2/anims.h | 4 ++++ sword2/build_display.cpp | 4 ++++ sword2/build_display.h | 4 ++++ sword2/console.cpp | 10 ++++++++++ sword2/console.h | 4 ++++ sword2/controls.cpp | 4 ++++ sword2/controls.h | 4 ++++ sword2/credits.h | 4 ++++ sword2/debug.cpp | 6 ++++++ sword2/debug.h | 8 ++++++++ sword2/driver/_console.cpp | 6 ++++-- sword2/driver/_console.h | 8 +++++--- sword2/driver/_mouse.cpp | 14 +++++++++----- sword2/driver/_mouse.h | 8 ++++++-- sword2/driver/d_draw.cpp | 14 +++++++++----- sword2/driver/d_draw.h | 10 +++------- sword2/driver/d_sound.cpp | 10 +++++++--- sword2/driver/d_sound.h | 4 ++++ sword2/driver/driver96.h | 8 ++------ sword2/driver/keyboard.cpp | 6 +++++- sword2/driver/keyboard.h | 4 ++++ sword2/driver/language.cpp | 6 +++++- sword2/driver/menu.cpp | 13 +++++++------ sword2/driver/misc.cpp | 8 ++++++-- sword2/driver/palette.cpp | 10 +++++++--- sword2/driver/palette.h | 4 +++- sword2/driver/rdwin.cpp | 24 ++++++++++++++---------- sword2/driver/rdwin.h | 4 ++++ sword2/driver/render.cpp | 18 +++++++++++------- sword2/driver/render.h | 6 +++++- sword2/driver/sprite.cpp | 4 ++++ sword2/events.cpp | 4 ++++ sword2/events.h | 8 ++++++-- sword2/function.cpp | 4 ++++ sword2/function.h | 4 ++++ sword2/header.h | 4 ++++ sword2/icons.cpp | 4 ++++ sword2/icons.h | 4 ++++ sword2/interpreter.cpp | 4 ++++ sword2/interpreter.h | 4 ++++ sword2/layers.cpp | 4 ++++ sword2/layers.h | 4 ++++ sword2/logic.cpp | 4 ++++ sword2/logic.h | 4 ++++ sword2/maketext.cpp | 4 ++++ sword2/maketext.h | 4 ++++ sword2/mem_view.cpp | 4 ++++ sword2/memory.cpp | 4 ++++ sword2/memory.h | 4 ++++ sword2/mouse.cpp | 4 ++++ sword2/mouse.h | 4 ++++ sword2/object.h | 4 ++++ sword2/protocol.cpp | 4 ++++ sword2/protocol.h | 4 ++++ sword2/resman.cpp | 4 ++++ sword2/resman.h | 4 ++++ sword2/router.cpp | 4 ++++ sword2/router.h | 4 ++++ sword2/save_rest.cpp | 4 ++++ sword2/save_rest.h | 4 ++++ sword2/scroll.cpp | 4 ++++ sword2/scroll.h | 4 ++++ sword2/sound.cpp | 4 ++++ sword2/sound.h | 4 ++++ sword2/speech.cpp | 4 ++++ sword2/speech.h | 4 ++++ sword2/startup.cpp | 4 ++++ sword2/startup.h | 4 ++++ sword2/sword2.cpp | 40 ++++++++++++++++++++++------------------ sword2/sword2.h | 14 +++++++++----- sword2/sync.cpp | 4 ++++ sword2/sync.h | 4 ++++ sword2/tony_gsdk.cpp | 4 ++++ sword2/tony_gsdk.h | 4 ++++ sword2/walker.cpp | 4 ++++ sword2/walker.h | 4 ++++ 77 files changed, 385 insertions(+), 90 deletions(-) (limited to 'sword2') diff --git a/sword2/anims.cpp b/sword2/anims.cpp index fea8b02887..bfd283000f 100644 --- a/sword2/anims.cpp +++ b/sword2/anims.cpp @@ -46,6 +46,8 @@ #include "sync.h" #include "sound.h" // for Speech stuff. +namespace Sword2 { + // stores resource id of wav to use as lead-out from smacker uint32 smackerLeadOut = 0; @@ -793,3 +795,5 @@ int32 FN_play_sequence(int32 *params) { // continue script return IR_CONT; } + +} // End of namespace Sword2 diff --git a/sword2/anims.h b/sword2/anims.h index b291cfde78..77b8a4a436 100644 --- a/sword2/anims.h +++ b/sword2/anims.h @@ -22,6 +22,8 @@ #include "driver/driver96.h" +namespace Sword2 { + int32 FN_anim(int32 *params); int32 FN_reverse_anim(int32 *params); int32 FN_mega_table_anim(int32 *params); @@ -32,4 +34,6 @@ int32 FN_back_sprite(int32 *params); int32 FN_sort_sprite(int32 *params); int32 FN_fore_sprite(int32 *params); +} // End of namespace Sword2 + #endif diff --git a/sword2/build_display.cpp b/sword2/build_display.cpp index 1531c6cd90..0563f3c063 100644 --- a/sword2/build_display.cpp +++ b/sword2/build_display.cpp @@ -35,6 +35,8 @@ #include "protocol.h" #include "resman.h" +namespace Sword2 { + // --------------------------------------------------------------------------- buildit bgp0_list[MAX_bgp0_sprites]; @@ -1163,3 +1165,5 @@ int32 FN_change_shadows(int32 *params) { return IR_CONT; } + +} // End of namespace Sword2 diff --git a/sword2/build_display.h b/sword2/build_display.h index fa14717eff..1cb7d5ef0b 100644 --- a/sword2/build_display.h +++ b/sword2/build_display.h @@ -22,6 +22,8 @@ #include "driver/driver96.h" +namespace Sword2 { + // structure filled out by each object to register its graphic printing // requrements @@ -98,4 +100,6 @@ void SetFullPalette(int32 palRes); extern uint32 fps; +} // End of namespace Sword2 + #endif diff --git a/sword2/console.cpp b/sword2/console.cpp index f4a0f535f7..304fcd3752 100644 --- a/sword2/console.cpp +++ b/sword2/console.cpp @@ -20,7 +20,9 @@ #include "stdafx.h" #include "driver/driver96.h" +namespace Sword2 { uint32 console_status = 0; //0 off // LEFT IN RELEASE VERSION +} // End of namespace Sword2 #ifdef _SWORD2_DEBUG @@ -51,6 +53,8 @@ uint32 console_status = 0; //0 off // LEFT IN RELEASE VERSION #include "sword2.h" #include "time.h" +namespace Sword2 { + uint32 Parse_user_input(void); void Clear_console_line(void); void Con_help(void); @@ -1058,8 +1062,12 @@ void Con_display_events() { } } +} // End of namespace Sword2 + #else +namespace Sword2 { + void Print_to_console(const char *format, ...) {} void Temp_print_to_console(const char *format, ...) {} void Clear_console_line(void) {} @@ -1067,4 +1075,6 @@ void Scroll_console(void) {} void Init_console(void) {} void StartConsole(void) {} +} // End of namespace Sword2 + #endif diff --git a/sword2/console.h b/sword2/console.h index 1b3a73eb2e..4d5c6ddcf7 100644 --- a/sword2/console.h +++ b/sword2/console.h @@ -23,6 +23,8 @@ #include "driver/driver96.h" #include "memory.h" +namespace Sword2 { + #ifdef _SWORD2_DEBUG void Init_console(void); @@ -62,4 +64,6 @@ void Scroll_console(void); extern uint32 console_status; +} // End of namespace Sword2 + #endif diff --git a/sword2/controls.cpp b/sword2/controls.cpp index 8706dad6ca..dab2620b2a 100644 --- a/sword2/controls.cpp +++ b/sword2/controls.cpp @@ -36,6 +36,8 @@ #include "sound.h" #include "sword2.h" +namespace Sword2 { + #define MAX_STRING_LEN 64 // 20 was too low; better to be safe ;) #define CHARACTER_OVERLAP 2 // overlap characters by 3 pixels @@ -1558,3 +1560,5 @@ void Sword2Gui::updateGraphicsLevel(uint8 newLevel) { _currentGraphicsLevel = newLevel; } + +} // End of namespace Sword2 diff --git a/sword2/controls.h b/sword2/controls.h index 3c7b8613d1..3124e155b9 100644 --- a/sword2/controls.h +++ b/sword2/controls.h @@ -20,6 +20,8 @@ #ifndef _CONTROL_S #define _CONTROL_S +namespace Sword2 { + class Sword2Gui { public: int _baseSlot; @@ -44,4 +46,6 @@ public: extern Sword2Gui gui; +} // End of namespace Sword2 + #endif diff --git a/sword2/credits.h b/sword2/credits.h index c00c7e165f..1de577484e 100644 --- a/sword2/credits.h +++ b/sword2/credits.h @@ -22,9 +22,13 @@ #include "driver/driver96.h" +namespace Sword2 { + // int32 __declspec( dllexport ) Credits(_drvDrawStatus *pDrawStatus, _drvSoundStatus *pSoundStatus, const char *cdPath, BOOL smoke, BOOL *pAppFocus, _drvKeyStatus *pKeyStatus); //int32 Credits(_drvDrawStatus *pDrawStatus, _drvSoundStatus *pSoundStatus, const char *cdPath, BOOL smoke, BOOL *pAppFocus, _drvKeyStatus *pKeyStatus); int32 FN_play_credits(int32 *params); +} // End of namespace Sword2 + #endif diff --git a/sword2/debug.cpp b/sword2/debug.cpp index 86801be9a5..52e03c75c3 100644 --- a/sword2/debug.cpp +++ b/sword2/debug.cpp @@ -44,6 +44,8 @@ #include "speech.h" // for 'officialTextNumber' and // 'speechScriptWaiting' +namespace Sword2 { + uint8 displayDebugText = 0; // "INFO" 0=off; 1=on uint8 displayWalkGrid = 0; // "WALKGRID" uint8 displayMouseMarker = 0; // "MOUSE" @@ -422,8 +424,12 @@ void Print_current_info(void) { Scroll_console(); } +} // End of namespace Sword2 + #else +namespace Sword2 { void Draw_debug_graphics(void) {} +} // End of namespace Sword2 #endif diff --git a/sword2/debug.h b/sword2/debug.h index 9fc14e5c44..cf6b73b840 100644 --- a/sword2/debug.h +++ b/sword2/debug.h @@ -26,6 +26,8 @@ #include "driver.h" #include "object.h" +namespace Sword2 { + #define MAX_DEBUG_TEXT_BLOCKS 50 extern uint8 displayDebugText; // 0=off; 1=on @@ -62,11 +64,17 @@ void Draw_debug_graphics(void); void Print_current_info(void); +} // End of namespace Sword2 + #else // ie. not _SWORD2_DEBUG +namespace Sword2 { + void Build_debug_text(void); void Draw_debug_graphics(void); +} // End of namespace Sword2 + #endif #endif diff --git a/sword2/driver/_console.cpp b/sword2/driver/_console.cpp index 741253055f..82672f7bc9 100644 --- a/sword2/driver/_console.cpp +++ b/sword2/driver/_console.cpp @@ -47,11 +47,12 @@ //#include "ddraw.h" #include "stdafx.h" -#include "driver96.h" +#include "bs2/driver/driver96.h" -#include "d_draw.h" +#include "bs2/driver/d_draw.h" +namespace Sword2 { uint8 consoleStatus = 0; // 1 - console display //static uint16 consoley = 0; @@ -152,3 +153,4 @@ int32 CloseConsole(void) } +} // End of namespace Sword2 diff --git a/sword2/driver/_console.h b/sword2/driver/_console.h index 83c5c10f53..ed88fb6403 100644 --- a/sword2/driver/_console.h +++ b/sword2/driver/_console.h @@ -30,12 +30,14 @@ //============================================================================= -#ifndef CONSOLE_H -#define CONSOLE_H - +#ifndef DRIVER_CONSOLE_H +#define DRIVER_CONSOLE_H +namespace Sword2 { extern void DisplayConsole(void); +} // End of namespace Sword2 + #endif diff --git a/sword2/driver/_mouse.cpp b/sword2/driver/_mouse.cpp index 3c1d94e17a..dbd0632e68 100644 --- a/sword2/driver/_mouse.cpp +++ b/sword2/driver/_mouse.cpp @@ -18,11 +18,13 @@ */ #include "stdafx.h" -#include "driver96.h" -#include "d_draw.h" -#include "render.h" -#include "menu.h" -#include "../sword2.h" +#include "bs2/driver/driver96.h" +#include "bs2/driver/d_draw.h" +#include "bs2/driver/render.h" +#include "bs2/driver/menu.h" +#include "bs2/sword2.h" + +namespace Sword2 { #define MAX_MOUSE_EVENTS 16 #define MOUSEFLASHFRAME 6 @@ -312,3 +314,5 @@ int32 SetLuggageAnim(uint8 *ma, int32 size) { return RD_OK; } + +} // End of namespace Sword2 diff --git a/sword2/driver/_mouse.h b/sword2/driver/_mouse.h index 09f53154a4..ba48eb251c 100644 --- a/sword2/driver/_mouse.h +++ b/sword2/driver/_mouse.h @@ -17,8 +17,10 @@ * $Header$ */ -#ifndef MOUSE_H -#define MOUSE_H +#ifndef DRIVER_MOUSE_H +#define DRIVER_MOUSE_H + +namespace Sword2 { extern int16 mousex; // Mouse x coordinate extern int16 mousey; // Mouse y coordinate @@ -26,4 +28,6 @@ extern int16 mousey; // Mouse y coordinate extern void LogMouseEvent(uint16 buttons); extern int32 DrawMouse(void); +} // End of namespace Sword2 + #endif diff --git a/sword2/driver/d_draw.cpp b/sword2/driver/d_draw.cpp index 3fa0d9193c..74abb18fa0 100644 --- a/sword2/driver/d_draw.cpp +++ b/sword2/driver/d_draw.cpp @@ -19,15 +19,17 @@ #include #include "stdafx.h" -#include "driver96.h" +#include "bs2/driver/driver96.h" #include "bs2/header.h" // HACK: For cutscenes instruction message #include "bs2/maketext.h" // HACK: For cutscenes instruction message #include "bs2/sword2.h" #include "sound/mixer.h" -#include "rdwin.h" -#include "d_draw.h" -#include "palette.h" -#include "render.h" +#include "bs2/driver/rdwin.h" +#include "bs2/driver/d_draw.h" +#include "bs2/driver/palette.h" +#include "bs2/driver/render.h" + +namespace Sword2 { byte *lpBackBuffer; @@ -331,3 +333,5 @@ int32 PlaySmacker(char *filename, _movieTextObject *text[], uint8 *musicOut) { return RD_OK; } + +} // End of namespace Sword2 diff --git a/sword2/driver/d_draw.h b/sword2/driver/d_draw.h index 547be8a860..7c24266677 100644 --- a/sword2/driver/d_draw.h +++ b/sword2/driver/d_draw.h @@ -20,16 +20,12 @@ #ifndef D_DRAW_H #define D_DRAW_H -#ifdef __cplusplus -extern "C" { -#endif +#include "bs2/driver/driver96.h" -#include "driver96.h" +namespace Sword2 { extern byte *lpBackBuffer; -#ifdef __cplusplus -} -#endif +} // End of namespace Sword2 #endif diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp index cd389daad9..3a21975fa5 100644 --- a/sword2/driver/d_sound.cpp +++ b/sword2/driver/d_sound.cpp @@ -33,13 +33,15 @@ // opinions on this? #include "stdafx.h" -#include "driver96.h" -#include "d_sound.h" -#include "../sword2.h" +#include "bs2/driver/driver96.h" +#include "bs2/driver/d_sound.h" +#include "bs2/sword2.h" #include "sound/audiostream.h" #include "sound/mixer.h" #include "sound/rate.h" +namespace Sword2 { + // Fade-out takes half a second. This may need some tuning. #define FADE_SAMPLES 11025 @@ -1150,3 +1152,5 @@ void Sword2Sound::muteMusic(uint8 mute) { uint8 Sword2Sound::isMusicMute(void) { return _musicMuted; } + +} // End of namespace Sword2 diff --git a/sword2/driver/d_sound.h b/sword2/driver/d_sound.h index 4890a5a026..9a8f7a4b0c 100644 --- a/sword2/driver/d_sound.h +++ b/sword2/driver/d_sound.h @@ -25,6 +25,8 @@ #include "sound/rate.h" #include "common/file.h" +namespace Sword2 { + extern void sword2_sound_handler(void *refCon); typedef struct { @@ -136,4 +138,6 @@ public: int32 setFxIdVolume(int32 id, uint8 vol); }; +} // End of namespace Sword2 + #endif diff --git a/sword2/driver/driver96.h b/sword2/driver/driver96.h index effc5f1f2a..051ffa1046 100644 --- a/sword2/driver/driver96.h +++ b/sword2/driver/driver96.h @@ -29,9 +29,7 @@ #include "common/system.h" #include "common/rect.h" -#ifdef __cplusplus -extern "C" { -#endif +namespace Sword2 { // // Defines @@ -425,8 +423,6 @@ extern int16 mousey; // Mouse screen y coordinate extern int32 renderCaps; // Flags which determine how to render the scene. extern uint8 palCopy[256][4]; // Current palette. -#ifdef __cplusplus -} -#endif +} // End of namespace Sword2 #endif diff --git a/sword2/driver/keyboard.cpp b/sword2/driver/keyboard.cpp index b9aef1425c..609d0a75c5 100644 --- a/sword2/driver/keyboard.cpp +++ b/sword2/driver/keyboard.cpp @@ -18,7 +18,9 @@ */ #include "stdafx.h" -#include "driver96.h" +#include "bs2/driver/driver96.h" + +namespace Sword2 { uint8 keyBacklog = 0; // The number of key presses waiting to be processed. uint8 keyPointer = 0; // Index of the next key to read from the buffer. @@ -69,3 +71,5 @@ int32 ReadKey(_keyboardEvent *ev) { return RD_OK; } + +} // End of namespace Sword2 diff --git a/sword2/driver/keyboard.h b/sword2/driver/keyboard.h index b243a485b7..9758b56d50 100644 --- a/sword2/driver/keyboard.h +++ b/sword2/driver/keyboard.h @@ -34,6 +34,10 @@ #ifndef KEYBOARD_H #define KEYBOARD_H +namespace Sword2 { + void WriteKey(uint16 ascii, int keycode, int modifier); // Adds a keypress to the buffer +} // End of namespace Sword2 + #endif diff --git a/sword2/driver/language.cpp b/sword2/driver/language.cpp index 6ac4ec66f9..0995368b4f 100644 --- a/sword2/driver/language.cpp +++ b/sword2/driver/language.cpp @@ -18,7 +18,9 @@ */ #include "stdafx.h" -#include "driver96.h" +#include "bs2/driver/driver96.h" + +namespace Sword2 { uint8 languageVersion = ENGLISH; @@ -83,3 +85,5 @@ int32 GetGameName(uint8 *name) { return rv; } + +} // End of namespace Sword2 diff --git a/sword2/driver/menu.cpp b/sword2/driver/menu.cpp index 8495e7cfb7..a83cb2ae2d 100644 --- a/sword2/driver/menu.cpp +++ b/sword2/driver/menu.cpp @@ -18,12 +18,14 @@ */ #include "stdafx.h" -#include "driver96.h" -#include "menu.h" -#include "d_draw.h" -#include "render.h" +#include "bs2/driver/driver96.h" +#include "bs2/driver/menu.h" +#include "bs2/driver/d_draw.h" +#include "bs2/driver/render.h" #include "common/rect.h" +namespace Sword2 { + #define MENUDEEP 40 #define MAXMENUANIMS 8 @@ -326,5 +328,4 @@ uint8 GetMenuStatus(uint8 menu) { return menuStatus[menu]; } - - +} // End of namespace Sword2 diff --git a/sword2/driver/misc.cpp b/sword2/driver/misc.cpp index 634a3c1199..0fcc72a885 100644 --- a/sword2/driver/misc.cpp +++ b/sword2/driver/misc.cpp @@ -18,8 +18,10 @@ */ #include "stdafx.h" -#include "driver96.h" -#include "../sword2.h" +#include "bs2/driver/driver96.h" +#include "bs2/sword2.h" + +namespace Sword2 { uint32 SVM_timeGetTime(void) { return g_system->get_msecs(); @@ -38,3 +40,5 @@ int32 SVM_GetVolumeInformation(char *cdPath, char *sCDName, uint32 maxPath, uint strcpy(sCDName, CD1_LABEL); return 1; } + +} // End of namespace Sword2 diff --git a/sword2/driver/palette.cpp b/sword2/driver/palette.cpp index 38a83a211c..47000f84cb 100644 --- a/sword2/driver/palette.cpp +++ b/sword2/driver/palette.cpp @@ -22,9 +22,11 @@ #include "common/util.h" #include "base/engine.h" -#include "d_draw.h" -#include "driver96.h" -#include "../sword2.h" +#include "bs2/driver/d_draw.h" +#include "bs2/driver/driver96.h" +#include "bs2/sword2.h" + +namespace Sword2 { #define PALTABLESIZE 64 * 64 * 64 @@ -263,3 +265,5 @@ void FadeServer() { g_system->set_palette(newPalette, 0, 256); } + +} // End of namespace Sword2 diff --git a/sword2/driver/palette.h b/sword2/driver/palette.h index 7776ad27b6..cf66427597 100644 --- a/sword2/driver/palette.h +++ b/sword2/driver/palette.h @@ -34,11 +34,13 @@ #ifndef PALETTE_H #define PALETTE_H +namespace Sword2 { + extern uint8 paletteMatch[64*64*64]; extern int32 RestorePalette(void); extern void FadeServer(); +} // End of namespace Sword2 #endif - diff --git a/sword2/driver/rdwin.cpp b/sword2/driver/rdwin.cpp index 5a053d8ebe..1612f28ca5 100644 --- a/sword2/driver/rdwin.cpp +++ b/sword2/driver/rdwin.cpp @@ -21,18 +21,20 @@ #include "base/engine.h" #include "common/timer.h" -#include "driver96.h" - -#include "_mouse.h" -#include "keyboard.h" -#include "rdwin.h" -#include "d_draw.h" -#include "palette.h" -#include "render.h" -#include "menu.h" -#include "d_sound.h" +#include "bs2/driver/driver96.h" + +#include "bs2/driver/_mouse.h" +#include "bs2/driver/keyboard.h" +#include "bs2/driver/rdwin.h" +#include "bs2/driver/d_draw.h" +#include "bs2/driver/palette.h" +#include "bs2/driver/render.h" +#include "bs2/driver/menu.h" +#include "bs2/driver/d_sound.h" #include "bs2/sword2.h" +namespace Sword2 { + #define MENUDEEP 40 // Temporary, until menu.h is written! // --------------------------------------------------------------------------- @@ -126,3 +128,5 @@ void SetWindowName(const char *windowName) { // SetWindowText(hwnd, windowName); // strcpy(gameName, windowName); } + +} // End of namespace Sword2 diff --git a/sword2/driver/rdwin.h b/sword2/driver/rdwin.h index 404ef24e36..b0a483fe1a 100644 --- a/sword2/driver/rdwin.h +++ b/sword2/driver/rdwin.h @@ -20,6 +20,10 @@ #ifndef RDWIN_H #define RDWIN_H +namespace Sword2 { + extern void SetNeedRedraw(void); +} // End of namespace Sword2 + #endif diff --git a/sword2/driver/render.cpp b/sword2/driver/render.cpp index 17acf5735e..36b36b0c47 100644 --- a/sword2/driver/render.cpp +++ b/sword2/driver/render.cpp @@ -18,13 +18,15 @@ */ #include "stdafx.h" -#include "driver96.h" -#include "d_draw.h" -#include "rdwin.h" -#include "_mouse.h" -#include "render.h" -#include "menu.h" -#include "../sword2.h" +#include "bs2/driver/driver96.h" +#include "bs2/driver/d_draw.h" +#include "bs2/driver/rdwin.h" +#include "bs2/driver/_mouse.h" +#include "bs2/driver/render.h" +#include "bs2/driver/menu.h" +#include "bs2/sword2.h" + +namespace Sword2 { #define MILLISECSPERCYCLE 83 @@ -1010,3 +1012,5 @@ int32 CloseBackgroundLayer(void) { layer = 0; return RD_OK; } + +} // End of namespace Sword2 diff --git a/sword2/driver/render.h b/sword2/driver/render.h index 34dc8eae58..034eb1e936 100644 --- a/sword2/driver/render.h +++ b/sword2/driver/render.h @@ -33,7 +33,9 @@ #ifndef RENDER_H #define RENDER_H -#include "menu.h" +#include "bs2/driver/menu.h" + +namespace Sword2 { #define RENDERWIDE 640 #define ALIGNRENDERDEEP 480 @@ -58,4 +60,6 @@ void StretchImage(byte *dst, uint16 dstPitch, uint16 dstWidth, uint16 dstHeight, void UploadRect(Common::Rect *r); +} // End of namespace Sword2 + #endif diff --git a/sword2/driver/sprite.cpp b/sword2/driver/sprite.cpp index cb2a6a38b1..de2c59fadb 100644 --- a/sword2/driver/sprite.cpp +++ b/sword2/driver/sprite.cpp @@ -25,6 +25,8 @@ #include "palette.h" #include "rdwin.h" +namespace Sword2 { + static uint8 *lightMask = 0; /** @@ -714,3 +716,5 @@ int32 CloseLightMask(void) { lightMask = 0; return RD_OK; } + +} // End of namespace Sword2 diff --git a/sword2/events.cpp b/sword2/events.cpp index 14118c49a9..74485eae6e 100644 --- a/sword2/events.cpp +++ b/sword2/events.cpp @@ -28,6 +28,8 @@ #include "object.h" #include "sync.h" +namespace Sword2 { + _event_unit event_list[MAX_events]; void Init_event_system(void) { @@ -347,3 +349,5 @@ void Kill_all_ids_events(uint32 id) { } } } + +} // End of namespace Sword2 diff --git a/sword2/events.h b/sword2/events.h index a0badf814a..f5ef1c9776 100644 --- a/sword2/events.h +++ b/sword2/events.h @@ -22,10 +22,12 @@ #include "object.h" -typedef struct { +namespace Sword2 { + +struct _event_unit { uint32 id; uint32 interact_id; -} _event_unit; +}; #define MAX_events 10 @@ -41,4 +43,6 @@ uint32 Check_event_waiting(void); void Kill_all_ids_events(uint32 id); uint32 CountEvents(void); +} // End of namespace Sword2 + #endif diff --git a/sword2/function.cpp b/sword2/function.cpp index 5480f3fe7d..df16115934 100644 --- a/sword2/function.cpp +++ b/sword2/function.cpp @@ -33,6 +33,8 @@ #include "sound.h" #include "sword2.h" // for CloseGame() +namespace Sword2 { + Object_graphic engine_graph; // global for engine Object_mega engine_mega; // global for engine @@ -469,3 +471,5 @@ int32 FN_play_credits(int32 *params) { return IR_CONT; } + +} // End of namespace Sword2 diff --git a/sword2/function.h b/sword2/function.h index 0d49e7f27e..0f46645489 100644 --- a/sword2/function.h +++ b/sword2/function.h @@ -22,7 +22,11 @@ #include "object.h" +namespace Sword2 { + extern Object_graphic engine_graph; // global for engine extern Object_mega engine_mega; // global for engine +} // End of namespace Sword2 + #endif diff --git a/sword2/header.h b/sword2/header.h index 363d193c71..817852f444 100644 --- a/sword2/header.h +++ b/sword2/header.h @@ -22,6 +22,8 @@ #include "common/scummsys.h" +namespace Sword2 { + //---------------------------------------------------------- // SYSTEM FILE & FRAME HEADERS //---------------------------------------------------------- @@ -299,4 +301,6 @@ struct _textHeader { #pragma END_PACK_STRUCTS #endif +} // End of namespace Sword2 + #endif diff --git a/sword2/icons.cpp b/sword2/icons.cpp index 3e6695666b..f1bc486631 100644 --- a/sword2/icons.cpp +++ b/sword2/icons.cpp @@ -23,6 +23,8 @@ #include "interpreter.h" #include "mouse.h" +namespace Sword2 { + // tempory list menu_object temp_list[TOTAL_engine_pockets]; uint32 total_temp = 0; @@ -248,3 +250,5 @@ void Build_system_menu(void) { ShowMenu(RDMENU_TOP); } + +} // End of namespace Sword2 diff --git a/sword2/icons.h b/sword2/icons.h index 44880e7633..c95350c092 100644 --- a/sword2/icons.h +++ b/sword2/icons.h @@ -22,6 +22,8 @@ #include "object.h" +namespace Sword2 { + #define MENU_MASTER_OBJECT 44 #define TOTAL_subjects (375 - 256 + 1) // the speech subject bar #define TOTAL_engine_pockets (15 + 10) // +10 for overflow @@ -39,4 +41,6 @@ extern menu_object master_menu_list[TOTAL_engine_pockets]; void Build_top_menu(void); void Build_system_menu(void); +} // End of namespace Sword2 + #endif diff --git a/sword2/interpreter.cpp b/sword2/interpreter.cpp index ef87e6ab36..1ed1d4bb70 100644 --- a/sword2/interpreter.cpp +++ b/sword2/interpreter.cpp @@ -23,6 +23,8 @@ #include "driver/driver96.h" #include "interpreter.h" +namespace Sword2 { + // This file serves two purposes. It is compiled as part of the test functions // of Linc, and also as part of the game @@ -710,3 +712,5 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) { return 1; } + +} // End of namespace Sword2 diff --git a/sword2/interpreter.h b/sword2/interpreter.h index 6d6059cb7f..5b35767d0c 100644 --- a/sword2/interpreter.h +++ b/sword2/interpreter.h @@ -23,6 +23,8 @@ #include "debug.h" #include "header.h" +namespace Sword2 { + // Interpreter return codes #define IR_STOP 0 @@ -90,4 +92,6 @@ int RunScript (char *scriptData, char *objectData, uint32 *offset); #define OP_LSTHANE 36 // <= #define OP_OROR 37 // || or OR +} // End of namespace Sword2 + #endif diff --git a/sword2/layers.cpp b/sword2/layers.cpp index f8cb339519..09fb053805 100644 --- a/sword2/layers.cpp +++ b/sword2/layers.cpp @@ -34,6 +34,8 @@ #include "resman.h" #include "sound.h" // for Clear_fx_queue() called from FN_init_background() +namespace Sword2 { + // this_screen describes the current back buffer and its in-game scroll // positions, etc. @@ -240,3 +242,5 @@ void SetUpBackgroundLayers(void) { res_man.close(this_screen.background_layer_id); } } + +} // End of namespace Sword2 diff --git a/sword2/layers.h b/sword2/layers.h index 2ab1bc4a4f..04b79d3bd5 100644 --- a/sword2/layers.h +++ b/sword2/layers.h @@ -22,6 +22,8 @@ #include "memory.h" +namespace Sword2 { + typedef struct { uint16 scroll_offset_x; // Position x uint16 scroll_offset_y; // Position y @@ -54,4 +56,6 @@ int32 FN_init_background(int32 *params); void SetUpBackgroundLayers(void); +} // End of namespace Sword2 + #endif diff --git a/sword2/logic.cpp b/sword2/logic.cpp index dab370d76c..5ba405db7a 100644 --- a/sword2/logic.cpp +++ b/sword2/logic.cpp @@ -27,6 +27,8 @@ #include "sound.h" #include "sync.h" +namespace Sword2 { + logic LLogic; #define LEVEL (_curObjectHub->logic_level) @@ -448,3 +450,5 @@ void logic::processKillList(void) { void logic::resetKillList(void) { kills = 0; } + +} // End of namespace Sword2 diff --git a/sword2/logic.h b/sword2/logic.h index a78b5a9cbb..9e1630a2bf 100644 --- a/sword2/logic.h +++ b/sword2/logic.h @@ -25,6 +25,8 @@ #include "defs.h" #include "header.h" +namespace Sword2 { + #define TREE_SIZE 3 class logic { @@ -67,4 +69,6 @@ extern logic LLogic; int32 FN_add_to_kill_list(int32 *params); +} // End of namespace Sword2 + #endif diff --git a/sword2/maketext.cpp b/sword2/maketext.cpp index 84e198a8a7..c0f7df1e3a 100644 --- a/sword2/maketext.cpp +++ b/sword2/maketext.cpp @@ -64,6 +64,8 @@ #include "resman.h" #include "sword2.h" +namespace Sword2 { + extern uint32 sequenceTextLines; // see anims.cpp // info for each line of words in the output text sprite @@ -686,3 +688,5 @@ void InitialiseFontResourceFlags(uint8 language) { break; } } + +} // End of namespace Sword2 diff --git a/sword2/maketext.h b/sword2/maketext.h index 197319341f..4a4f076718 100644 --- a/sword2/maketext.h +++ b/sword2/maketext.h @@ -59,6 +59,8 @@ #include "memory.h" +namespace Sword2 { + // only for debug text, since it doesn't keep text inside the screen margin! #define NO_JUSTIFICATION 0 // these all force text inside the screen edge margin when necessary @@ -92,4 +94,6 @@ extern uint32 speech_font_id; extern uint32 controls_font_id; extern uint32 red_font_id; +} // End of namespace Sword2 + #endif diff --git a/sword2/mem_view.cpp b/sword2/mem_view.cpp index 49a8ad32be..852c9895c3 100644 --- a/sword2/mem_view.cpp +++ b/sword2/mem_view.cpp @@ -24,6 +24,8 @@ #include "memory.h" #include "resman.h" +namespace Sword2 { + // has to be global because a local in Fetch_mem_owner is destroyed on exit char buf[50]; @@ -183,3 +185,5 @@ void Sword2MemoryManager::memoryString(char *string) { mem_locked, mem_floating, mem_free, blocksUsed, MAX_mem_blocks, percent, (res_man.fetchUsage() / 1024)); } + +} // End of namespace Sword2 diff --git a/sword2/memory.cpp b/sword2/memory.cpp index 2807a6c7f7..60dabf18c2 100644 --- a/sword2/memory.cpp +++ b/sword2/memory.cpp @@ -43,6 +43,8 @@ #include "memory.h" #include "resman.h" +namespace Sword2 { + Sword2MemoryManager memory; #define MEMORY_POOL (1024 * 12000) @@ -547,3 +549,5 @@ int32 Sword2MemoryManager::virtualDefrag(uint32 size) { return 1; } + +} // End of namespace Sword2 diff --git a/sword2/memory.h b/sword2/memory.h index 1a91dd01a1..ad54e3b316 100644 --- a/sword2/memory.h +++ b/sword2/memory.h @@ -22,6 +22,8 @@ #include "common/scummsys.h" +namespace Sword2 { + typedef struct { uint32 state; uint32 age; // *not used* @@ -102,4 +104,6 @@ public: extern Sword2MemoryManager memory; +} // End of namespace Sword2 + #endif diff --git a/sword2/mouse.cpp b/sword2/mouse.cpp index 26f17972d2..3827801771 100644 --- a/sword2/mouse.cpp +++ b/sword2/mouse.cpp @@ -35,6 +35,8 @@ #include "sound.h" #include "sword2.h" +namespace Sword2 { + // pointer resource id's #define CROSHAIR 18 @@ -1388,3 +1390,5 @@ void Monitor_player_activity(void) { player_activity_delay++; } } + +} // End of namespace Sword2 diff --git a/sword2/mouse.h b/sword2/mouse.h index 3b45fd0e39..a6d4a857ae 100644 --- a/sword2/mouse.h +++ b/sword2/mouse.h @@ -24,6 +24,8 @@ #include "object.h" +namespace Sword2 { + #define TOTAL_mouse_list 50 #define MOUSE_normal 0 @@ -99,4 +101,6 @@ int32 FN_add_human(int32 *params); void ClearPointerText(void); +} // End of namespace Sword2 + #endif diff --git a/sword2/object.h b/sword2/object.h index c158a22075..ae04efa5ed 100644 --- a/sword2/object.h +++ b/sword2/object.h @@ -22,6 +22,8 @@ #include "driver/driver96.h" +namespace Sword2 { + // these structures represent the broken up compact components // these here declared to the system must be the same as those declared to // LINC (or it wont work) @@ -122,4 +124,6 @@ typedef struct { int32 dy[8 * (12 + 1)]; // walk step distances in y direction } Object_walkdata; +} // End of namespace Sword2 + #endif diff --git a/sword2/protocol.cpp b/sword2/protocol.cpp index dd234f3751..1f9a58081e 100644 --- a/sword2/protocol.cpp +++ b/sword2/protocol.cpp @@ -27,6 +27,8 @@ #include "protocol.h" #include "resman.h" +namespace Sword2 { + // Returns a pointer to the first palette entry, given the pointer to the // start of the screen file. @@ -216,3 +218,5 @@ uint8 *FetchObjectName(int32 resourceId) { return header->name; } + +} // End of namespace Sword2 diff --git a/sword2/protocol.h b/sword2/protocol.h index 81f42de3aa..deebb3a911 100644 --- a/sword2/protocol.h +++ b/sword2/protocol.h @@ -25,6 +25,8 @@ #include "driver/driver96.h" #include "header.h" +namespace Sword2 { + uint8 *FetchPalette(uint8 *screenFile); _screenHeader *FetchScreenHeader(uint8 *screenFile); _layerHeader *FetchLayerHeader(uint8 *screenFile, uint16 layerNo); @@ -41,4 +43,6 @@ uint8 CheckTextLine(uint8 *file, uint32 text_line); uint8 *FetchPaletteMatchTable(uint8 *screenFile); uint8 *FetchObjectName(int32 resourceId); +} // End of namespace Sword2 + #endif diff --git a/sword2/resman.cpp b/sword2/resman.cpp index ac42f1988e..391bb7fe67 100644 --- a/sword2/resman.cpp +++ b/sword2/resman.cpp @@ -43,6 +43,8 @@ #include "sword2.h" // for CloseGame() #include "router.h" +namespace Sword2 { + // --------------------------------------------------------------------------- // welcome to the easy resource manager - written in simple code for easy // maintenance @@ -1435,3 +1437,5 @@ void Sword2ResourceManager::getCd(int cd) { memory.freeMemory(text_spr); RemoveMsg(); } + +} // End of namespace Sword2 diff --git a/sword2/resman.h b/sword2/resman.h index 4d19ba6d75..28157b79d7 100644 --- a/sword2/resman.h +++ b/sword2/resman.h @@ -22,6 +22,8 @@ #include "memory.h" +namespace Sword2 { + #define MAX_res_files 20 class Sword2ResourceManager { @@ -105,4 +107,6 @@ private: extern Sword2ResourceManager res_man; //declare the object global +} // End of namespace Sword2 + #endif diff --git a/sword2/router.cpp b/sword2/router.cpp index 441109a830..17417a5a9f 100644 --- a/sword2/router.cpp +++ b/sword2/router.cpp @@ -89,6 +89,8 @@ #include "resman.h" #include "router.h" +namespace Sword2 { + #define MAX_FRAMES_PER_CYCLE 16 #define NO_DIRECTIONS 8 #define MAX_FRAMES_PER_CHAR (MAX_FRAMES_PER_CYCLE * NO_DIRECTIONS) @@ -2848,3 +2850,5 @@ void RemoveWalkGrid(int32 gridResource) { if (entry < MAX_WALKGRIDS) walkGridList[entry] = 0; } + +} // End of namespace Sword2 diff --git a/sword2/router.h b/sword2/router.h index cc6e7b9eb7..9eecd3efc1 100644 --- a/sword2/router.h +++ b/sword2/router.h @@ -23,6 +23,8 @@ #include "memory.h" #include "object.h" +namespace Sword2 { + #if !defined(__GNUC__) #pragma START_PACK_STRUCTS #endif @@ -75,4 +77,6 @@ void AddWalkGrid(int32 gridResource); void RemoveWalkGrid(int32 gridResource); void ClearWalkGridList(void); +} // End of namespace Sword2 + #endif diff --git a/sword2/save_rest.cpp b/sword2/save_rest.cpp index 8d9ff09b39..a52b18cd26 100644 --- a/sword2/save_rest.cpp +++ b/sword2/save_rest.cpp @@ -47,6 +47,8 @@ #include "sword2.h" #include "walker.h" +namespace Sword2 { + // max length of a savegame filename, including full path #define MAX_FILENAME_LEN 128 @@ -653,3 +655,5 @@ uint32 CalcChecksum(uint8 *buffer, uint32 size) { return total; } + +} // End of namespace Sword2 diff --git a/sword2/save_rest.h b/sword2/save_rest.h index 78c6899b6c..13e9bc22ba 100644 --- a/sword2/save_rest.h +++ b/sword2/save_rest.h @@ -22,6 +22,8 @@ #include "memory.h" +namespace Sword2 { + #define SAVE_DESCRIPTION_LEN 64 uint32 SaveGame(uint16 slotNo, uint8 *description); @@ -54,4 +56,6 @@ uint32 FindBufferSize(void); // the fwrite() - could be // hard-drive full..? +} // End of namespace Sword2 + #endif diff --git a/sword2/scroll.cpp b/sword2/scroll.cpp index 5db6628bb7..70e0ac8815 100644 --- a/sword2/scroll.cpp +++ b/sword2/scroll.cpp @@ -26,6 +26,8 @@ #include "layers.h" #include "scroll.h" +namespace Sword2 { + // max no of pixel allowed to scroll per cycle #define MAX_SCROLL_DISTANCE 8 @@ -174,3 +176,5 @@ int32 FN_set_scroll_speed_slow(int32 *params) { scroll_fraction = 32; return IR_CONT; } + +} // End of namespace Sword2 diff --git a/sword2/scroll.h b/sword2/scroll.h index 6dce692850..44d26f718e 100644 --- a/sword2/scroll.h +++ b/sword2/scroll.h @@ -22,6 +22,10 @@ #ifndef _SCROLL #define _SCROLL +namespace Sword2 { + void Set_scrolling(void); +} // End of namespace Sword2 + #endif diff --git a/sword2/sound.cpp b/sword2/sound.cpp index 3e20c01402..22899c840f 100644 --- a/sword2/sound.cpp +++ b/sword2/sound.cpp @@ -38,6 +38,8 @@ #include "sound.h" #include "sword2.h" +namespace Sword2 { + typedef struct { uint32 resource; // resource id of sample uint32 fetchId; // Id of resource in PSX CD queue. :) @@ -426,3 +428,5 @@ void UnpauseAllSound(void) { g_sound->unpauseSpeech(); g_sound->unpauseFx(); } + +} // End of namespace Sword2 diff --git a/sword2/sound.h b/sword2/sound.h index 4ba808b966..3c2a1f2890 100644 --- a/sword2/sound.h +++ b/sword2/sound.h @@ -32,6 +32,8 @@ #include "common/scummsys.h" +namespace Sword2 { + // fx types #define FX_SPOT 0 @@ -59,4 +61,6 @@ int32 FN_stop_music(int32 *params); // used to store id of tunes that loop, for save & restore extern uint32 looping_music_id; +} // End of namespace Sword2 + #endif diff --git a/sword2/speech.cpp b/sword2/speech.cpp index 162921aecc..99137b557e 100644 --- a/sword2/speech.cpp +++ b/sword2/speech.cpp @@ -41,6 +41,8 @@ #include "sword2.h" #include "walker.h" +namespace Sword2 { + #define INS_talk 1 #define INS_anim 2 #define INS_reverse_anim 3 @@ -1628,3 +1630,5 @@ uint8 WantSpeechForLine(uint32 wavId) { return 1; } } + +} // End of namespace Sword2 diff --git a/sword2/speech.h b/sword2/speech.h index f137fdb991..c5e2ef1e47 100644 --- a/sword2/speech.h +++ b/sword2/speech.h @@ -22,6 +22,8 @@ #include "header.h" +namespace Sword2 { + #define MAX_SUBJECT_LIST 30 // is that enough? // array of these for subject menu build up @@ -42,4 +44,6 @@ extern int choosing; extern uint32 unpause_zone; +} // End of namespace Sword2 + #endif diff --git a/sword2/startup.cpp b/sword2/startup.cpp index 3c778b8d5a..c08a3bf805 100644 --- a/sword2/startup.cpp +++ b/sword2/startup.cpp @@ -39,6 +39,8 @@ #include "sync.h" #include "tony_gsdk.h" +namespace Sword2 { + uint32 total_startups = 0; uint32 total_screen_managers = 0; uint32 res; @@ -309,3 +311,5 @@ uint32 Con_start(uint8 *input) { return 1; } + +} // End of namespace Sword2 diff --git a/sword2/startup.h b/sword2/startup.h index 642172c538..ab36f278bd 100644 --- a/sword2/startup.h +++ b/sword2/startup.h @@ -20,6 +20,8 @@ #ifndef _STARTUP #define _STARTUP +namespace Sword2 { + #define MAX_starts 100 #define MAX_description 100 @@ -40,4 +42,6 @@ uint32 Init_start_menu(void); uint32 Con_print_start_menu(void); uint32 Con_start(uint8 *input); +} // End of namespace Sword2 + #endif diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp index ecd68d6af9..c01e9fc981 100644 --- a/sword2/sword2.cpp +++ b/sword2/sword2.cpp @@ -51,6 +51,26 @@ extern uint16 _debugLevel; +static const TargetSettings sword2_settings[] = { + /* Broken Sword 2 */ + {"sword2", "Broken Sword II", GID_SWORD2, 99, MDT_ADLIB | MDT_NATIVE, GF_DEFAULT_TO_1X_SCALER, "players.clu" }, + {"sword2alt", "Broken Sword II (alt)", GID_SWORD2, 99, MDT_ADLIB | MDT_NATIVE, GF_DEFAULT_TO_1X_SCALER, "r2ctlns.ocx" }, + {"sword2demo", "Broken Sword II (Demo)", GID_SWORD2_DEMO, 99, MDT_ADLIB | MDT_NATIVE, GF_DEFAULT_TO_1X_SCALER, "players.clu" }, + {NULL, NULL, 0, 0, MDT_NONE, 0, NULL} +}; + +const TargetSettings *Engine_SWORD2_targetList() { + return sword2_settings; +} + +Engine *Engine_SWORD2_create(GameDetector *detector, OSystem *syst) { + return new Sword2::Sword2State(detector, syst); +} + +REGISTER_PLUGIN("Broken Sword II", Engine_SWORD2_targetList, Engine_SWORD2_create); + +namespace Sword2 { + uint8 quitGame = 0; // version & owner details @@ -77,27 +97,9 @@ uint8 gamePaused = 0; uint8 graphics_level_fudged = 0; uint8 stepOneCycle = 0; // for use while game paused -static const TargetSettings sword2_settings[] = { - /* Broken Sword 2 */ - {"sword2", "Broken Sword II", GID_SWORD2, 99, MDT_ADLIB | MDT_NATIVE, GF_DEFAULT_TO_1X_SCALER, "players.clu" }, - {"sword2alt", "Broken Sword II (alt)", GID_SWORD2, 99, MDT_ADLIB | MDT_NATIVE, GF_DEFAULT_TO_1X_SCALER, "r2ctlns.ocx" }, - {"sword2demo", "Broken Sword II (Demo)", GID_SWORD2_DEMO, 99, MDT_ADLIB | MDT_NATIVE, GF_DEFAULT_TO_1X_SCALER, "players.clu" }, - {NULL, NULL, 0, 0, MDT_NONE, 0, NULL} -}; - Sword2State *g_sword2 = NULL; Sword2Sound *g_sound = NULL; -const TargetSettings *Engine_SWORD2_targetList() { - return sword2_settings; -} - -Engine *Engine_SWORD2_create(GameDetector *detector, OSystem *syst) { - return new Sword2State(detector, syst); -} - -REGISTER_PLUGIN("Broken Sword II", Engine_SWORD2_targetList, Engine_SWORD2_create); - Sword2State::Sword2State(GameDetector *detector, OSystem *syst) : Engine(detector, syst) { @@ -547,3 +549,5 @@ void UnpauseGame(void) { if (!mouse_status || choosing) Set_mouse(NORMAL_MOUSE_ID); } + +} // End of namespace Sword2 diff --git a/sword2/sword2.h b/sword2/sword2.h index f3b45b24ee..2bf3c0476a 100644 --- a/sword2/sword2.h +++ b/sword2/sword2.h @@ -22,6 +22,13 @@ #include "driver/d_sound.h" +enum BSGameId { + GID_SWORD2 = GID_SWORD2_FIRST, + GID_SWORD2_DEMO +}; + +namespace Sword2 { + // Bodge for PCF76 version so that their demo CD can be labelled "PCF76" // rather than "RBSII1" @@ -43,11 +50,6 @@ void UnpauseGame(void); extern uint8 version_string[]; // for displaying from the console extern uint8 unencoded_name[]; -enum BSGameId { - GID_SWORD2 = GID_SWORD2_FIRST, - GID_SWORD2_DEMO -}; - // TODO move stuff into class class Sword2State : public Engine { @@ -75,4 +77,6 @@ public: extern Sword2State *g_sword2; extern Sword2Sound *g_sound; +} // End of namespace Sword2 + #endif diff --git a/sword2/sync.cpp b/sword2/sync.cpp index 69426bb42a..6c3d6503f2 100644 --- a/sword2/sync.cpp +++ b/sword2/sync.cpp @@ -23,6 +23,8 @@ #include "interpreter.h" #include "sync.h" +namespace Sword2 { + typedef struct { uint32 id; uint32 sync; @@ -125,3 +127,5 @@ int32 FN_wait_sync(int32 *params) { // back again next cycle return IR_REPEAT; } + +} // End of namespace Sword2 diff --git a/sword2/sync.h b/sword2/sync.h index 2c7ba05ec6..a71e134cea 100644 --- a/sword2/sync.h +++ b/sword2/sync.h @@ -22,8 +22,12 @@ #include "object.h" +namespace Sword2 { + void Init_sync_system(void); void Clear_syncs(uint32 id); uint32 Get_sync(void); +} // End of namespace Sword2 + #endif diff --git a/sword2/tony_gsdk.cpp b/sword2/tony_gsdk.cpp index 4138993071..5d09f688aa 100644 --- a/sword2/tony_gsdk.cpp +++ b/sword2/tony_gsdk.cpp @@ -27,6 +27,8 @@ #include "sword2.h" #include "common/file.h" +namespace Sword2 { + uint32 Read_file(const char *name, mem **membloc, uint32 uid) { // read the file in and place into an allocated MEM_float block @@ -56,3 +58,5 @@ uint32 Read_file(const char *name, mem **membloc, uint32 uid) { //ok, done it - return bytes read return size; } + +} // End of namespace Sword2 diff --git a/sword2/tony_gsdk.h b/sword2/tony_gsdk.h index ea580cc781..b74e111af6 100644 --- a/sword2/tony_gsdk.h +++ b/sword2/tony_gsdk.h @@ -22,6 +22,10 @@ #include "memory.h" +namespace Sword2 { + uint32 Read_file(const char *name, mem **membloc, uint32 uid); +} // End of namespace Sword2 + #endif diff --git a/sword2/walker.cpp b/sword2/walker.cpp index c3d6221845..f5322aee07 100644 --- a/sword2/walker.cpp +++ b/sword2/walker.cpp @@ -45,6 +45,8 @@ #include "router.h" #include "sync.h" +namespace Sword2 { + int16 standby_x; // see FN_set_standby_coords int16 standby_y; uint8 standby_dir; @@ -798,3 +800,5 @@ int32 FN_set_standby_coords(int32 *params) { return IR_CONT; } + +} // End of namespace Sword2 diff --git a/sword2/walker.h b/sword2/walker.h index ab7bec0b2f..5a61fc1ca4 100644 --- a/sword2/walker.h +++ b/sword2/walker.h @@ -20,6 +20,8 @@ #ifndef _WALKER #define _WALKER +namespace Sword2 { + int32 FN_face_mega(int32 *params); int32 FN_turn(int32 *params); int32 FN_walk(int32 *params); @@ -27,4 +29,6 @@ int32 FN_walk_to_anim(int32 *params); int32 FN_stand_after_anim(int32 *params); int32 FN_stand(int32 *params); +} // End of namespace Sword2 + #endif -- cgit v1.2.3