diff options
author | Max Horn | 2003-10-03 18:33:57 +0000 |
---|---|---|
committer | Max Horn | 2003-10-03 18:33:57 +0000 |
commit | d7660a2662be298dad3cf9b320137dac8744d456 (patch) | |
tree | c80ddb2c4fb1917660db0010bb0b3d6ed8d57b24 | |
parent | eabeb62e20a8ed2117e19ca3bf04bb1d33637b79 (diff) | |
download | scummvm-rg350-d7660a2662be298dad3cf9b320137dac8744d456.tar.gz scummvm-rg350-d7660a2662be298dad3cf9b320137dac8744d456.tar.bz2 scummvm-rg350-d7660a2662be298dad3cf9b320137dac8744d456.zip |
introduced namespace Scumm; made #include statements use scumm/ prefix explicitly
svn-id: r10571
91 files changed, 589 insertions, 222 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp index e733324805..08b5f3ef4a 100644 --- a/scumm/actor.cpp +++ b/scumm/actor.cpp @@ -21,16 +21,18 @@ */ #include "stdafx.h" -#include "scumm.h" -#include "actor.h" -#include "akos.h" -#include "boxes.h" -#include "charset.h" -#include "costume.h" -#include "resource.h" -#include "saveload.h" -#include "sound.h" -#include "usage_bits.h" +#include "scumm/scumm.h" +#include "scumm/actor.h" +#include "scumm/akos.h" +#include "scumm/boxes.h" +#include "scumm/charset.h" +#include "scumm/costume.h" +#include "scumm/resource.h" +#include "scumm/saveload.h" +#include "scumm/sound.h" +#include "scumm/usage_bits.h" + +namespace Scumm { byte Actor::kInvalidBox = 0; ScummEngine *Actor::_vm = 0; @@ -1735,3 +1737,5 @@ const SaveLoadEntry *Actor::getSaveLoadEntries() { return actorEntries; } + +} // End of namespace Scumm diff --git a/scumm/actor.h b/scumm/actor.h index c95bd3d108..b911a1727d 100644 --- a/scumm/actor.h +++ b/scumm/actor.h @@ -25,8 +25,9 @@ #define ACTOR_H #include "common/scummsys.h" +#include "scumm/scumm.h" -#include "scumm.h" +namespace Scumm { enum MoveFlags { MF_NEW_LEG = 1, @@ -208,4 +209,6 @@ protected: void findPathTowardsOld(byte box, byte box2, byte box3, Common::Point &p2, Common::Point &p3); }; +} // End of namespace Scumm + #endif diff --git a/scumm/akos.cpp b/scumm/akos.cpp index 3af16b7bfd..1747c3c25f 100644 --- a/scumm/akos.cpp +++ b/scumm/akos.cpp @@ -21,12 +21,14 @@ */ #include "stdafx.h" -#include "scumm.h" -#include "actor.h" -#include "akos.h" -#include "bomp.h" -#include "imuse.h" -#include "sound.h" +#include "scumm/scumm.h" +#include "scumm/actor.h" +#include "scumm/akos.h" +#include "scumm/bomp.h" +#include "scumm/imuse.h" +#include "scumm/sound.h" + +namespace Scumm { #if !defined(__GNUC__) #pragma START_PACK_STRUCTS @@ -51,7 +53,6 @@ struct AkosOffset { #endif - enum AkosOpcodes { AKC_Return = 0xC001, AKC_SetVar = 0xC010, @@ -1377,3 +1378,5 @@ _GRELEASEPTR(GBVARS_DEFAULTSCALETABLE_INDEX, GBVARS_SCUMM) _GEND #endif + +} // End of namespace Scumm diff --git a/scumm/akos.h b/scumm/akos.h index d693cad814..cde89ec797 100644 --- a/scumm/akos.h +++ b/scumm/akos.h @@ -23,7 +23,9 @@ #ifndef AKOS_H #define AKOS_H -#include "base-costume.h" +#include "scumm/base-costume.h" + +namespace Scumm { #ifdef __PALM_OS__ extern const byte *defaultScaleTable; @@ -98,4 +100,6 @@ protected: void akos16DecompressMask(byte *dest, int32 pitch, const byte *src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency, byte *maskptr, int32 bitpos_start); }; +} // End of namespace Scumm + #endif diff --git a/scumm/base-costume.cpp b/scumm/base-costume.cpp index 3be38f1745..67fb8eaf3d 100644 --- a/scumm/base-costume.cpp +++ b/scumm/base-costume.cpp @@ -21,8 +21,9 @@ */ #include "stdafx.h" -#include "base-costume.h" +#include "scumm/base-costume.h" +namespace Scumm { byte BaseCostumeRenderer::drawCostume(const CostumeData &cost) { int i; @@ -59,3 +60,5 @@ void BaseCostumeRenderer::codec1_ignorePakCols(int num) { } while (--v1.replen); } while (1); } + +} // End of namespace Scumm diff --git a/scumm/base-costume.h b/scumm/base-costume.h index 001637ba33..45b522b616 100644 --- a/scumm/base-costume.h +++ b/scumm/base-costume.h @@ -24,7 +24,9 @@ #define BASE_COSTUME_H #include "common/scummsys.h" -#include "actor.h" // for CostumeData +#include "scumm/actor.h" // for CostumeData + +namespace Scumm { #if !defined(__GNUC__) #pragma START_PACK_STRUCTS @@ -130,4 +132,6 @@ protected: void codec1_ignorePakCols(int num); }; +} // End of namespace Scumm + #endif diff --git a/scumm/bomp.cpp b/scumm/bomp.cpp index 2a51f61ec5..5d94886349 100644 --- a/scumm/bomp.cpp +++ b/scumm/bomp.cpp @@ -20,11 +20,13 @@ */ #include "stdafx.h" -#include "scumm.h" -#include "akos.h" -#include "bomp.h" +#include "scumm/scumm.h" +#include "scumm/akos.h" +#include "scumm/bomp.h" +namespace Scumm { + static void bompScaleFuncX(byte *line_buffer, byte *scaling_x_ptr, byte skip, int32 size); static void bompApplyShadow0(const byte *line_buffer, byte *dst, int32 size, byte transparency); @@ -386,3 +388,4 @@ int32 setupBompScale(byte *scaling, int32 size, byte scale) { return ret_value; } +} // End of namespace Scumm diff --git a/scumm/bomp.h b/scumm/bomp.h index 386698bbab..d2c224ea29 100644 --- a/scumm/bomp.h +++ b/scumm/bomp.h @@ -22,6 +22,8 @@ #ifndef BOMP_H #define BOMP_H +namespace Scumm { + int32 setupBompScale(byte *scaling, int32 size, byte scale); void bompApplyMask(byte *line_buffer, byte *mask, byte maskbit, int32 size, byte transparency); @@ -31,4 +33,6 @@ void decompressBomp(byte *dst, const byte *src, int w, int h); void bompDecodeLine(byte *dst, const byte *src, int size); void bompDecodeLineReverse(byte *dst, const byte *src, int size); +} // End of namespace Scumm + #endif diff --git a/scumm/boxes.cpp b/scumm/boxes.cpp index 2f9e47ccc2..1fdf8128ac 100644 --- a/scumm/boxes.cpp +++ b/scumm/boxes.cpp @@ -21,11 +21,13 @@ */ #include "stdafx.h" -#include "scumm.h" -#include "actor.h" -#include "boxes.h" +#include "scumm/scumm.h" +#include "scumm/actor.h" +#include "scumm/boxes.h" #include "common/util.h" +namespace Scumm { + #if !defined(__GNUC__) #pragma START_PACK_STRUCTS #endif @@ -1278,3 +1280,4 @@ void ScummEngine::getGates(int trap1, int trap2, Common::Point gateA[2], Common: } } +} // End of namespace Scumm diff --git a/scumm/boxes.h b/scumm/boxes.h index e0ab671d5c..c4f23af448 100644 --- a/scumm/boxes.h +++ b/scumm/boxes.h @@ -25,6 +25,8 @@ #include "common/rect.h" +namespace Scumm { + #define SIZEOF_BOX_V2 8 #define SIZEOF_BOX_V3 18 #define SIZEOF_BOX 20 @@ -45,4 +47,6 @@ struct BoxCoords { /* Box coordinates */ Common::Point lr; }; +} // End of namespace Scumm + #endif diff --git a/scumm/bundle.cpp b/scumm/bundle.cpp index f866ea0a98..4e720d6d7e 100644 --- a/scumm/bundle.cpp +++ b/scumm/bundle.cpp @@ -23,6 +23,8 @@ #include "scumm/scumm.h" #include "scumm/bundle.h" +namespace Scumm { + #ifdef __PALM_OS__ static const int16 *imcTable; #else @@ -956,3 +958,5 @@ _GRELEASEPTR(GBVARS_IMCTABLE_INDEX, GBVARS_SCUMM) _GEND #endif + +} // End of namespace Scumm diff --git a/scumm/bundle.h b/scumm/bundle.h index a94ce6fe17..dd13d98379 100644 --- a/scumm/bundle.h +++ b/scumm/bundle.h @@ -24,6 +24,8 @@ #include "common/scummsys.h" #include "common/file.h" +namespace Scumm { + class Bundle { private: @@ -76,4 +78,6 @@ public: int32 getNumberOfMusicSamplesByName(const char *name); }; +} // End of namespace Scumm + #endif diff --git a/scumm/camera.cpp b/scumm/camera.cpp index 50990528fc..3f072950ea 100644 --- a/scumm/camera.cpp +++ b/scumm/camera.cpp @@ -20,10 +20,12 @@ */ #include "stdafx.h" -#include "scumm.h" -#include "intern.h" -#include "actor.h" -#include "charset.h" +#include "scumm/scumm.h" +#include "scumm/intern.h" +#include "scumm/actor.h" +#include "scumm/charset.h" + +namespace Scumm { void ScummEngine::setCameraAtEx(int at) { if (!(_features & GF_NEW_CAMERA)) { @@ -382,3 +384,4 @@ void ScummEngine::actorFollowCamera(int act) { } } +} // End of namespace Scumm diff --git a/scumm/charset.cpp b/scumm/charset.cpp index 36362f0ea8..8dcc9598b5 100644 --- a/scumm/charset.cpp +++ b/scumm/charset.cpp @@ -19,11 +19,13 @@ */ #include "stdafx.h" -#include "charset.h" -#include "scumm.h" -#include "nut_renderer.h" +#include "scumm/charset.h" +#include "scumm/scumm.h" +#include "scumm/nut_renderer.h" #include "base/gameDetector.h" +namespace Scumm { + CharsetRenderer::CharsetRenderer(ScummEngine *vm) { _nextLeft = 0; @@ -1321,3 +1323,5 @@ _GRELEASEPTR(GBVARS_SPANISHCHARSETDATAV2_INDEX, GBVARS_SCUMM) _GEND #endif + +} // End of namespace Scumm diff --git a/scumm/charset.h b/scumm/charset.h index 09e662b634..768af5bdbd 100644 --- a/scumm/charset.h +++ b/scumm/charset.h @@ -24,6 +24,8 @@ #include "common/rect.h" #include "common/scummsys.h" +namespace Scumm { + class ScummEngine; class NutRenderer; struct VirtScreen; @@ -143,4 +145,7 @@ public: int getFontHeight(); }; +} // End of namespace Scumm + + #endif diff --git a/scumm/costume.cpp b/scumm/costume.cpp index 9d04d34895..2723177ce1 100644 --- a/scumm/costume.cpp +++ b/scumm/costume.cpp @@ -21,11 +21,13 @@ */ #include "stdafx.h" -#include "scumm.h" -#include "actor.h" -#include "costume.h" +#include "scumm/scumm.h" +#include "scumm/actor.h" +#include "scumm/costume.h" #include "scumm/sound.h" +namespace Scumm { + const byte revBitMask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; #ifdef __PALM_OS__ @@ -868,3 +870,5 @@ _GRELEASEPTR(GBVARS_COSTSCALETABLE_INDEX, GBVARS_SCUMM) _GEND #endif + +} // End of namespace Scumm diff --git a/scumm/costume.h b/scumm/costume.h index 2038b42839..a6f60823c0 100644 --- a/scumm/costume.h +++ b/scumm/costume.h @@ -21,7 +21,9 @@ #ifndef COSTUME_H #define COSTUME_H -#include "base-costume.h" +#include "scumm/base-costume.h" + +namespace Scumm { class LoadedCostume { protected: @@ -78,4 +80,6 @@ protected: byte mainRoutine(int xmoveCur, int ymoveCur); }; +} // End of namespace Scumm + #endif diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp index 3eacb7734f..f7d2de0b2d 100644 --- a/scumm/debugger.cpp +++ b/scumm/debugger.cpp @@ -45,6 +45,8 @@ extern void force_keyboard(bool); extern uint16 _debugLevel; +namespace Scumm { + ScummDebugger::ScummDebugger() { _s = 0; _frame_countdown = 0; @@ -1125,3 +1127,4 @@ bool ScummDebugger::TabComplete(const char *input, char*& completion) { return true; } +} // End of namespace Scumm diff --git a/scumm/debugger.h b/scumm/debugger.h index 31c786799b..28902bac94 100644 --- a/scumm/debugger.h +++ b/scumm/debugger.h @@ -21,6 +21,8 @@ #ifndef DEBUG_H #define DEBUG_H +namespace Scumm { + // Choose between text console or ScummConsole #define USE_CONSOLE 1 @@ -108,4 +110,6 @@ protected: }; +} // End of namespace Scumm + #endif diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp index 8f022b2526..51ee68aadb 100644 --- a/scumm/dialogs.cpp +++ b/scumm/dialogs.cpp @@ -19,17 +19,17 @@ */ #include "stdafx.h" -#include "dialogs.h" -#include "sound.h" -#include "scumm.h" -#include "imuse.h" -#include "player_v2.h" -#include "verbs.h" +#include "scumm/dialogs.h" +#include "scumm/sound.h" +#include "scumm/scumm.h" +#include "scumm/imuse.h" +#include "scumm/player_v2.h" +#include "scumm/verbs.h" #include "sound/mididrv.h" #include "sound/mixer.h" #ifndef DISABLE_HELP -#include "help.h" +#include "scumm/help.h" #endif #include "gui/newgui.h" @@ -44,6 +44,8 @@ extern void save_key_mapping(); extern void load_key_mapping(); #endif +namespace Scumm { + struct ResString { int num; char string[80]; @@ -803,3 +805,5 @@ _GRELEASEPTR(GBVARS_STRINGMAPTABLEV5_INDEX, GBVARS_SCUMM) _GEND #endif + +} // End of namespace Scumm diff --git a/scumm/dialogs.h b/scumm/dialogs.h index 9b6aa359b9..db9bec2315 100644 --- a/scumm/dialogs.h +++ b/scumm/dialogs.h @@ -26,10 +26,13 @@ #include "gui/dialog.h" #ifndef DISABLE_HELP -#include "help.h" +#include "scumm/help.h" #endif class ListWidget; + +namespace Scumm { + class ScummEngine; class ScummDialog : public Dialog { @@ -192,4 +195,6 @@ protected: #endif +} // End of namespace Scumm + #endif diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index 3f52ed8a7d..f86b4e568d 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -20,13 +20,15 @@ */ #include "stdafx.h" -#include "scumm.h" -#include "actor.h" -#include "bomp.h" -#include "charset.h" -#include "resource.h" -#include "usage_bits.h" -#include "util.h" +#include "common/util.h" +#include "scumm/scumm.h" +#include "scumm/actor.h" +#include "scumm/bomp.h" +#include "scumm/charset.h" +#include "scumm/resource.h" +#include "scumm/usage_bits.h" + +namespace Scumm { enum { kScrolltime = 500, // ms scrolling is supposed to take @@ -2741,7 +2743,7 @@ void ScummEngine::stopCycle(int i) { * Cycle the colors in the given palette in the intervael [cycleStart, cycleEnd] * either one step forward or backward. */ -static void cyclePalette(byte *palette, int cycleStart, int cycleEnd, int size, bool forward) { +static void doCyclePalette(byte *palette, int cycleStart, int cycleEnd, int size, bool forward) { byte *start = palette + cycleStart * size; byte *end = palette + cycleEnd * size; int num = cycleEnd - cycleStart; @@ -2769,7 +2771,7 @@ static void cyclePalette(byte *palette, int cycleStart, int cycleEnd, int size, * palette by searching through it and replacing all indices that are in the * cycle range by the new (cycled) index. */ -static void cycleIndirectPalette(byte *palette, int cycleStart, int cycleEnd, bool forward) { +static void doCycleIndirectPalette(byte *palette, int cycleStart, int cycleEnd, bool forward) { int num = cycleEnd - cycleStart + 1; int i; int offset = forward ? 1 : num - 1; @@ -2811,19 +2813,19 @@ void ScummEngine::cyclePalette() { moveMemInPalRes(cycl->start, cycl->end, cycl->flags & 2); if (!(_features & GF_SMALL_HEADER && _version > 2)) - ::cyclePalette(_currentPalette, cycl->start, cycl->end, 3, !(cycl->flags & 2)); + doCyclePalette(_currentPalette, cycl->start, cycl->end, 3, !(cycl->flags & 2)); // Also cycle the other, indirect palettes if (_proc_special_palette) { - ::cycleIndirectPalette(_proc_special_palette, cycl->start, cycl->end, !(cycl->flags & 2)); + doCycleIndirectPalette(_proc_special_palette, cycl->start, cycl->end, !(cycl->flags & 2)); } if (_shadowPalette) { if (_version >= 7) { for (j = 0; j < NUM_SHADOW_PALETTE; j++) - ::cycleIndirectPalette(_shadowPalette + j * 256, cycl->start, cycl->end, !(cycl->flags & 2)); + doCycleIndirectPalette(_shadowPalette + j * 256, cycl->start, cycl->end, !(cycl->flags & 2)); } else { - ::cycleIndirectPalette(_shadowPalette, cycl->start, cycl->end, !(cycl->flags & 2)); + doCycleIndirectPalette(_shadowPalette, cycl->start, cycl->end, !(cycl->flags & 2)); } } } @@ -2838,8 +2840,8 @@ void ScummEngine::moveMemInPalRes(int start, int end, byte direction) { if (!_palManipCounter) return; - ::cyclePalette(_palManipPalette, start, end, 3, !direction); - ::cyclePalette(_palManipIntermediatePal, start, end, 6, !direction); + doCyclePalette(_palManipPalette, start, end, 3, !direction); + doCyclePalette(_palManipIntermediatePal, start, end, 6, !direction); } void ScummEngine::palManipulateInit(int start, int end, int string_id, int time) { @@ -3645,3 +3647,5 @@ _GRELEASEPTR(GBVARS_TRANSITIONEFFECTS_INDEX, GBVARS_SCUMM) _GEND #endif + +} // End of namespace Scumm diff --git a/scumm/gfx.h b/scumm/gfx.h index 066fc9d183..3e4b588962 100644 --- a/scumm/gfx.h +++ b/scumm/gfx.h @@ -25,6 +25,8 @@ #include "common/rect.h" +namespace Scumm { + class ScummEngine; enum { /** Camera modes */ @@ -198,4 +200,6 @@ public: // #define V7_SMOOTH_SCROLLING_HACK +} // End of namespace Scumm + #endif diff --git a/scumm/help.cpp b/scumm/help.cpp index d840fc9f32..2d2d089ce5 100644 --- a/scumm/help.cpp +++ b/scumm/help.cpp @@ -18,10 +18,12 @@ */ #include "stdafx.h" -#include "help.h" -#include "scumm.h" +#include "scumm/help.h" +#include "scumm/scumm.h" #include "common/str.h" +namespace Scumm { + int ScummHelp::numPages(byte gameId) { switch (gameId) { case GID_MANIAC: @@ -330,3 +332,4 @@ void ScummHelp::updateStrings(byte gameId, byte version, int page, #undef ADD_TEXT #undef ADD_LINE +} // End of namespace Scumm diff --git a/scumm/help.h b/scumm/help.h index 72d658fc01..6292925eb6 100644 --- a/scumm/help.h +++ b/scumm/help.h @@ -22,6 +22,8 @@ #include "common/str.h" +namespace Scumm { + #define HELP_NUM_LINES 15 class ScummHelp { @@ -34,5 +36,7 @@ public: String &title, String *&key, String *&dsc); }; +} // End of namespace Scumm + #endif diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp index 7f5c282938..223e32ad4f 100644 --- a/scumm/imuse.cpp +++ b/scumm/imuse.cpp @@ -34,6 +34,7 @@ #include "sound/mididrv.h" +namespace Scumm { //////////////////////////////////////// // @@ -1782,3 +1783,5 @@ IMuse *IMuse::create(OSystem *syst, SoundMixer *mixer, MidiDriver *midi) { IMuseInternal *engine = IMuseInternal::create(syst, mixer, midi); return new IMuse(syst, engine); } + +} // End of namespace Scumm diff --git a/scumm/imuse.h b/scumm/imuse.h index 559a0c5309..be19ba0372 100644 --- a/scumm/imuse.h +++ b/scumm/imuse.h @@ -27,12 +27,15 @@ #include "common/system.h" #include "scumm/music.h" -class IMuseInternal; class MidiDriver; class OSystem; +class SoundMixer; + +namespace Scumm { + +class IMuseInternal; class ScummEngine; class Serializer; -class SoundMixer; class IMuse : public MusicEngine { private: @@ -80,4 +83,6 @@ public: static IMuse *create(OSystem *syst, SoundMixer *mixer, MidiDriver *midi); }; +} // End of namespace Scumm + #endif diff --git a/scumm/imuse_digi.cpp b/scumm/imuse_digi.cpp index 0ff02e51f9..f0a08957f7 100644 --- a/scumm/imuse_digi.cpp +++ b/scumm/imuse_digi.cpp @@ -20,12 +20,14 @@ #include "stdafx.h" #include "common/timer.h" -#include "imuse_digi.h" -#include "scumm.h" -#include "sound.h" +#include "scumm/imuse_digi.h" +#include "scumm/scumm.h" +#include "scumm/sound.h" #include "sound/mixer.h" #include "sound/voc.h" +namespace Scumm { + //////////////////////////////////////// // // iMuse Digital Implementation @@ -1194,3 +1196,5 @@ _GRELEASEPTR(GBVARS_FTSEQMUSICTABLE_INDEX , GBVARS_SCUMM) _GEND #endif + +} // End of namespace Scumm diff --git a/scumm/imuse_digi.h b/scumm/imuse_digi.h index 1892c9b256..8dd861f4f4 100644 --- a/scumm/imuse_digi.h +++ b/scumm/imuse_digi.h @@ -27,6 +27,8 @@ #include "scumm/music.h" #include "sound/mixer.h" +namespace Scumm { + #define MAX_DIGITAL_CHANNELS 8 #define MAX_IMUSE_JUMPS 1 #define MAX_IMUSE_REGIONS 3 @@ -80,4 +82,6 @@ public: int getSoundStatus(int sound) const; }; +} // End of namespace Scumm + #endif diff --git a/scumm/imuse_internal.h b/scumm/imuse_internal.h index 1fc3ff8dd1..0265df65d5 100644 --- a/scumm/imuse_internal.h +++ b/scumm/imuse_internal.h @@ -26,6 +26,12 @@ #include "scumm/instrument.h" #include "sound/mididrv.h" +class MidiParser; +class OSystem; +class SoundMixer; + +namespace Scumm { + // Unremark this statement to activate some of // the most common iMuse diagnostic messages. // #define IMUSE_DEBUG @@ -42,10 +48,7 @@ struct Part; class IMuseInternal; // Some entities also referenced -class MidiParser; class ScummEngine; -class OSystem; -class SoundMixer; @@ -470,4 +473,6 @@ public: static IMuseInternal *create(OSystem *syst, SoundMixer *mixer, MidiDriver *midi); }; +} // End of namespace Scumm + #endif diff --git a/scumm/imuse_player.cpp b/scumm/imuse_player.cpp index daa635461d..a680dcbe64 100644 --- a/scumm/imuse_player.cpp +++ b/scumm/imuse_player.cpp @@ -31,6 +31,7 @@ #include "sound/midiparser.h" +namespace Scumm { //////////////////////////////////////// // @@ -1198,3 +1199,5 @@ int Player::save_or_load(Serializer *ser) { sizeof(ParameterFader), parameterFaderEntries); return 0; } + +} // End of namespace Scumm diff --git a/scumm/instrument.cpp b/scumm/instrument.cpp index 2a837b8320..e053a5220d 100644 --- a/scumm/instrument.cpp +++ b/scumm/instrument.cpp @@ -25,6 +25,8 @@ #include "scumm/instrument.h" #include "sound/mididrv.h" +namespace Scumm { + static bool _native_mt32 = false; static const byte mt32_to_gm[128] = { @@ -466,3 +468,5 @@ uint8 Instrument_Roland::getEquivalentGM() { } return 255; } + +} // End of namespace Scumm diff --git a/scumm/instrument.h b/scumm/instrument.h index 8116af1d25..baaf1c03f6 100644 --- a/scumm/instrument.h +++ b/scumm/instrument.h @@ -25,8 +25,11 @@ #include "stdafx.h" #include "common/scummsys.h" -class Serializer; class MidiChannel; + +namespace Scumm { + +class Serializer; class Instrument; class InstrumentInternal { @@ -68,4 +71,6 @@ public: void send (MidiChannel *mc) { if (_instrument) _instrument->send (mc); } }; +} // End of namespace Scumm + #endif diff --git a/scumm/intern.h b/scumm/intern.h index 8725615c7f..799eab37e1 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -23,7 +23,11 @@ #ifndef INTERN_H #define INTERN_H -#include "scumm.h" +#include "scumm/scumm.h" + + +namespace Scumm { + class NutRenderer; // V8 Font Renderer class ScummEngine_v5 : public ScummEngine { @@ -606,5 +610,6 @@ protected: }; +} // End of namespace Scumm #endif diff --git a/scumm/midiparser_eup.cpp b/scumm/midiparser_eup.cpp index 85276dad15..402e1d07f4 100644 --- a/scumm/midiparser_eup.cpp +++ b/scumm/midiparser_eup.cpp @@ -25,6 +25,8 @@ #include "common/util.h" +namespace Scumm { + ////////////////////////////////////////////////// // // The FM Towns Euphony version of MidiParser @@ -189,3 +191,5 @@ void MidiParser_EUP::resetTracking() { } MidiParser *MidiParser_createEUP() { return new MidiParser_EUP; } + +} // End of namespace Scumm diff --git a/scumm/midiparser_ro.cpp b/scumm/midiparser_ro.cpp index afe0f49131..da46e54fd3 100644 --- a/scumm/midiparser_ro.cpp +++ b/scumm/midiparser_ro.cpp @@ -25,6 +25,8 @@ #include "common/util.h" +namespace Scumm { + ////////////////////////////////////////////////// // // The Standard MIDI File version of MidiParser @@ -137,3 +139,5 @@ bool MidiParser_RO::loadMusic (byte *data, uint32 size) { } MidiParser *MidiParser_createRO() { return new MidiParser_RO; } + +} // End of namespace Scumm diff --git a/scumm/music.h b/scumm/music.h index 226c499fec..714105f02a 100644 --- a/scumm/music.h +++ b/scumm/music.h @@ -26,6 +26,8 @@ #include "common/scummsys.h" #include "common/system.h" +namespace Scumm { + /** * Pure virtual base class for the various music/sound engines used in Scumm * games. In particular, the iMuse code provides a subclass of this. There are @@ -85,4 +87,6 @@ public: virtual void terminate() {} }; +} // End of namespace Scumm + #endif diff --git a/scumm/nut_renderer.cpp b/scumm/nut_renderer.cpp index bae21dfbb4..a75166a76f 100644 --- a/scumm/nut_renderer.cpp +++ b/scumm/nut_renderer.cpp @@ -19,11 +19,13 @@ */ #include "stdafx.h" -#include "scumm.h" -#include "nut_renderer.h" -#include "bomp.h" +#include "scumm/scumm.h" +#include "scumm/nut_renderer.h" +#include "scumm/bomp.h" +namespace Scumm { + NutRenderer::NutRenderer(ScummEngine *vm) : _vm(vm), _initialized(false), @@ -345,3 +347,5 @@ void NutRenderer::draw2byte(byte *dst, byte *mask, int c, int x, int y, byte col mask += _vm->gdi._numStrips; } } + +} // End of namespace Scumm diff --git a/scumm/nut_renderer.h b/scumm/nut_renderer.h index 4aa835c842..9832e3a6da 100644 --- a/scumm/nut_renderer.h +++ b/scumm/nut_renderer.h @@ -23,6 +23,8 @@ #include "common/file.h" +namespace Scumm { + class ScummEngine; class NutRenderer { @@ -58,5 +60,6 @@ public: int getCharHeight(byte c); }; +} // End of namespace Scumm #endif diff --git a/scumm/object.cpp b/scumm/object.cpp index 359df5abe5..7dbd6685fc 100644 --- a/scumm/object.cpp +++ b/scumm/object.cpp @@ -21,12 +21,14 @@ */ #include "stdafx.h" -#include "scumm.h" -#include "actor.h" -#include "bomp.h" -#include "object.h" -#include "resource.h" -#include "usage_bits.h" +#include "scumm/scumm.h" +#include "scumm/actor.h" +#include "scumm/bomp.h" +#include "scumm/object.h" +#include "scumm/resource.h" +#include "scumm/usage_bits.h" + +namespace Scumm { #if !defined(__GNUC__) #pragma START_PACK_STRUCTS @@ -1661,3 +1663,5 @@ void ScummEngine::loadFlObject(uint object, uint room) { od->fl_object_index = slot; } + +} // End of namespace Scumm diff --git a/scumm/object.h b/scumm/object.h index 19089abf29..4f1f49f564 100644 --- a/scumm/object.h +++ b/scumm/object.h @@ -21,6 +21,8 @@ #ifndef OBJECT_H #define OBJECT_H +namespace Scumm { + struct ObjectData { uint32 OBIMoffset; uint32 OBCDoffset; @@ -165,5 +167,7 @@ enum FindObjectWhat { foCheckAlreadyLoaded = 4 }; +} // End of namespace Scumm + #endif diff --git a/scumm/player_mod.cpp b/scumm/player_mod.cpp index d0928a54ed..6aee4087ba 100644 --- a/scumm/player_mod.cpp +++ b/scumm/player_mod.cpp @@ -20,7 +20,9 @@ * */ -#include "player_mod.h" +#include "scumm/player_mod.h" + +namespace Scumm { //////////////////////////////////////// // @@ -186,3 +188,5 @@ void Player_MOD::do_mix (int16 *data, uint len) { dpos += dlen; } } + +} // End of namespace Scumm diff --git a/scumm/player_mod.h b/scumm/player_mod.h index d815d9cfc4..bdc4bc5cf0 100644 --- a/scumm/player_mod.h +++ b/scumm/player_mod.h @@ -23,11 +23,13 @@ #ifndef PLAYER_MOD_H #define PLAYER_MOD_H -#include "scumm.h" +#include "scumm/scumm.h" #include "sound/mixer.h" #include "sound/audiostream.h" #include "sound/rate.h" +namespace Scumm { + #define MOD_MAXCHANS 16 class Player_MOD { @@ -75,4 +77,6 @@ private: void *_playparam; }; +} // End of namespace Scumm + #endif diff --git a/scumm/player_v1.cpp b/scumm/player_v1.cpp index 95e2fc48af..4eec5e2f69 100644 --- a/scumm/player_v1.cpp +++ b/scumm/player_v1.cpp @@ -22,8 +22,10 @@ #include "stdafx.h" #include "base/engine.h" -#include "player_v1.h" -#include "scumm.h" +#include "scumm/player_v1.h" +#include "scumm/scumm.h" + +namespace Scumm { #define TIMER_BASE_FREQ 1193000 #define FIXP_SHIFT 16 @@ -605,3 +607,5 @@ void Player_V1::generatePCjrSamples(int16 *data, uint len) { if (_level || hasdata) lowPassFilter(data, len); } + +} // End of namespace Scumm diff --git a/scumm/player_v1.h b/scumm/player_v1.h index bf64cc472d..ce9b7ddfdb 100644 --- a/scumm/player_v1.h +++ b/scumm/player_v1.h @@ -23,7 +23,9 @@ #ifndef PLAYER_V1_H #define PLAYER_V1_H -#include "player_v2.h" +#include "scumm/player_v2.h" + +namespace Scumm { #define FB_WNOISE 0x12000 /* feedback for white noise */ #define FB_PNOISE 0x08000 /* feedback for periodic noise */ @@ -92,4 +94,6 @@ private: int _delta_2; }; +} // End of namespace Scumm + #endif diff --git a/scumm/player_v2.cpp b/scumm/player_v2.cpp index 929cce1468..a723905f29 100644 --- a/scumm/player_v2.cpp +++ b/scumm/player_v2.cpp @@ -22,11 +22,13 @@ #include "stdafx.h" #include "base/engine.h" -#include "player_v2.h" -#include "scumm.h" +#include "scumm/player_v2.h" +#include "scumm/scumm.h" #include "sound/mididrv.h" #include "sound/mixer.h" +namespace Scumm { + #define FREQ_HZ 236 // Don't change! #define SPK_DECAY 0xfa00 /* Depends on sample rate */ @@ -1019,3 +1021,5 @@ _GRELEASEPTR(GBVARS_PCJRFREQTABLE_INDEX, GBVARS_SCUMM) _GEND #endif + +} // End of namespace Scumm diff --git a/scumm/player_v2.h b/scumm/player_v2.h index 437fd0b365..55af6970c2 100644 --- a/scumm/player_v2.h +++ b/scumm/player_v2.h @@ -27,6 +27,12 @@ #include "common/system.h" #include "scumm/music.h" +class SoundMixer; + +namespace Scumm { + +class ScummEngine; + #if !defined(__GNUC__) #pragma START_PACK_STRUCTS #endif @@ -66,11 +72,6 @@ union ChannelInfo { uint16 array[sizeof(channel_data)/2]; }; - -class ScummEngine; -class SoundMixer; - - class Player_V2 : public MusicEngine { public: Player_V2(ScummEngine *scumm); @@ -145,4 +146,6 @@ private: void next_freqs(ChannelInfo *channel); }; +} // End of namespace Scumm + #endif diff --git a/scumm/player_v2a.cpp b/scumm/player_v2a.cpp index 37c1b4f817..6e5e07ab8e 100644 --- a/scumm/player_v2a.cpp +++ b/scumm/player_v2a.cpp @@ -22,8 +22,10 @@ #include "stdafx.h" #include "base/engine.h" -#include "player_v2a.h" -#include "scumm.h" +#include "scumm/player_v2a.h" +#include "scumm/scumm.h" + +namespace Scumm { #define BASE_FREQUENCY 3579545 @@ -1216,3 +1218,5 @@ int Player_V2A::getSoundStatus(int nr) const { } return 0; } + +} // End of namespace Scumm diff --git a/scumm/player_v2a.h b/scumm/player_v2a.h index b39c52f866..f54495cf98 100644 --- a/scumm/player_v2a.h +++ b/scumm/player_v2a.h @@ -28,11 +28,13 @@ #include "scumm/music.h" #include "scumm/player_mod.h" +class SoundMixer; + +namespace Scumm { + #define V2A_MAXSLOTS 8 class ScummEngine; -class SoundMixer; - class V2A_Sound; class Player_V2A : public MusicEngine { @@ -63,4 +65,6 @@ private: void updateSound(); }; +} // End of namespace Scumm + #endif diff --git a/scumm/player_v3a.cpp b/scumm/player_v3a.cpp index 3c7d6766a9..4b98653acb 100644 --- a/scumm/player_v3a.cpp +++ b/scumm/player_v3a.cpp @@ -22,8 +22,10 @@ #include "stdafx.h" #include "base/engine.h" -#include "player_v3a.h" -#include "scumm.h" +#include "scumm/player_v3a.h" +#include "scumm/scumm.h" + +namespace Scumm { static const uint16 note_freqs[4][12] = { {0x06B0,0x0650,0x05F4,0x05A0,0x054C,0x0500,0x04B8,0x0474,0x0434,0x03F8,0x03C0,0x0388}, @@ -334,3 +336,5 @@ int Player_V3A::getSoundStatus(int nr) const { return 1; return 0; } + +} // End of namespace Scumm diff --git a/scumm/player_v3a.h b/scumm/player_v3a.h index 2542045cc4..25857680fc 100644 --- a/scumm/player_v3a.h +++ b/scumm/player_v3a.h @@ -28,11 +28,14 @@ #include "scumm/music.h" #include "scumm/player_mod.h" +class SoundMixer; + +namespace Scumm { + #define V3A_MAXMUS 8 #define V3A_MAXSFX 8 class ScummEngine; -class SoundMixer; class Player_V3A : public MusicEngine { public: @@ -87,4 +90,6 @@ private: void playMusic(); }; +} // End of namespace Scumm + #endif diff --git a/scumm/resource.cpp b/scumm/resource.cpp index acaff01404..6c55856115 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -34,6 +34,8 @@ #include "scumm/verbs.h" #include "sound/mididrv.h" // Need MD_ enum values +namespace Scumm { + static uint16 newTag2Old(uint32 oldTag); static const char *resTypeFromId(int id); @@ -2373,3 +2375,5 @@ const char *resTypeFromId(int id) { return buf; } } + +} // End of namespace Scumm diff --git a/scumm/resource.h b/scumm/resource.h index b6ca35dc71..73e07260ed 100644 --- a/scumm/resource.h +++ b/scumm/resource.h @@ -21,6 +21,8 @@ #ifndef RESOURCE_H #define RESOURCE_H +namespace Scumm { + #if !defined(__GNUC__) #pragma START_PACK_STRUCTS #endif @@ -72,5 +74,6 @@ public: const byte *findNext(uint32 tag); }; +} // End of namespace Scumm #endif diff --git a/scumm/resource_v2.cpp b/scumm/resource_v2.cpp index a02002006f..34030268d3 100644 --- a/scumm/resource_v2.cpp +++ b/scumm/resource_v2.cpp @@ -20,13 +20,15 @@ */ #include "stdafx.h" -#include "scumm.h" -#include "intern.h" -#include "player_v2.h" -#include "player_v1.h" -#include "resource.h" +#include "scumm/scumm.h" +#include "scumm/intern.h" +#include "scumm/player_v2.h" +#include "scumm/player_v1.h" +#include "scumm/resource.h" #include "sound/mididrv.h" +namespace Scumm { + void ScummEngine_v2::readClassicIndexFile() { int i; @@ -202,3 +204,5 @@ void ScummEngine_v2::readMAXS() { void ScummEngine_v2::loadCharset(int num) { // Stub, V2 font resources are hardcoded into the engine. } + +} // End of namespace Scumm diff --git a/scumm/resource_v3.cpp b/scumm/resource_v3.cpp index 1404845885..308a044ae1 100644 --- a/scumm/resource_v3.cpp +++ b/scumm/resource_v3.cpp @@ -21,10 +21,11 @@ */ #include "stdafx.h" -#include "scumm.h" -#include "intern.h" -#include "resource.h" +#include "scumm/scumm.h" +#include "scumm/intern.h" +#include "scumm/resource.h" +namespace Scumm { void ScummEngine_v3::readIndexFile() { if (_features & GF_OLD_BUNDLE) { @@ -226,3 +227,5 @@ void ScummEngine_v3::readGlobalObjects() { _objectStateTable[i] = tmp >> OF_STATE_SHL; } } + +} // End of namespace Scumm diff --git a/scumm/resource_v4.cpp b/scumm/resource_v4.cpp index 425954f455..3f5311f07f 100644 --- a/scumm/resource_v4.cpp +++ b/scumm/resource_v4.cpp @@ -21,8 +21,10 @@ */ #include "stdafx.h" -#include "scumm.h" -#include "intern.h" +#include "scumm/scumm.h" +#include "scumm/intern.h" + +namespace Scumm { void ScummEngine_v4::loadCharset(int no) { uint32 size; @@ -38,3 +40,5 @@ void ScummEngine_v4::loadCharset(int no) { _fileHandle.read(createResource(6, no, size), size); closeRoom(); } + +} // End of namespace Scumm diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index 1c99d298b8..b8adbc7a8c 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -38,6 +38,8 @@ #include "sound/mixer.h" +namespace Scumm { + struct SaveGameHeader { uint32 type; uint32 size; @@ -957,3 +959,5 @@ void Serializer::loadEntries(void *d, const SaveLoadEntry *sle) { sle++; } } + +} // End of namespace Scumm diff --git a/scumm/saveload.h b/scumm/saveload.h index e6120c6700..dd51192ecf 100644 --- a/scumm/saveload.h +++ b/scumm/saveload.h @@ -24,6 +24,10 @@ #include "common/scummsys.h" +class SaveFile; + +namespace Scumm { + // Support for "old" savegames (made with 2501 CVS build) // Can be useful for other ports too :) @@ -88,8 +92,6 @@ struct SaveLoadEntry { typedef int SerializerSaveReference(void *me, byte type, void *ref); typedef void *SerializerLoadReference(void *me, byte type, int ref); -class SaveFile; - class Serializer { public: Serializer(SaveFile *stream, bool saveOrLoad, uint32 savegameVersion) @@ -132,4 +134,6 @@ protected: void loadEntries(void *d, const SaveLoadEntry *sle); }; +} // End of namespace Scumm + #endif diff --git a/scumm/script.cpp b/scumm/script.cpp index e4b966952e..7293899ced 100644 --- a/scumm/script.cpp +++ b/scumm/script.cpp @@ -29,6 +29,8 @@ #include "scumm/resource.h" #include "scumm/scumm.h" +namespace Scumm { + /* Start executing script 'script' with the given parameters */ void ScummEngine::runScript(int script, bool freezeResistant, bool recursive, int *lvarptr) { ScriptSlot *s; @@ -1162,3 +1164,5 @@ void ScummEngine::endOverride() { if (_version > 3) VAR(VAR_OVERRIDE) = 0; } + +} // End of namespace Scumm diff --git a/scumm/script.h b/scumm/script.h index e1c5fcdb8c..2a4b957a7f 100644 --- a/scumm/script.h +++ b/scumm/script.h @@ -25,6 +25,7 @@ #include "base/engine.h" +namespace Scumm { /* System Wide Constants */ enum { @@ -70,5 +71,6 @@ struct VirtualMachineState { byte numNestedScripts; }; +} // End of namespace Scumm #endif diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp index 6d262b1d0d..2af5817cff 100644 --- a/scumm/script_v2.cpp +++ b/scumm/script_v2.cpp @@ -29,6 +29,8 @@ #include "scumm/sound.h" #include "scumm/verbs.h" +namespace Scumm { + #define OPCODE(x) { &ScummEngine_v2::x, #x } void ScummEngine_v2::setupOpcodes() { @@ -1578,3 +1580,5 @@ void ScummEngine_v2::resetSentence() { VAR(VAR_SENTENCE_OBJECT2) = 0; VAR(VAR_SENTENCE_PREPOSITION) = 0; } + +} // End of namespace Scumm diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp index 6d695c7864..b06830ce08 100644 --- a/scumm/script_v5.cpp +++ b/scumm/script_v5.cpp @@ -29,6 +29,8 @@ #include "scumm/sound.h" #include "scumm/verbs.h" +namespace Scumm { + #define OPCODE(x) { &ScummEngine_v5::x, #x } void ScummEngine_v5::setupOpcodes() { @@ -2929,3 +2931,5 @@ void ScummEngine_v5::o5_pickupObjectOld() { clearDrawObjectQueue(); runInventoryScript(1); } + +} // End of namespace Scumm diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 8ea37363e7..b63ddfc16c 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -40,6 +40,8 @@ #include "scumm/dialogs.h" // FIXME: This is just for the FT-INSANE warning. // Remove when INSANE is implemented +namespace Scumm { + #define OPCODE(x) { &ScummEngine_v6::x, #x } void ScummEngine_v6::setupOpcodes() { @@ -3243,3 +3245,5 @@ void ScummEngine_v6::decodeParseString(int m, int n) { error("decodeParseString: default case 0x%x", b); } } + +} // End of namespace Scumm diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index 1bfb99aa96..74e32e2d45 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -33,6 +33,8 @@ #include "sound/mixer.h" +namespace Scumm { + #define OPCODE(x) { &ScummEngine_v8::x, #x } void ScummEngine_v8::setupOpcodes() { @@ -1607,3 +1609,5 @@ void ScummEngine_v8::o8_drawObject() { putState(obj, state); } + +} // End of namespace Scumm diff --git a/scumm/scumm.h b/scumm/scumm.h index c47e68df5e..56fded1b2b 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -32,16 +32,19 @@ #include "scumm/gfx.h" #include "scumm/script.h" -class Actor; -class BaseCostumeRenderer; -class CharsetRenderer; class ConsoleDialog; class Dialog; class GameDetector; +class NewGui; + +namespace Scumm { + +class Actor; +class BaseCostumeRenderer; +class CharsetRenderer; class IMuse; class IMuseDigital; class MusicEngine; -class NewGui; class ScummEngine; class ScummDebugger; class Serializer; @@ -1212,5 +1215,6 @@ int toSimpleDir(int dirtype, int dir); void checkRange(int max, int min, int no, const char *str); +} // End of namespace Scumm #endif diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 9ffd617b41..24615a69e8 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -63,6 +63,12 @@ extern bool isSmartphone(void); #endif +extern NewGui *g_gui; +extern uint16 _debugLevel; +extern uint16 _demo_mode; + +namespace Scumm { + enum MouseButtonStatus { msDown = 1, msClicked = 2 @@ -72,10 +78,6 @@ enum MouseButtonStatus { ScummEngine *g_scumm = 0; ScummDebugger *g_debugger; -extern NewGui *g_gui; -extern uint16 _debugLevel; -extern uint16 _demo_mode; - static const TargetSettings scumm_settings[] = { /* Scumm Version 1 */ /* Scumm Version 2 */ @@ -266,61 +268,6 @@ static const TargetSettings scumm_settings[] = { {NULL, NULL, 0, 0, MDT_NONE, 0, NULL} }; -const TargetSettings *Engine_SCUMM_targetList() { - return scumm_settings; -} - -Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) { - Engine *engine; - - if (detector->_amiga) - detector->_game.features |= GF_AMIGA; - - switch (detector->_platform) { - case 1: - if (!(detector->_game.features & GF_AMIGA)) - detector->_game.features |= GF_AMIGA; - break; - case 2: - detector->_game.features |= GF_ATARI_ST; - break; - case 3: - detector->_game.features |= GF_MACINTOSH; - break; - } - - switch (detector->_game.version) { - case 1: - case 2: - engine = new ScummEngine_v2(detector, syst); - break; - case 3: - engine = new ScummEngine_v3(detector, syst); - break; - case 4: - engine = new ScummEngine_v4(detector, syst); - break; - case 5: - engine = new ScummEngine_v5(detector, syst); - break; - case 6: - engine = new ScummEngine_v6(detector, syst); - break; - case 7: - engine = new ScummEngine_v7(detector, syst); - break; - case 8: - engine = new ScummEngine_v8(detector, syst); - break; - default: - error("Engine_SCUMM_create(): Unknown version of game engine"); - } - - return engine; -} - -REGISTER_PLUGIN("Scumm Engine", Engine_SCUMM_targetList, Engine_SCUMM_create); - ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst) : Engine(detector, syst), _pauseDialog(0), _optionsDialog(0), _saveLoadDialog(0) { OSystem::Property prop; @@ -2690,3 +2637,62 @@ int normalizeAngle(int angle) { return toSimpleDir(1, temp) * 45; } + +} // End of namespace Scumm + +using namespace Scumm; + +const TargetSettings *Engine_SCUMM_targetList() { + return scumm_settings; +} + +Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) { + Engine *engine; + + if (detector->_amiga) + detector->_game.features |= GF_AMIGA; + + switch (detector->_platform) { + case 1: + if (!(detector->_game.features & GF_AMIGA)) + detector->_game.features |= GF_AMIGA; + break; + case 2: + detector->_game.features |= GF_ATARI_ST; + break; + case 3: + detector->_game.features |= GF_MACINTOSH; + break; + } + + switch (detector->_game.version) { + case 1: + case 2: + engine = new ScummEngine_v2(detector, syst); + break; + case 3: + engine = new ScummEngine_v3(detector, syst); + break; + case 4: + engine = new ScummEngine_v4(detector, syst); + break; + case 5: + engine = new ScummEngine_v5(detector, syst); + break; + case 6: + engine = new ScummEngine_v6(detector, syst); + break; + case 7: + engine = new ScummEngine_v7(detector, syst); + break; + case 8: + engine = new ScummEngine_v8(detector, syst); + break; + default: + error("Engine_SCUMM_create(): Unknown version of game engine"); + } + + return engine; +} + +REGISTER_PLUGIN("Scumm Engine", Engine_SCUMM_targetList, Engine_SCUMM_create); diff --git a/scumm/smush/channel.h b/scumm/smush/channel.h index 6b9390d300..87de082ac8 100644 --- a/scumm/smush/channel.h +++ b/scumm/smush/channel.h @@ -24,6 +24,8 @@ #include "common/util.h" +namespace Scumm { + class Chunk; class ContChunk; @@ -137,4 +139,6 @@ public: virtual int32 getTrackIdentifier() const { return _track; }; }; +} // End of namespace Scumm + #endif diff --git a/scumm/smush/chunk.cpp b/scumm/smush/chunk.cpp index 39cde19048..a03c645b18 100644 --- a/scumm/smush/chunk.cpp +++ b/scumm/smush/chunk.cpp @@ -20,12 +20,14 @@ */ #include "stdafx.h" -#include "chunk.h" +#include "scumm/smush/chunk.h" #include "common/file.h" #include "common/str.h" #include "common/util.h" +namespace Scumm { + class FilePtr : public File { Common::String _filename; int32 _refcount; @@ -253,3 +255,5 @@ uint32 MemoryChunk::getDword() { _curPos += 4; return READ_LE_UINT32(ptr); } + +} // End of namespace Scumm diff --git a/scumm/smush/chunk.h b/scumm/smush/chunk.h index 6b2d2ada98..e45ffe43fd 100644 --- a/scumm/smush/chunk.h +++ b/scumm/smush/chunk.h @@ -24,6 +24,8 @@ #include "common/scummsys.h" +namespace Scumm { + class Chunk { public: virtual ~Chunk() {}; @@ -98,4 +100,6 @@ public: uint32 getDword(); }; +} // End of namespace Scumm + #endif diff --git a/scumm/smush/chunk_type.h b/scumm/smush/chunk_type.h index 669cc6fbcd..d3444beabf 100644 --- a/scumm/smush/chunk_type.h +++ b/scumm/smush/chunk_type.h @@ -23,7 +23,9 @@ #define CHUNK_TYPE_H #include "common/scummsys.h" -#include "chunk.h" +#include "scumm/smush/chunk.h" + +namespace Scumm { static const Chunk::type TYPE_ANIM = 'ANIM'; static const Chunk::type TYPE_AHDR = 'AHDR'; @@ -51,4 +53,6 @@ static const Chunk::type TYPE_MAP_ = 'MAP '; static const Chunk::type TYPE_DATA = 'DATA'; static const Chunk::type TYPE_ETRS = 'ETRS'; +} // End of namespace Scumm + #endif diff --git a/scumm/smush/codec1.cpp b/scumm/smush/codec1.cpp index 5df800b43b..d7ed1e0473 100644 --- a/scumm/smush/codec1.cpp +++ b/scumm/smush/codec1.cpp @@ -22,6 +22,8 @@ #include "stdafx.h" #include "common/scummsys.h" +namespace Scumm { + void smush_decode_codec1(byte *dst, byte *src, int height) { byte val, code; int32 length; @@ -52,3 +54,5 @@ void smush_decode_codec1(byte *dst, byte *src, int height) { } } } + +} // End of namespace Scumm diff --git a/scumm/smush/codec37.cpp b/scumm/smush/codec37.cpp index c2fa816045..0a748036a4 100644 --- a/scumm/smush/codec37.cpp +++ b/scumm/smush/codec37.cpp @@ -24,6 +24,8 @@ #include "scumm/bomp.h" #include "scumm/smush/codec37.h" +namespace Scumm { + void Codec37Decoder::init(int width, int height) { deinit(); _width = width; @@ -512,3 +514,5 @@ void Codec37Decoder::decode(byte *dst, const byte *src) { memcpy(dst, _deltaBufs[_curtable], _frameSize); } +} // End of namespace Scumm + diff --git a/scumm/smush/codec37.h b/scumm/smush/codec37.h index 1031b93044..fc40da4dfc 100644 --- a/scumm/smush/codec37.h +++ b/scumm/smush/codec37.h @@ -24,6 +24,8 @@ #include "common/scummsys.h" +namespace Scumm { + class Codec37Decoder { private: @@ -53,4 +55,6 @@ public: void decode(byte *dst, const byte *src); }; +} // End of namespace Scumm + #endif diff --git a/scumm/smush/codec47.cpp b/scumm/smush/codec47.cpp index 869e156444..5cc6d7e709 100644 --- a/scumm/smush/codec47.cpp +++ b/scumm/smush/codec47.cpp @@ -24,6 +24,8 @@ #include "scumm/bomp.h" #include "scumm/smush/codec47.h" +namespace Scumm { + #if defined(SCUMM_NEED_ALIGNMENT) #define COPY_4X1_LINE(dst, src) \ @@ -627,3 +629,5 @@ _GRELEASEPTR(GBVARS_CODEC47TABLE_INDEX, GBVARS_SCUMM) _GEND #endif + +} // End of namespace Scumm diff --git a/scumm/smush/codec47.h b/scumm/smush/codec47.h index 2af6948602..5dcfdad599 100644 --- a/scumm/smush/codec47.h +++ b/scumm/smush/codec47.h @@ -24,6 +24,8 @@ #include "common/scummsys.h" +namespace Scumm { + class Codec47Decoder { private: @@ -57,4 +59,6 @@ public: bool decode(byte *dst, const byte *src); }; +} // End of namespace Scumm + #endif diff --git a/scumm/smush/imuse_channel.cpp b/scumm/smush/imuse_channel.cpp index 45a475f30a..8b99a44935 100644 --- a/scumm/smush/imuse_channel.cpp +++ b/scumm/smush/imuse_channel.cpp @@ -20,9 +20,11 @@ */ #include "stdafx.h" -#include "channel.h" -#include "chunk.h" -#include "chunk_type.h" +#include "scumm/smush/channel.h" +#include "scumm/smush/chunk.h" +#include "scumm/smush/chunk_type.h" + +namespace Scumm { ImuseChannel::ImuseChannel(int32 track, int32 freq) : _track(track), @@ -349,3 +351,5 @@ void ImuseChannel::getSoundData(int8 *snd, int32 size) { _sbufferSize = 0; _dataSize -= _srbufferSize; } + +} // End of namespace Scumm diff --git a/scumm/smush/saud_channel.cpp b/scumm/smush/saud_channel.cpp index 1c5030974d..c06cee0ce1 100644 --- a/scumm/smush/saud_channel.cpp +++ b/scumm/smush/saud_channel.cpp @@ -21,9 +21,11 @@ #include "stdafx.h" -#include "channel.h" -#include "chunk.h" -#include "chunk_type.h" +#include "scumm/smush/channel.h" +#include "scumm/smush/chunk.h" +#include "scumm/smush/chunk_type.h" + +namespace Scumm { void SaudChannel::handleStrk(Chunk &b) { int32 size = b.getSize(); @@ -266,3 +268,5 @@ void SaudChannel::getSoundData(int16 *snd, int32 size) { _sbuffer = 0; _sbufferSize = 0; } + +} // End of namespace Scumm diff --git a/scumm/smush/smush_font.cpp b/scumm/smush/smush_font.cpp index d983a7d6a9..90a1738fd3 100644 --- a/scumm/smush/smush_font.cpp +++ b/scumm/smush/smush_font.cpp @@ -23,7 +23,9 @@ #include "common/file.h" #include "scumm/scumm.h" -#include "smush_font.h" +#include "scumm/smush/smush_font.h" + +namespace Scumm { SmushFont::SmushFont(bool use_original_colors, bool new_colors) : NutRenderer(g_scumm), // FIXME: evil hack @@ -317,3 +319,5 @@ void SmushFont::drawStringWrapCentered(const char *str, byte *buffer, int dst_wi free(s); } + +} // End of namespace Scumm diff --git a/scumm/smush/smush_font.h b/scumm/smush/smush_font.h index 3b0925361a..7d7337f775 100644 --- a/scumm/smush/smush_font.h +++ b/scumm/smush/smush_font.h @@ -25,6 +25,8 @@ #include "common/scummsys.h" #include "scumm/nut_renderer.h" +namespace Scumm { + class SmushFont : public NutRenderer { protected: int _nbChars; @@ -49,4 +51,6 @@ public: void drawStringWrapCentered(const char *str, byte *buffer, int dst_width, int dst_height, int x, int y, int left, int right); }; +} // End of namespace Scumm + #endif diff --git a/scumm/smush/smush_mixer.cpp b/scumm/smush/smush_mixer.cpp index a20b5e68a3..ad14292f39 100644 --- a/scumm/smush/smush_mixer.cpp +++ b/scumm/smush/smush_mixer.cpp @@ -21,13 +21,18 @@ #include "stdafx.h" #include "common/util.h" -#include "smush_mixer.h" -#include "channel.h" -#include "sound/mixer.h" + +#include "scumm/smush/smush_mixer.h" +#include "scumm/smush/channel.h" #include "scumm/scumm.h" #include "scumm/sound.h" #include "scumm/imuse.h" +#include "sound/mixer.h" + + +namespace Scumm { + SmushMixer::SmushMixer(SoundMixer *m) : _mixer(m), _nextIndex(0), @@ -158,3 +163,5 @@ bool SmushMixer::stop() { } return true; } + +} // End of namespace Scumm diff --git a/scumm/smush/smush_mixer.h b/scumm/smush/smush_mixer.h index 5fb63381bf..8184985257 100644 --- a/scumm/smush/smush_mixer.h +++ b/scumm/smush/smush_mixer.h @@ -19,10 +19,14 @@ * */ -#include "stdafx.h" +#ifndef SMUSH_MIXER_H +#define SMUSH_MIXER_H +#include "stdafx.h" #include "sound/mixer.h" +namespace Scumm { + class SmushChannel; class SmushMixer { @@ -49,3 +53,7 @@ public: bool update(); bool _silentMixer; }; + +} // End of namespace Scumm + +#endif diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index 0b23287cfe..161c6ff3cd 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -20,28 +20,33 @@ */ #include "stdafx.h" -#include "scumm/scumm.h" -#include "scumm/bomp.h" -#include "scumm/sound.h" -#include "scumm/imuse.h" -#include "scumm/imuse_digi.h" -#include "sound/mixer.h" -#include "smush_player.h" -#include "smush_mixer.h" -#include "smush_font.h" -#include "channel.h" -#include "chunk.h" -#include "chunk_type.h" #include "base/engine.h" + #include "common/file.h" #include "common/util.h" #include "common/timer.h" +#include "scumm/bomp.h" +#include "scumm/imuse_digi.h" +#include "scumm/imuse.h" +#include "scumm/scumm.h" +#include "scumm/sound.h" +#include "scumm/smush/channel.h" +#include "scumm/smush/chunk_type.h" +#include "scumm/smush/chunk.h" +#include "scumm/smush/smush_font.h" +#include "scumm/smush/smush_mixer.h" +#include "scumm/smush/smush_player.h" + +#include "sound/mixer.h" + #ifdef DUMP_SMUSH_FRAMES #include <png.h> #endif +namespace Scumm { + const int MAX_STRINGS = 200; class StringResource { @@ -982,3 +987,5 @@ void SmushPlayer::play(const char *filename, const char *directory) { // Reset mouse state _scumm->_system->show_mouse(oldMouseState); } + +} // End of namespace Scumm diff --git a/scumm/smush/smush_player.h b/scumm/smush/smush_player.h index 42275bfa90..e4c0218a66 100644 --- a/scumm/smush/smush_player.h +++ b/scumm/smush/smush_player.h @@ -28,6 +28,8 @@ #include "scumm/smush/codec47.h" #include "sound/mixer.h" +namespace Scumm { + class SmushFont; class SmushMixer; class StringResource; @@ -102,4 +104,6 @@ private: static void timerCallback(void *ptr); }; +} // End of namespace Scumm + #endif diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 7e91ba76bf..00b4e6d3cc 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -21,12 +21,12 @@ */ #include "stdafx.h" -#include "actor.h" -#include "bundle.h" -#include "imuse.h" -#include "imuse_digi.h" -#include "scumm.h" -#include "sound.h" +#include "scumm/actor.h" +#include "scumm/bundle.h" +#include "scumm/imuse.h" +#include "scumm/imuse_digi.h" +#include "scumm/scumm.h" +#include "scumm/sound.h" #include "common/config-file.h" #include "common/timer.h" @@ -38,6 +38,8 @@ #include "sound/voc.h" +namespace Scumm { + enum { SOUND_HEADER_SIZE = 26, SOUND_HEADER_BIG_SIZE = 26 + 8 @@ -1701,3 +1703,5 @@ VorbisTrackInfo::~VorbisTrackInfo() { } #endif + +} // End of namespace Scumm diff --git a/scumm/sound.h b/scumm/sound.h index 45e117872b..c9798d2df5 100644 --- a/scumm/sound.h +++ b/scumm/sound.h @@ -24,9 +24,12 @@ #include "common/scummsys.h" #include "sound/mixer.h" +class File; + +namespace Scumm { + class Bundle; class DigitalTrackInfo; -class File; class ScummEngine; struct MP3OffsetTable; @@ -156,5 +159,7 @@ protected: int getCachedTrack(int track); }; +} // End of namespace Scumm + #endif diff --git a/scumm/string.cpp b/scumm/string.cpp index c9183e938a..21db644efc 100644 --- a/scumm/string.cpp +++ b/scumm/string.cpp @@ -21,13 +21,15 @@ */ #include "stdafx.h" -#include "scumm.h" -#include "actor.h" -#include "charset.h" -#include "dialogs.h" -#include "verbs.h" +#include "scumm/scumm.h" +#include "scumm/actor.h" +#include "scumm/charset.h" +#include "scumm/dialogs.h" +#include "scumm/verbs.h" #include "scumm/sound.h" +namespace Scumm { + void ScummEngine::setStringVars(int slot) { StringTab *st = &_string[slot]; st->xpos = st->t_xpos; @@ -947,3 +949,4 @@ void ScummEngine::translateText(const byte *text, byte *trans_buff) { } } +} // End of namespace Scumm diff --git a/scumm/usage_bits.cpp b/scumm/usage_bits.cpp index 3e09f0f98e..0646f61785 100644 --- a/scumm/usage_bits.cpp +++ b/scumm/usage_bits.cpp @@ -17,8 +17,10 @@ */ #include "stdafx.h" -#include "scumm.h" -#include "usage_bits.h" +#include "scumm/scumm.h" +#include "scumm/usage_bits.h" + +namespace Scumm { void ScummEngine::upgradeGfxUsageBits() { int i; @@ -80,3 +82,5 @@ bool ScummEngine::testGfxOtherUsageBits(int strip, int bit) { return false; } + +} // End of namespace Scumm diff --git a/scumm/usage_bits.h b/scumm/usage_bits.h index fcb4d59769..acad8ae1f0 100644 --- a/scumm/usage_bits.h +++ b/scumm/usage_bits.h @@ -19,9 +19,13 @@ #ifndef USAGE_BITS_H #define USAGE_BITS_H +namespace Scumm { + enum { USAGE_BIT_DIRTY = 96, USAGE_BIT_RESTORED = 95 }; +} // End of namespace Scumm + #endif diff --git a/scumm/vars.cpp b/scumm/vars.cpp index 834951d561..0eb8a823c8 100644 --- a/scumm/vars.cpp +++ b/scumm/vars.cpp @@ -22,8 +22,10 @@ #include "stdafx.h" -#include "scumm.h" -#include "intern.h" +#include "scumm/scumm.h" +#include "scumm/intern.h" + +namespace Scumm { void ScummEngine::setupScummVars() { VAR_KEYPRESS = 0; @@ -324,3 +326,5 @@ void ScummEngine_v8::setupScummVars() { VAR_CHARINC = 221; } + +} // End of namespace Scumm diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp index 42bf9befa8..756f17c57f 100644 --- a/scumm/verbs.cpp +++ b/scumm/verbs.cpp @@ -21,11 +21,13 @@ */ #include "stdafx.h" -#include "charset.h" -#include "object.h" -#include "resource.h" -#include "scumm.h" -#include "verbs.h" +#include "scumm/charset.h" +#include "scumm/object.h" +#include "scumm/resource.h" +#include "scumm/scumm.h" +#include "scumm/verbs.h" + +namespace Scumm { enum { kInventoryUpArrow = 4, @@ -578,3 +580,5 @@ void ScummEngine::setVerbObject(uint room, uint object, uint verb) { memcpy(getResourceAddress(rtVerb, verb), obimptr, size); } } + +} // End of namespace Scumm diff --git a/scumm/verbs.h b/scumm/verbs.h index 1cbaa2d459..cea7300390 100644 --- a/scumm/verbs.h +++ b/scumm/verbs.h @@ -24,6 +24,8 @@ #include "common/scummsys.h" #include "common/rect.h" +namespace Scumm { + enum { kTextVerbType = 0, kImageVerbType = 1 @@ -43,4 +45,6 @@ struct VerbSlot { uint16 imgindex; }; +} // End of namespace Scumm + #endif |