From 4b850a2c0357aa2d94cfc2fcf5d05ed0903278e5 Mon Sep 17 00:00:00 2001 From: Lars Persson Date: Wed, 1 Jul 2009 20:02:33 +0000 Subject: Move action inits to engineInit and engineDone callbacks. svn-id: r42007 --- backends/platform/symbian/src/SymbianActions.cpp | 7 +++++++ backends/platform/symbian/src/SymbianOS.cpp | 10 +++++++++- backends/platform/symbian/src/SymbianOS.h | 12 ++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/backends/platform/symbian/src/SymbianActions.cpp b/backends/platform/symbian/src/SymbianActions.cpp index c45cef32bd..995b03f200 100644 --- a/backends/platform/symbian/src/SymbianActions.cpp +++ b/backends/platform/symbian/src/SymbianActions.cpp @@ -102,8 +102,15 @@ SymbianActions::SymbianActions() } void SymbianActions::initInstanceMain(OSystem *mainSystem) { + int i; + Actions::initInstanceMain(mainSystem); + // Disable all mappings before setting main mappings again + for (i = 0; i < ACTION_LAST; i++) { + _action_enabled[i] = false; + } + // Mouse Up _action_enabled[ACTION_UP] = true; diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp index 6a8a46df07..7af1cade8c 100644 --- a/backends/platform/symbian/src/SymbianOS.cpp +++ b/backends/platform/symbian/src/SymbianOS.cpp @@ -471,8 +471,16 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Common::Event &event) { void OSystem_SDL_Symbian::setWindowCaption(const char *caption) { OSystem_SDL::setWindowCaption(caption); +} + +void OSystem_SDL_Symbian::engineInit() { + // Check mappings for the engine just started check_mappings(); -FIXME: move check_mappings() call to engineInit() & engineDone() +} + +void OSystem_SDL_Symbian::engineDone() { + // Need to reset engine to basic state after an engine has been running + GUI::Actions::Instance()->initInstanceMain(this); } void OSystem_SDL_Symbian::check_mappings() { diff --git a/backends/platform/symbian/src/SymbianOS.h b/backends/platform/symbian/src/SymbianOS.h index efca94b706..b873b503be 100644 --- a/backends/platform/symbian/src/SymbianOS.h +++ b/backends/platform/symbian/src/SymbianOS.h @@ -107,6 +107,18 @@ protected: void setWindowCaption(const char *caption); + /** + * Allows the backend to perform engine specific init. + * Called just before the engine is run. + */ + virtual void engineInit(); + + /** + * Allows the backend to perform engine specific de-init. + * Called after the engine finishes. + */ + virtual void engineDone(); + // // Used to intialized special game mappings // -- cgit v1.2.3 From 62acda5fdbe0daaeae9e1d0f08044b8be4ee98cf Mon Sep 17 00:00:00 2001 From: Lars Persson Date: Wed, 1 Jul 2009 20:11:44 +0000 Subject: Use MIN with correct template parameter. svn-id: r42008 --- engines/gob/inter_v1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp index d5d5fcad9a..96ecfc6b25 100644 --- a/engines/gob/inter_v1.cpp +++ b/engines/gob/inter_v1.cpp @@ -1095,7 +1095,7 @@ bool Inter_v1::o1_palLoad(OpFuncParams ¶ms) { if (!resource) break; - memcpy((char *) _vm->_draw->_vgaPalette, resource->getData(), MIN(768, resource->getSize())); + memcpy((char *) _vm->_draw->_vgaPalette, resource->getData(), MIN(768, resource->getSize())); delete resource; break; -- cgit v1.2.3 From a6b57dc3a986f749ca8f915b461b184d48390757 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 1 Jul 2009 20:51:04 +0000 Subject: - Added GCC_PRINTF attribute to several funcs where it makes sense - change some constants from double to float, to avoid "loss of precision due to implicit conversion" warnings - removed duplicate prototypes for some funcs - fixed some "increases required alignment of target type" warnings svn-id: r42009 --- Makefile | 7 +++++++ engines/agi/agi.h | 2 +- engines/agos/agos.h | 2 +- engines/agos/vga_ff.cpp | 2 +- engines/cine/texte.cpp | 2 -- engines/cine/various.h | 2 -- engines/cruise/cruise_main.h | 2 -- engines/igor/igor.cpp | 2 +- engines/igor/staticres.cpp | 10 +++++----- engines/kyra/gui.h | 2 +- engines/sci/gfx/operations.cpp | 6 +++--- engines/sci/sfx/softseq/adlib.cpp | 2 +- engines/scumm/boxes.cpp | 4 ++-- engines/scumm/gfx.cpp | 8 ++++---- engines/sword2/screen.h | 4 ++-- engines/tinsel/actors.h | 4 ---- engines/tinsel/pdisplay.cpp | 8 -------- engines/tinsel/polygons.h | 6 +----- engines/tinsel/tinlib.cpp | 3 --- engines/tinsel/tinsel.cpp | 4 ---- gui/debugger.cpp | 2 +- sound/softsynth/mt32/partial.cpp | 22 +++++++++++----------- sound/softsynth/mt32/synth.cpp | 6 +++--- sound/softsynth/mt32/synth.h | 4 ++-- sound/softsynth/mt32/tables.cpp | 8 ++++---- sound/vorbis.cpp | 2 +- 26 files changed, 52 insertions(+), 74 deletions(-) diff --git a/Makefile b/Makefile index 99accca5fc..a72e76619d 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,13 @@ CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder # Enable even more warnings... CXXFLAGS+= -Wpointer-arith -Wcast-qual -Wcast-align CXXFLAGS+= -Wshadow -Wimplicit -Wnon-virtual-dtor -Wwrite-strings +# TODO: Consider using -Wold-style-cast at some point +# CXXFLAGS+= -Wno-sign-compare +#CXXFLAGS+= -Wextra +CXXFLAGS+= -Wmissing-format-attribute +CXXFLAGS+= -Wredundant-decls +CXXFLAGS+= -Wconversion +#CXXFLAGS+= -Wshorten-64-to-32 # Disable RTTI and exceptions, and enabled checking of pointers returned by "new" CXXFLAGS+= -fno-rtti -fno-exceptions -fcheck-new diff --git a/engines/agi/agi.h b/engines/agi/agi.h index 7cf89fa592..14e1fd448b 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -993,7 +993,7 @@ public: bool predictiveDialog(void); private: - void printStatus(const char *message, ...); + void printStatus(const char *message, ...) GCC_PRINTF(2, 3); void printText2(int l, const char *msg, int foff, int xoff, int yoff, int len, int fg, int bg, bool checkerboard = false); void blitTextbox(const char *p, int y, int x, int len); void eraseTextbox(); diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 405ee3622c..3720e35d3d 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -1977,7 +1977,7 @@ protected: virtual void printScreenText(uint vgaSpriteId, uint color, const char *stringPtr, int16 x, int16 y, int16 width); void printInteractText(uint16 num, const char *string); - void sendInteractText(uint16 num, const char *fmt, ...); + void sendInteractText(uint16 num, const char *fmt, ...) GCC_PRINTF(3, 4); void checkLinkBox(); void hyperLinkOn(uint16 x); diff --git a/engines/agos/vga_ff.cpp b/engines/agos/vga_ff.cpp index 58eb2f4cc0..14451a3dbe 100644 --- a/engines/agos/vga_ff.cpp +++ b/engines/agos/vga_ff.cpp @@ -70,7 +70,7 @@ int AGOSEngine::getScale(int16 y, int16 x) { void AGOSEngine::vc75_setScale() { _baseY = vcReadNextWord(); - _scale = (float)vcReadNextWord() / 1000000.; + _scale = vcReadNextWord() / 1000000.0f; } void AGOSEngine::vc76_setScaleXOffs() { diff --git a/engines/cine/texte.cpp b/engines/cine/texte.cpp index ffc36b4b1a..3dceae2fa4 100644 --- a/engines/cine/texte.cpp +++ b/engines/cine/texte.cpp @@ -37,8 +37,6 @@ const char **otherMessages; const char *defaultCommandPreposition; const char **commandPrepositionTable; -void generateMask(const byte *sprite, byte *mask, uint16 size, byte transparency); - /*! \brief Loads font data from the given file. * The number of characters used in the font varies between game versions: * 78 (Most PC, Amiga and Atari ST versions of Future Wars, but also Operation Stealth's Amiga demo), diff --git a/engines/cine/various.h b/engines/cine/various.h index bdbbc6fb86..1f9aa7dc78 100644 --- a/engines/cine/various.h +++ b/engines/cine/various.h @@ -80,8 +80,6 @@ extern int16 commandVar3[4]; extern char currentDatName[30]; extern uint16 musicIsPlaying; -void setTextWindow(uint16 param1, uint16 param2, uint16 param3, uint16 param4); - extern uint16 errorVar; extern byte menuVar; diff --git a/engines/cruise/cruise_main.h b/engines/cruise/cruise_main.h index 86e8dc1591..d2e9350d70 100644 --- a/engines/cruise/cruise_main.h +++ b/engines/cruise/cruise_main.h @@ -96,7 +96,6 @@ void *mallocAndZero(int32 size); uint8 *mainProc14(uint16 overlay, uint16 idx); void printInfoBlackBox(const char *string); void waitForPlayerInput(void); -int initCt(const char * ctpName); void loadPackedFileToMem(int fileIdx, uint8 * buffer); int getNumObjectsByClass(int scriptIdx, int param); void resetFileEntryRange(int param1, int param2); @@ -108,7 +107,6 @@ void resetPtr2(scriptInstanceStruct * ptr); void getFileExtention(const char *name, char *buffer); void *allocAndZero(int size); void freeStuff2(void); -const char *getObjectName(int index, const char * string); void mainLoop(void); void getMouseStatus(int16 *pMouseVar, int16 *pMouseX, int16 *pMouseButton, int16 *pMouseY); bool testMask(int x, int y, unsigned char* pData, int stride); diff --git a/engines/igor/igor.cpp b/engines/igor/igor.cpp index 0581f6ddc3..6cf7bda33d 100644 --- a/engines/igor/igor.cpp +++ b/engines/igor/igor.cpp @@ -2095,7 +2095,7 @@ int IgorEngine::getHorizontalStepsCount(int minX, int minY, int maxX, int maxY) float r2 = _walkScaleSpeedTable[scale - 1]; debugC(9, kDebugWalk, "getHorizontalStepsCount() maxX - minX = %d r1 = %f r2 = %f", maxX - minX, r1, r2); - int16 steps = roundReal((maxX - minX) / ((r1 + r2) / 2.)); + int16 steps = roundReal((maxX - minX) / ((r1 + r2) / 2.0f)); int count = 0; if (steps != 0) { float r3 = (maxY - minY) / (float)steps; diff --git a/engines/igor/staticres.cpp b/engines/igor/staticres.cpp index e5df644c5e..ef19d7033f 100644 --- a/engines/igor/staticres.cpp +++ b/engines/igor/staticres.cpp @@ -230,11 +230,11 @@ const uint8 IgorEngine::_walkWidthScaleTable[] = { }; const float IgorEngine::_walkScaleSpeedTable[] = { - 0.6250, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.1250, 1.3750, 1.6250, 1.6250, - 1.6250, 1.6250, 2.0000, 2.1250, 2.3750, 2.3750, 2.6250, 2.6250, 2.7500, 2.7500, - 2.7500, 3.0000, 3.0000, 3.0000, 3.0000, 3.6250, 3.6250, 3.6250, 3.8750, 3.8750, - 3.8750, 4.0000, 4.0000, 4.3750, 4.3750, 4.6250, 4.6250, 5.0000, 5.0000, 5.0000, - 5.0000, 5.2500, 5.5000, 5.6250, 5.6250, 5.6250, 5.6250, 5.6250, 5.6250, 5.6250 + 0.6250f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.1250f, 1.3750f, 1.6250f, 1.6250f, + 1.6250f, 1.6250f, 2.0000f, 2.1250f, 2.3750f, 2.3750f, 2.6250f, 2.6250f, 2.7500f, 2.7500f, + 2.7500f, 3.0000f, 3.0000f, 3.0000f, 3.0000f, 3.6250f, 3.6250f, 3.6250f, 3.8750f, 3.8750f, + 3.8750f, 4.0000f, 4.0000f, 4.3750f, 4.3750f, 4.6250f, 4.6250f, 5.0000f, 5.0000f, 5.0000f, + 5.0000f, 5.2500f, 5.5000f, 5.6250f, 5.6250f, 5.6250f, 5.6250f, 5.6250f, 5.6250f, 5.6250f }; const uint8 IgorEngine::_walkScaleTable[] = { diff --git a/engines/kyra/gui.h b/engines/kyra/gui.h index 3989062506..95df656977 100644 --- a/engines/kyra/gui.h +++ b/engines/kyra/gui.h @@ -260,7 +260,7 @@ private: void drawBox(int x, int y, int w, int h, int fill); bool getInput(); - void printString(const char *string, int x, int y, int col1, int col2, int flags, ...); + void printString(const char *string, int x, int y, int col1, int col2, int flags, ...) GCC_PRINTF(2, 8); }; } // end of namesapce Kyra diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index 613e5de1b1..7496c55868 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -662,7 +662,7 @@ static int line_clip(rect_t *line, rect_t clip, int xfact, int yfact) { return line_check_bar(&(line->x), &(line->width), clip.x, clip.width); } else { // "normal" line - float start = 0.0, end = 1.0; + float start = 0.0f, end = 1.0f; float xv = (float)line->width; float yv = (float)line->height; @@ -682,7 +682,7 @@ static int line_clip(rect_t *line, rect_t clip, int xfact, int yfact) { line->width = (int)(xv * (end - start)); line->height = (int)(yv * (end - start)); - return (start > 1.0 || end < 0.0); + return (start > 1.0f || end < 0.0f); } } @@ -902,7 +902,7 @@ int gfxop_draw_rectangle(GfxState *state, rect_t rect, gfx_color_t color, gfx_li int gfxop_draw_box(GfxState *state, rect_t box, gfx_color_t color1, gfx_color_t color2, gfx_box_shade_t shade_type) { GfxDriver *drv = state->driver; int reverse = 0; // switch color1 and color2 - float mod_offset = 0.0, mod_breadth = 1.0; // 0.0 to 1.0: Color adjustment + float mod_offset = 0.0f, mod_breadth = 1.0f; // 0.0 to 1.0: Color adjustment gfx_rectangle_fill_t driver_shade_type; rect_t new_box; diff --git a/engines/sci/sfx/softseq/adlib.cpp b/engines/sci/sfx/softseq/adlib.cpp index 0bb13e120c..41c7c63fc9 100644 --- a/engines/sci/sfx/softseq/adlib.cpp +++ b/engines/sci/sfx/softseq/adlib.cpp @@ -482,7 +482,7 @@ void MidiDriver_Adlib::setNote(int voice, int note, bool key) { if (bend < 8192) bend = 8192 - bend; - delta = pow(2.0, (float)(bend % 8192) / 8192.0); + delta = (float)pow(2.0, (bend % 8192) / 8192.0); if (bend > 8192) fre = (int)(ym3812_note[n] * delta); diff --git a/engines/scumm/boxes.cpp b/engines/scumm/boxes.cpp index f1429d4261..472e04b5f3 100644 --- a/engines/scumm/boxes.cpp +++ b/engines/scumm/boxes.cpp @@ -369,7 +369,7 @@ void ScummEngine::convertScaleTableToScaleSlot(int slot) { */ // Search for the bend on the left side - m = (resptr[199] - resptr[0]) / 199.0; + m = (resptr[199] - resptr[0]) / 199.0f; for (lowerIdx = 0; lowerIdx < 199 && (resptr[lowerIdx] == 1 || resptr[lowerIdx] == 255); lowerIdx++) { oldM = m; m = (resptr[199] - resptr[lowerIdx+1]) / (float)(199 - (lowerIdx+1)); @@ -383,7 +383,7 @@ void ScummEngine::convertScaleTableToScaleSlot(int slot) { } // Search for the bend on the right side - m = (resptr[199] - resptr[0]) / 199.0; + m = (resptr[199] - resptr[0]) / 199.0f; for (upperIdx = 199; upperIdx > 1 && (resptr[upperIdx] == 1 || resptr[upperIdx] == 255); upperIdx--) { oldM = m; m = (resptr[upperIdx-1] - resptr[0]) / (float)(upperIdx-1); diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 62e18561d3..07640ca551 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -574,13 +574,13 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i if (width <= 0 || height <= 0) return; - const byte *src = vs->getPixels(x, top); + const void *src = vs->getPixels(x, top); int m = _textSurfaceMultiplier; int vsPitch; int pitch = vs->pitch; if (_useCJKMode && _textSurfaceMultiplier == 2) { - scale2x(_fmtownsBuf, _screenWidth * m, src, vs->pitch, width, height); + scale2x(_fmtownsBuf, _screenWidth * m, (const byte *)src, vs->pitch, width, height); src = _fmtownsBuf; vsPitch = _screenWidth * m - width * m; @@ -599,7 +599,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i // Compute pointer to the text surface assert(_compositeBuf); - const byte *text = (byte *)_textSurface.getBasePtr(x * m, y * m); + const void *text = _textSurface.getBasePtr(x * m, y * m); // The values x, width, etc. are all multiples of 8 at this point, // so loop unrolloing might be a good idea... @@ -677,7 +677,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i } // Finally blit the whole thing to the screen - _system->copyRectToScreen(src, pitch, x, y, width, height); + _system->copyRectToScreen((const byte *)src, pitch, x, y, width, height); } // CGA diff --git a/engines/sword2/screen.h b/engines/sword2/screen.h index 2f72b75980..166245c6ef 100644 --- a/engines/sword2/screen.h +++ b/engines/sword2/screen.h @@ -423,8 +423,8 @@ public: void setPalette(int16 startEntry, int16 noEntries, byte *palette, uint8 setNow); void setSystemPalette(const byte *colors, uint start, uint num); uint8 quickMatch(uint8 r, uint8 g, uint8 b); - int32 fadeUp(float time = 0.75); - int32 fadeDown(float time = 0.75); + int32 fadeUp(float time = 0.75f); + int32 fadeDown(float time = 0.75f); uint8 getFadeStatus(); void dimPalette(bool dim); void waitForFade(); diff --git a/engines/tinsel/actors.h b/engines/tinsel/actors.h index 74a5ba4185..bda0e8bbb3 100644 --- a/engines/tinsel/actors.h +++ b/engines/tinsel/actors.h @@ -137,8 +137,6 @@ int GetActorFilmNumber(int ano); void StoreActorReel(int actor, int column, OBJECT *pObj); void NotPlayingReel(int actor, int filmNumber, int column); bool ActorReelPlaying(int actor, int column); -void SetActorPlayFilm(int ano, SCNHANDLE hFilm); -SCNHANDLE GetActorPlayFilm(int ano); /*----------------------------------------------------------------------*/ @@ -161,8 +159,6 @@ struct Z_POSITIONS { int z; }; -int SaveActors(SAVED_ACTOR *sActorInfo); - void RestoreActorProcess(int id, INT_CONTEXT *pic); int SaveActors(PSAVED_ACTOR sActorInfo); diff --git a/engines/tinsel/pdisplay.cpp b/engines/tinsel/pdisplay.cpp index e0262839a2..17e9a3a517 100644 --- a/engines/tinsel/pdisplay.cpp +++ b/engines/tinsel/pdisplay.cpp @@ -55,14 +55,6 @@ extern int newestString; // The overrun counter, in STRRES.C #endif -//----------------- EXTERNAL FUNCTIONS --------------------- - -// in BG.C -extern int BgWidth(void); -extern int BgHeight(void); - - - //----------------- LOCAL DEFINES -------------------- #define LPOSX 295 // X-co-ord of lead actor's position display diff --git a/engines/tinsel/polygons.h b/engines/tinsel/polygons.h index 62ec0422c6..7cb22a1b8a 100644 --- a/engines/tinsel/polygons.h +++ b/engines/tinsel/polygons.h @@ -92,7 +92,6 @@ bool IsPolyCorner(HPOLYGON hPath, int x, int y); int GetScale(HPOLYGON path, int y); int GetBrightness(HPOLYGON hPath, int y); void getNpathNode(HPOLYGON npath, int node, int *px, int *py); -void GetTagTag(HPOLYGON p, SCNHANDLE *hTagText, int *tagx, int *tagy); SCNHANDLE GetPolyFilm(HPOLYGON p); void GetPolyNode(HPOLYGON hp, int *pNodeX, int *pNodeY); SCNHANDLE GetPolyScript(HPOLYGON p); @@ -108,8 +107,6 @@ void DisablePath(int path); void EnablePath(int path); void DisableRefer(int refer); void EnableRefer(int refer); -void DisableBlock(int blockno); -void EnableBlock(int blockno); HPOLYGON GetTagHandle(int tagno); void DisableTag(CORO_PARAM, int tag); void EnableTag(CORO_PARAM, int tag); @@ -152,8 +149,7 @@ bool PolyTagIsWanted(HPOLYGON hp); bool PolyTagFollowsCursor(HPOLYGON hp); SCNHANDLE GetPolyTagHandle(HPOLYGON hp); bool IsTagPolygon(int tagno); -int GetTagPolyId(HPOLYGON hp); -void GetPolyMidBottom( HPOLYGON hp, int *pX, int *pY); +void GetPolyMidBottom(HPOLYGON hp, int *pX, int *pY); int PathCount(void); void MovePolygon(PTYPE ptype, int id, int x, int y); void MovePolygonTo(PTYPE ptype, int id, int x, int y); diff --git a/engines/tinsel/tinlib.cpp b/engines/tinsel/tinlib.cpp index b73a66b6d3..4b5e0ce450 100644 --- a/engines/tinsel/tinlib.cpp +++ b/engines/tinsel/tinlib.cpp @@ -89,8 +89,6 @@ int clRunMode = 0; // in BG.CPP extern void ChangePalette(SCNHANDLE hPal); -extern int BgWidth(void); -extern int BgHeight(void); // in BMV.CPP void PlayBMV(CORO_PARAM, SCNHANDLE hFileStem, int myEscape); @@ -278,7 +276,6 @@ static COLORREF s_talkfontColor = 0; //----------------- FORWARD REFERENCES -------------------- static int HeldObject(void); -void Offset(EXTREME extreme, int x, int y); static void PostTag(CORO_PARAM, int tagno, TINSEL_EVENT event, HPOLYGON hp, int myEscape); void ResetIdleTime(void); static void SendTag(CORO_PARAM, int tagno, TINSEL_EVENT event, HPOLYGON hp, int myEscape, bool *result); diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp index 1a08fd2420..95541e3287 100644 --- a/engines/tinsel/tinsel.cpp +++ b/engines/tinsel/tinsel.cpp @@ -93,10 +93,6 @@ extern void InventoryProcess(CORO_PARAM, const void *); extern void PrimeBackground(); extern SCNHANDLE GetSceneHandle(void); -// In TIMER.CPP -extern void FettleTimers(void); -extern void RebootTimers(void); - //----------------- FORWARD DECLARATIONS --------------------- void SetNewScene(SCNHANDLE scene, int entrance, int transition); diff --git a/gui/debugger.cpp b/gui/debugger.cpp index c32b68f3de..181403484b 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -39,7 +39,7 @@ Debugger::Debugger() { _isAttached = false; _errStr = NULL; _firstTime = true; - _debuggerDialog = new GUI::ConsoleDialog(1.0, 0.67F); + _debuggerDialog = new GUI::ConsoleDialog(1.0f, 0.67f); _debuggerDialog->setInputCallback(debuggerInputCallback, this); _debuggerDialog->setCompletionCallback(debuggerCompletionCallback, this); diff --git a/sound/softsynth/mt32/partial.cpp b/sound/softsynth/mt32/partial.cpp index 02610798dc..871eff03d2 100644 --- a/sound/softsynth/mt32/partial.cpp +++ b/sound/softsynth/mt32/partial.cpp @@ -35,9 +35,9 @@ // powf, resulting in a linker error because of multiple definitions. // Hence we re-define them here. The only potential drawback is that it // might be a little bit slower this way. -#define powf pow -#define floorf floor -#define fabsf fabs +#define powf(x,y) ((float)pow(x,y)) +#define floorf(x) ((float)floorf(x)) +#define fabsf(x) ((float)fabs(x)) #endif #define FIXEDPOINT_UDIV(x, y, point) (((x) << (point)) / ((y))) @@ -504,10 +504,10 @@ Bit16s *Partial::mixBuffersRingMix(Bit16s * buf1, Bit16s *buf2, int len) { a = ((float)*buf1) / 8192.0f; b = ((float)*buf2) / 8192.0f; a = (a * b) + a; - if (a>1.0) - a = 1.0; - if (a<-1.0) - a = -1.0; + if (a > 1.0f) + a = 1.0f; + if (a < -1.0f) + a = -1.0f; *buf1 = (Bit16s)(a * 8192.0f); buf1++; buf2++; @@ -537,10 +537,10 @@ Bit16s *Partial::mixBuffersRing(Bit16s * buf1, Bit16s *buf2, int len) { a = ((float)*buf1) / 8192.0f; b = ((float)*buf2) / 8192.0f; a *= b; - if (a>1.0) - a = 1.0; - if (a<-1.0) - a = -1.0; + if (a > 1.0f) + a = 1.0f; + if (a < -1.0f) + a = -1.0f; *buf1 = (Bit16s)(a * 8192.0f); buf1++; buf2++; diff --git a/sound/softsynth/mt32/synth.cpp b/sound/softsynth/mt32/synth.cpp index bedae241b3..547b2bb9b3 100644 --- a/sound/softsynth/mt32/synth.cpp +++ b/sound/softsynth/mt32/synth.cpp @@ -35,9 +35,9 @@ // powf, resulting in a linker error because of multiple definitions. // Hence we re-define them here. The only potential drawback is that it // might be a little bit slower this way. -#define powf pow -#define floorf floor -#define fabsf fabs +#define powf(x,y) ((float)pow(x,y)) +#define floorf(x) ((float)floorf(x)) +#define fabsf(x) ((float)fabs(x)) #endif namespace MT32Emu { diff --git a/sound/softsynth/mt32/synth.h b/sound/softsynth/mt32/synth.h index 9d57c8d3cd..3fc303d322 100644 --- a/sound/softsynth/mt32/synth.h +++ b/sound/softsynth/mt32/synth.h @@ -22,7 +22,7 @@ #ifndef MT32EMU_SYNTH_H #define MT32EMU_SYNTH_H -#include +#include "common/scummsys.h" class revmodel; @@ -256,7 +256,7 @@ protected: int report(ReportType type, const void *reportData); File *openFile(const char *filename, File::OpenMode mode); void closeFile(File *file); - void printDebug(const char *fmt, ...); + void printDebug(const char *fmt, ...) GCC_PRINTF(2, 3); public: static Bit8u calcSysexChecksum(const Bit8u *data, Bit32u len, Bit8u checksum); diff --git a/sound/softsynth/mt32/tables.cpp b/sound/softsynth/mt32/tables.cpp index bf35db776a..16fc4f71e5 100644 --- a/sound/softsynth/mt32/tables.cpp +++ b/sound/softsynth/mt32/tables.cpp @@ -35,9 +35,9 @@ // powf, resulting in a linker error because of multiple definitions. // Hence we re-define them here. The only potential drawback is that it // might be a little bit slower this way. -#define powf pow -#define floorf floor -#define fabsf fabs +#define powf(x,y) ((float)pow(x,y)) +#define floorf(x) ((float)floorf(x)) +#define fabsf(x) ((float)fabs(x)) #endif #define FIXEDPOINT_MAKE(x, point) ((Bit32u)((1 << point) * x)) @@ -730,7 +730,7 @@ Tables::Tables() { bool Tables::init(Synth *synth, PCMWaveEntry *pcmWaves, float sampleRate, float masterTune) { if (sampleRate <= 0.0f) { - synth->printDebug("Bad sampleRate (%d <= 0.0f)", sampleRate); + synth->printDebug("Bad sampleRate (%f <= 0.0f)", sampleRate); return false; } if (initialisedSampleRate == 0.0f) { diff --git a/sound/vorbis.cpp b/sound/vorbis.cpp index 9658f8f257..8b8bb8f649 100644 --- a/sound/vorbis.cpp +++ b/sound/vorbis.cpp @@ -60,7 +60,7 @@ static size_t read_stream_wrap(void *ptr, size_t size, size_t nmemb, void *datas static int seek_stream_wrap(void *datasource, ogg_int64_t offset, int whence) { Common::SeekableReadStream *stream = (Common::SeekableReadStream *)datasource; - stream->seek(offset, whence); + stream->seek((int32)offset, whence); return stream->pos(); } -- cgit v1.2.3 From c4f629533082b065d8399a38822cd9cce08ccce8 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 1 Jul 2009 20:51:34 +0000 Subject: Fixed some more warnings observed on buildbot svn-id: r42010 --- engines/agos/agos.h | 4 +-- engines/agos/feeble.cpp | 39 +++++++++---------------- engines/agos/items.cpp | 2 +- engines/agos/subroutine.cpp | 2 +- engines/queen/command.cpp | 4 +-- engines/sci/resource.cpp | 2 +- engines/sci/sfx/core.cpp | 2 +- engines/scumm/object.cpp | 5 ++-- engines/scumm/palette.cpp | 70 ++++++++++++++++++--------------------------- engines/scumm/resource.cpp | 8 ++---- 10 files changed, 55 insertions(+), 83 deletions(-) diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 3720e35d3d..1edfe54612 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -615,8 +615,8 @@ protected: void paletteFadeOut(byte *palPtr, uint num, uint size); - byte *allocateItem(uint size); - byte *allocateTable(uint size); + void *allocateItem(uint size); + void *allocateTable(uint size); void alignTableMem(); Child *findChildOfType(Item *i, uint child); diff --git a/engines/agos/feeble.cpp b/engines/agos/feeble.cpp index 492d855614..89b6f6da27 100644 --- a/engines/agos/feeble.cpp +++ b/engines/agos/feeble.cpp @@ -161,21 +161,16 @@ void AGOSEngine_FeebleDemo::exitMenu() { playVideo("fbye1.smk", true); HitArea *ha; - while (!shouldQuit()) { + do { _lastHitArea = NULL; _lastHitArea3 = NULL; - while (!shouldQuit()) { - if (_lastHitArea3 != 0) - break; + while (!shouldQuit() && _lastHitArea3 == 0) { delay(1); } ha = _lastHitArea; - - if (ha != NULL && ha->id == 21) - break; - } + } while (!shouldQuit() && !(ha != NULL && ha->id == 21)); playVideo("fbye2.smk"); quitGame(); @@ -202,9 +197,7 @@ void AGOSEngine_FeebleDemo::filmMenu() { _lastHitArea = NULL; _lastHitArea3 = NULL; - while (!shouldQuit()) { - if (_lastHitArea3 != 0) - break; + while (!shouldQuit() && _lastHitArea3 == 0) { handleWobble(); delay(1); } @@ -287,25 +280,23 @@ void AGOSEngine_FeebleDemo::mainMenu() { startInteractiveVideo("mainmenu.smk"); - HitArea *ha; - while (!shouldQuit()) { + HitArea *ha = 0; + do { _lastHitArea = NULL; _lastHitArea3 = NULL; - while (!shouldQuit()) { - if (_lastHitArea3 != 0) - break; + while (_lastHitArea3 == 0) { + if (shouldQuit()) + return; handleText(); delay(1); } ha = _lastHitArea; + } while (ha == NULL || !(ha->id >= 1 && ha->id <= 6)); - if (ha == NULL) { - } else if (ha->id >= 1 && ha->id <= 6) { - break; - } - } + if (shouldQuit()) + return; stopInteractiveVideo(); @@ -384,11 +375,9 @@ void AGOSEngine_FeebleDemo::waitForSpace() { windowPutChar(_textWindow, *message); mouseOff(); - while (!shouldQuit()) { + do { delay(1); - if (_keyPressed.keycode == Common::KEYCODE_SPACE) - break; - } + } while (!shouldQuit() && (_keyPressed.keycode != Common::KEYCODE_SPACE)); _keyPressed.reset(); mouseOn(); } diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp index c439be3555..49792b99c5 100644 --- a/engines/agos/items.cpp +++ b/engines/agos/items.cpp @@ -41,7 +41,7 @@ Child *AGOSEngine::allocateChildBlock(Item *i, uint type, uint size) { return child; } -byte *AGOSEngine::allocateItem(uint size) { +void *AGOSEngine::allocateItem(uint size) { byte *item = new byte[size]; memset(item, 0, size); diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp index 742ac48ac8..70ad3404f5 100644 --- a/engines/agos/subroutine.cpp +++ b/engines/agos/subroutine.cpp @@ -226,7 +226,7 @@ void AGOSEngine::alignTableMem() { } } -byte *AGOSEngine::allocateTable(uint size) { +void *AGOSEngine::allocateTable(uint size) { byte *org = _tablesHeapPtr; size = (size + 1) & ~1; diff --git a/engines/queen/command.cpp b/engines/queen/command.cpp index 2ae222479d..81f0f3ff89 100644 --- a/engines/queen/command.cpp +++ b/engines/queen/command.cpp @@ -123,7 +123,7 @@ public: virtual void displayTemp(InkColor color, const char *name, bool outlined) { char temp[MAX_COMMAND_LEN]; // don't show a space after the goto and give commands in the Greek version - if (_command[1] != -34 && !(_command[1] == -2 && strlen(_command) > 5)) + if (_command[1] != (char)-34 && !(_command[1] == (char)-2 && strlen(_command) > 5)) sprintf(temp, "%s %s", _command, name); else sprintf(temp, "%s%s", _command, name); @@ -132,7 +132,7 @@ public: virtual void addObject(const char *objName) { // don't show a space after the goto and give commands in the Greek version - if (_command[1] != -34 && !(_command[1] == -2 && strlen(_command) > 5)) + if (_command[1] != (char)-34 && !(_command[1] == (char)-2 && strlen(_command) > 5)) strcat(_command, " "); strcat(_command, objName); } diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 3c377e8ef2..52c079e829 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -711,7 +711,7 @@ void ResourceManager::unlockResource(Resource *res) { int ResourceManager::detectMapVersion() { Common::File file; byte buff[6]; - ResourceSource *rsrc; + ResourceSource *rsrc= 0; for (Common::List::iterator it = _sources.begin(); it != _sources.end(); ++it) { rsrc = *it; diff --git a/engines/sci/sfx/core.cpp b/engines/sci/sfx/core.cpp index 9bf7730fc9..95d79b3666 100644 --- a/engines/sci/sfx/core.cpp +++ b/engines/sci/sfx/core.cpp @@ -1130,7 +1130,7 @@ static byte* readSOLAudio(Common::SeekableReadStream *audioStream, uint32 &size, Audio::AudioStream* SfxState::getAudioStream(uint32 number, uint32 volume, int *sampleLen) { Audio::AudioStream *audioStream = 0; - uint32 size; + uint32 size = 0; byte *data = 0; byte flags = 0; Sci::Resource* audioRes; diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp index 372fcd9e45..f29be071e0 100644 --- a/engines/scumm/object.cpp +++ b/engines/scumm/object.cpp @@ -1816,9 +1816,8 @@ void ScummEngine::loadFlObject(uint object, uint room) { assert(flob); // Copy object code + object image to floating object - ((uint32 *)flob)[0] = MKID_BE('FLOB'); - ((uint32 *)flob)[1] = TO_BE_32(flob_size); - + WRITE_UINT32(flob, MKID_BE('FLOB')); + WRITE_BE_UINT32(flob + 4, flob_size); memcpy(flob + 8, foir.obcd, obcd_size); memcpy(flob + 8 + obcd_size, foir.obim, obim_size); diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp index a2cd4a0d4d..c356e7a06c 100644 --- a/engines/scumm/palette.cpp +++ b/engines/scumm/palette.cpp @@ -470,13 +470,9 @@ void ScummEngine::moveMemInPalRes(int start, int end, byte direction) { } void ScummEngine::palManipulateInit(int resID, int start, int end, int time) { - byte *pal, *target, *between; - byte *string1, *string2, *string3; - int i; - - string1 = getStringAddress(resID); - string2 = getStringAddress(resID + 1); - string3 = getStringAddress(resID + 2); + byte *string1 = getStringAddress(resID); + byte *string2 = getStringAddress(resID + 1); + byte *string3 = getStringAddress(resID + 2); if (!string1 || !string2 || !string3) { error("palManipulateInit(%d,%d,%d,%d): Cannot obtain string resources %d, %d and %d", resID, start, end, time, resID, resID + 1, resID + 2); @@ -496,29 +492,24 @@ void ScummEngine::palManipulateInit(int resID, int start, int end, int time) { if (!_palManipIntermediatePal) _palManipIntermediatePal = (byte *)calloc(0x600, 1); - pal = _currentPalette + start * 3; - target = _palManipPalette + start * 3; - between = _palManipIntermediatePal + start * 6; + byte *pal = _currentPalette + start * 3; + byte *target = _palManipPalette + start * 3; + uint16 *between = (uint16 *)(_palManipIntermediatePal + start * 6); - for (i = start; i < end; ++i) { + for (int i = start; i < end; ++i) { *target++ = *string1++; *target++ = *string2++; *target++ = *string3++; - *(uint16 *)between = ((uint16) *pal++) << 8; - between += 2; - *(uint16 *)between = ((uint16) *pal++) << 8; - between += 2; - *(uint16 *)between = ((uint16) *pal++) << 8; - between += 2; + *between++ = ((uint16) *pal++) << 8; + *between++ = ((uint16) *pal++) << 8; + *between++ = ((uint16) *pal++) << 8; } _palManipCounter = time; } void ScummEngine_v6::palManipulateInit(int resID, int start, int end, int time) { - byte *pal, *target, *between; const byte *new_pal; - int i; new_pal = getPalettePtr(resID, _roomResource); @@ -533,20 +524,17 @@ void ScummEngine_v6::palManipulateInit(int resID, int start, int end, int time) if (!_palManipIntermediatePal) _palManipIntermediatePal = (byte *)calloc(0x600, 1); - pal = _currentPalette + start * 3; - target = _palManipPalette + start * 3; - between = _palManipIntermediatePal + start * 6; + byte *pal = _currentPalette + start * 3; + byte *target = _palManipPalette + start * 3; + uint16 *between = (uint16 *)(_palManipIntermediatePal + start * 6); - for (i = start; i < end; ++i) { + for (int i = start; i < end; ++i) { *target++ = *new_pal++; *target++ = *new_pal++; *target++ = *new_pal++; - *(uint16 *)between = ((uint16) *pal++) << 8; - between += 2; - *(uint16 *)between = ((uint16) *pal++) << 8; - between += 2; - *(uint16 *)between = ((uint16) *pal++) << 8; - between += 2; + *between++ = ((uint16) *pal++) << 8; + *between++ = ((uint16) *pal++) << 8; + *between++ = ((uint16) *pal++) << 8; } _palManipCounter = time; @@ -554,26 +542,24 @@ void ScummEngine_v6::palManipulateInit(int resID, int start, int end, int time) void ScummEngine::palManipulate() { - byte *target, *pal, *between; - int i, j; - if (!_palManipCounter || !_palManipPalette || !_palManipIntermediatePal) return; - target = _palManipPalette + _palManipStart * 3; - pal = _currentPalette + _palManipStart * 3; - between = _palManipIntermediatePal + _palManipStart * 6; + byte *target = _palManipPalette + _palManipStart * 3; + byte *pal = _currentPalette + _palManipStart * 3; + uint16 *between = (uint16 *)(_palManipIntermediatePal + _palManipStart * 6); - for (i = _palManipStart; i < _palManipEnd; ++i) { - j = (*((uint16 *)between) += ((*target++ << 8) - *((uint16 *)between)) / _palManipCounter); + for (int i = _palManipStart; i < _palManipEnd; ++i) { + int j; + j = (*between += ((*target++ << 8) - *between) / _palManipCounter); *pal++ = j >> 8; - between += 2; - j = (*((uint16 *)between) += ((*target++ << 8) - *((uint16 *)between)) / _palManipCounter); + between++; + j = (*between += ((*target++ << 8) - *between) / _palManipCounter); *pal++ = j >> 8; - between += 2; - j = (*((uint16 *)between) += ((*target++ << 8) - *((uint16 *)between)) / _palManipCounter); + between++; + j = (*between += ((*target++ << 8) - *between) / _palManipCounter); *pal++ = j >> 8; - between += 2; + between++; } setDirtyColors(_palManipStart, _palManipEnd); _palManipCounter--; diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index 874b787615..4638c40828 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -787,8 +787,6 @@ void ResourceManager::setResourceCounter(int type, int idx, byte flag) { #define SAFETY_AREA 2 byte *ResourceManager::createResource(int type, int idx, uint32 size) { - byte *ptr; - debugC(DEBUG_RESOURCE, "_res->createResource(%s,%d,%d)", resTypeFromId(type), idx, size); if (!validateResource("allocating", type, idx)) @@ -807,17 +805,17 @@ byte *ResourceManager::createResource(int type, int idx, uint32 size) { expireResources(size); - ptr = (byte *)calloc(size + sizeof(MemBlkHeader) + SAFETY_AREA, 1); + void *ptr = calloc(size + sizeof(MemBlkHeader) + SAFETY_AREA, 1); if (ptr == NULL) { error("createResource(%s,%d): Out of memory while allocating %d", resTypeFromId(type), idx, size); } _allocatedSize += size; - address[type][idx] = ptr; + address[type][idx] = (byte *)ptr; ((MemBlkHeader *)ptr)->size = size; setResourceCounter(type, idx, 1); - return ptr + sizeof(MemBlkHeader); /* skip header */ + return (byte *)ptr + sizeof(MemBlkHeader); /* skip header */ } ResourceManager::ResourceManager(ScummEngine *vm) { -- cgit v1.2.3 From 385421e95b59cf904e7e84edfe31d272a66da6b4 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 1 Jul 2009 20:51:47 +0000 Subject: Flag what looks like a bug in the CMS player code -- somebody should verify and fix this properly svn-id: r42011 --- engines/scumm/player_v2cms.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/scumm/player_v2cms.cpp b/engines/scumm/player_v2cms.cpp index 97efb4dc63..d628293d7d 100644 --- a/engines/scumm/player_v2cms.cpp +++ b/engines/scumm/player_v2cms.cpp @@ -1428,6 +1428,10 @@ int Player_V2CMS::readBuffer(int16 *buffer, const int numSamples) { } _tempoSum += _tempo; + // FIXME: _tempoSum is declared as char; on some systems char is unsigned. + // E.g. on OS X. Hence the following check is always false. + // Moral of the story: Use uint8, int8 or any of the other types provided by + // ScummVM if you want to ensure signedness and number of available bits. if (_tempoSum < 0) { // this have to be called in the same rate as in the original (I think) processMidiData(1); -- cgit v1.2.3 From 630501fe43af959a26b7c345a31b250347450142 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 1 Jul 2009 20:53:47 +0000 Subject: oops svn-id: r42012 --- Makefile | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Makefile b/Makefile index a72e76619d..99accca5fc 100644 --- a/Makefile +++ b/Makefile @@ -26,13 +26,6 @@ CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder # Enable even more warnings... CXXFLAGS+= -Wpointer-arith -Wcast-qual -Wcast-align CXXFLAGS+= -Wshadow -Wimplicit -Wnon-virtual-dtor -Wwrite-strings -# TODO: Consider using -Wold-style-cast at some point -# CXXFLAGS+= -Wno-sign-compare -#CXXFLAGS+= -Wextra -CXXFLAGS+= -Wmissing-format-attribute -CXXFLAGS+= -Wredundant-decls -CXXFLAGS+= -Wconversion -#CXXFLAGS+= -Wshorten-64-to-32 # Disable RTTI and exceptions, and enabled checking of pointers returned by "new" CXXFLAGS+= -fno-rtti -fno-exceptions -fcheck-new -- cgit v1.2.3 From 341d875ceabcccd75d7921777c0158f287089b2f Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Thu, 2 Jul 2009 12:15:04 +0000 Subject: Added support for compressed sample files (patch #2815426 by m_kiewitz) svn-id: r42020 --- engines/tinsel/detection.cpp | 2 +- engines/tinsel/sound.cpp | 96 +++++++++++++++++++++++++++++++++++++++----- engines/tinsel/sound.h | 10 +++++ 3 files changed, 98 insertions(+), 10 deletions(-) diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp index a3cd0bc7b7..3ca8adf30d 100644 --- a/engines/tinsel/detection.cpp +++ b/engines/tinsel/detection.cpp @@ -505,7 +505,7 @@ static const TinselGameDescription gameDescriptions[] = { "CD", { {"dw2.scn", 0, "c6d15ce9720a9d8fef06e6582dcf3f34", 103593}, - {"english1.smp", 0, "aa8d05f6fade11e6f066d42c302c8e89", 250926923}, + {"english1.smp", 0, NULL, -1}, {"english1.txt", 0, "b522e19d7b2cd7b85e50e36fe48e36a9", 274444}, {NULL, 0, NULL, 0} }, diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp index a07a417723..c6d30fa222 100644 --- a/engines/tinsel/sound.cpp +++ b/engines/tinsel/sound.cpp @@ -41,6 +41,9 @@ #include "sound/mixer.h" #include "sound/adpcm.h" #include "sound/vag.h" +#include "sound/flac.h" +#include "sound/mp3.h" +#include "sound/vorbis.h" #include "gui/message.h" @@ -52,7 +55,9 @@ extern LANGUAGE sampleLanguage; SoundManager::SoundManager(TinselEngine *vm) : //_vm(vm), // TODO: Enable this once global _vm var is gone - _sampleIndex(0), _sampleIndexLen(0) { + _sampleIndex(0), _sampleIndexLen(0), + _soundMode(kVOCMode) + { for (int i = 0; i < kNumChannels; i++) _channels[i].sampleNum = _channels[i].subSample = -1; @@ -68,6 +73,7 @@ SoundManager::~SoundManager() { * @param type type of sound (voice or sfx) * @param handle sound handle */ +// playSample for DiscWorld 1 bool SoundManager::playSample(int id, Audio::Mixer::SoundType type, Audio::SoundHandle *handle) { // Floppy version has no sample file if (_vm->getFeatures() & GF_FLOPPY) @@ -114,7 +120,7 @@ bool SoundManager::playSample(int id, Audio::Mixer::SoundType type, Audio::Sound _vm->_mixer->playInputStream(type, &curChan.handle, vagStream); } else { // allocate a buffer - void *sampleBuf = malloc(sampleLen); + byte *sampleBuf = (byte *)malloc(sampleLen); assert(sampleBuf); // read all of the sample @@ -126,10 +132,35 @@ bool SoundManager::playSample(int id, Audio::Mixer::SoundType type, Audio::Sound //_vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic); _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, volVoice); + Common::MemoryReadStream *compressedStream = + new Common::MemoryReadStream(sampleBuf, sampleLen, true); + Audio::AudioStream *sampleStream = 0; // play it - _vm->_mixer->playRaw(type, &curChan.handle, sampleBuf, sampleLen, 22050, - Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED); + switch (_soundMode) { + case kMP3Mode: + #ifdef USE_MAD + sampleStream = Audio::makeMP3Stream(compressedStream, true); + #endif + break; + case kVorbisMode: + #ifdef USE_VORBIS + sampleStream = Audio::makeVorbisStream(compressedStream, true); + #endif + break; + case kFlacMode: + #ifdef USE_FLAC + sampleStream = Audio::makeFlacStream(compressedStream, true); + #endif + break; + default: + _vm->_mixer->playRaw(type, &curChan.handle, sampleBuf, sampleLen, 22050, + Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED); + break; + } + if (sampleStream) { + _vm->_mixer->playInputStream(type, &curChan.handle, sampleStream); + } } if (handle) @@ -138,6 +169,7 @@ bool SoundManager::playSample(int id, Audio::Mixer::SoundType type, Audio::Sound return true; } +// playSample for DiscWorld 2 bool SoundManager::playSample(int id, int sub, bool bLooped, int x, int y, int priority, Audio::Mixer::SoundType type, Audio::SoundHandle *handle) { @@ -251,10 +283,30 @@ bool SoundManager::playSample(int id, int sub, bool bLooped, int x, int y, int p if (_sampleStream.read(sampleBuf, sampleLen) != sampleLen) error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage)); - Common::MemoryReadStream *sampleStream = + Common::MemoryReadStream *compressedStream = new Common::MemoryReadStream(sampleBuf, sampleLen, true); - Audio::AudioStream *_stream = - makeADPCMStream(sampleStream, true, sampleLen, Audio::kADPCMTinsel6, 22050, 1, 24); + Audio::AudioStream *sampleStream = 0; + + switch (_soundMode) { + case kMP3Mode: + #ifdef USE_MAD + sampleStream = Audio::makeMP3Stream(compressedStream, true); + #endif + break; + case kVorbisMode: + #ifdef USE_VORBIS + sampleStream = Audio::makeVorbisStream(compressedStream, true); + #endif + break; + case kFlacMode: + #ifdef USE_FLAC + sampleStream = Audio::makeFlacStream(compressedStream, true); + #endif + break; + default: + sampleStream = Audio::makeADPCMStream(compressedStream, true, sampleLen, Audio::kADPCMTinsel6, 22050, 1, 24); + break; + } // FIXME: Should set this in a different place ;) _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, volSound); @@ -269,10 +321,12 @@ bool SoundManager::playSample(int id, int sub, bool bLooped, int x, int y, int p curChan->priority = priority; curChan->lastStart = g_system->getMillis(); // /---Compression----\ Milis BytesPerSecond - curChan->timeDuration = (((sampleLen * 64) / 25) * 1000) / (22050 * 2); + // not needed and won't work when using MP3/OGG/FLAC anyway + //curChan->timeDuration = (((sampleLen * 64) / 25) * 1000) / (22050 * 2); // Play it - _vm->_mixer->playInputStream(type, &curChan->handle, _stream); + _vm->_mixer->playInputStream(type, &curChan->handle, sampleStream); + _vm->_mixer->setChannelVolume(curChan->handle, sndVol); _vm->_mixer->setChannelBalance(curChan->handle, getPan(x)); @@ -455,6 +509,30 @@ void SoundManager::openSampleFiles(void) { // convert file size to size in DWORDs _sampleIndexLen /= sizeof(uint32); + + // Detect format of soundfile by looking at 1st sample-index + switch (_sampleIndex[0]) { + case MKID_BE(' 3PM'): + debugC(DEBUG_DETAILED, kTinselDebugSound, "Detected MP3 sound-data"); + _soundMode = kMP3Mode; + break; + + case MKID_BE(' GGO'): + debugC(DEBUG_DETAILED, kTinselDebugSound, "Detected OGG sound-data"); + _soundMode = kVorbisMode; + break; + + case MKID_BE('CLAF'): + debugC(DEBUG_DETAILED, kTinselDebugSound, "Detected FLAC sound-data"); + _soundMode = kFlacMode; + break; + + default: + debugC(DEBUG_DETAILED, kTinselDebugSound, "Detected original sound-data"); + break; + } + // Normally the 1st sample-index points to nothing at all + _sampleIndex[0] = 0; } else { char buf[50]; sprintf(buf, CANNOT_FIND_FILE, _vm->getSampleIndex(sampleLanguage)); diff --git a/engines/tinsel/sound.h b/engines/tinsel/sound.h index 15919f8ec5..9bdd037ff0 100644 --- a/engines/tinsel/sound.h +++ b/engines/tinsel/sound.h @@ -58,6 +58,13 @@ protected: }; static const int kNumChannels = kChannelSFX + kNumSFX; + enum SoundMode { + kVOCMode, + kMP3Mode, + kVorbisMode, + kFlacMode + }; + struct Channel { // Sample handle Audio::SoundHandle handle; @@ -87,6 +94,9 @@ protected: /** Number of entries in the sample index */ long _sampleIndexLen; + /** Specifies if the sample-data is compressed and if yes, how */ + SoundMode _soundMode; + /** file stream for sample file */ TinselFile _sampleStream; -- cgit v1.2.3 From 8aa667e342e8c8dc203fb6811f01523bacfcffab Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 2 Jul 2009 21:16:36 +0000 Subject: Enhanced the quicksearch box in the launcher to match words in the search string individually svn-id: r42038 --- gui/ListWidget.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index e46d5e9b1e..07d22973ac 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -561,8 +561,10 @@ void ListWidget::setFilter(const String &filter, bool redraw) { // No filter -> display everything _list = _dataList; } else { - // Restrict the list to everything which contains _filter as a substring, - // ignoring case. + // Restrict the list to everything which contains all words in _filter + // as substrings, ignoring case. + + Common::StringTokenizer tok(filter); String tmp; int n = 0; @@ -572,7 +574,16 @@ void ListWidget::setFilter(const String &filter, bool redraw) { for (StringList::iterator i = _dataList.begin(); i != _dataList.end(); ++i, ++n) { tmp = *i; tmp.toLowercase(); - if (tmp.contains(_filter)) { + bool matches = true; + tok.reset(); + while (!tok.empty()) { + if (!tmp.contains(tok.nextToken())) { + matches = false; + break; + } + } + + if (matches) { _list.push_back(*i); _listIndex.push_back(n); } -- cgit v1.2.3 From cea01452a7b6cfe59646c43935cff5877c985c29 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 2 Jul 2009 21:37:13 +0000 Subject: fixed indention (and trigger a reconfigure in buildbot) svn-id: r42039 --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 0d2af6ab4e..b2a94bf9dd 100755 --- a/configure +++ b/configure @@ -292,7 +292,7 @@ get_system_exe_extension() { # Show the configure help line for an option option_help() { - tmpopt=`echo $1 | sed 's/_/-/g'` + tmpopt=`echo $1 | sed 's/_/-/g'` option=`echo "--${tmpopt} " | sed "s/\(.\{23\}\).*/\1/"` echo " ${option} ${2}" } -- cgit v1.2.3 From 51889298258f651a95f810cebd78c5b431f35472 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 2 Jul 2009 22:05:42 +0000 Subject: cleanup svn-id: r42040 --- backends/platform/ds/arm7/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/backends/platform/ds/arm7/Makefile b/backends/platform/ds/arm7/Makefile index 82637845db..a8dc0efe6e 100644 --- a/backends/platform/ds/arm7/Makefile +++ b/backends/platform/ds/arm7/Makefile @@ -151,13 +151,12 @@ $(OUTPUT).elf : $(OFILES) #--------------------------------------------------------------------------------- %.bin: %.elf @echo built ... $(notdir $@) - @$(OBJCOPY) -O binary $(TARGET).elf $@ + $(OBJCOPY) -O binary $(TARGET).elf $@ #--------------------------------------------------------------------------------- %.elf: echo ELF - @echo $(LD) $(LDFLAGS) -specs=ds_arm7.specs $(OFILES) $(LIBPATHS) $(LIBS) -o $(TARGET).elf - @$(LD) $(LDFLAGS) -specs=ds_arm7.specs $(OFILES) $(LIBPATHS) $(LIBS) -o $(TARGET).elf + $(LD) $(LDFLAGS) -specs=ds_arm7.specs $(OFILES) $(LIBPATHS) $(LIBS) -o $(TARGET).elf -- cgit v1.2.3 From 650248dbd1871444e88a01b696d5d671e636650c Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 2 Jul 2009 22:21:33 +0000 Subject: Added -Wmissing-format-attribute to build system svn-id: r42041 --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 99accca5fc..12718494c7 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,7 @@ CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder # Enable even more warnings... CXXFLAGS+= -Wpointer-arith -Wcast-qual -Wcast-align CXXFLAGS+= -Wshadow -Wimplicit -Wnon-virtual-dtor -Wwrite-strings +CXXFLAGS+= -Wmissing-format-attribute # Disable RTTI and exceptions, and enabled checking of pointers returned by "new" CXXFLAGS+= -fno-rtti -fno-exceptions -fcheck-new -- cgit v1.2.3 From 80cb18e87fb2a0a6ecc3c7f96c5b8366550648ea Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 2 Jul 2009 23:16:40 +0000 Subject: Moved all the debug state variables in a separate struct and re-enabled several places where they're used svn-id: r42043 --- engines/sci/console.cpp | 52 +++++++++------------------- engines/sci/debug.h | 12 +++++++ engines/sci/engine/scriptdebug.cpp | 70 +++++++++++++++++--------------------- 3 files changed, 59 insertions(+), 75 deletions(-) diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 2f2fbc5243..9433b5a625 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -54,6 +54,7 @@ bool g_debug_weak_validations = true; int g_debug_seeking = 0; // Stepping forward until some special condition is met int g_debug_seek_special = 0; // Used for special seeks int g_debug_seek_level = 0; // Used for seekers that want to check their exec stack depth +extern DebugState debugState; Console::Console(SciEngine *vm) : GUI::Debugger() { _vm = vm; @@ -522,16 +523,13 @@ bool Console::cmdSetParseNodes(int argc, const char **argv) { bool Console::cmdRegisters(int argc, const char **argv) { DebugPrintf("Current register values:\n"); -#if 0 - // TODO: p_restadjust - DebugPrintf("acc=%04x:%04x prev=%04x:%04x &rest=%x\n", PRINT_REG(_vm->_gamestate->r_acc), PRINT_REG(_vm->_gamestate->r_prev), *p_restadjust); -#endif + DebugPrintf("acc=%04x:%04x prev=%04x:%04x &rest=%x\n", PRINT_REG(_vm->_gamestate->r_acc), PRINT_REG(_vm->_gamestate->r_prev), *debugState.p_restadjust); if (!_vm->_gamestate->_executionStack.empty()) { -#if 0 - // TODO: p_pc, p_objp, p_pp, p_sp - DebugPrintf("pc=%04x:%04x obj=%04x:%04x fp=ST:%04x sp=ST:%04x\n", PRINT_REG(*p_pc), PRINT_REG(*p_objp), PRINT_STK(*p_pp), PRINT_STK(*p_sp)); -#endif + EngineState *s = _vm->_gamestate; // for PRINT_STK + DebugPrintf("pc=%04x:%04x obj=%04x:%04x fp=ST:%04x sp=ST:%04x\n", + PRINT_REG(*debugState.p_pc), PRINT_REG(*debugState.p_objp), + PRINT_STK(*debugState.p_pp), PRINT_STK(*debugState.p_sp)); } else DebugPrintf("\n"); @@ -1689,20 +1687,16 @@ bool Console::cmdGCNormalize(int argc, const char **argv) { } bool Console::cmdVMVarlist(int argc, const char **argv) { - //const char *varnames[] = {"global", "local", "temp", "param"}; + const char *varnames[] = {"global", "local", "temp", "param"}; DebugPrintf("Addresses of variables in the VM:\n"); -#if 0 - // TODO: p_var_segs, p_vars, p_var_base, p_var_max - for (int i = 0; i < 4; i++) { - DebugPrintf("%s vars at %04x:%04x ", varnames[i], PRINT_REG(make_reg(p_var_segs[i], p_vars[i] - p_var_base[i]))); - if (p_var_max) - DebugPrintf(" total %d", p_var_max[i]); + DebugPrintf("%s vars at %04x:%04x ", varnames[i], PRINT_REG(make_reg(debugState.p_var_segs[i], debugState.p_vars[i] - debugState.p_var_base[i]))); + if (debugState.p_var_max) + DebugPrintf(" total %d", debugState.p_var_max[i]); DebugPrintf("\n"); } -#endif return true; } @@ -1718,7 +1712,7 @@ bool Console::cmdVMVars(int argc, const char **argv) { return true; } - //const char *varnames[] = {"global", "local", "temp", "param"}; + const char *varnames[] = {"global", "local", "temp", "param"}; const char *varabbrev = "gltp"; const char *vartype_pre = strchr(varabbrev, *argv[1]); int vartype; @@ -1736,31 +1730,21 @@ bool Console::cmdVMVars(int argc, const char **argv) { return true; } -#if 0 - // TODO: p_var_max - if ((p_var_max) && (p_var_max[vartype] <= idx)) { - DebugPrintf("Max. index is %d (0x%x)\n", p_var_max[vartype], p_var_max[vartype]); + if ((debugState.p_var_max) && (debugState.p_var_max[vartype] <= idx)) { + DebugPrintf("Max. index is %d (0x%x)\n", debugState.p_var_max[vartype], debugState.p_var_max[vartype]); return true; } -#endif switch (argc) { case 2: -#if 0 - // TODO: p_vars - DebugPrintf("%s var %d == %04x:%04x\n", varnames[vartype], idx, PRINT_REG(p_vars[vartype][idx])); -#endif + DebugPrintf("%s var %d == %04x:%04x\n", varnames[vartype], idx, PRINT_REG(debugState.p_vars[vartype][idx])); break; case 3: -#if 0 - // TODO: p_vars - - if (parse_reg_t(_vm->_gamestate, argv[3], &p_vars[vartype][idx])) { + if (parse_reg_t(_vm->_gamestate, argv[3], &debugState.p_vars[vartype][idx])) { DebugPrintf("Invalid address passed.\n"); DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } -#endif break; default: DebugPrintf("Too many arguments\n"); @@ -1995,11 +1979,7 @@ bool Console::cmdViewObject(int argc, const char **argv) { bool Console::cmdViewActiveObject(int argc, const char **argv) { DebugPrintf("Information on the currently active object or class:\n"); - -#if 0 - // TODO: p_objp - printObject(_vm->_gamestate, *p_objp); -#endif + printObject(_vm->_gamestate, *debugState.p_objp); return true; } diff --git a/engines/sci/debug.h b/engines/sci/debug.h index e12d7fbe2d..2be28ac905 100644 --- a/engines/sci/debug.h +++ b/engines/sci/debug.h @@ -45,6 +45,18 @@ extern int g_debug_seeking; extern int g_debug_seek_special; extern int g_debug_seek_level; +struct DebugState { + reg_t *p_pc; + StackPtr *p_sp; + StackPtr *p_pp; + reg_t *p_objp; + int *p_restadjust; + SegmentId *p_var_segs; + reg_t **p_vars; + reg_t **p_var_base; + int *p_var_max; // May be NULL even in valid state! +}; + } // End of namespace Sci #endif diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index 11c38052db..0bd1442cf4 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -36,18 +36,10 @@ int g_debugstate_valid = 0; // Set to 1 while script_debug is running int g_debug_step_running = 0; // Set to >0 to allow multiple stepping extern int g_debug_seek_special; -static reg_t *p_pc; -static StackPtr *p_sp; -static StackPtr *p_pp; -static reg_t *p_objp; -static int *p_restadjust; -static SegmentId *p_var_segs; -static reg_t **p_vars; -static reg_t **p_var_base; -static int *p_var_max; // May be NULL even in valid state! - extern const char *selector_name(EngineState *s, int selector); +DebugState debugState; + int propertyOffsetToId(EngineState *s, int prop_ofs, reg_t objp) { Object *obj = obj_get(s, objp); byte *selectoroffset; @@ -238,11 +230,11 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod } } - if (pos == *p_pc) { // Extra information if debugging the current opcode + if (pos == *debugState.p_pc) { // Extra information if debugging the current opcode if ((opcode == op_pTos) || (opcode == op_sTop) || (opcode == op_pToa) || (opcode == op_aTop) || (opcode == op_dpToa) || (opcode == op_ipToa) || (opcode == op_dpTos) || (opcode == op_ipTos)) { int prop_ofs = scr[pos.offset + 1]; - int prop_id = propertyOffsetToId(s, prop_ofs, *p_objp); + int prop_id = propertyOffsetToId(s, prop_ofs, *debugState.p_objp); sciprintf(" (%s)", selector_name(s, prop_id)); } @@ -250,38 +242,38 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod sciprintf("\n"); - if (pos == *p_pc) { // Extra information if debugging the current opcode + if (pos == *debugState.p_pc) { // Extra information if debugging the current opcode if (opcode == op_callk) { - int stackframe = (scr[pos.offset + 2] >> 1) + (*p_restadjust); - int argc = ((*p_sp)[- stackframe - 1]).offset; + int stackframe = (scr[pos.offset + 2] >> 1) + (*debugState.p_restadjust); + int argc = ((*debugState.p_sp)[- stackframe - 1]).offset; if (!(s->_flags & GF_SCI0_OLD)) - argc += (*p_restadjust); + argc += (*debugState.p_restadjust); sciprintf(" Kernel params: ("); for (int j = 0; j < argc; j++) { - sciprintf("%04x:%04x", PRINT_REG((*p_sp)[j - stackframe])); + sciprintf("%04x:%04x", PRINT_REG((*debugState.p_sp)[j - stackframe])); if (j + 1 < argc) sciprintf(", "); } sciprintf(")\n"); } else if ((opcode == op_send) || (opcode == op_self)) { - int restmod = *p_restadjust; + int restmod = *debugState.p_restadjust; int stackframe = (scr[pos.offset + 1] >> 1) + restmod; - reg_t *sb = *p_sp; + reg_t *sb = *debugState.p_sp; uint16 selector; reg_t fun_ref; while (stackframe > 0) { int argc = sb[- stackframe + 1].offset; const char *name = NULL; - reg_t called_obj_addr = *p_objp; + reg_t called_obj_addr = *debugState.p_objp; if (opcode == op_send) called_obj_addr = s->r_acc; else if (opcode == op_self) - called_obj_addr = *p_objp; + called_obj_addr = *debugState.p_objp; selector = sb[- stackframe].offset; @@ -331,15 +323,15 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t * int old_debugstate = g_debugstate_valid; - p_var_segs = segids; - p_vars = variables; - p_var_max = variables_nr; - p_var_base = variables_base; - p_pc = pc; - p_sp = sp; - p_pp = pp; - p_objp = objp; - p_restadjust = restadjust; + debugState.p_var_segs = segids; + debugState.p_vars = variables; + debugState.p_var_max = variables_nr; + debugState.p_var_base = variables_base; + debugState.p_pc = pc; + debugState.p_sp = sp; + debugState.p_pp = pp; + debugState.p_objp = objp; + debugState.p_restadjust = restadjust; sciprintf("%d: acc=%04x:%04x ", script_step_counter, PRINT_REG(s->r_acc)); g_debugstate_valid = 1; disassemble(s, *pc, 0, 1); @@ -399,15 +391,15 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t * g_debugstate_valid = (g_debug_step_running == 0); if (g_debugstate_valid) { - p_pc = pc; - p_sp = sp; - p_pp = pp; - p_objp = objp; - p_restadjust = restadjust; - p_var_segs = segids; - p_vars = variables; - p_var_max = variables_nr; - p_var_base = variables_base; + debugState.p_pc = pc; + debugState.p_sp = sp; + debugState.p_pp = pp; + debugState.p_objp = objp; + debugState.p_restadjust = restadjust; + debugState.p_var_segs = segids; + debugState.p_vars = variables; + debugState.p_var_max = variables_nr; + debugState.p_var_base = variables_base; sciprintf("Step #%d\n", script_step_counter); disassemble(s, *pc, 0, 1); -- cgit v1.2.3 From c3403ac7395cf9df9c4dad57b42e600b200660b5 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 2 Jul 2009 23:58:05 +0000 Subject: Moved some more debug state related variables in the DebugState struct svn-id: r42044 --- engines/sci/console.cpp | 70 ++++++++++++++++++++------------------ engines/sci/console.h | 9 ----- engines/sci/debug.h | 28 ++++++++------- engines/sci/engine/kevent.cpp | 12 ++++--- engines/sci/engine/kmisc.cpp | 5 ++- engines/sci/engine/scriptdebug.cpp | 34 ++++++++---------- engines/sci/engine/vm.cpp | 15 ++++---- 7 files changed, 86 insertions(+), 87 deletions(-) diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 9433b5a625..002acbae86 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -50,10 +50,6 @@ int g_debug_sleeptime_factor = 1; int g_debug_simulated_key = 0; bool g_debug_track_mouse_clicks = false; bool g_debug_weak_validations = true; -// Script related variables -int g_debug_seeking = 0; // Stepping forward until some special condition is met -int g_debug_seek_special = 0; // Used for special seeks -int g_debug_seek_level = 0; // Used for seekers that want to check their exec stack depth extern DebugState debugState; Console::Console(SciEngine *vm) : GUI::Debugger() { @@ -193,6 +189,12 @@ Console::Console(SciEngine *vm) : GUI::Debugger() { con_hook_int(&(gfx_options.dirty_frames), "dirty_frames", "Dirty frames management\n"); */ + + debugState.isValid = false; + debugState.seeking = kDebugSeekNothing; + debugState.seekLevel = 0; + debugState.runningStep = 0; + debugState.stopOnEvent = false; } Console::~Console() { @@ -833,7 +835,7 @@ bool Console::cmdRestoreGame(int argc, const char **argv) { _vm->_gamestate->successor = newstate; // Set successor script_abort_flag = 2; // Abort current game with replay - g_debugstate_valid = 0; + debugState.isValid = false; shrink_execution_stack(_vm->_gamestate, _vm->_gamestate->execution_stack_base + 1); return 0; @@ -864,7 +866,7 @@ bool Console::cmdRestartGame(int argc, const char **argv) { _vm->_gamestate->restarting_flags |= SCI_GAME_IS_RESTARTING_NOW; script_abort_flag = 1; - g_debugstate_valid = 0; + debugState.isValid = false; return false; } @@ -2086,24 +2088,24 @@ bool Console::cmdBacktrace(int argc, const char **argv) { } bool Console::cmdStep(int argc, const char **argv) { - g_debugstate_valid = 0; + debugState.isValid = false; if (argc == 2 && atoi(argv[1]) > 0) - g_debug_step_running = atoi(argv[1]) - 1; + debugState.runningStep = atoi(argv[1]) - 1; return true; } bool Console::cmdStepEvent(int argc, const char **argv) { - g_stop_on_event = 1; - g_debugstate_valid = 0; + debugState.stopOnEvent = true; + debugState.isValid = false; return true; } bool Console::cmdStepRet(int argc, const char **argv) { - g_debug_seeking = kDebugSeekLevelRet; - g_debug_seek_level = _vm->_gamestate->_executionStack.size() - 1; - g_debugstate_valid = 0; + debugState.seeking = kDebugSeekLevelRet; + debugState.seekLevel = _vm->_gamestate->_executionStack.size() - 1; + debugState.isValid = false; return true; } @@ -2115,9 +2117,9 @@ bool Console::cmdStepGlobal(int argc, const char **argv) { return true; } - g_debug_seeking = kDebugSeekGlobal; - g_debug_seek_special = atoi(argv[1]); - g_debugstate_valid = 0; + debugState.seeking = kDebugSeekGlobal; + debugState.seekSpecial = atoi(argv[1]); + debugState.isValid = false; return true; } @@ -2145,12 +2147,12 @@ bool Console::cmdStepCallk(int argc, const char **argv) { } } - g_debug_seeking = kDebugSeekSpecialCallk; - g_debug_seek_special = callk_index; - g_debugstate_valid = 0; + debugState.seeking = kDebugSeekSpecialCallk; + debugState.seekSpecial = callk_index; + debugState.isValid = false; } else { - g_debug_seeking = kDebugSeekCallk; - g_debugstate_valid = 0; + debugState.seeking = kDebugSeekCallk; + debugState.isValid = false; } return true; @@ -2326,8 +2328,8 @@ bool Console::cmdSend(int argc, const char **argv) { } bool Console::cmdGo(int argc, const char **argv) { - g_debug_seeking = 0; - g_debugstate_valid = 0; + debugState.seeking = kDebugSeekNothing; + debugState.isValid = false; return true; } @@ -2741,9 +2743,9 @@ bool Console::cmdExit(int argc, const char **argv) { if (!scumm_stricmp(argv[1], "game")) { // Quit gracefully script_abort_flag = 1; // Terminate VM - g_debugstate_valid = 0; - g_debug_seeking = 0; - g_debug_step_running = 0; + debugState.isValid = false; + debugState.seeking = kDebugSeekNothing; + debugState.runningStep = 0; } else if (!scumm_stricmp(argv[1], "now")) { // Quit ungracefully @@ -3231,34 +3233,34 @@ int c_stepover(EngineState *s, const Common::Array &cmdParams) { return 1; } - g_debugstate_valid = 0; + debugState.isValid = false; opcode = s->_heap[*p_pc]; opnumber = opcode >> 1; if (opnumber == 0x22 /* callb */ || opnumber == 0x23 /* calle */ || opnumber == 0x25 /* send */ || opnumber == 0x2a /* self */ || opnumber == 0x2b /* super */) { - g_debug_seeking = kDebugSeekSO; - g_debug_seek_level = s->_executionStack.size()-1; - // Store in g_debug_seek_special the offset of the next command after send + debugState.seeking = kDebugSeekSO; + debugState.seekLevel = s->_executionStack.size()-1; + // Store in debugState.seekSpecial the offset of the next command after send switch (opcode) { case 0x46: // calle W - g_debug_seek_special = *p_pc + 5; + debugState.seekSpecial = *p_pc + 5; break; case 0x44: // callb W case 0x47: // calle B case 0x56: // super W - g_debug_seek_special = *p_pc + 4; + debugState.seekSpecial = *p_pc + 4; break; case 0x45: // callb B case 0x57: // super B case 0x4A: // send W case 0x54: // self W - g_debug_seek_special = *p_pc + 3; + debugState.seekSpecial = *p_pc + 3; break; default: - g_debug_seek_special = *p_pc + 2; + debugState.seekSpecial = *p_pc + 2; } } diff --git a/engines/sci/console.h b/engines/sci/console.h index 22b5505bf2..c45202de16 100644 --- a/engines/sci/console.h +++ b/engines/sci/console.h @@ -35,15 +35,6 @@ namespace Sci { class SciEngine; struct List; -enum DebugSeeking { - kDebugSeekNothing = 0, - kDebugSeekCallk = 1, // Step forward until callk is found - kDebugSeekLevelRet = 2, // Step forward until returned from this level - kDebugSeekSpecialCallk = 3, // Step forward until a /special/ callk is found - kDebugSeekSO = 4, // Step forward until specified PC (after the send command) and stack depth - kDebugSeekGlobal = 5 // Step forward until one specified global variable is modified -}; - // Refer to the "addresses" command on how to pass address parameters int parse_reg_t(EngineState *s, const char *str, reg_t *dest); int printObject(EngineState *s, reg_t pos); diff --git a/engines/sci/debug.h b/engines/sci/debug.h index 2be28ac905..60bf938300 100644 --- a/engines/sci/debug.h +++ b/engines/sci/debug.h @@ -29,23 +29,27 @@ namespace Sci { // Various global variables used for debugging are declared here - -extern int g_stop_on_event; - -extern int g_debugstate_valid; -extern int g_debug_seeking; -extern int g_debug_step_running; - extern int g_debug_sleeptime_factor; extern int g_debug_simulated_key; extern bool g_debug_track_mouse_clicks; extern bool g_debug_weak_validations; -// Script related variables -extern int g_debug_seeking; -extern int g_debug_seek_special; -extern int g_debug_seek_level; + +enum DebugSeeking { + kDebugSeekNothing = 0, + kDebugSeekCallk = 1, // Step forward until callk is found + kDebugSeekLevelRet = 2, // Step forward until returned from this level + kDebugSeekSpecialCallk = 3, // Step forward until a /special/ callk is found + kDebugSeekSO = 4, // Step forward until specified PC (after the send command) and stack depth + kDebugSeekGlobal = 5 // Step forward until one specified global variable is modified +}; struct DebugState { + bool isValid; + bool stopOnEvent; + DebugSeeking seeking; // Stepping forward until some special condition is met + int runningStep; // Set to > 0 to allow multiple stepping + int seekLevel; // Used for seekers that want to check their exec stack depth + int seekSpecial; // Used for special seeks reg_t *p_pc; StackPtr *p_sp; StackPtr *p_pp; @@ -54,7 +58,7 @@ struct DebugState { SegmentId *p_var_segs; reg_t **p_vars; reg_t **p_var_base; - int *p_var_max; // May be NULL even in valid state! + int *p_var_max; // May be NULL even in valid state! }; } // End of namespace Sci diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index d5a725a230..3b37506e6c 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -33,7 +33,7 @@ namespace Sci { -int g_stop_on_event = 0; +extern DebugState debugState; #define SCI_VARIABLE_GAME_SPEED 3 @@ -90,10 +90,12 @@ reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv) { case SCI_EVT_KEYBOARD: if ((e.buckybits & SCI_EVM_LSHIFT) && (e.buckybits & SCI_EVM_RSHIFT) && (e.data == '-')) { sciprintf("Debug mode activated\n"); - g_debug_seeking = g_debug_step_running = 0; + debugState.seeking = kDebugSeekNothing; + debugState.runningStep = 0; } else if ((e.buckybits & SCI_EVM_CTRL) && (e.data == '`')) { sciprintf("Debug mode activated\n"); - g_debug_seeking = g_debug_step_running = 0; + debugState.seeking = kDebugSeekNothing; + debugState.runningStep = 0; } else { PUT_SEL32V(obj, type, SCI_EVT_KEYBOARD); // Keyboard event s->r_acc = make_reg(0, 1); @@ -137,8 +139,8 @@ reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv) { s->r_acc = NULL_REG; // Unknown or no event } - if ((s->r_acc.offset) && (g_stop_on_event)) { - g_stop_on_event = 0; + if ((s->r_acc.offset) && (debugState.stopOnEvent)) { + debugState.stopOnEvent = false; // A SCI event occured, and we have been asked to stop, so open the debug console GUI::Debugger *con = ((Sci::SciEngine*)g_engine)->getDebugger(); diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 7954dc5783..99665bae7d 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -93,10 +93,13 @@ reg_t kFlushResources(EngineState *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } +extern DebugState debugState; + reg_t kSetDebug(EngineState *s, int funct_nr, int argc, reg_t *argv) { sciprintf("Debug mode activated\n"); - g_debug_seeking = g_debug_step_running = 0; + debugState.seeking = kDebugSeekNothing; + debugState.runningStep = 0; return s->r_acc; } diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index 0bd1442cf4..dbcd778160 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -32,10 +32,6 @@ namespace Sci { -int g_debugstate_valid = 0; // Set to 1 while script_debug is running -int g_debug_step_running = 0; // Set to >0 to allow multiple stepping -extern int g_debug_seek_special; - extern const char *selector_name(EngineState *s, int selector); DebugState debugState; @@ -101,7 +97,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod opsize = scr[pos.offset]; opcode = opsize >> 1; - if (!g_debugstate_valid) { + if (!debugState.isValid) { sciprintf("Not in debug state\n"); return retval; } @@ -321,7 +317,7 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t * SegmentId *segids, reg_t **variables, reg_t **variables_base, int *variables_nr, int bp) { // Do we support a separate console? - int old_debugstate = g_debugstate_valid; + bool old_debugstate = debugState.isValid; debugState.p_var_segs = segids; debugState.p_vars = variables; @@ -333,15 +329,15 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t * debugState.p_objp = objp; debugState.p_restadjust = restadjust; sciprintf("%d: acc=%04x:%04x ", script_step_counter, PRINT_REG(s->r_acc)); - g_debugstate_valid = 1; + debugState.isValid = true; disassemble(s, *pc, 0, 1); - if (g_debug_seeking == kDebugSeekGlobal) - sciprintf("Global %d (0x%x) = %04x:%04x\n", g_debug_seek_special, - g_debug_seek_special, PRINT_REG(s->script_000->locals_block->_locals[g_debug_seek_special])); + if (debugState.seeking == kDebugSeekGlobal) + sciprintf("Global %d (0x%x) = %04x:%04x\n", debugState.seekSpecial, + debugState.seekSpecial, PRINT_REG(s->script_000->locals_block->_locals[debugState.seekSpecial])); - g_debugstate_valid = old_debugstate; + debugState.isValid = old_debugstate; - if (g_debug_seeking && !bp) { // Are we looking for something special? + if (debugState.seeking && !bp) { // Are we looking for something special? MemObject *mobj = GET_SEGMENT(*s->seg_manager, pc->segment, MEM_OBJ_SCRIPT); if (mobj) { @@ -353,9 +349,9 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t * int paramb1 = pc->offset + 1 >= code_buf_size ? 0 : code_buf[pc->offset + 1]; int paramf1 = (opcode & 1) ? paramb1 : (pc->offset + 2 >= code_buf_size ? 0 : (int16)READ_LE_UINT16(code_buf + pc->offset + 1)); - switch (g_debug_seeking) { + switch (debugState.seeking) { case kDebugSeekSpecialCallk: - if (paramb1 != g_debug_seek_special) + if (paramb1 != debugState.seekSpecial) return; case kDebugSeekCallk: { @@ -365,7 +361,7 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t * } case kDebugSeekLevelRet: { - if ((op != op_ret) || (g_debug_seek_level < (int)s->_executionStack.size()-1)) + if ((op != op_ret) || (debugState.seekLevel < (int)s->_executionStack.size()-1)) return; break; } @@ -377,20 +373,20 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t * return; // param or temp if ((op & 0x3) && s->_executionStack.back().local_segment > 0) return; // locals and not running in script.000 - if (paramf1 != g_debug_seek_special) + if (paramf1 != debugState.seekSpecial) return; // CORRECT global? break; } - g_debug_seeking = kDebugSeekNothing; + debugState.seeking = kDebugSeekNothing; // OK, found whatever we were looking for } } - g_debugstate_valid = (g_debug_step_running == 0); + debugState.isValid = (debugState.runningStep == 0); - if (g_debugstate_valid) { + if (debugState.isValid) { debugState.p_pc = pc; debugState.p_sp = sp; debugState.p_pp = pp; diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index cbd0b0cfbb..30b2f07edd 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -49,7 +49,7 @@ reg_t NULL_REG = {0, 0}; int script_abort_flag = 0; // Set to 1 to abort execution. Set to 2 to force a replay afterwards // FIXME: Avoid non-const global vars int script_step_counter = 0; // Counts the number of steps executed // FIXME: Avoid non-const global vars int script_gc_interval = GC_INTERVAL; // Number of steps in between gcs // FIXME: Avoid non-const global vars - +extern DebugState debugState; static bool breakpointFlag = false; // FIXME: Avoid non-const global vars static reg_t _dummy_register; // FIXME: Avoid non-const global vars @@ -396,7 +396,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt default: sciprintf("Send error: Variable selector %04x in %04x:%04x called with %04x params\n", selector, PRINT_REG(send_obj), argc); script_debug_flag = 1; // Enter debug mode - g_debug_seeking = g_debug_step_running = 0; + debugState.seeking = debugState.runningStep = 0; #endif } break; @@ -1427,8 +1427,8 @@ void run_vm(EngineState *s, int restoring) { #if 0 if (script_error_flag) { - g_debug_step_running = 0; // Stop multiple execution - g_debug_seeking = 0; // Stop special seeks + debugState.runningStep = 0; // Stop multiple execution + debugState.seeking = 0; // Stop special seeks xs->addr.pc.offset = old_pc_offset; xs->sp = old_sp; } else @@ -2057,11 +2057,12 @@ const char *obj_get_name(EngineState *s, reg_t pos) { return name; } + void quit_vm() { script_abort_flag = 1; // Terminate VM - g_debugstate_valid = 0; - g_debug_seeking = 0; - g_debug_step_running = 0; + debugState.isValid = false; + debugState.seeking = kDebugSeekNothing; + debugState.runningStep = 0; } void shrink_execution_stack(EngineState *s, uint size) { -- cgit v1.2.3 From 3190bf68f2638f51a3aceb3d3d24ca0d405e6be6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 3 Jul 2009 06:19:20 +0000 Subject: Bugfix for loading savegames where the active resource file database isn't completely filled svn-id: r42047 --- engines/cruise/saveload.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/cruise/saveload.cpp b/engines/cruise/saveload.cpp index d151950c5e..7fcc5ecb1b 100644 --- a/engines/cruise/saveload.cpp +++ b/engines/cruise/saveload.cpp @@ -898,11 +898,15 @@ Common::Error loadSavegameData(int saveGameIdx) { printf("Unsupported mono file load!\n"); ASSERT(0); //loadFileMode1(filesDatabase[j].subData.name,filesDatabase[j].subData.var4); - } else */{ + } else */ + if (strlen(filesDatabase[i].subData.name) > 0) { loadFileRange(filesDatabase[i].subData.name, filesDatabase[i].subData.index, i, j - i); - i = j - 1; + } else { + filesDatabase[i].subData.ptr = NULL; + filesDatabase[i].subData.ptrMask = NULL; } + i = j - 1; lowMemory = lowMemorySave; } } -- cgit v1.2.3 From d81bbae875ee4ef0681d16dcfd7219da80238df4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 3 Jul 2009 06:21:04 +0000 Subject: Bugfix for displaying text messages when an auto tracking (cut-scene) changes to a user wait svn-id: r42048 --- engines/cruise/cruise_main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index 938e823fe9..26f66d4433 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -1917,8 +1917,12 @@ void CruiseEngine::mainLoop(void) { char* pText = getText(autoMsg, autoOvl); - if (strlen(pText)) + if (strlen(pText)) { userWait = 1; + + mainDraw(0); + flipScreen(); + } } changeScriptParamInList(-1, -1, &relHead, 9998, 0); -- cgit v1.2.3 From f3ac0a62c47c33bfb814c89f52f6c2b50092f561 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 3 Jul 2009 07:06:48 +0000 Subject: Applied patch #2815937 - "SCI: ReadString fix to repair LSL5 password". This fixes the problems with the LSL5 password for good svn-id: r42049 --- engines/sci/engine/kfile.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index 29c9c5e336..ed18c7fcd6 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -267,6 +267,12 @@ static void fgets_wrapper(EngineState *s, char *dest, int maxsize, int handle) { return; } f->_in->readLine_NEW(dest, maxsize); + // The returned string must not have an ending LF + int strSize = strlen(dest); + if (strSize > 0) { + if (dest[strSize - 1] == 0x0A) + dest[strSize - 1] = 0; + } debugC(2, kDebugLevelFile, "FGets'ed \"%s\"\n", dest); } -- cgit v1.2.3 From 9664050ff07214ccd2ae2189475ddde80e7630ef Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 3 Jul 2009 09:01:51 +0000 Subject: Simplified the kernel name loading code: Merged the default SCI0 and SCI1 kernel name tables in one table. vocab.999 is only used in SCI0 and SCI01 games if it exists as an override to the default kernel name table (which works with SCI0/SCI01 demos with no vocab.999, like KQ1 and xmas1998). Removed GF_SCI0_SCI1VOCAB. svn-id: r42050 --- engines/sci/detection.cpp | 2 +- engines/sci/engine/kernel.cpp | 182 ++++-------------------------------------- engines/sci/sci.cpp | 6 +- engines/sci/sci.h | 11 +-- 4 files changed, 22 insertions(+), 179 deletions(-) diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index bdf2c7c72a..b8e8beb647 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -953,7 +953,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.map", 0, "59b13619078bd47011421468959ee5d4", 954}, {"resource.001", 0, "4cfb9040db152868f7cb6a1e8151c910", 296555}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH}, - GF_SCI0_SCI1VOCAB, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_0 }, diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index eafc6dbd4d..8acce8dd6a 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -38,127 +38,9 @@ namespace Sci { // Default kernel name table #define SCI0_KNAMES_WELL_DEFINED 0x6e -#define SCI0_KNAMES_DEFAULT_ENTRIES_NR 0x72 -#define SCI1_KNAMES_DEFAULT_ENTRIES_NR 0x89 +#define SCI_KNAMES_DEFAULT_ENTRIES_NR 0x89 -static const char *sci0_default_knames[SCI0_KNAMES_DEFAULT_ENTRIES_NR] = { - /*0x00*/ "Load", - /*0x01*/ "UnLoad", - /*0x02*/ "ScriptID", - /*0x03*/ "DisposeScript", - /*0x04*/ "Clone", - /*0x05*/ "DisposeClone", - /*0x06*/ "IsObject", - /*0x07*/ "RespondsTo", - /*0x08*/ "DrawPic", - /*0x09*/ "Show", - /*0x0a*/ "PicNotValid", - /*0x0b*/ "Animate", - /*0x0c*/ "SetNowSeen", - /*0x0d*/ "NumLoops", - /*0x0e*/ "NumCels", - /*0x0f*/ "CelWide", - /*0x10*/ "CelHigh", - /*0x11*/ "DrawCel", - /*0x12*/ "AddToPic", - /*0x13*/ "NewWindow", - /*0x14*/ "GetPort", - /*0x15*/ "SetPort", - /*0x16*/ "DisposeWindow", - /*0x17*/ "DrawControl", - /*0x18*/ "HiliteControl", - /*0x19*/ "EditControl", - /*0x1a*/ "TextSize", - /*0x1b*/ "Display", - /*0x1c*/ "GetEvent", - /*0x1d*/ "GlobalToLocal", - /*0x1e*/ "LocalToGlobal", - /*0x1f*/ "MapKeyToDir", - /*0x20*/ "DrawMenuBar", - /*0x21*/ "MenuSelect", - /*0x22*/ "AddMenu", - /*0x23*/ "DrawStatus", - /*0x24*/ "Parse", - /*0x25*/ "Said", - /*0x26*/ "SetSynonyms", - /*0x27*/ "HaveMouse", - /*0x28*/ "SetCursor", - /*0x29*/ "FOpen", - /*0x2a*/ "FPuts", - /*0x2b*/ "FGets", - /*0x2c*/ "FClose", - /*0x2d*/ "SaveGame", - /*0x2e*/ "RestoreGame", - /*0x2f*/ "RestartGame", - /*0x30*/ "GameIsRestarting", - /*0x31*/ "DoSound", - /*0x32*/ "NewList", - /*0x33*/ "DisposeList", - /*0x34*/ "NewNode", - /*0x35*/ "FirstNode", - /*0x36*/ "LastNode", - /*0x37*/ "EmptyList", - /*0x38*/ "NextNode", - /*0x39*/ "PrevNode", - /*0x3a*/ "NodeValue", - /*0x3b*/ "AddAfter", - /*0x3c*/ "AddToFront", - /*0x3d*/ "AddToEnd", - /*0x3e*/ "FindKey", - /*0x3f*/ "DeleteKey", - /*0x40*/ "Random", - /*0x41*/ "Abs", - /*0x42*/ "Sqrt", - /*0x43*/ "GetAngle", - /*0x44*/ "GetDistance", - /*0x45*/ "Wait", - /*0x46*/ "GetTime", - /*0x47*/ "StrEnd", - /*0x48*/ "StrCat", - /*0x49*/ "StrCmp", - /*0x4a*/ "StrLen", - /*0x4b*/ "StrCpy", - /*0x4c*/ "Format", - /*0x4d*/ "GetFarText", - /*0x4e*/ "ReadNumber", - /*0x4f*/ "BaseSetter", - /*0x50*/ "DirLoop", - /*0x51*/ "CanBeHere", - /*0x52*/ "OnControl", - /*0x53*/ "InitBresen", - /*0x54*/ "DoBresen", - /*0x55*/ "DoAvoider", - /*0x56*/ "SetJump", - /*0x57*/ "SetDebug", - /*0x58*/ "InspectObj", - /*0x59*/ "ShowSends", - /*0x5a*/ "ShowObjs", - /*0x5b*/ "ShowFree", - /*0x5c*/ "MemoryInfo", - /*0x5d*/ "StackUsage", - /*0x5e*/ "Profiler", - /*0x5f*/ "GetMenu", - /*0x60*/ "SetMenu", - /*0x61*/ "GetSaveFiles", - /*0x62*/ "GetCWD", - /*0x63*/ "CheckFreeSpace", - /*0x64*/ "ValidPath", - /*0x65*/ "CoordPri", - /*0x66*/ "StrAt", - /*0x67*/ "DeviceInfo", - /*0x68*/ "GetSaveDir", - /*0x69*/ "CheckSaveGame", - /*0x6a*/ "ShakeScreen", - /*0x6b*/ "FlushResources", - /*0x6c*/ "SinMult", - /*0x6d*/ "CosMult", - /*0x6e*/ "SinDiv", - /*0x6f*/ "CosDiv", - /*0x70*/ "Graph", - /*0x71*/ SCRIPT_UNKNOWN_FUNCTION_STRING -}; - -static const char *sci1_default_knames[SCI1_KNAMES_DEFAULT_ENTRIES_NR] = { +static const char *sci_default_knames[SCI_KNAMES_DEFAULT_ENTRIES_NR] = { /*0x00*/ "Load", /*0x01*/ "UnLoad", /*0x02*/ "ScriptID", @@ -846,18 +728,10 @@ reg_t *kernel_dereference_reg_pointer(EngineState *s, reg_t pointer, int entries return (reg_t*)_kernel_dereference_pointer(s, pointer, entries, sizeof(reg_t)); } -// Alternative kernel func names retriever. Required for KQ1/SCI (at least). -static void _vocab_get_knames0alt(const Resource *r, Common::StringList &names) { - uint idx = 0; - - while (idx < r->size) { - Common::String tmp((const char *)r->data + idx); - names.push_back(tmp); - idx += tmp.size() + 1; - } - - // The mystery kernel function- one in each SCI0 package - names.push_back(SCRIPT_UNKNOWN_FUNCTION_STRING); +void setDefaultKernelNames(Common::StringList &names) { + names.resize(SCI_KNAMES_DEFAULT_ENTRIES_NR); + for (int i = 0; i < SCI_KNAMES_DEFAULT_ENTRIES_NR; i++) + names[i] = sci_default_knames[i]; } static void vocab_get_knames0(ResourceManager *resmgr, Common::StringList &names) { @@ -865,16 +739,15 @@ static void vocab_get_knames0(ResourceManager *resmgr, Common::StringList &names Resource *r = resmgr->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_KNAMES), 0); if (!r) { // No kernel name table found? Fall back to default table - names.resize(SCI0_KNAMES_DEFAULT_ENTRIES_NR); - for (i = 0; i < SCI0_KNAMES_DEFAULT_ENTRIES_NR; i++) - names[i] = sci0_default_knames[i]; + setDefaultKernelNames(names); return; } count = READ_LE_UINT16(r->data); if (count > 1023) { - _vocab_get_knames0alt(r, names); + // Newer kernel name table, found in KQ1. We can use the default table here + setDefaultKernelNames(names); return; } @@ -898,20 +771,6 @@ static void vocab_get_knames0(ResourceManager *resmgr, Common::StringList &names } } -static void vocab_get_knames1(ResourceManager *resmgr, Common::StringList &names) { - // vocab.999/999.voc is notoriously unreliable in SCI1 games, and should not be used - // We hardcode the default SCI1 kernel names here (i.e. the ones inside the "special" - // 999.voc file from FreeSCI). All SCI1 games seem to be working with this change, but - // if any SCI1 game has different kernel vocabulary names, it might not work. It seems - // that all SCI1 games use the same kernel vocabulary names though, so this seems to be - // a safe change. If there's any SCI1 game with different kernel vocabulary names, we can - // add special flags to it to our detector - - names.resize(SCI1_KNAMES_DEFAULT_ENTRIES_NR); - for (int i = 0; i < SCI1_KNAMES_DEFAULT_ENTRIES_NR; i++) - names[i] = sci1_default_knames[i]; -} - #ifdef ENABLE_SCI32 static void vocab_get_knames11(ResourceManager *resmgr, Common::StringList &names) { /* @@ -945,27 +804,18 @@ bool Kernel::loadKernelNames() { switch (_resmgr->_sciVersion) { case SCI_VERSION_0: case SCI_VERSION_01: - // HACK: The KQ1 demo requires the SCI1 vocabulary. - if (((SciEngine*)g_engine)->getFlags() & GF_SCI0_SCI1VOCAB) - vocab_get_knames1(_resmgr, _kernelNames); - else - vocab_get_knames0(_resmgr, _kernelNames); - break; case SCI_VERSION_01_VGA: case SCI_VERSION_01_VGA_ODD: - // HACK: KQ5 needs the SCI1 default vocabulary names to work correctly. - // Having more vocabulary names (like in SCI1) doesn't seem to have any - // ill effects, other than resulting in unmapped functions towards the - // end, which are never used by the game interpreter anyway - // return vocab_get_knames0(resmgr, count); + vocab_get_knames0(_resmgr, _kernelNames); + break; case SCI_VERSION_1_EARLY: case SCI_VERSION_1_LATE: - vocab_get_knames1(_resmgr, _kernelNames); - break; case SCI_VERSION_1_1: - vocab_get_knames1(_resmgr, _kernelNames); - // KQ6CD calls unimplemented function 0x26 - _kernelNames[0x26] = "Dummy"; + setDefaultKernelNames(_kernelNames); + if (_resmgr->_sciVersion == SCI_VERSION_1_1) { + // KQ6CD calls unimplemented function 0x26 + _kernelNames[0x26] = "Dummy"; + } break; #ifdef ENABLE_SCI32 case SCI_VERSION_32: diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 9b277b058f..f58d729bf6 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -158,8 +158,7 @@ Common::Error SciEngine::run() { if (flags & GF_SCI0_OLD || flags & GF_SCI0_OLDGFXFUNCS || - flags & GF_SCI0_OLDGETTIME || - flags & GF_SCI0_SCI1VOCAB) { + flags & GF_SCI0_OLDGETTIME) { error("This game entry is erroneous. It's marked as SCI1, but it has SCI0 flags set"); } } else if (version == SCI_VERSION_1_1 || version == SCI_VERSION_32) { @@ -171,8 +170,7 @@ Common::Error SciEngine::run() { if (flags & GF_SCI0_OLD || flags & GF_SCI0_OLDGFXFUNCS || - flags & GF_SCI0_OLDGETTIME || - flags & GF_SCI0_SCI1VOCAB) { + flags & GF_SCI0_OLDGETTIME) { error("This game entry is erroneous. It's marked as SCI1.1/SCI32, but it has SCI0 flags set"); } diff --git a/engines/sci/sci.h b/engines/sci/sci.h index 18b1b93a92..91f491fe71 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -108,11 +108,6 @@ enum SciGameFlags { ** Older SCI versions had simpler code for GetTime() */ GF_SCI0_OLDGETTIME = (1 << 2), - - /* Applies to any game that requires the SCI1 kernel vocab - ** Some games (such as the King's Quest I demo) require the default kernel vocab table. - */ - GF_SCI0_SCI1VOCAB = (1 << 3), // ---------------------------------------------------------------------------- @@ -123,18 +118,18 @@ enum SciGameFlags { /* ** Used to distinguish SCI1 EGA games */ - GF_SCI1_EGA = (1 << 4), + GF_SCI1_EGA = (1 << 3), /* Applies to all SCI1 versions after 1.000.200 ** In late SCI1 versions, the argument of lofs[as] instructions ** is absolute rather than relative. */ - GF_SCI1_LOFSABSOLUTE = (1 << 5), + GF_SCI1_LOFSABSOLUTE = (1 << 4), /* Applies to all versions from 1.000.510 onwards ** kDoSound() is different than in earlier SCI1 versions. */ - GF_SCI1_NEWDOSOUND = (1 << 6) + GF_SCI1_NEWDOSOUND = (1 << 5) }; class SciEngine : public Engine { -- cgit v1.2.3 From cbea1a11935074090f737737e0a26d43cd708f89 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 3 Jul 2009 10:40:49 +0000 Subject: Added more GCC_PRINTF attributes, and fixed resulting warnings in format strings svn-id: r42054 --- engines/agos/agos.h | 2 +- engines/agos/script_e1.cpp | 2 +- engines/groovie/script.cpp | 14 ++++++++------ engines/kyra/screen_lol.h | 4 ++-- engines/kyra/text_lol.h | 2 +- engines/lure/lure.h | 2 +- engines/scumm/he/resource_he.cpp | 2 +- engines/scumm/he/script_v71he.cpp | 2 +- engines/scumm/resource.cpp | 2 +- engines/scumm/scumm.h | 10 ++++------ engines/scumm/smush/imuse_channel.cpp | 2 +- engines/scumm/sound.cpp | 2 +- engines/sky/control.cpp | 2 +- engines/sky/control.h | 2 +- engines/sword1/control.h | 2 +- gui/console.h | 2 +- 16 files changed, 27 insertions(+), 27 deletions(-) diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 1edfe54612..f6a85d498d 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -673,7 +673,7 @@ protected: void uncompressText(byte *ptr); byte *uncompressToken(byte a, byte *ptr); - void showMessageFormat(const char *s, ...); + void showMessageFormat(const char *s, ...) GCC_PRINTF(2, 3); const byte *getStringPtrByID(uint16 stringId, bool upperCase = false); const byte *getLocalStringByID(uint16 stringId); uint getNextStringID(); diff --git a/engines/agos/script_e1.cpp b/engines/agos/script_e1.cpp index 0080748699..df37a38a7c 100644 --- a/engines/agos/script_e1.cpp +++ b/engines/agos/script_e1.cpp @@ -532,7 +532,7 @@ void AGOSEngine_Elvira1::oe1_moveDirn() { void AGOSEngine_Elvira1::oe1_score() { // 90: score SubPlayer *p = (SubPlayer *)findChildOfType(me(), kPlayerType); - showMessageFormat("Your score is %ld.\n", p->score); + showMessageFormat("Your score is %d.\n", p->score); } void AGOSEngine_Elvira1::oe1_look() { diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp index df627e841c..eb53842b91 100644 --- a/engines/groovie/script.cpp +++ b/engines/groovie/script.cpp @@ -38,7 +38,9 @@ namespace Groovie { -void debugScript(int level, bool nl, const char *s, ...) { +static void debugScript(int level, bool nl, const char *s, ...) GCC_PRINTF(3, 4); + +static void debugScript(int level, bool nl, const char *s, ...) { char buf[STRINGBUFLEN]; va_list va; @@ -511,7 +513,7 @@ void Script::o_videofromref() { // 0x09 } } if (fileref != _videoRef) { - debugScript(1, true, ""); + debugScript(1, false, "\n"); } // Play the video if (!playvideofromref(fileref)) { @@ -569,7 +571,7 @@ bool Script::playvideofromref(uint32 fileref) { _eventKbdChar = 0; // Newline - debugScript(1, true, ""); + debugScript(1, false, "\n"); } // Let the caller know if the video has ended @@ -759,7 +761,7 @@ void Script::o_loadstring() { setVariable(varnum++, readScriptChar(true, true, true)); debugScript(1, false, " 0x%02X", _variables[varnum - 1]); } while (!(getCodeByte(_currentInstruction - 1) & 0x80)); - debugScript(1, true, ""); + debugScript(1, false, "\n"); } void Script::o_ret() { @@ -840,7 +842,7 @@ void Script::o_xor_obfuscate() { varnum++; } while (!_firstbit); - debugScript(1, true, ""); + debugScript(1, false, "\n"); } void Script::o_vdxtransition() { // 0x1C @@ -1095,7 +1097,7 @@ void Script::o_loadstringvar() { setVariable(varnum++, readScriptChar(true, true, true)); debugScript(1, false, " 0x%02X", _variables[varnum - 1]); } while (!(getCodeByte(_currentInstruction - 1) & 0x80)); - debugScript(1, true, ""); + debugScript(1, false, "\n"); } void Script::o_chargreatjmp() { diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h index db355977f8..2545064b58 100644 --- a/engines/kyra/screen_lol.h +++ b/engines/kyra/screen_lol.h @@ -46,8 +46,8 @@ public: int curDimIndex() { return _curDimIndex; } void modifyScreenDim(int dim, int x, int y, int w, int h); - void fprintString(const char *format, int x, int y, uint8 col1, uint8 col2, uint16 flags, ...); - void fprintStringIntro(const char *format, int x, int y, uint8 c1, uint8 c2, uint8 c3, uint16 flags, ...); + void fprintString(const char *format, int x, int y, uint8 col1, uint8 col2, uint16 flags, ...) GCC_PRINTF(2, 8); + void fprintStringIntro(const char *format, int x, int y, uint8 c1, uint8 c2, uint8 c3, uint16 flags, ...) GCC_PRINTF(2, 9); void drawGridBox(int x, int y, int w, int h, int col); void fadeClearSceneWindow(int delay); diff --git a/engines/kyra/text_lol.h b/engines/kyra/text_lol.h index 06c13e1fef..5586be730e 100644 --- a/engines/kyra/text_lol.h +++ b/engines/kyra/text_lol.h @@ -47,7 +47,7 @@ public: void resetDimTextPositions(int dim); void printDialogueText(int dim, char *str, EMCState *script, const uint16 *paramList, int16 paramIndex); - void printMessage(uint16 type, const char *str, ...); + void printMessage(uint16 type, const char *str, ...) GCC_PRINTF(3, 4); int16 _scriptParameter; diff --git a/engines/lure/lure.h b/engines/lure/lure.h index 12494870ad..e8f1a7c1e1 100644 --- a/engines/lure/lure.h +++ b/engines/lure/lure.h @@ -91,7 +91,7 @@ public: bool saveGame(uint8 slotNumber, Common::String &caption); Common::String *detectSave(int slotNumber); uint8 saveVersion() { return _saveVersion; } - void GUIError(const char *msg, ...); + void GUIError(const char *msg, ...) GCC_PRINTF(2, 3); uint32 getFeatures() const; Common::Language getLanguage() const; diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index 1b5b467512..022dbc0eb3 100644 --- a/engines/scumm/he/resource_he.cpp +++ b/engines/scumm/he/resource_he.cpp @@ -913,7 +913,7 @@ int Win32ResExtractor::convertIcons(byte *data, int datasize, byte **cursor, int if (entries[c].dib_size != bitmap.size + image_size + mask_size + palette_count * sizeof(Win32RGBQuad)) debugC(DEBUG_RESOURCE, "incorrect total size of bitmap (%d specified; %d real)", entries[c].dib_size, - bitmap.size + image_size + mask_size + palette_count * sizeof(Win32RGBQuad) + (int)(bitmap.size + image_size + mask_size + palette_count * sizeof(Win32RGBQuad)) ); image_data = (byte *)malloc(image_size); diff --git a/engines/scumm/he/script_v71he.cpp b/engines/scumm/he/script_v71he.cpp index 316d51b12d..c832d64316 100644 --- a/engines/scumm/he/script_v71he.cpp +++ b/engines/scumm/he/script_v71he.cpp @@ -59,7 +59,7 @@ byte *ScummEngine_v71he::heFindResourceData(uint32 tag, byte *ptr) { byte *ScummEngine_v71he::heFindResource(uint32 tag, byte *searchin) { uint32 curpos, totalsize, size; - debugC(DEBUG_RESOURCE, "heFindResource(%s, %lx)", tag2str(tag), searchin); + debugC(DEBUG_RESOURCE, "heFindResource(%s, %p)", tag2str(tag), (const void *)searchin); assert(searchin); searchin += 4; diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index 4638c40828..88802a205f 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -1372,7 +1372,7 @@ const byte *ResourceIterator::findNext(uint32 tag) { const byte *ScummEngine::findResource(uint32 tag, const byte *searchin) { uint32 curpos, totalsize, size; - debugC(DEBUG_RESOURCE, "findResource(%s, %lx)", tag2str(tag), searchin); + debugC(DEBUG_RESOURCE, "findResource(%s, %p)", tag2str(tag), (const void *)searchin); if (!searchin) { if (_game.heversion >= 70) { diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 9ac6f87f26..e3be053810 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -128,7 +128,7 @@ enum GameFeatures { }; /* SCUMM Debug Channels */ -void debugC(int level, const char *s, ...); +void debugC(int level, const char *s, ...) GCC_PRINTF(2, 3); enum { DEBUG_GENERAL = 1 << 0, // General debug @@ -528,7 +528,7 @@ protected: void versionDialog(); void scummMenuDialog(); - char displayMessage(const char *altButton, const char *message, ...); + char displayMessage(const char *altButton, const char *message, ...) GCC_PRINTF(3, 4); byte _fastMode; @@ -543,15 +543,13 @@ public: // VAR is a wrapper around scummVar, which attempts to include additional // useful information should an illegal var access be detected. #define VAR(x) scummVar(x, #x, __FILE__, __LINE__) - int32& scummVar(byte var, const char *varName, const char *file, int line) - { + int32& scummVar(byte var, const char *varName, const char *file, int line) { if (var == 0xFF) { error("Illegal access to variable %s in file %s, line %d", varName, file, line); } return _scummVars[var]; } - int32 scummVar(byte var, const char *varName, const char *file, int line) const - { + int32 scummVar(byte var, const char *varName, const char *file, int line) const { if (var == 0xFF) { error("Illegal access to variable %s in file %s, line %d", varName, file, line); } diff --git a/engines/scumm/smush/imuse_channel.cpp b/engines/scumm/smush/imuse_channel.cpp index e39397eded..c1167a57c1 100644 --- a/engines/scumm/smush/imuse_channel.cpp +++ b/engines/scumm/smush/imuse_channel.cpp @@ -158,7 +158,7 @@ void ImuseChannel::decode() { _sbufferSize -= remaining_size; } else { debugC(DEBUG_SMUSH, "impossible ! : %p, %d, %d, %p(%d), %p(%d, %d)", - this, _dataSize, _inData, _tbuffer, _tbufferSize, _sbuffer, _sbufferSize, _srbufferSize); + (const void *)this, _dataSize, _inData, _tbuffer, _tbufferSize, _sbuffer, _sbufferSize, _srbufferSize); byte *old = _tbuffer; int new_size = remaining_size + _tbufferSize; _tbuffer = new byte[new_size]; diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index bc3ca00571..ad48029bd2 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -1710,7 +1710,7 @@ static void convertADResource(ResourceManager *res, const GameSettings& game, in } else { dw = 500000 * 256 / ticks; } - debugC(DEBUG_SOUND, " ticks = %d, speed = %ld", ticks, dw); + debugC(DEBUG_SOUND, " ticks = %d, speed = %d", ticks, dw); // Write a tempo change Meta event memcpy(ptr, "\x00\xFF\x51\x03", 4); ptr += 4; diff --git a/engines/sky/control.cpp b/engines/sky/control.cpp index 764f3de9dd..4b5887da69 100644 --- a/engines/sky/control.cpp +++ b/engines/sky/control.cpp @@ -1115,7 +1115,7 @@ void Control::doAutoSave(void) { outf->finalize(); if (outf->err()) - displayMessage(0, "Unable to write autosave file '%s'. Disk full?", fName, _saveFileMan->popErrorDesc().c_str()); + displayMessage(0, "Unable to write autosave file '%s'. Disk full? (%s)", fName, _saveFileMan->popErrorDesc().c_str()); delete outf; free(saveData); diff --git a/engines/sky/control.h b/engines/sky/control.h index 2a3a229cb3..04ed26fefe 100644 --- a/engines/sky/control.h +++ b/engines/sky/control.h @@ -198,7 +198,7 @@ public: void saveDescriptions(const Common::StringList &list); private: - int displayMessage(const char *altButton, const char *message, ...); + int displayMessage(const char *altButton, const char *message, ...) GCC_PRINTF(3, 4); void initPanel(void); void removePanel(void); diff --git a/engines/sword1/control.h b/engines/sword1/control.h index d6adc61c3a..0193afc7f1 100644 --- a/engines/sword1/control.h +++ b/engines/sword1/control.h @@ -101,7 +101,7 @@ public: } private: - int displayMessage(const char *altButton, const char *message, ...); + int displayMessage(const char *altButton, const char *message, ...) GCC_PRINTF(3, 4); bool convertSaveGame(uint8 slot, char* desc); void showSavegameNames(void); diff --git a/gui/console.h b/gui/console.h index ae38d1d690..52c3394184 100644 --- a/gui/console.h +++ b/gui/console.h @@ -143,7 +143,7 @@ public: void handleKeyDown(Common::KeyState state); void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); - int printf(const char *format, ...); + int printf(const char *format, ...) GCC_PRINTF(2, 3); int vprintf(const char *format, va_list argptr); #undef putchar void putchar(int c); -- cgit v1.2.3 From 72512db7fb578ea47f916b7f7ef070b7a4d77694 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 3 Jul 2009 10:41:03 +0000 Subject: SCI: Fixed warning svn-id: r42055 --- engines/sci/engine/scriptdebug.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index dbcd778160..a79fec2489 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -377,6 +377,13 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t * return; // CORRECT global? break; + case kDebugSeekSO: + // FIXME: Unhandled? + break; + + case kDebugSeekNothing: + // FIXME: Unhandled? + break; } debugState.seeking = kDebugSeekNothing; -- cgit v1.2.3 From 9b3074d929d6313422677c5fa5b1bf741884e28d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 3 Jul 2009 11:05:59 +0000 Subject: If NDEBUG is #defined, then assert does nothing, leading to warnings about 'old_size' not being used -> fix that svn-id: r42056 --- common/hashmap.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/hashmap.h b/common/hashmap.h index fa613782cf..f5059a4bcf 100644 --- a/common/hashmap.h +++ b/common/hashmap.h @@ -383,7 +383,9 @@ template void HashMap::expandStorage(uint newCapacity) { assert(newCapacity > _mask+1); +#ifndef NDEBUG const uint old_size = _size; +#endif const uint old_mask = _mask; Node **old_storage = _storage; -- cgit v1.2.3 From 69da51e71d71bb700a4e5e5419f64f482cb9fabc Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 3 Jul 2009 14:18:20 +0000 Subject: Replaced all calls for manipulating the mouse cursor to be made to the CursorManager instead of directly to the graphics backend svn-id: r42060 --- engines/sci/engine/kgraphics.cpp | 5 +++-- engines/sci/gfx/gfx_driver.cpp | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 2856c76aa3..c2777d9b0e 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -25,6 +25,7 @@ #include "common/system.h" #include "common/events.h" +#include "graphics/cursorman.h" #include "sci/sci.h" #include "sci/debug.h" // for g_debug_sleeptime_factor @@ -306,14 +307,14 @@ reg_t kSetCursor(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (s->_version < SCI_VERSION_1_1) { if (argv[0].toSint16() <= 1) { // Newer (SCI1.1) semantics: show/hide cursor - g_system->showMouse(argv[0].toSint16() != 0); + CursorMan.showMouse(argv[0].toSint16() != 0); } else { // Pre-SCI1.1: set cursor according to the first parameter GFX_ASSERT(gfxop_set_pointer_cursor(s->gfx_state, argv[0].toSint16())); } } else { // SCI1.1: Show/hide cursor - g_system->showMouse(argv[0].toSint16() != 0); + CursorMan.showMouse(argv[0].toSint16() != 0); } break; case 2 : diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp index 961eecc6fd..3420472943 100644 --- a/engines/sci/gfx/gfx_driver.cpp +++ b/engines/sci/gfx/gfx_driver.cpp @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/system.h" +#include "graphics/cursorman.h" #include "graphics/primitives.h" #include "sci/sci.h" @@ -252,7 +253,7 @@ byte *GfxDriver::createCursor(gfx_pixmap_t *pointer) { int GfxDriver::setPointer(gfx_pixmap_t *pointer, Common::Point *hotspot) { if ((pointer == NULL) || (hotspot == NULL)) { - g_system->showMouse(false); + CursorMan.showMouse(false); } else { byte *cursorData = createCursor(pointer); @@ -266,8 +267,8 @@ int GfxDriver::setPointer(gfx_pixmap_t *pointer, Common::Point *hotspot) { if (!pointer->palette) color_key = 63; - g_system->setMouseCursor(cursorData, pointer->width, pointer->height, hotspot->x, hotspot->y, color_key); - g_system->showMouse(true); + CursorMan.replaceCursor(cursorData, pointer->width, pointer->height, hotspot->x, hotspot->y, color_key); + CursorMan.showMouse(true); delete[] cursorData; cursorData = 0; -- cgit v1.2.3 From 6fa8541aed68e72fd4f1cdeb13a46ec95547b275 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 3 Jul 2009 14:22:50 +0000 Subject: - Pushed debugstate into debug.h - When an error occurs, manipulate the execution stack before error() opens the console inside getDebugger(), like FreeSCI did. Added another method for obtaining the SCI console for use by the engine itself. svn-id: r42062 --- engines/sci/console.cpp | 3 +-- engines/sci/console.h | 1 + engines/sci/debug.h | 15 +++++++++------ engines/sci/engine/grammar.cpp | 4 ++-- engines/sci/engine/kevent.cpp | 6 ++---- engines/sci/engine/kmisc.cpp | 2 -- engines/sci/engine/vm.cpp | 18 +++--------------- engines/sci/gfx/operations.cpp | 5 +++-- engines/sci/sci.cpp | 13 +++++++++++++ engines/sci/sci.h | 1 + engines/sci/tools.cpp | 2 +- engines/sci/vocabulary.cpp | 4 ++-- 12 files changed, 38 insertions(+), 36 deletions(-) diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 002acbae86..bf919c3a25 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -50,7 +50,6 @@ int g_debug_sleeptime_factor = 1; int g_debug_simulated_key = 0; bool g_debug_track_mouse_clicks = false; bool g_debug_weak_validations = true; -extern DebugState debugState; Console::Console(SciEngine *vm) : GUI::Debugger() { _vm = vm; @@ -1598,7 +1597,7 @@ bool Console::cmdGCObjects(int argc, const char **argv) { void _print_address(void * _, reg_t addr) { if (addr.segment) - ((SciEngine *)g_engine)->getDebugger()->DebugPrintf(" %04x:%04x\n", PRINT_REG(addr)); + ((SciEngine *)g_engine)->getSciDebugger()->DebugPrintf(" %04x:%04x\n", PRINT_REG(addr)); } bool Console::cmdGCShowReachable(int argc, const char **argv) { diff --git a/engines/sci/console.h b/engines/sci/console.h index c45202de16..84a8d2f942 100644 --- a/engines/sci/console.h +++ b/engines/sci/console.h @@ -154,6 +154,7 @@ private: private: SciEngine *_vm; + bool _mouseVisible; }; } // End of namespace Sci diff --git a/engines/sci/debug.h b/engines/sci/debug.h index 60bf938300..fbd98e0d6f 100644 --- a/engines/sci/debug.h +++ b/engines/sci/debug.h @@ -28,12 +28,6 @@ namespace Sci { -// Various global variables used for debugging are declared here -extern int g_debug_sleeptime_factor; -extern int g_debug_simulated_key; -extern bool g_debug_track_mouse_clicks; -extern bool g_debug_weak_validations; - enum DebugSeeking { kDebugSeekNothing = 0, kDebugSeekCallk = 1, // Step forward until callk is found @@ -50,6 +44,8 @@ struct DebugState { int runningStep; // Set to > 0 to allow multiple stepping int seekLevel; // Used for seekers that want to check their exec stack depth int seekSpecial; // Used for special seeks + int old_pc_offset; + StackPtr old_sp; reg_t *p_pc; StackPtr *p_sp; StackPtr *p_pp; @@ -61,6 +57,13 @@ struct DebugState { int *p_var_max; // May be NULL even in valid state! }; +// Various global variables used for debugging are declared here +extern int g_debug_sleeptime_factor; +extern int g_debug_simulated_key; +extern bool g_debug_track_mouse_clicks; +extern bool g_debug_weak_validations; +extern DebugState debugState; + } // End of namespace Sci #endif diff --git a/engines/sci/engine/grammar.cpp b/engines/sci/engine/grammar.cpp index 275a31a0d4..e75441432d 100644 --- a/engines/sci/engine/grammar.cpp +++ b/engines/sci/engine/grammar.cpp @@ -351,7 +351,7 @@ parse_rule_list_t *Vocabulary::buildGNF(bool verbose) { int ntrules_nr; parse_rule_list_t *ntlist = NULL; parse_rule_list_t *tlist, *new_tlist; - GUI::Debugger *con = ((SciEngine *)g_engine)->getDebugger(); + Console *con = ((SciEngine *)g_engine)->getSciDebugger(); for (uint i = 1; i < _parserBranches.size(); i++) { // branch rule 0 is treated specially parse_rule_t *rule = _vbuild_rule(&_parserBranches[i]); @@ -477,7 +477,7 @@ static int _vbpt_write_subexpression(parse_tree_node_t *nodes, int *pos, parse_r } int Vocabulary::parseGNF(parse_tree_node_t *nodes, const ResultWordList &words, bool verbose) { - GUI::Debugger *con = ((SciEngine *)g_engine)->getDebugger(); + Console *con = ((SciEngine *)g_engine)->getSciDebugger(); // Get the start rules: parse_rule_list_t *work = _vocab_clone_rule_list_by_id(_parserRules, _parserBranches[0].data[1]); parse_rule_list_t *results = NULL; diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index 3b37506e6c..e40368a5c0 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -33,8 +33,6 @@ namespace Sci { -extern DebugState debugState; - #define SCI_VARIABLE_GAME_SPEED 3 reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv) { @@ -112,7 +110,7 @@ reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv) { // track left buttton clicks, if requested if (e.type == SCI_EVT_MOUSE_PRESS && e.data == 1 && g_debug_track_mouse_clicks) { - ((SciEngine *)g_engine)->getDebugger()->DebugPrintf("Mouse clicked at %d, %d\n", + ((SciEngine *)g_engine)->getSciDebugger()->DebugPrintf("Mouse clicked at %d, %d\n", s->gfx_state->pointer_pos.x, s->gfx_state->pointer_pos.y); } @@ -143,7 +141,7 @@ reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv) { debugState.stopOnEvent = false; // A SCI event occured, and we have been asked to stop, so open the debug console - GUI::Debugger *con = ((Sci::SciEngine*)g_engine)->getDebugger(); + Console *con = ((Sci::SciEngine*)g_engine)->getSciDebugger(); con->DebugPrintf("SCI event occured: "); switch (e.type) { case SCI_EVT_QUIT: diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 99665bae7d..98fba97f0e 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -93,8 +93,6 @@ reg_t kFlushResources(EngineState *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -extern DebugState debugState; - reg_t kSetDebug(EngineState *s, int funct_nr, int argc, reg_t *argv) { sciprintf("Debug mode activated\n"); diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 30b2f07edd..44b119ab46 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -49,7 +49,6 @@ reg_t NULL_REG = {0, 0}; int script_abort_flag = 0; // Set to 1 to abort execution. Set to 2 to force a replay afterwards // FIXME: Avoid non-const global vars int script_step_counter = 0; // Counts the number of steps executed // FIXME: Avoid non-const global vars int script_gc_interval = GC_INTERVAL; // Number of steps in between gcs // FIXME: Avoid non-const global vars -extern DebugState debugState; static bool breakpointFlag = false; // FIXME: Avoid non-const global vars static reg_t _dummy_register; // FIXME: Avoid non-const global vars @@ -606,14 +605,12 @@ void run_vm(EngineState *s, int restoring) { while (1) { byte opcode; - int old_pc_offset; - StackPtr old_sp; byte opnumber; int var_type; // See description below int var_number; - old_pc_offset = xs->addr.pc.offset; - old_sp = xs->sp; + debugState.old_pc_offset = xs->addr.pc.offset; + debugState.old_sp = xs->sp; if (s->_executionStackPosChanged) { Script *scr; @@ -1424,16 +1421,7 @@ void run_vm(EngineState *s, int restoring) { opnumber); } //#endif - -#if 0 - if (script_error_flag) { - debugState.runningStep = 0; // Stop multiple execution - debugState.seeking = 0; // Stop special seeks - xs->addr.pc.offset = old_pc_offset; - xs->sp = old_sp; - } else -#endif - ++script_step_counter; + ++script_step_counter; } } diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index 7496c55868..82b5e78117 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -1418,8 +1418,9 @@ static sci_event_t scummvm_get_event(GfxDriver *drv) { // Debug console if (ev.kbd.flags == Common::KBD_CTRL && ev.kbd.keycode == Common::KEYCODE_d) { // Open debug console - ((Sci::SciEngine*)g_engine)->getDebugger()->attach(); - ((Sci::SciEngine*)g_engine)->getDebugger()->onFrame(); + Console *con = ((Sci::SciEngine*)g_engine)->getSciDebugger(); + con->attach(); + con->onFrame(); // Clear keyboard event input.type = SCI_EVT_NONE; diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index f58d729bf6..aa9e2415f5 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -29,6 +29,7 @@ #include "engines/advancedDetector.h" #include "sci/sci.h" +#include "sci/debug.h" #include "sci/console.h" #include "sci/engine/state.h" @@ -254,7 +255,19 @@ Common::Error SciEngine::run() { return Common::kNoError; } +// Invoked by error() when a severe error occurs GUI::Debugger *SciEngine::getDebugger() { + ExecStack *xs = &(_gamestate->_executionStack.back()); + debugState.runningStep = 0; // Stop multiple execution + debugState.seeking = kDebugSeekNothing; // Stop special seeks + xs->addr.pc.offset = debugState.old_pc_offset; + xs->sp = debugState.old_sp; + + return _console; +} + +// Used to obtain the engine's console in order to print messages to it +Console *SciEngine::getSciDebugger() { return _console; } diff --git a/engines/sci/sci.h b/engines/sci/sci.h index 91f491fe71..b68301546d 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -142,6 +142,7 @@ public: virtual Common::Error run(); void pauseEngineIntern(bool pause); virtual GUI::Debugger *getDebugger(); + Console *getSciDebugger(); const char* getGameID() const; int getResourceVersion() const; diff --git a/engines/sci/tools.cpp b/engines/sci/tools.cpp index 589ce298d7..d0e11aca09 100644 --- a/engines/sci/tools.cpp +++ b/engines/sci/tools.cpp @@ -70,7 +70,7 @@ void sciprintf(const char *fmt, ...) { // Display the result suitably if (g_redirect_sciprintf_to_gui) - ((SciEngine *)g_engine)->getDebugger()->DebugPrintf("%s", buf); + ((SciEngine *)g_engine)->getSciDebugger()->DebugPrintf("%s", buf); printf("%s", buf); free(buf); diff --git a/engines/sci/vocabulary.cpp b/engines/sci/vocabulary.cpp index c877053060..6616ac362d 100644 --- a/engines/sci/vocabulary.cpp +++ b/engines/sci/vocabulary.cpp @@ -438,7 +438,7 @@ bool Vocabulary::tokenizeString(ResultWordList &retval, const char *sentence, ch void Vocabulary::printSuffixes() const { char word_buf[256], alt_buf[256]; - GUI::Debugger *con = ((SciEngine *)g_engine)->getDebugger(); + Console *con = ((SciEngine *)g_engine)->getSciDebugger(); int i = 0; for (SuffixList::const_iterator suf = _parserSuffixes.begin(); suf != _parserSuffixes.end(); ++suf) { @@ -453,7 +453,7 @@ void Vocabulary::printSuffixes() const { } void Vocabulary::printParserWords() const { - GUI::Debugger *con = ((SciEngine *)g_engine)->getDebugger(); + Console *con = ((SciEngine *)g_engine)->getSciDebugger(); int j = 0; for (WordMap::iterator i = _parserWords.begin(); i != _parserWords.end(); ++i) { -- cgit v1.2.3 From 9a96b20cd0c30dd8b1788637ae8b8b4bb4e5ca38 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 3 Jul 2009 21:59:07 +0000 Subject: Replaced script_error and CORE_ERROR with error() svn-id: r42079 --- engines/sci/engine/vm.cpp | 51 ++++++++++++++++------------------------------- 1 file changed, 17 insertions(+), 34 deletions(-) diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 44b119ab46..92f890512a 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -186,12 +186,6 @@ static void validate_write_var(reg_t *r, reg_t *stack_base, int type, int max, i #define OBJ_PROPERTY(o, p) (validate_property(o, p)) -int script_error(EngineState *s, const char *file, int line, const char *reason) { - error("Script error in file %s, line %d: %s\n", file, line, reason); - return 0; -} -#define CORE_ERROR(area, msg) script_error(s, "[" area "] " __FILE__, __LINE__, msg) - reg_t get_class_address(EngineState *s, int classnr, SCRIPT_GET lock, reg_t caller) { if (NULL == s) { @@ -308,8 +302,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt argc = validate_arithmetic(*argp); if (argc > 0x800) { // More arguments than the stack could possibly accomodate for - CORE_ERROR("SEND", "More than 0x800 arguments to function call\n"); - return NULL; + error("send_selector(): More than 0x800 arguments to function call"); } // Check if a breakpoint is set on this method @@ -574,8 +567,7 @@ void run_vm(EngineState *s, int restoring) { const byte *code_buf = NULL; // (Avoid spurious warning) if (!local_script) { - script_error(s, __FILE__, __LINE__, "Program Counter gone astray"); - return; + error("run_vm(): program counter gone astray (local_script pointer is null)"); } if (!restoring) @@ -685,12 +677,12 @@ void run_vm(EngineState *s, int restoring) { #ifndef DISABLE_VALIDATIONS if (xs->sp < xs->fp) - script_error(s, "[VM] "__FILE__, __LINE__, "Stack underflow"); + error("run_vm(): stack underflow"); variables_max[VAR_TEMP] = xs->sp - xs->fp; if (xs->addr.pc.offset >= code_buf_size) - script_error(s, "[VM] "__FILE__, __LINE__, "Program Counter gone astray"); + error("run_vm(): program counter gone astray"); #endif opcode = GET_OP_BYTE(); // Get opcode @@ -1103,7 +1095,7 @@ void run_vm(EngineState *s, int restoring) { r_temp = get_class_address(s, opparams[0], SCRIPT_GET_LOAD, xs->addr.pc); if (!r_temp.segment) - CORE_ERROR("VM", "Invalid superclass in object"); + error("[VM]: Invalid superclass in object"); else { s_temp = xs->sp; xs->sp -= ((opparams[1] >> 1) + restadjust); // Adjust stack @@ -1407,7 +1399,7 @@ void run_vm(EngineState *s, int restoring) { break; default: - script_error(s, __FILE__, __LINE__, "Illegal opcode"); + error("run_vm(): illegal opcode %x", opnumber); } // switch(opcode >> 1) @@ -1506,9 +1498,8 @@ SelectorType lookup_selector(EngineState *s, reg_t obj_location, Selector select selector_id &= ~1; if (!obj) { - CORE_ERROR("SLC-LU", "Attempt to send to non-object or invalid script"); - sciprintf("Address was %04x:%04x\n", PRINT_REG(obj_location)); - return kSelectorNone; + error("lookup_selector(): Attempt to send to non-object or invalid script. Address was %04x:%04x", + PRINT_REG(obj_location)); } if (IS_CLASS(obj)) @@ -1518,9 +1509,8 @@ SelectorType lookup_selector(EngineState *s, reg_t obj_location, Selector select if (!obj) { - CORE_ERROR("SLC-LU", "Error while looking up Species class"); - sciprintf("Original address was %04x:%04x\n", PRINT_REG(obj_location)); - sciprintf("Species address was %04x:%04x\n", PRINT_REG(obj->_variables[SCRIPT_SPECIES_SELECTOR])); + error("lookup_selector(): Error while looking up Species class.\nOriginal address was %04x:%04x. Species address was %04x:%04x\n", + PRINT_REG(obj_location), PRINT_REG(obj->_variables[SCRIPT_SPECIES_SELECTOR])); return kSelectorNone; } @@ -1560,31 +1550,24 @@ reg_t script_lookup_export(EngineState *s, int script_nr, int export_index) { Script *script = NULL; #ifndef DISABLE_VALIDATIONS - if (!seg) { - CORE_ERROR("EXPORTS", "Script invalid or not loaded"); - sciprintf("Script was script.%03d (0x%x)\n", - script_nr, script_nr); - return NULL_REG; - } + if (!seg) + error("script_lookup_export(): script.%03d (0x%x) is invalid or not loaded", + script_nr, script_nr); #endif script = script_locate_by_segment(s, seg); #ifndef DISABLE_VALIDATIONS - if (script - && export_index < script->exports_nr - && export_index >= 0) + if (script && export_index < script->exports_nr && export_index >= 0) #endif return make_reg(seg, READ_LE_UINT16((byte *)(script->export_table + export_index))); #ifndef DISABLE_VALIDATIONS else { - CORE_ERROR("EXPORTS", "Export invalid or script missing "); if (!script) - sciprintf("(script.%03d missing)\n", script_nr); + error("script_lookup_export(): script.%03d missing", script_nr); else - sciprintf("(script.%03d: Sought export %d/%d)\n", - script_nr, export_index, script->exports_nr); - return NULL_REG; + error("script_lookup_export(): script.%03d: Sought invalid export %d/%d", + script_nr, export_index, script->exports_nr); } #endif } -- cgit v1.2.3 From df9570cb3265f4d81ac41d66d949355491e2df7e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 3 Jul 2009 23:37:08 +0000 Subject: SCI0 games using older graphics functions are automatically detected now, from the presence of the "TimesSin" and "SinMult" kernel functions. Removed the GF_SCI0_OLDGFXFUNCS game flag svn-id: r42081 --- engines/sci/detection.cpp | 26 ++++++++++++-------------- engines/sci/engine/game.cpp | 2 +- engines/sci/engine/kernel.cpp | 4 ++++ engines/sci/engine/kernel.h | 9 +++++++++ engines/sci/engine/kgraphics.cpp | 12 ++++++------ engines/sci/sci.cpp | 2 -- engines/sci/sci.h | 16 ++++------------ 7 files changed, 36 insertions(+), 35 deletions(-) diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index b8e8beb647..f04c390944 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -31,9 +31,7 @@ namespace Sci { -// The 4 SCI0 engine generations (pre-395, pre-502, pre-629 and post-629) -#define GF_FOR_SCI0_BEFORE_395 (GF_SCI0_OLD | GF_SCI0_OLDGFXFUNCS | GF_SCI0_OLDGETTIME) -#define GF_FOR_SCI0_BEFORE_502 (GF_SCI0_OLDGFXFUNCS | GF_SCI0_OLDGETTIME) +#define GF_FOR_SCI0_BEFORE_395 (GF_SCI0_OLD | GF_SCI0_OLDGETTIME) #define GF_FOR_SCI0_BEFORE_629 GF_SCI0_OLDGETTIME // SCI1 @@ -134,7 +132,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.map", 0, "f3d1be7752d30ba60614533d531e2e98", 474}, {"resource.001", 0, "6fd05926c2199af0af6f72f90d0d7260", 126895}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI0_BEFORE_502, + GF_FOR_SCI0_BEFORE_629, SCI_VERSION_AUTODETECT, SCI_VERSION_0 }, @@ -1578,7 +1576,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.map", 0, "03dba704bb77da55a91ad27b5a3cac09", 528}, {"resource.001", 0, "9f5520f0297206928df0b0b36493cd33", 127532}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH}, - GF_FOR_SCI0_BEFORE_502, + GF_FOR_SCI0_BEFORE_629, SCI_VERSION_AUTODETECT, SCI_VERSION_0 }, @@ -1594,7 +1592,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.005", 0, "4a24443a25e2b1492462a52809605dc2", 277732}, {"resource.006", 0, "4a24443a25e2b1492462a52809605dc2", 345683}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI0_BEFORE_502, + GF_FOR_SCI0_BEFORE_629, SCI_VERSION_AUTODETECT, SCI_VERSION_0 }, @@ -2272,7 +2270,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.map", 0, "8b77d0d4650c2052b356cece28294b58", 576}, {"resource.001", 0, "376ef6d6eaaeed66e1424bd219c4b9ab", 215398}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH}, - GF_FOR_SCI0_BEFORE_502, + GF_FOR_SCI0_BEFORE_629, SCI_VERSION_AUTODETECT, SCI_VERSION_0 }, @@ -2288,7 +2286,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.005", 0, "77f02def3094af804fd2371db25b7100", 349899}, {"resource.006", 0, "77f02def3094af804fd2371db25b7100", 354991}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI0_BEFORE_502, + GF_FOR_SCI0_BEFORE_629, SCI_VERSION_AUTODETECT, SCI_VERSION_0 }, @@ -2301,7 +2299,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "77f02def3094af804fd2371db25b7100", 546000}, {"resource.003", 0, "77f02def3094af804fd2371db25b7100", 591851}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI0_BEFORE_502, + GF_FOR_SCI0_BEFORE_629, SCI_VERSION_AUTODETECT, SCI_VERSION_0 }, @@ -2314,7 +2312,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "77f02def3094af804fd2371db25b7100", 542897}, {"resource.003", 0, "77f02def3094af804fd2371db25b7100", 586857}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI0_BEFORE_502, + GF_FOR_SCI0_BEFORE_629, SCI_VERSION_AUTODETECT, SCI_VERSION_0 }, @@ -2914,7 +2912,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.003", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 746496}, {"resource.004", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 761984}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI0_BEFORE_502, + GF_FOR_SCI0_BEFORE_629, SCI_VERSION_0, SCI_VERSION_0 }, @@ -2941,7 +2939,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.map", 0, "ec66ac2b1ce58b2575ba00b65058de1a", 612}, {"resource.001", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 180245}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH}, - GF_FOR_SCI0_BEFORE_502, + GF_FOR_SCI0_BEFORE_629, SCI_VERSION_AUTODETECT, SCI_VERSION_0 }, @@ -2954,7 +2952,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 720244}, {"resource.003", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 688367}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI0_BEFORE_502, + GF_FOR_SCI0_BEFORE_629, SCI_VERSION_AUTODETECT, SCI_VERSION_0 }, @@ -2984,7 +2982,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.006", 0, "9107c2aa5398e28b5c5406df13491f85", 320643}, {"resource.007", 0, "9107c2aa5398e28b5c5406df13491f85", 344287}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI0_BEFORE_502, + GF_FOR_SCI0_BEFORE_629, SCI_VERSION_AUTODETECT, SCI_VERSION_0 }, diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index bbb29ada3b..a1e2c24955 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -89,7 +89,7 @@ int _reset_graphics_input(EngineState *s) { s->priority_first = 42; // Priority zone 0 ends here - if (s->_flags & GF_SCI0_OLDGFXFUNCS) + if (s->_kernel->usesOldGfxFunctions()) s->priority_last = 200; else s->priority_last = 190; diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 8acce8dd6a..b03a073d8f 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -369,6 +369,10 @@ Kernel::Kernel(ResourceManager *resmgr, bool isOldSci0) : _resmgr(resmgr) { // Map a few special selectors for later use mapSelectors(); + + // SCI0 games using old graphics functions (before version 0.000.502) have the TimesSin + // kernel function, whereas newer games have the SinMult kernel function in its place + _oldGfxFunctions = !hasKernelFunction("SinMult"); } Kernel::~Kernel() { diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index 46913a5b39..e3ecddca26 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -83,6 +83,14 @@ public: */ bool hasKernelFunction(const char *functionName) const; + /* Applies to all versions before 0.000.502 + ** Old SCI versions used to interpret the third DrawPic() parameter inversely, + ** with the opposite default value (obviously). + ** Also, they used 15 priority zones from 42 to 200 instead of 14 priority + ** zones from 42 to 190. + */ + bool usesOldGfxFunctions() const { return _oldGfxFunctions; } + // Script dissection/dumping functions void dissectScript(int scriptNumber, Vocabulary *vocab); void dumpScriptObject(char *data, int seeker, int objsize); @@ -126,6 +134,7 @@ private: bool loadOpcodes(); ResourceManager *_resmgr; + bool _oldGfxFunctions; // Kernel-related lists /** diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index c2777d9b0e..6e737597d6 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -164,7 +164,7 @@ int _find_view_priority(EngineState *s, int y) { return j; return 14; // Maximum } else { - if (!(s->_flags & GF_SCI0_OLDGFXFUNCS)) + if (!s->_kernel->usesOldGfxFunctions()) return SCI0_VIEW_PRIORITY_14_ZONES(y); else return SCI0_VIEW_PRIORITY(y) == 15 ? 14 : SCI0_VIEW_PRIORITY(y); @@ -172,7 +172,7 @@ int _find_view_priority(EngineState *s, int y) { } int _find_priority_band(EngineState *s, int nr) { - if (!(s->_flags & GF_SCI0_OLDGFXFUNCS) && (nr < 0 || nr > 14)) { + if (!s->_kernel->usesOldGfxFunctions() && (nr < 0 || nr > 14)) { if (nr == 15) return 0xffff; else { @@ -181,7 +181,7 @@ int _find_priority_band(EngineState *s, int nr) { return 0; } - if ((s->_flags & GF_SCI0_OLDGFXFUNCS) && (nr < 0 || nr > 15)) { + if (s->_kernel->usesOldGfxFunctions() && (nr < 0 || nr > 15)) { warning("Attempt to get priority band %d", nr); return 0; } @@ -191,7 +191,7 @@ int _find_priority_band(EngineState *s, int nr) { else { int retval; - if (!(s->_flags & GF_SCI0_OLDGFXFUNCS)) + if (!s->_kernel->usesOldGfxFunctions()) retval = SCI0_PRIORITY_BAND_FIRST_14_ZONES(nr); else retval = SCI0_PRIORITY_BAND_FIRST(nr); @@ -998,7 +998,7 @@ reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) { gfx_color_t transparent = s->wm_port->_bgcolor; int picFlags = DRAWPIC01_FLAG_FILL_NORMALLY; - if (s->_flags & GF_SCI0_OLDGFXFUNCS) + if (s->_kernel->usesOldGfxFunctions()) add_to_pic = (argc > 2) ? argv[2].toSint16() : false; dp.nr = argv[0].toSint16(); @@ -1052,7 +1052,7 @@ reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) { s->priority_first = 42; - if (s->_flags & GF_SCI0_OLDGFXFUNCS) + if (s->_kernel->usesOldGfxFunctions()) s->priority_last = 200; else s->priority_last = 190; diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index aa9e2415f5..4e453e7af6 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -158,7 +158,6 @@ Common::Error SciEngine::run() { // SCI1 if (flags & GF_SCI0_OLD || - flags & GF_SCI0_OLDGFXFUNCS || flags & GF_SCI0_OLDGETTIME) { error("This game entry is erroneous. It's marked as SCI1, but it has SCI0 flags set"); } @@ -170,7 +169,6 @@ Common::Error SciEngine::run() { } if (flags & GF_SCI0_OLD || - flags & GF_SCI0_OLDGFXFUNCS || flags & GF_SCI0_OLDGETTIME) { error("This game entry is erroneous. It's marked as SCI1.1/SCI32, but it has SCI0 flags set"); } diff --git a/engines/sci/sci.h b/engines/sci/sci.h index b68301546d..ea50976df4 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -96,18 +96,10 @@ enum SciGameFlags { */ GF_SCI0_OLD = (1 << 0), - /* Applies to all versions before 0.000.502 - ** Old SCI versions used to interpret the third DrawPic() parameter inversely, - ** with the opposite default value (obviously). - ** Also, they used 15 priority zones from 42 to 200 instead of 14 priority - ** zones from 42 to 190. - */ - GF_SCI0_OLDGFXFUNCS = (1 << 1), - /* Applies to all versions before 0.000.629 ** Older SCI versions had simpler code for GetTime() */ - GF_SCI0_OLDGETTIME = (1 << 2), + GF_SCI0_OLDGETTIME = (1 << 1), // ---------------------------------------------------------------------------- @@ -118,18 +110,18 @@ enum SciGameFlags { /* ** Used to distinguish SCI1 EGA games */ - GF_SCI1_EGA = (1 << 3), + GF_SCI1_EGA = (1 << 2), /* Applies to all SCI1 versions after 1.000.200 ** In late SCI1 versions, the argument of lofs[as] instructions ** is absolute rather than relative. */ - GF_SCI1_LOFSABSOLUTE = (1 << 4), + GF_SCI1_LOFSABSOLUTE = (1 << 3), /* Applies to all versions from 1.000.510 onwards ** kDoSound() is different than in earlier SCI1 versions. */ - GF_SCI1_NEWDOSOUND = (1 << 5) + GF_SCI1_NEWDOSOUND = (1 << 4) }; class SciEngine : public Engine { -- cgit v1.2.3 From 230e7a8d2cf422d4956b089f779632de6cecf171 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 4 Jul 2009 11:24:09 +0000 Subject: Newer DoSound() semantics are now detected automatically, by the existence of the "setVol" selector. Removed game flag GF_SCI1_NEWDOSOUND svn-id: r42087 --- engines/sci/detection.cpp | 91 +++++++++++++++++++++---------------------- engines/sci/engine/ksound.cpp | 2 +- engines/sci/engine/script.cpp | 1 + engines/sci/engine/vm.h | 1 + engines/sci/sci.cpp | 6 +-- engines/sci/sci.h | 7 +--- 6 files changed, 51 insertions(+), 57 deletions(-) diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index f04c390944..76c2bc0153 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -36,7 +36,6 @@ namespace Sci { // SCI1 #define GF_FOR_SCI1_200_OR_LATER GF_SCI1_LOFSABSOLUTE -#define GF_FOR_SCI1_510_OR_LATER (GF_SCI1_LOFSABSOLUTE | GF_SCI1_NEWDOSOUND) // Titles of the games static const PlainGameDescriptor SciGameTitles[] = { @@ -147,7 +146,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "d226d7d3b4f77c4a566913fc310487fc", 792380}, {"resource.003", 0, "d226d7d3b4f77c4a566913fc310487fc", 464348}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -162,7 +161,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "85e51acb5f9c539d66e3c8fe40e17da5", 826309}, {"resource.003", 0, "85e51acb5f9c539d66e3c8fe40e17da5", 493638}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -188,7 +187,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.001", 0, "d2f5a1be74ed963fa849a76892be5290", 794832}, {"resource.002", 0, "c0c29c51af66d65cb53f49e785a2d978", 1280907}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -200,7 +199,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "27ec5fa09cd12a7fd16e86d96a2ed245", 1197694}, {"resource.001", 0, "735be4e58957180cfc807d5e18fdffcd", 1433302}, {NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -382,7 +381,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.005", 0, "1c3804e56b114028c5873a35c2f06d13", 653002}, {"resource.006", 0, "f9487732289a4f4966b4e34eea413325", 842817}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -399,7 +398,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.005", 0, "d036df0872f2db19bca34601276be2d7", 1154950}, {"resource.006", 0, "b367a6a59f29ee30dde1d88a5a41152d", 1042966}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -416,7 +415,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "9cfce07e204a329e94fda8b5657621da", 1261462}, {"resource.005", 0, "21ebe6b39b57a73fc449f67f013765aa", 1284720}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -432,7 +431,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "9cfce07e204a329e94fda8b5657621da", 1260237}, {"resource.005", 0, "21ebe6b39b57a73fc449f67f013765aa", 1284609}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -449,7 +448,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.005", 0, "58942b1aa6d6ffeb66e9f8897fd4435f", 469243}, {"resource.006", 0, "8c767b3939add63d11274065e46aad04", 713158}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER | GF_SCI1_EGA, + GF_FOR_SCI1_200_OR_LATER | GF_SCI1_EGA, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -477,7 +476,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.005", 0, "d036df0872f2db19bca34601276be2d7", 1176914}, {"resource.006", 0, "b367a6a59f29ee30dde1d88a5a41152d", 1123585}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -514,7 +513,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "28fe9b4f0567e71feb198bc9f3a2c605", 1241816}, {"resource.003", 0, "f3146df0ad4297f5ce35aa8c4753bf6c", 586832}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -528,7 +527,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "323b3b12f43d53f27d259beb225f0aa7", 1129316}, {"resource.003", 0, "83ac03e4bddb2c1ac2d36d2a587d0536", 1145616}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -542,7 +541,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "02d7d0411f7903aacb3bc8b0f8ca8a9a", 1202581}, {"resource.003", 0, "84dd11b6825255671c703aee5ceff620", 1175835}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -557,7 +556,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "2d21a1d2dcbffa551552e3e0725d2284", 1186033}, {"resource.003", 0, "84dd11b6825255671c703aee5ceff620", 1174993}, {NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -874,7 +873,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "595b6039ea1356e7f96a52c58eedcf22", 355791}, {"resource.001", 0, "143df8aef214a2db34c2d48190742012", 632273}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -887,7 +886,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.map", 0, "0d06cacc87dc21a08cd017e73036f905", 735}, {"resource.001", 0, "24db2bccda0a3c43ac4a7b5edb116c7e", 797678}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -900,7 +899,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "6ef28cac094dcd97fdb461662ead6f92", 541845}, {"resource.001", 0, "0a98a268ee99b92c233a0d7187c1f0fa", 845795}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1111,7 +1110,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "449471bfd77be52f18a3773c7f7d843d", 571368}, {"resource.001", 0, "b45a581ff8751e052c7e364f58d3617f", 16800210}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NONE}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1482,7 +1481,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "5790ac0505f7ca98d4567132b875eb1e", 681041}, {"resource.003", 0, "4a34c3367c2fe7eb380d741374da1989", 572251}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1495,7 +1494,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.001", 0, "ec20246209d7b19f38989261e5c8f5b8", 1111226}, {"resource.002", 0, "85d6935ef77e6b0e16bc307640a0d913", 1088312}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1508,7 +1507,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.001", 0, "d34cadb11e1aefbb497cf91bc1d3baa7", 1114688}, {"resource.002", 0, "85b030bb66d5342b0a068f1208c431a8", 1078443}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1535,7 +1534,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "3fe2a3aec0ed53c7d6db1845a67e3aa2", 1095908}, {"resource.003", 0, "ac175df0ea9a2cba57f0248651856d27", 376556}, {NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1549,7 +1548,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.001", 0, "bc8ca10c807515d959cbd91f9ba47735", 1123759}, {"resource.002", 0, "b7409ab32bc3bee2d6cce887cd33f2b6", 1092160}, {NULL, 0, NULL, 0}}, Common::RU_RUS, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1716,7 +1715,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.005", 0, "f8b2d1137bb767e5d232056b99dd69eb", 623621}, {"resource.006", 0, "bafc64e3144f115dc58c6aee02de98fb", 715598}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1735,7 +1734,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.006", 0, "bafc64e3144f115dc58c6aee02de98fb", 754966}, {"resource.007", 0, "59eba83ad465b08d763b44f86afa86f6", 683135}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1764,7 +1763,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 1024810}, {"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 1030656}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1782,7 +1781,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 1021774}, {"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 993408}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1801,7 +1800,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 946540}, {"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 958842}, {NULL, 0, NULL, 0}}, Common::FR_FRA, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1820,7 +1819,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 1015136}, {"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 987222}, {NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1831,7 +1830,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.map", 0, "a99776df795127f387cb35dae872d4e4", 5919}, {"resource.000", 0, "a8989a5a89e7d4f702b26b378c7a357a", 7001981}, {NULL, 0, NULL, 0}}, Common::IT_ITA, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2157,7 +2156,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.map", 0, "5b457cbe5042f557e5b610148171f6c0", 1158}, {"resource.001", 0, "453ea81ef66a50cbe33ce06302afe47f", 229737}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2328,7 +2327,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.003", 0, "630bfa65beb05f743552704ac2899dae", 759891}, {"resource.004", 0, "7b229fbdf30d670d0728cede3e984a7e", 838663}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2345,7 +2344,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "6258d5dd85898d8e218eb8113ebc9059", 722738}, {"resource.005", 0, "6258d5dd85898d8e218eb8113ebc9059", 704485}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2361,7 +2360,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.003", 0, "8791b9eef53edf77c2dac950142221d3", 1159791}, {"resource.004", 0, "1b91e891a3c60a941dac0eecdf83375b", 1143606}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2374,7 +2373,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "277f97771f7a6d89677141f02da313d6", 65150}, {"resource.001", 0, "5c5a551b6c86cce2ee75becb90e0b586", 624411}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2390,7 +2389,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.003", 0, "4836f460f4cfc8de61e2df4c45775504", 1180956}, {"resource.004", 0, "0c3eb84b9755852d9e795e0d5c9373c7", 1171760}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2567,7 +2566,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "ecace1a2771846b1a8aa1afdd44111a0", 6570147}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, 0, - SCI_VERSION_AUTODETECT, + SCI_VERSION_1, SCI_VERSION_1_1 }, @@ -2578,7 +2577,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "ec6f5cf369054dd3e5392995e9975b9e", 768218}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH}, 0, - SCI_VERSION_AUTODETECT, + SCI_VERSION_1, SCI_VERSION_1_1 }, @@ -2854,7 +2853,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "b25a1539c71701f7715f738c5037e9a6", 775515}, {"resource.005", 0, "640ffe1a9acde392cc33cc1b1a528328", 806324}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2870,7 +2869,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.003", 0, "c47600e50c6fc591957ae0c5020ee7b8", 1213262}, {"resource.004", 0, "e19ea4ad131472f9238590f2e1d40289", 1203051}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2898,7 +2897,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "9b78228ad4f9f335fedf74f1812dcfca", 513325}, {"resource.005", 0, "7d4ebcb745c0bf8fc42e4013f52ecd49", 1101812}, {NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2928,7 +2927,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "6d8f34090503ce937e7dbef6cb6cdb6a", 545053}, {"resource.005", 0, "6d8f34090503ce937e7dbef6cb6cdb6a", 687507}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER, + GF_FOR_SCI1_200_OR_LATER, SCI_VERSION_0, SCI_VERSION_0 }, @@ -3117,7 +3116,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.001", 0, "454684e3a7a68cbca073945e50778447", 1187088}, {"resource.002", 0, "6dc668326cc22cb9e8bd8ca9e68d2a66", 1181249}, {NULL, 0, NULL, 0}}, Common::JA_JPN, Common::kPlatformPC98, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER | GF_SCI1_EGA, + GF_FOR_SCI1_200_OR_LATER | GF_SCI1_EGA, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -3130,7 +3129,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.001", 0, "454684e3a7a68cbca073945e50778447", 1187088}, {"resource.002", 0, "6dc668326cc22cb9e8bd8ca9e68d2a66", 1181249}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC98, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_510_OR_LATER | GF_SCI1_EGA, + GF_FOR_SCI1_200_OR_LATER | GF_SCI1_EGA, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -3413,7 +3412,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { FANMADE("The Legend of the Lost Jewel", "ba1bca315e3818c5626eda51bcfbcccf", 636, "9b0736d69924af0cff32a0f78db96855", 300398), // FIXME: The vga demo does not have a resource.000/001 file. - //FANMADE_V("SCI VGA Demo", "00b1abd87bad356b90fcdfcb6132c26f", 8, "", 0, GF_FOR_SCI1_510_OR_LATER), + //FANMADE_V("SCI VGA Demo", "00b1abd87bad356b90fcdfcb6132c26f", 8, "", 0, GF_FOR_SCI1_200_OR_LATER), {AD_TABLE_END_MARKER, 0, SCI_VERSION_AUTODETECT, SCI_VERSION_0} }; diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index bb27589d84..1dc597a80d 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -964,7 +964,7 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { } reg_t kDoSound(EngineState *s, int funct_nr, int argc, reg_t *argv) { - if (s->_version >= SCI_VERSION_1_1 || s->_flags & GF_SCI1_NEWDOSOUND) + if (s->_kernel->_selectorMap.setVol != -1) return kDoSound_SCI1(s, funct_nr, argc, argv); else if (s->_version >= SCI_VERSION_01) return kDoSound_SCI01(s, funct_nr, argc, argv); diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index fb094e00f6..6ec4b0b43d 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -203,6 +203,7 @@ void Kernel::mapSelectors() { FIND_SELECTOR(printLang); FIND_SELECTOR(subtitleLang); FIND_SELECTOR(parseLang); + FIND_SELECTOR(setVol); } void Kernel::dumpScriptObject(char *data, int seeker, int objsize) { diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h index a3fabbe44b..a4c3043594 100644 --- a/engines/sci/engine/vm.h +++ b/engines/sci/engine/vm.h @@ -203,6 +203,7 @@ struct selector_map_t { Selector printLang; /**< Used for i18n */ Selector subtitleLang; Selector parseLang; + Selector setVol; /**< Used to detect newer sound semantics */ }; // A reference to an object's variable. diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 4e453e7af6..34db178706 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -150,8 +150,7 @@ Common::Error SciEngine::run() { if (version < SCI_VERSION_1_EARLY) { // SCI0/SCI01 if (flags & GF_SCI1_EGA || - flags & GF_SCI1_LOFSABSOLUTE || - flags & GF_SCI1_NEWDOSOUND) { + flags & GF_SCI1_LOFSABSOLUTE) { error("This game entry is erroneous. It's marked as SCI0/SCI01, but it has SCI1 flags set"); } } else if (version >= SCI_VERSION_1_EARLY && version <= SCI_VERSION_1_LATE) { @@ -163,8 +162,7 @@ Common::Error SciEngine::run() { } } else if (version == SCI_VERSION_1_1 || version == SCI_VERSION_32) { if (flags & GF_SCI1_EGA || - flags & GF_SCI1_LOFSABSOLUTE || - flags & GF_SCI1_NEWDOSOUND) { + flags & GF_SCI1_LOFSABSOLUTE) { error("This game entry is erroneous. It's marked as SCI1.1/SCI32, but it has SCI1 flags set"); } diff --git a/engines/sci/sci.h b/engines/sci/sci.h index ea50976df4..ca286b0a4c 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -116,12 +116,7 @@ enum SciGameFlags { ** In late SCI1 versions, the argument of lofs[as] instructions ** is absolute rather than relative. */ - GF_SCI1_LOFSABSOLUTE = (1 << 3), - - /* Applies to all versions from 1.000.510 onwards - ** kDoSound() is different than in earlier SCI1 versions. - */ - GF_SCI1_NEWDOSOUND = (1 << 4) + GF_SCI1_LOFSABSOLUTE = (1 << 3) }; class SciEngine : public Engine { -- cgit v1.2.3 From 8726f0198672c26dfb4f3944bf470a2150d8dc01 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 4 Jul 2009 11:33:51 +0000 Subject: Removed silly FIXME (mixup between debug and engine debug levels) svn-id: r42088 --- engines/sci/sci.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/engines/sci/sci.h b/engines/sci/sci.h index ca286b0a4c..c1033cb424 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -49,16 +49,15 @@ enum kDebugLevels { kDebugLevelGfxDriver = 1 << 8, kDebugLevelBaseSetter = 1 << 9, kDebugLevelParser = 1 << 10, - // FIXME: seems that debug level 11 is special (check debugC in common/debug.cpp) - kDebugLevelMenu = 1 << 12, - kDebugLevelSaid = 1 << 13, - kDebugLevelFile = 1 << 14, - kDebugLevelTime = 1 << 15, - kDebugLevelRoom = 1 << 16, - kDebugLevelAvoidPath = 1 << 17, - kDebugLevelDclInflate = 1 << 18, - kDebugLevelVM = 1 << 19, - kDebugLevelScripts = 1 << 20 + kDebugLevelMenu = 1 << 11, + kDebugLevelSaid = 1 << 12, + kDebugLevelFile = 1 << 13, + kDebugLevelTime = 1 << 14, + kDebugLevelRoom = 1 << 15, + kDebugLevelAvoidPath = 1 << 16, + kDebugLevelDclInflate = 1 << 17, + kDebugLevelVM = 1 << 18, + kDebugLevelScripts = 1 << 19 }; struct SciGameDescription { -- cgit v1.2.3 From 49ef8ae5a4a4b4f08ac5a8d6f059bb4f7dd43c3f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 4 Jul 2009 15:22:42 +0000 Subject: Added a new console command, "selector", which attempts to find a selector by name svn-id: r42093 --- engines/sci/console.cpp | 21 +++++++++++++++++++++ engines/sci/console.h | 1 + 2 files changed, 22 insertions(+) diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index bf919c3a25..6ef6ff3d0c 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -67,6 +67,7 @@ Console::Console(SciEngine *vm) : GUI::Debugger() { // Kernel // DCmd_Register("classes", WRAP_METHOD(Console, cmdClasses)); // TODO DCmd_Register("opcodes", WRAP_METHOD(Console, cmdOpcodes)); + DCmd_Register("selector", WRAP_METHOD(Console, cmdSelector)); DCmd_Register("selectors", WRAP_METHOD(Console, cmdSelectors)); DCmd_Register("functions", WRAP_METHOD(Console, cmdKernelFunctions)); DCmd_Register("class_table", WRAP_METHOD(Console, cmdClassTable)); @@ -239,6 +240,7 @@ bool Console::cmdHelp(int argc, const char **argv) { DebugPrintf("Kernel:\n"); DebugPrintf(" opcodes - Lists the opcode names\n"); DebugPrintf(" selectors - Lists the selector names\n"); + DebugPrintf(" selector - Attempts to find the requested selector by name\n"); DebugPrintf(" functions - Lists the kernel functions\n"); DebugPrintf(" class_table - Shows the available classes\n"); DebugPrintf("\n"); @@ -392,6 +394,25 @@ bool Console::cmdOpcodes(int argc, const char **argv) { return true; } +bool Console::cmdSelector(int argc, const char **argv) { + if (argc < 2) { + DebugPrintf("Attempts to find the requested selector by name.\n"); + DebugPrintf("Usage: %s \n", argv[0]); + return true; + } + + for (uint seeker = 0; seeker < _vm->_gamestate->_kernel->getSelectorNamesSize(); seeker++) { + if (!scumm_stricmp(_vm->_gamestate->_kernel->getSelectorName(seeker).c_str(), argv[1])) { + DebugPrintf("Selector %s found at %03x\n", _vm->_gamestate->_kernel->getSelectorName(seeker).c_str(), seeker); + return true; + } + } + + DebugPrintf("Selector %s wasn't found\n", argv[1]); + + return true; +} + bool Console::cmdSelectors(int argc, const char **argv) { DebugPrintf("Selector names in numeric order:\n"); for (uint seeker = 0; seeker < _vm->_gamestate->_kernel->getSelectorNamesSize(); seeker++) { diff --git a/engines/sci/console.h b/engines/sci/console.h index 84a8d2f942..bc07ddb530 100644 --- a/engines/sci/console.h +++ b/engines/sci/console.h @@ -52,6 +52,7 @@ private: // Kernel // bool cmdClasses(int argc, const char **argv); // TODO bool cmdOpcodes(int argc, const char **argv); + bool cmdSelector(int argc, const char **argv); bool cmdSelectors(int argc, const char **argv); bool cmdKernelFunctions(int argc, const char **argv); bool cmdClassTable(int argc, const char **argv); -- cgit v1.2.3 From fddc5915f7f6ff8feb37d356666d32d3162a16b0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 4 Jul 2009 15:39:31 +0000 Subject: - Changed some comments to DOxygen style svn-id: r42094 --- engines/sci/sci.h | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/engines/sci/sci.h b/engines/sci/sci.h index c1033cb424..fdf9dc9ebf 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -82,39 +82,35 @@ enum SciGameVersions { extern const char *versionNames[9]; enum SciGameFlags { - /* - ** SCI0 flags - */ + // SCI0 flags /* Applies to all versions before 0.000.395 (i.e. KQ4 old, XMAS 1988 and LSL2) - ** Old SCI versions used two word header for script blocks (first word equal - ** to 0x82, meaning of the second one unknown). New SCI versions used one - ** word header. - ** Also, old SCI versions assign 120 degrees to left & right, and 60 to up - ** and down. Later versions use an even 90 degree distribution. - */ + * Old SCI versions used two word header for script blocks (first word equal + * to 0x82, meaning of the second one unknown). New SCI versions used one + * word header. + * Also, old SCI versions assign 120 degrees to left & right, and 60 to up + * and down. Later versions use an even 90 degree distribution. + */ GF_SCI0_OLD = (1 << 0), /* Applies to all versions before 0.000.629 - ** Older SCI versions had simpler code for GetTime() - */ + * Older SCI versions had simpler code for GetTime() + */ GF_SCI0_OLDGETTIME = (1 << 1), // ---------------------------------------------------------------------------- - /* - ** SCI1 flags - */ + // SCI1 flags /* - ** Used to distinguish SCI1 EGA games - */ + * Used to distinguish SCI1 EGA games + */ GF_SCI1_EGA = (1 << 2), /* Applies to all SCI1 versions after 1.000.200 - ** In late SCI1 versions, the argument of lofs[as] instructions - ** is absolute rather than relative. - */ + * In late SCI1 versions, the argument of lofs[as] instructions + * is absolute rather than relative. + */ GF_SCI1_LOFSABSOLUTE = (1 << 3) }; -- cgit v1.2.3 From c5522b37660644666c2842045cf64f1254cc3e17 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 4 Jul 2009 15:45:04 +0000 Subject: - Kernel function names are no longer loaded from vocab.999, but are constructed from the hardcoded function table, depending on the SCI version used - SCI0 games using older graphics functions are now detected by the presence of the "curAngle" selector - SCI0 games using a SCI1 table (like KQ1 demo version and full version) are detected by the presence of the "sightAngle" selector (as no SCI0 game seems to have it) svn-id: r42095 --- engines/sci/engine/kernel.cpp | 96 ++++++++++++++++--------------------------- engines/sci/engine/kernel.h | 21 ++++++---- engines/sci/engine/script.cpp | 2 + engines/sci/engine/vm.h | 4 +- 4 files changed, 54 insertions(+), 69 deletions(-) diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index b03a073d8f..b68c42296a 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -356,35 +356,27 @@ static const char *argtype_description[] = { Kernel::Kernel(ResourceManager *resmgr, bool isOldSci0) : _resmgr(resmgr) { memset(&_selectorMap, 0, sizeof(_selectorMap)); // FIXME: Remove this once/if we C++ify selector_map_t - loadKernelNames(); - + loadSelectorNames(isOldSci0); + mapSelectors(); // Map a few special selectors for later use loadOpcodes(); + loadKernelNames(); + mapFunctions(); // Map the kernel functions - if (!loadSelectorNames(isOldSci0)) { - error("Kernel: Could not retrieve selector names"); - } - - // Map the kernel functions - mapFunctions(); - - // Map a few special selectors for later use - mapSelectors(); - - // SCI0 games using old graphics functions (before version 0.000.502) have the TimesSin - // kernel function, whereas newer games have the SinMult kernel function in its place - _oldGfxFunctions = !hasKernelFunction("SinMult"); + // SCI0 games using old graphics functions (before version 0.000.502) did not have a + // curAngle selector + _oldGfxFunctions = (_selectorMap.curAngle == -1 && _resmgr->_sciVersion == SCI_VERSION_0); } Kernel::~Kernel() { } -bool Kernel::loadSelectorNames(bool isOldSci0) { +void Kernel::loadSelectorNames(bool isOldSci0) { int count; Resource *r = _resmgr->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SNAMES), 0); if (!r) // No such resource? - return false; + error("Kernel: Could not retrieve selector names"); count = READ_LE_UINT16(r->data) + 1; // Counter is slightly off @@ -400,8 +392,6 @@ bool Kernel::loadSelectorNames(bool isOldSci0) { if (isOldSci0) _selectorNames.push_back(tmp); } - - return true; } bool Kernel::loadOpcodes() { @@ -732,46 +722,34 @@ reg_t *kernel_dereference_reg_pointer(EngineState *s, reg_t pointer, int entries return (reg_t*)_kernel_dereference_pointer(s, pointer, entries, sizeof(reg_t)); } -void setDefaultKernelNames(Common::StringList &names) { - names.resize(SCI_KNAMES_DEFAULT_ENTRIES_NR); - for (int i = 0; i < SCI_KNAMES_DEFAULT_ENTRIES_NR; i++) - names[i] = sci_default_knames[i]; -} - -static void vocab_get_knames0(ResourceManager *resmgr, Common::StringList &names) { - int count, i, index = 2, empty_to_add = 1; - Resource *r = resmgr->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_KNAMES), 0); - - if (!r) { // No kernel name table found? Fall back to default table - setDefaultKernelNames(names); - return; - } - - count = READ_LE_UINT16(r->data); - - if (count > 1023) { - // Newer kernel name table, found in KQ1. We can use the default table here - setDefaultKernelNames(names); - return; - } - - if (count < SCI0_KNAMES_WELL_DEFINED) { - empty_to_add = SCI0_KNAMES_WELL_DEFINED - count; - sciprintf("Less than %d kernel functions; adding %d\n", SCI0_KNAMES_WELL_DEFINED, empty_to_add); - } +void Kernel::setDefaultKernelNames() { + bool isSci0 = (_resmgr->_sciVersion == SCI_VERSION_0); + int offset = 0; + + // Check if we have a SCI01 game which uses a SCI1 kernel table (e.g. the KQ1 demo + // and full version). We do this by checking if the sightAngle selector exists, as no + // SCI0 game seems to have it + if (_selectorMap.sightAngle != -1) + isSci0 = false; + + _kernelNames.resize(SCI_KNAMES_DEFAULT_ENTRIES_NR + (isSci0 ? 4 : 0)); + for (int i = 0; i < SCI_KNAMES_DEFAULT_ENTRIES_NR; i++) { + // In SCI0, Platform was DoAvoider + if (!strcmp(sci_default_knames[i], "Platform") && isSci0) { + _kernelNames[i + offset] = "DoAvoider"; + continue; + } - names.resize(count + 1 + empty_to_add); + _kernelNames[i + offset] = sci_default_knames[i]; - for (i = 0; i < count; i++) { - int offset = READ_LE_UINT16(r->data + index); - int len = READ_LE_UINT16(r->data + offset); - //fprintf(stderr,"Getting name %d of %d...\n", i, count); - index += 2; - names[i] = Common::String((const char *)r->data + offset + 2, len); - } - - for (i = 0; i < empty_to_add; i++) { - names[count + i] = SCRIPT_UNKNOWN_FUNCTION_STRING; + // SCI0 has 4 extra functions between SetCursor (0x28) and Savegame + if (!strcmp(sci_default_knames[i], "SetCursor") && isSci0) { + _kernelNames[i + 1] = "FOpen"; + _kernelNames[i + 2] = "FPuts"; + _kernelNames[i + 3] = "FGets"; + _kernelNames[i + 4] = "FClose"; + offset = 4; + } } } @@ -810,12 +788,10 @@ bool Kernel::loadKernelNames() { case SCI_VERSION_01: case SCI_VERSION_01_VGA: case SCI_VERSION_01_VGA_ODD: - vocab_get_knames0(_resmgr, _kernelNames); - break; case SCI_VERSION_1_EARLY: case SCI_VERSION_1_LATE: case SCI_VERSION_1_1: - setDefaultKernelNames(_kernelNames); + setDefaultKernelNames(); if (_resmgr->_sciVersion == SCI_VERSION_1_1) { // KQ6CD calls unimplemented function 0x26 _kernelNames[0x26] = "Dummy"; diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index e3ecddca26..ad7605753b 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -83,12 +83,13 @@ public: */ bool hasKernelFunction(const char *functionName) const; - /* Applies to all versions before 0.000.502 - ** Old SCI versions used to interpret the third DrawPic() parameter inversely, - ** with the opposite default value (obviously). - ** Also, they used 15 priority zones from 42 to 200 instead of 14 priority - ** zones from 42 to 190. - */ + /** + * Applies to all versions before 0.000.502 + * Old SCI versions used to interpret the third DrawPic() parameter inversely, + * with the opposite default value (obviously). + * Also, they used 15 priority zones from 42 to 200 instead of 14 priority + * zones from 42 to 190. + */ bool usesOldGfxFunctions() const { return _oldGfxFunctions; } // Script dissection/dumping functions @@ -111,11 +112,15 @@ private: */ bool loadKernelNames(); + /** + * Sets the default kernel function names, based on the SCI version used + */ + void setDefaultKernelNames(); + /** * Loads the kernel selector names. - * @return True upon success, false otherwise. */ - bool loadSelectorNames(bool isOldSci0); + void loadSelectorNames(bool isOldSci0); /** * Maps special selectors diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index 6ec4b0b43d..3260be6b36 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -203,6 +203,8 @@ void Kernel::mapSelectors() { FIND_SELECTOR(printLang); FIND_SELECTOR(subtitleLang); FIND_SELECTOR(parseLang); + FIND_SELECTOR(curAngle); + FIND_SELECTOR(sightAngle); FIND_SELECTOR(setVol); } diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h index a4c3043594..f1e89bba45 100644 --- a/engines/sci/engine/vm.h +++ b/engines/sci/engine/vm.h @@ -203,7 +203,9 @@ struct selector_map_t { Selector printLang; /**< Used for i18n */ Selector subtitleLang; Selector parseLang; - Selector setVol; /**< Used to detect newer sound semantics */ + Selector curAngle; // Used to detect newer graphics functions semantics. + Selector sightAngle; // Used to detect some SCI0/SCI01 games which need a SCI1 table + Selector setVol; // Used to detect newer sound semantics }; // A reference to an object's variable. -- cgit v1.2.3 From b093511239401c5d64d6b21c0b875d5be6e5f239 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 4 Jul 2009 16:30:20 +0000 Subject: - Merged the "early" and "late" SCI1 versions - these are functionally equivalent, and the code that does the version check is unreliable (e.g. it sets SQ1 VGA to SCI1 "late" and EcoQuest 1 to SCI1 "early") - Cleanup of the vocabulary setting functions - Cleanup of the cursor manipulation code svn-id: r42097 --- engines/sci/engine/kernel.cpp | 13 +++++++------ engines/sci/engine/kgraphics.cpp | 13 +++++++++---- engines/sci/engine/script.cpp | 3 +-- engines/sci/gfx/gfx_resmgr.cpp | 2 +- engines/sci/resource.cpp | 18 ++++-------------- engines/sci/resource.h | 2 -- engines/sci/sci.cpp | 4 ++-- engines/sci/sci.h | 3 +-- 8 files changed, 25 insertions(+), 33 deletions(-) diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index b68c42296a..ab6fb36085 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -386,6 +386,7 @@ void Kernel::loadSelectorNames(bool isOldSci0) { Common::String tmp((const char *)r->data + offset + 2, len); _selectorNames.push_back(tmp); + //printf("%s\n", tmp.c_str()); // debug // Early SCI versions used the LSB in the selector ID as a read/write // toggle. To compensate for that, we add every selector name twice. @@ -751,6 +752,11 @@ void Kernel::setDefaultKernelNames() { offset = 4; } } + + if (_resmgr->_sciVersion == SCI_VERSION_1_1) { + // KQ6CD calls unimplemented function 0x26 + _kernelNames[0x26] = "Dummy"; + } } #ifdef ENABLE_SCI32 @@ -788,14 +794,9 @@ bool Kernel::loadKernelNames() { case SCI_VERSION_01: case SCI_VERSION_01_VGA: case SCI_VERSION_01_VGA_ODD: - case SCI_VERSION_1_EARLY: - case SCI_VERSION_1_LATE: + case SCI_VERSION_1: case SCI_VERSION_1_1: setDefaultKernelNames(); - if (_resmgr->_sciVersion == SCI_VERSION_1_1) { - // KQ6CD calls unimplemented function 0x26 - _kernelNames[0x26] = "Dummy"; - } break; #ifdef ENABLE_SCI32 case SCI_VERSION_32: diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 6e737597d6..9d19f3f0c9 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -304,7 +304,9 @@ static gfx_color_t graph_map_color(EngineState *s, int color, int priority, int reg_t kSetCursor(EngineState *s, int funct_nr, int argc, reg_t *argv) { switch (argc) { case 1 : - if (s->_version < SCI_VERSION_1_1) { + if (s->_version < SCI_VERSION_1) { + GFX_ASSERT(gfxop_set_pointer_cursor(s->gfx_state, argv[0].toSint16())); + } else if (s->_version == SCI_VERSION_1) { if (argv[0].toSint16() <= 1) { // Newer (SCI1.1) semantics: show/hide cursor CursorMan.showMouse(argv[0].toSint16() != 0); @@ -312,13 +314,16 @@ reg_t kSetCursor(EngineState *s, int funct_nr, int argc, reg_t *argv) { // Pre-SCI1.1: set cursor according to the first parameter GFX_ASSERT(gfxop_set_pointer_cursor(s->gfx_state, argv[0].toSint16())); } - } else { + } else if (s->_version >= SCI_VERSION_1_1) { // SCI1.1: Show/hide cursor CursorMan.showMouse(argv[0].toSint16() != 0); } break; case 2 : - if (s->_version < SCI_VERSION_1_1) { + if (s->_version < SCI_VERSION_1) { + GFX_ASSERT(gfxop_set_pointer_cursor(s->gfx_state, + argv[1].toSint16() == 0 ? GFXOP_NO_POINTER : argv[0].toSint16())); + } else if (s->_version == SCI_VERSION_1) { // Pre-SCI1.1: set cursor according to the first parameter, and toggle its // visibility based on the second parameter // Some late SCI1 games actually use the SCI1.1 version of this call (EcoQuest 1 @@ -337,7 +342,7 @@ reg_t kSetCursor(EngineState *s, int funct_nr, int argc, reg_t *argv) { GFX_ASSERT(gfxop_set_pointer_position(s->gfx_state, Common::Point(argv[0].toUint16(), argv[1].toUint16()))); } - } else { + } else if (s->_version >= SCI_VERSION_1_1) { // SCI1.1 and newer: set pointer position GFX_ASSERT(gfxop_set_pointer_position(s->gfx_state, Common::Point(argv[0].toUint16(), argv[1].toUint16()))); diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index 3260be6b36..ca5379a4c0 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -97,8 +97,7 @@ void script_adjust_opcode_formats(int res_version) { break; case SCI_VERSION_01_VGA: case SCI_VERSION_01_VGA_ODD: - case SCI_VERSION_1_EARLY: - case SCI_VERSION_1_LATE: + case SCI_VERSION_1: case SCI_VERSION_1_1: g_opcode_formats[op_lofsa][0] = Script_Offset; g_opcode_formats[op_lofss][0] = Script_Offset; diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index 0ec27ae41a..1289997721 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -534,7 +534,7 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) { view = gfxr_draw_view0(resid, viewRes->data, viewRes->size, -1); else if (_version == SCI_VERSION_01 || !_isVGA) view = gfxr_draw_view0(resid, viewRes->data, viewRes->size, palette); - else if (_version >= SCI_VERSION_01_VGA && _version <= SCI_VERSION_1_LATE) + else if (_version >= SCI_VERSION_01_VGA && _version <= SCI_VERSION_1) view = gfxr_draw_view1(resid, viewRes->data, viewRes->size, _staticPalette, false); else if (_version >= SCI_VERSION_1_1) view = gfxr_draw_view1(resid, viewRes->data, viewRes->size, 0, true); diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 52c079e829..6368f40cc1 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -509,16 +509,9 @@ ResourceManager::ResourceManager(int version, int maxMemory) { case SCI_VERSION_01_VGA_ODD: version = _mapVersion; break; - case SCI_VERSION_1: { - Resource *res = testResource(ResourceId(kResourceTypeScript, 0)); - - _sciVersion = version = SCI_VERSION_1_EARLY; - loadResource(res); - - if (res->status == kResStatusNoMalloc) - version = SCI_VERSION_1_LATE; + case SCI_VERSION_1: + _sciVersion = version = SCI_VERSION_1; break; - } case SCI_VERSION_1_1: // No need to handle SCI 1.1 here - it was done in resource_map.cpp version = SCI_VERSION_1_1; @@ -542,11 +535,8 @@ ResourceManager::ResourceManager(int version, int maxMemory) { case SCI_VERSION_01_VGA_ODD: debug("Resmgr: Detected SCI01VGA - Jones/CD or similar"); break; - case SCI_VERSION_1_EARLY: - debug("Resmgr: Detected SCI1 Early"); - break; - case SCI_VERSION_1_LATE: - debug("Resmgr: Detected SCI1 Late"); + case SCI_VERSION_1: + debug("Resmgr: Detected SCI1"); break; case SCI_VERSION_1_1: debug("Resmgr: Detected SCI1.1"); diff --git a/engines/sci/resource.h b/engines/sci/resource.h index 77c92840ee..8ef42b171d 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -66,8 +66,6 @@ enum { /* the first critical error number */ }; -#define SCI_VERSION_1 SCI_VERSION_1_EARLY - #define MAX_OPENED_VOLUMES 5 // Max number of simultaneously opened volumes enum ResSourceType { diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 34db178706..3686126c83 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -147,13 +147,13 @@ Common::Error SciEngine::run() { _gamestate = new EngineState(_resmgr, version, flags); // Verify that we haven't got an invalid game detection entry - if (version < SCI_VERSION_1_EARLY) { + if (version < SCI_VERSION_1) { // SCI0/SCI01 if (flags & GF_SCI1_EGA || flags & GF_SCI1_LOFSABSOLUTE) { error("This game entry is erroneous. It's marked as SCI0/SCI01, but it has SCI1 flags set"); } - } else if (version >= SCI_VERSION_1_EARLY && version <= SCI_VERSION_1_LATE) { + } else if (version == SCI_VERSION_1) { // SCI1 if (flags & GF_SCI0_OLD || diff --git a/engines/sci/sci.h b/engines/sci/sci.h index fdf9dc9ebf..6236b9843b 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -73,8 +73,7 @@ enum SciGameVersions { SCI_VERSION_01 = 2, SCI_VERSION_01_VGA = 3, SCI_VERSION_01_VGA_ODD = 4, - SCI_VERSION_1_EARLY = 5, - SCI_VERSION_1_LATE = 6, + SCI_VERSION_1 = 5, SCI_VERSION_1_1 = 7, SCI_VERSION_32 = 8 }; -- cgit v1.2.3 From b0c908e3493cd9673d92b9752006d373672ffb85 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 4 Jul 2009 16:36:56 +0000 Subject: Merged SCI1 versions in one more file svn-id: r42098 --- engines/sci/resource.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 6368f40cc1..7138a918a1 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -48,8 +48,7 @@ const char *sci_version_types[] = { "SCI version 0.xxx w/ 1.000 compression", "SCI version 1.000 w/ 0.xxx resource.map", "SCI version 1.000 w/ special resource.map", - "SCI version 1.000 (early)", - "SCI version 1.000 (late)", + "SCI version 1.000", "SCI version 1.001", "SCI WIN/32" }; -- cgit v1.2.3 From 177891a0c1b0a6b03e03b2a81520a1f51ff3ee00 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 4 Jul 2009 17:39:43 +0000 Subject: Cursors without a palette are now initialized correctly (from patch #2816652). Fixes the cursor transparent color in QFG3 svn-id: r42099 --- engines/sci/gfx/gfx_driver.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp index 3420472943..c665eef3b8 100644 --- a/engines/sci/gfx/gfx_driver.cpp +++ b/engines/sci/gfx/gfx_driver.cpp @@ -257,15 +257,14 @@ int GfxDriver::setPointer(gfx_pixmap_t *pointer, Common::Point *hotspot) { } else { byte *cursorData = createCursor(pointer); - // FIXME: The palette size check is a workaround for cursors using non-palette colour GFX_CURSOR_TRANSPARENT - // Note that some cursors don't have a palette in SQ5 + // FIXME: The palette size check is a workaround for cursors using non-palette color GFX_CURSOR_TRANSPARENT + // Note that some cursors don't have a palette (e.g. in SQ5 and QFG3) byte color_key = GFX_CURSOR_TRANSPARENT; if ((pointer->color_key != GFX_PIXMAP_COLOR_KEY_NONE) && (pointer->palette && (unsigned int)pointer->color_key < pointer->palette->size())) color_key = pointer->palette->getColor(pointer->color_key).parent_index; - // Some cursors in SQ5 don't have a palette. The cursor palette seems to use 64 colors, so setting the color key to 63 works - // TODO: Is this correct? + // Some cursors don't have a palette, so we set the color key directly if (!pointer->palette) - color_key = 63; + color_key = pointer->color_key; CursorMan.replaceCursor(cursorData, pointer->width, pointer->height, hotspot->x, hotspot->y, color_key); CursorMan.showMouse(true); -- cgit v1.2.3 From 14319442945f67652a9ad757edc3cf1b0c581df2 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 4 Jul 2009 18:54:06 +0000 Subject: Add GCC_PRINTF parameter. svn-id: r42104 --- backends/midi/timidity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/midi/timidity.cpp b/backends/midi/timidity.cpp index c813441724..d533dab770 100644 --- a/backends/midi/timidity.cpp +++ b/backends/midi/timidity.cpp @@ -99,7 +99,7 @@ private: int connect_to_server(const char* hostname, unsigned short tcp_port); /* send command to the server; printf-like; returns reply string */ - char *timidity_ctl_command(const char *fmt, ...); + char *timidity_ctl_command(const char *fmt, ...) GCC_PRINTF(2, 3); /* timidity data socket-related stuff */ void timidity_meta_seq(int p1, int p2, int p3); -- cgit v1.2.3 From 59aa80b2d27639722d0d38f123bae80ed02ac6b9 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 4 Jul 2009 18:54:27 +0000 Subject: Fix mismatching format arguments. svn-id: r42105 --- engines/scumm/he/resource_he.cpp | 2 +- engines/scumm/script.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index 022dbc0eb3..ce29bf0319 100644 --- a/engines/scumm/he/resource_he.cpp +++ b/engines/scumm/he/resource_he.cpp @@ -474,7 +474,7 @@ bool Win32ResExtractor::check_offset(byte *memory, int total_size, const char *n int need_size = (int)((byte *)offset - memory + size); debugC(DEBUG_RESOURCE, "check_offset: size=%x vs %x offset=%x size=%x", - need_size, total_size, (byte *)offset - memory, size); + need_size, total_size, (uint)((byte *)offset - memory), size); if (need_size < 0 || need_size > total_size) { error("%s: premature end", name); diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp index c70c819b69..78f7fb0453 100644 --- a/engines/scumm/script.cpp +++ b/engines/scumm/script.cpp @@ -462,7 +462,7 @@ void ScummEngine::executeScript() { vm.slot[_currentScript].didexec = true; debugC(DEBUG_OPCODES, "Script %d, offset 0x%x: [%X] %s()", vm.slot[_currentScript].number, - _scriptPointer - _scriptOrgPointer, + (uint)(_scriptPointer - _scriptOrgPointer), _opcode, getOpcodeDesc(_opcode)); if (_hexdumpScripts == true) { -- cgit v1.2.3 From eeb5ba9d507014a4429adc419c4c7f019f45af85 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 4 Jul 2009 18:54:43 +0000 Subject: Kyra1 PC-98 never offered English as language settings, thus remove it. (The CD version *does* supply English files, but those will work as FM-Towns version, so this causes no drawback for the user and is faithful to the original) svn-id: r42106 --- engines/kyra/detection.cpp | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp index 3491c54b36..63d15419d2 100644 --- a/engines/kyra/detection.cpp +++ b/engines/kyra/detection.cpp @@ -263,26 +263,12 @@ const KYRAGameDescription adGameDescs[] = { KYRA1_TOWNS_SJIS_FLAGS }, - { // PC-9821 (CD) version - { - "kyra1", - "CD", - { - { "EMC.PAK", 0, "a046bb0b422061aab8e4c4689400343a", -1 }, - { "MUSIC98.PAK", 0, "02fc212f799331b769b274e33d87b37f", -1 }, - { NULL, 0, NULL, 0 } - }, - Common::EN_ANY, - Common::kPlatformPC98, - ADGF_CD, - Common::GUIO_NOSPEECH - }, - KYRA1_TOWNS_FLAGS - }, + // PC-9801 floppy + CD / PC-9821 floppy version are all using the same data files, + // thus we will mark it as non CD game. { { "kyra1", - "CD", + "", { { "JMC.PAK", 0, "9c5707a2a478e8167e44283246612d2c", -1 }, { "MUSIC98.PAK", 0, "02fc212f799331b769b274e33d87b37f", -1 }, @@ -290,7 +276,7 @@ const KYRAGameDescription adGameDescs[] = { }, Common::JA_JPN, Common::kPlatformPC98, - ADGF_CD, + ADGF_NO_FLAGS, Common::GUIO_NOSPEECH }, KYRA1_TOWNS_SJIS_FLAGS -- cgit v1.2.3 From c48f71edf49aefbcba601a8b931d8339279d227f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 4 Jul 2009 19:04:39 +0000 Subject: After discussing with Max, disable -Wmissing-format-attribute again. Also added a comment explaining why it is disabled. svn-id: r42107 --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 12718494c7..5771e692dc 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,12 @@ CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder # Enable even more warnings... CXXFLAGS+= -Wpointer-arith -Wcast-qual -Wcast-align CXXFLAGS+= -Wshadow -Wimplicit -Wnon-virtual-dtor -Wwrite-strings -CXXFLAGS+= -Wmissing-format-attribute + +# Currently we disable this gcc flag, since it will also warn in cases, +# where using GCC_PRINTF (means: __attribute__((format(printf, x, y)))) +# is not possible, thus it would fail compiliation with -Werror without +# being helpful. +#CXXFLAGS+= -Wmissing-format-attribute # Disable RTTI and exceptions, and enabled checking of pointers returned by "new" CXXFLAGS+= -fno-rtti -fno-exceptions -fcheck-new -- cgit v1.2.3 From 9255bfc9074b65226dc4d5c012e2a968051572a9 Mon Sep 17 00:00:00 2001 From: Florian Kagerer Date: Sat, 4 Jul 2009 21:18:20 +0000 Subject: KYRA: fix minor bug in Screen::drawShape() svn-id: r42110 --- engines/kyra/screen.cpp | 17 +++++++++-------- engines/kyra/screen.h | 10 +++++----- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index fa54bffa98..963dc3f4d6 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -1529,6 +1529,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int _dsTmpWidth = shapeWidth; int cnt = _dsOffscreenLeft; int scaleState = (this->*_dsProcessMargin)(d, src, cnt); + if (_dsTmpWidth) { cnt += shpWidthScaled1; if (cnt > 0) { @@ -1584,7 +1585,6 @@ int Screen::drawShapeMarginScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt) while (cnt > 0) { --cnt; - if (*src++) continue; @@ -1611,7 +1611,6 @@ int Screen::drawShapeMarginScaleDownwind(uint8 *&dst, const uint8 *&src, int &cn while (cnt > 0) { --cnt; - if (*src++) continue; @@ -1640,10 +1639,11 @@ int Screen::drawShapeSkipScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt) { return 0; do { + --cnt; if (*src++) continue; cnt = cnt + 1 - (*src++); - } while (--cnt > 0); + } while (cnt > 0); return 0; } @@ -1656,16 +1656,17 @@ int Screen::drawShapeSkipScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt) return 0; do { + --cnt; if (*src++) continue; found = true; cnt = cnt + 1 - (*src++); - } while (--cnt > 0); + } while (cnt > 0); return found ? 0 : _dsOffscreenScaleVal1; } -void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16) { +void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int16) { do { uint8 c = *src++; if (c) { @@ -1680,7 +1681,7 @@ void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, i } while (cnt > 0); } -void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16) { +void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int16) { do { uint8 c = *src++; if (c) { @@ -1695,7 +1696,7 @@ void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, } while (cnt > 0); } -void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState) { +void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState) { int c = 0; do { @@ -1723,7 +1724,7 @@ void Screen::drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int cnt = -1; } -void Screen::drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState) { +void Screen::drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState) { int c = 0; do { diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index 390d058bb8..956bd7107e 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -421,10 +421,10 @@ protected: int drawShapeMarginScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt); int drawShapeSkipScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt); int drawShapeSkipScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt); - void drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState); - void drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState); - void drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState); - void drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState); + void drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState); + void drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState); + void drawShapeProcessLineScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState); + void drawShapeProcessLineScaleDownwind(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState); void drawShapePlotType0(uint8 *dst, uint8 cmd); void drawShapePlotType1(uint8 *dst, uint8 cmd); @@ -446,7 +446,7 @@ protected: void drawShapePlotType52(uint8 *dst, uint8 cmd); typedef int (Screen::*DsMarginSkipFunc)(uint8 *&dst, const uint8 *&src, int &cnt); - typedef void (Screen::*DsLineFunc)(uint8 *&dst, const uint8 *&src, int &cnt, uint16 scaleState); + typedef void (Screen::*DsLineFunc)(uint8 *&dst, const uint8 *&src, int &cnt, int16 scaleState); typedef void (Screen::*DsPlotFunc)(uint8 *dst, uint8 cmd); DsMarginSkipFunc _dsProcessMargin; -- cgit v1.2.3 From f907dc7fc72594e00b48c76629b40229e76657cb Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 4 Jul 2009 23:52:24 +0000 Subject: When morphing a TeeSongIterator, transfer death listeners to remaining child svn-id: r42112 --- engines/sci/sfx/iterator.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/engines/sci/sfx/iterator.cpp b/engines/sci/sfx/iterator.cpp index ad33bc8dfb..8b6a17fac8 100644 --- a/engines/sci/sfx/iterator.cpp +++ b/engines/sci/sfx/iterator.cpp @@ -1269,6 +1269,15 @@ static void song_iterator_remove_death_listener(SongIterator *it, TeeSongIterato } } +static void song_iterator_transfer_death_listeners(SongIterator *it, TeeSongIterator *old_client) { + song_iterator_remove_death_listener(it, old_client); + for (int i = 0; i < SONGIT_MAX_LISTENERS; ++i) { + if (old_client->_deathListeners[i]) + song_iterator_add_death_listener(it, old_client->_deathListeners[i]); + old_client->_deathListeners[i] = 0; + } +} + static void songit_tee_death_notification(TeeSongIterator *self, SongIterator *corpse) { if (corpse == self->_children[TEE_LEFT].it) { self->_status &= ~TEE_LEFT_ACTIVE; @@ -1505,12 +1514,14 @@ SongIterator *TeeSongIterator::handleMessage(Message msg) { delete _children[TEE_LEFT].it; _children[TEE_LEFT].it = 0; old_it = _children[TEE_RIGHT].it; + song_iterator_transfer_death_listeners(old_it, this); delete this; return old_it; } else if (!(_status & TEE_RIGHT_ACTIVE)) { delete _children[TEE_RIGHT].it; _children[TEE_RIGHT].it = 0; old_it = _children[TEE_LEFT].it; + song_iterator_transfer_death_listeners(old_it, this); delete this; return old_it; } -- cgit v1.2.3 From eba5780fc062d26ba2d70d3bc438265a43ef5411 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 5 Jul 2009 01:16:53 +0000 Subject: When creating a CleanupSongIterator, transfer death listeners to it svn-id: r42113 --- engines/sci/sfx/iterator.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/engines/sci/sfx/iterator.cpp b/engines/sci/sfx/iterator.cpp index 8b6a17fac8..c1acda7f6c 100644 --- a/engines/sci/sfx/iterator.cpp +++ b/engines/sci/sfx/iterator.cpp @@ -1269,12 +1269,11 @@ static void song_iterator_remove_death_listener(SongIterator *it, TeeSongIterato } } -static void song_iterator_transfer_death_listeners(SongIterator *it, TeeSongIterator *old_client) { - song_iterator_remove_death_listener(it, old_client); +static void song_iterator_transfer_death_listeners(SongIterator *it, SongIterator *it_from) { for (int i = 0; i < SONGIT_MAX_LISTENERS; ++i) { - if (old_client->_deathListeners[i]) - song_iterator_add_death_listener(it, old_client->_deathListeners[i]); - old_client->_deathListeners[i] = 0; + if (it_from->_deathListeners[i]) + song_iterator_add_death_listener(it, it_from->_deathListeners[i]); + it_from->_deathListeners[i] = 0; } } @@ -1514,6 +1513,7 @@ SongIterator *TeeSongIterator::handleMessage(Message msg) { delete _children[TEE_LEFT].it; _children[TEE_LEFT].it = 0; old_it = _children[TEE_RIGHT].it; + song_iterator_remove_death_listener(old_it, this); song_iterator_transfer_death_listeners(old_it, this); delete this; return old_it; @@ -1521,6 +1521,7 @@ SongIterator *TeeSongIterator::handleMessage(Message msg) { delete _children[TEE_RIGHT].it; _children[TEE_RIGHT].it = 0; old_it = _children[TEE_LEFT].it; + song_iterator_remove_death_listener(old_it, this); song_iterator_transfer_death_listeners(old_it, this); delete this; return old_it; @@ -1593,9 +1594,11 @@ int songit_next(SongIterator **it, byte *buf, int *result, int mask) { ** cleanup iterator */ int channel_mask = (*it)->channel_mask; - if (mask & IT_READER_MAY_FREE) - delete *it; + SongIterator *old_it = *it; *it = new CleanupSongIterator(channel_mask); + song_iterator_transfer_death_listeners(*it, old_it); + if (mask & IT_READER_MAY_FREE) + delete old_it; retval = -9999; /* Continue */ } } while (!( /* Until one of the following holds */ -- cgit v1.2.3 From 48d164a498d188793374921e572aac15f13366c0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 5 Jul 2009 07:21:17 +0000 Subject: Bugfix for word-wrapping of text, which sometimes failed for strings with special characters svn-id: r42115 --- engines/cruise/font.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/cruise/font.cpp b/engines/cruise/font.cpp index d5010b2bf8..8da3621bdc 100644 --- a/engines/cruise/font.cpp +++ b/engines/cruise/font.cpp @@ -242,7 +242,7 @@ int32 prepareWordRender(int32 inRightBorder_X, int16 wordSpacingWidth, if (character == '|' || !character) { finish = 1; } else { - if (charData) { + if (charData >= 0) { if (pixelCount + wordSpacingWidth + (int16)fontData[charData].charWidth >= inRightBorder_X) { finish = 1; -- cgit v1.2.3 From 6d3b2ec3afdb5b137f87b782e5b7f363ea2f1849 Mon Sep 17 00:00:00 2001 From: Jordi Vilalta Prat Date: Sun, 5 Jul 2009 09:34:54 +0000 Subject: - Refactorized Groovie::MusicPlayer to make it extensible - Added an empty MusicPlayerMac to let the Macintosh version of The 7th Guest start svn-id: r42116 --- engines/groovie/groovie.cpp | 6 +- engines/groovie/music.cpp | 428 +++++++++++++++++++++++++++----------------- engines/groovie/music.h | 114 ++++++++---- 3 files changed, 346 insertions(+), 202 deletions(-) diff --git a/engines/groovie/groovie.cpp b/engines/groovie/groovie.cpp index e2315459d4..9381b5b47c 100644 --- a/engines/groovie/groovie.cpp +++ b/engines/groovie/groovie.cpp @@ -94,7 +94,11 @@ Common::Error GroovieEngine::run() { } // Create the music player - _musicPlayer = new MusicPlayer(this, _gameDescription->version == kGroovieT7G ? "fat" : "sample"); + if (_gameDescription->desc.platform == Common::kPlatformMacintosh) { + _musicPlayer = new MusicPlayerMac(this); + } else { + _musicPlayer = new MusicPlayerXMI(this, _gameDescription->version == kGroovieT7G ? "fat" : "sample"); + } // Load volume levels syncSoundSettings(); diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp index 30889deb44..1a1de92156 100644 --- a/engines/groovie/music.cpp +++ b/engines/groovie/music.cpp @@ -31,72 +31,20 @@ namespace Groovie { -MusicPlayer::MusicPlayer(GroovieEngine *vm, const Common::String >lName) : - _vm(vm), _midiParser(NULL), _data(NULL), _driver(NULL), - _backgroundFileRef(0), _gameVolume(100), _prevCDtrack(0), _isPlaying(0) { - // Create the parser - _midiParser = MidiParser::createParser_XMIDI(); - - // Create the driver - int driver = detectMusicDriver(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MIDI); - _driver = createMidi(driver); - this->open(); - - // Initialize the channel volumes and banks - for (int i = 0; i < 0x10; i++) { - _chanVolumes[i] = 0x7F; - _chanBanks[i] = 0; - } - - // Load the Global Timbre Library - if (driver == MD_ADLIB) { - // MIDI through AdLib - _musicType = MD_ADLIB; - loadTimbres(gtlName + ".ad"); - - // Setup the percussion channel - for (unsigned int i = 0; i < _timbres.size(); i++) { - if (_timbres[i].bank == 0x7F) - setTimbreAD(9, _timbres[i]); - } - } else if ((driver == MD_MT32) || ConfMan.getBool("native_mt32")) { - // MT-32 - _musicType = MD_MT32; - loadTimbres(gtlName + ".mt"); - } else { - // GM - _musicType = 0; - } - - // Set the parser's driver - _midiParser->setMidiDriver(this); - - // Set the timer rate - _midiParser->setTimerRate(_driver->getBaseTempo()); -} - -MusicPlayer::~MusicPlayer() { - _driver->setTimerCallback(NULL, NULL); - - Common::StackLock lock(_mutex); - - // Unload the parser - unload(); - delete _midiParser; +// MusicPlayer - // Unload the MIDI Driver - _driver->close(); - delete _driver; - - // Unload the timbres - clearTimbres(); +MusicPlayer::MusicPlayer(GroovieEngine *vm) : + _vm(vm), _isPlaying(false), _backgroundFileRef(0), _gameVolume(100), + _prevCDtrack(0) { } void MusicPlayer::playSong(uint32 fileref) { Common::StackLock lock(_mutex); + // Set the volumes _fadingEndVolume = 100; _gameVolume = 100; + // Play the referenced file once play(fileref, false); } @@ -146,6 +94,14 @@ void MusicPlayer::playCD(uint8 track) { AudioCD.play(track - 1, 1, startms * 75 / 1000, 0); } +void MusicPlayer::startBackground() { + debugC(3, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: startBackground()"); + if (!_isPlaying && _backgroundFileRef) { + debugC(3, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Starting the background song (0x%4X)", _backgroundFileRef); + play(_backgroundFileRef, true); + } +} + void MusicPlayer::setUserVolume(uint16 volume) { Common::StackLock lock(_mutex); @@ -154,10 +110,8 @@ void MusicPlayer::setUserVolume(uint16 volume) { if (_userVolume > 0x100) _userVolume = 0x100; - // Apply it to all the channels - for (int i = 0; i < 0x10; i++) { - updateChanVolume(i); - } + // Apply it + updateVolume(); } void MusicPlayer::setGameVolume(uint16 volume, uint16 time) { @@ -176,17 +130,15 @@ void MusicPlayer::setGameVolume(uint16 volume, uint16 time) { _fadingEndVolume = 100; } -void MusicPlayer::startBackground() { - debugC(3, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: startBackground()"); - if (!_isPlaying && _backgroundFileRef) { - debugC(3, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Starting the background song (0x%4X)", _backgroundFileRef); - play(_backgroundFileRef, true); - } -} - -void MusicPlayer::endTrack() { - debugC(3, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: endTrack()"); +bool MusicPlayer::play(uint32 fileref, bool loop) { + // Unload the previous song unload(); + + // Set the new state + _isPlaying = true; + + // Load the new file + return load(fileref, loop); } void MusicPlayer::applyFading() { @@ -212,13 +164,129 @@ void MusicPlayer::applyFading() { } } - // Apply the new volume to all the channels + // Apply it + updateVolume(); +} + +void MusicPlayer::onTimer(void *refCon) { + debugC(9, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: onTimer()"); + MusicPlayer *music = (MusicPlayer *)refCon; + Common::StackLock lock(music->_mutex); + + // Apply the game volume fading + if (music->_gameVolume != music->_fadingEndVolume) { + // Apply the next step of the fading + music->applyFading(); + } + + // Handle internal timed events + music->onTimerInternal(); +} + +void MusicPlayer::unload() { + debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Stopping the playback"); + + // Set the new state + _isPlaying = false; +} + + +// MusicPlayerMidi + +MusicPlayerMidi::MusicPlayerMidi(GroovieEngine *vm) : + MusicPlayer(vm), _midiParser(NULL), _data(NULL), _driver(NULL) { + // Initialize the channel volumes for (int i = 0; i < 0x10; i++) { - updateChanVolume(i); + _chanVolumes[i] = 0x7F; + } +} + +MusicPlayerMidi::~MusicPlayerMidi() { + // Stop the callback + if (_driver) + _driver->setTimerCallback(NULL, NULL); + + Common::StackLock lock(_mutex); + + // Unload the parser + unload(); + delete _midiParser; + + // Unload the MIDI Driver + if (_driver) + _driver->close(); + delete _driver; +} + +int MusicPlayerMidi::open() { + // Don't ever call open without first setting the output driver! + if (!_driver) + return 255; + + int ret = _driver->open(); + if (ret) + return ret; + + return 0; +} + +void MusicPlayerMidi::close() {} + +void MusicPlayerMidi::send(uint32 b) { + if ((b & 0xFFF0) == 0x07B0) { // Volume change + // Save the specific channel volume + byte chan = b & 0xF; + _chanVolumes[chan] = (b >> 16) & 0x7F; + + // Send the updated value + updateChanVolume(chan); + + return; + } + if (_driver) + _driver->send(b); +} + +void MusicPlayerMidi::metaEvent(byte type, byte *data, uint16 length) { + switch (type) { + case 0x2F: + // End of Track, play the background song + endTrack(); + break; + default: + if (_driver) + _driver->metaEvent(type, data, length); + break; } } -void MusicPlayer::updateChanVolume(byte channel) { +void MusicPlayerMidi::setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) { + if (_driver) + _driver->setTimerCallback(timer_param, timer_proc); +} + +uint32 MusicPlayerMidi::getBaseTempo(void) { + if (_driver) + return _driver->getBaseTempo(); + else + return 0; +} + +MidiChannel *MusicPlayerMidi::allocateChannel() { + if (_driver) + return _driver->allocateChannel(); + else + return 0; +} + +MidiChannel *MusicPlayerMidi::getPercussionChannel() { + if (_driver) + return _driver->getPercussionChannel(); + else + return 0; +} + +void MusicPlayerMidi::updateChanVolume(byte channel) { // Generate a MIDI Control change message for the volume uint32 b = 0x7B0; @@ -230,76 +298,119 @@ void MusicPlayer::updateChanVolume(byte channel) { val &= 0x7F; // Send it to the driver - _driver->send(b | (val << 16)); + if (_driver) + _driver->send(b | (val << 16)); } -bool MusicPlayer::play(uint32 fileref, bool loop) { - // Unload the previous song +void MusicPlayerMidi::endTrack() { + debugC(3, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: endTrack()"); unload(); +} - // Set the looping option - _midiParser->property(MidiParser::mpAutoLoop, loop); +void MusicPlayerMidi::onTimerInternal() { + // TODO: We really only need to call this while music is playing. + if (_midiParser) + _midiParser->onTimer(); +} - _isPlaying = true; - // Load the new file - return load(fileref); +void MusicPlayerMidi::updateVolume() { + // Apply it to all the channels + for (int i = 0; i < 0x10; i++) { + updateChanVolume(i); + } } -bool MusicPlayer::load(uint32 fileref) { - debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Starting the playback of song: %04X", fileref); +void MusicPlayerMidi::unload() { + MusicPlayer::unload(); - // Open the song resource - Common::SeekableReadStream *xmidiFile = _vm->_resMan->open(fileref); - if (!xmidiFile) { - error("Groovie::Music: Couldn't find resource 0x%04X", fileref); + // Unload the parser data + if (_midiParser) + _midiParser->unloadMusic(); + + // Unload the data + delete[] _data; + _data = NULL; +} + +bool MusicPlayerMidi::loadParser(Common::SeekableReadStream *stream, bool loop) { + if (!_midiParser) return false; - } // Read the whole file to memory - int length = xmidiFile->size(); + int length = stream->size(); _data = new byte[length]; - xmidiFile->read(_data, length); - delete xmidiFile; + stream->read(_data, length); + delete stream; + + // Set the looping option + _midiParser->property(MidiParser::mpAutoLoop, loop); // Start parsing the data if (!_midiParser->loadMusic(_data, length)) { - error("Groovie::Music: Invalid XMI file"); + error("Groovie::Music: Couldn't parse the data"); return false; } // Activate the timer source - _driver->setTimerCallback(this, &onTimer); + if (_driver) + _driver->setTimerCallback(this, &onTimer); return true; } -void MusicPlayer::unload() { - debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Stopping the playback"); - _isPlaying = false; - // Unload the parser - _midiParser->unloadMusic(); +// MusicPlayerXMI - // Unload the xmi file - delete[] _data; - _data = NULL; -} +MusicPlayerXMI::MusicPlayerXMI(GroovieEngine *vm, const Common::String >lName) : + MusicPlayerMidi(vm) { + // Create the parser + _midiParser = MidiParser::createParser_XMIDI(); -int MusicPlayer::open() { - // Don't ever call open without first setting the output driver! - if (!_driver) - return 255; + // Create the driver + int driver = detectMusicDriver(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MIDI); + _driver = createMidi(driver); + this->open(); - int ret = _driver->open(); - if (ret) - return ret; + // Set the parser's driver + _midiParser->setMidiDriver(this); - return 0; + // Set the timer rate + _midiParser->setTimerRate(_driver->getBaseTempo()); + + // Initialize the channel banks + for (int i = 0; i < 0x10; i++) { + _chanBanks[i] = 0; + } + + // Load the Global Timbre Library + if (driver == MD_ADLIB) { + // MIDI through AdLib + _musicType = MD_ADLIB; + loadTimbres(gtlName + ".ad"); + + // Setup the percussion channel + for (unsigned int i = 0; i < _timbres.size(); i++) { + if (_timbres[i].bank == 0x7F) + setTimbreAD(9, _timbres[i]); + } + } else if ((driver == MD_MT32) || ConfMan.getBool("native_mt32")) { + // MT-32 + _musicType = MD_MT32; + loadTimbres(gtlName + ".mt"); + } else { + // GM + _musicType = 0; + } } -void MusicPlayer::close() {} +MusicPlayerXMI::~MusicPlayerXMI() { + //~MusicPlayer(); + + // Unload the timbres + clearTimbres(); +} -void MusicPlayer::send(uint32 b) { +void MusicPlayerXMI::send(uint32 b) { if ((b & 0xFFF0) == 0x72B0) { // XMIDI Patch Bank Select 114 // From AIL2's documentation: XMIDI Patch Bank Select controller (114) // selects a bank to be used when searching the next patches @@ -337,63 +448,24 @@ void MusicPlayer::send(uint32 b) { // If we got here we couldn't find the patch, and the // received message will be sent unchanged. } - } else if ((b & 0xFFF0) == 0x07B0) { // Volume change - // Save the specific channel volume - byte chan = b & 0xF; - _chanVolumes[chan] = (b >> 16) & 0x7F; - - // Send the updated value - updateChanVolume(chan); - - return; - } - _driver->send(b); -} - -void MusicPlayer::metaEvent(byte type, byte *data, uint16 length) { - switch (type) { - case 0x2F: - // End of Track, play the background song - endTrack(); - break; - default: - _driver->metaEvent(type, data, length); - break; } + MusicPlayerMidi::send(b); } -void MusicPlayer::onTimer(void *refCon) { - debugC(9, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: onTimer()"); - MusicPlayer *music = (MusicPlayer *)refCon; - Common::StackLock lock(music->_mutex); +bool MusicPlayerXMI::load(uint32 fileref, bool loop) { + debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Starting the playback of song: %04X", fileref); - // Apply the game volume fading - if (music->_gameVolume != music->_fadingEndVolume) { - // Apply the next step of the fading - music->applyFading(); + // Open the song resource + Common::SeekableReadStream *file = _vm->_resMan->open(fileref); + if (!file) { + error("Groovie::Music: Couldn't find resource 0x%04X", fileref); + return false; } - // TODO: We really only need to call this while music is playing. - music->_midiParser->onTimer(); -} - -void MusicPlayer::setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) { - _driver->setTimerCallback(timer_param, timer_proc); -} - -uint32 MusicPlayer::getBaseTempo(void) { - return _driver->getBaseTempo(); -} - -MidiChannel *MusicPlayer::allocateChannel() { - return _driver->allocateChannel(); -} - -MidiChannel *MusicPlayer::getPercussionChannel() { - return _driver->getPercussionChannel(); + return loadParser(file, loop); } -void MusicPlayer::loadTimbres(const Common::String &filename) { +void MusicPlayerXMI::loadTimbres(const Common::String &filename) { // Load the Global Timbre Library format as documented in AIL2 debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Loading the GTL file %s", filename.c_str()); @@ -451,7 +523,7 @@ void MusicPlayer::loadTimbres(const Common::String &filename) { delete gtl; } -void MusicPlayer::clearTimbres() { +void MusicPlayerXMI::clearTimbres() { // Delete the allocated data int num = _timbres.size(); for (int i = 0; i < num; i++) { @@ -462,7 +534,7 @@ void MusicPlayer::clearTimbres() { _timbres.clear(); } -void MusicPlayer::setTimbreAD(byte channel, const Timbre &timbre) { +void MusicPlayerXMI::setTimbreAD(byte channel, const Timbre &timbre) { // Verify the timbre size if (timbre.size != 12) { error("Groovie::Music: Invalid size for an AdLib timbre: %d", timbre.size); @@ -514,7 +586,7 @@ void MusicPlayer::setTimbreAD(byte channel, const Timbre &timbre) { } } -void MusicPlayer::setTimbreMT(byte channel, const Timbre &timbre) { +void MusicPlayerXMI::setTimbreMT(byte channel, const Timbre &timbre) { // Verify the timbre size if (timbre.size != 0xF6) { error("Groovie::Music: Invalid size for an MT-32 timbre: %d", timbre.size); @@ -528,4 +600,28 @@ void MusicPlayer::setTimbreMT(byte channel, const Timbre &timbre) { warning("Groovie::Music: Setting MT32 custom instruments isn't supported yet"); } + +// MusicPlayerMac + +MusicPlayerMac::MusicPlayerMac(GroovieEngine *vm) : + MusicPlayerMidi(vm) { +} + +bool MusicPlayerMac::load(uint32 fileref, bool loop) { + debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Starting the playback of song: %04X", fileref); + debug("Groovie::Music: Starting the playback of song: %04X %d", fileref, fileref); + + // Open the song resource + /* + Common::SeekableReadStream *file = _vm->_resMan->open(fileref); + if (!file) { + error("Groovie::Music: Couldn't find resource 0x%04X", fileref); + return false; + } + */ + + //return loadParser(file, loop); + return false; +} + } // End of Groovie namespace diff --git a/engines/groovie/music.h b/engines/groovie/music.h index 92c7afde70..db50930c37 100644 --- a/engines/groovie/music.h +++ b/engines/groovie/music.h @@ -34,10 +34,11 @@ namespace Groovie { -class MusicPlayer : public MidiDriver { +class MusicPlayer { public: - MusicPlayer(GroovieEngine *vm, const Common::String >lName); - ~MusicPlayer(); + MusicPlayer(GroovieEngine *vm); + virtual ~MusicPlayer() {} + void playSong(uint32 fileref); void setBackgroundSong(uint32 fileref); void playCD(uint8 track); @@ -48,25 +49,89 @@ public: void setGameVolume(uint16 volume, uint16 time); private: - // User volume - uint16 _userVolume; + // Song playback + bool play(uint32 fileref, bool loop); + bool _isPlaying; + uint32 _backgroundFileRef; + uint8 _prevCDtrack; - // Game volume - uint16 _gameVolume; + // Volume fading uint32 _fadingStartTime; uint16 _fadingStartVolume; uint16 _fadingEndVolume; uint16 _fadingDuration; - void endTrack(); void applyFading(); - // Song volumes +protected: + GroovieEngine *_vm; + + // Callback + static void onTimer(void *data); + virtual void onTimerInternal() {} + Common::Mutex _mutex; + + // User volume + uint16 _userVolume; + // Game volume + uint16 _gameVolume; + + // These are specific for each type of music + virtual void updateVolume() = 0; + virtual bool load(uint32 fileref, bool loop) = 0; + virtual void unload(); +}; + +class MusicPlayerMidi : public MusicPlayer, public MidiDriver { +public: + MusicPlayerMidi(GroovieEngine *vm); + ~MusicPlayerMidi(); + + // MidiDriver interface + int open(); + void close(); + void send(uint32 b); + void metaEvent(byte type, byte *data, uint16 length); + void setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc); + uint32 getBaseTempo(void); + MidiChannel *allocateChannel(); + MidiChannel *getPercussionChannel(); + +private: + // Channel volumes byte _chanVolumes[0x10]; void updateChanVolume(byte channel); + void endTrack(); + +protected: + byte *_data; + MidiParser *_midiParser; + MidiDriver *_driver; + + void onTimerInternal(); + void updateVolume(); + void unload(); + + bool loadParser(Common::SeekableReadStream *stream, bool loop); +}; + +class MusicPlayerXMI : public MusicPlayerMidi { +public: + MusicPlayerXMI(GroovieEngine *vm, const Common::String >lName); + ~MusicPlayerXMI(); + + void send(uint32 b); + +protected: + bool load(uint32 fileref, bool loop); + +private: // Channel banks byte _chanBanks[0x10]; + // Output music type + uint8 _musicType; + // Timbres class Timbre { public: @@ -81,35 +146,14 @@ private: void clearTimbres(); void setTimbreAD(byte channel, const Timbre &timbre); void setTimbreMT(byte channel, const Timbre &timbre); +}; +class MusicPlayerMac : public MusicPlayerMidi { public: - // MidiDriver interface - int open(); - void close(); - void send(uint32 b); - void metaEvent(byte type, byte *data, uint16 length); - void setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc); - uint32 getBaseTempo(void); - MidiChannel *allocateChannel(); - MidiChannel *getPercussionChannel(); + MusicPlayerMac(GroovieEngine *vm); -private: - GroovieEngine *_vm; - Common::Mutex _mutex; - byte *_data; - MidiParser *_midiParser; - MidiDriver *_driver; - uint8 _musicType; - bool _isPlaying; - - uint32 _backgroundFileRef; - uint8 _prevCDtrack; - - static void onTimer(void *data); - - bool play(uint32 fileref, bool loop); - bool load(uint32 fileref); - void unload(); +protected: + bool load(uint32 fileref, bool loop); }; } // End of Groovie namespace -- cgit v1.2.3 From 6cb5106a0b1b5f2c4d31dff321a08b134af82d1f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 5 Jul 2009 10:34:43 +0000 Subject: Removed validity check for atoi, which prevented console commands from interacting with resources with id 0 svn-id: r42117 --- engines/sci/console.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 6ef6ff3d0c..d978915741 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -567,11 +567,6 @@ bool Console::cmdHexDump(int argc, const char **argv) { } int resNum = atoi(argv[2]); - if (resNum == 0) { - DebugPrintf("The resource number specified is not a number"); - return true; - } - ResourceType res = parseResourceType(argv[1]); if (res == kResourceTypeInvalid) @@ -628,11 +623,6 @@ bool Console::cmdResourceSize(int argc, const char **argv) { } int resNum = atoi(argv[2]); - if (resNum == 0) { - DebugPrintf("The resource number specified is not a number"); - return true; - } - ResourceType res = parseResourceType(argv[1]); if (res == kResourceTypeInvalid) -- cgit v1.2.3 From 5c60d94725764c278aa463b8c206abb796406da9 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 5 Jul 2009 11:08:53 +0000 Subject: SCI1 games with absolute parameters to lofs instructions are automatically detected now. Removed the GF_SCI1_LOFSABSOLUTE game flag svn-id: r42118 --- engines/sci/detection.cpp | 121 +++++++++++++++++++++++------------------- engines/sci/engine/game.cpp | 2 +- engines/sci/engine/kernel.cpp | 3 ++ engines/sci/engine/kernel.h | 8 +++ engines/sci/engine/script.cpp | 1 + engines/sci/engine/vm.cpp | 4 +- engines/sci/engine/vm.h | 7 +-- engines/sci/sci.cpp | 6 +-- engines/sci/sci.h | 8 +-- 9 files changed, 87 insertions(+), 73 deletions(-) diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index 76c2bc0153..79088c86ff 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -34,9 +34,6 @@ namespace Sci { #define GF_FOR_SCI0_BEFORE_395 (GF_SCI0_OLD | GF_SCI0_OLDGETTIME) #define GF_FOR_SCI0_BEFORE_629 GF_SCI0_OLDGETTIME -// SCI1 -#define GF_FOR_SCI1_200_OR_LATER GF_SCI1_LOFSABSOLUTE - // Titles of the games static const PlainGameDescriptor SciGameTitles[] = { {"sci", "Sierra SCI Game"}, @@ -146,7 +143,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "d226d7d3b4f77c4a566913fc310487fc", 792380}, {"resource.003", 0, "d226d7d3b4f77c4a566913fc310487fc", 464348}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -161,7 +158,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "85e51acb5f9c539d66e3c8fe40e17da5", 826309}, {"resource.003", 0, "85e51acb5f9c539d66e3c8fe40e17da5", 493638}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -187,7 +184,19 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.001", 0, "d2f5a1be74ed963fa849a76892be5290", 794832}, {"resource.002", 0, "c0c29c51af66d65cb53f49e785a2d978", 1280907}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, + SCI_VERSION_AUTODETECT, + SCI_VERSION_1 + }, + + // Castle of Dr. Brain - English DOS Floppy 1.1 + {{"castlebrain", "", { + {"resource.map", 0, "f77728304c70017c54793eb6ca648174", 2745}, + {"resource.000", 0, "27ec5fa09cd12a7fd16e86d96a2ed245", 347071}, + {"resource.001", 0, "13e81e1839cd7b216d2bb5615c1ca160", 796776}, + {"resource.002", 0, "930e416bec196b9703a331d81b3d66f2", 1283812}, + {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -199,7 +208,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "27ec5fa09cd12a7fd16e86d96a2ed245", 1197694}, {"resource.001", 0, "735be4e58957180cfc807d5e18fdffcd", 1433302}, {NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -381,7 +390,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.005", 0, "1c3804e56b114028c5873a35c2f06d13", 653002}, {"resource.006", 0, "f9487732289a4f4966b4e34eea413325", 842817}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -398,7 +407,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.005", 0, "d036df0872f2db19bca34601276be2d7", 1154950}, {"resource.006", 0, "b367a6a59f29ee30dde1d88a5a41152d", 1042966}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -415,7 +424,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "9cfce07e204a329e94fda8b5657621da", 1261462}, {"resource.005", 0, "21ebe6b39b57a73fc449f67f013765aa", 1284720}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -431,7 +440,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "9cfce07e204a329e94fda8b5657621da", 1260237}, {"resource.005", 0, "21ebe6b39b57a73fc449f67f013765aa", 1284609}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -448,7 +457,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.005", 0, "58942b1aa6d6ffeb66e9f8897fd4435f", 469243}, {"resource.006", 0, "8c767b3939add63d11274065e46aad04", 713158}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER | GF_SCI1_EGA, + GF_SCI1_EGA, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -476,7 +485,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.005", 0, "d036df0872f2db19bca34601276be2d7", 1176914}, {"resource.006", 0, "b367a6a59f29ee30dde1d88a5a41152d", 1123585}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -513,7 +522,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "28fe9b4f0567e71feb198bc9f3a2c605", 1241816}, {"resource.003", 0, "f3146df0ad4297f5ce35aa8c4753bf6c", 586832}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -527,7 +536,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "323b3b12f43d53f27d259beb225f0aa7", 1129316}, {"resource.003", 0, "83ac03e4bddb2c1ac2d36d2a587d0536", 1145616}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -541,7 +550,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "02d7d0411f7903aacb3bc8b0f8ca8a9a", 1202581}, {"resource.003", 0, "84dd11b6825255671c703aee5ceff620", 1175835}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -556,7 +565,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "2d21a1d2dcbffa551552e3e0725d2284", 1186033}, {"resource.003", 0, "84dd11b6825255671c703aee5ceff620", 1174993}, {NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -873,7 +882,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "595b6039ea1356e7f96a52c58eedcf22", 355791}, {"resource.001", 0, "143df8aef214a2db34c2d48190742012", 632273}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -886,7 +895,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.map", 0, "0d06cacc87dc21a08cd017e73036f905", 735}, {"resource.001", 0, "24db2bccda0a3c43ac4a7b5edb116c7e", 797678}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -899,7 +908,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "6ef28cac094dcd97fdb461662ead6f92", 541845}, {"resource.001", 0, "0a98a268ee99b92c233a0d7187c1f0fa", 845795}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1110,7 +1119,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "449471bfd77be52f18a3773c7f7d843d", 571368}, {"resource.001", 0, "b45a581ff8751e052c7e364f58d3617f", 16800210}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NONE}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1481,7 +1490,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "5790ac0505f7ca98d4567132b875eb1e", 681041}, {"resource.003", 0, "4a34c3367c2fe7eb380d741374da1989", 572251}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1494,7 +1503,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.001", 0, "ec20246209d7b19f38989261e5c8f5b8", 1111226}, {"resource.002", 0, "85d6935ef77e6b0e16bc307640a0d913", 1088312}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1507,7 +1516,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.001", 0, "d34cadb11e1aefbb497cf91bc1d3baa7", 1114688}, {"resource.002", 0, "85b030bb66d5342b0a068f1208c431a8", 1078443}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1534,7 +1543,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "3fe2a3aec0ed53c7d6db1845a67e3aa2", 1095908}, {"resource.003", 0, "ac175df0ea9a2cba57f0248651856d27", 376556}, {NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1548,7 +1557,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.001", 0, "bc8ca10c807515d959cbd91f9ba47735", 1123759}, {"resource.002", 0, "b7409ab32bc3bee2d6cce887cd33f2b6", 1092160}, {NULL, 0, NULL, 0}}, Common::RU_RUS, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1715,7 +1724,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.005", 0, "f8b2d1137bb767e5d232056b99dd69eb", 623621}, {"resource.006", 0, "bafc64e3144f115dc58c6aee02de98fb", 715598}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1734,7 +1743,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.006", 0, "bafc64e3144f115dc58c6aee02de98fb", 754966}, {"resource.007", 0, "59eba83ad465b08d763b44f86afa86f6", 683135}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1763,7 +1772,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 1024810}, {"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 1030656}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1781,7 +1790,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 1021774}, {"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 993408}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1800,7 +1809,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 946540}, {"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 958842}, {NULL, 0, NULL, 0}}, Common::FR_FRA, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1819,7 +1828,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 1015136}, {"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 987222}, {NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -1830,7 +1839,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.map", 0, "a99776df795127f387cb35dae872d4e4", 5919}, {"resource.000", 0, "a8989a5a89e7d4f702b26b378c7a357a", 7001981}, {NULL, 0, NULL, 0}}, Common::IT_ITA, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2156,7 +2165,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.map", 0, "5b457cbe5042f557e5b610148171f6c0", 1158}, {"resource.001", 0, "453ea81ef66a50cbe33ce06302afe47f", 229737}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2327,7 +2336,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.003", 0, "630bfa65beb05f743552704ac2899dae", 759891}, {"resource.004", 0, "7b229fbdf30d670d0728cede3e984a7e", 838663}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2344,7 +2353,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "6258d5dd85898d8e218eb8113ebc9059", 722738}, {"resource.005", 0, "6258d5dd85898d8e218eb8113ebc9059", 704485}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2360,7 +2369,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.003", 0, "8791b9eef53edf77c2dac950142221d3", 1159791}, {"resource.004", 0, "1b91e891a3c60a941dac0eecdf83375b", 1143606}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2373,7 +2382,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "277f97771f7a6d89677141f02da313d6", 65150}, {"resource.001", 0, "5c5a551b6c86cce2ee75becb90e0b586", 624411}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2389,7 +2398,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.003", 0, "4836f460f4cfc8de61e2df4c45775504", 1180956}, {"resource.004", 0, "0c3eb84b9755852d9e795e0d5c9373c7", 1171760}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2853,7 +2862,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "b25a1539c71701f7715f738c5037e9a6", 775515}, {"resource.005", 0, "640ffe1a9acde392cc33cc1b1a528328", 806324}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2869,7 +2878,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.003", 0, "c47600e50c6fc591957ae0c5020ee7b8", 1213262}, {"resource.004", 0, "e19ea4ad131472f9238590f2e1d40289", 1203051}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2897,7 +2906,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "9b78228ad4f9f335fedf74f1812dcfca", 513325}, {"resource.005", 0, "7d4ebcb745c0bf8fc42e4013f52ecd49", 1101812}, {NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -2927,7 +2936,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "6d8f34090503ce937e7dbef6cb6cdb6a", 545053}, {"resource.005", 0, "6d8f34090503ce937e7dbef6cb6cdb6a", 687507}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_0, SCI_VERSION_0 }, @@ -3012,7 +3021,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.005", 0, "3540d1cc84d674cf4b2c898b88a3b563", 790296}, {"resource.006", 0, "ade814bc4d56244c156d9e9bcfebbc11", 664085}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -3029,7 +3038,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.005", 0, "10ee1709e6559c724676d058199b75b5", 818745}, {"resource.006", 0, "67fb188b191d88efe8414af6ea297b93", 672675}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -3041,7 +3050,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.map", 0, "a18088c8aceb06025dbc945f29e02935", 5124}, {"resource.000", 0, "e1f46832cd2458796028e054a0466031", 5502009}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -3053,7 +3062,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.map", 0, "71ccf4f82ac4efb588731acfb7bf2603", 5646}, {"resource.000", 0, "e1f46832cd2458796028e054a0466031", 933928}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -3070,7 +3079,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "ff9c87da3bc53473fdee8b9d3edbc93c", 1200631}, {"resource.005", 0, "e33019ac19f755ae33fbf49b4fc9066c", 1053294}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -3087,7 +3096,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.005", 0, "47ee647b5b12232d27e63cc627c25899", 1156765}, {"resource.006", 0, "dfb023e4e2a1e7a00fa18f9ede72a91b", 924059}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -3103,7 +3112,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "4277c61bed40a50dadc4b5a344520af2", 1251000}, {"resource.005", 0, "5f885abd335978e2fd4e5f886d7676c8", 1102880}, {NULL, 0, NULL, 0}}, Common::IT_ITA, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -3116,7 +3125,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.001", 0, "454684e3a7a68cbca073945e50778447", 1187088}, {"resource.002", 0, "6dc668326cc22cb9e8bd8ca9e68d2a66", 1181249}, {NULL, 0, NULL, 0}}, Common::JA_JPN, Common::kPlatformPC98, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER | GF_SCI1_EGA, + GF_SCI1_EGA, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -3129,7 +3138,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.001", 0, "454684e3a7a68cbca073945e50778447", 1187088}, {"resource.002", 0, "6dc668326cc22cb9e8bd8ca9e68d2a66", 1181249}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC98, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER | GF_SCI1_EGA, + GF_SCI1_EGA, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -3157,7 +3166,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "776fba81c110d1908776232cbe190e20", 1253752}, {"resource.005", 0, "55fae26c2a92f16ef72c1e216e827c0f", 1098328}, {NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NONE}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -3172,7 +3181,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "74c62fa2146ff3b3b2ea2b3fb95b9af9", 1140801}, {"resource.003", 0, "42a307941edeb1a3be31daeb2e4be90b", 1088408}, {NULL, 0, NULL, 0}}, Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -3189,7 +3198,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "c06350184a490c10eb4585fff0aa3192", 1254368}, {"resource.005", 0, "b8d6efbd3235329bfe844c794097b2c9", 1098717}, {NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI1_200_OR_LATER, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -3412,7 +3421,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { FANMADE("The Legend of the Lost Jewel", "ba1bca315e3818c5626eda51bcfbcccf", 636, "9b0736d69924af0cff32a0f78db96855", 300398), // FIXME: The vga demo does not have a resource.000/001 file. - //FANMADE_V("SCI VGA Demo", "00b1abd87bad356b90fcdfcb6132c26f", 8, "", 0, GF_FOR_SCI1_200_OR_LATER), + //FANMADE_V("SCI VGA Demo", "00b1abd87bad356b90fcdfcb6132c26f", 8, "", 0, 0), {AD_TABLE_END_MARKER, 0, SCI_VERSION_AUTODETECT, SCI_VERSION_0} }; diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index a1e2c24955..a1e7569967 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -377,7 +377,7 @@ int script_init_engine(EngineState *s) { s->bp_list = NULL; // No breakpoints defined s->have_bp = 0; - if ((s->_flags & GF_SCI1_LOFSABSOLUTE) && s->_version < SCI_VERSION_1_1) + if (s->_kernel->hasLofsAbsolute()) s->seg_manager->setExportWidth(1); else s->seg_manager->setExportWidth(0); diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index ab6fb36085..eaa1cbcbc2 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -365,6 +365,9 @@ Kernel::Kernel(ResourceManager *resmgr, bool isOldSci0) : _resmgr(resmgr) { // SCI0 games using old graphics functions (before version 0.000.502) did not have a // curAngle selector _oldGfxFunctions = (_selectorMap.curAngle == -1 && _resmgr->_sciVersion == SCI_VERSION_0); + + // SCI1 games which use absolute lofs have the egoMoveSpeed selector + _hasLofsAbsolute = (_selectorMap.egoMoveSpeed != -1 && _resmgr->_sciVersion < SCI_VERSION_1_1); } Kernel::~Kernel() { diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index ad7605753b..da8ef04135 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -92,6 +92,13 @@ public: */ bool usesOldGfxFunctions() const { return _oldGfxFunctions; } + /** + * Applies to all SCI1 versions after 1.000.200 + * In late SCI1 versions, the argument of lofs[as] instructions + * is absolute rather than relative. + */ + bool hasLofsAbsolute() const { return _hasLofsAbsolute; } + // Script dissection/dumping functions void dissectScript(int scriptNumber, Vocabulary *vocab); void dumpScriptObject(char *data, int seeker, int objsize); @@ -140,6 +147,7 @@ private: ResourceManager *_resmgr; bool _oldGfxFunctions; + bool _hasLofsAbsolute; // Kernel-related lists /** diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index ca5379a4c0..0b89fbc093 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -205,6 +205,7 @@ void Kernel::mapSelectors() { FIND_SELECTOR(curAngle); FIND_SELECTOR(sightAngle); FIND_SELECTOR(setVol); + FIND_SELECTOR(egoMoveSpeed); } void Kernel::dumpScriptObject(char *data, int seeker, int objsize) { diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 92f890512a..a31af68323 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -1193,7 +1193,7 @@ void run_vm(EngineState *s, int restoring) { if (s->_version >= SCI_VERSION_1_1) { s->r_acc.offset = opparams[0] + local_script->script_size; } else { - if (s->_flags & GF_SCI1_LOFSABSOLUTE) + if (s->_kernel->hasLofsAbsolute()) s->r_acc.offset = opparams[0]; else s->r_acc.offset = xs->addr.pc.offset + opparams[0]; @@ -1210,7 +1210,7 @@ void run_vm(EngineState *s, int restoring) { case 0x3a: // lofss r_temp.segment = xs->addr.pc.segment; - if (s->_flags & GF_SCI1_LOFSABSOLUTE) + if (s->_kernel->hasLofsAbsolute()) r_temp.offset = opparams[0]; else r_temp.offset = xs->addr.pc.offset + opparams[0]; diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h index f1e89bba45..f20838bb4a 100644 --- a/engines/sci/engine/vm.h +++ b/engines/sci/engine/vm.h @@ -203,9 +203,10 @@ struct selector_map_t { Selector printLang; /**< Used for i18n */ Selector subtitleLang; Selector parseLang; - Selector curAngle; // Used to detect newer graphics functions semantics. - Selector sightAngle; // Used to detect some SCI0/SCI01 games which need a SCI1 table - Selector setVol; // Used to detect newer sound semantics + Selector curAngle; // Used to detect newer graphics functions semantics. + Selector sightAngle; // Used to detect some SCI0/SCI01 games which need a SCI1 table + Selector setVol; // Used to detect newer sound semantics + Selector egoMoveSpeed; // Used to detect SCI1 games which use absolute values in lofs }; // A reference to an object's variable. diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 3686126c83..9b9c466812 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -149,8 +149,7 @@ Common::Error SciEngine::run() { // Verify that we haven't got an invalid game detection entry if (version < SCI_VERSION_1) { // SCI0/SCI01 - if (flags & GF_SCI1_EGA || - flags & GF_SCI1_LOFSABSOLUTE) { + if (flags & GF_SCI1_EGA) { error("This game entry is erroneous. It's marked as SCI0/SCI01, but it has SCI1 flags set"); } } else if (version == SCI_VERSION_1) { @@ -161,8 +160,7 @@ Common::Error SciEngine::run() { error("This game entry is erroneous. It's marked as SCI1, but it has SCI0 flags set"); } } else if (version == SCI_VERSION_1_1 || version == SCI_VERSION_32) { - if (flags & GF_SCI1_EGA || - flags & GF_SCI1_LOFSABSOLUTE) { + if (flags & GF_SCI1_EGA) { error("This game entry is erroneous. It's marked as SCI1.1/SCI32, but it has SCI1 flags set"); } diff --git a/engines/sci/sci.h b/engines/sci/sci.h index 6236b9843b..c158bb25ab 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -104,13 +104,7 @@ enum SciGameFlags { /* * Used to distinguish SCI1 EGA games */ - GF_SCI1_EGA = (1 << 2), - - /* Applies to all SCI1 versions after 1.000.200 - * In late SCI1 versions, the argument of lofs[as] instructions - * is absolute rather than relative. - */ - GF_SCI1_LOFSABSOLUTE = (1 << 3) + GF_SCI1_EGA = (1 << 2) }; class SciEngine : public Engine { -- cgit v1.2.3 From d2c2386c6ad70cb1e7edd40b1c007c5f863be99c Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 11:26:23 +0000 Subject: Adding an enum MouseButtons svn-id: r42119 --- engines/gob/game.cpp | 9 ++++----- engines/gob/game.h | 6 ++++-- engines/gob/game_fascin.cpp | 8 ++++---- engines/gob/game_v1.cpp | 16 ++++++++-------- engines/gob/game_v2.cpp | 14 +++++++------- engines/gob/game_v6.cpp | 14 +++++++------- engines/gob/inter.cpp | 2 +- engines/gob/inter_bargon.cpp | 4 ++-- engines/gob/util.cpp | 38 +++++++++++++++++++------------------- engines/gob/util.h | 13 +++++++++++-- 10 files changed, 67 insertions(+), 57 deletions(-) diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index 5771ee9f76..f69b899ce1 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -29,7 +29,6 @@ #include "gob/game.h" #include "gob/helper.h" #include "gob/global.h" -#include "gob/util.h" #include "gob/dataio.h" #include "gob/variables.h" #include "gob/script.h" @@ -186,7 +185,7 @@ Game::Game(GobEngine *vm) : _vm(vm) { _totToLoad[0] = 0; _startTimeKey = 0; - _mouseButtons = 0; + _mouseButtons = kMouseButtonsNone; _lastCollKey = 0; _lastCollAreaIndex = 0; @@ -349,7 +348,7 @@ void Game::evaluateScroll(int16 x, int16 y) { } int16 Game::checkKeys(int16 *pMouseX, int16 *pMouseY, - int16 *pButtons, char handleMouse) { + MouseButtons *pButtons, char handleMouse) { _vm->_util->processInput(true); @@ -373,8 +372,8 @@ int16 Game::checkKeys(int16 *pMouseX, int16 *pMouseY, if (pMouseX && pMouseY && pButtons) { _vm->_util->getMouseState(pMouseX, pMouseY, pButtons); - if (*pButtons == 3) - *pButtons = 0; + if (*pButtons == kMouseButtonsBoth) + *pButtons = kMouseButtonsNone; } return _vm->_util->checkKey(); diff --git a/engines/gob/game.h b/engines/gob/game.h index ead4a56492..eb579d44a4 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -26,6 +26,8 @@ #ifndef GOB_GAME_H #define GOB_GAME_H +#include "gob/util.h" + namespace Gob { class Script; @@ -103,7 +105,7 @@ public: char _totToLoad[20]; int32 _startTimeKey; - int16 _mouseButtons; + MouseButtons _mouseButtons; bool _noScroll; bool _preventScroll; @@ -122,7 +124,7 @@ public: void evaluateScroll(int16 x, int16 y); int16 checkKeys(int16 *pMousex = 0, int16 *pMouseY = 0, - int16 *pButtons = 0, char handleMouse = 0); + MouseButtons *pButtons = 0, char handleMouse = 0); void start(void); virtual void totSub(int8 flags, const char *newTotFile); diff --git a/engines/gob/game_fascin.cpp b/engines/gob/game_fascin.cpp index 38ad03f0f8..1387bf1de1 100644 --- a/engines/gob/game_fascin.cpp +++ b/engines/gob/game_fascin.cpp @@ -100,7 +100,7 @@ int16 Game_Fascination::checkCollisions(byte handleMouse, int16 deltaTime, int16 key = checkKeys(&_vm->_global->_inter_mouseX, &_vm->_global->_inter_mouseY, &_mouseButtons, handleMouse); - if ((handleMouse == 0) && (_mouseButtons != 0)) { + if ((handleMouse == 0) && (_mouseButtons != kMouseButtonsNone)) { _vm->_util->waitMouseRelease(0); key = 3; } @@ -125,7 +125,7 @@ int16 Game_Fascination::checkCollisions(byte handleMouse, int16 deltaTime, int16 } if (handleMouse != 0) { - if (_mouseButtons != 0) { + if (_mouseButtons != kMouseButtonsNone) { if (deltaTime > 0) { _vm->_draw->animateCursor(2); _vm->_util->delay(deltaTime); @@ -142,7 +142,7 @@ int16 Game_Fascination::checkCollisions(byte handleMouse, int16 deltaTime, int16 if ((key != 0) || ((pResId != 0) && (*pResId != 0))) { if ((handleMouse & 1) && - ((deltaTime <= 0) || (_mouseButtons == 0))) + ((deltaTime <= 0) || (_mouseButtons == kMouseButtonsNone))) _vm->_draw->blitCursor(); if ((_lastCollKey != 0) && (key != _lastCollKey)) @@ -180,7 +180,7 @@ int16 Game_Fascination::checkCollisions(byte handleMouse, int16 deltaTime, int16 } } - if ((deltaTime < 0) && (key == 0) && (_mouseButtons == 0)) { + if ((deltaTime < 0) && (key == 0) && (_mouseButtons == kMouseButtonsNone)) { uint32 curtime = _vm->_util->getTimeKey(); if ((curtime + deltaTime) > timeKey) { if (pResId != 0) diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index 87dc78e3b1..cf1641928c 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -317,7 +317,7 @@ int16 Game_v1::checkCollisions(byte handleMouse, int16 deltaTime, key = checkKeys(&_vm->_global->_inter_mouseX, &_vm->_global->_inter_mouseY, &_mouseButtons, handleMouse); - if ((handleMouse == 0) && (_mouseButtons != 0)) { + if ((handleMouse == 0) && (_mouseButtons != kMouseButtonsNone)) { _vm->_util->waitMouseRelease(0); key = 3; } @@ -347,7 +347,7 @@ int16 Game_v1::checkCollisions(byte handleMouse, int16 deltaTime, } if (handleMouse != 0) { - if (_mouseButtons != 0) { + if (_mouseButtons != kMouseButtonsNone) { oldIndex = 0; _vm->_draw->animateCursor(2); @@ -368,7 +368,7 @@ int16 Game_v1::checkCollisions(byte handleMouse, int16 deltaTime, if ((key != 0) || ((pResId != 0) && (*pResId != 0))) { if ((handleMouse == 1) && - ((deltaTime <= 0) || (_mouseButtons == 0))) + ((deltaTime <= 0) || (_mouseButtons == kMouseButtonsNone))) _vm->_draw->blitCursor(); if ((_lastCollKey != 0) && @@ -775,7 +775,7 @@ void Game_v1::collisionsBlock(void) { _activeCollIndex = i; WRITE_VAR(2, _vm->_global->_inter_mouseX); WRITE_VAR(3, _vm->_global->_inter_mouseY); - WRITE_VAR(4, _mouseButtons); + WRITE_VAR(4, (uint32) _mouseButtons); WRITE_VAR(16, array[(uint16) _activeCollResId & ~0x8000]); if (collPtr->funcLeave != 0) { @@ -870,7 +870,7 @@ void Game_v1::collisionsBlock(void) { WRITE_VAR(2, _vm->_global->_inter_mouseX); WRITE_VAR(3, _vm->_global->_inter_mouseY); - WRITE_VAR(4, _mouseButtons); + WRITE_VAR(4, (uint32) _mouseButtons); WRITE_VAR(16, array[(uint16) _activeCollResId & ~0x8000]); if (_collisionAreas[_activeCollIndex].funcEnter != 0) { @@ -965,7 +965,7 @@ void Game_v1::collisionsBlock(void) { WRITE_VAR(2, _vm->_global->_inter_mouseX); WRITE_VAR(3, _vm->_global->_inter_mouseY); - WRITE_VAR(4, _mouseButtons); + WRITE_VAR(4, (uint32) _mouseButtons); if (VAR(16) == 0) WRITE_VAR(16, array[(uint16) _activeCollResId & ~0x8000]); @@ -1400,7 +1400,7 @@ int16 Game_v1::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) { if (((ptr->flags & 0xF) != 1) && ((ptr->flags & 0xF) != 2)) continue; - if ((((ptr->flags & 0xF0) >> 4) != (_mouseButtons - 1)) + if ((((ptr->flags & 0xF0) >> 4) != (((int32) _mouseButtons) - 1)) && (((ptr->flags & 0xF0) >> 4) != 2)) continue; @@ -1417,7 +1417,7 @@ int16 Game_v1::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) { } } - if ((_mouseButtons != 1) && (all == 0)) + if ((_mouseButtons != kMouseButtonsLeft) && (all == 0)) return 0x11B; return 0; diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index 08184e73d0..e910b5278e 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -338,7 +338,7 @@ int16 Game_v2::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, key = checkKeys(&_vm->_global->_inter_mouseX, &_vm->_global->_inter_mouseY, &_mouseButtons, handleMouse); - if ((handleMouse == 0) && (_mouseButtons != 0)) { + if ((handleMouse == 0) && (_mouseButtons != kMouseButtonsNone)) { _vm->_util->waitMouseRelease(0); key = 3; } @@ -363,7 +363,7 @@ int16 Game_v2::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, } if (handleMouse != 0) { - if (_mouseButtons != 0) { + if (_mouseButtons != kMouseButtonsNone) { if (deltaTime > 0) { _vm->_draw->animateCursor(2); _vm->_util->delay(deltaTime); @@ -380,7 +380,7 @@ int16 Game_v2::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, if ((key != 0) || ((pResId != 0) && (*pResId != 0))) { if ((handleMouse & 1) && - ((deltaTime <= 0) || (_mouseButtons == 0))) + ((deltaTime <= 0) || (_mouseButtons == kMouseButtonsNone))) _vm->_draw->blitCursor(); if ((_lastCollKey != 0) && (key != _lastCollKey)) @@ -418,7 +418,7 @@ int16 Game_v2::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, } } - if ((deltaTime < 0) && (key == 0) && (_mouseButtons == 0)) { + if ((deltaTime < 0) && (key == 0) && (_mouseButtons == kMouseButtonsNone)) { uint32 curtime = _vm->_util->getTimeKey(); if ((curtime + deltaTime) > timeKey) { if (pResId != 0) @@ -1103,7 +1103,7 @@ int16 Game_v2::multiEdit(int16 time, int16 index, int16 *pCurPos, if (*collResId == 0) return 0; - if (_mouseButtons != 0) { + if (_mouseButtons != kMouseButtonsNone) { for (collArea = _collisionAreas, i = 0; collArea->left != 0xFFFF; collArea++, i++) { if ((collArea->flags & 0xF00)) @@ -1535,7 +1535,7 @@ int16 Game_v2::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) { if ((ptr->flags & 0xF) < 1) continue; - if ((((ptr->flags & 0xF0) >> 4) != (_mouseButtons - 1)) && + if ((((ptr->flags & 0xF0) >> 4) != (((int32) _mouseButtons) - 1)) && (((ptr->flags & 0xF0) >> 4) != 2)) continue; @@ -1554,7 +1554,7 @@ int16 Game_v2::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) { } } - if ((_mouseButtons != 1) && (all == 0)) + if ((_mouseButtons != kMouseButtonsLeft) && (all == 0)) return 0x11B; return 0; diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp index 8d40d41acc..dade2adddf 100644 --- a/engines/gob/game_v6.cpp +++ b/engines/gob/game_v6.cpp @@ -261,7 +261,7 @@ int16 Game_v6::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, key = checkKeys(&_vm->_global->_inter_mouseX, &_vm->_global->_inter_mouseY, &_mouseButtons, handleMouse); - if ((handleMouse == 0) && (_mouseButtons != 0)) { + if ((handleMouse == 0) && (_mouseButtons != kMouseButtonsNone)) { _vm->_util->waitMouseRelease(0); key = 3; } @@ -289,7 +289,7 @@ int16 Game_v6::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, } if (handleMouse != 0) { - if (_mouseButtons != 0) { + if (_mouseButtons != kMouseButtonsNone) { if (deltaTime > 0) { _vm->_draw->animateCursor(2); @@ -308,7 +308,7 @@ int16 Game_v6::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, if ((key != 0) || ((pResId != 0) && (*pResId != 0))) { if ((handleMouse & 1) && - ((deltaTime <= 0) || (_mouseButtons == 0))) + ((deltaTime <= 0) || (_mouseButtons == kMouseButtonsNone))) _vm->_draw->blitCursor(); if (key != _lastCollKey) @@ -331,7 +331,7 @@ int16 Game_v6::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, collSubReenter(); } - if ((deltaTime == -2) && (key == 0) && (_mouseButtons == 0)) { + if ((deltaTime == -2) && (key == 0) && (_mouseButtons == kMouseButtonsNone)) { if (pResId != 0) *pResId = 0; @@ -343,7 +343,7 @@ int16 Game_v6::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, } else if (handleMouse != 0) _vm->_draw->animateCursor(-1); - if ((deltaTime < 0) && (key == 0) && (_mouseButtons == 0)) { + if ((deltaTime < 0) && (key == 0) && (_mouseButtons == kMouseButtonsNone)) { uint32 curtime = _vm->_util->getTimeKey(); if ((curtime + deltaTime) > timeKey) { if (pResId != 0) @@ -1069,7 +1069,7 @@ int16 Game_v6::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) { if ((ptr->flags & 0xF) < 1) continue; - if ((((ptr->flags & 0x70) >> 4) != (_mouseButtons - 1)) && + if ((((ptr->flags & 0x70) >> 4) != (((int32) _mouseButtons) - 1)) && (((ptr->flags & 0x70) >> 4) != 2)) continue; @@ -1088,7 +1088,7 @@ int16 Game_v6::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) { } } - if ((_mouseButtons != 1) && (all == 0)) + if ((_mouseButtons != kMouseButtonsLeft) && (all == 0)) return 0x11B; return 0; diff --git a/engines/gob/inter.cpp b/engines/gob/inter.cpp index 8be07034c6..3cbdaa3584 100644 --- a/engines/gob/inter.cpp +++ b/engines/gob/inter.cpp @@ -180,7 +180,7 @@ void Inter::storeMouse() { WRITE_VAR(2, x); WRITE_VAR(3, y); - WRITE_VAR(4, _vm->_game->_mouseButtons); + WRITE_VAR(4, (uint32) _vm->_game->_mouseButtons); } void Inter::storeKey(int16 key) { diff --git a/engines/gob/inter_bargon.cpp b/engines/gob/inter_bargon.cpp index 12079600c0..1cffe4ca2d 100644 --- a/engines/gob/inter_bargon.cpp +++ b/engines/gob/inter_bargon.cpp @@ -89,7 +89,7 @@ void Inter_Bargon::oBargon_intro2(OpGobParams ¶ms) { int i; int16 mouseX; int16 mouseY; - int16 buttons; + MouseButtons buttons; SurfaceDescPtr surface; SoundDesc samples[4]; int16 comp[5] = { 0, 1, 2, 3, -1 }; @@ -137,7 +137,7 @@ void Inter_Bargon::oBargon_intro2(OpGobParams ¶ms) { void Inter_Bargon::oBargon_intro3(OpGobParams ¶ms) { int16 mouseX; int16 mouseY; - int16 buttons; + MouseButtons buttons; Video::Color *palBak; SoundDesc samples[2]; int16 comp[3] = { 0, 1, -1 }; diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index b0e7691c07..6c38dcb5a9 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -38,14 +38,14 @@ namespace Gob { Util::Util(GobEngine *vm) : _vm(vm) { - _mouseButtons = 0; - _keyBufferHead = 0; - _keyBufferTail = 0; - _fastMode = 0; - _frameRate = 12; - _frameWaitTime = 0; + _mouseButtons = kMouseButtonsNone, + _keyBufferHead = 0; + _keyBufferTail = 0; + _fastMode = 0; + _frameRate = 12; + _frameWaitTime = 0; _startFrameTime = 0; - _frameWaitLag = 0; + _frameWaitLag = 0; } uint32 Util::getTimeKey(void) { @@ -85,7 +85,7 @@ void Util::longDelay(uint16 msecs) { } void Util::initInput(void) { - _mouseButtons = 0; + _mouseButtons = kMouseButtonsNone; _keyBufferHead = _keyBufferTail = 0; } @@ -103,16 +103,16 @@ void Util::processInput(bool scroll) { y = event.mouse.y; break; case Common::EVENT_LBUTTONDOWN: - _mouseButtons |= 1; + _mouseButtons = (MouseButtons) (((uint32) _mouseButtons) | ((uint32) kMouseButtonsLeft)); break; case Common::EVENT_RBUTTONDOWN: - _mouseButtons |= 2; + _mouseButtons = (MouseButtons) (((uint32) _mouseButtons) | ((uint32) kMouseButtonsRight)); break; case Common::EVENT_LBUTTONUP: - _mouseButtons &= ~1; + _mouseButtons = (MouseButtons) (((uint32) _mouseButtons) & ~((uint32) kMouseButtonsLeft)); break; case Common::EVENT_RBUTTONUP: - _mouseButtons &= ~2; + _mouseButtons = (MouseButtons) (((uint32) _mouseButtons) & ~((uint32) kMouseButtonsRight)); break; case Common::EVENT_KEYDOWN: if (event.kbd.flags == Common::KBD_CTRL) { @@ -246,7 +246,7 @@ bool Util::checkKey(int16 &key) { return true; } -void Util::getMouseState(int16 *pX, int16 *pY, int16 *pButtons) { +void Util::getMouseState(int16 *pX, int16 *pY, MouseButtons *pButtons) { Common::Point mouse = g_system->getEventManager()->getMousePos(); *pX = mouse.x + _vm->_video->_scrollOffsetX - _vm->_video->_screenDeltaX; *pY = mouse.y + _vm->_video->_scrollOffsetY - _vm->_video->_screenDeltaY; @@ -264,15 +264,15 @@ void Util::setMousePos(int16 x, int16 y) { void Util::waitMouseUp(void) { do { processInput(); - if (_mouseButtons != 0) + if (_mouseButtons != kMouseButtonsNone) delay(10); - } while (_mouseButtons != 0); + } while (_mouseButtons != kMouseButtonsNone); } void Util::waitMouseDown(void) { int16 x; int16 y; - int16 buttons; + MouseButtons buttons; do { processInput(); @@ -283,7 +283,7 @@ void Util::waitMouseDown(void) { } void Util::waitMouseRelease(char drawMouse) { - int16 buttons; + MouseButtons buttons; int16 mouseX; int16 mouseY; @@ -300,8 +300,8 @@ void Util::forceMouseUp(bool onlyWhenSynced) { if (onlyWhenSynced && (_vm->_game->_mouseButtons != _mouseButtons)) return; - _vm->_game->_mouseButtons = 0; - _mouseButtons = 0; + _vm->_game->_mouseButtons = kMouseButtonsNone; + _mouseButtons = kMouseButtonsNone; } void Util::clearPalette(void) { diff --git a/engines/gob/util.h b/engines/gob/util.h index 0a76ee40ab..2b6ea7fdc3 100644 --- a/engines/gob/util.h +++ b/engines/gob/util.h @@ -34,6 +34,14 @@ namespace Gob { #define KEYBUFSIZE 16 +enum MouseButtons { + kMouseButtonsNone = 0, + kMouseButtonsLeft = 1, + kMouseButtonsRight = 2, + kMouseButtonsBoth = 3, + kMouseButtonsAny = 4 +}; + class Util { public: struct ListNode; @@ -66,7 +74,7 @@ public: int16 checkKey(void); bool checkKey(int16 &key); - void getMouseState(int16 *pX, int16 *pY, int16 *pButtons); + void getMouseState(int16 *pX, int16 *pY, MouseButtons *pButtons); void setMousePos(int16 x, int16 y); void waitMouseUp(void); void waitMouseDown(void); @@ -95,7 +103,8 @@ public: Util(GobEngine *vm); protected: - int16 _mouseButtons; + MouseButtons _mouseButtons; + Common::KeyState _keyBuffer[KEYBUFSIZE]; int16 _keyBufferHead; int16 _keyBufferTail; -- cgit v1.2.3 From 704895b35ff365525e894f8caf92c4383d446209 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 11:26:42 +0000 Subject: Commenting prepareStr a bit and renaming it to cleanupStr svn-id: r42120 --- engines/gob/game_v1.cpp | 4 ++-- engines/gob/game_v2.cpp | 4 ++-- engines/gob/game_v6.cpp | 4 ++-- engines/gob/inter.h | 2 +- engines/gob/inter_v1.cpp | 6 +++--- engines/gob/util.cpp | 9 ++++++--- engines/gob/util.h | 2 +- 7 files changed, 17 insertions(+), 14 deletions(-) diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index cf1641928c..7db4f65f2c 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -928,7 +928,7 @@ void Game_v1::collisionsBlock(void) { strncpy0(_tempStr, GET_VARO_STR(_collisionAreas[i].key), 255); if ((_collisionAreas[i].flags & 0x0F) < 7) - _vm->_util->prepareStr(_tempStr); + _vm->_util->cleanupStr(_tempStr); int16 pos = 0; do { @@ -938,7 +938,7 @@ void Game_v1::collisionsBlock(void) { str += strlen(str) + 1; if ((_collisionAreas[i].flags & 0x0F) < 7) - _vm->_util->prepareStr(_collStr); + _vm->_util->cleanupStr(_collStr); if (strcmp(_tempStr, _collStr) == 0) { WRITE_VAR(17, VAR(17) + 1); diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index e910b5278e..9d494ad6fe 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -935,7 +935,7 @@ void Game_v2::collisionsBlock(void) { strncpy0(_tempStr, GET_VARO_STR(_collisionAreas[i].key), 255); if ((_collisionAreas[i].flags & 0x0F) < 7) - _vm->_util->prepareStr(_tempStr); + _vm->_util->cleanupStr(_tempStr); int16 pos = 0; do { @@ -945,7 +945,7 @@ void Game_v2::collisionsBlock(void) { str += strlen(str) + 1; if ((_collisionAreas[i].flags & 0x0F) < 7) - _vm->_util->prepareStr(_collStr); + _vm->_util->cleanupStr(_collStr); if (strcmp(_tempStr, _collStr) == 0) { WRITE_VAR(17, VAR(17) + 1); diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp index dade2adddf..e2c0c52919 100644 --- a/engines/gob/game_v6.cpp +++ b/engines/gob/game_v6.cpp @@ -839,7 +839,7 @@ void Game_v6::collisionsBlock(void) { strncpy0(_tempStr, GET_VARO_STR(_collisionAreas[i].key), 255); if ((_collisionAreas[i].flags & 0x0F) < 7) - _vm->_util->prepareStr(_tempStr); + _vm->_util->cleanupStr(_tempStr); int16 pos = 0; do { @@ -849,7 +849,7 @@ void Game_v6::collisionsBlock(void) { str += strlen(str) + 1; if ((_collisionAreas[i].flags & 0x0F) < 7) - _vm->_util->prepareStr(_collStr); + _vm->_util->cleanupStr(_collStr); if (strcmp(_tempStr, _collStr) == 0) { WRITE_VAR(17, VAR(17) + 1); diff --git a/engines/gob/inter.h b/engines/gob/inter.h index d4ed2d3240..9d983f4fe7 100644 --- a/engines/gob/inter.h +++ b/engines/gob/inter.h @@ -238,7 +238,7 @@ protected: bool o1_playComposition(OpFuncParams ¶ms); bool o1_getFreeMem(OpFuncParams ¶ms); bool o1_checkData(OpFuncParams ¶ms); - bool o1_prepareStr(OpFuncParams ¶ms); + bool o1_cleanupStr(OpFuncParams ¶ms); bool o1_insertStr(OpFuncParams ¶ms); bool o1_cutStr(OpFuncParams ¶ms); bool o1_strstr(OpFuncParams ¶ms); diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp index 96ecfc6b25..23c9351dd4 100644 --- a/engines/gob/inter_v1.cpp +++ b/engines/gob/inter_v1.cpp @@ -147,7 +147,7 @@ void Inter_v1::setupOpcodesFunc() { OPCODEFUNC(0x3E, o1_getFreeMem); OPCODEFUNC(0x3F, o1_checkData); - OPCODEFUNC(0x41, o1_prepareStr); + OPCODEFUNC(0x41, o1_cleanupStr); OPCODEFUNC(0x42, o1_insertStr); OPCODEFUNC(0x43, o1_cutStr); @@ -1601,11 +1601,11 @@ bool Inter_v1::o1_checkData(OpFuncParams ¶ms) { return false; } -bool Inter_v1::o1_prepareStr(OpFuncParams ¶ms) { +bool Inter_v1::o1_cleanupStr(OpFuncParams ¶ms) { int16 strVar; strVar = _vm->_game->_script->readVarIndex(); - _vm->_util->prepareStr(GET_VARO_FSTR(strVar)); + _vm->_util->cleanupStr(GET_VARO_FSTR(strVar)); return false; } diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index 6c38dcb5a9..4830c4be51 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -452,7 +452,7 @@ static const char trStr2[] = " "; static const char trStr3[] = " "; -void Util::prepareStr(char *str) { +void Util::cleanupStr(char *str) { char *start, *end; char buf[300]; @@ -460,17 +460,20 @@ void Util::prepareStr(char *str) { strcat(buf, trStr2); strcat(buf, trStr3); + // Translating "wrong" characters for (size_t i = 0; i < strlen(str); i++) - str[i] = buf[str[i] - 32]; + str[i] = buf[MIN(str[i] - 32, 32)]; + // Trim spaces left while (str[0] == ' ') cutFromStr(str, 0, 1); + // Trim spaces right while ((strlen(str) > 0) && (str[strlen(str) - 1] == ' ')) cutFromStr(str, strlen(str) - 1, 1); + // Merge double spaces start = strchr(str, ' '); - while (start) { if (start[1] == ' ') { cutFromStr(str, start - str, 1); diff --git a/engines/gob/util.h b/engines/gob/util.h index 2b6ea7fdc3..b0bcf70d0c 100644 --- a/engines/gob/util.h +++ b/engines/gob/util.h @@ -92,7 +92,7 @@ public: static void insertStr(const char *str1, char *str2, int16 pos); static void cutFromStr(char *str, int16 from, int16 cutlen); - static void prepareStr(char *str); + static void cleanupStr(char *str); static void replaceChar(char *str, char c1, char c2); static void listInsertFront(List *list, void *data); -- cgit v1.2.3 From e861fab808897b8ec10a03930d94a079f1c7f1bb Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 11:27:11 +0000 Subject: Added a Key and ShortKey enum svn-id: r42121 --- engines/gob/demos/demoplayer.cpp | 2 +- engines/gob/game_v1.cpp | 73 ++++++++++++++++++++-------------------- engines/gob/game_v2.cpp | 73 ++++++++++++++++++++-------------------- engines/gob/game_v6.cpp | 4 +-- engines/gob/inter.cpp | 28 +++++++-------- engines/gob/inter_bargon.cpp | 8 ++--- engines/gob/inter_v6.cpp | 1 + engines/gob/mult.cpp | 2 +- engines/gob/sound/sound.cpp | 2 +- engines/gob/util.cpp | 40 +++++++++++----------- engines/gob/util.h | 33 ++++++++++++++++++ engines/gob/videoplayer.cpp | 1 - engines/gob/videoplayer.h | 8 +++-- 13 files changed, 154 insertions(+), 121 deletions(-) diff --git a/engines/gob/demos/demoplayer.cpp b/engines/gob/demos/demoplayer.cpp index 0229bb7515..7f65721ce5 100644 --- a/engines/gob/demos/demoplayer.cpp +++ b/engines/gob/demos/demoplayer.cpp @@ -222,7 +222,7 @@ void DemoPlayer::playVideoDoubled() { int16 key; bool end = false; while (_vm->_util->checkKey(key)) - if (key == 0x011B) + if (key == kKeyEscape) end = true; if (end) break; diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index 7db4f65f2c..ca6a7044cb 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -684,7 +684,7 @@ void Game_v1::collisionsBlock(void) { key = multiEdit(deltaTime, index, &curEditIndex, descArray, &_activeCollResId, &_activeCollIndex); - if (key == 0x1C0D) { + if (key == kKeyReturn) { for (i = 0; i < 250; i++) { if (_collisionAreas[i].left == 0xFFFF) continue; @@ -1066,7 +1066,7 @@ int16 Game_v1::multiEdit(int16 time, int16 index, int16 *pCurPos, return 0; switch (key) { - case 0: + case kKeyNone: if (*collResId == 0) return 0; @@ -1099,19 +1099,19 @@ int16 Game_v1::multiEdit(int16 time, int16 index, int16 *pCurPos, } break; - case 0x3B00: - case 0x3C00: - case 0x3D00: - case 0x3E00: - case 0x3F00: - case 0x4000: - case 0x4100: - case 0x4200: - case 0x4300: - case 0x4400: + case kKeyF1: + case kKeyF2: + case kKeyF3: + case kKeyF4: + case kKeyF5: + case kKeyF6: + case kKeyF7: + case kKeyF8: + case kKeyF9: + case kKeyF10: return key; - case 0x1C0D: + case kKeyReturn: if (index == 1) return key; @@ -1124,12 +1124,12 @@ int16 Game_v1::multiEdit(int16 time, int16 index, int16 *pCurPos, pCurPos[0]++; break; - case 0x5000: + case kKeyDown: if (index - 1 > *pCurPos) pCurPos[0]++; break; - case 0x4800: + case kKeyUp: if (*pCurPos > 0) pCurPos[0]--; break; @@ -1259,51 +1259,50 @@ int16 Game_v1::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, return 0; switch (key) { - case 0x4D00: // Right Arrow + case kKeyRight: if ((pos < strlen(str)) && (pos < (editSize - 1))) { pos++; continue; } - return 0x5000; + return kKeyDown; - case 0x4B00: // Left Arrow + case kKeyLeft: if (pos > 0) { pos--; continue; } - return 0x4800; + return kKeyUp; - case 0xE08: // Backspace + case kKeyBackspace: if (pos > 0) { _vm->_util->cutFromStr(str, pos - 1, 1); pos--; continue; } - case 0x5300: // Del - + case kKeyDelete: if (pos >= strlen(str)) continue; _vm->_util->cutFromStr(str, pos, 1); continue; - case 0x1C0D: // Enter - case 0x3B00: // F1 - case 0x3C00: // F2 - case 0x3D00: // F3 - case 0x3E00: // F4 - case 0x3F00: // F5 - case 0x4000: // F6 - case 0x4100: // F7 - case 0x4200: // F8 - case 0x4300: // F9 - case 0x4400: // F10 - case 0x4800: // Up arrow - case 0x5000: // Down arrow + case kKeyReturn: + case kKeyF1: + case kKeyF2: + case kKeyF3: + case kKeyF4: + case kKeyF5: + case kKeyF6: + case kKeyF7: + case kKeyF8: + case kKeyF9: + case kKeyF10: + case kKeyUp: + case kKeyDown: return key; - case 0x11B: // Escape + case kKeyEscape: if (_vm->_global->_useMouse != 0) continue; @@ -1418,7 +1417,7 @@ int16 Game_v1::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) { } if ((_mouseButtons != kMouseButtonsLeft) && (all == 0)) - return 0x11B; + return kKeyEscape; return 0; } diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index 9d494ad6fe..db4e87287f 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -735,7 +735,7 @@ void Game_v2::collisionsBlock(void) { &_activeCollResId, &_activeCollIndex); WRITE_VAR(55, curEditIndex); - if (key == 0x1C0D) { + if (key == kKeyReturn) { for (i = 0; i < 150; i++) { if (_collisionAreas[i].left == 0xFFFF) break; @@ -1099,7 +1099,7 @@ int16 Game_v2::multiEdit(int16 time, int16 index, int16 *pCurPos, return 0; switch (key) { - case 0: + case kKeyNone: if (*collResId == 0) return 0; @@ -1158,19 +1158,19 @@ int16 Game_v2::multiEdit(int16 time, int16 index, int16 *pCurPos, } break; - case 0x3B00: - case 0x3C00: - case 0x3D00: - case 0x3E00: - case 0x3F00: - case 0x4000: - case 0x4100: - case 0x4200: - case 0x4300: - case 0x4400: + case kKeyF1: + case kKeyF2: + case kKeyF3: + case kKeyF4: + case kKeyF5: + case kKeyF6: + case kKeyF7: + case kKeyF8: + case kKeyF9: + case kKeyF10: return key; - case 0x1C0D: + case kKeyReturn: if (index == 1) return key; @@ -1183,12 +1183,12 @@ int16 Game_v2::multiEdit(int16 time, int16 index, int16 *pCurPos, pCurPos[0]++; break; - case 0x5000: + case kKeyDown: if (index - 1 > *pCurPos) pCurPos[0]++; break; - case 0x4800: + case kKeyUp: if (*pCurPos > 0) pCurPos[0]--; break; @@ -1377,21 +1377,21 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, return 0; switch (key) { - case 0x4D00: // Right Arrow + case kKeyRight: if ((pos > strlen(str)) || (pos > (editSize - 1)) || (editSize == 0)) { pos++; continue; } - return 0x5000; + return kKeyDown; - case 0x4B00: // Left Arrow + case kKeyLeft: if (pos > 0) { pos--; continue; } - return 0x4800; + return kKeyUp; - case 0xE08: // Backspace + case kKeyBackspace: if (pos > 0) { _vm->_util->cutFromStr(str, pos - 1, 1); pos--; @@ -1401,30 +1401,29 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, _vm->_util->cutFromStr(str, pos, 1); } - case 0x5300: // Del - + case kKeyDelete: if (pos >= strlen(str)) continue; _vm->_util->cutFromStr(str, pos, 1); continue; - case 0x1C0D: // Enter - case 0x3B00: // F1 - case 0x3C00: // F2 - case 0x3D00: // F3 - case 0x3E00: // F4 - case 0x3F00: // F5 - case 0x4000: // F6 - case 0x4100: // F7 - case 0x4200: // F8 - case 0x4300: // F9 - case 0x4400: // F10 - case 0x4800: // Up arrow - case 0x5000: // Down arrow + case kKeyReturn: + case kKeyF1: + case kKeyF2: + case kKeyF3: + case kKeyF4: + case kKeyF5: + case kKeyF6: + case kKeyF7: + case kKeyF8: + case kKeyF9: + case kKeyF10: + case kKeyUp: + case kKeyDown: return key; - case 0x11B: // Escape + case kKeyEscape: if (_vm->_global->_useMouse != 0) continue; @@ -1555,7 +1554,7 @@ int16 Game_v2::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) { } if ((_mouseButtons != kMouseButtonsLeft) && (all == 0)) - return 0x11B; + return kKeyEscape; return 0; } diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp index e2c0c52919..985f72c23a 100644 --- a/engines/gob/game_v6.cpp +++ b/engines/gob/game_v6.cpp @@ -630,7 +630,7 @@ void Game_v6::collisionsBlock(void) { &activeCollResId, &activeCollIndex, false); WRITE_VAR(55, curEditIndex); - if (key == 0x1C0D) { + if (key == kKeyReturn) { for (i = 0; i < 150; i++) { if (_collisionAreas[i].left == 0xFFFF) break; @@ -1089,7 +1089,7 @@ int16 Game_v6::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) { } if ((_mouseButtons != kMouseButtonsLeft) && (all == 0)) - return 0x11B; + return kKeyEscape; return 0; } diff --git a/engines/gob/inter.cpp b/engines/gob/inter.cpp index 3cbdaa3584..5ec0647d29 100644 --- a/engines/gob/inter.cpp +++ b/engines/gob/inter.cpp @@ -189,20 +189,20 @@ void Inter::storeKey(int16 key) { storeMouse(); WRITE_VAR(1, _vm->_sound->blasterPlayingSound()); - if (key == 0x4800) - key = 0x0B; - else if (key == 0x5000) - key = 0x0A; - else if (key == 0x4D00) - key = 0x09; - else if (key == 0x4B00) - key = 0x08; - else if (key == 0x011B) - key = 0x1B; - else if (key == 0x0E08) - key = 0x19; - else if (key == 0x5300) - key = 0x1A; + if (key == kKeyUp) + key = kShortKeyUp; + else if (key == kKeyDown) + key = kShortKeyDown; + else if (key == kKeyRight) + key = kShortKeyRight; + else if (key == kKeyLeft) + key = kShortKeyLeft; + else if (key == kKeyEscape) + key = kShortKeyEscape; + else if (key == kKeyBackspace) + key = kShortKeyBackspace; + else if (key == kKeyDelete) + key = kShortKeyDelete; else if ((key & 0xFF) != 0) key &= 0xFF; diff --git a/engines/gob/inter_bargon.cpp b/engines/gob/inter_bargon.cpp index 1cffe4ca2d..b955057bac 100644 --- a/engines/gob/inter_bargon.cpp +++ b/engines/gob/inter_bargon.cpp @@ -107,13 +107,13 @@ void Inter_Bargon::oBargon_intro2(OpGobParams ¶ms) { for (i = 320; i >= 0; i--) { _vm->_util->setScrollOffset(i, 0); _vm->_video->dirtyRectsAll(); - if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == 0x11B) || + if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == kKeyEscape) || _vm->shouldQuit()) { _vm->_palAnim->fade(0, -2, 0); _vm->_video->clearSurf(*_vm->_draw->_frontSurface); memset((char *) _vm->_draw->_vgaPalette, 0, 768); WRITE_VAR(4, buttons); - WRITE_VAR(0, 0x11B); + WRITE_VAR(0, kKeyEscape); WRITE_VAR(57, (uint32) -1); break; } @@ -158,14 +158,14 @@ void Inter_Bargon::oBargon_intro3(OpGobParams ¶ms) { _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); _vm->_util->longDelay(_vm->_util->getRandom(200)); } - if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == 0x11B) || + if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == kKeyEscape) || _vm->shouldQuit()) { _vm->_sound->blasterStop(10); _vm->_palAnim->fade(0, -2, 0); _vm->_video->clearSurf(*_vm->_draw->_frontSurface); memset(_vm->_draw->_vgaPalette, 0, 768); WRITE_VAR(4, buttons); - WRITE_VAR(0, 0x11B); + WRITE_VAR(0, kKeyEscape); WRITE_VAR(57, (uint32) -1); break; } diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index 506de821d4..14bfa1e840 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -31,6 +31,7 @@ #include "gob/inter.h" #include "gob/helper.h" #include "gob/global.h" +#include "gob/dataio.h" #include "gob/game.h" #include "gob/expression.h" #include "gob/script.h" diff --git a/engines/gob/mult.cpp b/engines/gob/mult.cpp index 5aec5ff76e..d383d955c7 100644 --- a/engines/gob/mult.cpp +++ b/engines/gob/mult.cpp @@ -204,7 +204,7 @@ void Mult::playMult(int16 startFrame, int16 endFrame, char checkEscape, stop = false; _vm->_util->processInput(); - if (checkEscape && (_vm->_util->checkKey() == 0x11B)) + if (checkEscape && (_vm->_util->checkKey() == kKeyEscape)) stop = true; _frame++; diff --git a/engines/gob/sound/sound.cpp b/engines/gob/sound/sound.cpp index d3afc9baa3..2d7ba02385 100644 --- a/engines/gob/sound/sound.cpp +++ b/engines/gob/sound/sound.cpp @@ -506,7 +506,7 @@ void Sound::blasterWaitEndPlay(bool interruptible, bool stopComp) { _blaster->endComposition(); while (_blaster->isPlaying() && !_vm->shouldQuit()) { - if (interruptible && (_vm->_util->checkKey() == 0x11B)) { + if (interruptible && (_vm->_util->checkKey() == kKeyEscape)) { WRITE_VAR(57, (uint32) -1); return; } diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index 4830c4be51..bb206eb52d 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -179,26 +179,26 @@ int16 Util::translateKey(const Common::KeyState &key) { int16 from; int16 to; } keys[] = { - {Common::KEYCODE_INVALID, 0x0000}, - {Common::KEYCODE_BACKSPACE, 0x0E08}, - {Common::KEYCODE_SPACE, 0x3920}, - {Common::KEYCODE_RETURN, 0x1C0D}, - {Common::KEYCODE_ESCAPE, 0x011B}, - {Common::KEYCODE_DELETE, 0x5300}, - {Common::KEYCODE_UP, 0x4800}, - {Common::KEYCODE_DOWN, 0x5000}, - {Common::KEYCODE_RIGHT, 0x4D00}, - {Common::KEYCODE_LEFT, 0x4B00}, - {Common::KEYCODE_F1, 0x3B00}, - {Common::KEYCODE_F2, 0x3C00}, - {Common::KEYCODE_F3, 0x3D00}, - {Common::KEYCODE_F4, 0x3E00}, - {Common::KEYCODE_F5, 0x011B}, - {Common::KEYCODE_F6, 0x4000}, - {Common::KEYCODE_F7, 0x4100}, - {Common::KEYCODE_F8, 0x4200}, - {Common::KEYCODE_F9, 0x4300}, - {Common::KEYCODE_F10, 0x4400} + {Common::KEYCODE_INVALID, kKeyNone }, + {Common::KEYCODE_BACKSPACE, kKeyBackspace}, + {Common::KEYCODE_SPACE, kKeySpace }, + {Common::KEYCODE_RETURN, kKeyReturn }, + {Common::KEYCODE_ESCAPE, kKeyEscape }, + {Common::KEYCODE_DELETE, kKeyDelete }, + {Common::KEYCODE_UP, kKeyUp }, + {Common::KEYCODE_DOWN, kKeyDown }, + {Common::KEYCODE_RIGHT, kKeyRight }, + {Common::KEYCODE_LEFT, kKeyLeft }, + {Common::KEYCODE_F1, kKeyF1 }, + {Common::KEYCODE_F2, kKeyF2 }, + {Common::KEYCODE_F3, kKeyF3 }, + {Common::KEYCODE_F4, kKeyF4 }, + {Common::KEYCODE_F5, kKeyEscape }, + {Common::KEYCODE_F6, kKeyF6 }, + {Common::KEYCODE_F7, kKeyF7 }, + {Common::KEYCODE_F8, kKeyF8 }, + {Common::KEYCODE_F9, kKeyF9 }, + {Common::KEYCODE_F10, kKeyF10 } }; for (int i = 0; i < ARRAYSIZE(keys); i++) diff --git a/engines/gob/util.h b/engines/gob/util.h index b0bcf70d0c..088a78a64d 100644 --- a/engines/gob/util.h +++ b/engines/gob/util.h @@ -42,6 +42,39 @@ enum MouseButtons { kMouseButtonsAny = 4 }; +enum Keys { + kKeyNone = 0x0000, + kKeyBackspace = 0x0E08, + kKeySpace = 0x3920, + kKeyReturn = 0x1C0D, + kKeyEscape = 0x011B, + kKeyDelete = 0x5300, + kKeyUp = 0x4800, + kKeyDown = 0x5000, + kKeyRight = 0x4D00, + kKeyLeft = 0x4B00, + kKeyF1 = 0x3B00, + kKeyF2 = 0x3C00, + kKeyF3 = 0x3D00, + kKeyF4 = 0x3E00, + kKeyF5 = 0x3F00, + kKeyF6 = 0x4000, + kKeyF7 = 0x4100, + kKeyF8 = 0x4200, + kKeyF9 = 0x4300, + kKeyF10 = 0x4400 +}; + +enum ShortKey { + kShortKeyUp = 0x0B, + kShortKeyDown = 0x0A, + kShortKeyRight = 0x09, + kShortKeyLeft = 0x08, + kShortKeyEscape = 0x1B, + kShortKeyBackspace = 0x19, + kShortKeyDelete = 0x1A +}; + class Util { public: struct ListNode; diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index 6c07d22333..da552d7202 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -27,7 +27,6 @@ #include "gob/videoplayer.h" #include "gob/helper.h" #include "gob/global.h" -#include "gob/util.h" #include "gob/dataio.h" #include "gob/video.h" #include "gob/draw.h" diff --git a/engines/gob/videoplayer.h b/engines/gob/videoplayer.h index 842426f90a..ead752d446 100644 --- a/engines/gob/videoplayer.h +++ b/engines/gob/videoplayer.h @@ -31,11 +31,12 @@ #include "graphics/video/coktelvideo/coktelvideo.h" -#include "gob/dataio.h" +#include "gob/util.h" namespace Gob { class GobEngine; +class DataStream; class VideoPlayer { public: @@ -60,13 +61,14 @@ public: bool primaryOpen(const char *videoFile, int16 x = -1, int16 y = -1, int32 flags = kFlagFrontSurface, Type which = kVideoTypeTry); - bool primaryPlay(int16 startFrame = -1, int16 lastFrame = -1, int16 breakKey = 27, + bool primaryPlay(int16 startFrame = -1, int16 lastFrame = -1, + int16 breakKey = kShortKeyEscape, uint16 palCmd = 8, int16 palStart = 0, int16 palEnd = 255, int16 palFrame = -1, int16 endFrame = -1, bool fade = false, int16 reverseTo = -1, bool forceSeek = false); void primaryClose(); - void playFrame(int16 frame, int16 breakKey = 27, + void playFrame(int16 frame, int16 breakKey = kShortKeyEscape, uint16 palCmd = 8, int16 palStart = 0, int16 palEnd = 255, int16 palFrame = -1 , int16 endFrame = -1); -- cgit v1.2.3 From 835dea71ceba85fb5c0fcdba7162cb9d92f77874 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 11:27:26 +0000 Subject: Added a skipBlock() method svn-id: r42122 --- engines/gob/script.cpp | 4 ++++ engines/gob/script.h | 1 + 2 files changed, 5 insertions(+) diff --git a/engines/gob/script.cpp b/engines/gob/script.cpp index 6162e943bf..38b1f8fa40 100644 --- a/engines/gob/script.cpp +++ b/engines/gob/script.cpp @@ -127,6 +127,10 @@ bool Script::skip(int32 offset) { return seek(offset, SEEK_CUR); } +bool Script::skipBlock() { + return seek(peekUint16(2) + 2, SEEK_CUR); +} + int32 Script::getOffset(byte *ptr) const { if (!_totData) return -1; diff --git a/engines/gob/script.h b/engines/gob/script.h index 64a04503b1..84daeaf1af 100644 --- a/engines/gob/script.h +++ b/engines/gob/script.h @@ -53,6 +53,7 @@ public: // Stream seeking bool seek(int32 offset, int whence = SEEK_SET); bool skip(int32 offset); + bool skipBlock(); // Reading data byte readByte (); -- cgit v1.2.3 From 18550c1314eb6a47651cd9dbe8b9be28b937bcc9 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 11:27:54 +0000 Subject: Moving the "Collision" stuff to Hotspots in hotspots.cpp/.h svn-id: r42123 --- engines/gob/draw_v1.cpp | 29 +- engines/gob/draw_v2.cpp | 42 +- engines/gob/game.cpp | 128 +--- engines/gob/game.h | 169 +---- engines/gob/game_fascin.cpp | 155 ---- engines/gob/game_v1.cpp | 1220 ------------------------------- engines/gob/game_v2.cpp | 1344 ---------------------------------- engines/gob/game_v6.cpp | 1009 +------------------------ engines/gob/hotspots.cpp | 1706 +++++++++++++++++++++++++++++++++++++++++++ engines/gob/hotspots.h | 177 +++++ engines/gob/inter.cpp | 3 +- engines/gob/inter_v1.cpp | 3 +- engines/gob/inter_v2.cpp | 61 +- engines/gob/inter_v6.cpp | 21 +- engines/gob/module.mk | 3 +- 15 files changed, 1958 insertions(+), 4112 deletions(-) create mode 100644 engines/gob/hotspots.cpp create mode 100644 engines/gob/hotspots.h diff --git a/engines/gob/draw_v1.cpp b/engines/gob/draw_v1.cpp index 94ee32a031..625b738b8a 100644 --- a/engines/gob/draw_v1.cpp +++ b/engines/gob/draw_v1.cpp @@ -33,6 +33,7 @@ #include "gob/util.h" #include "gob/game.h" #include "gob/resources.h" +#include "gob/hotspots.h" #include "gob/scenery.h" #include "gob/inter.h" #include "gob/sound/sound.h" @@ -58,7 +59,6 @@ void Draw_v1::blitCursor() { } void Draw_v1::animateCursor(int16 cursor) { - Game::Collision *ptr; int16 cursorIndex = cursor; int16 newX = 0, newY = 0; uint16 hotspotX = 0, hotspotY = 0; @@ -66,29 +66,10 @@ void Draw_v1::animateCursor(int16 cursor) { _showCursor = 2; if (cursorIndex == -1) { - cursorIndex = 0; - for (ptr = _vm->_game->_collisionAreas; ptr->left != 0xFFFF; ptr++) { - if (ptr->flags & 0xFFF0) - continue; + cursorIndex = + _vm->_game->_hotspots->findCursor(_vm->_global->_inter_mouseX, + _vm->_global->_inter_mouseY); - if (ptr->left > _vm->_global->_inter_mouseX) - continue; - - if (ptr->right < _vm->_global->_inter_mouseX) - continue; - - if (ptr->top > _vm->_global->_inter_mouseY) - continue; - - if (ptr->bottom < _vm->_global->_inter_mouseY) - continue; - - if ((ptr->flags & 0xF) < 3) - cursorIndex = 1; - else - cursorIndex = 3; - break; - } if (_cursorAnimLow[cursorIndex] == -1) cursorIndex = 1; } @@ -317,7 +298,7 @@ void Draw_v1::printTotText(int16 id) { _renderFlags = savedFlags; if (_renderFlags & RENDERFLAG_COLLISIONS) - _vm->_game->checkCollisions(0, 0, 0, 0); + _vm->_game->_hotspots->check(0, 0); if ((_renderFlags & RENDERFLAG_CAPTUREPOP) && *_vm->_scenery->_pCaptureCounter != 0) { (*_vm->_scenery->_pCaptureCounter)--; diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp index 2843456f42..e09c565b79 100644 --- a/engines/gob/draw_v2.cpp +++ b/engines/gob/draw_v2.cpp @@ -34,6 +34,7 @@ #include "gob/game.h" #include "gob/script.h" #include "gob/resources.h" +#include "gob/hotspots.h" #include "gob/scenery.h" #include "gob/inter.h" #include "gob/video.h" @@ -82,7 +83,6 @@ void Draw_v2::blitCursor() { } void Draw_v2::animateCursor(int16 cursor) { - Game::Collision *ptr; int16 cursorIndex = cursor; int16 newX = 0, newY = 0; uint16 hotspotX = 0, hotspotY = 0; @@ -91,32 +91,10 @@ void Draw_v2::animateCursor(int16 cursor) { // .-- _draw_animateCursorSUB1 --- if (cursorIndex == -1) { - cursorIndex = 0; - for (ptr = _vm->_game->_collisionAreas; ptr->left != 0xFFFF; ptr++) { - if ((ptr->flags & 0xF00) || (ptr->id & 0x4000)) - continue; - - if (ptr->left > _vm->_global->_inter_mouseX) - continue; - - if (ptr->right < _vm->_global->_inter_mouseX) - continue; - - if (ptr->top > _vm->_global->_inter_mouseY) - continue; - - if (ptr->bottom < _vm->_global->_inter_mouseY) - continue; - - if ((ptr->flags & 0xF000) == 0) { - if ((ptr->flags & 0xF) >= 3) { - cursorIndex = 3; - break; - } else if (((ptr->flags & 0xF0) != 0x10) && (cursorIndex == 0)) - cursorIndex = 1; - } else if (cursorIndex == 0) - cursorIndex = (ptr->flags >> 12) & 0xF; - } + cursorIndex = + _vm->_game->_hotspots->findCursor(_vm->_global->_inter_mouseX, + _vm->_global->_inter_mouseY); + if (_cursorAnimLow[cursorIndex] == -1) cursorIndex = 1; } @@ -407,8 +385,8 @@ void Draw_v2::printTotText(int16 id) { adjustCoords(2, &rectRight, &rectBottom); if (colId != -1) - _vm->_game->addNewCollision(colId + 0xD000, rectLeft, rectTop, - rectRight, rectBottom, 2, 0, 0, 0); + _vm->_game->_hotspots->add(colId + 0xD000, rectLeft, rectTop, + rectRight, rectBottom, (uint16) Hotspots::kTypeClick, 0, 0, 0, 0); if (_needAdjust != 2) printTextCentered(colCmd & 0x0F, rectLeft + 4, rectTop + 4, @@ -501,8 +479,8 @@ void Draw_v2::printTotText(int16 id) { rectBottom = destY + (int16)READ_LE_UINT16(ptr + 6); adjustCoords(2, &rectLeft, &rectTop); adjustCoords(2, &rectRight, &rectBottom); - _vm->_game->addNewCollision(colId + 0x0D000, rectLeft, rectTop, - rectRight, rectBottom, 2, 0, 0, 0); + _vm->_game->_hotspots->add(colId + 0x0D000, rectLeft, rectTop, + rectRight, rectBottom, (uint16) Hotspots::kTypeClick, 0, 0, 0, 0); ptr += 8; } break; @@ -604,7 +582,7 @@ void Draw_v2::printTotText(int16 id) { if (!(_renderFlags & RENDERFLAG_COLLISIONS)) return; - _vm->_game->checkCollisions(0, 0, 0, 0); + _vm->_game->_hotspots->check(0, 0); if (*_vm->_scenery->_pCaptureCounter != 0) { (*_vm->_scenery->_pCaptureCounter)--; diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index f69b899ce1..b75726cc75 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -33,6 +33,7 @@ #include "gob/variables.h" #include "gob/script.h" #include "gob/resources.h" +#include "gob/hotspots.h" #include "gob/inter.h" #include "gob/draw.h" #include "gob/mult.h" @@ -169,30 +170,14 @@ bool Environments::has(Resources *resources, uint8 startEnv, int16 except) const Game::Game(GobEngine *vm) : _vm(vm) { - _collisionAreas = 0; - _shouldPushColls = 0; - _captureCount = 0; - _collStackSize = 0; - - for (int i = 0; i < 5; i++) { - _collStack[i] = 0; - _collStackElemSizes[i] = 0; - } - _curTotFile[0] = 0; _totToLoad[0] = 0; _startTimeKey = 0; _mouseButtons = kMouseButtonsNone; - _lastCollKey = 0; - _lastCollAreaIndex = 0; - _lastCollId = 0; - - _activeCollResId = 0; - _activeCollIndex = 0; _handleMouse = 0; _forceHandleMouse = 0; _menuLevel = 0; @@ -203,7 +188,6 @@ Game::Game(GobEngine *vm) : _vm(vm) { _noCd = false; _tempStr[0] = 0; - _collStr[0] = 0; _numEnvironments = 0; _curEnvironment = 0; @@ -211,19 +195,14 @@ Game::Game(GobEngine *vm) : _vm(vm) { _environments = new Environments(_vm); _script = new Script(_vm); _resources = new Resources(_vm); + _hotspots = new Hotspots(_vm); } Game::~Game() { delete _environments; delete _script; delete _resources; -} - -void Game::freeCollision(int16 id) { - for (int i = 0; i < 250; i++) { - if (_collisionAreas[i].id == id) - _collisionAreas[i].left = 0xFFFF; - } + delete _hotspots; } void Game::capturePush(int16 left, int16 top, int16 width, int16 height) { @@ -379,21 +358,10 @@ int16 Game::checkKeys(int16 *pMouseX, int16 *pMouseY, return _vm->_util->checkKey(); } -int16 Game::adjustKey(int16 key) { - if (key <= 0x60 || key >= 0x7B) - return key; - - return key - 0x20; -} - void Game::start(void) { - _collisionAreas = new Collision[250]; - memset(_collisionAreas, 0, 250 * sizeof(Collision)); - prepareStart(); playTot(-2); - delete[] _collisionAreas; _vm->_draw->closeScreen(); for (int i = 0; i < SPRITES_COUNT; i++) @@ -430,7 +398,7 @@ void Game::totSub(int8 flags, const char *newTotFile) { return; } - pushCollisions(0); + _hotspots->push(0, true); if (flags & 2) playTot(-1); @@ -440,7 +408,7 @@ void Game::totSub(int8 flags, const char *newTotFile) { if (_vm->_inter->_terminate != 2) _vm->_inter->_terminate = 0; - popCollisions(); + _hotspots->pop(); if ((flags & 1) && _vm->_inter->_variables) { _vm->_inter->delocateVars(); @@ -488,13 +456,13 @@ void Game::switchTotSub(int16 index, int16 skipPlay) { return; } - pushCollisions(0); + _hotspots->push(0, true); playTot(skipPlay); if (_vm->_inter->_terminate != 2) _vm->_inter->_terminate = 0; - popCollisions(); + _hotspots->pop(); clearUnusedEnvironment(); @@ -503,87 +471,6 @@ void Game::switchTotSub(int16 index, int16 skipPlay) { _environments->get(_curEnvironment); } -void Game::setCollisions(byte arg_0) { - uint16 left; - uint16 top; - uint16 width; - uint16 height; - Collision *collArea; - - for (collArea = _collisionAreas; collArea->left != 0xFFFF; collArea++) { - if (((collArea->id & 0xC000) != 0x8000) || (collArea->funcSub == 0)) - continue; - - _script->call(collArea->funcSub); - - left = _script->readValExpr(); - top = _script->readValExpr(); - width = _script->readValExpr(); - height = _script->readValExpr(); - if ((_vm->_draw->_renderFlags & RENDERFLAG_CAPTUREPOP) && - (left != 0xFFFF)) { - left += _vm->_draw->_backDeltaX; - top += _vm->_draw->_backDeltaY; - } - if (_vm->_draw->_needAdjust != 2) { - _vm->_draw->adjustCoords(0, &left, &top); - if ((collArea->flags & 0x0F) < 3) - _vm->_draw->adjustCoords(2, &width, &height); - else { - height &= 0xFFFE; - _vm->_draw->adjustCoords(2, 0, &height); - } - } - collArea->left = left; - collArea->top = top; - collArea->right = left + width - 1; - collArea->bottom = top + height - 1; - - _script->pop(); - } -} - -void Game::collSub(uint16 offset) { - int16 collStackSize; - - _script->call(offset); - - _shouldPushColls = 1; - collStackSize = _collStackSize; - - _vm->_inter->funcBlock(0); - - if (collStackSize != _collStackSize) - popCollisions(); - - _shouldPushColls = 0; - - _script->pop(); - - setCollisions(); -} - -void Game::collAreaSub(int16 index, int8 enter) { - uint16 collId; - - collId = _collisionAreas[index].id & 0xF000; - - if ((collId == 0xA000) || (collId == 0x9000)) { - if (enter == 0) - WRITE_VAR(17, _collisionAreas[index].id & 0x0FFF); - else - WRITE_VAR(17, -(_collisionAreas[index].id & 0x0FFF)); - } - - if (enter != 0) { - if (_collisionAreas[index].funcEnter != 0) - collSub(_collisionAreas[index].funcEnter); - } else { - if (_collisionAreas[index].funcLeave != 0) - collSub(_collisionAreas[index].funcLeave); - } -} - void Game::clearUnusedEnvironment() { if (!_environments->has(_script)) { delete _script; @@ -593,7 +480,6 @@ void Game::clearUnusedEnvironment() { delete _resources; _resources = 0; } - } } // End of namespace Gob diff --git a/engines/gob/game.h b/engines/gob/game.h index eb579d44a4..e6a7a4c089 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -33,6 +33,7 @@ namespace Gob { class Script; class Resources; class Variables; +class Hotspots; class Environments { public: @@ -69,37 +70,9 @@ private: class Game { public: - -#include "common/pack-start.h" // START STRUCT PACKING - - struct Collision { - int16 id; - uint16 left; - uint16 top; - uint16 right; - uint16 bottom; - int16 flags; - int16 key; - uint16 funcEnter; - uint16 funcLeave; - uint16 funcSub; - Script *script; - } PACKED_STRUCT; - - struct InputDesc { - int16 fontIndex; - int16 backColor; - int16 frontColor; - byte *ptr; - } PACKED_STRUCT; - -#include "common/pack-end.h" // END STRUCT PACKING - - Collision *_collisionAreas; - Collision *_collStack[5]; - - Script *_script; + Script *_script; Resources *_resources; + Hotspots *_hotspots; char _curTotFile[14]; char _totToLoad[20]; @@ -113,6 +86,9 @@ public: bool _noCd; + byte _handleMouse; + char _forceHandleMouse; + Game(GobEngine *vm); virtual ~Game(); @@ -130,54 +106,19 @@ public: virtual void totSub(int8 flags, const char *newTotFile); virtual void switchTotSub(int16 index, int16 skipPlay); - void freeCollision(int16 id); - virtual void playTot(int16 skipPlay) = 0; - virtual void clearCollisions(void) = 0; - virtual int16 addNewCollision(int16 id, uint16 left, uint16 top, - uint16 right, uint16 bottom, int16 flags, int16 key, - uint16 funcEnter, uint16 funcLeave, uint16 funcSub = 0) = 0; - virtual void collisionsBlock(void) = 0; - virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos, - InputDesc *inpDesc, int16 *collResId, - int16 *collIndex, bool mono = true) = 0; - virtual int16 inputArea(int16 xPos, int16 yPos, int16 width, int16 height, - int16 backColor, int16 frontColor, char *str, int16 fontIndex, - char inpType, int16 *pTotTime, int16 *collResId, - int16 *collIndex, bool mono = true) = 0; - virtual int16 checkCollisions(byte handleMouse, int16 deltaTime, - int16 *pResId, int16 *pResIndex) = 0; - virtual void prepareStart(void) = 0; - virtual void pushCollisions(char all) = 0; - virtual void popCollisions(void) = 0; - protected: - int16 _lastCollKey; - int16 _lastCollAreaIndex; - int16 _lastCollId; - - int16 _activeCollResId; - int16 _activeCollIndex; - byte _handleMouse; - char _forceHandleMouse; uint32 _menuLevel; char _tempStr[256]; - int16 _collStackSize; - int16 _collStackElemSizes[5]; - - char _shouldPushColls; - // Capture Common::Rect _captureStack[20]; int16 _captureCount; - char _collStr[256]; - // For totSub() int8 _curEnvironment; int8 _numEnvironments; @@ -185,125 +126,41 @@ protected: GobEngine *_vm; - virtual int16 adjustKey(int16 key); - - void collAreaSub(int16 index, int8 enter); - - virtual void setCollisions(byte arg_0 = 1); - virtual void collSub(uint16 offset); - - virtual int16 checkMousePoint(int16 all, int16 *resId, int16 *resIndex) = 0; - void clearUnusedEnvironment(); }; class Game_v1 : public Game { public: - virtual void playTot(int16 skipPlay); - - virtual void clearCollisions(void); - virtual int16 addNewCollision(int16 id, uint16 left, uint16 top, - uint16 right, uint16 bottom, int16 flags, int16 key, - uint16 funcEnter, uint16 funcLeave, uint16 funcSub = 0); - virtual void collisionsBlock(void); - virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos, - InputDesc *inpDesc, int16 *collResId, - int16 *collIndex, bool mono = true); - virtual int16 inputArea(int16 xPos, int16 yPos, int16 width, int16 height, - int16 backColor, int16 frontColor, char *str, int16 fontIndex, - char inpType, int16 *pTotTime, int16 *collResId, - int16 *collIndex, bool mono = true); - virtual int16 checkCollisions(byte handleMouse, int16 deltaTime, - int16 *pResId, int16 *pResIndex); - - virtual void prepareStart(void); - - virtual void pushCollisions(char all); - virtual void popCollisions(void); - Game_v1(GobEngine *vm); virtual ~Game_v1() {} -protected: - virtual int16 checkMousePoint(int16 all, int16 *resId, int16 *resIndex); -}; - -class Game_v2 : public Game_v1 { -public: virtual void playTot(int16 skipPlay); - virtual void clearCollisions(void); - virtual int16 addNewCollision(int16 id, uint16 left, uint16 top, - uint16 right, uint16 bottom, int16 flags, int16 key, - uint16 funcEnter, uint16 funcLeave, uint16 funcSub = 0); - virtual void collisionsBlock(void); - virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos, - InputDesc *inpDesc, int16 *collResId, - int16 *collIndex, bool mono = true); - virtual int16 inputArea(int16 xPos, int16 yPos, int16 width, int16 height, - int16 backColor, int16 frontColor, char *str, int16 fontIndex, - char inpType, int16 *pTotTime, int16 *collResId, - int16 *collIndex, bool mono = true); - virtual int16 checkCollisions(byte handleMouse, int16 deltaTime, - int16 *pResId, int16 *pResIndex); - virtual void prepareStart(void); +}; - virtual void pushCollisions(char all); - virtual void popCollisions(void); - +class Game_v2 : public Game_v1 { +public: Game_v2(GobEngine *vm); virtual ~Game_v2() {} -protected: - struct CollLast { - int16 key; - int16 id; - int16 areaIndex; - }; - - CollLast _collLasts[5]; + virtual void playTot(int16 skipPlay); - virtual int16 checkMousePoint(int16 all, int16 *resId, int16 *resIndex); + virtual void prepareStart(void); }; class Game_v6 : public Game_v2 { public: - virtual void totSub(int8 flags, const char *newTotFile); - - virtual int16 addNewCollision(int16 id, uint16 left, uint16 top, - uint16 right, uint16 bottom, int16 flags, int16 key, - uint16 funcEnter, uint16 funcLeave, uint16 funcSub = 0); - - virtual void prepareStart(void); - - virtual void pushCollisions(char all); - - virtual int16 checkCollisions(byte handleMouse, int16 deltaTime, - int16 *pResId, int16 *pResIndex); - virtual void collisionsBlock(void); - Game_v6(GobEngine *vm); virtual ~Game_v6() {} -protected: - uint32 _someTimeDly; - - virtual void setCollisions(byte arg_0 = 1); - virtual void collSub(uint16 offset); - - virtual int16 adjustKey(int16 key); - - virtual int16 checkMousePoint(int16 all, int16 *resId, int16 *resIndex); + virtual void totSub(int8 flags, const char *newTotFile); - void collSubReenter(); + virtual void prepareStart(void); }; class Game_Fascination : public Game_v2 { public: - virtual int16 checkCollisions(byte handleMouse, int16 deltaTime, - int16 *pResId, int16 *pResIndex); - Game_Fascination(GobEngine *vm); virtual ~Game_Fascination() {} }; diff --git a/engines/gob/game_fascin.cpp b/engines/gob/game_fascin.cpp index 1387bf1de1..20480f778f 100644 --- a/engines/gob/game_fascin.cpp +++ b/engines/gob/game_fascin.cpp @@ -45,159 +45,4 @@ namespace Gob { Game_Fascination::Game_Fascination(GobEngine *vm) : Game_v2(vm) { } -int16 Game_Fascination::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, - int16 *pResIndex) { - int16 resIndex; - int16 key; - int16 oldIndex; - int16 oldId; - int16 newkey; - uint32 timeKey; - - _scrollHandleMouse = handleMouse != 0; - - if (deltaTime >= -1) { - _lastCollKey = 0; - _lastCollAreaIndex = 0; - _lastCollId = 0; - } - - if (pResId != 0) - *pResId = 0; - - resIndex = 0; - - if ((_vm->_draw->_cursorIndex == -1) && - (handleMouse != 0) && (_lastCollKey == 0)) { - _lastCollKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex); - - if ((_lastCollKey != 0) && (_lastCollId & 0x8000)) - collAreaSub(_lastCollAreaIndex, 1); - } - - if (handleMouse != 0) { - if ((handleMouse==1) && (_vm->_draw->_renderFlags & RENDERFLAG_UNKNOWN)) - warning("checkCollisions : RENDERFLAG_UNKNOWN - Unknown behavior"); - _vm->_draw->animateCursor(-1); - } - - timeKey = _vm->_util->getTimeKey(); - while (1) { - if (_vm->_inter->_terminate || _vm->shouldQuit()) { - if (handleMouse) - _vm->_draw->blitCursor(); - return 0; - } - - if (!_vm->_draw->_noInvalidated) { - if (handleMouse != 0) - _vm->_draw->animateCursor(-1); - else - _vm->_draw->blitInvalidated(); - _vm->_video->waitRetrace(); - } - - key = checkKeys(&_vm->_global->_inter_mouseX, - &_vm->_global->_inter_mouseY, &_mouseButtons, handleMouse); - - if ((handleMouse == 0) && (_mouseButtons != kMouseButtonsNone)) { - _vm->_util->waitMouseRelease(0); - key = 3; - } - - if (key != 0) { - - if (handleMouse & 1) - _vm->_draw->blitCursor(); - - if (pResId != 0) - *pResId = 0; - - if (pResIndex != 0) - *pResIndex = 0; - - if (_lastCollKey != 0) - collAreaSub(_lastCollAreaIndex, 0); - - _lastCollKey = 0; - if (key != 0) - return key; - } - - if (handleMouse != 0) { - if (_mouseButtons != kMouseButtonsNone) { - if (deltaTime > 0) { - _vm->_draw->animateCursor(2); - _vm->_util->delay(deltaTime); - } else if (handleMouse & 1) - _vm->_util->waitMouseRelease(1); - _vm->_draw->animateCursor(-1); - - if (pResId != 0) - *pResId = 0; - - key = checkMousePoint(0, pResId, &resIndex); - if (pResIndex != 0) - *pResIndex = resIndex; - - if ((key != 0) || ((pResId != 0) && (*pResId != 0))) { - if ((handleMouse & 1) && - ((deltaTime <= 0) || (_mouseButtons == kMouseButtonsNone))) - _vm->_draw->blitCursor(); - - if ((_lastCollKey != 0) && (key != _lastCollKey)) - collAreaSub(_lastCollAreaIndex, 0); - - _lastCollKey = 0; - return key; - } - - if (handleMouse & 4) - return 0; - - if (_lastCollKey != 0) - collAreaSub(_lastCollAreaIndex, 0); - - _lastCollKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex); - if ((_lastCollKey != 0) && (_lastCollId & 0x8000)) - collAreaSub(_lastCollAreaIndex, 1); - } else if ((_vm->_global->_inter_mouseX != _vm->_draw->_cursorX) || - (_vm->_global->_inter_mouseY != _vm->_draw->_cursorY)) { - - oldIndex = _lastCollAreaIndex; - oldId = _lastCollId; - newkey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex); - - if (newkey != _lastCollKey) { - if ((_lastCollKey != 0) && (oldId & 0x8000)) - collAreaSub(oldIndex, 0); - - _lastCollKey = newkey; - - if ((newkey != 0) && (_lastCollId & 0x8000)) - collAreaSub(_lastCollAreaIndex, 1); - } - } - } - - if ((deltaTime < 0) && (key == 0) && (_mouseButtons == kMouseButtonsNone)) { - uint32 curtime = _vm->_util->getTimeKey(); - if ((curtime + deltaTime) > timeKey) { - if (pResId != 0) - *pResId = 0; - - if (pResIndex != 0) - *pResIndex = 0; - - return 0; - } - } - - if (handleMouse != 0) - _vm->_draw->animateCursor(-1); - - _vm->_util->delay(10); - } -} - } // End of namespace Gob diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index ca6a7044cb..5948a21b9c 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -160,294 +160,7 @@ void Game_v1::playTot(int16 skipPlay) { _script->pop(); } -void Game_v1::clearCollisions() { - for (int i = 0; i < 250; i++) { - _collisionAreas[i].id = 0; - _collisionAreas[i].left = 0xFFFF; - } -} - -int16 Game_v1::addNewCollision(int16 id, uint16 left, uint16 top, - uint16 right, uint16 bottom, int16 flags, int16 key, - uint16 funcEnter, uint16 funcLeave, uint16 funcSub) { - Collision *ptr; - - debugC(5, kDebugCollisions, "addNewCollision"); - debugC(5, kDebugCollisions, "id = %X", id); - debugC(5, kDebugCollisions, "left = %d, top = %d, right = %d, bottom = %d", - left, top, right, bottom); - debugC(5, kDebugCollisions, "flags = %X, key = %X", flags, key); - debugC(5, kDebugCollisions, "funcEnter = %d, funcLeave = %d", - funcEnter, funcLeave); - - for (int i = 0; i < 250; i++) { - if (_collisionAreas[i].left != 0xFFFF) - continue; - - ptr = &_collisionAreas[i]; - ptr->id = id; - ptr->left = left; - ptr->top = top; - ptr->right = right; - ptr->bottom = bottom; - ptr->flags = flags; - ptr->key = key; - ptr->funcEnter = funcEnter; - ptr->funcLeave = funcLeave; - ptr->funcSub = funcSub; - ptr->script = 0; - - return i; - } - error("Game_v1::addNewCollision(): Collision array full"); - return 0; -} - -void Game_v1::pushCollisions(char all) { - Collision *srcPtr; - Collision *destPtr; - int16 size; - - debugC(1, kDebugCollisions, "pushCollisions"); - for (size = 0, srcPtr = _collisionAreas; srcPtr->left != 0xFFFF; srcPtr++) { - if (all || (srcPtr->id & 0x8000)) - size++; - } - - destPtr = new Collision[size]; - _collStack[_collStackSize] = destPtr; - _collStackElemSizes[_collStackSize] = size; - _collStackSize++; - - for (srcPtr = _collisionAreas; srcPtr->left != 0xFFFF; srcPtr++) { - if (all || (srcPtr->id & 0x8000)) { - memcpy(destPtr, srcPtr, sizeof(Collision)); - srcPtr->left = 0xFFFF; - destPtr++; - } - } -} - -void Game_v1::popCollisions(void) { - Collision *destPtr; - Collision *srcPtr; - - debugC(1, kDebugCollisions, "popCollision"); - - _collStackSize--; - for (destPtr = _collisionAreas; destPtr->left != 0xFFFF; destPtr++) - ; - - srcPtr = _collStack[_collStackSize]; - memcpy(destPtr, srcPtr, - _collStackElemSizes[_collStackSize] * sizeof(Collision)); - - delete[] _collStack[_collStackSize]; -} - -int16 Game_v1::checkCollisions(byte handleMouse, int16 deltaTime, - int16 *pResId, int16 *pResIndex) { - int16 resIndex; - int16 key; - int16 oldIndex; - int16 oldId; - uint32 timeKey; - bool firstIteration = true; - - if (deltaTime >= -1) { - _lastCollKey = 0; - _lastCollAreaIndex = 0; - _lastCollId = 0; - } - - if (pResId != 0) - *pResId = 0; - - resIndex = 0; - - timeKey = _vm->_util->getTimeKey(); - - if ((_vm->_draw->_cursorIndex == -1) && (handleMouse != 0) && - (_lastCollKey == 0)) { - _lastCollKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex); - - if ((_lastCollKey != 0) && ((_lastCollId & 0x8000) != 0)) { - _script->call(_collisionAreas[_lastCollAreaIndex].funcEnter); - _vm->_inter->funcBlock(0); - _script->pop(); - } - } - - if (handleMouse != 0) - _vm->_draw->animateCursor(-1); - - while (1) { - if (_vm->_inter->_terminate) { - if (handleMouse) - _vm->_draw->blitCursor(); - return 0; - } - - if (!_vm->_draw->_noInvalidated) { - if (handleMouse) - _vm->_draw->animateCursor(-1); - else - _vm->_draw->blitInvalidated(); - } - - // NOTE: the original asm does the below checkKeys call - // _before_ this check. However, that can cause keypresses to get lost - // since there's a return statement in this check. - // Additionally, I added a 'deltaTime == -1' check there, since - // when this function is called with deltaTime == -1 in inputArea, - // and the return value is then discarded. - if (deltaTime < 0) { - uint32 curtime = _vm->_util->getTimeKey(); - if ((deltaTime == -1) || (((curtime + deltaTime) > timeKey) && !firstIteration)) { - if (pResId != 0) - *pResId = 0; - - if (pResIndex != 0) - *pResIndex = 0; - - return 0; - } - } - - key = checkKeys(&_vm->_global->_inter_mouseX, - &_vm->_global->_inter_mouseY, &_mouseButtons, handleMouse); - - if ((handleMouse == 0) && (_mouseButtons != kMouseButtonsNone)) { - _vm->_util->waitMouseRelease(0); - key = 3; - } - - if (key != 0) { - - if (handleMouse == 1) - _vm->_draw->blitCursor(); - - if (pResId != 0) - *pResId = 0; - - if (pResIndex != 0) - *pResIndex = 0; - - if ((_lastCollKey != 0) && - (_collisionAreas[_lastCollAreaIndex].funcLeave != 0)) { - - _script->call(_collisionAreas[_lastCollAreaIndex].funcLeave); - _vm->_inter->funcBlock(0); - _script->pop(); - } - - _lastCollKey = 0; - if (key != 0) - return key; - } - - if (handleMouse != 0) { - if (_mouseButtons != kMouseButtonsNone) { - oldIndex = 0; - - _vm->_draw->animateCursor(2); - if (deltaTime <= 0) { - if (handleMouse == 1) - _vm->_util->waitMouseRelease(1); - } else if (deltaTime > 0) - _vm->_util->delay(deltaTime); - - _vm->_draw->animateCursor(-1); - if (pResId != 0) - *pResId = 0; - - key = checkMousePoint(0, pResId, &resIndex); - - if (pResIndex != 0) - *pResIndex = resIndex; - - if ((key != 0) || ((pResId != 0) && (*pResId != 0))) { - if ((handleMouse == 1) && - ((deltaTime <= 0) || (_mouseButtons == kMouseButtonsNone))) - _vm->_draw->blitCursor(); - - if ((_lastCollKey != 0) && - (_collisionAreas[_lastCollAreaIndex].funcLeave != 0)) { - - _script->call(_collisionAreas[_lastCollAreaIndex].funcLeave); - _vm->_inter->funcBlock(0); - _script->pop(); - - } - _lastCollKey = 0; - return key; - } - - if ((_lastCollKey != 0) && - (_collisionAreas[_lastCollAreaIndex].funcLeave != 0)) { - - _script->call(_collisionAreas[_lastCollAreaIndex].funcLeave); - _vm->_inter->funcBlock(0); - _script->pop(); - - } - - _lastCollKey = - checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex); - - if ((_lastCollKey != 0) && ((_lastCollId & 0x8000) != 0)) { - - _script->call(_collisionAreas[_lastCollAreaIndex].funcEnter); - _vm->_inter->funcBlock(0); - _script->pop(); - - } - } else { - - if ((handleMouse != 0) && - ((_vm->_global->_inter_mouseX != _vm->_draw->_cursorX) || - (_vm->_global->_inter_mouseY != _vm->_draw->_cursorY))) { - oldIndex = _lastCollAreaIndex; - oldId = _lastCollId; - - key = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex); - - if (key != _lastCollKey) { - if ((_lastCollKey != 0) && ((oldId & 0x8000) != 0)) { - - _script->call(_collisionAreas[oldIndex].funcLeave); - _vm->_inter->funcBlock(0); - _script->pop(); - - } - - _lastCollKey = key; - if ((_lastCollKey != 0) && ((_lastCollId & 0x8000) != 0)) { - - _script->call(_collisionAreas[_lastCollAreaIndex].funcEnter); - _vm->_inter->funcBlock(0); - _script->pop(); - - } - - } - } - } - } - - if (handleMouse != 0) - _vm->_draw->animateCursor(-1); - - if (deltaTime < -10) - _vm->_util->delay(10); - - firstIteration = false; - } -} - void Game_v1::prepareStart(void) { - clearCollisions(); - _vm->_global->_pPaletteDesc->unused2 = _vm->_draw->_unusedPalette2; _vm->_global->_pPaletteDesc->unused1 = _vm->_draw->_unusedPalette1; _vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaPalette; @@ -489,937 +202,4 @@ void Game_v1::prepareStart(void) { _startTimeKey = _vm->_util->getTimeKey(); } -void Game_v1::collisionsBlock(void) { - InputDesc descArray[20]; - int16 array[250]; - byte count; - int16 collResId; - int16 curCmd; - int16 cmd; - int16 cmdHigh; - int16 key; - int16 flags; - uint16 left; - uint16 top; - uint16 width; - uint16 height; - int16 var_22; - int16 index; - int16 curEditIndex; - int16 deltaTime; - int16 descIndex2; - int16 stackPos2; - int16 descIndex; - int16 timeVal; - char *str; - int16 savedCollStackSize; - int16 i; - int16 counter; - int16 var_24; - int16 var_26; - int16 collStackPos; - Collision *collPtr; - uint32 timeKey; - - if (_shouldPushColls) - pushCollisions(1); - - collResId = -1; - _script->skip(1); - count = _script->readByte(); - _handleMouse = _script->readByte(); - deltaTime = 1000 * _script->readByte(); - descIndex2 = _script->readByte(); - stackPos2 = _script->readByte(); - descIndex = _script->readByte(); - - if ((stackPos2 != 0) || (descIndex != 0)) - deltaTime /= 100; - - timeVal = deltaTime; - _script->skip(1); - - uint32 startPos = _script->pos(); - - WRITE_VAR(16, 0); - var_22 = 0; - index = 0; - curEditIndex = 0; - - for (curCmd = 0; curCmd < count; curCmd++) { - array[curCmd] = 0; - cmd = _script->readByte(); - - if ((cmd & 0x40) != 0) { - cmd -= 0x40; - cmdHigh = _script->readByte(); - cmdHigh <<= 8; - } else - cmdHigh = 0; - - if ((cmd & 0x80) != 0) { - left = _script->readValExpr(); - top = _script->readValExpr(); - width = _script->readValExpr(); - height = _script->readValExpr(); - } else { - left = _script->readUint16(); - top = _script->readUint16(); - width = _script->readUint16(); - height = _script->readUint16(); - } - cmd &= 0x7F; - - debugC(1, kDebugCollisions, "collisionsBlock(%d)", cmd); - - switch (cmd) { - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - - _vm->_util->clearKeyBuf(); - var_22 = 1; - key = _script->readVarIndex(); - descArray[index].fontIndex = _script->readInt16(); - descArray[index].backColor = _script->readByte(); - descArray[index].frontColor = _script->readByte(); - - if ((cmd < 5) || (cmd > 8)) { - descArray[index].ptr = 0; - } else { - descArray[index].ptr = _script->getData() + _script->pos() + 2; - _script->skip(_script->readInt16()); - } - - if (left == 0xFFFF) - break; - - if ((cmd & 1) == 0) { - addNewCollision(curCmd + 0x8000, left, top, left + width * - _vm->_draw->_fonts[descArray[index].fontIndex]->itemWidth - 1, - top + height - 1, cmd, key, 0, _script->pos()); - - _script->skip(_script->peekUint16(2) + 2); - } else { - addNewCollision(curCmd + 0x8000, left, top, left + width * - _vm->_draw->_fonts[descArray[index].fontIndex]->itemWidth - 1, - top + height - 1, cmd, key, 0, 0); - } - index++; - break; - - case 21: - key = _script->readInt16(); - array[curCmd] = _script->readInt16(); - flags = _script->readInt16() & 3; - - addNewCollision(curCmd + 0x8000, left, top, - left + width - 1, top + height - 1, - (flags << 4) + cmdHigh + 2, key, _script->pos(), 0); - - _script->skip(_script->peekUint16(2) + 2); - break; - - case 20: - collResId = curCmd; - // Fall through to case 2 - - case 2: - key = _script->readInt16(); - array[curCmd] = _script->readInt16(); - flags = _script->readInt16() & 3; - - addNewCollision(curCmd + 0x8000, left, top, - left + width - 1, - top + height - 1, - (flags << 4) + cmdHigh + 2, key, 0, _script->pos()); - - _script->skip(_script->peekUint16(2) + 2); - break; - - case 0: - _script->skip(6); - startPos = _script->pos(); - _script->skip(_script->peekUint16(2) + 2); - key = curCmd + 0xA000; - - addNewCollision(curCmd + 0x8000, left, top, - left + width - 1, top + height - 1, - cmd + cmdHigh, key, - startPos, _script->pos()); - - _script->skip(_script->peekUint16(2) + 2); - break; - - case 1: - key = _script->readInt16(); - array[curCmd] = _script->readInt16(); - flags = _script->readInt16() & 3; - - startPos = _script->pos(); - _script->skip(_script->peekUint16(2) + 2); - if (key == 0) - key = curCmd + 0xA000; - - addNewCollision(curCmd + 0x8000, left, top, - left + width - 1, top + height - 1, - (flags << 4) + cmd + cmdHigh, key, - startPos, _script->pos()); - - _script->skip(_script->peekUint16(2) + 2); - break; - } - } - - _forceHandleMouse = 0; - _vm->_util->clearKeyBuf(); - - do { - if (var_22 != 0) { - key = multiEdit(deltaTime, index, &curEditIndex, - descArray, &_activeCollResId, &_activeCollIndex); - - if (key == kKeyReturn) { - for (i = 0; i < 250; i++) { - if (_collisionAreas[i].left == 0xFFFF) - continue; - - if ((_collisionAreas[i].id & 0x8000) == 0) - continue; - - if ((_collisionAreas[i].flags & 1) != 0) - continue; - - if ((_collisionAreas[i].flags & 0x0F) <= 2) - continue; - - collResId = _collisionAreas[i].id; - _activeCollResId = collResId; - collResId &= 0x7FFF; - _activeCollIndex = i; - break; - } - break; - } - } else - key = checkCollisions(_handleMouse, -deltaTime, - &_activeCollResId, &_activeCollIndex); - - if (((key & 0xFF) >= ' ') && ((key & 0xFF) <= 0xFF) && - ((key >> 8) > 1) && ((key >> 8) < 12)) - key = '0' + (((key >> 8) - 1) % 10) + (key & 0xFF00); - - if (_activeCollResId == 0) { - if (key != 0) { - for (i = 0; i < 250; i++) { - if (_collisionAreas[i].left == 0xFFFF) - continue; - - if ((_collisionAreas[i].id & 0x8000) == 0) - continue; - - if ((_collisionAreas[i].key == key) || - (_collisionAreas[i].key == 0x7FFF)) { - - _activeCollResId = _collisionAreas[i].id; - _activeCollIndex = i; - break; - } - } - - if (_activeCollResId == 0) { - for (i = 0; i < 250; i++) { - if (_collisionAreas[i].left == 0xFFFF) - continue; - - if ((_collisionAreas[i].id & 0x8000) == 0) - continue; - - if ((_collisionAreas[i].key & 0xFF00) != 0) - continue; - - if (_collisionAreas[i].key == 0) - continue; - - if ((adjustKey(key & 0xFF) == adjustKey(_collisionAreas[i].key)) || - (_collisionAreas[i].key == 0x7FFF)) { - _activeCollResId = _collisionAreas[i].id; - _activeCollIndex = i; - break; - } - } - } - } else { - - if ((deltaTime != 0) && (VAR(16) == 0)) { - if (stackPos2 != 0) { - collStackPos = 0; - collPtr = _collisionAreas; - - for (i = 0, collPtr = _collisionAreas; - collPtr->left != 0xFFFF; i++, collPtr++) { - - if ((collPtr->id & 0x8000) == 0) - continue; - - collStackPos++; - if (collStackPos != stackPos2) - continue; - - _activeCollResId = collPtr->id; - _activeCollIndex = i; - WRITE_VAR(2, _vm->_global->_inter_mouseX); - WRITE_VAR(3, _vm->_global->_inter_mouseY); - WRITE_VAR(4, (uint32) _mouseButtons); - WRITE_VAR(16, array[(uint16) _activeCollResId & ~0x8000]); - - if (collPtr->funcLeave != 0) { - timeKey = _vm->_util->getTimeKey(); - - uint32 savedPos = _script->pos(); - - _script->seek(collPtr->funcLeave); - - _shouldPushColls = 1; - savedCollStackSize = _collStackSize; - _vm->_inter->funcBlock(0); - - if (savedCollStackSize != _collStackSize) - popCollisions(); - - _shouldPushColls = 0; - - _script->seek(savedPos); - - deltaTime = timeVal - - (_vm->_util->getTimeKey() - timeKey); - - if (deltaTime < 2) - deltaTime = 2; - } - - if (VAR(16) == 0) - _activeCollResId = 0; - break; - } - } else { - if (descIndex != 0) { - counter = 0; - for (i = 0; i < 250; i++) { - if (_collisionAreas[i].left == 0xFFFF) - continue; - - if ((_collisionAreas[i].id & 0x8000) == 0) - continue; - - counter++; - if (counter != descIndex) - continue; - - _activeCollResId = _collisionAreas[i].id; - _activeCollIndex = i; - break; - } - } else { - for (i = 0; i < 250; i++) { - if (_collisionAreas[i].left == 0xFFFF) - continue; - - if ((_collisionAreas[i].id & 0x8000) == 0) - continue; - - _activeCollResId = _collisionAreas[i].id; - _activeCollIndex = i; - break; - } - } - } - } else { - if (descIndex2 != 0) { - counter = 0; - for (i = 0; i < 250; i++) { - if (_collisionAreas[i].left == 0xFFFF) - continue; - - if ((_collisionAreas[i].id & 0x8000) == 0) - continue; - - counter++; - if (counter != descIndex2) - continue; - - _activeCollResId = _collisionAreas[i].id; - _activeCollIndex = i; - break; - } - } - } - } - } - - if (_activeCollResId == 0) - continue; - - if (_collisionAreas[_activeCollIndex].funcLeave != 0) - continue; - - WRITE_VAR(2, _vm->_global->_inter_mouseX); - WRITE_VAR(3, _vm->_global->_inter_mouseY); - WRITE_VAR(4, (uint32) _mouseButtons); - WRITE_VAR(16, array[(uint16) _activeCollResId & ~0x8000]); - - if (_collisionAreas[_activeCollIndex].funcEnter != 0) { - uint32 savedPos = _script->pos(); - - _script->seek(_collisionAreas[_activeCollIndex].funcEnter); - - _shouldPushColls = 1; - - collStackPos = _collStackSize; - _vm->_inter->funcBlock(0); - if (collStackPos != _collStackSize) - popCollisions(); - _shouldPushColls = 0; - - _script->seek(savedPos); - } - - WRITE_VAR(16, 0); - _activeCollResId = 0; - } - while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !_vm->shouldQuit()); - - if (((uint16) _activeCollResId & ~0x8000) == collResId) { - collStackPos = 0; - var_24 = 0; - var_26 = 1; - for (i = 0; i < 250; i++) { - if (_collisionAreas[i].left == 0xFFFF) - continue; - - if ((_collisionAreas[i].id & 0x8000) == 0) - continue; - - if ((_collisionAreas[i].flags & 0x0F) < 3) - continue; - - if ((_collisionAreas[i].flags & 0x0F) > 10) - continue; - - if ((_collisionAreas[i].flags & 0x0F) > 8) { - char *ptr; - strncpy0(_tempStr, GET_VARO_STR(_collisionAreas[i].key), 255); - while ((ptr = strchr(_tempStr, ' ')) != 0) { - _vm->_util->cutFromStr(_tempStr, (ptr - _tempStr), 1); - ptr = strchr(_tempStr, ' '); - } - WRITE_VARO_STR(_collisionAreas[i].key, _tempStr); - } - - if (((_collisionAreas[i].flags & 0x0F) >= 5) && - ((_collisionAreas[i].flags & 0x0F) <= 8)) { - str = (char *) descArray[var_24].ptr; - - strncpy0(_tempStr, GET_VARO_STR(_collisionAreas[i].key), 255); - - if ((_collisionAreas[i].flags & 0x0F) < 7) - _vm->_util->cleanupStr(_tempStr); - - int16 pos = 0; - do { - strncpy0(_collStr, str, 255); - pos += strlen(str) + 1; - - str += strlen(str) + 1; - - if ((_collisionAreas[i].flags & 0x0F) < 7) - _vm->_util->cleanupStr(_collStr); - - if (strcmp(_tempStr, _collStr) == 0) { - WRITE_VAR(17, VAR(17) + 1); - WRITE_VAR(17 + var_26, 1); - break; - } - } while (READ_LE_UINT16(descArray[var_24].ptr - 2) > pos); - collStackPos++; - } else { - WRITE_VAR(17 + var_26, 2); - } - var_24++; - var_26++; - } - - if (collStackPos != (int16) VAR(17)) - WRITE_VAR(17, 0); - else - WRITE_VAR(17, 1); - } - - if (!_vm->_inter->_terminate) { - _script->seek(_collisionAreas[_activeCollIndex].funcLeave); - - WRITE_VAR(2, _vm->_global->_inter_mouseX); - WRITE_VAR(3, _vm->_global->_inter_mouseY); - WRITE_VAR(4, (uint32) _mouseButtons); - - if (VAR(16) == 0) - WRITE_VAR(16, array[(uint16) _activeCollResId & ~0x8000]); - } else - _script->setFinished(true); - - for (curCmd = 0; curCmd < count; curCmd++) - freeCollision(curCmd + 0x8000); -} - -int16 Game_v1::multiEdit(int16 time, int16 index, int16 *pCurPos, - InputDesc * inpDesc, int16 *collResId, int16 *collIndex, bool mono) { - Collision *collArea; - int16 descInd; - int16 key; - int16 found = -1; - int16 i; - - descInd = 0; - for (i = 0; i < 250; i++) { - collArea = &_collisionAreas[i]; - - if (collArea->left == 0xFFFF) - continue; - - if ((collArea->id & 0x8000) == 0) - continue; - - if ((collArea->flags & 0x0F) < 3) - continue; - - if ((collArea->flags & 0x0F) > 10) - continue; - - strncpy0(_tempStr, GET_VARO_STR(collArea->key), 255); - - _vm->_draw->_destSpriteX = collArea->left; - _vm->_draw->_destSpriteY = collArea->top; - _vm->_draw->_spriteRight = collArea->right - collArea->left + 1; - _vm->_draw->_spriteBottom = collArea->bottom - collArea->top + 1; - - _vm->_draw->_destSurface = 21; - - _vm->_draw->_backColor = inpDesc[descInd].backColor; - _vm->_draw->_frontColor = inpDesc[descInd].frontColor; - _vm->_draw->_textToPrint = _tempStr; - _vm->_draw->_transparency = 1; - _vm->_draw->_fontIndex = inpDesc[descInd].fontIndex; - _vm->_draw->spriteOperation(DRAW_FILLRECT); - _vm->_draw->_destSpriteY += - ((collArea->bottom - collArea->top + 1) - 8) / 2; - - _vm->_draw->spriteOperation(DRAW_PRINTTEXT); - descInd++; - } - - for (i = 0; i < 40; i++) - WRITE_VAR_OFFSET(i * 4 + 0x44, 0); - - while (1) { - descInd = 0; - - for (i = 0; i < 250; i++) { - collArea = &_collisionAreas[i]; - - if (collArea->left == 0xFFFF) - continue; - - if ((collArea->id & 0x8000) == 0) - continue; - - if ((collArea->flags & 0x0F) < 3) - continue; - - if ((collArea->flags & 0x0F) > 10) - continue; - - if (descInd == *pCurPos) { - found = i; - break; - } - - descInd++; - } - - assert(found != -1); - - collArea = &_collisionAreas[found]; - - key = inputArea(collArea->left, collArea->top, - collArea->right - collArea->left + 1, - collArea->bottom - collArea->top + 1, - inpDesc[*pCurPos].backColor, inpDesc[*pCurPos].frontColor, - GET_VARO_STR(collArea->key), inpDesc[*pCurPos].fontIndex, - collArea->flags, &time, collResId, collIndex); - - if (_vm->_inter->_terminate) - return 0; - - switch (key) { - case kKeyNone: - if (*collResId == 0) - return 0; - - if ((_collisionAreas[*collIndex].flags & 0x0F) < 3) - return 0; - - if ((_collisionAreas[*collIndex].flags & 0x0F) > 10) - return 0; - - *pCurPos = 0; - for (i = 0; i < 250; i++) { - collArea = &_collisionAreas[i]; - - if (collArea->left == 0xFFFF) - continue; - - if ((collArea->id & 0x8000) == 0) - continue; - - if ((collArea->flags & 0x0F) < 3) - continue; - - if ((collArea->flags & 0x0F) > 10) - continue; - - if (i == *collIndex) - break; - - pCurPos[0]++; - } - break; - - case kKeyF1: - case kKeyF2: - case kKeyF3: - case kKeyF4: - case kKeyF5: - case kKeyF6: - case kKeyF7: - case kKeyF8: - case kKeyF9: - case kKeyF10: - return key; - - case kKeyReturn: - - if (index == 1) - return key; - - if (*pCurPos == index - 1) { - *pCurPos = 0; - break; - } - - pCurPos[0]++; - break; - - case kKeyDown: - if (index - 1 > *pCurPos) - pCurPos[0]++; - break; - - case kKeyUp: - if (*pCurPos > 0) - pCurPos[0]--; - break; - } - } -} - -int16 Game_v1::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, - int16 backColor, int16 frontColor, char *str, int16 fontIndex, - char inpType, int16 *pTotTime, int16 *collResId, int16 *collIndex, bool mono) { - int16 handleMouse; - uint32 editSize; - Video::FontDesc *pFont; - char curSym; - int16 key; - const char *str1; - const char *str2; - int16 i; - uint32 pos; - int16 flag; - int16 savedKey; - - if ((_handleMouse != 0) && - ((_vm->_global->_useMouse != 0) || (_forceHandleMouse != 0))) - handleMouse = 1; - else - handleMouse = 0; - - pos = strlen(str); - pFont = _vm->_draw->_fonts[fontIndex]; - editSize = width / pFont->itemWidth; - - while (1) { - strncpy0(_tempStr, str, 254); - strcat(_tempStr, " "); - if (strlen(_tempStr) > editSize) - strncpy0(_tempStr, str, 255); - - _vm->_draw->_destSpriteX = xPos; - _vm->_draw->_destSpriteY = yPos; - _vm->_draw->_spriteRight = editSize * pFont->itemWidth; - _vm->_draw->_spriteBottom = height; - - _vm->_draw->_destSurface = 21; - _vm->_draw->_backColor = backColor; - _vm->_draw->_frontColor = frontColor; - _vm->_draw->_textToPrint = _tempStr; - _vm->_draw->_transparency = 1; - _vm->_draw->_fontIndex = fontIndex; - _vm->_draw->spriteOperation(DRAW_FILLRECT); - - _vm->_draw->_destSpriteY = yPos + (height - 8) / 2; - - _vm->_draw->spriteOperation(DRAW_PRINTTEXT); - if (pos == editSize) - pos--; - - curSym = _tempStr[pos]; - - flag = 1; - - while (1) { - _tempStr[0] = curSym; - _tempStr[1] = 0; - - _vm->_draw->_destSpriteX = xPos + pFont->itemWidth * pos; - _vm->_draw->_destSpriteY = yPos + height - 1; - _vm->_draw->_spriteRight = pFont->itemWidth; - _vm->_draw->_spriteBottom = 1; - _vm->_draw->_destSurface = 21; - _vm->_draw->_backColor = frontColor; - _vm->_draw->spriteOperation(DRAW_FILLRECT); - - if (flag != 0) - key = checkCollisions(handleMouse, -1, collResId, collIndex); - flag = 0; - - key = checkCollisions(handleMouse, -300, collResId, collIndex); - - if (*pTotTime > 0) { - *pTotTime -= 300; - if (*pTotTime <= 1) { - key = 0; - *collResId = 0; - break; - } - } - - _tempStr[0] = curSym; - _tempStr[1] = 0; - _vm->_draw->_destSpriteX = xPos + pFont->itemWidth * pos; - _vm->_draw->_destSpriteY = yPos + height - 1; - _vm->_draw->_spriteRight = pFont->itemWidth; - _vm->_draw->_spriteBottom = 1; - _vm->_draw->_destSurface = 21; - _vm->_draw->_backColor = backColor; - _vm->_draw->_frontColor = frontColor; - _vm->_draw->_textToPrint = _tempStr; - _vm->_draw->_transparency = 1; - _vm->_draw->spriteOperation(DRAW_FILLRECT); - - _vm->_draw->_destSpriteY = yPos + (height - 8) / 2; - _vm->_draw->spriteOperation(DRAW_PRINTTEXT); - - if ((key != 0) || (*collResId != 0)) - break; - - key = checkCollisions(handleMouse, -300, collResId, collIndex); - - if (*pTotTime > 0) { - *pTotTime -= 300; - if (*pTotTime <= 1) { - key = 0; - *collResId = 0; - break; - } - } - - if ((key != 0) || (*collResId != 0)) - break; - - if (_vm->_inter->_terminate) - return 0; - } - - if ((key == 0) || (*collResId != 0) || _vm->_inter->_terminate) - return 0; - - switch (key) { - case kKeyRight: - if ((pos < strlen(str)) && (pos < (editSize - 1))) { - pos++; - continue; - } - return kKeyDown; - - case kKeyLeft: - if (pos > 0) { - pos--; - continue; - } - return kKeyUp; - - case kKeyBackspace: - if (pos > 0) { - _vm->_util->cutFromStr(str, pos - 1, 1); - pos--; - continue; - } - - case kKeyDelete: - if (pos >= strlen(str)) - continue; - - _vm->_util->cutFromStr(str, pos, 1); - continue; - - case kKeyReturn: - case kKeyF1: - case kKeyF2: - case kKeyF3: - case kKeyF4: - case kKeyF5: - case kKeyF6: - case kKeyF7: - case kKeyF8: - case kKeyF9: - case kKeyF10: - case kKeyUp: - case kKeyDown: - return key; - - case kKeyEscape: - if (_vm->_global->_useMouse != 0) - continue; - - _forceHandleMouse = !_forceHandleMouse; - - if ((_handleMouse != 0) && - ((_vm->_global->_useMouse != 0) || (_forceHandleMouse != 0))) - handleMouse = 1; - else - handleMouse = 0; - - if (_vm->_global->_pressedKeys[1] == 0) - continue; - - while (_vm->_global->_pressedKeys[1] != 0) - ; - continue; - - default: - - savedKey = key; - key &= 0xFF; - - if (((inpType == 9) || (inpType == 10)) && - (key >= ' ') && (key <= 0xFF)) { - str1 = "0123456789-.,+ "; - str2 = "0123456789-,,+ "; - - if (((savedKey >> 8) > 1) && ((savedKey >> 8) < 12)) - key = ((savedKey >> 8) - 1) % 10 + '0'; - - for (i = 0; str1[i] != 0; i++) { - if (key == str1[i]) { - key = str2[i]; - break; - } - } - - if (i == (int16) strlen(str1)) - key = 0; - } - - if ((key >= ' ') && (key <= 0xFF)) { - if (editSize == strlen(str)) - _vm->_util->cutFromStr(str, strlen(str) - 1, 1); - - if ((key >= 'a') && (key <= 'z')) - key += ('A' - 'a'); - - pos++; - _tempStr[0] = key; - _tempStr[1] = 0; - - _vm->_util->insertStr(_tempStr, str, pos - 1); - } - - } - } -} - -int16 Game_v1::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) { - Collision *ptr; - int16 i; - - if (resId != 0) - *resId = 0; - - *resIndex = 0; - - ptr = _collisionAreas; - for (i = 0; ptr->left != 0xFFFF; ptr++, i++) { - if (all) { - if ((ptr->flags & 0xF) > 1) - continue; - - if ((ptr->flags & 0xFF00) != 0) - continue; - - if ((_vm->_global->_inter_mouseX < ptr->left) || - (_vm->_global->_inter_mouseX > ptr->right) || - (_vm->_global->_inter_mouseY < ptr->top) || - (_vm->_global->_inter_mouseY > ptr->bottom)) - continue; - - if (resId != 0) - *resId = ptr->id; - - *resIndex = i; - return ptr->key; - } else { - if ((ptr->flags & 0xFF00) != 0) - continue; - - if (((ptr->flags & 0xF) != 1) && ((ptr->flags & 0xF) != 2)) - continue; - - if ((((ptr->flags & 0xF0) >> 4) != (((int32) _mouseButtons) - 1)) - && (((ptr->flags & 0xF0) >> 4) != 2)) - continue; - - if ((_vm->_global->_inter_mouseX < ptr->left) || - (_vm->_global->_inter_mouseX > ptr->right) || - (_vm->_global->_inter_mouseY < ptr->top) || - (_vm->_global->_inter_mouseY > ptr->bottom)) - continue; - - if (resId != 0) - *resId = ptr->id; - *resIndex = i; - return ptr->key; - } - } - - if ((_mouseButtons != kMouseButtonsLeft) && (all == 0)) - return kKeyEscape; - - return 0; -} - } // End of namespace Gob diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index db4e87287f..9cc4da3cc9 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -179,268 +179,7 @@ void Game_v2::playTot(int16 skipPlay) { _script->pop(); } -void Game_v2::clearCollisions() { - _lastCollKey = 0; - - for (int i = 0; i < 150; i++) - _collisionAreas[i].left = 0xFFFF; -} - -int16 Game_v2::addNewCollision(int16 id, uint16 left, uint16 top, - uint16 right, uint16 bottom, int16 flags, int16 key, - uint16 funcEnter, uint16 funcLeave, uint16 funcSub) { - Collision *ptr; - - debugC(5, kDebugCollisions, "addNewCollision"); - debugC(5, kDebugCollisions, "id = %X", id); - debugC(5, kDebugCollisions, "left = %d, top = %d, right = %d, bottom = %d", - left, top, right, bottom); - debugC(5, kDebugCollisions, "flags = %X, key = %X", flags, key); - debugC(5, kDebugCollisions, "funcEnter = %d, funcLeave = %d", - funcEnter, funcLeave); - - for (int i = 0; i < 150; i++) { - if ((_collisionAreas[i].left != 0xFFFF) && (_collisionAreas[i].id != id)) - continue; - - ptr = &_collisionAreas[i]; - ptr->id = id; - ptr->left = left; - ptr->top = top; - ptr->right = right; - ptr->bottom = bottom; - ptr->flags = flags; - ptr->key = key; - ptr->funcEnter = funcEnter; - ptr->funcLeave = funcLeave; - ptr->funcSub = funcSub; - ptr->script = 0; - - return i; - } - error("Game_v2::addNewCollision(): Collision array full"); - return 0; -} - -void Game_v2::pushCollisions(char all) { - Collision *srcPtr; - Collision *destPtr; - int16 size; - - debugC(1, kDebugCollisions, "pushCollisions"); - for (size = 0, srcPtr = _collisionAreas; srcPtr->left != 0xFFFF; srcPtr++) - if (all || (((uint16) srcPtr->id) >= 20)) - size++; - - destPtr = new Collision[size]; - _collStack[_collStackSize] = destPtr; - - if (_vm->_inter->_terminate) - return; - - _collStackElemSizes[_collStackSize] = size; - - if (_shouldPushColls != 0) - _collStackElemSizes[_collStackSize] |= 0x8000; - - _shouldPushColls = 0; - _collLasts[_collStackSize].key = _lastCollKey; - _collLasts[_collStackSize].id = _lastCollId; - _collLasts[_collStackSize].areaIndex = _lastCollAreaIndex; - _lastCollKey = 0; - _lastCollId = 0; - _lastCollAreaIndex = 0; - _collStackSize++; - - for (srcPtr = _collisionAreas; srcPtr->left != 0xFFFF; srcPtr++) { - if (all || (((uint16) srcPtr->id) >= 20)) { - memcpy(destPtr, srcPtr, sizeof(Collision)); - srcPtr->left = 0xFFFF; - destPtr++; - } - } -} - -void Game_v2::popCollisions(void) { - Collision *destPtr; - Collision *srcPtr; - - debugC(1, kDebugCollisions, "popCollision"); - - _collStackSize--; - - _shouldPushColls = _collStackElemSizes[_collStackSize] & 0x8000 ? 1 : 0; - _collStackElemSizes[_collStackSize] &= 0x7FFF; - - _lastCollKey = _collLasts[_collStackSize].key; - _lastCollId = _collLasts[_collStackSize].id; - _lastCollAreaIndex = _collLasts[_collStackSize].areaIndex; - - for (destPtr = _collisionAreas; destPtr->left != 0xFFFF; destPtr++) - ; - - srcPtr = _collStack[_collStackSize]; - memcpy(destPtr, srcPtr, - _collStackElemSizes[_collStackSize] * sizeof(Collision)); - - delete[] _collStack[_collStackSize]; -} - -int16 Game_v2::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, - int16 *pResIndex) { - int16 resIndex; - int16 key; - int16 oldIndex; - int16 oldId; - int16 newkey; - uint32 timeKey; - - _scrollHandleMouse = handleMouse != 0; - - if (deltaTime >= -1) { - _lastCollKey = 0; - _lastCollAreaIndex = 0; - _lastCollId = 0; - } - - if (pResId != 0) - *pResId = 0; - - resIndex = 0; - - if ((_vm->_draw->_cursorIndex == -1) && - (handleMouse != 0) && (_lastCollKey == 0)) { - _lastCollKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex); - - if ((_lastCollKey != 0) && (_lastCollId & 0x8000)) - collAreaSub(_lastCollAreaIndex, 1); - } - - if (handleMouse != 0) - _vm->_draw->animateCursor(-1); - - timeKey = _vm->_util->getTimeKey(); - while (1) { - if (_vm->_inter->_terminate || _vm->shouldQuit()) { - if (handleMouse) - _vm->_draw->blitCursor(); - return 0; - } - - if (!_vm->_draw->_noInvalidated) { - if (handleMouse != 0) - _vm->_draw->animateCursor(-1); - else - _vm->_draw->blitInvalidated(); - _vm->_video->waitRetrace(); - } - - key = checkKeys(&_vm->_global->_inter_mouseX, - &_vm->_global->_inter_mouseY, &_mouseButtons, handleMouse); - - if ((handleMouse == 0) && (_mouseButtons != kMouseButtonsNone)) { - _vm->_util->waitMouseRelease(0); - key = 3; - } - - if (key != 0) { - - if (handleMouse & 1) - _vm->_draw->blitCursor(); - - if (pResId != 0) - *pResId = 0; - - if (pResIndex != 0) - *pResIndex = 0; - - if (_lastCollKey != 0) - collAreaSub(_lastCollAreaIndex, 0); - - _lastCollKey = 0; - if (key != 0) - return key; - } - - if (handleMouse != 0) { - if (_mouseButtons != kMouseButtonsNone) { - if (deltaTime > 0) { - _vm->_draw->animateCursor(2); - _vm->_util->delay(deltaTime); - } else if (handleMouse & 1) - _vm->_util->waitMouseRelease(1); - _vm->_draw->animateCursor(-1); - - if (pResId != 0) - *pResId = 0; - - key = checkMousePoint(0, pResId, &resIndex); - if (pResIndex != 0) - *pResIndex = resIndex; - - if ((key != 0) || ((pResId != 0) && (*pResId != 0))) { - if ((handleMouse & 1) && - ((deltaTime <= 0) || (_mouseButtons == kMouseButtonsNone))) - _vm->_draw->blitCursor(); - - if ((_lastCollKey != 0) && (key != _lastCollKey)) - collAreaSub(_lastCollAreaIndex, 0); - - _lastCollKey = 0; - return key; - } - - if (handleMouse & 4) - return 0; - - if (_lastCollKey != 0) - collAreaSub(_lastCollAreaIndex, 0); - - _lastCollKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex); - if ((_lastCollKey != 0) && (_lastCollId & 0x8000)) - collAreaSub(_lastCollAreaIndex, 1); - } else if ((_vm->_global->_inter_mouseX != _vm->_draw->_cursorX) || - (_vm->_global->_inter_mouseY != _vm->_draw->_cursorY)) { - - oldIndex = _lastCollAreaIndex; - oldId = _lastCollId; - newkey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex); - - if (newkey != _lastCollKey) { - if ((_lastCollKey != 0) && (oldId & 0x8000)) - collAreaSub(oldIndex, 0); - - _lastCollKey = newkey; - - if ((newkey != 0) && (_lastCollId & 0x8000)) - collAreaSub(_lastCollAreaIndex, 1); - } - } - } - - if ((deltaTime < 0) && (key == 0) && (_mouseButtons == kMouseButtonsNone)) { - uint32 curtime = _vm->_util->getTimeKey(); - if ((curtime + deltaTime) > timeKey) { - if (pResId != 0) - *pResId = 0; - - if (pResIndex != 0) - *pResIndex = 0; - - return 0; - } - } - - if (handleMouse != 0) - _vm->_draw->animateCursor(-1); - - _vm->_util->delay(10); - } -} - void Game_v2::prepareStart(void) { - clearCollisions(); - _vm->_global->_pPaletteDesc->unused2 = _vm->_draw->_unusedPalette2; _vm->_global->_pPaletteDesc->unused1 = _vm->_draw->_unusedPalette1; _vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaPalette; @@ -476,1087 +215,4 @@ void Game_v2::prepareStart(void) { _startTimeKey = _vm->_util->getTimeKey(); } -void Game_v2::collisionsBlock(void) { - InputDesc descArray[20]; - int16 array[250]; - byte count; - int16 collResId; - int16 curCmd; - int16 cmd; - int16 cmdHigh; - int16 key; - int16 flags; - uint16 left; - uint16 top; - uint16 width; - uint16 height; - int16 var_1C; - int16 index; - int16 curEditIndex; - int16 deltaTime; - int16 stackPos2; - int16 descIndex; - int16 timeVal; - char *str; - int16 i; - int16 counter; - int16 var_24; - int16 var_26; - int16 collStackPos; - Collision *collPtr; - Collision *collArea; - int16 timeKey; - byte collAreaStart; - uint32 startPos; - uint32 offsetPos; - - if (_shouldPushColls) - pushCollisions(0); - - collAreaStart = 0; - while (_collisionAreas[collAreaStart].left != 0xFFFF) - collAreaStart++; - collArea = &_collisionAreas[collAreaStart]; - - _shouldPushColls = 0; - collResId = -1; - - _script->skip(1); - count = _script->readByte(); - - _handleMouse = _script->readByte(); - deltaTime = 1000 * _script->readByte(); - _script->skip(1); - stackPos2 = _script->readByte(); - descIndex = _script->readByte(); - - if ((stackPos2 != 0) || (descIndex != 0)) - deltaTime /= 100; - - timeVal = deltaTime; - _script->skip(1); - - startPos = _script->pos(); - WRITE_VAR(16, 0); - - var_1C = 0; - index = 0; - curEditIndex = 0; - - for (curCmd = 0; curCmd < count; curCmd++) { - array[curCmd] = 0; - cmd = _script->readByte(); - - if ((cmd & 0x40) != 0) { - cmd -= 0x40; - cmdHigh = _script->readByte(); - cmdHigh <<= 8; - } else - cmdHigh = 0; - - if ((cmd & 0x80) != 0) { - offsetPos = _script->pos(); - left = _script->readValExpr(); - top = _script->readValExpr(); - width = _script->readValExpr(); - height = _script->readValExpr(); - } else { - offsetPos = 0; - left = _script->readUint16(); - top = _script->readUint16(); - width = _script->readUint16(); - height = _script->readUint16(); - } - - if ((_vm->_draw->_renderFlags & RENDERFLAG_CAPTUREPOP) && (left != 0xFFFF)) { - left += _vm->_draw->_backDeltaX; - top += _vm->_draw->_backDeltaY; - } - - if (left != 0xFFFF) { - _vm->_draw->adjustCoords(0, &left, &top); - if (((cmd & 0x3F) < 20) && ((cmd & 0x3F) >= 3)) { - if (_vm->_draw->_needAdjust != 2) - height &= 0xFFFE; - _vm->_draw->adjustCoords(0, 0, &width); - } else - _vm->_draw->adjustCoords(0, &height, &width); - } - - cmd &= 0x7F; - debugC(1, kDebugCollisions, "collisionsBlock(%d)", cmd); - - switch (cmd) { - case 0: - _script->skip(6); - startPos = _script->pos(); - _script->skip(_script->peekUint16(2) + 2); - key = curCmd + 0xA000; - - addNewCollision(curCmd + 0x8000, left, top, - left + width - 1, top + height - 1, - cmd + cmdHigh, key, startPos, - _script->pos(), offsetPos); - - _script->skip(_script->peekUint16(2) + 2); - - break; - - case 1: - key = _script->readInt16(); - array[curCmd] = _script->readInt16(); - flags = _script->readInt16(); - - startPos = _script->pos(); - _script->skip(_script->peekUint16(2) + 2); - - if (key == 0) - key = curCmd + 0xA000; - - addNewCollision(curCmd + 0x8000, left, top, - left + width - 1, top + height - 1, - (flags << 4) + cmd + cmdHigh, key, startPos, - _script->pos(), offsetPos); - - _script->skip(_script->peekUint16(2) + 2); - break; - - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - _vm->_util->clearKeyBuf(); - var_1C = 1; - key = _script->readVarIndex(); - descArray[index].fontIndex = _script->readInt16(); - descArray[index].backColor = _script->readByte(); - descArray[index].frontColor = _script->readByte(); - - if ((cmd >= 5) && (cmd <= 8)) { - descArray[index].ptr = _script->getData() + _script->pos() + 2; - _script->skip(_script->peekUint16() + 2); - } else - descArray[index].ptr = 0; - - if (left == 0xFFFF) { - if ((cmd & 1) == 0) { - _script->skip(_script->peekUint16(2) + 2); - } - break; - } - - if ((cmd & 1) == 0) { - addNewCollision(curCmd + 0x8000, left, top, left + width * - _vm->_draw->_fonts[descArray[index].fontIndex]-> itemWidth - 1, - top + height - 1, cmd, key, 0, - _script->pos()); - - _script->skip(_script->peekUint16(2) + 2); - } else - addNewCollision(curCmd + 0x8000, left, top, left + width * - _vm->_draw->_fonts[descArray[index].fontIndex]-> itemWidth - 1, - top + height - 1, cmd, key, 0, 0); - - index++; - break; - - case 11: - _script->skip(6); - for (i = 0; i < 150; i++) { - if ((_collisionAreas[i].id & 0xF000) == 0xE000) { - _collisionAreas[i].id &= 0xBFFF; - _collisionAreas[i].funcEnter = - _script->pos(); - _collisionAreas[i].funcLeave = - _script->pos(); - } - } - _script->skip(_script->peekUint16(2) + 2); - break; - - case 12: - _script->skip(6); - for (i = 0; i < 150; i++) { - if ((_collisionAreas[i].id & 0xF000) == 0xD000) { - _collisionAreas[i].id &= 0xBFFF; - _collisionAreas[i].funcEnter = - _script->pos(); - _collisionAreas[i].funcLeave = - _script->pos(); - } - } - _script->skip(_script->peekUint16(2) + 2); - break; - - case 20: - collResId = curCmd; - // Fall through to case 2 - - case 2: - key = _script->readInt16(); - array[curCmd] = _script->readInt16(); - flags = _script->readInt16(); - - addNewCollision(curCmd + 0x8000, left, top, - left + width - 1, top + height - 1, - (flags << 4) + cmdHigh + 2, key, 0, - _script->pos(), offsetPos); - - _script->skip(_script->peekUint16(2) + 2); - - break; - - case 21: - key = _script->readInt16(); - array[curCmd] = _script->readInt16(); - flags = _script->readInt16() & 3; - - addNewCollision(curCmd + 0x8000, left, top, - left + width - 1, top + height - 1, - (flags << 4) + cmdHigh + 2, key, - _script->pos(), 0, offsetPos); - - _script->skip(_script->peekUint16(2) + 2); - - break; - } - } - - _forceHandleMouse = 0; - _vm->_util->clearKeyBuf(); - - do { - if (var_1C != 0) { - key = multiEdit(deltaTime, index, &curEditIndex, descArray, - &_activeCollResId, &_activeCollIndex); - - WRITE_VAR(55, curEditIndex); - if (key == kKeyReturn) { - for (i = 0; i < 150; i++) { - if (_collisionAreas[i].left == 0xFFFF) - break; - - if ((_collisionAreas[i].id & 0xC000) != 0x8000) - continue; - - if ((_collisionAreas[i].flags & 1) != 0) - continue; - - if ((_collisionAreas[i].flags & 0x0F) <= 2) - continue; - - _activeCollResId = _collisionAreas[i].id; - collResId = _collisionAreas[i].id & 0x7FFF; - _activeCollIndex = i; - break; - } - break; - } - } else - key = checkCollisions(_handleMouse, -deltaTime, - &_activeCollResId, &_activeCollIndex); - - if (((key & 0xFF) >= ' ') && ((key & 0xFF) <= 0xFF) && - ((key >> 8) > 1) && ((key >> 8) < 12)) - key = '0' + (((key >> 8) - 1) % 10) + (key & 0xFF00); - - if (_activeCollResId == 0) { - if (key != 0) { - for (i = 0; i < 150; i++) { - if (_collisionAreas[i].left == 0xFFFF) - break; - - if ((_collisionAreas[i].id & 0xC000) != 0x8000) - continue; - - if ((_collisionAreas[i].key == key) || - (_collisionAreas[i].key == 0x7FFF)) { - _activeCollResId = _collisionAreas[i].id; - _activeCollIndex = i; - break; - } - } - - if (_activeCollResId == 0) { - for (i = 0; i < 150; i++) { - if (_collisionAreas[i].left == 0xFFFF) - break; - - if ((_collisionAreas[i].id & 0xC000) != 0x8000) - continue; - - if ((_collisionAreas[i].key & 0xFF00) != 0) - continue; - - if (_collisionAreas[i].key == 0) - continue; - - if ((adjustKey(key & 0xFF) == adjustKey(_collisionAreas[i].key)) || - (_collisionAreas[i].key == 0x7FFF)) { - _activeCollResId = _collisionAreas[i].id; - _activeCollIndex = i; - break; - } - } - } - } else if (deltaTime != 0) { - if (stackPos2 != 0) { - collStackPos = 0; - - for (i = 0, collPtr = collArea; collPtr->left != 0xFFFF; i++, collPtr++) { - if ((collPtr->id & 0xF000) != 0x8000) - continue; - - collStackPos++; - if (collStackPos != stackPos2) - continue; - - _activeCollResId = collPtr->id; - _activeCollIndex = i + collAreaStart; - _vm->_inter->storeMouse(); - if (VAR(16) != 0) - break; - - if ((_activeCollResId & 0xF000) == 0x8000) - WRITE_VAR(16, array[_activeCollResId & 0xFFF]); - else - WRITE_VAR(16, _activeCollResId & 0xFFF); - - if (collPtr->funcLeave != 0) { - int16 collResIdBak = _activeCollResId; - int16 collIndexBak = _activeCollIndex; - - timeKey = _vm->_util->getTimeKey(); - collSub(collPtr->funcLeave); - - _activeCollResId = collResIdBak; - _activeCollIndex = collIndexBak; - - _vm->_inter->animPalette(); - - deltaTime = timeVal - (_vm->_util->getTimeKey() - timeKey); - - if (deltaTime < 2) - deltaTime = 2; - if (deltaTime > timeVal) - deltaTime = timeVal; - } - - if (VAR(16) == 0) - _activeCollResId = 0; - break; - } - } else { - if (descIndex != 0) { - - counter = 0; - for (i = 0, collPtr = collArea; collPtr->left != 0xFFFF; i++, collPtr++) { - if ((collPtr->id & 0xF000) == 0x8000) - if (++counter == descIndex) { - _activeCollResId = collPtr->id; - _activeCollIndex = i + collAreaStart; - break; - } - } - - } else { - - for (i = 0, collPtr = _collisionAreas; collPtr->left != 0xFFFF; i++, collPtr++) { - if ((collPtr->id & 0xF000) == 0x8000) { - _activeCollResId = collPtr->id; - _activeCollIndex = i; - break; - } - } - if ((_lastCollKey != 0) && - (_collisionAreas[_lastCollAreaIndex].funcLeave != 0)) - collSub(_collisionAreas[_lastCollAreaIndex].funcLeave); - _lastCollKey = 0; - } - - } - } - } - - if ((_activeCollResId == 0) || - (_collisionAreas[_activeCollIndex].funcLeave != 0)) - continue; - - _vm->_inter->storeMouse(); - if ((_activeCollResId & 0xF000) == 0x8000) - WRITE_VAR(16, array[_activeCollResId & 0xFFF]); - else - WRITE_VAR(16, _activeCollResId & 0xFFF); - - if (_collisionAreas[_activeCollIndex].funcEnter != 0) - collSub(_collisionAreas[_activeCollIndex].funcEnter); - - WRITE_VAR(16, 0); - _activeCollResId = 0; - } - while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !_vm->shouldQuit()); - - if ((_activeCollResId & 0xFFF) == collResId) { - collStackPos = 0; - var_24 = 0; - var_26 = 1; - for (i = 0; i < 150; i++) { - if (_collisionAreas[i].left == 0xFFFF) - continue; - - if ((_collisionAreas[i].id & 0xC000) == 0x8000) - continue; - - if ((_collisionAreas[i].flags & 0x0F) < 3) - continue; - - if ((_collisionAreas[i].flags & 0x0F) > 10) - continue; - - if ((_collisionAreas[i].flags & 0x0F) > 8) { - char *ptr; - strncpy0(_tempStr, GET_VARO_STR(_collisionAreas[i].key), 255); - while ((ptr = strchr(_tempStr, ' '))) - _vm->_util->cutFromStr(_tempStr, (ptr - _tempStr), 1); - if (_vm->_language == 2) - while ((ptr = strchr(_tempStr, '.'))) - *ptr = ','; - WRITE_VARO_STR(_collisionAreas[i].key, _tempStr); - } - - if (((_collisionAreas[i].flags & 0x0F) >= 5) && - ((_collisionAreas[i].flags & 0x0F) <= 8)) { - str = (char *) descArray[var_24].ptr; - - strncpy0(_tempStr, GET_VARO_STR(_collisionAreas[i].key), 255); - - if ((_collisionAreas[i].flags & 0x0F) < 7) - _vm->_util->cleanupStr(_tempStr); - - int16 pos = 0; - do { - strncpy0(_collStr, str, 255); - pos += strlen(str) + 1; - - str += strlen(str) + 1; - - if ((_collisionAreas[i].flags & 0x0F) < 7) - _vm->_util->cleanupStr(_collStr); - - if (strcmp(_tempStr, _collStr) == 0) { - WRITE_VAR(17, VAR(17) + 1); - WRITE_VAR(17 + var_26, 1); - break; - } - } while (READ_LE_UINT16(descArray[var_24].ptr - 2) > pos); - collStackPos++; - } else { - WRITE_VAR(17 + var_26, 2); - } - var_24++; - var_26++; - } - - if (collStackPos != (int16) VAR(17)) - WRITE_VAR(17, 0); - else - WRITE_VAR(17, 1); - } - - if (_handleMouse == 1) - _vm->_draw->blitCursor(); - - if (!_vm->_inter->_terminate) { - _script->seek(_collisionAreas[_activeCollIndex].funcLeave); - - _vm->_inter->storeMouse(); - if (VAR(16) == 0) { - if ((_activeCollResId & 0xF000) == 0x8000) - WRITE_VAR(16, array[_activeCollResId & 0xFFF]); - else - WRITE_VAR(16, _activeCollResId & 0xFFF); - } - } else - _script->setFinished(true); - - for (curCmd = 0; curCmd < count; curCmd++) - freeCollision(curCmd + 0x8000); - - for (i = 0; i < 150; i++) { - if (((_collisionAreas[i].id & 0xF000) == 0xA000) || - ((_collisionAreas[i].id & 0xF000) == 0x9000)) - _collisionAreas[i].id |= 0x4000; - } -} - -int16 Game_v2::multiEdit(int16 time, int16 index, int16 *pCurPos, - InputDesc * inpDesc, int16 *collResId, int16 *collIndex, bool mono) { - Collision *collArea; - int16 descInd; - int16 key; - int16 found = -1; - int16 i; - byte *fontExtraBak = 0; - int16 needAdjust = 0; - - descInd = 0; - for (i = 0; i < 150; i++) { - collArea = &_collisionAreas[i]; - - if (collArea->left == 0xFFFF) - continue; - - if ((collArea->id & 0xC000) != 0x8000) - continue; - - if ((collArea->flags & 0x0F) < 3) - continue; - - if ((collArea->flags & 0x0F) > 10) - continue; - - strncpy0(_tempStr, GET_VARO_STR(collArea->key), 255); - - _vm->_draw->_destSpriteX = collArea->left; - _vm->_draw->_destSpriteY = collArea->top; - _vm->_draw->_spriteRight = collArea->right - collArea->left + 1; - _vm->_draw->_spriteBottom = collArea->bottom - collArea->top + 1; - - _vm->_draw->_destSurface = 21; - - _vm->_draw->_backColor = inpDesc[descInd].backColor; - _vm->_draw->_frontColor = inpDesc[descInd].frontColor; - _vm->_draw->_textToPrint = _tempStr; - _vm->_draw->_transparency = 1; - _vm->_draw->_fontIndex = inpDesc[descInd].fontIndex; - - if (mono) { - fontExtraBak = _vm->_draw->_fonts[_vm->_draw->_fontIndex]->extraData; - needAdjust = _vm->_draw->_needAdjust; - _vm->_draw->_needAdjust = 2; - _vm->_draw->_fonts[_vm->_draw->_fontIndex]->extraData = 0; - } - - _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10); - - _vm->_draw->_destSpriteY += ((collArea->bottom - collArea->top + 1) - - _vm->_draw->_fonts[_vm->_draw->_fontIndex]->itemHeight) / 2; - _vm->_draw->spriteOperation(DRAW_PRINTTEXT | 0x10); - - if (mono) { - _vm->_draw->_needAdjust = needAdjust; - _vm->_draw->_fonts[_vm->_draw->_fontIndex]->extraData = fontExtraBak; - } - - descInd++; - } - - for (i = 0; i < 40; i++) - WRITE_VAR_OFFSET(i * 4 + 0x44, 0); - - while (1) { - descInd = 0; - - for (i = 0; i < 150; i++) { - collArea = &_collisionAreas[i]; - - if (collArea->left == 0xFFFF) - continue; - - if ((collArea->id & 0xC000) != 0x8000) - continue; - - if ((collArea->flags & 0x0F) < 3) - continue; - - if ((collArea->flags & 0x0F) > 10) - continue; - - if (descInd == *pCurPos) { - found = i; - break; - } - - descInd++; - } - - assert(found != -1); - - collArea = &_collisionAreas[found]; - - key = inputArea(collArea->left, collArea->top, - collArea->right - collArea->left + 1, - collArea->bottom - collArea->top + 1, - inpDesc[*pCurPos].backColor, inpDesc[*pCurPos].frontColor, - GET_VARO_STR(collArea->key), inpDesc[*pCurPos].fontIndex, - collArea->flags, &time, collResId, collIndex, mono); - - if (_vm->_inter->_terminate) - return 0; - - switch (key) { - case kKeyNone: - if (*collResId == 0) - return 0; - - if (_mouseButtons != kMouseButtonsNone) { - for (collArea = _collisionAreas, i = 0; - collArea->left != 0xFFFF; collArea++, i++) { - if ((collArea->flags & 0xF00)) - continue; - - if ((collArea->id & 0x4000)) - continue; - - if ((collArea->left > _vm->_global->_inter_mouseX) || - (collArea->right < _vm->_global->_inter_mouseX) || - (collArea->top > _vm->_global->_inter_mouseY) || - (collArea->bottom < _vm->_global->_inter_mouseY)) - continue; - - if ((collArea->id & 0xF000)) - continue; - - if ((collArea->flags & 0x0F) < 3) - continue; - - if ((collArea->flags & 0x0F) > 10) - continue; - - *collIndex = i; - } - } - - if ((_collisionAreas[*collIndex].flags & 0x0F) < 3) - return 0; - - if ((_collisionAreas[*collIndex].flags & 0x0F) > 10) - return 0; - - *pCurPos = 0; - for (i = 0; i < 150; i++) { - collArea = &_collisionAreas[i]; - - if (collArea->left == 0xFFFF) - continue; - - if ((collArea->id & 0xC000) != 0x8000) - continue; - - if ((collArea->flags & 0x0F) < 3) - continue; - - if ((collArea->flags & 0x0F) > 10) - continue; - - if (i != *collIndex) - pCurPos[0]++; - } - break; - - case kKeyF1: - case kKeyF2: - case kKeyF3: - case kKeyF4: - case kKeyF5: - case kKeyF6: - case kKeyF7: - case kKeyF8: - case kKeyF9: - case kKeyF10: - return key; - - case kKeyReturn: - - if (index == 1) - return key; - - if (*pCurPos == index - 1) { - *pCurPos = 0; - break; - } - - pCurPos[0]++; - break; - - case kKeyDown: - if (index - 1 > *pCurPos) - pCurPos[0]++; - break; - - case kKeyUp: - if (*pCurPos > 0) - pCurPos[0]--; - break; - } - } -} - -int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, - int16 backColor, int16 frontColor, char *str, int16 fontIndex, - char inpType, int16 *pTotTime, int16 *collResId, int16 *collIndex, bool mono) { - byte handleMouse; - uint32 editSize; - Video::FontDesc *pFont; - char curSym; - int16 key; - const char *str1; - const char *str2; - int16 i; - uint32 pos; - int16 flag; - int16 savedKey; - byte *fontExtraBak = 0; - int16 needAdjust = 0; - - if ((_handleMouse != 0) && - ((_vm->_global->_useMouse != 0) || (_forceHandleMouse != 0))) - handleMouse = 1; - else - handleMouse = 0; - - pos = strlen(str); - pFont = _vm->_draw->_fonts[fontIndex]; - editSize = (!mono && pFont->extraData) ? 0 : (width / pFont->itemWidth); - - while (1) { - strncpy0(_tempStr, str, 254); - strcat(_tempStr, " "); - if ((editSize != 0) && strlen(_tempStr) > editSize) - strncpy0(_tempStr, str, 255); - - if (mono) { - fontExtraBak = _vm->_draw->_fonts[fontIndex]->extraData; - needAdjust = _vm->_draw->_needAdjust; - _vm->_draw->_needAdjust = 2; - _vm->_draw->_fonts[fontIndex]->extraData = 0; - } - - _vm->_draw->_destSpriteX = xPos; - _vm->_draw->_destSpriteY = yPos; - _vm->_draw->_spriteRight = mono ? (editSize * pFont->itemWidth) : width; - _vm->_draw->_spriteBottom = height; - - _vm->_draw->_destSurface = 21; - _vm->_draw->_backColor = backColor; - _vm->_draw->_frontColor = frontColor; - _vm->_draw->_textToPrint = _tempStr; - _vm->_draw->_transparency = 1; - _vm->_draw->_fontIndex = fontIndex; - _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10 ); - - _vm->_draw->_destSpriteY = yPos + (height - pFont->itemHeight) / 2; - _vm->_draw->spriteOperation(DRAW_PRINTTEXT | 0x10); - - if (mono) { - _vm->_draw->_needAdjust = needAdjust; - _vm->_draw->_fonts[fontIndex]->extraData = fontExtraBak; - } - - if ((editSize != 0) && (pos == editSize)) - pos--; - - curSym = _tempStr[pos]; - - flag = 1; - - if (_vm->_inter->_variables) - WRITE_VAR(56, pos); - - while (1) { - if (mono) { - fontExtraBak = _vm->_draw->_fonts[fontIndex]->extraData; - needAdjust = _vm->_draw->_needAdjust; - _vm->_draw->_needAdjust = 2; - _vm->_draw->_fonts[fontIndex]->extraData = 0; - } - - _tempStr[0] = curSym; - _tempStr[1] = 0; - - if (pFont->extraData) { - _vm->_draw->_destSpriteY = yPos; - _vm->_draw->_spriteBottom = height; - _vm->_draw->_spriteRight = 1; - - _vm->_draw->_destSpriteX = xPos; - for (uint32 j = 0; j < pos; j++) - _vm->_draw->_destSpriteX += pFont->extraData[str[j] - pFont->startItem]; - - } else { - _vm->_draw->_destSpriteX = xPos + pFont->itemWidth * pos; - _vm->_draw->_destSpriteY = yPos + height - 1; - _vm->_draw->_spriteRight = pFont->itemWidth; - _vm->_draw->_spriteBottom = 1; - } - - _vm->_draw->_destSurface = 21; - _vm->_draw->_backColor = frontColor; - _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10); - - if (mono) { - _vm->_draw->_needAdjust = needAdjust; - _vm->_draw->_fonts[fontIndex]->extraData = fontExtraBak; - } - - if (flag != 0) { - key = checkCollisions(handleMouse, -1, collResId, collIndex); - if (key == 0) - key = checkCollisions(handleMouse, -300, collResId, collIndex); - flag = 0; - } else - key = checkCollisions(handleMouse, -300, collResId, collIndex); - - if (mono) { - fontExtraBak = _vm->_draw->_fonts[fontIndex]->extraData; - needAdjust = _vm->_draw->_needAdjust; - _vm->_draw->_needAdjust = 2; - _vm->_draw->_fonts[fontIndex]->extraData = 0; - } - - _tempStr[0] = curSym; - _tempStr[1] = 0; - - if (pFont->extraData) { - _vm->_draw->_destSpriteY = yPos; - _vm->_draw->_spriteBottom = height; - _vm->_draw->_spriteRight = 1; - - _vm->_draw->_destSpriteX = xPos; - for (uint32 j = 0; j < pos; j++) - _vm->_draw->_destSpriteX += pFont->extraData[str[j] - pFont->startItem]; - - } else { - _vm->_draw->_destSpriteX = xPos + pFont->itemWidth * pos; - _vm->_draw->_destSpriteY = yPos + height - 1; - _vm->_draw->_spriteRight = pFont->itemWidth; - _vm->_draw->_spriteBottom = 1; - } - - _vm->_draw->_destSurface = 21; - _vm->_draw->_backColor = backColor; - _vm->_draw->_frontColor = frontColor; - _vm->_draw->_textToPrint = _tempStr; - _vm->_draw->_transparency = 1; - _vm->_draw->_fontIndex = fontIndex; - _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10); - - _vm->_draw->_destSpriteY = yPos + (height - pFont->itemHeight) / 2; - _vm->_draw->spriteOperation(DRAW_PRINTTEXT | 0x10); - - if (mono) { - _vm->_draw->_needAdjust = needAdjust; - _vm->_draw->_fonts[fontIndex]->extraData = fontExtraBak; - } - - if ((key != 0) || (*collResId != 0)) - break; - - key = checkCollisions(handleMouse, -300, collResId, collIndex); - - if ((key != 0) || (*collResId != 0) || - _vm->_inter->_terminate || _vm->shouldQuit()) - break; - - if (*pTotTime > 0) { - *pTotTime -= 600; - if (*pTotTime <= 1) { - key = 0; - *collResId = 0; - break; - } - } - } - - if ((key == 0) || (*collResId != 0) || - _vm->_inter->_terminate || _vm->shouldQuit()) - return 0; - - switch (key) { - case kKeyRight: - if ((pos > strlen(str)) || (pos > (editSize - 1)) || (editSize == 0)) { - pos++; - continue; - } - return kKeyDown; - - case kKeyLeft: - if (pos > 0) { - pos--; - continue; - } - return kKeyUp; - - case kKeyBackspace: - if (pos > 0) { - _vm->_util->cutFromStr(str, pos - 1, 1); - pos--; - continue; - } else { - if (pos < strlen(str)) - _vm->_util->cutFromStr(str, pos, 1); - } - - case kKeyDelete: - if (pos >= strlen(str)) - continue; - - _vm->_util->cutFromStr(str, pos, 1); - continue; - - case kKeyReturn: - case kKeyF1: - case kKeyF2: - case kKeyF3: - case kKeyF4: - case kKeyF5: - case kKeyF6: - case kKeyF7: - case kKeyF8: - case kKeyF9: - case kKeyF10: - case kKeyUp: - case kKeyDown: - return key; - - case kKeyEscape: - if (_vm->_global->_useMouse != 0) - continue; - - _forceHandleMouse = !_forceHandleMouse; - - if ((_handleMouse != 0) && - ((_vm->_global->_useMouse != 0) || (_forceHandleMouse != 0))) - handleMouse = 1; - else - handleMouse = 0; - - while (_vm->_global->_pressedKeys[1] != 0) - ; - continue; - - default: - - savedKey = key; - key &= 0xFF; - - if (((inpType == 9) || (inpType == 10)) && - (key >= ' ') && (key <= 0xFF)) { - str1 = "0123456789-.,+ "; - str2 = "0123456789-,,+ "; - - if ((((savedKey >> 8) > 1) && ((savedKey >> 8) < 12)) && - ((_vm->_global->_pressedKeys[42] != 0) || - (_vm->_global->_pressedKeys[56] != 0))) - key = ((savedKey >> 8) - 1) % 10 + '0'; - - for (i = 0; str1[i] != 0; i++) { - if (key == str1[i]) { - key = str2[i]; - break; - } - } - - if (i == (int16) strlen(str1)) - key = 0; - } - - if ((key >= ' ') && (key <= 0xFF)) { - if (editSize == 0) { - int length = _vm->_draw->stringLength(str, fontIndex) + - pFont->extraData[' ' - pFont->startItem] + - pFont->extraData[key - pFont->startItem]; - - if (length > width) - continue; - - if (((int32) strlen(str)) >= (_vm->_global->_inter_animDataSize * 4 - 1)) - continue; - - } else { - if (strlen(str) > editSize) - continue; - else if (editSize == strlen(str)) - _vm->_util->cutFromStr(str, strlen(str) - 1, 1); - } - - pos++; - _tempStr[0] = key; - _tempStr[1] = 0; - - _vm->_util->insertStr(_tempStr, str, pos - 1); - } - - } - } -} - -int16 Game_v2::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) { - Collision *ptr; - int16 i; - - if (resId != 0) - *resId = 0; - - *resIndex = 0; - - ptr = _collisionAreas; - for (i = 0; ptr->left != 0xFFFF; ptr++, i++) { - if (ptr->id & 0x4000) - continue; - - if (all) { - if ((ptr->flags & 0xF) > 1) - continue; - - if ((ptr->flags & 0xF00) != 0) - continue; - - if ((_vm->_global->_inter_mouseX < ptr->left) || - (_vm->_global->_inter_mouseX > ptr->right) || - (_vm->_global->_inter_mouseY < ptr->top) || - (_vm->_global->_inter_mouseY > ptr->bottom)) - continue; - - if (resId != 0) - *resId = ptr->id; - - *resIndex = i; - return ptr->key; - } else { - if ((ptr->flags & 0xF00) != 0) - continue; - - if ((ptr->flags & 0xF) < 1) - continue; - - if ((((ptr->flags & 0xF0) >> 4) != (((int32) _mouseButtons) - 1)) && - (((ptr->flags & 0xF0) >> 4) != 2)) - continue; - - if ((_vm->_global->_inter_mouseX < ptr->left) || - (_vm->_global->_inter_mouseX > ptr->right) || - (_vm->_global->_inter_mouseY < ptr->top) || - (_vm->_global->_inter_mouseY > ptr->bottom)) - continue; - - if (resId != 0) - *resId = ptr->id; - *resIndex = i; - if (((ptr->flags & 0xF) == 1) || ((ptr->flags & 0xF) == 2)) - return ptr->key; - return 0; - } - } - - if ((_mouseButtons != kMouseButtonsLeft) && (all == 0)) - return kKeyEscape; - - return 0; -} - } // End of namespace Gob diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp index 985f72c23a..e8e08578b3 100644 --- a/engines/gob/game_v6.cpp +++ b/engines/gob/game_v6.cpp @@ -33,13 +33,13 @@ #include "gob/global.h" #include "gob/script.h" #include "gob/resources.h" +#include "gob/hotspots.h" #include "gob/inter.h" #include "gob/draw.h" namespace Gob { Game_v6::Game_v6(GobEngine *vm) : Game_v2(vm) { - _someTimeDly = 0; } // flagbits: 5 = freeInterVariables, 6 = skipPlay @@ -75,7 +75,7 @@ void Game_v6::totSub(int8 flags, const char *newTotFile) { return; } - pushCollisions(0); + _hotspots->push(0, true); if (flags & 6) playTot(-1); @@ -85,8 +85,8 @@ void Game_v6::totSub(int8 flags, const char *newTotFile) { if (_vm->_inter->_terminate < 2) _vm->_inter->_terminate = 0; - clearCollisions(); - popCollisions(); +_hotspots->clear(); +_hotspots->pop(); if ((flags & 5) && _vm->_inter->_variables) { _vm->_inter->delocateVars(); @@ -99,45 +99,6 @@ void Game_v6::totSub(int8 flags, const char *newTotFile) { _environments->get(_numEnvironments); } -int16 Game_v6::addNewCollision(int16 id, uint16 left, uint16 top, - uint16 right, uint16 bottom, int16 flags, int16 key, - uint16 funcEnter, uint16 funcLeave, uint16 funcSub) { - Collision *ptr; - - debugC(5, kDebugCollisions, "addNewCollision"); - debugC(5, kDebugCollisions, "id = %X", id); - debugC(5, kDebugCollisions, "left = %d, top = %d, right = %d, bottom = %d", - left, top, right, bottom); - debugC(5, kDebugCollisions, "flags = %X, key = %X", flags, key); - debugC(5, kDebugCollisions, "funcEnter = %d, funcLeave = %d", - funcEnter, funcLeave); - - for (int i = 0; i < 150; i++) { - if ((_collisionAreas[i].left != 0xFFFF) && (_collisionAreas[i].id != id)) - continue; - - ptr = &_collisionAreas[i]; - - if ((ptr->id & 0xBFFF) != (id & 0xBFFF)) - ptr->id = id; - - ptr->left = left; - ptr->top = top; - ptr->right = right; - ptr->bottom = bottom; - ptr->flags = flags; - ptr->key = key; - ptr->funcEnter = funcEnter; - ptr->funcLeave = funcLeave; - ptr->funcSub = funcSub; - ptr->script = _script; - - return i; - } - error("Game_v6::addNewCollision(): Collision array full"); - return 0; -} - void Game_v6::prepareStart(void) { _noCd = false; @@ -149,966 +110,4 @@ void Game_v6::prepareStart(void) { Game_v2::prepareStart(); } -void Game_v6::pushCollisions(char all) { - Collision *srcPtr; - Collision *destPtr; - int16 size; - - debugC(1, kDebugCollisions, "pushCollisions"); - for (size = 0, srcPtr = _collisionAreas; srcPtr->left != 0xFFFF; srcPtr++) { - if ( (all == 1) || - ((all == 0) && (((uint16) srcPtr->id) >= 20)) || - ((all == 2) && (((srcPtr->id & 0xF000) == 0xD000) || - ((srcPtr->id & 0xF000) == 0x4000) || - ((srcPtr->id & 0xF000) == 0xE000)))) - size++; - } - - if (_collStackSize >= 5) - error("Game_v6::pushCollisions: _collStackSize == %d", _collStackSize); - - destPtr = new Collision[size]; - _collStack[_collStackSize] = destPtr; - - if (_vm->_inter->_terminate) - return; - - _collStackElemSizes[_collStackSize] = size; - - if (_shouldPushColls != 0) - _collStackElemSizes[_collStackSize] |= 0x8000; - - _shouldPushColls = 0; - _collLasts[_collStackSize].key = _lastCollKey; - _collLasts[_collStackSize].id = _lastCollId; - _collLasts[_collStackSize].areaIndex = _lastCollAreaIndex; - _lastCollKey = 0; - _lastCollId = 0; - _lastCollAreaIndex = 0; - _collStackSize++; - - for (srcPtr = _collisionAreas; srcPtr->left != 0xFFFF; srcPtr++) { - if ( (all == 1) || - ((all == 0) && (((uint16) srcPtr->id) >= 20)) || - ((all == 2) && (((srcPtr->id & 0xF000) == 0xD000) || - ((srcPtr->id & 0xF000) == 0x4000) || - ((srcPtr->id & 0xF000) == 0xE000)))) { - - memcpy(destPtr, srcPtr, sizeof(Collision)); - srcPtr->left = 0xFFFF; - destPtr++; - } - } -} - -int16 Game_v6::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, - int16 *pResIndex) { - int16 resIndex; - int16 key; - uint32 timeKey; - - _scrollHandleMouse = handleMouse != 0; - - if (deltaTime >= -1) { - _lastCollKey = 0; - _lastCollAreaIndex = 0; - _lastCollId = 0; - } - - if (pResId != 0) - *pResId = 0; - - resIndex = 0; - - if ((_lastCollKey != 0) && - ( (_collisionAreas[_lastCollAreaIndex].id != _lastCollId) || - (_collisionAreas[_lastCollAreaIndex].key != _lastCollKey))) { - - _lastCollKey = 0; - _lastCollAreaIndex = 0; - _lastCollId = 0; - } - - if ((_vm->_draw->_cursorIndex == -1) && - (handleMouse != 0) && (_lastCollKey == 0)) { - _lastCollKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex); - - if ((_lastCollKey != 0) && (_lastCollId & 0x8000)) - collAreaSub(_lastCollAreaIndex, 1); - } - - if (handleMouse != 0) - _vm->_draw->animateCursor(-1); - - timeKey = _vm->_util->getTimeKey(); - _vm->_draw->blitInvalidated(); - while (1) { - if (_vm->_inter->_terminate || _vm->shouldQuit()) { - if (handleMouse) - _vm->_draw->blitCursor(); - return 0; - } - - collSubReenter(); - if (!_vm->_draw->_noInvalidated) { - if (handleMouse != 0) - _vm->_draw->animateCursor(-1); - else - _vm->_draw->blitInvalidated(); - _vm->_video->waitRetrace(); - } - - key = checkKeys(&_vm->_global->_inter_mouseX, - &_vm->_global->_inter_mouseY, &_mouseButtons, handleMouse); - - if ((handleMouse == 0) && (_mouseButtons != kMouseButtonsNone)) { - _vm->_util->waitMouseRelease(0); - key = 3; - } - - if (key != 0) { - - if (handleMouse & 1) - _vm->_draw->blitCursor(); - - if (pResId != 0) - *pResId = 0; - - if (pResIndex != 0) - *pResIndex = 0; - - if ((_lastCollKey != 0) && (_lastCollId & 0x8000)) - collAreaSub(_lastCollAreaIndex, 0); - - _lastCollKey = 0; - if (key != 0) - return key; - - if (handleMouse) - _vm->_draw->animateCursor(-1); - } - - if (handleMouse != 0) { - if (_mouseButtons != kMouseButtonsNone) { - - if (deltaTime > 0) { - _vm->_draw->animateCursor(2); - _vm->_util->delay(deltaTime); - } else if (handleMouse & 1) - _vm->_util->waitMouseRelease(1); - - _vm->_draw->animateCursor(-1); - - if (pResId != 0) - *pResId = 0; - - key = checkMousePoint(0, pResId, &resIndex); - if (pResIndex != 0) - *pResIndex = resIndex; - - if ((key != 0) || ((pResId != 0) && (*pResId != 0))) { - if ((handleMouse & 1) && - ((deltaTime <= 0) || (_mouseButtons == kMouseButtonsNone))) - _vm->_draw->blitCursor(); - - if (key != _lastCollKey) - collAreaSub(_lastCollAreaIndex, 0); - - _lastCollKey = 0; - return key; - } - - if (handleMouse & 4) - return 0; - - if (_lastCollKey != 0) - collAreaSub(_lastCollAreaIndex, 0); - - _lastCollKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex); - if ((_lastCollKey != 0) && (_lastCollId & 0x8000)) - collAreaSub(_lastCollAreaIndex, 1); - } else - collSubReenter(); - } - - if ((deltaTime == -2) && (key == 0) && (_mouseButtons == kMouseButtonsNone)) { - if (pResId != 0) - *pResId = 0; - - if (pResIndex != 0) - *pResIndex = 0; - - return 0; - - } else if (handleMouse != 0) - _vm->_draw->animateCursor(-1); - - if ((deltaTime < 0) && (key == 0) && (_mouseButtons == kMouseButtonsNone)) { - uint32 curtime = _vm->_util->getTimeKey(); - if ((curtime + deltaTime) > timeKey) { - if (pResId != 0) - *pResId = 0; - - if (pResIndex != 0) - *pResIndex = 0; - - return 0; - } - } - - _vm->_util->delay(10); - } -} - -void Game_v6::collisionsBlock(void) { - InputDesc descArray[20]; - int16 array[300]; - byte count; - int16 collResId; - int16 curCmd; - int16 cmd; - int16 cmdHigh; - int16 key; - int16 flags; - uint16 left; - uint16 top; - uint16 width; - uint16 height; - int16 deltaTime; - int16 stackPos2; - int16 descIndex; - int16 timeVal; - char *str; - int16 i; - int16 counter; - int16 var_24; - int16 var_26; - int16 collStackPos; - Collision *collPtr; - Collision *collArea; - byte collAreaStart; - int16 activeCollResId = 0; - int16 activeCollIndex = 0; - uint32 startPos; - uint32 offsetPos; - - if (_shouldPushColls) - pushCollisions(0); - - collAreaStart = 0; - while (_collisionAreas[collAreaStart].left != 0xFFFF) - collAreaStart++; - collArea = &_collisionAreas[collAreaStart]; - - _shouldPushColls = 0; - collResId = -1; - - _script->skip(1); - count = _script->readByte(); - - _handleMouse = _script->peekByte(0); - deltaTime = 1000 * _script->peekByte(1); - stackPos2 = _script->peekByte(3); - descIndex = _script->peekByte(4); - byte var_42 = _script->peekByte(5); - - if ((stackPos2 != 0) || (descIndex != 0)) { - deltaTime /= 100; - if (_script->peekByte(1) == 100) - deltaTime = 2; - } - - timeVal = deltaTime; - _script->skip(6); - - startPos = _script->pos(); - WRITE_VAR(16, 0); - - byte var_41 = 0; - int16 var_46 = 0; - int16 var_1C = 0; - int16 index = 0; - int16 curEditIndex = 0; - int right = 0, funcLeave = 0; - - for (curCmd = 0; curCmd < count; curCmd++) { - array[curCmd] = 0; - cmd = _script->readByte(); - - if ((cmd & 0x40) != 0) { - cmd -= 0x40; - cmdHigh = _script->readByte(); - cmdHigh <<= 8; - } else - cmdHigh = 0; - - if ((cmd & 0x80) != 0) { - offsetPos = _script->pos(); - left = _script->readValExpr(); - top = _script->readValExpr(); - width = _script->readValExpr(); - height = _script->readValExpr(); - } else { - offsetPos = 0; - left = _script->readUint16(); - top = _script->readUint16(); - width = _script->readUint16(); - height = _script->readUint16(); - } - - if ((_vm->_draw->_renderFlags & RENDERFLAG_CAPTUREPOP) && (left != 0xFFFF)) { - left += _vm->_draw->_backDeltaX; - top += _vm->_draw->_backDeltaY; - } - - if (left != 0xFFFF) { - _vm->_draw->adjustCoords(0, &left, &top); - if (((cmd & 0x3F) < 20) && ((cmd & 0x3F) >= 3)) { - if (_vm->_draw->_needAdjust != 2) - height &= 0xFFFE; - _vm->_draw->adjustCoords(0, 0, &width); - } else - _vm->_draw->adjustCoords(0, &height, &width); - } - - cmd &= 0x7F; - debugC(1, kDebugCollisions, "collisionsBlock(%d)", cmd); - - switch (cmd) { - case 0: - _script->skip(6); - startPos = _script->pos(); - _script->skip(_script->peekUint16(2) + 2); - key = curCmd + 0xA000; - - addNewCollision(curCmd + 0x8000, left, top, - left + width - 1, top + height - 1, - cmd + cmdHigh, key, startPos, - _script->pos(), offsetPos); - - _script->skip(_script->peekUint16(2) + 2); - - break; - - case 1: - key = _script->readInt16(); - array[curCmd] = _script->readInt16(); - flags = _script->readInt16(); - - startPos = _script->pos(); - _script->skip(_script->peekUint16(2) + 2); - - if (key == 0) - key = curCmd + 0xA000; - - addNewCollision(curCmd + 0x8000, left, top, - left + width - 1, top + height - 1, - (flags << 4) + cmd + cmdHigh, key, startPos, - _script->pos(), offsetPos); - - _script->skip(_script->peekUint16(2) + 2); - - break; - - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - _vm->_util->clearKeyBuf(); - var_1C = 1; - key = _script->readVarIndex(); - descArray[index].fontIndex = _script->readInt16(); - descArray[index].backColor = _script->readByte(); - descArray[index].frontColor = _script->readByte(); - - if ((cmd >= 5) && (cmd <= 8)) { - descArray[index].ptr = _script->getData() + _script->pos() + 2; - _script->skip(_script->peekUint16() + 2); - } else - descArray[index].ptr = 0; - - if (left == 0xFFFF) { - if ((cmd & 1) == 0) { - _script->skip(_script->peekUint16(2) + 2); - } - break; - } - - right = left + width - 1; - if (!_vm->_draw->_fonts[descArray[index].fontIndex]->extraData) - right = left + width * _vm->_draw->_fonts[descArray[index].fontIndex]->itemWidth - 1; - - funcLeave = 0; - if (!(cmd & 1)) - funcLeave = _script->pos(); - - addNewCollision(curCmd + 0x8000, left, top, right, - top + height - 1, cmd, key, 0, funcLeave, 0); - - if (!(cmd & 1)) { - _script->skip(_script->peekUint16(2) + 2); - } - - index++; - break; - - case 11: - _script->skip(6); - for (i = 0; i < 150; i++) { - if ((_collisionAreas[i].id & 0xF000) == 0xE000) { - _collisionAreas[i].id &= 0xBFFF; - _collisionAreas[i].funcEnter = - _script->pos(); - _collisionAreas[i].funcLeave = - _script->pos(); - } - } - _script->skip(_script->peekUint16(2) + 2); - break; - - case 12: - _script->skip(6); - for (i = 0; i < 150; i++) { - if ((_collisionAreas[i].id & 0xF000) == 0xD000) { - _collisionAreas[i].id &= 0xBFFF; - _collisionAreas[i].funcEnter = - _script->pos(); - _collisionAreas[i].funcLeave = - _script->pos(); - } - } - _script->skip(_script->peekUint16(2) + 2); - break; - - case 20: - collResId = curCmd; - // Fall through to case 2 - - case 2: - key = _script->readInt16(); - array[curCmd] = _script->readInt16(); - flags = _script->readInt16(); - - addNewCollision(curCmd + 0x8000, left, top, - left + width - 1, top + height - 1, - (flags << 4) + cmdHigh + 2, key, 0, - _script->pos(), offsetPos); - - _script->skip(_script->peekUint16(2) + 2); - - break; - - case 21: - key = _script->readInt16(); - array[curCmd] = _script->readInt16(); - flags = _script->readInt16() & 3; - - addNewCollision(curCmd + 0x8000, left, top, - left + width - 1, top + height - 1, - (flags << 4) + cmdHigh + 2, key, - _script->pos(), 0, offsetPos); - - _script->skip(_script->peekUint16(2) + 2); - - break; - } - } - - if (var_42 != 0) - setCollisions(1); - - _forceHandleMouse = 0; - _vm->_util->clearKeyBuf(); - - do { - if (var_1C != 0) { - key = multiEdit(deltaTime, index, &curEditIndex, descArray, - &activeCollResId, &activeCollIndex, false); - - WRITE_VAR(55, curEditIndex); - if (key == kKeyReturn) { - for (i = 0; i < 150; i++) { - if (_collisionAreas[i].left == 0xFFFF) - break; - - if ((_collisionAreas[i].id & 0xC000) != 0x8000) - continue; - - if ((_collisionAreas[i].flags & 1) != 0) - continue; - - if ((_collisionAreas[i].flags & 0x0F) <= 2) - continue; - - activeCollResId = _collisionAreas[i].id; - collResId = _collisionAreas[i].id & 0x7FFF; - activeCollIndex = i; - break; - } - break; - } - } else - key = checkCollisions(_handleMouse, -deltaTime, - &activeCollResId, &activeCollIndex); - - if (((key & 0xFF) >= ' ') && ((key & 0xFF) <= 0xFF) && - ((key >> 8) > 1) && ((key >> 8) < 12)) - key = '0' + (((key >> 8) - 1) % 10) + (key & 0xFF00); - - if (activeCollResId == 0) { - if (key != 0) { - for (i = 0; i < 150; i++) { - if (_collisionAreas[i].left == 0xFFFF) - break; - - if ((_collisionAreas[i].id & 0xC000) != 0x8000) - continue; - - if ((_collisionAreas[i].key == key) || - (_collisionAreas[i].key == 0x7FFF)) { - activeCollResId = _collisionAreas[i].id; - activeCollIndex = i; - break; - } - } - - if (activeCollResId == 0) { - for (i = 0; i < 150; i++) { - if (_collisionAreas[i].left == 0xFFFF) - break; - - if ((_collisionAreas[i].id & 0xC000) != 0x8000) - continue; - - if ((_collisionAreas[i].key & 0xFF00) != 0) - continue; - - if (_collisionAreas[i].key == 0) - continue; - - if (adjustKey(key & 0xFF) == adjustKey(_collisionAreas[i].key)) { - activeCollResId = _collisionAreas[i].id; - activeCollIndex = i; - break; - } - } - } - } else if (deltaTime != 0) { - if (stackPos2 != 0) { - collStackPos = 0; - - for (i = 0, collPtr = collArea; collPtr->left != 0xFFFF; i++, collPtr++) { - if ((collPtr->id & 0xF000) != 0x8000) - continue; - - collStackPos++; - if (collStackPos != stackPos2) - continue; - - activeCollResId = collPtr->id; - activeCollIndex = i + collAreaStart; - _vm->_inter->storeMouse(); - if (VAR(16) != 0) - break; - - if ((activeCollResId & 0xF000) == 0x8000) - WRITE_VAR(16, array[activeCollResId & 0xFFF]); - else - WRITE_VAR(16, activeCollResId & 0xFFF); - - if (collPtr->funcLeave != 0) { - uint32 timeKey = _vm->_util->getTimeKey(); - collSub(collPtr->funcLeave); - - if (timeVal != 2) { - deltaTime = timeVal - (_vm->_util->getTimeKey() - timeKey); - - if ((deltaTime - var_46) < 3) { - var_46 -= (deltaTime - 3); - deltaTime = 3; - } else if (var_46 != 0) { - deltaTime -= var_46; - var_46 = 0; - } - - if (deltaTime > timeVal) - deltaTime = timeVal; - - } else - deltaTime = 2; - - } - - if (VAR(16) == 0) - activeCollResId = 0; - else - var_41 = 1; - - break; - } - } else { - if (descIndex != 0) { - - counter = 0; - for (i = 0, collPtr = collArea; collPtr->left != 0xFFFF; i++, collPtr++) { - if ((collPtr->id & 0xF000) == 0x8000) - if (++counter == descIndex) { - activeCollResId = collPtr->id; - activeCollIndex = i + collAreaStart; - break; - } - } - - } else { - - for (i = 0, collPtr = _collisionAreas; collPtr->left != 0xFFFF; i++, collPtr++) { - if ((collPtr->id & 0xF000) == 0x8000) { - activeCollResId = collPtr->id; - activeCollIndex = i; - break; - } - } - if ((_lastCollKey != 0) && - (_collisionAreas[_lastCollAreaIndex].funcLeave != 0)) - collSub(_collisionAreas[_lastCollAreaIndex].funcLeave); - - _lastCollKey = 0; - } - - } - } - } - - if (var_41 != 0) - break; - - if ((activeCollResId == 0) || - (_collisionAreas[activeCollIndex].funcLeave != 0)) - continue; - - _vm->_inter->storeMouse(); - if ((activeCollResId & 0xF000) == 0x8000) - WRITE_VAR(16, array[activeCollResId & 0xFFF]); - else - WRITE_VAR(16, activeCollResId & 0xFFF); - - if (_collisionAreas[activeCollIndex].funcEnter != 0) - collSub(_collisionAreas[activeCollIndex].funcEnter); - - WRITE_VAR(16, 0); - activeCollResId = 0; - } - while ((activeCollResId == 0) && !_vm->_inter->_terminate && !_vm->shouldQuit()); - - if ((activeCollResId & 0xFFF) == collResId) { - collStackPos = 0; - var_24 = 0; - var_26 = 1; - for (i = 0; i < 150; i++) { - if (_collisionAreas[i].left == 0xFFFF) - continue; - - if ((_collisionAreas[i].id & 0xC000) != 0x8000) - continue; - - if ((_collisionAreas[i].flags & 0x0F) < 3) - continue; - - if ((_collisionAreas[i].flags & 0x0F) > 10) - continue; - - if ((_collisionAreas[i].flags & 0x0F) > 8) { - char *ptr; - strncpy0(_tempStr, GET_VARO_STR(_collisionAreas[i].key), 255); - while ((ptr = strchr(_tempStr, ' '))) - _vm->_util->cutFromStr(_tempStr, (ptr - _tempStr), 1); - if (_vm->_language == 2) - while ((ptr = strchr(_tempStr, '.'))) - *ptr = ','; - WRITE_VARO_STR(_collisionAreas[i].key, _tempStr); - } - - if (((_collisionAreas[i].flags & 0x0F) >= 5) && - ((_collisionAreas[i].flags & 0x0F) <= 8)) { - str = (char *) descArray[var_24].ptr; - - strncpy0(_tempStr, GET_VARO_STR(_collisionAreas[i].key), 255); - - if ((_collisionAreas[i].flags & 0x0F) < 7) - _vm->_util->cleanupStr(_tempStr); - - int16 pos = 0; - do { - strncpy0(_collStr, str, 255); - pos += strlen(str) + 1; - - str += strlen(str) + 1; - - if ((_collisionAreas[i].flags & 0x0F) < 7) - _vm->_util->cleanupStr(_collStr); - - if (strcmp(_tempStr, _collStr) == 0) { - WRITE_VAR(17, VAR(17) + 1); - WRITE_VAR(17 + var_26, 1); - break; - } - } while (READ_LE_UINT16(descArray[var_24].ptr - 2) > pos); - collStackPos++; - } else { - WRITE_VAR(17 + var_26, 2); - } - var_24++; - var_26++; - } - - if (collStackPos != (int16) VAR(17)) - WRITE_VAR(17, 0); - else - WRITE_VAR(17, 1); - } - - if (_handleMouse == 1) - _vm->_draw->blitCursor(); - - if (!_vm->_inter->_terminate && (var_41 == 0)) { - _script->seek(_collisionAreas[activeCollIndex].funcLeave); - - _vm->_inter->storeMouse(); - if (VAR(16) == 0) { - if ((activeCollResId & 0xF000) == 0x8000) - WRITE_VAR(16, array[activeCollResId & 0xFFF]); - else - WRITE_VAR(16, activeCollResId & 0xFFF); - } - } else - _script->setFinished(true); - - for (curCmd = 0; curCmd < count; curCmd++) - freeCollision(curCmd + 0x8000); - - for (i = 0; i < 150; i++) { - if (((_collisionAreas[i].id & 0xF000) == 0xA000) || - ((_collisionAreas[i].id & 0xF000) == 0x9000)) - _collisionAreas[i].id |= 0x4000; - } -} - -void Game_v6::setCollisions(byte arg_0) { - for (Collision *collArea = _collisionAreas; collArea->left != 0xFFFF; collArea++) { - if (((collArea->id & 0xC000) != 0x8000) || (collArea->funcSub == 0)) - continue; - - if (arg_0 == 0) - if (collArea->flags & 0x80) - continue; - - Script *curScript = _script; - - _script = collArea->script; - if (!_script) - _script = curScript; - - _script->call(collArea->funcSub); - - int16 left = _script->readValExpr(); - int16 top = _script->readValExpr(); - int16 width = _script->readValExpr(); - int16 height = _script->readValExpr(); - uint16 flags = 0; - - if ((collArea->id & 0xF000) == 0xA000) - flags = _script->readValExpr(); - - if ((_vm->_draw->_renderFlags & RENDERFLAG_CAPTUREPOP) && - (left != -1)) { - left += _vm->_draw->_backDeltaX; - top += _vm->_draw->_backDeltaY; - } - if (_vm->_draw->_needAdjust != 2) { - _vm->_draw->adjustCoords(0, &left, &top); - if ((collArea->flags & 0x0F) < 3) - _vm->_draw->adjustCoords(2, &width, &height); - else { - height &= 0xFFFE; - _vm->_draw->adjustCoords(2, 0, &height); - } - } - - if (left < 0) { - width += left; - left = 0; - } - - if (top < 0) { - height += top; - top = 0; - } - - collArea->left = left; - collArea->top = top; - collArea->right = left + width - 1; - collArea->bottom = top + height - 1; - - if ((collArea->id & 0xF000) == 0xA000) - collArea->flags = flags; - - _script->pop(); - - _script = curScript; - } -} - -void Game_v6::collSub(uint16 offset) { - int16 collStackSize; - - uint32 savedPos = _script->pos(); - - _script->seek(offset); - - _shouldPushColls = 1; - collStackSize = _collStackSize; - - _vm->_inter->funcBlock(0); - - if (collStackSize != _collStackSize) - popCollisions(); - - _shouldPushColls = 0; - - _script->seek(savedPos); - - if ((_vm->_util->getTimeKey() - _someTimeDly) > 500) - setCollisions(0); -} - -static const byte adjustTable[] = { - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x21, 0x21, 0x21, 0x21, 0x21, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x81, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, - 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, - 0x12, 0x12, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, - 0x40, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x40, 0x40, 0x40, 0x40, 0x40, - 0x40, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x40, 0x40, 0x40, 0x40, 0x20, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -int16 Game_v6::adjustKey(int16 key) { - if (key == -1) - return -1; - - if (adjustTable[key & 0xFF] & 8) - return ((key & 0xFF) - 0x20); - - return key & 0xFF; -} - -int16 Game_v6::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) { - Collision *ptr; - int16 i; - - if (resId != 0) - *resId = 0; - - *resIndex = 0; - - ptr = _collisionAreas; - for (i = 0; ptr->left != 0xFFFF; ptr++, i++) { - if (ptr->id & 0x4000) - continue; - - if (all) { - if ((ptr->flags & 0xF) > 1) - continue; - - if ((ptr->flags & 0xF00) != 0) - continue; - - if ((_vm->_global->_inter_mouseX < ptr->left) || - (_vm->_global->_inter_mouseX > ptr->right) || - (_vm->_global->_inter_mouseY < ptr->top) || - (_vm->_global->_inter_mouseY > ptr->bottom)) - continue; - - if (resId != 0) - *resId = ptr->id; - - *resIndex = i; - return ptr->key; - } else { - if ((ptr->flags & 0xF00) != 0) - continue; - - if ((ptr->flags & 0xF) < 1) - continue; - - if ((((ptr->flags & 0x70) >> 4) != (((int32) _mouseButtons) - 1)) && - (((ptr->flags & 0x70) >> 4) != 2)) - continue; - - if ((_vm->_global->_inter_mouseX < ptr->left) || - (_vm->_global->_inter_mouseX > ptr->right) || - (_vm->_global->_inter_mouseY < ptr->top) || - (_vm->_global->_inter_mouseY > ptr->bottom)) - continue; - - if (resId != 0) - *resId = ptr->id; - *resIndex = i; - if (((ptr->flags & 0xF) == 1) || ((ptr->flags & 0xF) == 2)) - return ptr->key; - return 0; - } - } - - if ((_mouseButtons != kMouseButtonsLeft) && (all == 0)) - return kKeyEscape; - - return 0; -} - -void Game_v6::collSubReenter() { - int16 lastCollAreaIndex = _lastCollAreaIndex; - int16 lastCollId = _lastCollId; - int16 collKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex); - - if (collKey == _lastCollKey) - return; - - if ((_lastCollKey != 0) && (lastCollId & 0x8000)) - collAreaSub(lastCollAreaIndex, 0); - - _lastCollKey = collKey; - - if ((_lastCollKey != 0) && (_lastCollId & 0x8000)) - collAreaSub(_lastCollAreaIndex, 1); -} - } // End of namespace Gob diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp new file mode 100644 index 0000000000..bed9d6a7cb --- /dev/null +++ b/engines/gob/hotspots.cpp @@ -0,0 +1,1706 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "gob/hotspots.h" +#include "gob/global.h" +#include "gob/helper.h" +#include "gob/draw.h" +#include "gob/game.h" +#include "gob/script.h" +#include "gob/inter.h" + +namespace Gob { + +Hotspots::Hotspot::Hotspot() { + clear(); +} + +Hotspots::Hotspot::Hotspot(uint16 i, + uint16 l, uint16 t, uint16 r, uint16 b, uint16 f, uint16 k, + uint16 enter, uint16 leave, uint16 pos) { + + id = i; + left = l; + top = t; + right = r; + bottom = b; + flags = f; + key = k; + funcEnter = enter; + funcLeave = leave; + funcPos = pos; + script = 0; +} + +void Hotspots::Hotspot::clear() { + id = 0; + left = 0xFFFF; + top = 0; + right = 0; + bottom = 0; + flags = 0; + key = 0; + funcEnter = 0; + funcLeave = 0; + funcPos = 0; + script = 0; +} + +Hotspots::Type Hotspots::Hotspot::getType() const { + return (Type) (flags & 0xF); +} + +MouseButtons Hotspots::Hotspot::getButton() const { + uint8 buttonBits = ((flags & 0x70) >> 4); + + if (buttonBits == 0) + return kMouseButtonsLeft; + if (buttonBits == 1) + return kMouseButtonsRight; + if (buttonBits == 2) + return kMouseButtonsAny; + + return kMouseButtonsNone; +} + +uint8 Hotspots::Hotspot::getWindow() const { + return (flags & 0x0F00) >> 8; +} + +uint8 Hotspots::Hotspot::getCursor() const { + return (flags & 0xF000) >> 12; +} + +bool Hotspots::Hotspot::isIn(uint16 x, uint16 y) const { + if (x < left) + return false; + if (x > right) + return false; + if (y < top) + return false; + if (y > bottom) + return false; + + return true; +} + +bool Hotspots::Hotspot::buttonMatch(MouseButtons button) const { + MouseButtons myButton = getButton(); + + if (myButton == kMouseButtonsAny) + return true; + + if (myButton == kMouseButtonsNone) + return false; + + if (myButton == button) + return true; + + return false; +} + + +Hotspots::Hotspots(GobEngine *vm) : _vm(vm) { + _hotspots = new Hotspot[kHotspotCount]; + + _shouldPush = false; + + _currentKey = 0; + _currentIndex = 0; + _currentId = 0; +} + +Hotspots::~Hotspots() { + delete[] _hotspots; + + while (!_stack.empty()) { + StackEntry backup = _stack.pop(); + + delete[] backup.hotspots; + } +} + +void Hotspots::clear() { + _currentKey = 0; + + for (int i = 0; i < kHotspotCount; i++) + _hotspots[i].clear(); +} + +uint16 Hotspots::add(uint16 id, + uint16 left, uint16 top, uint16 right, uint16 bottom, + uint16 flags, uint16 key, + uint16 funcEnter, uint16 funcLeave, uint16 funcPos) { + + Hotspot hotspot(id, left, top, right, bottom, + flags, key, funcEnter, funcLeave, funcPos); + + return add(hotspot); +} + +uint16 Hotspots::add(const Hotspot &hotspot) { + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + // free space => add same id => update + if (! ((spot.left == 0xFFFF) || (spot.id == hotspot.id))) + continue; + + // When updating, keep bit 0x4000 intact + uint16 id = hotspot.id; + if ((spot.id & 0xBFFF) == (hotspot.id & 0xBFFF)) + id = spot.id; + + // Set + spot = hotspot; + spot.id = id; + + // Remember the current script + spot.script = _vm->_game->_script; + + return i; + } + + error("Hotspots::add(): Hotspot array full"); + return 0xFFFF; +} + +void Hotspots::remove(uint16 id) { + for (int i = 0; i < kHotspotCount; i++) { + if (_hotspots[i].id == id) + _hotspots[i].clear(); + } +} + +void Hotspots::removeState(uint16 state) { + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if ((spot.id & 0xF000) == state) + spot.clear(); + } +} + +void Hotspots::recalculate(bool force) { + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (spot.left == 0xFFFF) + // End reached + break; + + if (!force && ((spot.flags & 0x80) != 0)) + continue; + + if (spot.funcPos == 0) + continue; + + // Setting the needed script + Script *curScript = _vm->_game->_script; + + _vm->_game->_script = spot.script; + if (!_vm->_game->_script) + _vm->_game->_script = curScript; + + // Calling the function that contains the positions + _vm->_game->_script->call(spot.funcPos); + + // Calculate positions + int16 left = _vm->_game->_script->readValExpr(); + int16 top = _vm->_game->_script->readValExpr(); + int16 width = _vm->_game->_script->readValExpr(); + int16 height = _vm->_game->_script->readValExpr(); + + // Re-read the flags too, if applicable + uint16 flags = 0; + if ((spot.id & 0xF000) == 0xA000) + flags = _vm->_game->_script->readValExpr(); + + // Apply backDelta, if needed + if ((_vm->_draw->_renderFlags & RENDERFLAG_CAPTUREPOP) && (left != -1)) { + left += _vm->_draw->_backDeltaX; + top += _vm->_draw->_backDeltaY; + } + + // Clamping + if (left < 0) { + width += left; + left = 0; + } + if (top < 0) { + height += top; + top = 0; + } + + // Set the updated position + spot.left = left; + spot.top = top; + spot.right = left + width - 1; + spot.bottom = top + height - 1; + + if ((spot.id & 0xF000) == 0xA000) + spot.flags = flags; + + // Return + _vm->_game->_script->pop(); + + _vm->_game->_script = curScript; + } +} + +void Hotspots::push(uint8 all, bool force) { + // Should we push at all? + if (!_shouldPush && !force) + return; + + // Count the hotspots + uint32 size = 0; + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (spot.left == 0xFFFF) + // End reached + break; + + // Save all of them + if ( (all == 1) || + // Don't save the global ones + ((all == 0) && (spot.id >= 20)) || + // Only save the ones with the correct state + ((all == 2) && (((spot.id & 0xF000) == 0xD000) || + ((spot.id & 0xF000) == 0x4000) || + ((spot.id & 0xF000) == 0xE000)))) { + size++; + } + + } + + StackEntry backup; + + backup.shouldPush = _shouldPush; + backup.size = size; + backup.key = _currentKey; + backup.id = _currentId; + backup.index = _currentIndex; + + backup.hotspots = new Hotspot[size]; + + // Copy the hotspots + Hotspot *destPtr = backup.hotspots; + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (spot.left == 0xFFFF) + // End reached + break; + + // Save all of them + if ( (all == 1) || + // Don't save the global ones + ((all == 0) && (spot.id >= 20)) || + // Only save the ones with the correct state + ((all == 2) && (((spot.id & 0xF000) == 0xD000) || + ((spot.id & 0xF000) == 0x4000) || + ((spot.id & 0xF000) == 0xE000)))) { + + memcpy(destPtr, &spot, sizeof(Hotspot)); + destPtr++; + + spot.left = 0xFFFF; + } + + } + + // Reset current state + _shouldPush = false; + _currentKey = 0; + _currentId = 0; + _currentIndex = 0; + + _stack.push(backup); +} + +void Hotspots::pop() { + assert(!_stack.empty()); + + StackEntry backup = _stack.pop(); + + // Find the end of the filled hotspot space + int i; + Hotspot *destPtr = _hotspots; + for (i = 0; i < kHotspotCount; i++, destPtr++) + if (destPtr->left == 0xFFFF) + break; + + if (((uint32) (kHotspotCount - i)) < backup.size) + error("Hotspots::pop(): Not enough free space in the current Hotspot " + "array to pop %d elements (got %d)", backup.size, kHotspotCount - i); + + memcpy(destPtr, backup.hotspots, backup.size * sizeof(Hotspot)); + + _shouldPush = backup.shouldPush; + _currentKey = backup.key; + _currentId = backup.id; + _currentIndex = backup.index; + + delete[] backup.hotspots; +} + +bool Hotspots::isValid(uint16 key, uint16 id, uint16 index) const { + if (index >= kHotspotCount) + return false; + + if (key == 0) + return false; + + if (!(id & 0x8000)) + return false; + + return true; +} + +void Hotspots::call(uint16 offset) { + _vm->_game->_script->call(offset); + + _shouldPush = true; + + int16 stackSize = _stack.size(); + + _vm->_inter->funcBlock(0); + + while (stackSize != _stack.size()) + pop(); + + _shouldPush = false; + + _vm->_game->_script->pop(); + + recalculate(false); +} + +void Hotspots::enter(uint16 index) { + if (index >= kHotspotCount) { + warning("Hotspots::enter(): Index %d out of range", index); + return; + } + + Hotspot &spot = _hotspots[index]; + + if (((spot.id & 0xF000) == 0xA000) || ((spot.id & 0xF000) == 0x9000)) + WRITE_VAR(17, -(spot.id & 0x0FFF)); + + if (spot.funcEnter != 0) + call(spot.funcEnter); +} + +void Hotspots::leave(uint16 index) { + if (index >= kHotspotCount) { + warning("Hotspots::leave(): Index %d out of range", index); + return; + } + + Hotspot &spot = _hotspots[index]; + + if (((spot.id & 0xF000) == 0xA000) || ((spot.id & 0xF000) == 0x9000)) + WRITE_VAR(17, spot.id & 0x0FFF); + + if (spot.funcLeave != 0) + call(spot.funcLeave); +} + +uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const { + id = 0; + index = 0; + + if (type == kTypeMove) { + + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (spot.left == 0xFFFF) + break; + + if (spot.id & 0x4000) + continue; + + if (spot.getType() > kTypeMove) + continue; + + if (spot.getWindow() != 0) + continue; + + if (!spot.isIn(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY)) + continue; + + id = spot.id; + index = i; + + return spot.key; + } + + return 0; + + } else if (type == kTypeClick) { + + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (spot.left == 0xFFFF) + break; + + if (spot.id & 0x4000) + continue; + + if (spot.getWindow() != 0) + continue; + + if (spot.getType() < kTypeMove) + continue; + + if (!spot.isIn(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY)) + continue; + + if (!spot.buttonMatch(_vm->_game->_mouseButtons)) + continue; + + id = spot.id; + index = i; + + if ((spot.getType() == kTypeMove) || (spot.getType() == kTypeClick)) + return spot.key; + + return 0; + } + + if (_vm->_game->_mouseButtons != kMouseButtonsLeft) + return kKeyEscape; + + return 0; + + } + + return 0; +} + +void Hotspots::checkHotspotChanged() { + uint16 key, id, index; + + key = checkMouse(kTypeMove, id, index); + + if (key == _currentKey) + return; + + if (isValid(_currentKey, _currentId, _currentIndex)) + leave(_currentIndex); + + _currentKey = key; + _currentId = id; + _currentIndex = index; + + if (isValid(key, id, index)) + enter(index); +} + +uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index) { + _vm->_game->_scrollHandleMouse = handleMouse != 0; + + if (delay >= -1) { + _currentKey = 0; + _currentId = 0; + _currentIndex = 0; + } + + id = 0; + index = 0; + + if (handleMouse) { + if ((_vm->_draw->_cursorIndex == -1) && (_currentKey == 0)) { + _currentKey = checkMouse(kTypeMove, _currentId, _currentIndex); + + if (isValid(_currentKey, _currentId, _currentIndex)) + enter(_currentIndex); + } + + _vm->_draw->animateCursor(-1); + } + + uint32 startTime = _vm->_util->getTimeKey(); + + _vm->_draw->blitInvalidated(); + _vm->_video->retrace(); + + uint16 key = 0; + while (key == 0) { + + if (_vm->_inter->_terminate || _vm->shouldQuit()) { + if (handleMouse) + _vm->_draw->blitCursor(); + return 0; + } + + checkHotspotChanged(); + + if (!_vm->_draw->_noInvalidated) { + if (handleMouse) + _vm->_draw->animateCursor(-1); + else + _vm->_draw->blitInvalidated(); + _vm->_video->waitRetrace(); + } + + key = _vm->_game->checkKeys(&_vm->_global->_inter_mouseX, + &_vm->_global->_inter_mouseY, &_vm->_game->_mouseButtons, handleMouse); + + if (!handleMouse && (_vm->_game->_mouseButtons != kMouseButtonsNone)) { + _vm->_util->waitMouseRelease(0); + key = 3; + } + + if (key != 0) { + if (handleMouse & 1) + _vm->_draw->blitCursor(); + + id = 0; + index = 0; + + if (isValid(_currentKey, _currentId, _currentIndex)) + leave(_currentIndex); + + _currentKey = 0; + break; + } + + if (handleMouse) { + + if (_vm->_game->_mouseButtons != kMouseButtonsNone) { + + if (delay > 0) { + _vm->_draw->animateCursor(2); + _vm->_util->delay(delay); + } else if (handleMouse & 1) + _vm->_util->waitMouseRelease(1); + + _vm->_draw->animateCursor(-1); + + key = checkMouse(kTypeClick, id, index); + + if ((key != 0) || (id != 0)) { + if ( (handleMouse & 1) && + ((delay <= 0) || (_vm->_game->_mouseButtons == kMouseButtonsNone))) + _vm->_draw->blitCursor(); + + if (key != _currentKey) + leave(_currentIndex); + + _currentKey = 0; + break; + } + + if (handleMouse & 4) + return 0; + + if (_currentKey != 0) + leave(_currentIndex); + + _currentKey = checkMouse(kTypeMove, _currentId, _currentIndex); + if (isValid(_currentKey, _currentId, _currentIndex)) + enter(_currentIndex); + + } else + checkHotspotChanged(); + + } + + if ((delay == -2) && (key == 0) && + (_vm->_game->_mouseButtons == kMouseButtonsNone)) { + + id = 0; + index = 0; + break; + } + + if (handleMouse) + _vm->_draw->animateCursor(-1); + + if ((delay < 0) && (key == 0) && + (_vm->_game->_mouseButtons == kMouseButtonsNone)) { + + uint32 curTime = _vm->_util->getTimeKey(); + // Timeout reached? + if ((curTime + delay) > startTime) { + id = 0; + index = 0; + break; + } + + } + + _vm->_util->delay(10); + + } + + return key; +} + +uint16 Hotspots::check(uint8 handleMouse, int16 delay) { + uint16 id, index; + + return Hotspots::check(handleMouse, delay, id, index); +} + +uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 height, + uint16 backColor, uint16 frontColor, char *str, uint16 fontIndex, + Type type, int16 &duration, uint16 &id, uint16 index) { + + if ((fontIndex >= 8) || !_vm->_draw->_fonts[fontIndex]) + return 0; + + bool handleMouse = false; + if ( (_vm->_game->_handleMouse != 0) && + ((_vm->_global->_useMouse != 0) || (_vm->_game->_forceHandleMouse != 0))) + handleMouse = true; + + Video::FontDesc &font = *_vm->_draw->_fonts[fontIndex]; + + bool monoSpaced = (font.extraData == 0); + + uint32 pos = strlen(str); + uint32 editSize = monoSpaced ? 0 : (width / font.itemWidth); + + uint16 key = 0; + char tempStr[256]; + + while (1) { + strncpy0(tempStr, str, 254); + strcat(tempStr, " "); + if ((editSize != 0) && strlen(tempStr) > editSize) + strncpy0(tempStr, str, 255); + + _vm->_draw->_destSpriteX = xPos; + _vm->_draw->_destSpriteY = yPos; + _vm->_draw->_spriteRight = monoSpaced ? (editSize * font.itemWidth) : width; + _vm->_draw->_spriteBottom = height; + + _vm->_draw->_destSurface = 21; + _vm->_draw->_backColor = backColor; + _vm->_draw->_frontColor = frontColor; + _vm->_draw->_textToPrint = tempStr; + _vm->_draw->_transparency = 1; + _vm->_draw->_fontIndex = fontIndex; + _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10 ); + + _vm->_draw->_destSpriteY = yPos + (height - font.itemHeight) / 2; + _vm->_draw->spriteOperation(DRAW_PRINTTEXT | 0x10); + + if ((editSize != 0) && (pos == editSize)) + pos--; + + char curSym = tempStr[pos]; + + if (_vm->_inter->_variables) + WRITE_VAR(56, pos); + + bool first = true; + while (1) { + tempStr[0] = curSym; + tempStr[1] = 0; + + if (font.extraData) { + _vm->_draw->_destSpriteY = yPos; + _vm->_draw->_spriteBottom = height; + _vm->_draw->_spriteRight = 1; + + _vm->_draw->_destSpriteX = xPos; + for (uint32 j = 0; j < pos; j++) + _vm->_draw->_destSpriteX += font.extraData[str[j] - font.startItem]; + + } else { + _vm->_draw->_destSpriteX = xPos + font.itemWidth * pos; + _vm->_draw->_destSpriteY = yPos + height - 1; + _vm->_draw->_spriteRight = font.itemWidth; + _vm->_draw->_spriteBottom = 1; + } + + _vm->_draw->_destSurface = 21; + _vm->_draw->_backColor = frontColor; + _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10); + + if (first) { + key = check(handleMouse, -1, id, index); + + if (key == 0) + key = check(handleMouse, -300, id, index); + + first = false; + } else + key = check(handleMouse, -300, id, index); + + tempStr[0] = curSym; + tempStr[1] = 0; + + if (font.extraData) { + _vm->_draw->_destSpriteY = yPos; + _vm->_draw->_spriteBottom = height; + _vm->_draw->_spriteRight = 1; + + _vm->_draw->_destSpriteX = xPos; + for (uint32 j = 0; j < pos; j++) + _vm->_draw->_destSpriteX += font.extraData[str[j] - font.startItem]; + + } else { + _vm->_draw->_destSpriteX = xPos + font.itemWidth * pos; + _vm->_draw->_destSpriteY = yPos + height - 1; + _vm->_draw->_spriteRight = font.itemWidth; + _vm->_draw->_spriteBottom = 1; + } + + _vm->_draw->_destSurface = 21; + _vm->_draw->_backColor = backColor; + _vm->_draw->_frontColor = frontColor; + _vm->_draw->_textToPrint = tempStr; + _vm->_draw->_transparency = 1; + _vm->_draw->_fontIndex = fontIndex; + _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10); + + _vm->_draw->_destSpriteY = yPos + (height - font.itemHeight) / 2; + _vm->_draw->spriteOperation(DRAW_PRINTTEXT | 0x10); + + if ((key != 0) || (id != 0)) + break; + + key = check(handleMouse, -300, id, index); + + if ((key != 0) || (id != 0) || + _vm->_inter->_terminate || _vm->shouldQuit()) + break; + + if (duration > 0) { + duration -= 600; + if (duration <= 1) { + key = 0; + id = 0; + break; + } + } + } + + if ((key == 0) || (id != 0) || + _vm->_inter->_terminate || _vm->shouldQuit()) + return 0; + + switch (key) { + case kKeyRight: + if ((pos > strlen(str)) || (pos > (editSize - 1)) || (editSize == 0)) { + pos++; + continue; + } + return kKeyDown; + + case kKeyLeft: + if (pos > 0) { + pos--; + continue; + } + return kKeyUp; + + case kKeyBackspace: + if (pos > 0) { + _vm->_util->cutFromStr(str, pos - 1, 1); + pos--; + continue; + } else { + if (pos < strlen(str)) + _vm->_util->cutFromStr(str, pos, 1); + } + + case kKeyDelete: + if (pos >= strlen(str)) + continue; + + _vm->_util->cutFromStr(str, pos, 1); + continue; + + case kKeyReturn: + case kKeyF1: + case kKeyF2: + case kKeyF3: + case kKeyF4: + case kKeyF5: + case kKeyF6: + case kKeyF7: + case kKeyF8: + case kKeyF9: + case kKeyF10: + case kKeyUp: + case kKeyDown: + return key; + + case kKeyEscape: + if (_vm->_global->_useMouse != 0) + continue; + + _vm->_game->_forceHandleMouse = !_vm->_game->_forceHandleMouse; + + handleMouse = false; + if ( (_vm->_game->_handleMouse != 0) && + ((_vm->_global->_useMouse != 0) || (_vm->_game->_forceHandleMouse != 0))) + handleMouse = true; + + while (_vm->_global->_pressedKeys[1] != 0) + ; + continue; + + default: + uint16 savedKey = key; + + key &= 0xFF; + + if (((type == kTypeInputFloatNoLeave) || (type == kTypeInputFloatLeave)) && + (key >= ' ') && (key <= 0xFF)) { + const char *str1 = "0123456789-.,+ "; + const char *str2 = "0123456789-,,+ "; + + if ((((savedKey >> 8) > 1) && ((savedKey >> 8) < 12)) && + ((_vm->_global->_pressedKeys[42] != 0) || + (_vm->_global->_pressedKeys[56] != 0))) + key = ((savedKey >> 8) - 1) % 10 + '0'; + + int i; + for (i = 0; str1[i] != 0; i++) { + if (key == str1[i]) { + key = str2[i]; + break; + } + } + + if (i == (int16) strlen(str1)) + key = 0; + } + + if ((key >= ' ') && (key <= 0xFF)) { + if (editSize == 0) { + int length = _vm->_draw->stringLength(str, fontIndex) + + font.extraData[' ' - font.startItem] + + font.extraData[key - font.startItem]; + + if (length > width) + continue; + + if (((int32) strlen(str)) >= (_vm->_global->_inter_animDataSize * 4 - 1)) + continue; + + } else { + if (strlen(str) > editSize) + continue; + else if (editSize == strlen(str)) + _vm->_util->cutFromStr(str, strlen(str) - 1, 1); + } + + pos++; + tempStr[0] = key; + tempStr[1] = 0; + + _vm->_util->insertStr(tempStr, str, pos - 1); + } + + } + } +} + +uint16 Hotspots::handleInput(int16 time, uint16 maxPos, uint16 &curPos, + InputDesc *inpDesc, uint16 &id, uint16 &index) { + + uint16 descInd = 0; + uint16 key = 0; + uint16 found = 0xFFFF; + + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (spot.left == 0xFFFF) + continue; + + if ((spot.id & 0xC000) != 0x8000) + continue; + + if (spot.getType() < kTypeInput1NoLeave) + continue; + + if (spot.getType() > kTypeInputFloatLeave) + continue; + + char tempStr[256]; + strncpy0(tempStr, GET_VARO_STR(spot.key), 255); + + _vm->_draw->_destSpriteX = spot.left; + _vm->_draw->_destSpriteY = spot.top; + _vm->_draw->_spriteRight = spot.right - spot.left + 1; + _vm->_draw->_spriteBottom = spot.bottom - spot.top + 1; + + _vm->_draw->_destSurface = 21; + + _vm->_draw->_backColor = inpDesc[descInd].backColor; + _vm->_draw->_frontColor = inpDesc[descInd].frontColor; + _vm->_draw->_textToPrint = tempStr; + _vm->_draw->_transparency = 1; + _vm->_draw->_fontIndex = inpDesc[descInd].fontIndex; + + _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10); + + _vm->_draw->_destSpriteY += ((spot.bottom - spot.top + 1) - + _vm->_draw->_fonts[_vm->_draw->_fontIndex]->itemHeight) / 2; + _vm->_draw->spriteOperation(DRAW_PRINTTEXT | 0x10); + + descInd++; + } + + for (int i = 0; i < 40; i++) + WRITE_VAR_OFFSET(i * 4 + 0x44, 0); + + while (1) { + descInd = 0; + + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (spot.left == 0xFFFF) + continue; + + if ((spot.id & 0xC000) != 0x8000) + continue; + + if (spot.getType() < kTypeInput1NoLeave) + continue; + + if (spot.getType() > kTypeInputFloatLeave) + continue; + + if (descInd == curPos) { + found = i; + break; + } + + descInd++; + } + + assert(found != 0xFFFF); + + Hotspot inputSpot = _hotspots[found]; + + key = readString(inputSpot.left, inputSpot.top, + inputSpot.right - inputSpot.left + 1, + inputSpot.bottom - inputSpot.top + 1, + inpDesc[curPos].backColor, inpDesc[curPos].frontColor, + GET_VARO_STR(inputSpot.key), inpDesc[curPos].fontIndex, + inputSpot.getType(), time, id, index); + + if (_vm->_inter->_terminate) + return 0; + + switch (key) { + case kKeyNone: + if (id == 0) + return 0; + + if (_vm->_game->_mouseButtons != kMouseButtonsNone) { + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (spot.left == 0xFFFF) + break; + + if (spot.getWindow() != 0) + continue; + + if ((spot.id & 0x4000)) + continue; + + if (!spot.isIn(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY)) + continue; + + if ((spot.id & 0xF000)) + continue; + + if (spot.getType() < kTypeInput1NoLeave) + continue; + + if (spot.getType() > kTypeInputFloatLeave) + continue; + + index = i; + break; + } + } + + if (_hotspots[index].getType() < kTypeInput1NoLeave) + return 0; + + if (_hotspots[index].getType() > kTypeInputFloatLeave) + return 0; + + curPos = 0; + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (spot.left == 0xFFFF) + continue; + + if ((spot.id & 0xC000) != 0x8000) + continue; + + if (spot.getType() < kTypeInput1NoLeave) + continue; + + if (spot.getType() > kTypeInputFloatLeave) + continue; + + if (i == index) + break; + + curPos++; + } + break; + + case kKeyF1: + case kKeyF2: + case kKeyF3: + case kKeyF4: + case kKeyF5: + case kKeyF6: + case kKeyF7: + case kKeyF8: + case kKeyF9: + case kKeyF10: + return key; + + case kKeyReturn: + + if (maxPos == 1) + return key; + + if (curPos == (maxPos - 1)) { + curPos = 0; + break; + } + + curPos++; + break; + + case kKeyDown: + if ((maxPos - 1) > curPos) + curPos++; + break; + + case kKeyUp: + if (curPos > 0) + curPos--; + break; + } + } +} + +void Hotspots::evaluate() { + InputDesc descArray[20]; + int16 array[300]; + char *str; + int16 counter; + int16 var_24; + int16 var_26; + int16 collStackPos; + + push(0); + + uint16 endIndex = 0; + while (_hotspots[endIndex].left != 0xFFFF) + endIndex++; + + _shouldPush = false; + + _vm->_game->_script->skip(1); + + byte count = _vm->_game->_script->readByte(); + + _vm->_game->_handleMouse = _vm->_game->_script->peekByte(0); + int16 duration = _vm->_game->_script->peekByte(1); + byte stackPos2 = _vm->_game->_script->peekByte(3); + byte descIndex = _vm->_game->_script->peekByte(4); + bool needRecalculation = _vm->_game->_script->peekByte(5) != 0; + + duration *= 1000; + if ((stackPos2 != 0) || (descIndex != 0)) { + duration /= 100; + if (_vm->_game->_script->peekByte(1) == 100) + duration = 2; + } + + int16 timeVal = duration; + + _vm->_game->_script->skip(6); + + WRITE_VAR(16, 0); + + byte var_41 = 0; + int16 var_46 = 0; + + uint16 id = 0; + uint16 validId = 0xFFFF; + uint16 index = 0; + + bool hasInput = false; + uint16 inputIndex = 0; + + for (uint16 i = 0; i < count; i++) { + array[i] = 0; + + byte type = _vm->_game->_script->readByte(); + byte window = 0; + + if ((type & 0x40) != 0) { + type -= 0x40; + window = _vm->_game->_script->readByte(); + } + + uint16 left, top, width, height, right, bottom; + uint32 funcEnter = 0, funcLeave = 0, funcPos = 0; + if ((type & 0x80) != 0) { + funcPos = _vm->_game->_script->pos(); + left = _vm->_game->_script->readValExpr(); + top = _vm->_game->_script->readValExpr(); + width = _vm->_game->_script->readValExpr(); + height = _vm->_game->_script->readValExpr(); + } else { + funcPos = 0; + left = _vm->_game->_script->readUint16(); + top = _vm->_game->_script->readUint16(); + width = _vm->_game->_script->readUint16(); + height = _vm->_game->_script->readUint16(); + } + + if ((_vm->_draw->_renderFlags & RENDERFLAG_CAPTUREPOP) && (left != 0xFFFF)) { + left += _vm->_draw->_backDeltaX; + top += _vm->_draw->_backDeltaY; + } + + right = left + width - 1; + bottom = top + height - 1; + + int16 key = 0; + int16 flags = 0; + Video::FontDesc *font = 0; + + type &= 0x7F; + switch (type) { + case kTypeNone: + _vm->_game->_script->skip(6); + + funcEnter = _vm->_game->_script->pos(); + _vm->_game->_script->skipBlock(); + + funcLeave = _vm->_game->_script->pos(); + _vm->_game->_script->skipBlock(); + + key = i + 0xA000; + flags = type + (window << 8); + + add(i + 0x8000, left, top, right, bottom, + flags, key, funcEnter, funcLeave, funcPos); + break; + + case kTypeMove: + key = _vm->_game->_script->readInt16(); + array[i] = _vm->_game->_script->readInt16(); + flags = _vm->_game->_script->readInt16(); + + funcEnter = _vm->_game->_script->pos(); + _vm->_game->_script->skipBlock(); + + funcLeave = _vm->_game->_script->pos(); + _vm->_game->_script->skipBlock(); + + if (key == 0) + key = i + 0xA000; + flags = type + (window << 8) + (flags << 4); + + add(i + 0x8000, left, top, right, bottom, + flags, key, funcEnter, funcLeave, funcPos); + break; + + case kTypeInput1NoLeave: + case kTypeInput1Leave: + case kTypeInput2NoLeave: + case kTypeInput2Leave: + case kTypeInput3NoLeave: + case kTypeInput3Leave: + case kTypeInputFloatNoLeave: + case kTypeInputFloatLeave: + hasInput = true; + + _vm->_util->clearKeyBuf(); + + key = _vm->_game->_script->readVarIndex(); + descArray[inputIndex].fontIndex = _vm->_game->_script->readInt16(); + descArray[inputIndex].backColor = _vm->_game->_script->readByte(); + descArray[inputIndex].frontColor = _vm->_game->_script->readByte(); + descArray[inputIndex].ptr = 0; + + if ((type >= kTypeInput2NoLeave) && (type <= kTypeInput3Leave)) { + descArray[inputIndex].ptr = _vm->_game->_script->getData() + _vm->_game->_script->pos() + 2; + _vm->_game->_script->skip(_vm->_game->_script->peekUint16() + 2); + } + + if (left == 0xFFFF) { + if ((type & 1) == 0) + _vm->_game->_script->skipBlock(); + break; + } + + font = _vm->_draw->_fonts[descArray[inputIndex].fontIndex]; + if (!font->extraData) + right = left + width * font->itemWidth - 1; + + funcEnter = 0; + funcPos = 0; + funcLeave = 0; + if (!(type & 1)) { + funcLeave = _vm->_game->_script->pos(); + _vm->_game->_script->skipBlock(); + } + + flags = type; + + inputIndex++; + + add(i + 0x8000, left, top, right, bottom, + flags, key, funcEnter, funcLeave, funcPos); + + break; + + case 11: + _vm->_game->_script->skip(6); + + for (int j = 0; j < kHotspotCount; j++) { + Hotspot &spot = _hotspots[j]; + + if ((spot.id & 0xF000) == 0xE000) { + spot.id &= 0xBFFF; + spot.funcEnter = _vm->_game->_script->pos(); + spot.funcLeave = _vm->_game->_script->pos(); + } + } + + _vm->_game->_script->skipBlock(); + break; + + case 12: + _vm->_game->_script->skip(6); + + for (int j = 0; j < kHotspotCount; j++) { + Hotspot &spot = _hotspots[j]; + + if ((spot.id & 0xF000) == 0xD000) { + spot.id &= 0xBFFF; + spot.funcEnter = _vm->_game->_script->pos(); + spot.funcLeave = _vm->_game->_script->pos(); + } + } + + _vm->_game->_script->skipBlock(); + break; + + case 20: + validId = i; + // Fall through to case 2 + case kTypeClick: + key = _vm->_game->_script->readInt16(); + array[i] = _vm->_game->_script->readInt16(); + flags = _vm->_game->_script->readInt16(); + + funcEnter = 0; + + funcLeave = _vm->_game->_script->pos(); + _vm->_game->_script->skipBlock(); + + flags = 2 + (window << 8) + (flags << 4); + + add(i + 0x8000, left, top, right, bottom, + flags, key, funcEnter, funcLeave, funcPos); + break; + + case 21: + key = _vm->_game->_script->readInt16(); + array[i] = _vm->_game->_script->readInt16(); + flags = _vm->_game->_script->readInt16() & 3; + + funcEnter = _vm->_game->_script->pos(); + _vm->_game->_script->skipBlock(); + + funcLeave = 0; + + flags = 2 + (window << 8) + (flags << 4); + + add(i + 0x8000, left, top, right, bottom, + flags, key, funcEnter, funcLeave, funcPos); + break; + } + } + + if (needRecalculation) + recalculate(true); + + _vm->_game->_forceHandleMouse = 0; + _vm->_util->clearKeyBuf(); + + do { + uint16 key = 0; + if (hasInput) { + uint16 curEditIndex = 0; + + key = handleInput(duration, inputIndex, curEditIndex, descArray, id, index); + + WRITE_VAR(55, curEditIndex); + if (key == kKeyReturn) { + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (spot.left == 0xFFFF) + break; + + if ((spot.id & 0xC000) != 0x8000) + continue; + + if ((spot.getType() & 1) != 0) + continue; + + if (spot.getType() <= kTypeClick) + continue; + + id = spot.id; + validId = spot.id & 0x7FFF; + index = i; + break; + } + break; + } + } else + key = check(_vm->_game->_handleMouse, -duration, id, index); + + if (((key & 0xFF) >= ' ') && ((key & 0xFF) <= 0xFF) && + ((key >> 8) > 1) && ((key >> 8) < 12)) + key = '0' + (((key >> 8) - 1) % 10) + (key & 0xFF00); + + if (id == 0) { + if (key != 0) { + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (spot.left == 0xFFFF) + break; + + if ((spot.id & 0xC000) != 0x8000) + continue; + + if ((spot.key == key) || (spot.key == 0x7FFF)) { + id = spot.id; + index = i; + break; + } + } + + if (id == 0) { + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (spot.left == 0xFFFF) + break; + + if ((spot.id & 0xC000) != 0x8000) + continue; + + if ((spot.key & 0xFF00) != 0) + continue; + + if (spot.key == 0) + continue; + + if (toupper(key & 0xFF) == toupper(spot.key)) { + id = spot.id; + index = i; + break; + } + } + } + } else if (duration != 0) { + if (stackPos2 != 0) { + collStackPos = 0; + + for (int i = endIndex; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (spot.left == 0xFFFF) + break; + + if ((spot.id & 0xF000) != 0x8000) + continue; + + collStackPos++; + if (collStackPos != stackPos2) + continue; + + id = spot.id; + index = i; + _vm->_inter->storeMouse(); + if (VAR(16) != 0) + break; + + if ((id & 0xF000) == 0x8000) + WRITE_VAR(16, array[id & 0xFFF]); + else + WRITE_VAR(16, id & 0xFFF); + + if (spot.funcLeave != 0) { + uint32 timeKey = _vm->_util->getTimeKey(); + call(spot.funcLeave); + + if (timeVal != 2) { + duration = timeVal - (_vm->_util->getTimeKey() - timeKey); + + if ((duration - var_46) < 3) { + var_46 -= (duration - 3); + duration = 3; + } else if (var_46 != 0) { + duration -= var_46; + var_46 = 0; + } + + if (duration > timeVal) + duration = timeVal; + + } else + duration = 2; + + } + + if (VAR(16) == 0) + id = 0; + else + var_41 = 1; + + break; + } + + } else { + if (descIndex != 0) { + + counter = 0; + for (int i = endIndex; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (spot.left == 0xFFFF) + break; + + if ((spot.id & 0xF000) == 0x8000) { + if (++counter == descIndex) { + id = spot.id; + index = i; + break; + } + } + + } + + } else { + + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (spot.left == 0xFFFF) + break; + + if ((spot.id & 0xF000) == 0x8000) { + id = spot.id; + index = i; + break; + } + } + + if ((_currentKey != 0) && (_hotspots[_currentIndex].funcLeave != 0)) + call(_hotspots[_currentIndex].funcLeave); + + _currentKey = 0; + } + + } + } + } + + if (var_41 != 0) + break; + + if ((id == 0) || (_hotspots[index].funcLeave != 0)) + continue; + + _vm->_inter->storeMouse(); + + if ((id & 0xF000) == 0x8000) + WRITE_VAR(16, array[id & 0xFFF]); + else + WRITE_VAR(16, id & 0xFFF); + + if (_hotspots[index].funcEnter != 0) + call(_hotspots[index].funcEnter); + + WRITE_VAR(16, 0); + id = 0; + } + while ((id == 0) && !_vm->_inter->_terminate && !_vm->shouldQuit()); + + char tempStr[256]; + if ((id & 0xFFF) == validId) { + collStackPos = 0; + var_24 = 0; + var_26 = 1; + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (spot.left == 0xFFFF) + continue; + + if ((spot.id & 0xC000) != 0x8000) + continue; + + if (spot.getType() < kTypeInput1NoLeave) + continue; + + if (spot.getType() > kTypeInputFloatLeave) + continue; + + if (spot.getType() > kTypeInput3Leave) { + char *ptr; + strncpy0(tempStr, GET_VARO_STR(spot.key), 255); + while ((ptr = strchr(tempStr, ' '))) + _vm->_util->cutFromStr(tempStr, (ptr - tempStr), 1); + if (_vm->_global->_language == kLanguageBritish) + while ((ptr = strchr(tempStr, '.'))) + *ptr = ','; + WRITE_VARO_STR(spot.key, tempStr); + } + + if ((spot.getType() >= kTypeInput2NoLeave) && (spot.getType() <= kTypeInput3Leave)) { + str = (char *) descArray[var_24].ptr; + + strncpy0(tempStr, GET_VARO_STR(spot.key), 255); + + if (spot.getType() < kTypeInput3NoLeave) + _vm->_util->cleanupStr(tempStr); + + int16 pos = 0; + do { + char spotStr[256]; + + strncpy0(spotStr, str, 255); + pos += strlen(str) + 1; + + str += strlen(str) + 1; + + if (spot.getType() < kTypeInput3NoLeave) + _vm->_util->cleanupStr(spotStr); + + if (strcmp(tempStr, spotStr) == 0) { + WRITE_VAR(17, VAR(17) + 1); + WRITE_VAR(17 + var_26, 1); + break; + } + } while (READ_LE_UINT16(descArray[var_24].ptr - 2) > pos); + collStackPos++; + } else { + WRITE_VAR(17 + var_26, 2); + } + var_24++; + var_26++; + } + + if (collStackPos != (int16) VAR(17)) + WRITE_VAR(17, 0); + else + WRITE_VAR(17, 1); + } + + if (_vm->_game->_handleMouse == 1) + _vm->_draw->blitCursor(); + + if (!_vm->_inter->_terminate && (var_41 == 0)) { + _vm->_game->_script->seek(_hotspots[index].funcLeave); + + _vm->_inter->storeMouse(); + if (VAR(16) == 0) { + if ((id & 0xF000) == 0x8000) + WRITE_VAR(16, array[id & 0xFFF]); + else + WRITE_VAR(16, id & 0xFFF); + } + } else + _vm->_game->_script->setFinished(true); + + for (int i = 0; i < count; i++) + remove(i + 0x8000); + + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (((spot.id & 0xF000) == 0xA000) || ((spot.id & 0xF000) == 0x9000)) + spot.id |= 0x4000; + } + +} + +int16 Hotspots::findCursor(uint16 x, uint16 y) const { + int16 cursor = 0; + + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (spot.left == 0xFFFF) + break; + + if ((spot.getWindow() != 0) || (spot.id & 0x4000)) + continue; + + if (!spot.isIn(x, y)) + continue; + + if (spot.getCursor() == 0) { + if (spot.getType() >= kTypeInput1NoLeave) { + cursor = 3; + break; + } else if ((spot.getButton() != kMouseButtonsRight) && (cursor == 0)) + cursor = 1; + } else if (cursor == 0) + cursor = spot.getCursor(); + } + + return cursor; +} + +} // End of namespace Gob diff --git a/engines/gob/hotspots.h b/engines/gob/hotspots.h new file mode 100644 index 0000000000..0bafb94937 --- /dev/null +++ b/engines/gob/hotspots.h @@ -0,0 +1,177 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#ifndef GOB_HOTSPOTS_H +#define GOB_HOTSPOTS_H + +#include "common/stack.h" + +#include "gob/util.h" + +namespace Gob { + +class Script; + +class Hotspots { +public: + static const int kHotspotCount = 250; + + enum Type { + kTypeNone = 0, + kTypeMove = 1, + kTypeClick = 2, + kTypeInput1NoLeave = 3, + kTypeInput1Leave = 4, + kTypeInput2NoLeave = 5, + kTypeInput2Leave = 6, + kTypeInput3NoLeave = 7, + kTypeInput3Leave = 8, + kTypeInputFloatNoLeave = 9, + kTypeInputFloatLeave = 10 + }; + + Hotspots(GobEngine *vm); + ~Hotspots(); + + void clear(); + + /** Add a hotspot, returning the new index. */ + uint16 add(uint16 id, + uint16 left, uint16 top, uint16 right, uint16 bottom, + uint16 flags, uint16 key, + uint16 funcEnter, uint16 funcLeave, uint16 funcPos); + + void remove(uint16 id); + void removeState(uint16 state); + + /** Push the current hotspots onto the stack. + * + * @param all 0: Don't push global ones; 1: Push all; 2: Push only the ones with the correct state + * @param force Force a push although _shouldPush is false + */ + void push(uint8 all, bool force = false); + /** Pop hotspots from the stack. */ + void pop(); + + uint16 check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index); + uint16 check(uint8 handleMouse, int16 delay); + + void evaluate(); + + int16 findCursor(uint16 x, uint16 y) const; + +private: + struct Hotspot { + uint16 id; + uint16 left; + uint16 top; + uint16 right; + uint16 bottom; + uint16 flags; + uint16 key; + uint16 funcEnter; + uint16 funcLeave; + uint16 funcPos; + Script *script; + + Hotspot(); + Hotspot(uint16 i, + uint16 l, uint16 t, uint16 r, uint16 b, uint16 f, uint16 k, + uint16 enter, uint16 leave, uint16 pos); + + void clear(); + + Type getType() const; + MouseButtons getButton() const; + uint8 getWindow() const; + uint8 getCursor() const; + + /** Are the specified coordinates in the hotspot? */ + bool isIn(uint16 x, uint16 y) const; + /** Does the specified button trigger the hotspot? */ + bool buttonMatch(MouseButtons button) const; + }; + + struct StackEntry { + bool shouldPush; + Hotspot *hotspots; + uint32 size; + uint32 key; + uint32 id; + uint32 index; + }; + + struct InputDesc { + uint16 fontIndex; + uint16 backColor; + uint16 frontColor; + byte *ptr; + }; + + GobEngine *_vm; + + Hotspot *_hotspots; + Common::Stack _stack; + + bool _shouldPush; + + uint16 _currentKey; + uint16 _currentIndex; + uint16 _currentId; + + /** Add a hotspot, returning the new index. */ + uint16 add(const Hotspot &hotspot); + + /** Recalculate all hotspot parameters + * + * @param force Force recalculation of all hotspots, including global ones. + */ + void recalculate(bool force); + + bool isValid(uint16 key, uint16 id, uint16 index) const; + + /** Call a hotspot subroutine. */ + void call(uint16 offset); + /** Handling hotspot enter events. */ + void enter(uint16 index); + /** Handling hotspot leave events. */ + void leave(uint16 index); + + /** Which hotspot is the mouse cursor currently at? */ + uint16 checkMouse(Type type, uint16 &id, uint16 &index) const; + +void checkHotspotChanged(); + + uint16 readString(uint16 xPos, uint16 yPos, uint16 width, uint16 height, + uint16 backColor, uint16 frontColor, char *str, uint16 fontIndex, + Type type, int16 &duration, uint16 &id, uint16 index); + + uint16 handleInput(int16 time, uint16 hotspotIndex, uint16 &curPos, + InputDesc *inpDesc, uint16 &id, uint16 &index); +}; + +} // End of namespace Gob + +#endif // GOB_HOTSPOTS_H diff --git a/engines/gob/inter.cpp b/engines/gob/inter.cpp index 5ec0647d29..afd215a00d 100644 --- a/engines/gob/inter.cpp +++ b/engines/gob/inter.cpp @@ -35,6 +35,7 @@ #include "gob/game.h" #include "gob/expression.h" #include "gob/script.h" +#include "gob/hotspots.h" #include "gob/scenery.h" #include "gob/sound/sound.h" @@ -334,7 +335,7 @@ void Inter::callSub(int16 retFlag) { if (block == 1) funcBlock(retFlag); else if (block == 2) - _vm->_game->collisionsBlock(); + _vm->_game->_hotspots->evaluate(); else error("Unknown block type %d in Inter::callSub()", block); } diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp index 23c9351dd4..7d32104552 100644 --- a/engines/gob/inter_v1.cpp +++ b/engines/gob/inter_v1.cpp @@ -37,6 +37,7 @@ #include "gob/expression.h" #include "gob/script.h" #include "gob/resources.h" +#include "gob/hotspots.h" #include "gob/goblin.h" #include "gob/inter.h" #include "gob/map.h" @@ -1173,7 +1174,7 @@ bool Inter_v1::o1_keyFunc(OpFuncParams ¶ms) { case 0: _vm->_draw->_showCursor &= ~2; _vm->_util->longDelay(1); - key = _vm->_game->checkCollisions(0, 0, 0, 0); + key = _vm->_game->_hotspots->check(0, 0); storeKey(key); _vm->_util->clearKeyBuf(); diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index 82822330b1..d71a321db7 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -39,6 +39,7 @@ #include "gob/expression.h" #include "gob/script.h" #include "gob/resources.h" +#include "gob/hotspots.h" #include "gob/goblin.h" #include "gob/map.h" #include "gob/mult.h" @@ -1177,66 +1178,48 @@ bool Inter_v2::o2_animPalInit(OpFuncParams ¶ms) { } bool Inter_v2::o2_addCollision(OpFuncParams ¶ms) { - int16 id; - int16 left, top, width, height; - int16 flags; - int16 key; - int16 funcSub; - - id = _vm->_game->_script->readValExpr(); - funcSub = _vm->_game->_script->pos(); - left = _vm->_game->_script->readValExpr(); - top = _vm->_game->_script->readValExpr(); - width = _vm->_game->_script->readValExpr(); - height = _vm->_game->_script->readValExpr(); - flags = _vm->_game->_script->readValExpr(); - key = _vm->_game->_script->readInt16(); + int16 id = _vm->_game->_script->readValExpr(); + uint16 funcPos = _vm->_game->_script->pos(); + int16 left = _vm->_game->_script->readValExpr(); + int16 top = _vm->_game->_script->readValExpr(); + uint16 width = _vm->_game->_script->readValExpr(); + uint16 height = _vm->_game->_script->readValExpr(); + uint16 flags = _vm->_game->_script->readValExpr(); + uint16 key = _vm->_game->_script->readInt16(); if (key == 0) key = ABS(id) + 41960; - _vm->_draw->adjustCoords(0, &left, &top); - _vm->_draw->adjustCoords(2, &width, &height); - if (left < 0) { width += left; - left = 0; + left = 0; } if (top < 0) { height += top; - top = 0; + top = 0; } int16 index; if (id < 0) - index = _vm->_game->addNewCollision(0xD000 - id, left & 0xFFFC, top & 0xFFFC, - left + width + 3, top + height + 3, flags, key, 0, 0); + index = _vm->_game->_hotspots->add(0xD000 - id, left & 0xFFFC, top & 0xFFFC, + left + width + 3, top + height + 3, flags, key, 0, 0, funcPos); else - index = _vm->_game->addNewCollision(0xE000 + id, left, top, - left + width - 1, top + height - 1, flags, key, 0, 0); - - _vm->_game->_collisionAreas[index].funcSub = funcSub; + index = _vm->_game->_hotspots->add(0xE000 + id, left, top, + left + width - 1, top + height - 1, flags, key, 0, 0, funcPos); return false; } bool Inter_v2::o2_freeCollision(OpFuncParams ¶ms) { - int16 id; + int16 id = _vm->_game->_script->readValExpr(); - id = _vm->_game->_script->readValExpr(); - if (id == -2) { - for (int i = 0; i < 150; i++) { - if ((_vm->_game->_collisionAreas[i].id & 0xF000) == 0xD000) - _vm->_game->_collisionAreas[i].left = 0xFFFF; - } - } else if (id == -1) { - for (int i = 0; i < 150; i++) { - if ((_vm->_game->_collisionAreas[i].id & 0xF000) == 0xE000) - _vm->_game->_collisionAreas[i].left = 0xFFFF; - } - } else - _vm->_game->freeCollision(0xE000 + id); + if (id == -2) + _vm->_game->_hotspots->removeState(0xD000); + else if (id == -1) + _vm->_game->_hotspots->removeState(0xE000); + else + _vm->_game->_hotspots->remove(0xE000 + id); return false; } diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index 14bfa1e840..b366d39d0d 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -36,6 +36,7 @@ #include "gob/expression.h" #include "gob/script.h" #include "gob/resources.h" +#include "gob/hotspots.h" #include "gob/draw.h" #include "gob/sound/sound.h" #include "gob/videoplayer.h" @@ -359,29 +360,23 @@ bool Inter_v6::o6_freeCollision(OpFuncParams ¶ms) { switch (id + 5) { case 0: - _vm->_game->pushCollisions(1); + _vm->_game->_hotspots->push(1); break; case 1: - _vm->_game->popCollisions(); + _vm->_game->_hotspots->pop(); break; case 2: - _vm->_game->pushCollisions(2); + _vm->_game->_hotspots->push(2); break; case 3: - for (int i = 0; i < 150; i++) { - if (((_vm->_game->_collisionAreas[i].id & 0xF000) == 0xD000) || - ((_vm->_game->_collisionAreas[i].id & 0xF000) == 0x4000)) - _vm->_game->_collisionAreas[i].left = 0xFFFF; - } + _vm->_game->_hotspots->removeState(0xD000); + _vm->_game->_hotspots->removeState(0x4000); break; case 4: - for (int i = 0; i < 150; i++) { - if ((_vm->_game->_collisionAreas[i].id & 0xF000) == 0xE000) - _vm->_game->_collisionAreas[i].left = 0xFFFF; - } + _vm->_game->_hotspots->removeState(0xE000); break; default: - _vm->_game->freeCollision(0xE000 + id); + _vm->_game->_hotspots->remove(0xE000 + id); break; } diff --git a/engines/gob/module.mk b/engines/gob/module.mk index 695976da61..6c8b735019 100644 --- a/engines/gob/module.mk +++ b/engines/gob/module.mk @@ -22,7 +22,7 @@ MODULE_OBJS := \ goblin_v2.o \ goblin_v3.o \ goblin_v4.o \ - videoplayer.o \ + hotspots.o \ init.o \ init_v1.o \ init_v2.o \ @@ -56,6 +56,7 @@ MODULE_OBJS := \ video_v1.o \ video_v2.o \ video_v6.o \ + videoplayer.o \ demos/demoplayer.o \ demos/scnplayer.o \ demos/batplayer.o \ -- cgit v1.2.3 From 86f0669c93c7fa3d8887820470e075b20abe1a71 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 11:28:09 +0000 Subject: Wrapping the block end marker checks into Hotspots::Hotspot::isEnd() svn-id: r42124 --- engines/gob/hotspots.cpp | 90 ++++++++++++++---------------------------------- engines/gob/hotspots.h | 3 ++ 2 files changed, 29 insertions(+), 64 deletions(-) diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index bed9d6a7cb..9d1373d51d 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -93,6 +93,10 @@ uint8 Hotspots::Hotspot::getCursor() const { return (flags & 0xF000) >> 12; } +bool Hotspots::Hotspot::isEnd() const { + return (left == 0xFFFF); +} + bool Hotspots::Hotspot::isIn(uint16 x, uint16 y) const { if (x < left) return false; @@ -164,8 +168,8 @@ uint16 Hotspots::add(const Hotspot &hotspot) { for (int i = 0; i < kHotspotCount; i++) { Hotspot &spot = _hotspots[i]; - // free space => add same id => update - if (! ((spot.left == 0xFFFF) || (spot.id == hotspot.id))) + // free space => add same id => update + if (! (spot.isEnd() || (spot.id == hotspot.id))) continue; // When updating, keep bit 0x4000 intact @@ -204,13 +208,9 @@ void Hotspots::removeState(uint16 state) { } void Hotspots::recalculate(bool force) { - for (int i = 0; i < kHotspotCount; i++) { + for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.left == 0xFFFF) - // End reached - break; - if (!force && ((spot.flags & 0x80) != 0)) continue; @@ -277,13 +277,9 @@ void Hotspots::push(uint8 all, bool force) { // Count the hotspots uint32 size = 0; - for (int i = 0; i < kHotspotCount; i++) { + for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.left == 0xFFFF) - // End reached - break; - // Save all of them if ( (all == 1) || // Don't save the global ones @@ -309,13 +305,9 @@ void Hotspots::push(uint8 all, bool force) { // Copy the hotspots Hotspot *destPtr = backup.hotspots; - for (int i = 0; i < kHotspotCount; i++) { + for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.left == 0xFFFF) - // End reached - break; - // Save all of them if ( (all == 1) || // Don't save the global ones @@ -328,7 +320,7 @@ void Hotspots::push(uint8 all, bool force) { memcpy(destPtr, &spot, sizeof(Hotspot)); destPtr++; - spot.left = 0xFFFF; + spot.clear(); } } @@ -351,7 +343,7 @@ void Hotspots::pop() { int i; Hotspot *destPtr = _hotspots; for (i = 0; i < kHotspotCount; i++, destPtr++) - if (destPtr->left == 0xFFFF) + if (destPtr->isEnd()) break; if (((uint32) (kHotspotCount - i)) < backup.size) @@ -436,12 +428,9 @@ uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const { if (type == kTypeMove) { - for (int i = 0; i < kHotspotCount; i++) { + for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.left == 0xFFFF) - break; - if (spot.id & 0x4000) continue; @@ -464,12 +453,9 @@ uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const { } else if (type == kTypeClick) { - for (int i = 0; i < kHotspotCount; i++) { + for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.left == 0xFFFF) - break; - if (spot.id & 0x4000) continue; @@ -939,7 +925,7 @@ uint16 Hotspots::handleInput(int16 time, uint16 maxPos, uint16 &curPos, for (int i = 0; i < kHotspotCount; i++) { Hotspot &spot = _hotspots[i]; - if (spot.left == 0xFFFF) + if (spot.isEnd()) continue; if ((spot.id & 0xC000) != 0x8000) @@ -985,7 +971,7 @@ uint16 Hotspots::handleInput(int16 time, uint16 maxPos, uint16 &curPos, for (int i = 0; i < kHotspotCount; i++) { Hotspot &spot = _hotspots[i]; - if (spot.left == 0xFFFF) + if (spot.isEnd()) continue; if ((spot.id & 0xC000) != 0x8000) @@ -1025,12 +1011,9 @@ uint16 Hotspots::handleInput(int16 time, uint16 maxPos, uint16 &curPos, return 0; if (_vm->_game->_mouseButtons != kMouseButtonsNone) { - for (int i = 0; i < kHotspotCount; i++) { + for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.left == 0xFFFF) - break; - if (spot.getWindow() != 0) continue; @@ -1064,7 +1047,7 @@ uint16 Hotspots::handleInput(int16 time, uint16 maxPos, uint16 &curPos, for (int i = 0; i < kHotspotCount; i++) { Hotspot &spot = _hotspots[i]; - if (spot.left == 0xFFFF) + if (spot.isEnd()) continue; if ((spot.id & 0xC000) != 0x8000) @@ -1133,7 +1116,7 @@ void Hotspots::evaluate() { push(0); uint16 endIndex = 0; - while (_hotspots[endIndex].left != 0xFFFF) + while (!_hotspots[endIndex].isEnd()) endIndex++; _shouldPush = false; @@ -1381,12 +1364,9 @@ void Hotspots::evaluate() { WRITE_VAR(55, curEditIndex); if (key == kKeyReturn) { - for (int i = 0; i < kHotspotCount; i++) { + for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.left == 0xFFFF) - break; - if ((spot.id & 0xC000) != 0x8000) continue; @@ -1412,12 +1392,9 @@ void Hotspots::evaluate() { if (id == 0) { if (key != 0) { - for (int i = 0; i < kHotspotCount; i++) { + for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.left == 0xFFFF) - break; - if ((spot.id & 0xC000) != 0x8000) continue; @@ -1429,12 +1406,9 @@ void Hotspots::evaluate() { } if (id == 0) { - for (int i = 0; i < kHotspotCount; i++) { + for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.left == 0xFFFF) - break; - if ((spot.id & 0xC000) != 0x8000) continue; @@ -1455,12 +1429,9 @@ void Hotspots::evaluate() { if (stackPos2 != 0) { collStackPos = 0; - for (int i = endIndex; i < kHotspotCount; i++) { + for (int i = endIndex; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.left == 0xFFFF) - break; - if ((spot.id & 0xF000) != 0x8000) continue; @@ -1514,12 +1485,9 @@ void Hotspots::evaluate() { if (descIndex != 0) { counter = 0; - for (int i = endIndex; i < kHotspotCount; i++) { + for (int i = endIndex; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.left == 0xFFFF) - break; - if ((spot.id & 0xF000) == 0x8000) { if (++counter == descIndex) { id = spot.id; @@ -1532,12 +1500,9 @@ void Hotspots::evaluate() { } else { - for (int i = 0; i < kHotspotCount; i++) { + for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.left == 0xFFFF) - break; - if ((spot.id & 0xF000) == 0x8000) { id = spot.id; index = i; @@ -1584,7 +1549,7 @@ void Hotspots::evaluate() { for (int i = 0; i < kHotspotCount; i++) { Hotspot &spot = _hotspots[i]; - if (spot.left == 0xFFFF) + if (spot.isEnd()) continue; if ((spot.id & 0xC000) != 0x8000) @@ -1678,12 +1643,9 @@ void Hotspots::evaluate() { int16 Hotspots::findCursor(uint16 x, uint16 y) const { int16 cursor = 0; - for (int i = 0; i < kHotspotCount; i++) { + for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.left == 0xFFFF) - break; - if ((spot.getWindow() != 0) || (spot.id & 0x4000)) continue; diff --git a/engines/gob/hotspots.h b/engines/gob/hotspots.h index 0bafb94937..b8cd883ffd 100644 --- a/engines/gob/hotspots.h +++ b/engines/gob/hotspots.h @@ -108,6 +108,9 @@ private: uint8 getWindow() const; uint8 getCursor() const; + /** Is this hotspot the block end marker? */ + bool isEnd() const; + /** Are the specified coordinates in the hotspot? */ bool isIn(uint16 x, uint16 y) const; /** Does the specified button trigger the hotspot? */ -- cgit v1.2.3 From bc4f27c6b6c5a7cdf6ecc088ecf39f8f0546d976 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 11:28:25 +0000 Subject: Removing the now empty Game_Fascination class svn-id: r42125 --- engines/gob/game.h | 6 ------ engines/gob/game_fascin.cpp | 48 --------------------------------------------- engines/gob/gob.cpp | 2 +- engines/gob/module.mk | 1 - 4 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 engines/gob/game_fascin.cpp diff --git a/engines/gob/game.h b/engines/gob/game.h index e6a7a4c089..c6c7bd76d9 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -159,12 +159,6 @@ public: virtual void prepareStart(void); }; -class Game_Fascination : public Game_v2 { -public: - Game_Fascination(GobEngine *vm); - virtual ~Game_Fascination() {} -}; - } // End of namespace Gob #endif // GOB_GAME_H diff --git a/engines/gob/game_fascin.cpp b/engines/gob/game_fascin.cpp deleted file mode 100644 index 20480f778f..0000000000 --- a/engines/gob/game_fascin.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#include "common/endian.h" -#include "common/stream.h" - -#include "gob/gob.h" -#include "gob/game.h" -#include "gob/global.h" -#include "gob/util.h" -#include "gob/dataio.h" -#include "gob/draw.h" -#include "gob/goblin.h" -#include "gob/inter.h" -#include "gob/mult.h" -#include "gob/scenery.h" -#include "gob/video.h" -#include "gob/videoplayer.h" -#include "gob/sound/sound.h" - -namespace Gob { - -Game_Fascination::Game_Fascination(GobEngine *vm) : Game_v2(vm) { -} - -} // End of namespace Gob diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index e534464cce..9e1dfb0738 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -353,7 +353,7 @@ bool GobEngine::initGameParts() { _inter = new Inter_Fascination(this); _mult = new Mult_v2(this); _draw = new Draw_v2(this); - _game = new Game_Fascination(this); + _game = new Game_v2(this); _map = new Map_v2(this); _goblin = new Goblin_v2(this); _scenery = new Scenery_v2(this); diff --git a/engines/gob/module.mk b/engines/gob/module.mk index 6c8b735019..33d8f642b4 100644 --- a/engines/gob/module.mk +++ b/engines/gob/module.mk @@ -14,7 +14,6 @@ MODULE_OBJS := \ game_v1.o \ game_v2.o \ game_v6.o \ - game_fascin.o \ global.o \ gob.o \ goblin.o \ -- cgit v1.2.3 From 3b9add8330f2498ba3ea49de5b745f183080c880 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 11:28:38 +0000 Subject: Fixing indent svn-id: r42126 --- engines/gob/game_v6.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp index e8e08578b3..95e8ddf930 100644 --- a/engines/gob/game_v6.cpp +++ b/engines/gob/game_v6.cpp @@ -85,8 +85,8 @@ void Game_v6::totSub(int8 flags, const char *newTotFile) { if (_vm->_inter->_terminate < 2) _vm->_inter->_terminate = 0; -_hotspots->clear(); -_hotspots->pop(); + _hotspots->clear(); + _hotspots->pop(); if ((flags & 5) && _vm->_inter->_variables) { _vm->_inter->delocateVars(); -- cgit v1.2.3 From 4e70129d6033f2d9e4c7ec3d6806de66a61ad5c1 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 11:28:57 +0000 Subject: Merging Game_v1's and Game_v2's prepareStart() svn-id: r42127 --- engines/gob/draw_v1.cpp | 6 ++++++ engines/gob/game.cpp | 36 ++++++++++++++++++++++++++++++++++++ engines/gob/game.h | 8 ++------ engines/gob/game_v1.cpp | 42 ------------------------------------------ engines/gob/game_v2.cpp | 36 ------------------------------------ engines/gob/game_v6.cpp | 2 +- 6 files changed, 45 insertions(+), 85 deletions(-) diff --git a/engines/gob/draw_v1.cpp b/engines/gob/draw_v1.cpp index 625b738b8a..91f2a45637 100644 --- a/engines/gob/draw_v1.cpp +++ b/engines/gob/draw_v1.cpp @@ -45,6 +45,12 @@ Draw_v1::Draw_v1(GobEngine *vm) : Draw(vm) { void Draw_v1::initScreen() { _backSurface = _vm->_video->initSurfDesc(_vm->_global->_videoMode, 320, 200, 0); + _frontSurface = _vm->_global->_primarySurfDesc; + + _cursorSprites = + _vm->_video->initSurfDesc(_vm->_global->_videoMode, 32, 16, 2); + _scummvmCursor = + _vm->_video->initSurfDesc(_vm->_global->_videoMode, 16, 16, SCUMMVM_CURSOR); } void Draw_v1::closeScreen() { diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index b75726cc75..d8db743450 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -205,6 +205,42 @@ Game::~Game() { delete _hotspots; } +void Game::prepareStart() { + _vm->_global->_pPaletteDesc->unused2 = _vm->_draw->_unusedPalette2; + _vm->_global->_pPaletteDesc->unused1 = _vm->_draw->_unusedPalette1; + _vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaPalette; + + _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); + + _vm->_draw->initScreen(); + _vm->_video->fillRect(*_vm->_draw->_frontSurface, 0, 0, + _vm->_video->_surfWidth - 1, _vm->_video->_surfHeight - 1, 1); + + _vm->_util->setMousePos(152, 92); + _vm->_draw->_cursorX = _vm->_global->_inter_mouseX = 152; + _vm->_draw->_cursorY = _vm->_global->_inter_mouseY = 92; + + _vm->_draw->_invalidatedCount = 0; + _vm->_draw->_noInvalidated = true; + _vm->_draw->_applyPal = false; + _vm->_draw->_paletteCleared = false; + _vm->_draw->_cursorWidth = 16; + _vm->_draw->_cursorHeight = 16; + _vm->_draw->_transparentCursor = 1; + + for (int i = 0; i < 40; i++) { + _vm->_draw->_cursorAnimLow[i] = -1; + _vm->_draw->_cursorAnimDelays[i] = 0; + _vm->_draw->_cursorAnimHigh[i] = 0; + } + + _vm->_draw->_renderFlags = 0; + _vm->_draw->_backDeltaX = 0; + _vm->_draw->_backDeltaY = 0; + + _startTimeKey = _vm->_util->getTimeKey(); +} + void Game::capturePush(int16 left, int16 top, int16 width, int16 height) { int16 right; diff --git a/engines/gob/game.h b/engines/gob/game.h index c6c7bd76d9..2c2c89a490 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -92,6 +92,8 @@ public: Game(GobEngine *vm); virtual ~Game(); + virtual void prepareStart(); + void capturePush(int16 left, int16 top, int16 width, int16 height); void capturePop(char doDraw); @@ -108,8 +110,6 @@ public: virtual void playTot(int16 skipPlay) = 0; - virtual void prepareStart(void) = 0; - protected: uint32 _menuLevel; @@ -135,8 +135,6 @@ public: virtual ~Game_v1() {} virtual void playTot(int16 skipPlay); - - virtual void prepareStart(void); }; class Game_v2 : public Game_v1 { @@ -145,8 +143,6 @@ public: virtual ~Game_v2() {} virtual void playTot(int16 skipPlay); - - virtual void prepareStart(void); }; class Game_v6 : public Game_v2 { diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index 5948a21b9c..936311a986 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -160,46 +160,4 @@ void Game_v1::playTot(int16 skipPlay) { _script->pop(); } -void Game_v1::prepareStart(void) { - _vm->_global->_pPaletteDesc->unused2 = _vm->_draw->_unusedPalette2; - _vm->_global->_pPaletteDesc->unused1 = _vm->_draw->_unusedPalette1; - _vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaPalette; - - _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); - - _vm->_draw->initScreen(); - _vm->_video->fillRect(*_vm->_draw->_backSurface, 0, 0, 319, 199, 1); - _vm->_draw->_frontSurface = _vm->_global->_primarySurfDesc; - _vm->_video->fillRect(*_vm->_draw->_frontSurface, 0, 0, 319, 199, 1); - - _vm->_util->setMousePos(152, 92); - _vm->_draw->_cursorX = _vm->_global->_inter_mouseX = 152; - _vm->_draw->_cursorY = _vm->_global->_inter_mouseY = 92; - - _vm->_draw->_invalidatedCount = 0; - _vm->_draw->_noInvalidated = true; - _vm->_draw->_applyPal = false; - _vm->_draw->_paletteCleared = false; - _vm->_draw->_cursorWidth = 16; - _vm->_draw->_cursorHeight = 16; - _vm->_draw->_transparentCursor = 1; - - for (int i = 0; i < 40; i++) { - _vm->_draw->_cursorAnimLow[i] = -1; - _vm->_draw->_cursorAnimDelays[i] = 0; - _vm->_draw->_cursorAnimHigh[i] = 0; - } - - _vm->_draw->_cursorAnimLow[1] = 0; - _vm->_draw->_cursorSprites = - _vm->_video->initSurfDesc(_vm->_global->_videoMode, 32, 16, 2); - _vm->_draw->_scummvmCursor = - _vm->_video->initSurfDesc(_vm->_global->_videoMode, 16, 16, SCUMMVM_CURSOR); - _vm->_draw->_renderFlags = 0; - _vm->_draw->_backDeltaX = 0; - _vm->_draw->_backDeltaY = 0; - - _startTimeKey = _vm->_util->getTimeKey(); -} - } // End of namespace Gob diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index 9cc4da3cc9..725a66e4d6 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -179,40 +179,4 @@ void Game_v2::playTot(int16 skipPlay) { _script->pop(); } -void Game_v2::prepareStart(void) { - _vm->_global->_pPaletteDesc->unused2 = _vm->_draw->_unusedPalette2; - _vm->_global->_pPaletteDesc->unused1 = _vm->_draw->_unusedPalette1; - _vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaPalette; - - _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); - - _vm->_draw->initScreen(); - _vm->_video->fillRect(*_vm->_draw->_frontSurface, 0, 0, - _vm->_video->_surfWidth - 1, _vm->_video->_surfHeight - 1, 1); - - _vm->_util->setMousePos(152, 92); - _vm->_draw->_cursorX = _vm->_global->_inter_mouseX = 152; - _vm->_draw->_cursorY = _vm->_global->_inter_mouseY = 92; - - _vm->_draw->_invalidatedCount = 0; - _vm->_draw->_noInvalidated = true; - _vm->_draw->_applyPal = false; - _vm->_draw->_paletteCleared = false; - _vm->_draw->_cursorWidth = 16; - _vm->_draw->_cursorHeight = 16; - _vm->_draw->_transparentCursor = 1; - - for (int i = 0; i < 40; i++) { - _vm->_draw->_cursorAnimLow[i] = -1; - _vm->_draw->_cursorAnimDelays[i] = 0; - _vm->_draw->_cursorAnimHigh[i] = 0; - } - - _vm->_draw->_renderFlags = 0; - _vm->_draw->_backDeltaX = 0; - _vm->_draw->_backDeltaY = 0; - - _startTimeKey = _vm->_util->getTimeKey(); -} - } // End of namespace Gob diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp index 95e8ddf930..4881772aed 100644 --- a/engines/gob/game_v6.cpp +++ b/engines/gob/game_v6.cpp @@ -107,7 +107,7 @@ void Game_v6::prepareStart(void) { _noCd = true; } - Game_v2::prepareStart(); + Game::prepareStart(); } } // End of namespace Gob -- cgit v1.2.3 From 7be3530ffbc0485d56564e8ff015b4979d90b7ad Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 11:29:13 +0000 Subject: Merging Game's and Game_v6's totSub() svn-id: r42128 --- engines/gob/game.cpp | 11 +++++++--- engines/gob/game.h | 6 ++---- engines/gob/game_v6.cpp | 57 ------------------------------------------------- 3 files changed, 10 insertions(+), 64 deletions(-) diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index d8db743450..97a4c265fd 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -409,6 +409,9 @@ void Game::start(void) { void Game::totSub(int8 flags, const char *newTotFile) { int8 curBackupPos; + if ((flags == 16) || (flags == 17)) + warning("Urban Stub: Game::totSub(), flags == %d", flags); + if (_numEnvironments >= Environments::kEnvironmentCount) return; @@ -420,13 +423,14 @@ void Game::totSub(int8 flags, const char *newTotFile) { _script = new Script(_vm); _resources = new Resources(_vm); + + if (flags & 0x80) + warning("Urban Stub: Game::totSub(), flags & 0x80"); + if (flags & 1) _vm->_inter->_variables = 0; strncpy0(_curTotFile, newTotFile, 9); -// if (_vm->getGameType() == kGameTypeGeisha) -// strcat(_curTotFile, ".0OT"); -// else strcat(_curTotFile, ".TOT"); if (_vm->_inter->_terminate != 0) { @@ -444,6 +448,7 @@ void Game::totSub(int8 flags, const char *newTotFile) { if (_vm->_inter->_terminate != 2) _vm->_inter->_terminate = 0; + _hotspots->clear(); _hotspots->pop(); if ((flags & 1) && _vm->_inter->_variables) { diff --git a/engines/gob/game.h b/engines/gob/game.h index 2c2c89a490..7f4f9e2cd2 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -105,8 +105,8 @@ public: MouseButtons *pButtons = 0, char handleMouse = 0); void start(void); - virtual void totSub(int8 flags, const char *newTotFile); - virtual void switchTotSub(int16 index, int16 skipPlay); + void totSub(int8 flags, const char *newTotFile); + void switchTotSub(int16 index, int16 skipPlay); virtual void playTot(int16 skipPlay) = 0; @@ -150,8 +150,6 @@ public: Game_v6(GobEngine *vm); virtual ~Game_v6() {} - virtual void totSub(int8 flags, const char *newTotFile); - virtual void prepareStart(void); }; diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp index 4881772aed..be6bdff5b0 100644 --- a/engines/gob/game_v6.cpp +++ b/engines/gob/game_v6.cpp @@ -42,63 +42,6 @@ namespace Gob { Game_v6::Game_v6(GobEngine *vm) : Game_v2(vm) { } -// flagbits: 5 = freeInterVariables, 6 = skipPlay -void Game_v6::totSub(int8 flags, const char *newTotFile) { - int8 curBackupPos; - - if ((flags == 16) || (flags == 17)) - warning("Urban Stub: Game_v6::totSub(), flags == %d", flags); - - if (_numEnvironments >= Environments::kEnvironmentCount) - return; - - _environments->set(_numEnvironments); - - curBackupPos = _curEnvironment; - _numEnvironments++; - _curEnvironment = _numEnvironments; - - _script = new Script(_vm); - _resources = new Resources(_vm); - - if (flags & 0x80) - warning("Urban Stub: Game_v6::totSub(), flags & 0x80"); - - if (flags & 5) - _vm->_inter->_variables = 0; - - strncpy0(_curTotFile, newTotFile, 9); - strcat(_curTotFile, ".TOT"); - - if (_vm->_inter->_terminate != 0) { - clearUnusedEnvironment(); - return; - } - - _hotspots->push(0, true); - - if (flags & 6) - playTot(-1); - else - playTot(0); - - if (_vm->_inter->_terminate < 2) - _vm->_inter->_terminate = 0; - - _hotspots->clear(); - _hotspots->pop(); - - if ((flags & 5) && _vm->_inter->_variables) { - _vm->_inter->delocateVars(); - } - - clearUnusedEnvironment(); - - _numEnvironments--; - _curEnvironment = curBackupPos; - _environments->get(_numEnvironments); -} - void Game_v6::prepareStart(void) { _noCd = false; -- cgit v1.2.3 From 14172febf717702421332dc599e4970a578336cb Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 11:29:30 +0000 Subject: Merging playTot() svn-id: r42129 --- engines/gob/game.cpp | 134 +++++++++++++++++++++++++++++++++++++++++++++++- engines/gob/game.h | 12 ++--- engines/gob/game_v1.cpp | 114 ---------------------------------------- engines/gob/game_v2.cpp | 132 ----------------------------------------------- engines/gob/game_v6.cpp | 2 +- 5 files changed, 138 insertions(+), 256 deletions(-) diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index 97a4c265fd..731a76e712 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -37,6 +37,7 @@ #include "gob/inter.h" #include "gob/draw.h" #include "gob/mult.h" +#include "gob/scenery.h" #include "gob/videoplayer.h" #include "gob/sound/sound.h" @@ -241,6 +242,137 @@ void Game::prepareStart() { _startTimeKey = _vm->_util->getTimeKey(); } +void Game::playTot(int16 skipPlay) { + char savedTotName[20]; + int16 *oldCaptureCounter; + int16 *oldBreakFrom; + int16 *oldNestLevel; + int16 _captureCounter; + int16 breakFrom; + int16 nestLevel; + + oldNestLevel = _vm->_inter->_nestLevel; + oldBreakFrom = _vm->_inter->_breakFromLevel; + oldCaptureCounter = _vm->_scenery->_pCaptureCounter; + + _script->push(); + + _vm->_inter->_nestLevel = &nestLevel; + _vm->_inter->_breakFromLevel = &breakFrom; + _vm->_scenery->_pCaptureCounter = &_captureCounter; + strcpy(savedTotName, _curTotFile); + + if (skipPlay <= 0) { + while (!_vm->shouldQuit()) { + if (_vm->_inter->_variables) + _vm->_draw->animateCursor(4); + + if (skipPlay != -1) { + _vm->_inter->initControlVars(1); + + for (int i = 0; i < 4; i++) { + _vm->_draw->_fontToSprite[i].sprite = -1; + _vm->_draw->_fontToSprite[i].base = -1; + _vm->_draw->_fontToSprite[i].width = -1; + _vm->_draw->_fontToSprite[i].height = -1; + } + + _vm->_mult->initAll(); + _vm->_mult->zeroMultData(); + + _vm->_draw->_spritesArray[20] = _vm->_draw->_frontSurface; + _vm->_draw->_spritesArray[21] = _vm->_draw->_backSurface; + _vm->_draw->_cursorSpritesBack = _vm->_draw->_cursorSprites; + } else + _vm->_inter->initControlVars(0); + + _vm->_draw->_cursorHotspotXVar = -1; + _totToLoad[0] = 0; + + if ((_curTotFile[0] == 0) && (!_script->isLoaded())) + break; + + if (skipPlay == -2) { + _vm->_vidPlayer->primaryClose(); + skipPlay = 0; + } + + if (!_script->load(_curTotFile)) { + _vm->_draw->blitCursor(); + _vm->_inter->_terminate = 2; + break; + } + + _resources->load(_curTotFile); + + _vm->_global->_inter_animDataSize = _script->getAnimDataSize(); + if (!_vm->_inter->_variables) + _vm->_inter->allocateVars(_script->getVariablesCount() & 0xFFFF); + + _script->seek(_script->getFunctionOffset(TOTFile::kFunctionStart)); + + _vm->_inter->renewTimeInVars(); + + WRITE_VAR(13, _vm->_global->_useMouse); + WRITE_VAR(14, _vm->_global->_soundFlags); + WRITE_VAR(15, _vm->_global->_fakeVideoMode); + WRITE_VAR(16, _vm->_global->_language); + + _vm->_inter->callSub(2); + + if (_totToLoad[0] != 0) + _vm->_inter->_terminate = 0; + + _vm->_draw->blitInvalidated(); + + _script->unload(); + + _resources->unload(); + + for (int i = 0; i < *_vm->_scenery->_pCaptureCounter; i++) + capturePop(0); + + if (skipPlay != -1) { + _vm->_goblin->freeObjects(); + + _vm->_sound->blasterStop(0); + + for (int i = 0; i < Sound::kSoundsCount; i++) { + SoundDesc *sound = _vm->_sound->sampleGetBySlot(i); + + if (sound && + ((sound->getType() == SOUND_SND) || (sound->getType() == SOUND_WAV))) + _vm->_sound->sampleFree(sound); + } + } + + if (_totToLoad[0] == 0) + break; + + strcpy(_curTotFile, _totToLoad); + } + } else { + _vm->_inter->initControlVars(0); + _vm->_scenery->_pCaptureCounter = oldCaptureCounter; + _script->seek(_script->getFunctionOffset(skipPlay + 1)); + + _menuLevel++; + _vm->_inter->callSub(2); + _menuLevel--; + + if (_vm->_inter->_terminate != 0) + _vm->_inter->_terminate = 2; + } + + strcpy(_curTotFile, savedTotName); + + _vm->_inter->_nestLevel = oldNestLevel; + _vm->_inter->_breakFromLevel = oldBreakFrom; + _vm->_scenery->_pCaptureCounter = oldCaptureCounter; + + _script->pop(); +} + void Game::capturePush(int16 left, int16 top, int16 width, int16 height) { int16 right; @@ -394,7 +526,7 @@ int16 Game::checkKeys(int16 *pMouseX, int16 *pMouseY, return _vm->_util->checkKey(); } -void Game::start(void) { +void Game::start() { prepareStart(); playTot(-2); diff --git a/engines/gob/game.h b/engines/gob/game.h index 7f4f9e2cd2..4a8008a504 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -94,6 +94,8 @@ public: virtual void prepareStart(); + void playTot(int16 skipPlay); + void capturePush(int16 left, int16 top, int16 width, int16 height); void capturePop(char doDraw); @@ -103,13 +105,11 @@ public: int16 checkKeys(int16 *pMousex = 0, int16 *pMouseY = 0, MouseButtons *pButtons = 0, char handleMouse = 0); - void start(void); + void start(); void totSub(int8 flags, const char *newTotFile); void switchTotSub(int16 index, int16 skipPlay); - virtual void playTot(int16 skipPlay) = 0; - protected: uint32 _menuLevel; @@ -133,16 +133,12 @@ class Game_v1 : public Game { public: Game_v1(GobEngine *vm); virtual ~Game_v1() {} - - virtual void playTot(int16 skipPlay); }; class Game_v2 : public Game_v1 { public: Game_v2(GobEngine *vm); virtual ~Game_v2() {} - - virtual void playTot(int16 skipPlay); }; class Game_v6 : public Game_v2 { @@ -150,7 +146,7 @@ public: Game_v6(GobEngine *vm); virtual ~Game_v6() {} - virtual void prepareStart(void); + virtual void prepareStart(); }; } // End of namespace Gob diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index 936311a986..84a3544ffd 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -46,118 +46,4 @@ namespace Gob { Game_v1::Game_v1(GobEngine *vm) : Game(vm) { } -void Game_v1::playTot(int16 skipPlay) { - int16 _captureCounter; - int16 breakFrom; - int16 nestLevel; - - int16 *oldNestLevel = _vm->_inter->_nestLevel; - int16 *oldBreakFrom = _vm->_inter->_breakFromLevel; - int16 *oldCaptureCounter = _vm->_scenery->_pCaptureCounter; - - _script->push(); - - _vm->_inter->_nestLevel = &nestLevel; - _vm->_inter->_breakFromLevel = &breakFrom; - _vm->_scenery->_pCaptureCounter = &_captureCounter; - - char savedTotName[20]; - strcpy(savedTotName, _curTotFile); - - if (skipPlay <= 0) { - while (!_vm->shouldQuit()) { - for (int i = 0; i < 4; i++) { - _vm->_draw->_fontToSprite[i].sprite = -1; - _vm->_draw->_fontToSprite[i].base = -1; - _vm->_draw->_fontToSprite[i].width = -1; - _vm->_draw->_fontToSprite[i].height = -1; - } - - if ((_vm->getPlatform() == Common::kPlatformMacintosh)|| - (_vm->getPlatform() == Common::kPlatformWindows)) - _vm->_sound->adlibStop(); - else - _vm->_sound->cdStop(); - - _vm->_draw->animateCursor(4); - _vm->_inter->initControlVars(1); - _vm->_mult->initAll(); - _vm->_mult->zeroMultData(); - - for (int i = 0; i < SPRITES_COUNT; i++) - _vm->_draw->freeSprite(i); - - _vm->_draw->_spritesArray[20] = _vm->_draw->_frontSurface; - _vm->_draw->_spritesArray[21] = _vm->_draw->_backSurface; - _vm->_draw->_spritesArray[23] = _vm->_draw->_cursorSprites; - - for (int i = 0; i < 20; i++) - freeSoundSlot(i); - - _totToLoad[0] = 0; - - if ((_curTotFile[0] == 0) && !_script->isLoaded()) - break; - - if (!_script->load(_curTotFile)) { - _vm->_draw->blitCursor(); - break; - } - - _resources->load(_curTotFile); - - _vm->_global->_inter_animDataSize = _script->getAnimDataSize(); - if (!_vm->_inter->_variables) - _vm->_inter->allocateVars(_script->getVariablesCount() & 0xFFFF); - - _script->seek(_script->getFunctionOffset(TOTFile::kFunctionStart)); - - _vm->_inter->renewTimeInVars(); - - WRITE_VAR(13, _vm->_global->_useMouse); - WRITE_VAR(14, _vm->_global->_soundFlags); - WRITE_VAR(15, _vm->_global->_videoMode); - WRITE_VAR(16, _vm->_global->_language); - - _vm->_inter->callSub(2); - _script->setFinished(false); - - if (_totToLoad[0] != 0) - _vm->_inter->_terminate = 0; - - _vm->_draw->blitInvalidated(); - - _script->unload(); - - _resources->unload(); - - for (int i = 0; i < *_vm->_scenery->_pCaptureCounter; i++) - capturePop(0); - - _vm->_mult->checkFreeMult(); - _vm->_mult->freeAll(); - - for (int i = 0; i < SPRITES_COUNT; i++) - _vm->_draw->freeSprite(i); - _vm->_sound->blasterStop(0); - - for (int i = 0; i < 20; i++) - freeSoundSlot(i); - - if (_totToLoad[0] == 0) - break; - - strcpy(_curTotFile, _totToLoad); - } - } - - strcpy(_curTotFile, savedTotName); - - _vm->_inter->_nestLevel = oldNestLevel; - _vm->_inter->_breakFromLevel = oldBreakFrom; - _vm->_scenery->_pCaptureCounter = oldCaptureCounter; - - _script->pop(); -} - } // End of namespace Gob diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index 725a66e4d6..3cad49a0f9 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -38,7 +38,6 @@ #include "gob/goblin.h" #include "gob/inter.h" #include "gob/mult.h" -#include "gob/scenery.h" #include "gob/video.h" #include "gob/videoplayer.h" #include "gob/sound/sound.h" @@ -48,135 +47,4 @@ namespace Gob { Game_v2::Game_v2(GobEngine *vm) : Game_v1(vm) { } -void Game_v2::playTot(int16 skipPlay) { - char savedTotName[20]; - int16 *oldCaptureCounter; - int16 *oldBreakFrom; - int16 *oldNestLevel; - int16 _captureCounter; - int16 breakFrom; - int16 nestLevel; - - oldNestLevel = _vm->_inter->_nestLevel; - oldBreakFrom = _vm->_inter->_breakFromLevel; - oldCaptureCounter = _vm->_scenery->_pCaptureCounter; - - _script->push(); - - _vm->_inter->_nestLevel = &nestLevel; - _vm->_inter->_breakFromLevel = &breakFrom; - _vm->_scenery->_pCaptureCounter = &_captureCounter; - strcpy(savedTotName, _curTotFile); - - if (skipPlay <= 0) { - while (!_vm->shouldQuit()) { - if (_vm->_inter->_variables) - _vm->_draw->animateCursor(4); - - if (skipPlay != -1) { - _vm->_inter->initControlVars(1); - - for (int i = 0; i < 4; i++) { - _vm->_draw->_fontToSprite[i].sprite = -1; - _vm->_draw->_fontToSprite[i].base = -1; - _vm->_draw->_fontToSprite[i].width = -1; - _vm->_draw->_fontToSprite[i].height = -1; - } - - _vm->_mult->initAll(); - _vm->_mult->zeroMultData(); - - _vm->_draw->_spritesArray[20] = _vm->_draw->_frontSurface; - _vm->_draw->_spritesArray[21] = _vm->_draw->_backSurface; - _vm->_draw->_cursorSpritesBack = _vm->_draw->_cursorSprites; - } else - _vm->_inter->initControlVars(0); - - _vm->_draw->_cursorHotspotXVar = -1; - _totToLoad[0] = 0; - - if ((_curTotFile[0] == 0) && (!_script->isLoaded())) - break; - - if (skipPlay == -2) { - _vm->_vidPlayer->primaryClose(); - skipPlay = 0; - } - - if (!_script->load(_curTotFile)) { - _vm->_draw->blitCursor(); - _vm->_inter->_terminate = 2; - break; - } - - _resources->load(_curTotFile); - - _vm->_global->_inter_animDataSize = _script->getAnimDataSize(); - if (!_vm->_inter->_variables) - _vm->_inter->allocateVars(_script->getVariablesCount() & 0xFFFF); - - _script->seek(_script->getFunctionOffset(TOTFile::kFunctionStart)); - - _vm->_inter->renewTimeInVars(); - - WRITE_VAR(13, _vm->_global->_useMouse); - WRITE_VAR(14, _vm->_global->_soundFlags); - WRITE_VAR(15, _vm->_global->_fakeVideoMode); - WRITE_VAR(16, _vm->_global->_language); - - _vm->_inter->callSub(2); - - if (_totToLoad[0] != 0) - _vm->_inter->_terminate = 0; - - _vm->_draw->blitInvalidated(); - - _script->unload(); - - _resources->unload(); - - for (int i = 0; i < *_vm->_scenery->_pCaptureCounter; i++) - capturePop(0); - - if (skipPlay != -1) { - _vm->_goblin->freeObjects(); - - _vm->_sound->blasterStop(0); - - for (int i = 0; i < Sound::kSoundsCount; i++) { - SoundDesc *sound = _vm->_sound->sampleGetBySlot(i); - - if (sound && - ((sound->getType() == SOUND_SND) || (sound->getType() == SOUND_WAV))) - _vm->_sound->sampleFree(sound); - } - } - - if (_totToLoad[0] == 0) - break; - - strcpy(_curTotFile, _totToLoad); - } - } else { - _vm->_inter->initControlVars(0); - _vm->_scenery->_pCaptureCounter = oldCaptureCounter; - _script->seek(_script->getFunctionOffset(skipPlay + 1)); - - _menuLevel++; - _vm->_inter->callSub(2); - _menuLevel--; - - if (_vm->_inter->_terminate != 0) - _vm->_inter->_terminate = 2; - } - - strcpy(_curTotFile, savedTotName); - - _vm->_inter->_nestLevel = oldNestLevel; - _vm->_inter->_breakFromLevel = oldBreakFrom; - _vm->_scenery->_pCaptureCounter = oldCaptureCounter; - - _script->pop(); -} - } // End of namespace Gob diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp index be6bdff5b0..814b973ed9 100644 --- a/engines/gob/game_v6.cpp +++ b/engines/gob/game_v6.cpp @@ -42,7 +42,7 @@ namespace Gob { Game_v6::Game_v6(GobEngine *vm) : Game_v2(vm) { } -void Game_v6::prepareStart(void) { +void Game_v6::prepareStart() { _noCd = false; if (Common::File::exists("cd1.itk") && Common::File::exists("cd2.itk") && -- cgit v1.2.3 From 7e11c18fa2dfa8d4b6d6916b02af84043151a6d2 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 11:29:54 +0000 Subject: Putting the Urban noCD check into Init_v6::initGame() svn-id: r42130 --- engines/gob/game.cpp | 2 -- engines/gob/game.h | 6 +----- engines/gob/game_v6.cpp | 11 ----------- engines/gob/global.cpp | 2 ++ engines/gob/global.h | 2 ++ engines/gob/gob.cpp | 2 +- engines/gob/init.h | 10 +++++++++- engines/gob/init_v6.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ engines/gob/inter_v6.cpp | 2 +- engines/gob/module.mk | 1 + 10 files changed, 65 insertions(+), 21 deletions(-) create mode 100644 engines/gob/init_v6.cpp diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index 731a76e712..d201019d08 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -186,8 +186,6 @@ Game::Game(GobEngine *vm) : _vm(vm) { _preventScroll = false; _scrollHandleMouse = false; - _noCd = false; - _tempStr[0] = 0; _numEnvironments = 0; diff --git a/engines/gob/game.h b/engines/gob/game.h index 4a8008a504..dc6db1ed98 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -84,15 +84,13 @@ public: bool _preventScroll; bool _scrollHandleMouse; - bool _noCd; - byte _handleMouse; char _forceHandleMouse; Game(GobEngine *vm); virtual ~Game(); - virtual void prepareStart(); + void prepareStart(); void playTot(int16 skipPlay); @@ -145,8 +143,6 @@ class Game_v6 : public Game_v2 { public: Game_v6(GobEngine *vm); virtual ~Game_v6() {} - - virtual void prepareStart(); }; } // End of namespace Gob diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp index 814b973ed9..e5bed75725 100644 --- a/engines/gob/game_v6.cpp +++ b/engines/gob/game_v6.cpp @@ -42,15 +42,4 @@ namespace Gob { Game_v6::Game_v6(GobEngine *vm) : Game_v2(vm) { } -void Game_v6::prepareStart() { - _noCd = false; - - if (Common::File::exists("cd1.itk") && Common::File::exists("cd2.itk") && - Common::File::exists("cd3.itk") && Common::File::exists("cd4.itk")) { - _noCd = true; - } - - Game::prepareStart(); -} - } // End of namespace Gob diff --git a/engines/gob/global.cpp b/engines/gob/global.cpp index 4165938966..2969ed0870 100644 --- a/engines/gob/global.cpp +++ b/engines/gob/global.cpp @@ -123,6 +123,8 @@ Global::Global(GobEngine *vm) : _vm(vm) { _inter_mouseY = 0; _speedFactor = 1; + + _noCd = false; } Global::~Global() { diff --git a/engines/gob/global.h b/engines/gob/global.h index 982ce113cb..7849490107 100644 --- a/engines/gob/global.h +++ b/engines/gob/global.h @@ -141,6 +141,8 @@ public: // Can be 1, 2 or 3 for normal, double and triple speed, respectively uint8 _speedFactor; + bool _noCd; + Global(GobEngine *vm); ~Global(); diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 9e1dfb0738..0835979289 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -445,7 +445,7 @@ bool GobEngine::initGameParts() { case kGameTypeAdibou4: case kGameTypeUrban: - _init = new Init_v3(this); + _init = new Init_v6(this); _video = new Video_v6(this); _inter = new Inter_v6(this); _mult = new Mult_v2(this); diff --git a/engines/gob/init.h b/engines/gob/init.h index a8d4b9833e..60642d0189 100644 --- a/engines/gob/init.h +++ b/engines/gob/init.h @@ -32,7 +32,7 @@ namespace Gob { class Init { public: - void initGame(); + virtual void initGame(); virtual void initVideo() = 0; @@ -72,6 +72,14 @@ public: virtual ~Init_v3() {} }; +class Init_v6 : public Init_v3 { +public: + virtual void initGame(); + + Init_v6(GobEngine *vm); + virtual ~Init_v6() {} +}; + } // End of namespace Gob #endif // GOB_INIT_H diff --git a/engines/gob/init_v6.cpp b/engines/gob/init_v6.cpp new file mode 100644 index 0000000000..4b14c8a29c --- /dev/null +++ b/engines/gob/init_v6.cpp @@ -0,0 +1,48 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "common/endian.h" + +#include "gob/gob.h" +#include "gob/init.h" +#include "gob/global.h" + +namespace Gob { + +Init_v6::Init_v6(GobEngine *vm) : Init_v3(vm) { +} + +void Init_v6::initGame() { + _vm->_global->_noCd = false; + + if (Common::File::exists("cd1.itk") && Common::File::exists("cd2.itk") && + Common::File::exists("cd3.itk") && Common::File::exists("cd4.itk")) { + _vm->_global->_noCd = true; + } + + Init::initGame(); +} + +} // End of namespace Gob diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index b366d39d0d..3c71b3cd91 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -189,7 +189,7 @@ void Inter_v6::o6_openItk() { // (it checks CD1.ITK - CD4.ITK and the first that's found determines // the CD number), while its NO_CD modus wants everything in CD1.ITK. // So we just open the other ITKs, too. - if (_vm->_game->_noCd && !scumm_stricmp(fileName, "CD1.ITK")) { + if (_vm->_global->_noCd && !scumm_stricmp(fileName, "CD1.ITK")) { _vm->_dataIO->openDataFile("CD2.ITK", true); _vm->_dataIO->openDataFile("CD3.ITK", true); _vm->_dataIO->openDataFile("CD4.ITK", true); diff --git a/engines/gob/module.mk b/engines/gob/module.mk index 33d8f642b4..80a4218514 100644 --- a/engines/gob/module.mk +++ b/engines/gob/module.mk @@ -26,6 +26,7 @@ MODULE_OBJS := \ init_v1.o \ init_v2.o \ init_v3.o \ + init_v6.o \ inter.o \ inter_v1.o \ inter_v2.o \ -- cgit v1.2.3 From 7e7c86a33747df93a4d88c6e6984e003a79726d1 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 11:30:14 +0000 Subject: Removing the now unneeded Game_v* classes svn-id: r42131 --- engines/gob/game.h | 18 ------------------ engines/gob/game_v1.cpp | 49 ------------------------------------------------ engines/gob/game_v2.cpp | 50 ------------------------------------------------- engines/gob/game_v6.cpp | 45 -------------------------------------------- engines/gob/gob.cpp | 10 +--------- engines/gob/module.mk | 3 --- 6 files changed, 1 insertion(+), 174 deletions(-) delete mode 100644 engines/gob/game_v1.cpp delete mode 100644 engines/gob/game_v2.cpp delete mode 100644 engines/gob/game_v6.cpp diff --git a/engines/gob/game.h b/engines/gob/game.h index dc6db1ed98..d3a758f014 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -127,24 +127,6 @@ protected: void clearUnusedEnvironment(); }; -class Game_v1 : public Game { -public: - Game_v1(GobEngine *vm); - virtual ~Game_v1() {} -}; - -class Game_v2 : public Game_v1 { -public: - Game_v2(GobEngine *vm); - virtual ~Game_v2() {} -}; - -class Game_v6 : public Game_v2 { -public: - Game_v6(GobEngine *vm); - virtual ~Game_v6() {} -}; - } // End of namespace Gob #endif // GOB_GAME_H diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp deleted file mode 100644 index 84a3544ffd..0000000000 --- a/engines/gob/game_v1.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#include "common/endian.h" -#include "common/stream.h" - -#include "gob/gob.h" -#include "gob/game.h" -#include "gob/helper.h" -#include "gob/global.h" -#include "gob/util.h" -#include "gob/dataio.h" -#include "gob/script.h" -#include "gob/resources.h" -#include "gob/draw.h" -#include "gob/inter.h" -#include "gob/mult.h" -#include "gob/video.h" -#include "gob/scenery.h" -#include "gob/sound/sound.h" - -namespace Gob { - -Game_v1::Game_v1(GobEngine *vm) : Game(vm) { -} - -} // End of namespace Gob diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp deleted file mode 100644 index 3cad49a0f9..0000000000 --- a/engines/gob/game_v2.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#include "common/endian.h" -#include "common/stream.h" - -#include "gob/gob.h" -#include "gob/game.h" -#include "gob/helper.h" -#include "gob/global.h" -#include "gob/util.h" -#include "gob/dataio.h" -#include "gob/script.h" -#include "gob/resources.h" -#include "gob/draw.h" -#include "gob/goblin.h" -#include "gob/inter.h" -#include "gob/mult.h" -#include "gob/video.h" -#include "gob/videoplayer.h" -#include "gob/sound/sound.h" - -namespace Gob { - -Game_v2::Game_v2(GobEngine *vm) : Game_v1(vm) { -} - -} // End of namespace Gob diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp deleted file mode 100644 index e5bed75725..0000000000 --- a/engines/gob/game_v6.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#include "common/endian.h" -#include "common/stream.h" -#include "common/file.h" - -#include "gob/gob.h" -#include "gob/game.h" -#include "gob/helper.h" -#include "gob/global.h" -#include "gob/script.h" -#include "gob/resources.h" -#include "gob/hotspots.h" -#include "gob/inter.h" -#include "gob/draw.h" - -namespace Gob { - -Game_v6::Game_v6(GobEngine *vm) : Game_v2(vm) { -} - -} // End of namespace Gob diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 0835979289..35b3c0d662 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -331,6 +331,7 @@ bool GobEngine::initGameParts() { _palAnim = new PalAnim(this); _vidPlayer = new VideoPlayer(this); _sound = new Sound(this); + _game = new Game(this); switch (_gameType) { case kGameTypeGeisha: @@ -341,7 +342,6 @@ bool GobEngine::initGameParts() { _inter = new Inter_v1(this); _mult = new Mult_v1(this); _draw = new Draw_v1(this); - _game = new Game_v1(this); _map = new Map_v1(this); _goblin = new Goblin_v1(this); _scenery = new Scenery_v1(this); @@ -353,7 +353,6 @@ bool GobEngine::initGameParts() { _inter = new Inter_Fascination(this); _mult = new Mult_v2(this); _draw = new Draw_v2(this); - _game = new Game_v2(this); _map = new Map_v2(this); _goblin = new Goblin_v2(this); _scenery = new Scenery_v2(this); @@ -367,7 +366,6 @@ bool GobEngine::initGameParts() { _inter = new Inter_v2(this); _mult = new Mult_v2(this); _draw = new Draw_v2(this); - _game = new Game_v2(this); _map = new Map_v2(this); _goblin = new Goblin_v2(this); _scenery = new Scenery_v2(this); @@ -380,7 +378,6 @@ bool GobEngine::initGameParts() { _inter = new Inter_Bargon(this); _mult = new Mult_v2(this); _draw = new Draw_Bargon(this); - _game = new Game_v2(this); _map = new Map_v2(this); _goblin = new Goblin_v2(this); _scenery = new Scenery_v2(this); @@ -394,7 +391,6 @@ bool GobEngine::initGameParts() { _inter = new Inter_v3(this); _mult = new Mult_v2(this); _draw = new Draw_v2(this); - _game = new Game_v2(this); _map = new Map_v2(this); _goblin = new Goblin_v3(this); _scenery = new Scenery_v2(this); @@ -407,7 +403,6 @@ bool GobEngine::initGameParts() { _inter = new Inter_v3(this); _mult = new Mult_v2(this); _draw = new Draw_v2(this); - _game = new Game_v2(this); _map = new Map_v2(this); _goblin = new Goblin_v3(this); _scenery = new Scenery_v2(this); @@ -420,7 +415,6 @@ bool GobEngine::initGameParts() { _inter = new Inter_v4(this); _mult = new Mult_v2(this); _draw = new Draw_v2(this); - _game = new Game_v2(this); _map = new Map_v4(this); _goblin = new Goblin_v4(this); _scenery = new Scenery_v2(this); @@ -436,7 +430,6 @@ bool GobEngine::initGameParts() { _inter = new Inter_v5(this); _mult = new Mult_v2(this); _draw = new Draw_v2(this); - _game = new Game_v2(this); _map = new Map_v4(this); _goblin = new Goblin_v4(this); _scenery = new Scenery_v2(this); @@ -450,7 +443,6 @@ bool GobEngine::initGameParts() { _inter = new Inter_v6(this); _mult = new Mult_v2(this); _draw = new Draw_v2(this); - _game = new Game_v6(this); _map = new Map_v4(this); _goblin = new Goblin_v4(this); _scenery = new Scenery_v2(this); diff --git a/engines/gob/module.mk b/engines/gob/module.mk index 80a4218514..66c1b0dbaf 100644 --- a/engines/gob/module.mk +++ b/engines/gob/module.mk @@ -11,9 +11,6 @@ MODULE_OBJS := \ driver_vga.o \ expression.o \ game.o \ - game_v1.o \ - game_v2.o \ - game_v6.o \ global.o \ gob.o \ goblin.o \ -- cgit v1.2.3 From c31d1b3180903405058d274dd6a2cc984a64ed1e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 5 Jul 2009 11:49:05 +0000 Subject: - Fixed feature auto-detection for Conquests of Camelot - Auto-detected features are now printed in the console (to ease debugging) svn-id: r42132 --- engines/sci/engine/kernel.cpp | 30 +++++++++++++++++++++++++++--- engines/sci/engine/kernel.h | 9 +++++++-- engines/sci/engine/ksound.cpp | 2 +- engines/sci/engine/script.cpp | 2 +- engines/sci/engine/vm.h | 2 +- 5 files changed, 37 insertions(+), 8 deletions(-) diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index eaa1cbcbc2..8ac629d87b 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -363,16 +363,40 @@ Kernel::Kernel(ResourceManager *resmgr, bool isOldSci0) : _resmgr(resmgr) { mapFunctions(); // Map the kernel functions // SCI0 games using old graphics functions (before version 0.000.502) did not have a - // curAngle selector - _oldGfxFunctions = (_selectorMap.curAngle == -1 && _resmgr->_sciVersion == SCI_VERSION_0); + // motionCue selector + _oldGfxFunctions = (_selectorMap.motionCue == -1 && _resmgr->_sciVersion == SCI_VERSION_0); // SCI1 games which use absolute lofs have the egoMoveSpeed selector _hasLofsAbsolute = (_selectorMap.egoMoveSpeed != -1 && _resmgr->_sciVersion < SCI_VERSION_1_1); + + printAutoDetectedFeatures(); } Kernel::~Kernel() { } +void Kernel::printAutoDetectedFeatures() { + if (_oldGfxFunctions) + printf("Kernel auto-detection: game found to be using old graphics functions\n"); + else + printf("Kernel auto-detection: game found to be using newer graphics functions\n"); + + if (_hasLofsAbsolute) + printf("Kernel auto-detection: game found to be using absolute parameters for lofs\n"); + else + printf("Kernel auto-detection: game found to be using relative parameters for lofs\n"); + + if (_selectorMap.setVol != -1) + printf("Kernel auto-detection: using SCI1 sound functions\n"); + else if (_selectorMap.nodePtr != -1) + printf("Kernel auto-detection: using SCI01 sound functions\n"); + else + printf("Kernel auto-detection: using SCI0 sound functions\n"); + + if (_resmgr->_sciVersion == SCI_VERSION_0 && _selectorMap.sightAngle != -1) + printf("Kernel auto-detection: found SCI0 game using a SCI1 kernel table\n"); +} + void Kernel::loadSelectorNames(bool isOldSci0) { int count; @@ -733,7 +757,7 @@ void Kernel::setDefaultKernelNames() { // Check if we have a SCI01 game which uses a SCI1 kernel table (e.g. the KQ1 demo // and full version). We do this by checking if the sightAngle selector exists, as no // SCI0 game seems to have it - if (_selectorMap.sightAngle != -1) + if (_selectorMap.sightAngle != -1 && isSci0) isSci0 = false; _kernelNames.resize(SCI_KNAMES_DEFAULT_ENTRIES_NR + (isSci0 ? 4 : 0)); diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index da8ef04135..da3d255329 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -125,10 +125,15 @@ private: void setDefaultKernelNames(); /** - * Loads the kernel selector names. - */ + * Loads the kernel selector names. + */ void loadSelectorNames(bool isOldSci0); + /** + * Prints auto-detected features from selectors + */ + void printAutoDetectedFeatures(); + /** * Maps special selectors */ diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 1dc597a80d..fa64ab4086 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -966,7 +966,7 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t kDoSound(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (s->_kernel->_selectorMap.setVol != -1) return kDoSound_SCI1(s, funct_nr, argc, argv); - else if (s->_version >= SCI_VERSION_01) + else if (s->_kernel->_selectorMap.nodePtr != -1) return kDoSound_SCI01(s, funct_nr, argc, argv); else return kDoSound_SCI0(s, funct_nr, argc, argv); diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index 0b89fbc093..d4bd094b4a 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -202,7 +202,7 @@ void Kernel::mapSelectors() { FIND_SELECTOR(printLang); FIND_SELECTOR(subtitleLang); FIND_SELECTOR(parseLang); - FIND_SELECTOR(curAngle); + FIND_SELECTOR(motionCue); FIND_SELECTOR(sightAngle); FIND_SELECTOR(setVol); FIND_SELECTOR(egoMoveSpeed); diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h index f20838bb4a..adaa064a6c 100644 --- a/engines/sci/engine/vm.h +++ b/engines/sci/engine/vm.h @@ -203,7 +203,7 @@ struct selector_map_t { Selector printLang; /**< Used for i18n */ Selector subtitleLang; Selector parseLang; - Selector curAngle; // Used to detect newer graphics functions semantics. + Selector motionCue; // Used to detect newer graphics functions semantics. Selector sightAngle; // Used to detect some SCI0/SCI01 games which need a SCI1 table Selector setVol; // Used to detect newer sound semantics Selector egoMoveSpeed; // Used to detect SCI1 games which use absolute values in lofs -- cgit v1.2.3 From 0b4e5c43d3821b803a4bf9b1699f567e860dfb68 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 5 Jul 2009 11:58:42 +0000 Subject: Updated the MSVC project files of the gob engine svn-id: r42134 --- dists/msvc7/gob.vcproj | 89 ++++++++++++++++++++--------------------- dists/msvc71/gob.vcproj | 89 ++++++++++++++++++++--------------------- dists/msvc8/gob.vcproj | 104 +++++++++++++++++++++++------------------------- dists/msvc9/gob.vcproj | 104 +++++++++++++++++++++++------------------------- 4 files changed, 186 insertions(+), 200 deletions(-) diff --git a/dists/msvc7/gob.vcproj b/dists/msvc7/gob.vcproj index 1f74676279..fd1cbb9dfe 100644 --- a/dists/msvc7/gob.vcproj +++ b/dists/msvc7/gob.vcproj @@ -172,24 +172,6 @@ - - - - - - - - - - - - @@ -230,22 +212,16 @@ RelativePath="..\..\engines\gob\driver_vga.h"> - - - - + RelativePath="..\..\engines\gob\expression.cpp"> + RelativePath="..\..\engines\gob\expression.h"> + RelativePath="..\..\engines\gob\game.cpp"> + RelativePath="..\..\engines\gob\game.h"> @@ -280,6 +256,12 @@ + + + + @@ -295,6 +277,9 @@ + + @@ -359,58 +344,58 @@ RelativePath="..\..\engines\gob\palanim.h"> + RelativePath="..\..\engines\gob\resources.cpp"> + RelativePath="..\..\engines\gob\resources.h"> + RelativePath="..\..\engines\gob\save\saveconverter.cpp"> + RelativePath="..\..\engines\gob\save\saveconverter.h"> + RelativePath="..\..\engines\gob\save\saveconverter_v2.cpp"> + RelativePath="..\..\engines\gob\save\saveconverter_v3.cpp"> + RelativePath="..\..\engines\gob\save\saveconverter_v4.cpp"> + RelativePath="..\..\engines\gob\save\saveconverter_v6.cpp"> + RelativePath="..\..\engines\gob\save\savefile.cpp"> + RelativePath="..\..\engines\gob\save\savefile.h"> + RelativePath="..\..\engines\gob\save\savehandler.cpp"> + RelativePath="..\..\engines\gob\save\savehandler.h"> + RelativePath="..\..\engines\gob\save\saveload.cpp"> + RelativePath="..\..\engines\gob\save\saveload.h"> + RelativePath="..\..\engines\gob\save\saveload_v2.cpp"> + RelativePath="..\..\engines\gob\save\saveload_v3.cpp"> + RelativePath="..\..\engines\gob\save\saveload_v4.cpp"> + RelativePath="..\..\engines\gob\save\saveload_v6.cpp"> @@ -430,6 +415,18 @@ + + + + + + + + diff --git a/dists/msvc71/gob.vcproj b/dists/msvc71/gob.vcproj index bbeef85109..b005dbbd6e 100644 --- a/dists/msvc71/gob.vcproj +++ b/dists/msvc71/gob.vcproj @@ -186,24 +186,6 @@ - - - - - - - - - - - - @@ -244,22 +226,16 @@ RelativePath="..\..\engines\gob\driver_vga.h"> - - - - + RelativePath="..\..\engines\gob\expression.cpp"> + RelativePath="..\..\engines\gob\expression.h"> + RelativePath="..\..\engines\gob\game.cpp"> + RelativePath="..\..\engines\gob\game.h"> @@ -294,6 +270,12 @@ + + + + @@ -309,6 +291,9 @@ + + @@ -373,58 +358,58 @@ RelativePath="..\..\engines\gob\palanim.h"> + RelativePath="..\..\engines\gob\resources.cpp"> + RelativePath="..\..\engines\gob\resources.h"> + RelativePath="..\..\engines\gob\save\saveconverter.cpp"> + RelativePath="..\..\engines\gob\save\saveconverter.h"> + RelativePath="..\..\engines\gob\save\saveconverter_v2.cpp"> + RelativePath="..\..\engines\gob\save\saveconverter_v3.cpp"> + RelativePath="..\..\engines\gob\save\saveconverter_v4.cpp"> + RelativePath="..\..\engines\gob\save\saveconverter_v6.cpp"> + RelativePath="..\..\engines\gob\save\savefile.cpp"> + RelativePath="..\..\engines\gob\save\savefile.h"> + RelativePath="..\..\engines\gob\save\savehandler.cpp"> + RelativePath="..\..\engines\gob\save\savehandler.h"> + RelativePath="..\..\engines\gob\save\saveload.cpp"> + RelativePath="..\..\engines\gob\save\saveload.h"> + RelativePath="..\..\engines\gob\save\saveload_v2.cpp"> + RelativePath="..\..\engines\gob\save\saveload_v3.cpp"> + RelativePath="..\..\engines\gob\save\saveload_v4.cpp"> + RelativePath="..\..\engines\gob\save\saveload_v6.cpp"> @@ -444,6 +429,18 @@ + + + + + + + + diff --git a/dists/msvc8/gob.vcproj b/dists/msvc8/gob.vcproj index 3df12a8403..315cabc7d3 100644 --- a/dists/msvc8/gob.vcproj +++ b/dists/msvc8/gob.vcproj @@ -258,30 +258,6 @@ RelativePath="..\..\engines\gob\demos\batplayer.h" > - - - - - - - - - - - - @@ -335,27 +311,19 @@ > - - - - + + + + @@ -422,6 +398,10 @@ RelativePath="..\..\engines\gob\init_v3.cpp" > + + @@ -507,75 +487,75 @@ > + + + + + + + + diff --git a/dists/msvc9/gob.vcproj b/dists/msvc9/gob.vcproj index 98bc1a935f..60385473a5 100644 --- a/dists/msvc9/gob.vcproj +++ b/dists/msvc9/gob.vcproj @@ -259,30 +259,6 @@ RelativePath="..\..\engines\gob\demos\batplayer.h" > - - - - - - - - - - - - @@ -336,27 +312,19 @@ > - - - - + + + + @@ -423,6 +399,10 @@ RelativePath="..\..\engines\gob\init_v3.cpp" > + + @@ -508,75 +488,75 @@ > + + + + + + + + -- cgit v1.2.3 From daaba72677cb12fe9ce3345505dbbcccd2437341 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 12:52:14 +0000 Subject: Adding a workaround for an invalid expression in Gob1 EGA svn-id: r42135 --- engines/gob/inter_v1.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp index 7d32104552..7c5094d175 100644 --- a/engines/gob/inter_v1.cpp +++ b/engines/gob/inter_v1.cpp @@ -868,7 +868,16 @@ bool Inter_v1::o1_loadSpriteToPos(OpFuncParams ¶ms) { _vm->_draw->_spriteLeft = _vm->_game->_script->readInt16(); _vm->_draw->_destSpriteX = _vm->_game->_script->readValExpr(); - _vm->_draw->_destSpriteY = _vm->_game->_script->readValExpr(); + + // WORKAROUND: The EGA version of Gobliiins 1 has an invalid expression there + if (_vm->isEGA() && (_vm->_game->_script->pos() == 1398) && + !scumm_stricmp(_vm->_game->_curTotFile, "intro.tot")) { + + _vm->_draw->_destSpriteY = 0; + _vm->_game->_script->skip(1); + + } else + _vm->_draw->_destSpriteY = _vm->_game->_script->readValExpr(); _vm->_draw->_transparency = _vm->_game->_script->peekByte() & 1; _vm->_draw->_destSurface = ((int16) (_vm->_game->_script->peekByte() >> 1)) - 1; -- cgit v1.2.3 From d424bee608ea2c1adc5720f081c9e221b2969e26 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 5 Jul 2009 13:07:11 +0000 Subject: Merged the two SCI1 versions in one more file svn-id: r42136 --- engines/sci/sci.cpp | 5 ++--- engines/sci/sci.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 9b9c466812..250460c5de 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -43,14 +43,13 @@ namespace Sci { class GfxDriver; -const char *versionNames[9] = { +const char *versionNames[8] = { "Autodetected", "SCI0", "SCI01 EGA", "SCI01 VGA", "SCI01 VGA ODD", - "SCI1 early", - "SCI1 late", + "SCI1", "SCI1.1", "SCI32" }; diff --git a/engines/sci/sci.h b/engines/sci/sci.h index c158bb25ab..9b5d1de689 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -78,7 +78,7 @@ enum SciGameVersions { SCI_VERSION_32 = 8 }; -extern const char *versionNames[9]; +extern const char *versionNames[8]; enum SciGameFlags { // SCI0 flags -- cgit v1.2.3 From 4956052ca4d0d9e6fa0d50d3ceaaf442dae5d3aa Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 5 Jul 2009 14:11:54 +0000 Subject: Got rid of HACK, which was used to setup new cursor on theme change. svn-id: r42137 --- gui/GuiManager.cpp | 31 +++++++++++-------------------- gui/GuiManager.h | 4 +--- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/gui/GuiManager.cpp b/gui/GuiManager.cpp index cf8b7b2d9d..21b437fb6e 100644 --- a/gui/GuiManager.cpp +++ b/gui/GuiManager.cpp @@ -72,7 +72,6 @@ GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled), error("Failed to load any GUI theme, aborting"); } } - _themeChange = false; } GuiManager::~GuiManager() { @@ -143,12 +142,20 @@ bool GuiManager::loadNewTheme(Common::String id, ThemeEngine::GraphicsMode gfx) // Enable the new theme // _theme = newTheme; - _themeChange = true; + _useStdCursor = !_theme->ownCursor(); + + // If _stateIsSaved is set, we know that a Theme is already initialized, + // thus we initialize the new theme properly + if (_stateIsSaved) { + _theme->enable(); + + if (_useStdCursor) + setupCursor(); + } // refresh all dialogs - for (int i = 0; i < _dialogStack.size(); ++i) { + for (int i = 0; i < _dialogStack.size(); ++i) _dialogStack[i]->reflowLayout(); - } // We need to redraw immediately. Otherwise // some other event may cause a widget to be @@ -233,7 +240,6 @@ void GuiManager::runLoop() { // _theme->refresh(); - _themeChange = false; _redrawStatus = kRedrawFull; redraw(); } @@ -285,21 +291,6 @@ void GuiManager::runLoop() { Common::Point mouse(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y); - // HACK to change the cursor to the new themes one - if (_themeChange) { - _theme->enable(); - - _useStdCursor = !_theme->ownCursor(); - if (_useStdCursor) - setupCursor(); - -// _theme->refresh(); - - _themeChange = false; - _redrawStatus = kRedrawFull; - redraw(); - } - if (lastRedraw + waitTime < _system->getMillis()) { _theme->updateScreen(); _system->updateScreen(); diff --git a/gui/GuiManager.h b/gui/GuiManager.h index 102d612699..ab5c653549 100644 --- a/gui/GuiManager.h +++ b/gui/GuiManager.h @@ -120,9 +120,7 @@ protected: // mouse cursor state int _cursorAnimateCounter; int _cursorAnimateTimer; - byte _cursor[2048]; - - bool _themeChange; + byte _cursor[2048]; void initKeymap(); -- cgit v1.2.3 From c353e8de1fb1afae67fdc69f06db4d399caa2ed5 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 5 Jul 2009 14:12:04 +0000 Subject: Removed pushing of EVENT_SCREEN_CHANGED on theme load. This event should only be pushed by the backend. svn-id: r42138 --- gui/GuiManager.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/gui/GuiManager.cpp b/gui/GuiManager.cpp index 21b437fb6e..b97a62109b 100644 --- a/gui/GuiManager.cpp +++ b/gui/GuiManager.cpp @@ -164,10 +164,6 @@ bool GuiManager::loadNewTheme(Common::String id, ThemeEngine::GraphicsMode gfx) redraw(); _system->updateScreen(); - Common::Event event; - event.type = Common::EVENT_SCREEN_CHANGED; - _system->getEventManager()->pushEvent(event); - return true; } -- cgit v1.2.3 From 415d0c5b036a9b012c61972e7220e0f4df72db56 Mon Sep 17 00:00:00 2001 From: Marcus Comstedt Date: Sun, 5 Jul 2009 14:57:03 +0000 Subject: Refresh the screen if pollEvent() is called without updateScreen() being called for a long time. svn-id: r42139 --- backends/platform/dc/dc.h | 6 +++++- backends/platform/dc/display.cpp | 26 ++++++++++++++++++++++---- backends/platform/dc/input.cpp | 2 ++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index f86a2c6065..b67bbb51a1 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -194,7 +194,7 @@ class OSystem_Dreamcast : private DCHardware, public BaseBackend, public Filesys SoftKeyboard _softkbd; int _ms_cur_x, _ms_cur_y, _ms_cur_w, _ms_cur_h, _ms_old_x, _ms_old_y; - int _ms_hotspot_x, _ms_hotspot_y, _ms_visible, _devpoll; + int _ms_hotspot_x, _ms_hotspot_y, _ms_visible, _devpoll, _last_screen_refresh; int _current_shake_pos, _screen_w, _screen_h; int _overlay_x, _overlay_y; unsigned char *_ms_buf; @@ -220,11 +220,15 @@ class OSystem_Dreamcast : private DCHardware, public BaseBackend, public Filesys uint initSound(); void checkSound(); + void updateScreenTextures(void); + void updateScreenPolygons(void); + void maybeRefreshScreen(void); void drawMouse(int xdraw, int ydraw, int w, int h, unsigned char *buf, bool visible); void setScaling(); + Common::SaveFileManager *createSavefileManager(); }; diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp index ba8e1ba04f..d1e95c6a91 100644 --- a/backends/platform/dc/display.cpp +++ b/backends/platform/dc/display.cpp @@ -285,11 +285,8 @@ void OSystem_Dreamcast::setShakePos(int shake_pos) _current_shake_pos = shake_pos; } -void OSystem_Dreamcast::updateScreen(void) +void OSystem_Dreamcast::updateScreenTextures(void) { - struct polygon_list mypoly; - struct packed_colour_vertex_list myvertex; - if (_screen_dirty) { _screen_buffer++; @@ -328,6 +325,12 @@ void OSystem_Dreamcast::updateScreen(void) _overlay_dirty = false; } +} + +void OSystem_Dreamcast::updateScreenPolygons(void) +{ + struct polygon_list mypoly; + struct packed_colour_vertex_list myvertex; // *((volatile unsigned int *)(void*)0xa05f8040) = 0x00ff00; @@ -448,6 +451,21 @@ void OSystem_Dreamcast::updateScreen(void) ta_commit_frame(); // *((volatile unsigned int *)(void*)0xa05f8040) = 0x0; + + _last_screen_refresh = Timer(); +} + +void OSystem_Dreamcast::updateScreen(void) +{ + updateScreenTextures(); + updateScreenPolygons(); +} + +void OSystem_Dreamcast::maybeRefreshScreen(void) +{ + unsigned int t = Timer(); + if((int)(t-_last_screen_refresh) > USEC_TO_TIMER(30000)) + updateScreenPolygons(); } void OSystem_Dreamcast::drawMouse(int xdraw, int ydraw, int w, int h, diff --git a/backends/platform/dc/input.cpp b/backends/platform/dc/input.cpp index 1b85f601a6..5d4ed7ce96 100644 --- a/backends/platform/dc/input.cpp +++ b/backends/platform/dc/input.cpp @@ -202,6 +202,8 @@ bool OSystem_Dreamcast::pollEvent(Common::Event &event) if (((int)(t-_devpoll))>=0) _devpoll = t + USEC_TO_TIMER(17000); + maybeRefreshScreen(); + int mask = getimask(); setimask(15); checkSound(); -- cgit v1.2.3 From 501df3adf8c926695707fb3c62487bffdf2cde07 Mon Sep 17 00:00:00 2001 From: Florian Kagerer Date: Sun, 5 Jul 2009 14:58:22 +0000 Subject: LOL: - reduce code duplication svn-id: r42140 --- engines/kyra/lol.cpp | 2 +- engines/kyra/screen_lol.cpp | 172 ++++++++++++++++---------------------------- engines/kyra/screen_lol.h | 16 ----- 3 files changed, 61 insertions(+), 129 deletions(-) diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 020e1ea3ea..7c4b073f29 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -2880,7 +2880,7 @@ void LoLEngine::drinkBezelCup(int numUses, int charNum) { uint16 step = 0; do { - step = (step & 0xff) + (hpDiff * 256) / (bezelAnimData[numUses * 3 + 2]); + step = (step & 0xff) + (hpDiff * 256) / (bezelAnimData[numUses * 3 + 1]); increaseCharacterHitpoints(charNum, step / 256, true); gui_drawCharPortraitWithStats(charNum); diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index b9bf9961c5..ef42a49382 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -44,8 +44,6 @@ Screen_LoL::Screen_LoL(LoLEngine *vm, OSystem *system) : Screen_v2(vm, system), _fadeFlag = 2; _curDimIndex = 0; - - _internDimX = _internDimY = _internDimW = _internDimH = _internDimDstX = _internBlockWidth = _internDimDstY = _internBlockHeight = _internDimU5 = _internDimU6 = _internBlockWidth2 = _internDimU8 = 0; } Screen_LoL::~Screen_LoL() { @@ -588,44 +586,26 @@ void Screen_LoL::copyRegionSpecial(int page1, int w1, int h1, int x1, int y1, in va_end(args); } - // _internDimH: h0 -// _internDimW: w0 -// _internDimDstX: x1 -// _internDimDstY: y1 -// _internBlockWidth: w1 -// _internBlockHeight: h1 -// _internDimU5: x2 -// _internDimU6: y2 -// _internBlockWidth2: w2 - - _internDimX = _internDimY = 0; - _internDimW = w1; - _internDimH = h1; - calcBoundariesIntern(x1, y1, w3, h3); - if (_internBlockWidth == -1) + int na = 0, nb = 0, nc = w3; + if (!calcBounds(w1, h1, x1, y1, w3, h3, na, nb, nc)) return; - int iu5_1 = _internDimU5; - int iu6_1 = _internDimU6; - int ibw_1 = _internBlockWidth; - int ibh_1 = _internBlockHeight; - int dx_1 = _internDimDstX; - int dy_1 = _internDimDstY; + int iu5_1 = na; + int iu6_1 = nb; + int ibw_1 = w3; + //int ibh_1 = h3; + int dx_1 = x1; + int dy_1 = y1; - _internDimX = _internDimY = 0; - _internDimW = w2; - _internDimH = h2; - - calcBoundariesIntern(x2, y2, ibw_1, ibh_1); - if (_internBlockWidth == -1) + if (!calcBounds(w2, h2, x2, y2, w3, h3, na, nb, nc)) return; - int iu5_2 = _internDimU5; - int iu6_2 = _internDimU6; - int ibw_2 = _internBlockWidth; - int ibh_2 = _internBlockHeight; - int dx_2 = _internDimDstX; - int dy_2 = _internDimDstY; + int iu5_2 = na; + int iu6_2 = nb; + int ibw_2 = w3; + int ibh_2 = h3; + int dx_2 = x2; + int dy_2 = y2; uint8 *src = getPagePtr(page1) + (dy_1 + iu6_2) * w1; uint8 *dst = getPagePtr(page2) + (dy_2 + iu6_1) * w2; @@ -670,7 +650,7 @@ void Screen_LoL::copyRegionSpecial(int page1, int w1, int h1, int x1, int y1, in } if (!page2) - addDirtyRect(_internDimDstX + _internDimX, _internDimDstY + _internDimY, _internBlockWidth, _internBlockHeight); + addDirtyRect(x2, y2, w2, h2); } void Screen_LoL::copyBlockAndApplyOverlay(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, uint8 *ovl) { @@ -678,23 +658,23 @@ void Screen_LoL::copyBlockAndApplyOverlay(int page1, int x1, int y1, int page2, return; const ScreenDim *cdim = getScreenDim(dim); - _internDimX = cdim->sx << 3; - _internDimY = cdim->sy; - _internDimW = cdim->w << 3; - _internDimH = cdim->h; + int ix = cdim->sx << 3; + int iy = cdim->sy; + int iw = cdim->w << 3; + int ih = cdim->h; - calcBoundariesIntern(x2, y2, w, h); - if (_internBlockWidth == -1) + int na = 0, nb = 0, nc = w; + if (!calcBounds(iw, ih, x2, y2, w, h, na, nb, nc)) return; uint8 *src = getPagePtr(page1) + y1 * 320 + x1; - uint8 *dst = getPagePtr(page2) + (_internDimDstY + _internDimY) * 320; + uint8 *dst = getPagePtr(page2) + (y2 + iy) * 320; - for (int i = 0; i < _internBlockHeight; i++) { - uint8 *s = src + _internDimU5; - uint8 *d = dst + (_internDimDstX + _internDimX); + for (int i = 0; i < h; i++) { + uint8 *s = src + na; + uint8 *d = dst + (x2 + ix); - for (int ii = 0; ii < _internBlockWidth; ii++) { + for (int ii = 0; ii < w; ii++) { uint8 p = ovl[*s++]; if (p) *d = p; @@ -706,7 +686,7 @@ void Screen_LoL::copyBlockAndApplyOverlay(int page1, int x1, int y1, int page2, } if (!page2) - addDirtyRect(_internDimDstX + _internDimX, _internDimDstY + _internDimY, _internBlockWidth, _internBlockHeight); + addDirtyRect(x2 + ix, y2 + iy, w, h); } void Screen_LoL::applyOverlaySpecial(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, int flag, uint8 *ovl) { @@ -714,26 +694,47 @@ void Screen_LoL::applyOverlaySpecial(int page1, int x1, int y1, int page2, int x return; const ScreenDim *cdim = getScreenDim(dim); - _internDimX = cdim->sx << 3; - _internDimY = cdim->sy; - _internDimW = cdim->w << 3; - _internDimH = cdim->h; + int ix = cdim->sx << 3; + int iy = cdim->sy; + int iw = cdim->w << 3; + int ih = cdim->h; - calcBoundariesIntern(x2, y2, w, h); + int na = 0, nb = 0, nc = w; + if (!calcBounds(iw, ih, x2, y2, w, h, na, nb, nc)) + return; + + // _internDimH: h0 +// _internDimW: w0 +// _internDimDstX: x1 +// _internDimDstY: y1 +// _internBlockWidth: w1 +// _internBlockHeight: h1 +// _internDimU5: x2 na +// _internDimU6: y2 nb +// _internBlockWidth2: w2 nc + +// _internDimX = _internDimY = 0; +// _internDimW = w1; +/* _internDimH = h1; + calcBoundariesIntern(x1, y1, w3, h3); if (_internBlockWidth == -1) return; + calcBoundariesIntern(x2, y2, w, h); + if (_internBlockWidth == -1) + return;*/ + uint8 *src = getPagePtr(page1) + y1 * 320 + x1; - uint8 *dst = getPagePtr(page2) + (_internDimDstY + _internDimY) * 320; + uint8 *dst = getPagePtr(page2) + (y2 + iy) * 320; - for (int i = 0; i < _internBlockHeight; i++) { - uint8 *s = src + _internDimU5; - uint8 *d = dst + (_internDimDstX + _internDimX); + for (int i = 0; i < h; i++) { + uint8 *s = src + na; + uint8 *d = dst + (x2 + ix); if (flag) d += (i >> 1); - for (int ii = 0; ii < _internBlockWidth; ii++) { + for (int ii = 0; ii < w; ii++) { if (*s++) *d = ovl[*d]; d++; @@ -744,7 +745,7 @@ void Screen_LoL::applyOverlaySpecial(int page1, int x1, int y1, int page2, int x } if (!page2) - addDirtyRect(_internDimDstX + _internDimX, _internDimDstY + _internDimY, _internBlockWidth, _internBlockHeight); + addDirtyRect(x2 + ix, y2 + iy, w, h); } void Screen_LoL::copyBlockAndApplyOverlayOutro(int srcPage, int dstPage, const uint8 *ovl) { @@ -778,59 +779,6 @@ void Screen_LoL::copyBlockAndApplyOverlayOutro(int srcPage, int dstPage, const u } } -void Screen_LoL::calcBoundariesIntern(int dstX, int dstY, int width, int height) { - _internBlockWidth = _internBlockWidth2 = width; - _internBlockHeight = height; - _internDimDstX = dstX; - _internDimDstY = dstY; - - _internDimU5 = _internDimU6 = _internDimU8 = 0; - - int t = _internDimDstX + _internBlockWidth; - if (t <= 0) { - _internBlockWidth = _internBlockHeight = -1; - return; - } - - if (t <= _internDimDstX) { - _internDimU5 = _internBlockWidth - t; - _internBlockWidth = t; - _internDimDstX = 0; - } - - t = _internDimW - _internDimDstX; - if (t <= 0) { - _internBlockWidth = _internBlockHeight = -1; - return; - } - - if (t <= _internBlockWidth) - _internBlockWidth = t; - - _internBlockWidth2 -= _internBlockWidth; - - t = _internDimDstY + _internBlockHeight; - if (t <= 0) { - _internBlockWidth = _internBlockHeight = -1; - return; - } - - if (t <= _internDimDstY) { - _internDimU6 = _internBlockHeight - t; - _internBlockHeight = t; - _internDimDstY = 0; - } - - t = _internDimH - _internDimDstY; - if (t <= 0) { - _internBlockWidth = _internBlockHeight = -1; - return; - } - - if (t <= _internBlockHeight) - _internBlockHeight = t; -} - void Screen_LoL::fadeToBlack(int delay, const UpdateFunctor *upFunc) { Screen::fadeToBlack(delay, upFunc); _fadeFlag = 2; diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h index 2545064b58..f9cd7133de 100644 --- a/engines/kyra/screen_lol.h +++ b/engines/kyra/screen_lol.h @@ -112,22 +112,6 @@ private: static const uint8 _paletteConvTable[256]; void mergeOverlay(int x, int y, int w, int h); void postProcessCursor(uint8 *data, int width, int height, int pitch); - - // magic atlas - void calcBoundariesIntern(int dstX, int dstY, int c, int d); - - int _internDimX; - int _internDimY; - int _internDimW; - int _internDimH; - int _internDimDstX; - int _internBlockWidth; - int _internDimDstY; - int _internBlockHeight; - int _internDimU5; - int _internDimU6; - int _internBlockWidth2; - int _internDimU8; }; } // end of namespace Kyra -- cgit v1.2.3 From b43664e36810617ac02836d6ea9f50e54787c76a Mon Sep 17 00:00:00 2001 From: Florian Kagerer Date: Sun, 5 Jul 2009 16:29:17 +0000 Subject: LOL: cleanup svn-id: r42141 --- engines/kyra/screen_lol.cpp | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index ef42a49382..46b243a4cf 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -593,7 +593,6 @@ void Screen_LoL::copyRegionSpecial(int page1, int w1, int h1, int x1, int y1, in int iu5_1 = na; int iu6_1 = nb; int ibw_1 = w3; - //int ibh_1 = h3; int dx_1 = x1; int dy_1 = y1; @@ -703,27 +702,6 @@ void Screen_LoL::applyOverlaySpecial(int page1, int x1, int y1, int page2, int x if (!calcBounds(iw, ih, x2, y2, w, h, na, nb, nc)) return; - // _internDimH: h0 -// _internDimW: w0 -// _internDimDstX: x1 -// _internDimDstY: y1 -// _internBlockWidth: w1 -// _internBlockHeight: h1 -// _internDimU5: x2 na -// _internDimU6: y2 nb -// _internBlockWidth2: w2 nc - -// _internDimX = _internDimY = 0; -// _internDimW = w1; -/* _internDimH = h1; - calcBoundariesIntern(x1, y1, w3, h3); - if (_internBlockWidth == -1) - return; - - calcBoundariesIntern(x2, y2, w, h); - if (_internBlockWidth == -1) - return;*/ - uint8 *src = getPagePtr(page1) + y1 * 320 + x1; uint8 *dst = getPagePtr(page2) + (y2 + iy) * 320; -- cgit v1.2.3 From dbdce9616c7c1a38d424dd2d7f1566d28f7a1147 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 19:56:03 +0000 Subject: Encapsulating hotspot state reading svn-id: r42142 --- engines/gob/hotspots.cpp | 58 ++++++++++++++++++++++++++---------------------- engines/gob/hotspots.h | 1 + 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index 9d1373d51d..994a3e8efb 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -93,6 +93,10 @@ uint8 Hotspots::Hotspot::getCursor() const { return (flags & 0xF000) >> 12; } +uint8 Hotspots::Hotspot::getState() const { + return (id & 0xF000) >> 12; +} + bool Hotspots::Hotspot::isEnd() const { return (left == 0xFFFF); } @@ -235,7 +239,7 @@ void Hotspots::recalculate(bool force) { // Re-read the flags too, if applicable uint16 flags = 0; - if ((spot.id & 0xF000) == 0xA000) + if (spot.getState() == 0xA) flags = _vm->_game->_script->readValExpr(); // Apply backDelta, if needed @@ -260,7 +264,7 @@ void Hotspots::recalculate(bool force) { spot.right = left + width - 1; spot.bottom = top + height - 1; - if ((spot.id & 0xF000) == 0xA000) + if (spot.getState() == 0xA) spot.flags = flags; // Return @@ -285,9 +289,9 @@ void Hotspots::push(uint8 all, bool force) { // Don't save the global ones ((all == 0) && (spot.id >= 20)) || // Only save the ones with the correct state - ((all == 2) && (((spot.id & 0xF000) == 0xD000) || - ((spot.id & 0xF000) == 0x4000) || - ((spot.id & 0xF000) == 0xE000)))) { + ((all == 2) && ((spot.getState() == 0xD) || + (spot.getState() == 0x4) || + (spot.getState() == 0xE)))) { size++; } @@ -313,9 +317,9 @@ void Hotspots::push(uint8 all, bool force) { // Don't save the global ones ((all == 0) && (spot.id >= 20)) || // Only save the ones with the correct state - ((all == 2) && (((spot.id & 0xF000) == 0xD000) || - ((spot.id & 0xF000) == 0x4000) || - ((spot.id & 0xF000) == 0xE000)))) { + ((all == 2) && ((spot.getState() == 0xD) || + (spot.getState() == 0x4) || + (spot.getState() == 0xE)))) { memcpy(destPtr, &spot, sizeof(Hotspot)); destPtr++; @@ -400,7 +404,7 @@ void Hotspots::enter(uint16 index) { Hotspot &spot = _hotspots[index]; - if (((spot.id & 0xF000) == 0xA000) || ((spot.id & 0xF000) == 0x9000)) + if ((spot.getState() == 0xA) || (spot.getState() == 0x9)) WRITE_VAR(17, -(spot.id & 0x0FFF)); if (spot.funcEnter != 0) @@ -415,7 +419,7 @@ void Hotspots::leave(uint16 index) { Hotspot &spot = _hotspots[index]; - if (((spot.id & 0xF000) == 0xA000) || ((spot.id & 0xF000) == 0x9000)) + if ((spot.getState() == 0xA) || (spot.getState() == 0x9)) WRITE_VAR(17, spot.id & 0x0FFF); if (spot.funcLeave != 0) @@ -431,7 +435,7 @@ uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const { for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.id & 0x4000) + if (spot.getState() & 0x4) continue; if (spot.getType() > kTypeMove) @@ -456,7 +460,7 @@ uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const { for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.id & 0x4000) + if (spot.getState() & 0x4) continue; if (spot.getWindow() != 0) @@ -928,7 +932,7 @@ uint16 Hotspots::handleInput(int16 time, uint16 maxPos, uint16 &curPos, if (spot.isEnd()) continue; - if ((spot.id & 0xC000) != 0x8000) + if ((spot.getState() & 0xC) != 0x8) continue; if (spot.getType() < kTypeInput1NoLeave) @@ -974,7 +978,7 @@ uint16 Hotspots::handleInput(int16 time, uint16 maxPos, uint16 &curPos, if (spot.isEnd()) continue; - if ((spot.id & 0xC000) != 0x8000) + if ((spot.getState() & 0xC) != 0x8) continue; if (spot.getType() < kTypeInput1NoLeave) @@ -1017,7 +1021,7 @@ uint16 Hotspots::handleInput(int16 time, uint16 maxPos, uint16 &curPos, if (spot.getWindow() != 0) continue; - if ((spot.id & 0x4000)) + if (spot.getState() & 0x4) continue; if (!spot.isIn(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY)) @@ -1050,7 +1054,7 @@ uint16 Hotspots::handleInput(int16 time, uint16 maxPos, uint16 &curPos, if (spot.isEnd()) continue; - if ((spot.id & 0xC000) != 0x8000) + if ((spot.getState() & 0xC) != 0x8) continue; if (spot.getType() < kTypeInput1NoLeave) @@ -1286,7 +1290,7 @@ void Hotspots::evaluate() { for (int j = 0; j < kHotspotCount; j++) { Hotspot &spot = _hotspots[j]; - if ((spot.id & 0xF000) == 0xE000) { + if (spot.getState() == 0xE) { spot.id &= 0xBFFF; spot.funcEnter = _vm->_game->_script->pos(); spot.funcLeave = _vm->_game->_script->pos(); @@ -1302,7 +1306,7 @@ void Hotspots::evaluate() { for (int j = 0; j < kHotspotCount; j++) { Hotspot &spot = _hotspots[j]; - if ((spot.id & 0xF000) == 0xD000) { + if (spot.getState() == 0xD) { spot.id &= 0xBFFF; spot.funcEnter = _vm->_game->_script->pos(); spot.funcLeave = _vm->_game->_script->pos(); @@ -1367,7 +1371,7 @@ void Hotspots::evaluate() { for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if ((spot.id & 0xC000) != 0x8000) + if ((spot.getState() & 0xC) != 0x8) continue; if ((spot.getType() & 1) != 0) @@ -1395,7 +1399,7 @@ void Hotspots::evaluate() { for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if ((spot.id & 0xC000) != 0x8000) + if ((spot.getState() & 0xC) != 0x8) continue; if ((spot.key == key) || (spot.key == 0x7FFF)) { @@ -1409,7 +1413,7 @@ void Hotspots::evaluate() { for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if ((spot.id & 0xC000) != 0x8000) + if ((spot.getState() & 0xC) != 0x8) continue; if ((spot.key & 0xFF00) != 0) @@ -1432,7 +1436,7 @@ void Hotspots::evaluate() { for (int i = endIndex; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if ((spot.id & 0xF000) != 0x8000) + if (spot.getState() != 0x8) continue; collStackPos++; @@ -1488,7 +1492,7 @@ void Hotspots::evaluate() { for (int i = endIndex; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if ((spot.id & 0xF000) == 0x8000) { + if (spot.getState() == 0x8) { if (++counter == descIndex) { id = spot.id; index = i; @@ -1503,7 +1507,7 @@ void Hotspots::evaluate() { for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if ((spot.id & 0xF000) == 0x8000) { + if (spot.getState() == 0x8) { id = spot.id; index = i; break; @@ -1552,7 +1556,7 @@ void Hotspots::evaluate() { if (spot.isEnd()) continue; - if ((spot.id & 0xC000) != 0x8000) + if ((spot.getState() & 0xC) != 0x8) continue; if (spot.getType() < kTypeInput1NoLeave) @@ -1634,7 +1638,7 @@ void Hotspots::evaluate() { for (int i = 0; i < kHotspotCount; i++) { Hotspot &spot = _hotspots[i]; - if (((spot.id & 0xF000) == 0xA000) || ((spot.id & 0xF000) == 0x9000)) + if ((spot.getState() == 0xA) || (spot.getState() == 0x9)) spot.id |= 0x4000; } @@ -1646,7 +1650,7 @@ int16 Hotspots::findCursor(uint16 x, uint16 y) const { for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if ((spot.getWindow() != 0) || (spot.id & 0x4000)) + if ((spot.getWindow() != 0) || (spot.getState() & 0x4)) continue; if (!spot.isIn(x, y)) diff --git a/engines/gob/hotspots.h b/engines/gob/hotspots.h index b8cd883ffd..6d37b4e4a5 100644 --- a/engines/gob/hotspots.h +++ b/engines/gob/hotspots.h @@ -107,6 +107,7 @@ private: MouseButtons getButton() const; uint8 getWindow() const; uint8 getCursor() const; + uint8 getState() const; /** Is this hotspot the block end marker? */ bool isEnd() const; -- cgit v1.2.3 From a7ab6c5e92ccf774930846144cc5a272d7ce1542 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 19:56:23 +0000 Subject: Correcting an input related mistake svn-id: r42143 --- engines/gob/hotspots.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index 994a3e8efb..9847ae2ae1 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -1027,7 +1027,7 @@ uint16 Hotspots::handleInput(int16 time, uint16 maxPos, uint16 &curPos, if (!spot.isIn(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY)) continue; - if ((spot.id & 0xF000)) + if (spot.getCursor() != 0) continue; if (spot.getType() < kTypeInput1NoLeave) -- cgit v1.2.3 From aeb020602a6f89a5cbc5af66ded393fe8da61212 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 19:56:40 +0000 Subject: More state-related encapsulation svn-id: r42144 --- engines/gob/hotspots.cpp | 16 ++++++++++------ engines/gob/hotspots.h | 4 +++- engines/gob/inter_v2.cpp | 4 ++-- engines/gob/inter_v6.cpp | 6 +++--- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index 9847ae2ae1..987b91ca59 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -93,10 +93,14 @@ uint8 Hotspots::Hotspot::getCursor() const { return (flags & 0xF000) >> 12; } -uint8 Hotspots::Hotspot::getState() const { +uint8 Hotspots::Hotspot::getState(uint16 id) { return (id & 0xF000) >> 12; } +uint8 Hotspots::Hotspot::getState() const { + return getState(id); +} + bool Hotspots::Hotspot::isEnd() const { return (left == 0xFFFF); } @@ -202,11 +206,11 @@ void Hotspots::remove(uint16 id) { } } -void Hotspots::removeState(uint16 state) { +void Hotspots::removeState(uint8 state) { for (int i = 0; i < kHotspotCount; i++) { Hotspot &spot = _hotspots[i]; - if ((spot.id & 0xF000) == state) + if (spot.getState() == state) spot.clear(); } } @@ -1449,7 +1453,7 @@ void Hotspots::evaluate() { if (VAR(16) != 0) break; - if ((id & 0xF000) == 0x8000) + if (Hotspot::getState(id) == 0x8) WRITE_VAR(16, array[id & 0xFFF]); else WRITE_VAR(16, id & 0xFFF); @@ -1532,7 +1536,7 @@ void Hotspots::evaluate() { _vm->_inter->storeMouse(); - if ((id & 0xF000) == 0x8000) + if (Hotspot::getState(id) == 0x8) WRITE_VAR(16, array[id & 0xFFF]); else WRITE_VAR(16, id & 0xFFF); @@ -1624,7 +1628,7 @@ void Hotspots::evaluate() { _vm->_inter->storeMouse(); if (VAR(16) == 0) { - if ((id & 0xF000) == 0x8000) + if (Hotspot::getState(id) == 0x8) WRITE_VAR(16, array[id & 0xFFF]); else WRITE_VAR(16, id & 0xFFF); diff --git a/engines/gob/hotspots.h b/engines/gob/hotspots.h index 6d37b4e4a5..e05e37b296 100644 --- a/engines/gob/hotspots.h +++ b/engines/gob/hotspots.h @@ -64,7 +64,7 @@ public: uint16 funcEnter, uint16 funcLeave, uint16 funcPos); void remove(uint16 id); - void removeState(uint16 state); + void removeState(uint8 state); /** Push the current hotspots onto the stack. * @@ -116,6 +116,8 @@ private: bool isIn(uint16 x, uint16 y) const; /** Does the specified button trigger the hotspot? */ bool buttonMatch(MouseButtons button) const; + + static uint8 getState(uint16 id); }; struct StackEntry { diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index d71a321db7..e82448c12c 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -1215,9 +1215,9 @@ bool Inter_v2::o2_freeCollision(OpFuncParams ¶ms) { int16 id = _vm->_game->_script->readValExpr(); if (id == -2) - _vm->_game->_hotspots->removeState(0xD000); + _vm->_game->_hotspots->removeState(0xD); else if (id == -1) - _vm->_game->_hotspots->removeState(0xE000); + _vm->_game->_hotspots->removeState(0xE); else _vm->_game->_hotspots->remove(0xE000 + id); diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index 3c71b3cd91..15e2cc9481 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -369,11 +369,11 @@ bool Inter_v6::o6_freeCollision(OpFuncParams ¶ms) { _vm->_game->_hotspots->push(2); break; case 3: - _vm->_game->_hotspots->removeState(0xD000); - _vm->_game->_hotspots->removeState(0x4000); + _vm->_game->_hotspots->removeState(0xD); + _vm->_game->_hotspots->removeState(0x4); break; case 4: - _vm->_game->_hotspots->removeState(0xE000); + _vm->_game->_hotspots->removeState(0xE); break; default: _vm->_game->_hotspots->remove(0xE000 + id); -- cgit v1.2.3 From c4dc61edb54c244b4df5c9f1503cb983e2021030 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 19:56:54 +0000 Subject: Split off Hotspots::evaluateNew() svn-id: r42145 --- engines/gob/hotspots.cpp | 407 +++++++++++++++++++++++------------------------ engines/gob/hotspots.h | 7 +- 2 files changed, 202 insertions(+), 212 deletions(-) diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index 987b91ca59..eca9a250b4 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -924,7 +924,7 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh } uint16 Hotspots::handleInput(int16 time, uint16 maxPos, uint16 &curPos, - InputDesc *inpDesc, uint16 &id, uint16 &index) { + InputDesc *inputs, uint16 &id, uint16 &index) { uint16 descInd = 0; uint16 key = 0; @@ -955,11 +955,11 @@ uint16 Hotspots::handleInput(int16 time, uint16 maxPos, uint16 &curPos, _vm->_draw->_destSurface = 21; - _vm->_draw->_backColor = inpDesc[descInd].backColor; - _vm->_draw->_frontColor = inpDesc[descInd].frontColor; + _vm->_draw->_backColor = inputs[descInd].backColor; + _vm->_draw->_frontColor = inputs[descInd].frontColor; _vm->_draw->_textToPrint = tempStr; _vm->_draw->_transparency = 1; - _vm->_draw->_fontIndex = inpDesc[descInd].fontIndex; + _vm->_draw->_fontIndex = inputs[descInd].fontIndex; _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10); @@ -1006,8 +1006,8 @@ uint16 Hotspots::handleInput(int16 time, uint16 maxPos, uint16 &curPos, key = readString(inputSpot.left, inputSpot.top, inputSpot.right - inputSpot.left + 1, inputSpot.bottom - inputSpot.top + 1, - inpDesc[curPos].backColor, inpDesc[curPos].frontColor, - GET_VARO_STR(inputSpot.key), inpDesc[curPos].fontIndex, + inputs[curPos].backColor, inputs[curPos].frontColor, + GET_VARO_STR(inputSpot.key), inputs[curPos].fontIndex, inputSpot.getType(), time, id, index); if (_vm->_inter->_terminate) @@ -1112,250 +1112,237 @@ uint16 Hotspots::handleInput(int16 time, uint16 maxPos, uint16 &curPos, } } -void Hotspots::evaluate() { - InputDesc descArray[20]; - int16 array[300]; - char *str; - int16 counter; - int16 var_24; - int16 var_26; - int16 collStackPos; - - push(0); - - uint16 endIndex = 0; - while (!_hotspots[endIndex].isEnd()) - endIndex++; - - _shouldPush = false; +void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, + uint16 &validId, bool &hasInput, uint16 &inputIndex) { - _vm->_game->_script->skip(1); + ids[i] = 0; - byte count = _vm->_game->_script->readByte(); + // Type and window + byte type = _vm->_game->_script->readByte(); + byte window = 0; - _vm->_game->_handleMouse = _vm->_game->_script->peekByte(0); - int16 duration = _vm->_game->_script->peekByte(1); - byte stackPos2 = _vm->_game->_script->peekByte(3); - byte descIndex = _vm->_game->_script->peekByte(4); - bool needRecalculation = _vm->_game->_script->peekByte(5) != 0; - - duration *= 1000; - if ((stackPos2 != 0) || (descIndex != 0)) { - duration /= 100; - if (_vm->_game->_script->peekByte(1) == 100) - duration = 2; + if ((type & 0x40) != 0) { + type -= 0x40; + window = _vm->_game->_script->readByte(); } - int16 timeVal = duration; - - _vm->_game->_script->skip(6); - - WRITE_VAR(16, 0); - - byte var_41 = 0; - int16 var_46 = 0; - - uint16 id = 0; - uint16 validId = 0xFFFF; - uint16 index = 0; + // Coordinates + uint16 left, top, width, height, right, bottom; + uint32 funcPos = 0; + if ((type & 0x80) != 0) { + funcPos = _vm->_game->_script->pos(); + left = _vm->_game->_script->readValExpr(); + top = _vm->_game->_script->readValExpr(); + width = _vm->_game->_script->readValExpr(); + height = _vm->_game->_script->readValExpr(); + } else { + funcPos = 0; + left = _vm->_game->_script->readUint16(); + top = _vm->_game->_script->readUint16(); + width = _vm->_game->_script->readUint16(); + height = _vm->_game->_script->readUint16(); + } + type &= 0x7F; - bool hasInput = false; - uint16 inputIndex = 0; + // Apply global drawing offset + if ((_vm->_draw->_renderFlags & RENDERFLAG_CAPTUREPOP) && (left != 0xFFFF)) { + left += _vm->_draw->_backDeltaX; + top += _vm->_draw->_backDeltaY; + } - for (uint16 i = 0; i < count; i++) { - array[i] = 0; + right = left + width - 1; + bottom = top + height - 1; - byte type = _vm->_game->_script->readByte(); - byte window = 0; + // Removing 0x4 from the state + if ((type == 11) || (type == 12)) { + uint8 wantedState = (type == 11) ? 0xE : 0xD; - if ((type & 0x40) != 0) { - type -= 0x40; - window = _vm->_game->_script->readByte(); - } + _vm->_game->_script->skip(6); - uint16 left, top, width, height, right, bottom; - uint32 funcEnter = 0, funcLeave = 0, funcPos = 0; - if ((type & 0x80) != 0) { - funcPos = _vm->_game->_script->pos(); - left = _vm->_game->_script->readValExpr(); - top = _vm->_game->_script->readValExpr(); - width = _vm->_game->_script->readValExpr(); - height = _vm->_game->_script->readValExpr(); - } else { - funcPos = 0; - left = _vm->_game->_script->readUint16(); - top = _vm->_game->_script->readUint16(); - width = _vm->_game->_script->readUint16(); - height = _vm->_game->_script->readUint16(); - } + for (int j = 0; j < kHotspotCount; j++) { + Hotspot &spot = _hotspots[j]; - if ((_vm->_draw->_renderFlags & RENDERFLAG_CAPTUREPOP) && (left != 0xFFFF)) { - left += _vm->_draw->_backDeltaX; - top += _vm->_draw->_backDeltaY; + if (spot.getState() == wantedState) { + spot.id &= 0xBFFF; + spot.funcEnter = _vm->_game->_script->pos(); + spot.funcLeave = _vm->_game->_script->pos(); + } } - right = left + width - 1; - bottom = top + height - 1; - - int16 key = 0; - int16 flags = 0; - Video::FontDesc *font = 0; - - type &= 0x7F; - switch (type) { - case kTypeNone: - _vm->_game->_script->skip(6); - - funcEnter = _vm->_game->_script->pos(); - _vm->_game->_script->skipBlock(); + _vm->_game->_script->skipBlock(); - funcLeave = _vm->_game->_script->pos(); - _vm->_game->_script->skipBlock(); + return; + } - key = i + 0xA000; - flags = type + (window << 8); + int16 key = 0; + int16 flags = 0; + Video::FontDesc *font = 0; + uint32 funcEnter = 0, funcLeave = 0; + + // Evaluate parameters for the new hotspot + switch (type) { + case kTypeNone: + _vm->_game->_script->skip(6); + + funcEnter = _vm->_game->_script->pos(); + _vm->_game->_script->skipBlock(); + + funcLeave = _vm->_game->_script->pos(); + _vm->_game->_script->skipBlock(); + + key = i + 0xA000; + flags = type + (window << 8); + break; + + case kTypeMove: + key = _vm->_game->_script->readInt16(); + ids[i] = _vm->_game->_script->readInt16(); + flags = _vm->_game->_script->readInt16(); + + funcEnter = _vm->_game->_script->pos(); + _vm->_game->_script->skipBlock(); + + funcLeave = _vm->_game->_script->pos(); + _vm->_game->_script->skipBlock(); + + if (key == 0) + key = i + 0xA000; + + flags = type + (window << 8) + (flags << 4); + break; + + case kTypeInput1NoLeave: + case kTypeInput1Leave: + case kTypeInput2NoLeave: + case kTypeInput2Leave: + case kTypeInput3NoLeave: + case kTypeInput3Leave: + case kTypeInputFloatNoLeave: + case kTypeInputFloatLeave: + hasInput = true; + + _vm->_util->clearKeyBuf(); + + // Input text parameters + key = _vm->_game->_script->readVarIndex(); + inputs[inputIndex].fontIndex = _vm->_game->_script->readInt16(); + inputs[inputIndex].backColor = _vm->_game->_script->readByte(); + inputs[inputIndex].frontColor = _vm->_game->_script->readByte(); + inputs[inputIndex].str = 0; + + if ((type >= kTypeInput2NoLeave) && (type <= kTypeInput3Leave)) { + inputs[inputIndex].str = + (const char *) (_vm->_game->_script->getData() + _vm->_game->_script->pos() + 2); + _vm->_game->_script->skip(_vm->_game->_script->peekUint16() + 2); + } - add(i + 0x8000, left, top, right, bottom, - flags, key, funcEnter, funcLeave, funcPos); + if (left == 0xFFFF) { + if ((type & 1) == 0) + _vm->_game->_script->skipBlock(); break; + } - case kTypeMove: - key = _vm->_game->_script->readInt16(); - array[i] = _vm->_game->_script->readInt16(); - flags = _vm->_game->_script->readInt16(); - - funcEnter = _vm->_game->_script->pos(); - _vm->_game->_script->skipBlock(); + font = _vm->_draw->_fonts[inputs[inputIndex].fontIndex]; + if (!font->extraData) + right = left + width * font->itemWidth - 1; + funcEnter = 0; + funcPos = 0; + funcLeave = 0; + if (!(type & 1)) { funcLeave = _vm->_game->_script->pos(); _vm->_game->_script->skipBlock(); + } - if (key == 0) - key = i + 0xA000; - flags = type + (window << 8) + (flags << 4); - - add(i + 0x8000, left, top, right, bottom, - flags, key, funcEnter, funcLeave, funcPos); - break; - - case kTypeInput1NoLeave: - case kTypeInput1Leave: - case kTypeInput2NoLeave: - case kTypeInput2Leave: - case kTypeInput3NoLeave: - case kTypeInput3Leave: - case kTypeInputFloatNoLeave: - case kTypeInputFloatLeave: - hasInput = true; - - _vm->_util->clearKeyBuf(); - - key = _vm->_game->_script->readVarIndex(); - descArray[inputIndex].fontIndex = _vm->_game->_script->readInt16(); - descArray[inputIndex].backColor = _vm->_game->_script->readByte(); - descArray[inputIndex].frontColor = _vm->_game->_script->readByte(); - descArray[inputIndex].ptr = 0; - - if ((type >= kTypeInput2NoLeave) && (type <= kTypeInput3Leave)) { - descArray[inputIndex].ptr = _vm->_game->_script->getData() + _vm->_game->_script->pos() + 2; - _vm->_game->_script->skip(_vm->_game->_script->peekUint16() + 2); - } - - if (left == 0xFFFF) { - if ((type & 1) == 0) - _vm->_game->_script->skipBlock(); - break; - } + flags = type; - font = _vm->_draw->_fonts[descArray[inputIndex].fontIndex]; - if (!font->extraData) - right = left + width * font->itemWidth - 1; + inputIndex++; + break; - funcEnter = 0; - funcPos = 0; - funcLeave = 0; - if (!(type & 1)) { - funcLeave = _vm->_game->_script->pos(); - _vm->_game->_script->skipBlock(); - } + case 20: + validId = i; + // Fall through to case 2 + case kTypeClick: + key = _vm->_game->_script->readInt16(); + ids[i] = _vm->_game->_script->readInt16(); + flags = _vm->_game->_script->readInt16(); - flags = type; + funcEnter = 0; - inputIndex++; + funcLeave = _vm->_game->_script->pos(); + _vm->_game->_script->skipBlock(); - add(i + 0x8000, left, top, right, bottom, - flags, key, funcEnter, funcLeave, funcPos); + flags = 2 + (window << 8) + (flags << 4); + break; - break; + case 21: + key = _vm->_game->_script->readInt16(); + ids[i] = _vm->_game->_script->readInt16(); + flags = _vm->_game->_script->readInt16() & 3; - case 11: - _vm->_game->_script->skip(6); + funcEnter = _vm->_game->_script->pos(); + _vm->_game->_script->skipBlock(); - for (int j = 0; j < kHotspotCount; j++) { - Hotspot &spot = _hotspots[j]; + funcLeave = 0; - if (spot.getState() == 0xE) { - spot.id &= 0xBFFF; - spot.funcEnter = _vm->_game->_script->pos(); - spot.funcLeave = _vm->_game->_script->pos(); - } - } + flags = 2 + (window << 8) + (flags << 4); + break; + } - _vm->_game->_script->skipBlock(); - break; + add(i + 0x8000, left, top, right, bottom, + flags, key, funcEnter, funcLeave, funcPos); +} - case 12: - _vm->_game->_script->skip(6); +void Hotspots::evaluate() { + InputDesc inputs[20]; + uint16 ids[kHotspotCount]; + int16 counter; + int16 var_24; + int16 var_26; + int16 collStackPos; - for (int j = 0; j < kHotspotCount; j++) { - Hotspot &spot = _hotspots[j]; + push(0); - if (spot.getState() == 0xD) { - spot.id &= 0xBFFF; - spot.funcEnter = _vm->_game->_script->pos(); - spot.funcLeave = _vm->_game->_script->pos(); - } - } + uint16 endIndex = 0; + while (!_hotspots[endIndex].isEnd()) + endIndex++; - _vm->_game->_script->skipBlock(); - break; + _shouldPush = false; - case 20: - validId = i; - // Fall through to case 2 - case kTypeClick: - key = _vm->_game->_script->readInt16(); - array[i] = _vm->_game->_script->readInt16(); - flags = _vm->_game->_script->readInt16(); + _vm->_game->_script->skip(1); - funcEnter = 0; + byte count = _vm->_game->_script->readByte(); - funcLeave = _vm->_game->_script->pos(); - _vm->_game->_script->skipBlock(); + _vm->_game->_handleMouse = _vm->_game->_script->peekByte(0); + int16 duration = _vm->_game->_script->peekByte(1); + byte stackPos2 = _vm->_game->_script->peekByte(3); + byte descIndex = _vm->_game->_script->peekByte(4); + bool needRecalculation = _vm->_game->_script->peekByte(5) != 0; - flags = 2 + (window << 8) + (flags << 4); + duration *= 1000; + if ((stackPos2 != 0) || (descIndex != 0)) { + duration /= 100; + if (_vm->_game->_script->peekByte(1) == 100) + duration = 2; + } - add(i + 0x8000, left, top, right, bottom, - flags, key, funcEnter, funcLeave, funcPos); - break; + int16 timeVal = duration; - case 21: - key = _vm->_game->_script->readInt16(); - array[i] = _vm->_game->_script->readInt16(); - flags = _vm->_game->_script->readInt16() & 3; + _vm->_game->_script->skip(6); - funcEnter = _vm->_game->_script->pos(); - _vm->_game->_script->skipBlock(); + WRITE_VAR(16, 0); - funcLeave = 0; + byte var_41 = 0; + int16 var_46 = 0; - flags = 2 + (window << 8) + (flags << 4); + uint16 id = 0; + uint16 validId = 0xFFFF; + uint16 index = 0; - add(i + 0x8000, left, top, right, bottom, - flags, key, funcEnter, funcLeave, funcPos); - break; - } - } + bool hasInput = false; + uint16 inputIndex = 0; + for (uint16 i = 0; i < count; i++) + evaluateNew(i, ids, inputs, validId, hasInput, inputIndex); if (needRecalculation) recalculate(true); @@ -1368,7 +1355,7 @@ void Hotspots::evaluate() { if (hasInput) { uint16 curEditIndex = 0; - key = handleInput(duration, inputIndex, curEditIndex, descArray, id, index); + key = handleInput(duration, inputIndex, curEditIndex, inputs, id, index); WRITE_VAR(55, curEditIndex); if (key == kKeyReturn) { @@ -1454,7 +1441,7 @@ void Hotspots::evaluate() { break; if (Hotspot::getState(id) == 0x8) - WRITE_VAR(16, array[id & 0xFFF]); + WRITE_VAR(16, ids[id & 0xFFF]); else WRITE_VAR(16, id & 0xFFF); @@ -1537,7 +1524,7 @@ void Hotspots::evaluate() { _vm->_inter->storeMouse(); if (Hotspot::getState(id) == 0x8) - WRITE_VAR(16, array[id & 0xFFF]); + WRITE_VAR(16, ids[id & 0xFFF]); else WRITE_VAR(16, id & 0xFFF); @@ -1581,7 +1568,7 @@ void Hotspots::evaluate() { } if ((spot.getType() >= kTypeInput2NoLeave) && (spot.getType() <= kTypeInput3Leave)) { - str = (char *) descArray[var_24].ptr; + const char *str = inputs[var_24].str; strncpy0(tempStr, GET_VARO_STR(spot.key), 255); @@ -1605,7 +1592,7 @@ void Hotspots::evaluate() { WRITE_VAR(17 + var_26, 1); break; } - } while (READ_LE_UINT16(descArray[var_24].ptr - 2) > pos); + } while (READ_LE_UINT16(inputs[var_24].str - 2) > pos); collStackPos++; } else { WRITE_VAR(17 + var_26, 2); @@ -1629,7 +1616,7 @@ void Hotspots::evaluate() { _vm->_inter->storeMouse(); if (VAR(16) == 0) { if (Hotspot::getState(id) == 0x8) - WRITE_VAR(16, array[id & 0xFFF]); + WRITE_VAR(16, ids[id & 0xFFF]); else WRITE_VAR(16, id & 0xFFF); } diff --git a/engines/gob/hotspots.h b/engines/gob/hotspots.h index e05e37b296..a337620710 100644 --- a/engines/gob/hotspots.h +++ b/engines/gob/hotspots.h @@ -133,7 +133,7 @@ private: uint16 fontIndex; uint16 backColor; uint16 frontColor; - byte *ptr; + const char *str; }; GobEngine *_vm; @@ -175,7 +175,10 @@ void checkHotspotChanged(); Type type, int16 &duration, uint16 &id, uint16 index); uint16 handleInput(int16 time, uint16 hotspotIndex, uint16 &curPos, - InputDesc *inpDesc, uint16 &id, uint16 &index); + InputDesc *inputs, uint16 &id, uint16 &index); + + void evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, + uint16 &validId, bool &hasInput, uint16 &inputIndex); }; } // End of namespace Gob -- cgit v1.2.3 From 9f0245094b8eb2ba5626cf96498ee360a3366f27 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 19:57:08 +0000 Subject: Ooops, fixing monospaced text input again svn-id: r42146 --- engines/gob/hotspots.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index eca9a250b4..49c4c32032 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -681,7 +681,7 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh bool monoSpaced = (font.extraData == 0); uint32 pos = strlen(str); - uint32 editSize = monoSpaced ? 0 : (width / font.itemWidth); + uint32 editSize = monoSpaced ? (width / font.itemWidth) : 0; uint16 key = 0; char tempStr[256]; -- cgit v1.2.3 From 5a85a1361582b48218a914c380961ae0a8de4f68 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 19:57:22 +0000 Subject: Split off some drawing related functions svn-id: r42147 --- engines/gob/hotspots.cpp | 145 ++++++++++++++++++++++------------------------- engines/gob/hotspots.h | 6 ++ 2 files changed, 75 insertions(+), 76 deletions(-) diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index 49c4c32032..8d1bc770a7 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -664,6 +664,52 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay) { return Hotspots::check(handleMouse, delay, id, index); } +void Hotspots::printText(uint16 x, uint16 y, const char *str, uint16 fontIndex, uint16 color) { + _vm->_draw->_destSpriteX = x; + _vm->_draw->_destSpriteY = y; + _vm->_draw->_frontColor = color; + _vm->_draw->_fontIndex = fontIndex; + _vm->_draw->_textToPrint = str; + _vm->_draw->_transparency = 1; + + _vm->_draw->spriteOperation(DRAW_PRINTTEXT | 0x10); +} + +void Hotspots::fillRect(uint16 left, uint16 top, uint16 right, uint16 bottom, uint16 color) { + _vm->_draw->_destSurface = 21; + _vm->_draw->_destSpriteX = left; + _vm->_draw->_destSpriteY = top; + _vm->_draw->_spriteRight = right; + _vm->_draw->_spriteBottom = bottom; + _vm->_draw->_backColor = color; + + _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10 ); +} + +void Hotspots::getTextCursorPos(const Video::FontDesc &font, const char *str, + uint32 pos, uint16 x, uint16 y, uint16 width, uint16 height, + uint16 &left, uint16 &top, uint16 &right, uint16 &bottom) { + + if (font.extraData) { + // Cursor to the right of the current character + + left = x; + top = y; + right = 1; + bottom = height; + + for (uint32 i = 0; i < pos; i++) + left += font.extraData[str[i] - font.startItem]; + } else { + // Cursor underlining the current character + + left = x + font.itemWidth * pos; + top = y + height - 1; + right = font.itemWidth; + bottom = 1; + } +} + uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 height, uint16 backColor, uint16 frontColor, char *str, uint16 fontIndex, Type type, int16 &duration, uint16 &id, uint16 index) { @@ -676,7 +722,7 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh ((_vm->_global->_useMouse != 0) || (_vm->_game->_forceHandleMouse != 0))) handleMouse = true; - Video::FontDesc &font = *_vm->_draw->_fonts[fontIndex]; + const Video::FontDesc &font = *_vm->_draw->_fonts[fontIndex]; bool monoSpaced = (font.extraData == 0); @@ -692,21 +738,13 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh if ((editSize != 0) && strlen(tempStr) > editSize) strncpy0(tempStr, str, 255); - _vm->_draw->_destSpriteX = xPos; - _vm->_draw->_destSpriteY = yPos; - _vm->_draw->_spriteRight = monoSpaced ? (editSize * font.itemWidth) : width; - _vm->_draw->_spriteBottom = height; - - _vm->_draw->_destSurface = 21; - _vm->_draw->_backColor = backColor; - _vm->_draw->_frontColor = frontColor; - _vm->_draw->_textToPrint = tempStr; - _vm->_draw->_transparency = 1; - _vm->_draw->_fontIndex = fontIndex; - _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10 ); + // Clear input area + fillRect(xPos, yPos, + monoSpaced ? (editSize * font.itemWidth) : width, height, + backColor); - _vm->_draw->_destSpriteY = yPos + (height - font.itemHeight) / 2; - _vm->_draw->spriteOperation(DRAW_PRINTTEXT | 0x10); + printText(xPos, yPos + (height - font.itemHeight) / 2, + tempStr, fontIndex, frontColor); if ((editSize != 0) && (pos == editSize)) pos--; @@ -721,25 +759,10 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh tempStr[0] = curSym; tempStr[1] = 0; - if (font.extraData) { - _vm->_draw->_destSpriteY = yPos; - _vm->_draw->_spriteBottom = height; - _vm->_draw->_spriteRight = 1; - - _vm->_draw->_destSpriteX = xPos; - for (uint32 j = 0; j < pos; j++) - _vm->_draw->_destSpriteX += font.extraData[str[j] - font.startItem]; - - } else { - _vm->_draw->_destSpriteX = xPos + font.itemWidth * pos; - _vm->_draw->_destSpriteY = yPos + height - 1; - _vm->_draw->_spriteRight = font.itemWidth; - _vm->_draw->_spriteBottom = 1; - } - - _vm->_draw->_destSurface = 21; - _vm->_draw->_backColor = frontColor; - _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10); + // Draw cursor + uint16 left, top, right, bottom; + getTextCursorPos(font, str, pos, xPos, yPos, width, height, left, top, right, bottom); + fillRect(left, top, right, bottom, frontColor); if (first) { key = check(handleMouse, -1, id, index); @@ -754,32 +777,12 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh tempStr[0] = curSym; tempStr[1] = 0; - if (font.extraData) { - _vm->_draw->_destSpriteY = yPos; - _vm->_draw->_spriteBottom = height; - _vm->_draw->_spriteRight = 1; + // Clear cursor + getTextCursorPos(font, str, pos, xPos, yPos, width, height, left, top, right, bottom); + fillRect(left, top, right, bottom, backColor); - _vm->_draw->_destSpriteX = xPos; - for (uint32 j = 0; j < pos; j++) - _vm->_draw->_destSpriteX += font.extraData[str[j] - font.startItem]; - - } else { - _vm->_draw->_destSpriteX = xPos + font.itemWidth * pos; - _vm->_draw->_destSpriteY = yPos + height - 1; - _vm->_draw->_spriteRight = font.itemWidth; - _vm->_draw->_spriteBottom = 1; - } - - _vm->_draw->_destSurface = 21; - _vm->_draw->_backColor = backColor; - _vm->_draw->_frontColor = frontColor; - _vm->_draw->_textToPrint = tempStr; - _vm->_draw->_transparency = 1; - _vm->_draw->_fontIndex = fontIndex; - _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10); - - _vm->_draw->_destSpriteY = yPos + (height - font.itemHeight) / 2; - _vm->_draw->spriteOperation(DRAW_PRINTTEXT | 0x10); + printText(left, yPos + (height - font.itemHeight) / 2, + tempStr, fontIndex, frontColor); if ((key != 0) || (id != 0)) break; @@ -948,24 +951,14 @@ uint16 Hotspots::handleInput(int16 time, uint16 maxPos, uint16 &curPos, char tempStr[256]; strncpy0(tempStr, GET_VARO_STR(spot.key), 255); - _vm->_draw->_destSpriteX = spot.left; - _vm->_draw->_destSpriteY = spot.top; - _vm->_draw->_spriteRight = spot.right - spot.left + 1; - _vm->_draw->_spriteBottom = spot.bottom - spot.top + 1; - - _vm->_draw->_destSurface = 21; - - _vm->_draw->_backColor = inputs[descInd].backColor; - _vm->_draw->_frontColor = inputs[descInd].frontColor; - _vm->_draw->_textToPrint = tempStr; - _vm->_draw->_transparency = 1; - _vm->_draw->_fontIndex = inputs[descInd].fontIndex; - - _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10); + fillRect(spot.left, spot.top, + spot.right - spot.left + 1, spot.bottom - spot.top + 1, + inputs[descInd].backColor); - _vm->_draw->_destSpriteY += ((spot.bottom - spot.top + 1) - - _vm->_draw->_fonts[_vm->_draw->_fontIndex]->itemHeight) / 2; - _vm->_draw->spriteOperation(DRAW_PRINTTEXT | 0x10); + printText(spot.left, + spot.top + ((spot.bottom - spot.top + 1) - + _vm->_draw->_fonts[_vm->_draw->_fontIndex]->itemHeight) / 2, + tempStr, inputs[descInd].fontIndex, inputs[descInd].frontColor); descInd++; } diff --git a/engines/gob/hotspots.h b/engines/gob/hotspots.h index a337620710..adc65be251 100644 --- a/engines/gob/hotspots.h +++ b/engines/gob/hotspots.h @@ -179,6 +179,12 @@ void checkHotspotChanged(); void evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, uint16 &validId, bool &hasInput, uint16 &inputIndex); + + void printText(uint16 x, uint16 y, const char *str, uint16 fontIndex, uint16 color); + void fillRect(uint16 left, uint16 top, uint16 right, uint16 bottom, uint16 color); + void getTextCursorPos(const Video::FontDesc &font, const char *str, + uint32 pos, uint16 x, uint16 y, uint16 width, uint16 height, + uint16 &left, uint16 &top, uint16 &right, uint16 &bottom); }; } // End of namespace Gob -- cgit v1.2.3 From 62fcf1177d7782fd30ec908676e3cd287d0ae507 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 19:57:37 +0000 Subject: More input related split-offs svn-id: r42148 --- engines/gob/hotspots.cpp | 297 +++++++++++++++++++++++++---------------------- engines/gob/hotspots.h | 19 ++- 2 files changed, 172 insertions(+), 144 deletions(-) diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index 8d1bc770a7..ca345f690c 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -105,6 +105,29 @@ bool Hotspots::Hotspot::isEnd() const { return (left == 0xFFFF); } +bool Hotspots::Hotspot::isInput() const { + if (getType() < kTypeInput1NoLeave) + return false; + + if (getType() > kTypeInputFloatLeave) + return false; + + return true; +} + +bool Hotspots::Hotspot::isActiveInput() const { + if (isEnd()) + return false; + + if ((getState() & 0xC) != 0x8) + return false; + + if (!isInput()) + return false; + + return true; +} + bool Hotspots::Hotspot::isIn(uint16 x, uint16 y) const { if (x < left) return false; @@ -664,7 +687,7 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay) { return Hotspots::check(handleMouse, delay, id, index); } -void Hotspots::printText(uint16 x, uint16 y, const char *str, uint16 fontIndex, uint16 color) { +void Hotspots::printText(uint16 x, uint16 y, const char *str, uint16 fontIndex, uint16 color) const { _vm->_draw->_destSpriteX = x; _vm->_draw->_destSpriteY = y; _vm->_draw->_frontColor = color; @@ -675,12 +698,12 @@ void Hotspots::printText(uint16 x, uint16 y, const char *str, uint16 fontIndex, _vm->_draw->spriteOperation(DRAW_PRINTTEXT | 0x10); } -void Hotspots::fillRect(uint16 left, uint16 top, uint16 right, uint16 bottom, uint16 color) { +void Hotspots::fillRect(uint16 x, uint16 y, uint16 width, uint16 height, uint16 color) const { _vm->_draw->_destSurface = 21; - _vm->_draw->_destSpriteX = left; - _vm->_draw->_destSpriteY = top; - _vm->_draw->_spriteRight = right; - _vm->_draw->_spriteBottom = bottom; + _vm->_draw->_destSpriteX = x; + _vm->_draw->_destSpriteY = y; + _vm->_draw->_spriteRight = width; + _vm->_draw->_spriteBottom = height; _vm->_draw->_backColor = color; _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10 ); @@ -688,25 +711,26 @@ void Hotspots::fillRect(uint16 left, uint16 top, uint16 right, uint16 bottom, ui void Hotspots::getTextCursorPos(const Video::FontDesc &font, const char *str, uint32 pos, uint16 x, uint16 y, uint16 width, uint16 height, - uint16 &left, uint16 &top, uint16 &right, uint16 &bottom) { + uint16 &cursorX, uint16 &cursorY, uint16 &cursorWidth, uint16 &cursorHeight) const { if (font.extraData) { // Cursor to the right of the current character - left = x; - top = y; - right = 1; - bottom = height; + cursorX = x; + cursorY = y; + cursorWidth = 1; + cursorHeight = height; for (uint32 i = 0; i < pos; i++) - left += font.extraData[str[i] - font.startItem]; + cursorX += font.extraData[str[i] - font.startItem]; + } else { // Cursor underlining the current character - left = x + font.itemWidth * pos; - top = y + height - 1; - right = font.itemWidth; - bottom = 1; + cursorX = x + font.itemWidth * pos; + cursorY = y + height - 1; + cursorWidth = font.itemWidth; + cursorHeight = 1; } } @@ -760,9 +784,10 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh tempStr[1] = 0; // Draw cursor - uint16 left, top, right, bottom; - getTextCursorPos(font, str, pos, xPos, yPos, width, height, left, top, right, bottom); - fillRect(left, top, right, bottom, frontColor); + uint16 cursorX, cursorY, cursorWidth, cursorHeight; + getTextCursorPos(font, str, pos, xPos, yPos, width, height, + cursorX, cursorY, cursorWidth, cursorHeight); + fillRect(cursorX, cursorY, cursorWidth, cursorHeight, frontColor); if (first) { key = check(handleMouse, -1, id, index); @@ -778,10 +803,11 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh tempStr[1] = 0; // Clear cursor - getTextCursorPos(font, str, pos, xPos, yPos, width, height, left, top, right, bottom); - fillRect(left, top, right, bottom, backColor); + getTextCursorPos(font, str, pos, xPos, yPos, width, height, + cursorX, cursorY, cursorWidth, cursorHeight); + fillRect(cursorX, cursorY, cursorWidth, cursorHeight, backColor); - printText(left, yPos + (height - font.itemHeight) / 2, + printText(cursorX, yPos + (height - font.itemHeight) / 2, tempStr, fontIndex, frontColor); if ((key != 0) || (id != 0)) @@ -926,15 +952,11 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh } } -uint16 Hotspots::handleInput(int16 time, uint16 maxPos, uint16 &curPos, - InputDesc *inputs, uint16 &id, uint16 &index) { - - uint16 descInd = 0; - uint16 key = 0; - uint16 found = 0xFFFF; +void Hotspots::updateAllTexts(const InputDesc *inputs) const { + uint16 input = 0; for (int i = 0; i < kHotspotCount; i++) { - Hotspot &spot = _hotspots[i]; + const Hotspot &spot = _hotspots[i]; if (spot.isEnd()) continue; @@ -942,129 +964,124 @@ uint16 Hotspots::handleInput(int16 time, uint16 maxPos, uint16 &curPos, if ((spot.getState() & 0xC) != 0x8) continue; - if (spot.getType() < kTypeInput1NoLeave) - continue; - - if (spot.getType() > kTypeInputFloatLeave) + if (!spot.isInput()) continue; char tempStr[256]; strncpy0(tempStr, GET_VARO_STR(spot.key), 255); - fillRect(spot.left, spot.top, - spot.right - spot.left + 1, spot.bottom - spot.top + 1, - inputs[descInd].backColor); + uint16 x = spot.left; + uint16 y = spot.top; + uint16 width = spot.right - spot.left + 1; + uint16 height = spot.bottom - spot.top + 1; + fillRect(x, y, width, height, inputs[input].backColor); + + y += (width - _vm->_draw->_fonts[_vm->_draw->_fontIndex]->itemHeight) / 2; - printText(spot.left, - spot.top + ((spot.bottom - spot.top + 1) - - _vm->_draw->_fonts[_vm->_draw->_fontIndex]->itemHeight) / 2, - tempStr, inputs[descInd].fontIndex, inputs[descInd].frontColor); + printText(x, y, tempStr, inputs[input].fontIndex, inputs[input].frontColor); - descInd++; + input++; } +} - for (int i = 0; i < 40; i++) - WRITE_VAR_OFFSET(i * 4 + 0x44, 0); +uint16 Hotspots::findInput(uint16 input) const { + uint16 inputIndex = 0; + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; - while (1) { - descInd = 0; + if (!spot.isActiveInput()) + continue; - for (int i = 0; i < kHotspotCount; i++) { - Hotspot &spot = _hotspots[i]; + if (inputIndex == input) + return i; - if (spot.isEnd()) - continue; + inputIndex++; + } - if ((spot.getState() & 0xC) != 0x8) - continue; + return 0xFFFF; +} - if (spot.getType() < kTypeInput1NoLeave) - continue; +uint16 Hotspots::findClickedInput(uint16 index) const { + for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { + Hotspot &spot = _hotspots[i]; - if (spot.getType() > kTypeInputFloatLeave) - continue; + if (spot.getWindow() != 0) + continue; - if (descInd == curPos) { - found = i; - break; - } + if (spot.getState() & 0x4) + continue; - descInd++; - } + if (!spot.isIn(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY)) + continue; - assert(found != 0xFFFF); + if (spot.getCursor() != 0) + continue; - Hotspot inputSpot = _hotspots[found]; + if (!spot.isInput()) + continue; - key = readString(inputSpot.left, inputSpot.top, - inputSpot.right - inputSpot.left + 1, - inputSpot.bottom - inputSpot.top + 1, - inputs[curPos].backColor, inputs[curPos].frontColor, - GET_VARO_STR(inputSpot.key), inputs[curPos].fontIndex, - inputSpot.getType(), time, id, index); + index = i; + break; + } - if (_vm->_inter->_terminate) - return 0; + return index; +} - switch (key) { - case kKeyNone: - if (id == 0) - return 0; +uint16 Hotspots::findNthInput(uint16 n) const { + uint16 input = 0; - if (_vm->_game->_mouseButtons != kMouseButtonsNone) { - for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { - Hotspot &spot = _hotspots[i]; + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; - if (spot.getWindow() != 0) - continue; + if (!spot.isActiveInput()) + continue; - if (spot.getState() & 0x4) - continue; + if (i == n) + break; - if (!spot.isIn(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY)) - continue; + input++; + } - if (spot.getCursor() != 0) - continue; + return input; +} - if (spot.getType() < kTypeInput1NoLeave) - continue; +uint16 Hotspots::handleInput(int16 time, uint16 inputCount, uint16 &curInput, + InputDesc *inputs, uint16 &id, uint16 &index) { - if (spot.getType() > kTypeInputFloatLeave) - continue; + updateAllTexts(inputs); - index = i; - break; - } - } + for (int i = 0; i < 40; i++) + WRITE_VAR_OFFSET(i * 4 + 0x44, 0); - if (_hotspots[index].getType() < kTypeInput1NoLeave) - return 0; + while (1) { + uint16 hotspotIndex = findInput(curInput); - if (_hotspots[index].getType() > kTypeInputFloatLeave) - return 0; + assert(hotspotIndex != 0xFFFF); - curPos = 0; - for (int i = 0; i < kHotspotCount; i++) { - Hotspot &spot = _hotspots[i]; + Hotspot inputSpot = _hotspots[hotspotIndex]; - if (spot.isEnd()) - continue; + uint16 key = readString(inputSpot.left, inputSpot.top, + inputSpot.right - inputSpot.left + 1, + inputSpot.bottom - inputSpot.top + 1, + inputs[curInput].backColor, inputs[curInput].frontColor, + GET_VARO_STR(inputSpot.key), inputs[curInput].fontIndex, + inputSpot.getType(), time, id, index); - if ((spot.getState() & 0xC) != 0x8) - continue; + if (_vm->_inter->_terminate) + return 0; - if (spot.getType() < kTypeInput1NoLeave) - continue; + switch (key) { + case kKeyNone: + if (id == 0) + return 0; - if (spot.getType() > kTypeInputFloatLeave) - continue; + if (_vm->_game->_mouseButtons != kMouseButtonsNone) + index = findClickedInput(index); - if (i == index) - break; + if (!_hotspots[index].isInput()) + return 0; - curPos++; - } + curInput = findNthInput(index); break; case kKeyF1: @@ -1081,32 +1098,37 @@ uint16 Hotspots::handleInput(int16 time, uint16 maxPos, uint16 &curPos, case kKeyReturn: - if (maxPos == 1) - return key; + // Just one input => return + if (inputCount == 1) + return kKeyReturn; - if (curPos == (maxPos - 1)) { - curPos = 0; + // End of input chain reached => wap + if (curInput == (inputCount - 1)) { + curInput = 0; break; } - curPos++; + // Next input + curInput++; break; case kKeyDown: - if ((maxPos - 1) > curPos) - curPos++; + // Next input + if ((inputCount - 1) > curInput) + curInput++; break; case kKeyUp: - if (curPos > 0) - curPos--; + // Previous input + if (curInput > 0) + curInput--; break; } } } void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, - uint16 &validId, bool &hasInput, uint16 &inputIndex) { + uint16 &validId, bool &hasInput, uint16 &inputCount) { ids[i] = 0; @@ -1218,13 +1240,13 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, // Input text parameters key = _vm->_game->_script->readVarIndex(); - inputs[inputIndex].fontIndex = _vm->_game->_script->readInt16(); - inputs[inputIndex].backColor = _vm->_game->_script->readByte(); - inputs[inputIndex].frontColor = _vm->_game->_script->readByte(); - inputs[inputIndex].str = 0; + inputs[inputCount].fontIndex = _vm->_game->_script->readInt16(); + inputs[inputCount].backColor = _vm->_game->_script->readByte(); + inputs[inputCount].frontColor = _vm->_game->_script->readByte(); + inputs[inputCount].str = 0; if ((type >= kTypeInput2NoLeave) && (type <= kTypeInput3Leave)) { - inputs[inputIndex].str = + inputs[inputCount].str = (const char *) (_vm->_game->_script->getData() + _vm->_game->_script->pos() + 2); _vm->_game->_script->skip(_vm->_game->_script->peekUint16() + 2); } @@ -1235,7 +1257,7 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, break; } - font = _vm->_draw->_fonts[inputs[inputIndex].fontIndex]; + font = _vm->_draw->_fonts[inputs[inputCount].fontIndex]; if (!font->extraData) right = left + width * font->itemWidth - 1; @@ -1249,7 +1271,7 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, flags = type; - inputIndex++; + inputCount++; break; case 20: @@ -1333,9 +1355,9 @@ void Hotspots::evaluate() { uint16 index = 0; bool hasInput = false; - uint16 inputIndex = 0; + uint16 inputCount = 0; for (uint16 i = 0; i < count; i++) - evaluateNew(i, ids, inputs, validId, hasInput, inputIndex); + evaluateNew(i, ids, inputs, validId, hasInput, inputCount); if (needRecalculation) recalculate(true); @@ -1346,11 +1368,11 @@ void Hotspots::evaluate() { do { uint16 key = 0; if (hasInput) { - uint16 curEditIndex = 0; + uint16 curInput = 0; - key = handleInput(duration, inputIndex, curEditIndex, inputs, id, index); + key = handleInput(duration, inputCount, curInput, inputs, id, index); - WRITE_VAR(55, curEditIndex); + WRITE_VAR(55, curInput); if (key == kKeyReturn) { for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; @@ -1543,10 +1565,7 @@ void Hotspots::evaluate() { if ((spot.getState() & 0xC) != 0x8) continue; - if (spot.getType() < kTypeInput1NoLeave) - continue; - - if (spot.getType() > kTypeInputFloatLeave) + if (!spot.isInput()) continue; if (spot.getType() > kTypeInput3Leave) { diff --git a/engines/gob/hotspots.h b/engines/gob/hotspots.h index adc65be251..b47cf39980 100644 --- a/engines/gob/hotspots.h +++ b/engines/gob/hotspots.h @@ -112,6 +112,9 @@ private: /** Is this hotspot the block end marker? */ bool isEnd() const; + bool isInput() const; + bool isActiveInput() const; + /** Are the specified coordinates in the hotspot? */ bool isIn(uint16 x, uint16 y) const; /** Does the specified button trigger the hotspot? */ @@ -174,17 +177,23 @@ void checkHotspotChanged(); uint16 backColor, uint16 frontColor, char *str, uint16 fontIndex, Type type, int16 &duration, uint16 &id, uint16 index); - uint16 handleInput(int16 time, uint16 hotspotIndex, uint16 &curPos, + uint16 handleInput(int16 time, uint16 inputCount, uint16 &curInput, InputDesc *inputs, uint16 &id, uint16 &index); void evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, - uint16 &validId, bool &hasInput, uint16 &inputIndex); + uint16 &validId, bool &hasInput, uint16 &inputCount); + + void updateAllTexts(const InputDesc *inputs) const; + + uint16 findInput(uint16 input) const; + uint16 findClickedInput(uint16 index) const; + uint16 findNthInput(uint16 n) const; - void printText(uint16 x, uint16 y, const char *str, uint16 fontIndex, uint16 color); - void fillRect(uint16 left, uint16 top, uint16 right, uint16 bottom, uint16 color); + void printText(uint16 x, uint16 y, const char *str, uint16 fontIndex, uint16 color) const; + void fillRect(uint16 x, uint16 y, uint16 width, uint16 height, uint16 color) const; void getTextCursorPos(const Video::FontDesc &font, const char *str, uint32 pos, uint16 x, uint16 y, uint16 width, uint16 height, - uint16 &left, uint16 &top, uint16 &right, uint16 &bottom); + uint16 &cursorX, uint16 &cursorY, uint16 &cursorWidth, uint16 &cursorHeight) const; }; } // End of namespace Gob -- cgit v1.2.3 From d6c99ae861aa857b24023ecc66bd1507fa895ecd Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 19:57:55 +0000 Subject: Renaming FontDesc::extraData to charWidths svn-id: r42149 --- engines/gob/draw.cpp | 14 +++++++------- engines/gob/draw_v2.cpp | 4 ++-- engines/gob/hotspots.cpp | 12 ++++++------ engines/gob/util.cpp | 4 ++-- engines/gob/video.h | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp index b3e5e7418c..c20bece7b4 100644 --- a/engines/gob/draw.cpp +++ b/engines/gob/draw.cpp @@ -360,9 +360,9 @@ int Draw::stringLength(const char *str, int16 fontIndex) { } else { - if (_fonts[fontIndex]->extraData) + if (_fonts[fontIndex]->charWidths) while (*str != 0) - len += *(_fonts[fontIndex]->extraData + (*str++ - _fonts[fontIndex]->startItem)); + len += *(_fonts[fontIndex]->charWidths + (*str++ - _fonts[fontIndex]->startItem)); else len = (strlen(str) * _fonts[fontIndex]->itemWidth); @@ -376,10 +376,10 @@ void Draw::drawString(const char *str, int16 x, int16 y, int16 color1, int16 col while (*str != '\0') { _vm->_video->drawLetter(*str, x, y, font, transp, color1, color2, dest); - if (!font->extraData) + if (!font->charWidths) x += font->itemWidth; else - x += *(font->extraData + (*str - font->startItem)); + x += *(font->charWidths + (*str - font->startItem)); str++; } } @@ -415,12 +415,12 @@ void Draw::printTextCentered(int16 id, int16 left, int16 top, int16 right, _fontIndex = fontIndex; _frontColor = color; _textToPrint = str; - if (_fonts[fontIndex]->extraData != 0) { - byte *data = _fonts[fontIndex]->extraData; + if (_fonts[fontIndex]->charWidths != 0) { + uint8 *widths = _fonts[fontIndex]->charWidths; int length = strlen(str); for (int i = 0; i < length; i++) - width += *(data + (str[i] - _fonts[_fontIndex]->startItem)); + width += *(widths + (str[i] - _fonts[_fontIndex]->startItem)); } else width = strlen(str) * _fonts[fontIndex]->itemWidth; diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp index e09c565b79..a0be23516c 100644 --- a/engines/gob/draw_v2.cpp +++ b/engines/gob/draw_v2.cpp @@ -762,7 +762,7 @@ void Draw_v2::spriteOperation(int16 operation) { if ((_fontIndex >= 4) || (_fontToSprite[_fontIndex].sprite == -1)) { - if (!_fonts[_fontIndex]->extraData) { + if (!_fonts[_fontIndex]->charWidths) { if (((int8) _textToPrint[0]) == -1) { _vm->validateLanguage(); @@ -785,7 +785,7 @@ void Draw_v2::spriteOperation(int16 operation) { _vm->_video->drawLetter(_textToPrint[i], _destSpriteX, _destSpriteY, _fonts[_fontIndex], _transparency, _frontColor, _backColor, *_spritesArray[_destSurface]); - _destSpriteX += *(_fonts[_fontIndex]->extraData + + _destSpriteX += *(_fonts[_fontIndex]->charWidths + (_textToPrint[i] - _fonts[_fontIndex]->startItem)); } else diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index ca345f690c..7cbefcc922 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -713,7 +713,7 @@ void Hotspots::getTextCursorPos(const Video::FontDesc &font, const char *str, uint32 pos, uint16 x, uint16 y, uint16 width, uint16 height, uint16 &cursorX, uint16 &cursorY, uint16 &cursorWidth, uint16 &cursorHeight) const { - if (font.extraData) { + if (font.charWidths) { // Cursor to the right of the current character cursorX = x; @@ -722,7 +722,7 @@ void Hotspots::getTextCursorPos(const Video::FontDesc &font, const char *str, cursorHeight = height; for (uint32 i = 0; i < pos; i++) - cursorX += font.extraData[str[i] - font.startItem]; + cursorX += font.charWidths[str[i] - font.startItem]; } else { // Cursor underlining the current character @@ -748,7 +748,7 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh const Video::FontDesc &font = *_vm->_draw->_fonts[fontIndex]; - bool monoSpaced = (font.extraData == 0); + bool monoSpaced = (font.charWidths == 0); uint32 pos = strlen(str); uint32 editSize = monoSpaced ? (width / font.itemWidth) : 0; @@ -925,8 +925,8 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh if ((key >= ' ') && (key <= 0xFF)) { if (editSize == 0) { int length = _vm->_draw->stringLength(str, fontIndex) + - font.extraData[' ' - font.startItem] + - font.extraData[key - font.startItem]; + font.charWidths[' ' - font.startItem] + + font.charWidths[key - font.startItem]; if (length > width) continue; @@ -1258,7 +1258,7 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, } font = _vm->_draw->_fonts[inputs[inputCount].fontIndex]; - if (!font->extraData) + if (!font->charWidths) right = left + width * font->itemWidth - 1; funcEnter = 0; diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index bb206eb52d..429b0269cf 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -403,10 +403,10 @@ Video::FontDesc *Util::loadFont(const char *path) { fontDesc->bitWidth = fontDesc->itemWidth; if (data[0] & 0x80) - fontDesc->extraData = data + 4 + fontDesc->itemSize * + fontDesc->charWidths = data + 4 + fontDesc->itemSize * (fontDesc->endItem - fontDesc->startItem + 1); else - fontDesc->extraData = 0; + fontDesc->charWidths = 0; return fontDesc; } diff --git a/engines/gob/video.h b/engines/gob/video.h index c71a18daa6..8716a637c2 100644 --- a/engines/gob/video.h +++ b/engines/gob/video.h @@ -78,7 +78,7 @@ public: uint8 endItem; int8 itemSize; int8 bitWidth; - byte *extraData; + uint8 *charWidths; FontDesc() : dataPtr(0), itemWidth(0), itemHeight(0), startItem(0), endItem(0), itemSize(0), bitWidth(0) {} ~FontDesc() { -- cgit v1.2.3 From c88b9be2a79abf97eed1997337b450a2920afe3b Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 19:58:09 +0000 Subject: Reordering some methods svn-id: r42150 --- engines/gob/hotspots.cpp | 280 +++++++++++++++++++++++------------------------ engines/gob/hotspots.h | 14 ++- 2 files changed, 149 insertions(+), 145 deletions(-) diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index 7cbefcc922..2982fc101e 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -687,53 +687,6 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay) { return Hotspots::check(handleMouse, delay, id, index); } -void Hotspots::printText(uint16 x, uint16 y, const char *str, uint16 fontIndex, uint16 color) const { - _vm->_draw->_destSpriteX = x; - _vm->_draw->_destSpriteY = y; - _vm->_draw->_frontColor = color; - _vm->_draw->_fontIndex = fontIndex; - _vm->_draw->_textToPrint = str; - _vm->_draw->_transparency = 1; - - _vm->_draw->spriteOperation(DRAW_PRINTTEXT | 0x10); -} - -void Hotspots::fillRect(uint16 x, uint16 y, uint16 width, uint16 height, uint16 color) const { - _vm->_draw->_destSurface = 21; - _vm->_draw->_destSpriteX = x; - _vm->_draw->_destSpriteY = y; - _vm->_draw->_spriteRight = width; - _vm->_draw->_spriteBottom = height; - _vm->_draw->_backColor = color; - - _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10 ); -} - -void Hotspots::getTextCursorPos(const Video::FontDesc &font, const char *str, - uint32 pos, uint16 x, uint16 y, uint16 width, uint16 height, - uint16 &cursorX, uint16 &cursorY, uint16 &cursorWidth, uint16 &cursorHeight) const { - - if (font.charWidths) { - // Cursor to the right of the current character - - cursorX = x; - cursorY = y; - cursorWidth = 1; - cursorHeight = height; - - for (uint32 i = 0; i < pos; i++) - cursorX += font.charWidths[str[i] - font.startItem]; - - } else { - // Cursor underlining the current character - - cursorX = x + font.itemWidth * pos; - cursorY = y + height - 1; - cursorWidth = font.itemWidth; - cursorHeight = 1; - } -} - uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 height, uint16 backColor, uint16 frontColor, char *str, uint16 fontIndex, Type type, int16 &duration, uint16 &id, uint16 index) { @@ -952,99 +905,6 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh } } -void Hotspots::updateAllTexts(const InputDesc *inputs) const { - uint16 input = 0; - - for (int i = 0; i < kHotspotCount; i++) { - const Hotspot &spot = _hotspots[i]; - - if (spot.isEnd()) - continue; - - if ((spot.getState() & 0xC) != 0x8) - continue; - - if (!spot.isInput()) - continue; - - char tempStr[256]; - strncpy0(tempStr, GET_VARO_STR(spot.key), 255); - - uint16 x = spot.left; - uint16 y = spot.top; - uint16 width = spot.right - spot.left + 1; - uint16 height = spot.bottom - spot.top + 1; - fillRect(x, y, width, height, inputs[input].backColor); - - y += (width - _vm->_draw->_fonts[_vm->_draw->_fontIndex]->itemHeight) / 2; - - printText(x, y, tempStr, inputs[input].fontIndex, inputs[input].frontColor); - - input++; - } -} - -uint16 Hotspots::findInput(uint16 input) const { - uint16 inputIndex = 0; - for (int i = 0; i < kHotspotCount; i++) { - Hotspot &spot = _hotspots[i]; - - if (!spot.isActiveInput()) - continue; - - if (inputIndex == input) - return i; - - inputIndex++; - } - - return 0xFFFF; -} - -uint16 Hotspots::findClickedInput(uint16 index) const { - for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { - Hotspot &spot = _hotspots[i]; - - if (spot.getWindow() != 0) - continue; - - if (spot.getState() & 0x4) - continue; - - if (!spot.isIn(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY)) - continue; - - if (spot.getCursor() != 0) - continue; - - if (!spot.isInput()) - continue; - - index = i; - break; - } - - return index; -} - -uint16 Hotspots::findNthInput(uint16 n) const { - uint16 input = 0; - - for (int i = 0; i < kHotspotCount; i++) { - Hotspot &spot = _hotspots[i]; - - if (!spot.isActiveInput()) - continue; - - if (i == n) - break; - - input++; - } - - return input; -} - uint16 Hotspots::handleInput(int16 time, uint16 inputCount, uint16 &curInput, InputDesc *inputs, uint16 &id, uint16 &index) { @@ -1672,4 +1532,144 @@ int16 Hotspots::findCursor(uint16 x, uint16 y) const { return cursor; } +uint16 Hotspots::findInput(uint16 input) const { + uint16 inputIndex = 0; + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (!spot.isActiveInput()) + continue; + + if (inputIndex == input) + return i; + + inputIndex++; + } + + return 0xFFFF; +} + +uint16 Hotspots::findClickedInput(uint16 index) const { + for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { + Hotspot &spot = _hotspots[i]; + + if (spot.getWindow() != 0) + continue; + + if (spot.getState() & 0x4) + continue; + + if (!spot.isIn(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY)) + continue; + + if (spot.getCursor() != 0) + continue; + + if (!spot.isInput()) + continue; + + index = i; + break; + } + + return index; +} + +uint16 Hotspots::findNthInput(uint16 n) const { + uint16 input = 0; + + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (!spot.isActiveInput()) + continue; + + if (i == n) + break; + + input++; + } + + return input; +} + +void Hotspots::getTextCursorPos(const Video::FontDesc &font, const char *str, + uint32 pos, uint16 x, uint16 y, uint16 width, uint16 height, + uint16 &cursorX, uint16 &cursorY, uint16 &cursorWidth, uint16 &cursorHeight) const { + + if (font.charWidths) { + // Cursor to the right of the current character + + cursorX = x; + cursorY = y; + cursorWidth = 1; + cursorHeight = height; + + for (uint32 i = 0; i < pos; i++) + cursorX += font.charWidths[str[i] - font.startItem]; + + } else { + // Cursor underlining the current character + + cursorX = x + font.itemWidth * pos; + cursorY = y + height - 1; + cursorWidth = font.itemWidth; + cursorHeight = 1; + } +} + +void Hotspots::fillRect(uint16 x, uint16 y, uint16 width, uint16 height, uint16 color) const { + _vm->_draw->_destSurface = 21; + _vm->_draw->_destSpriteX = x; + _vm->_draw->_destSpriteY = y; + _vm->_draw->_spriteRight = width; + _vm->_draw->_spriteBottom = height; + _vm->_draw->_backColor = color; + + _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10 ); +} + +void Hotspots::printText(uint16 x, uint16 y, const char *str, uint16 fontIndex, uint16 color) const { + _vm->_draw->_destSpriteX = x; + _vm->_draw->_destSpriteY = y; + _vm->_draw->_frontColor = color; + _vm->_draw->_fontIndex = fontIndex; + _vm->_draw->_textToPrint = str; + _vm->_draw->_transparency = 1; + + _vm->_draw->spriteOperation(DRAW_PRINTTEXT | 0x10); +} + +void Hotspots::updateAllTexts(const InputDesc *inputs) const { + uint16 input = 0; + + for (int i = 0; i < kHotspotCount; i++) { + const Hotspot &spot = _hotspots[i]; + + if (spot.isEnd()) + continue; + + if ((spot.getState() & 0xC) != 0x8) + continue; + + if (!spot.isInput()) + continue; + + char tempStr[256]; + strncpy0(tempStr, GET_VARO_STR(spot.key), 255); + + uint16 x = spot.left; + uint16 y = spot.top; + uint16 width = spot.right - spot.left + 1; + uint16 height = spot.bottom - spot.top + 1; + fillRect(x, y, width, height, inputs[input].backColor); + + y += (width - _vm->_draw->_fonts[_vm->_draw->_fontIndex]->itemHeight) / 2; + + printText(x, y, tempStr, inputs[input].fontIndex, inputs[input].frontColor); + + input++; + } +} + } // End of namespace Gob diff --git a/engines/gob/hotspots.h b/engines/gob/hotspots.h index b47cf39980..1801a10591 100644 --- a/engines/gob/hotspots.h +++ b/engines/gob/hotspots.h @@ -171,7 +171,7 @@ private: /** Which hotspot is the mouse cursor currently at? */ uint16 checkMouse(Type type, uint16 &id, uint16 &index) const; -void checkHotspotChanged(); + void checkHotspotChanged(); uint16 readString(uint16 xPos, uint16 yPos, uint16 width, uint16 height, uint16 backColor, uint16 frontColor, char *str, uint16 fontIndex, @@ -183,17 +183,21 @@ void checkHotspotChanged(); void evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, uint16 &validId, bool &hasInput, uint16 &inputCount); - void updateAllTexts(const InputDesc *inputs) const; - + // Finding certain inputs uint16 findInput(uint16 input) const; uint16 findClickedInput(uint16 index) const; uint16 findNthInput(uint16 n) const; - void printText(uint16 x, uint16 y, const char *str, uint16 fontIndex, uint16 color) const; - void fillRect(uint16 x, uint16 y, uint16 width, uint16 height, uint16 color) const; + /** Calculate the graphical cursor position. */ void getTextCursorPos(const Video::FontDesc &font, const char *str, uint32 pos, uint16 x, uint16 y, uint16 width, uint16 height, uint16 &cursorX, uint16 &cursorY, uint16 &cursorWidth, uint16 &cursorHeight) const; + + // Drawing functions + void fillRect(uint16 x, uint16 y, uint16 width, uint16 height, uint16 color) const; + void printText(uint16 x, uint16 y, const char *str, uint16 fontIndex, uint16 color) const; + + void updateAllTexts(const InputDesc *inputs) const; }; } // End of namespace Gob -- cgit v1.2.3 From 50108e9135ad0ad4b6725e7df9677fff869c44bd Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 21:39:55 +0000 Subject: Renaming the last occurences of "Collision" to "Hotspot" svn-id: r42153 --- engines/gob/gob.cpp | 2 +- engines/gob/gob.h | 2 +- engines/gob/inter.h | 6 +++--- engines/gob/inter_v2.cpp | 8 ++++---- engines/gob/inter_v6.cpp | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 35b3c0d662..8605dfbd52 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -126,7 +126,7 @@ GobEngine::GobEngine(OSystem *syst) : Engine(syst) { Common::addDebugChannel(kDebugSaveLoad, "SaveLoad", "Saving/Loading debug level"); Common::addDebugChannel(kDebugGraphics, "Graphics", "Graphics debug level"); Common::addDebugChannel(kDebugVideo, "Video", "IMD/VMD video debug level"); - Common::addDebugChannel(kDebugCollisions, "Collisions", "Collisions debug level"); + Common::addDebugChannel(kDebugHotspots, "Hotspots", "Hotspots debug level"); Common::addDebugChannel(kDebugDemo, "Demo", "Demo script debug level"); syst->getEventManager()->registerRandomSource(_rnd, "gob"); diff --git a/engines/gob/gob.h b/engines/gob/gob.h index 5d1cb3ecf2..5047382316 100644 --- a/engines/gob/gob.h +++ b/engines/gob/gob.h @@ -133,7 +133,7 @@ enum { kDebugSaveLoad = 1 << 7, kDebugGraphics = 1 << 8, kDebugVideo = 1 << 9, - kDebugCollisions = 1 << 10, + kDebugHotspots = 1 << 10, kDebugDemo = 1 << 11 }; diff --git a/engines/gob/inter.h b/engines/gob/inter.h index 9d983f4fe7..a31860885f 100644 --- a/engines/gob/inter.h +++ b/engines/gob/inter.h @@ -380,8 +380,8 @@ protected: bool o2_assign(OpFuncParams ¶ms); bool o2_printText(OpFuncParams ¶ms); bool o2_animPalInit(OpFuncParams ¶ms); - bool o2_addCollision(OpFuncParams ¶ms); - bool o2_freeCollision(OpFuncParams ¶ms); + bool o2_addHotspot(OpFuncParams ¶ms); + bool o2_removeHotspot(OpFuncParams ¶ms); bool o2_goblinFunc(OpFuncParams ¶ms); bool o2_stopSound(OpFuncParams ¶ms); bool o2_loadSound(OpFuncParams ¶ms); @@ -541,7 +541,7 @@ protected: bool o6_loadCursor(OpFuncParams ¶ms); bool o6_assign(OpFuncParams ¶ms); bool o6_palLoad(OpFuncParams ¶ms); - bool o6_freeCollision(OpFuncParams ¶ms); + bool o6_removeHotspot(OpFuncParams ¶ms); bool o6_fillRect(OpFuncParams ¶ms); void probe16bitMusic(char *fileName); diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index e82448c12c..746816303c 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -122,8 +122,8 @@ void Inter_v2::setupOpcodesFunc() { OPCODEFUNC(0x17, o2_animPalInit); - OPCODEFUNC(0x18, o2_addCollision); - OPCODEFUNC(0x19, o2_freeCollision); + OPCODEFUNC(0x18, o2_addHotspot); + OPCODEFUNC(0x19, o2_removeHotspot); OPCODEFUNC(0x25, o2_goblinFunc); @@ -1177,7 +1177,7 @@ bool Inter_v2::o2_animPalInit(OpFuncParams ¶ms) { return false; } -bool Inter_v2::o2_addCollision(OpFuncParams ¶ms) { +bool Inter_v2::o2_addHotspot(OpFuncParams ¶ms) { int16 id = _vm->_game->_script->readValExpr(); uint16 funcPos = _vm->_game->_script->pos(); int16 left = _vm->_game->_script->readValExpr(); @@ -1211,7 +1211,7 @@ bool Inter_v2::o2_addCollision(OpFuncParams ¶ms) { return false; } -bool Inter_v2::o2_freeCollision(OpFuncParams ¶ms) { +bool Inter_v2::o2_removeHotspot(OpFuncParams ¶ms) { int16 id = _vm->_game->_script->readValExpr(); if (id == -2) diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index 15e2cc9481..67bf87a7da 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -66,7 +66,7 @@ void Inter_v6::setupOpcodesFunc() { OPCODEFUNC(0x03, o6_loadCursor); OPCODEFUNC(0x09, o6_assign); OPCODEFUNC(0x13, o6_palLoad); - OPCODEFUNC(0x19, o6_freeCollision); + OPCODEFUNC(0x19, o6_removeHotspot); OPCODEFUNC(0x33, o6_fillRect); } @@ -353,7 +353,7 @@ bool Inter_v6::o6_palLoad(OpFuncParams ¶ms) { return false; } -bool Inter_v6::o6_freeCollision(OpFuncParams ¶ms) { +bool Inter_v6::o6_removeHotspot(OpFuncParams ¶ms) { int16 id; id = _vm->_game->_script->readValExpr(); -- cgit v1.2.3 From 29e97533c1b884e231feb01ed99fd8ae17a3564d Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 21:40:20 +0000 Subject: Adding some hotspot debug messages svn-id: r42154 --- engines/gob/hotspots.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index 2982fc101e..f2116209d7 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -215,6 +215,10 @@ uint16 Hotspots::add(const Hotspot &hotspot) { // Remember the current script spot.script = _vm->_game->_script; + debugC(1, kDebugHotspots, "Adding hotspot %03d: %3d+%3d+%3d+%3d - %04X, %04X, %04X - %5d, %5d, %5d", + i, spot.left, spot.top, spot.right, spot.bottom, + spot.id, spot.key, spot.flags, spot.funcEnter, spot.funcLeave, spot.funcPos); + return i; } @@ -224,8 +228,10 @@ uint16 Hotspots::add(const Hotspot &hotspot) { void Hotspots::remove(uint16 id) { for (int i = 0; i < kHotspotCount; i++) { - if (_hotspots[i].id == id) + if (_hotspots[i].id == id) { + debugC(1, kDebugHotspots, "Removing hotspot %d: %X", i, id); _hotspots[i].clear(); + } } } @@ -233,12 +239,16 @@ void Hotspots::removeState(uint8 state) { for (int i = 0; i < kHotspotCount; i++) { Hotspot &spot = _hotspots[i]; - if (spot.getState() == state) + if (spot.getState() == state) { + debugC(1, kDebugHotspots, "Removing hotspot %d: %X (by state %X)", i, spot.id, state); spot.clear(); + } } } void Hotspots::recalculate(bool force) { + debugC(5, kDebugHotspots, "Recalculating hotspots"); + for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; @@ -302,6 +312,8 @@ void Hotspots::recalculate(bool force) { } void Hotspots::push(uint8 all, bool force) { + debugC(1, kDebugHotspots, "Pushing hotspots (%d, %d)", all, force); + // Should we push at all? if (!_shouldPush && !force) return; @@ -366,6 +378,8 @@ void Hotspots::push(uint8 all, bool force) { } void Hotspots::pop() { + debugC(1, kDebugHotspots, "Popping hotspots"); + assert(!_stack.empty()); StackEntry backup = _stack.pop(); @@ -405,6 +419,8 @@ bool Hotspots::isValid(uint16 key, uint16 id, uint16 index) const { } void Hotspots::call(uint16 offset) { + debugC(4, kDebugHotspots, "Calling hotspot function %d", offset); + _vm->_game->_script->call(offset); _shouldPush = true; @@ -424,6 +440,8 @@ void Hotspots::call(uint16 offset) { } void Hotspots::enter(uint16 index) { + debugC(2, kDebugHotspots, "Entering hotspot %d", index); + if (index >= kHotspotCount) { warning("Hotspots::enter(): Index %d out of range", index); return; @@ -439,6 +457,8 @@ void Hotspots::enter(uint16 index) { } void Hotspots::leave(uint16 index) { + debugC(2, kDebugHotspots, "Leaving hotspot %d", index); + if (index >= kHotspotCount) { warning("Hotspots::leave(): Index %d out of range", index); return; -- cgit v1.2.3 From edfaf7bc3c770c008be81f9ccb26835185d7d7d5 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 21:40:51 +0000 Subject: Added an enum for the hotspot states svn-id: r42155 --- engines/gob/hotspots.cpp | 122 ++++++++++++++++++++++++++++++----------------- engines/gob/hotspots.h | 23 ++++++++- engines/gob/inter_v2.cpp | 10 ++-- engines/gob/inter_v6.cpp | 11 +++-- 4 files changed, 111 insertions(+), 55 deletions(-) diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index f2116209d7..f97e2a7f9c 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -119,7 +119,7 @@ bool Hotspots::Hotspot::isActiveInput() const { if (isEnd()) return false; - if ((getState() & 0xC) != 0x8) + if (!isFilledEnabled()) return false; if (!isInput()) @@ -128,6 +128,22 @@ bool Hotspots::Hotspot::isActiveInput() const { return true; } +bool Hotspots::Hotspot::isFilled() const { + return getState() & kStateFilled; +} + +bool Hotspots::Hotspot::isFilledEnabled() const { + return (getState() & kStateFilledDisabled) == kStateFilled; +} + +bool Hotspots::Hotspot::isFilledNew() const { + return getState() == kStateFilled; +} + +bool Hotspots::Hotspot::isDisabled() const { + return getState() & kStateDisabled; +} + bool Hotspots::Hotspot::isIn(uint16 x, uint16 y) const { if (x < left) return false; @@ -156,6 +172,14 @@ bool Hotspots::Hotspot::buttonMatch(MouseButtons button) const { return false; } +void Hotspots::Hotspot::disable() { + id |= (kStateDisabled << 12); +} + +void Hotspots::Hotspot::enable() { + id &= ~(kStateDisabled << 12); +} + Hotspots::Hotspots(GobEngine *vm) : _vm(vm) { _hotspots = new Hotspot[kHotspotCount]; @@ -203,9 +227,10 @@ uint16 Hotspots::add(const Hotspot &hotspot) { if (! (spot.isEnd() || (spot.id == hotspot.id))) continue; - // When updating, keep bit 0x4000 intact + // When updating, keep disabled state intact uint16 id = hotspot.id; - if ((spot.id & 0xBFFF) == (hotspot.id & 0xBFFF)) + if ((spot.id & ~(kStateDisabled << 12)) == + (hotspot.id & ~(kStateDisabled << 12))) id = spot.id; // Set @@ -276,7 +301,7 @@ void Hotspots::recalculate(bool force) { // Re-read the flags too, if applicable uint16 flags = 0; - if (spot.getState() == 0xA) + if (spot.getState() == (kStateFilled | kStateType2)) flags = _vm->_game->_script->readValExpr(); // Apply backDelta, if needed @@ -301,7 +326,7 @@ void Hotspots::recalculate(bool force) { spot.right = left + width - 1; spot.bottom = top + height - 1; - if (spot.getState() == 0xA) + if (spot.getState() == (kStateFilled | kStateType2)) spot.flags = flags; // Return @@ -327,10 +352,10 @@ void Hotspots::push(uint8 all, bool force) { if ( (all == 1) || // Don't save the global ones ((all == 0) && (spot.id >= 20)) || - // Only save the ones with the correct state - ((all == 2) && ((spot.getState() == 0xD) || - (spot.getState() == 0x4) || - (spot.getState() == 0xE)))) { + // Only save disabled ones + ((all == 2) && ((spot.getState() == (kStateFilledDisabled | kStateType1)) || + (spot.getState() == (kStateDisabled)) || + (spot.getState() == (kStateFilledDisabled | kStateType2))))) { size++; } @@ -355,10 +380,10 @@ void Hotspots::push(uint8 all, bool force) { if ( (all == 1) || // Don't save the global ones ((all == 0) && (spot.id >= 20)) || - // Only save the ones with the correct state - ((all == 2) && ((spot.getState() == 0xD) || - (spot.getState() == 0x4) || - (spot.getState() == 0xE)))) { + // Only save disabled ones + ((all == 2) && ((spot.getState() == (kStateFilledDisabled | kStateType1)) || + (spot.getState() == (kStateDisabled)) || + (spot.getState() == (kStateFilledDisabled | kStateType2))))) { memcpy(destPtr, &spot, sizeof(Hotspot)); destPtr++; @@ -412,8 +437,8 @@ bool Hotspots::isValid(uint16 key, uint16 id, uint16 index) const { if (key == 0) return false; - if (!(id & 0x8000)) - return false; + if (!(Hotspot::getState(id) & kStateFilled)) + return false; return true; } @@ -449,7 +474,8 @@ void Hotspots::enter(uint16 index) { Hotspot &spot = _hotspots[index]; - if ((spot.getState() == 0xA) || (spot.getState() == 0x9)) + if ((spot.getState() == (kStateFilled | kStateType1)) || + (spot.getState() == (kStateFilled | kStateType2))) WRITE_VAR(17, -(spot.id & 0x0FFF)); if (spot.funcEnter != 0) @@ -466,7 +492,8 @@ void Hotspots::leave(uint16 index) { Hotspot &spot = _hotspots[index]; - if ((spot.getState() == 0xA) || (spot.getState() == 0x9)) + if ((spot.getState() == (kStateFilled | kStateType1)) || + (spot.getState() == (kStateFilled | kStateType2))) WRITE_VAR(17, spot.id & 0x0FFF); if (spot.funcLeave != 0) @@ -482,7 +509,7 @@ uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const { for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.getState() & 0x4) + if (spot.isDisabled()) continue; if (spot.getType() > kTypeMove) @@ -507,7 +534,7 @@ uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const { for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.getState() & 0x4) + if (spot.isDisabled()) continue; if (spot.getWindow() != 0) @@ -1048,9 +1075,13 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, right = left + width - 1; bottom = top + height - 1; - // Removing 0x4 from the state - if ((type == 11) || (type == 12)) { - uint8 wantedState = (type == 11) ? 0xE : 0xD; + // Enabling the hotspots again + if ((type == kTypeEnable2) || (type == kTypeEnable1)) { + uint8 wantedState = 0; + if (type == kTypeEnable2) + wantedState = kStateFilledDisabled | kStateType2; + else + wantedState = kStateFilledDisabled | kStateType1; _vm->_game->_script->skip(6); @@ -1058,7 +1089,7 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, Hotspot &spot = _hotspots[j]; if (spot.getState() == wantedState) { - spot.id &= 0xBFFF; + spot.enable(); spot.funcEnter = _vm->_game->_script->pos(); spot.funcLeave = _vm->_game->_script->pos(); } @@ -1085,7 +1116,7 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, funcLeave = _vm->_game->_script->pos(); _vm->_game->_script->skipBlock(); - key = i + 0xA000; + key = i + ((kStateFilled | kStateType2) << 12); flags = type + (window << 8); break; @@ -1101,7 +1132,7 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, _vm->_game->_script->skipBlock(); if (key == 0) - key = i + 0xA000; + key = i + ((kStateFilled | kStateType2) << 12); flags = type + (window << 8) + (flags << 4); break; @@ -1167,10 +1198,10 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, funcLeave = _vm->_game->_script->pos(); _vm->_game->_script->skipBlock(); - flags = 2 + (window << 8) + (flags << 4); + flags = ((uint16) kTypeClick) + (window << 8) + (flags << 4); break; - case 21: + case kTypeClickEnter: key = _vm->_game->_script->readInt16(); ids[i] = _vm->_game->_script->readInt16(); flags = _vm->_game->_script->readInt16() & 3; @@ -1180,11 +1211,11 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, funcLeave = 0; - flags = 2 + (window << 8) + (flags << 4); + flags = ((uint16) kTypeClick) + (window << 8) + (flags << 4); break; } - add(i + 0x8000, left, top, right, bottom, + add(i | (kStateFilled << 12), left, top, right, bottom, flags, key, funcEnter, funcLeave, funcPos); } @@ -1257,7 +1288,7 @@ void Hotspots::evaluate() { for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if ((spot.getState() & 0xC) != 0x8) + if (!spot.isFilledEnabled()) continue; if ((spot.getType() & 1) != 0) @@ -1285,7 +1316,7 @@ void Hotspots::evaluate() { for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if ((spot.getState() & 0xC) != 0x8) + if (!spot.isFilledEnabled()) continue; if ((spot.key == key) || (spot.key == 0x7FFF)) { @@ -1299,7 +1330,7 @@ void Hotspots::evaluate() { for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if ((spot.getState() & 0xC) != 0x8) + if (!spot.isFilledEnabled()) continue; if ((spot.key & 0xFF00) != 0) @@ -1322,7 +1353,7 @@ void Hotspots::evaluate() { for (int i = endIndex; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.getState() != 0x8) + if (!spot.isFilledNew()) continue; collStackPos++; @@ -1335,7 +1366,7 @@ void Hotspots::evaluate() { if (VAR(16) != 0) break; - if (Hotspot::getState(id) == 0x8) + if (Hotspot::getState(id) == kStateFilled) WRITE_VAR(16, ids[id & 0xFFF]); else WRITE_VAR(16, id & 0xFFF); @@ -1378,7 +1409,7 @@ void Hotspots::evaluate() { for (int i = endIndex; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.getState() == 0x8) { + if (spot.isFilledNew()) { if (++counter == descIndex) { id = spot.id; index = i; @@ -1393,7 +1424,7 @@ void Hotspots::evaluate() { for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if (spot.getState() == 0x8) { + if (spot.isFilledNew()) { id = spot.id; index = i; break; @@ -1418,7 +1449,7 @@ void Hotspots::evaluate() { _vm->_inter->storeMouse(); - if (Hotspot::getState(id) == 0x8) + if (Hotspot::getState(id) == kStateFilled) WRITE_VAR(16, ids[id & 0xFFF]); else WRITE_VAR(16, id & 0xFFF); @@ -1442,7 +1473,7 @@ void Hotspots::evaluate() { if (spot.isEnd()) continue; - if ((spot.getState() & 0xC) != 0x8) + if (!spot.isFilledEnabled()) continue; if (!spot.isInput()) @@ -1507,7 +1538,7 @@ void Hotspots::evaluate() { _vm->_inter->storeMouse(); if (VAR(16) == 0) { - if (Hotspot::getState(id) == 0x8) + if (Hotspot::getState(id) == kStateFilled) WRITE_VAR(16, ids[id & 0xFFF]); else WRITE_VAR(16, id & 0xFFF); @@ -1516,13 +1547,14 @@ void Hotspots::evaluate() { _vm->_game->_script->setFinished(true); for (int i = 0; i < count; i++) - remove(i + 0x8000); + remove(i + (kStateFilled << 12)); for (int i = 0; i < kHotspotCount; i++) { Hotspot &spot = _hotspots[i]; - if ((spot.getState() == 0xA) || (spot.getState() == 0x9)) - spot.id |= 0x4000; + if ((spot.getState() == (kStateFilled | kStateType1)) || + (spot.getState() == (kStateFilled | kStateType2))) + spot.disable(); } } @@ -1533,7 +1565,7 @@ int16 Hotspots::findCursor(uint16 x, uint16 y) const { for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; - if ((spot.getWindow() != 0) || (spot.getState() & 0x4)) + if ((spot.getWindow() != 0) || spot.isDisabled()) continue; if (!spot.isIn(x, y)) @@ -1576,7 +1608,7 @@ uint16 Hotspots::findClickedInput(uint16 index) const { if (spot.getWindow() != 0) continue; - if (spot.getState() & 0x4) + if (spot.isDisabled()) continue; if (!spot.isIn(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY)) @@ -1669,7 +1701,7 @@ void Hotspots::updateAllTexts(const InputDesc *inputs) const { if (spot.isEnd()) continue; - if ((spot.getState() & 0xC) != 0x8) + if (!spot.isFilledEnabled()) continue; if (!spot.isInput()) diff --git a/engines/gob/hotspots.h b/engines/gob/hotspots.h index 1801a10591..79a80526de 100644 --- a/engines/gob/hotspots.h +++ b/engines/gob/hotspots.h @@ -49,7 +49,18 @@ public: kTypeInput3NoLeave = 7, kTypeInput3Leave = 8, kTypeInputFloatNoLeave = 9, - kTypeInputFloatLeave = 10 + kTypeInputFloatLeave = 10, + kTypeEnable2 = 11, + kTypeEnable1 = 12, + kTypeClickEnter = 21 + }; + + enum State { + kStateFilledDisabled = 0xC, + kStateFilled = 0x8, + kStateDisabled = 0x4, + kStateType2 = 0x2, + kStateType1 = 0x1 }; Hotspots(GobEngine *vm); @@ -68,7 +79,7 @@ public: /** Push the current hotspots onto the stack. * - * @param all 0: Don't push global ones; 1: Push all; 2: Push only the ones with the correct state + * @param all 0: Don't push global ones; 1: Push all; 2: Push only the disabled ones * @param force Force a push although _shouldPush is false */ void push(uint8 all, bool force = false); @@ -115,12 +126,20 @@ private: bool isInput() const; bool isActiveInput() const; + bool isFilled() const; + bool isFilledEnabled() const; + bool isFilledNew() const; + bool isDisabled() const; + /** Are the specified coordinates in the hotspot? */ bool isIn(uint16 x, uint16 y) const; /** Does the specified button trigger the hotspot? */ bool buttonMatch(MouseButtons button) const; static uint8 getState(uint16 id); + + void disable(); + void enable(); }; struct StackEntry { diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index 746816303c..20f812bb88 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -1213,13 +1213,15 @@ bool Inter_v2::o2_addHotspot(OpFuncParams ¶ms) { bool Inter_v2::o2_removeHotspot(OpFuncParams ¶ms) { int16 id = _vm->_game->_script->readValExpr(); + uint8 stateType1 = Hotspots::kStateFilledDisabled | Hotspots::kStateType1; + uint8 stateType2 = Hotspots::kStateFilledDisabled | Hotspots::kStateType2; - if (id == -2) - _vm->_game->_hotspots->removeState(0xD); + if (id == -2) + _vm->_game->_hotspots->removeState(stateType1); else if (id == -1) - _vm->_game->_hotspots->removeState(0xE); + _vm->_game->_hotspots->removeState(stateType2); else - _vm->_game->_hotspots->remove(0xE000 + id); + _vm->_game->_hotspots->remove((stateType2 << 12) + id); return false; } diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index 67bf87a7da..aa4721ff0a 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -355,6 +355,9 @@ bool Inter_v6::o6_palLoad(OpFuncParams ¶ms) { bool Inter_v6::o6_removeHotspot(OpFuncParams ¶ms) { int16 id; + uint8 stateType1 = Hotspots::kStateFilledDisabled | Hotspots::kStateType1; + uint8 stateType2 = Hotspots::kStateFilledDisabled | Hotspots::kStateType2; + uint8 stateDisabled = Hotspots::kStateDisabled; id = _vm->_game->_script->readValExpr(); @@ -369,14 +372,14 @@ bool Inter_v6::o6_removeHotspot(OpFuncParams ¶ms) { _vm->_game->_hotspots->push(2); break; case 3: - _vm->_game->_hotspots->removeState(0xD); - _vm->_game->_hotspots->removeState(0x4); + _vm->_game->_hotspots->removeState(stateType1); + _vm->_game->_hotspots->removeState(stateDisabled); break; case 4: - _vm->_game->_hotspots->removeState(0xE); + _vm->_game->_hotspots->removeState(stateType2); break; default: - _vm->_game->_hotspots->remove(0xE000 + id); + _vm->_game->_hotspots->remove((stateType2 << 12) + id); break; } -- cgit v1.2.3 From c3d9acf309c8616bdf99ebfc8236a984a08de323 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Mon, 6 Jul 2009 01:41:29 +0000 Subject: Adding more comments svn-id: r42161 --- engines/gob/hotspots.cpp | 317 ++++++++++++++++++++++++++++++++++++++--------- engines/gob/hotspots.h | 41 ++++-- 2 files changed, 288 insertions(+), 70 deletions(-) diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index f97e2a7f9c..b717bd76df 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -161,12 +161,15 @@ bool Hotspots::Hotspot::buttonMatch(MouseButtons button) const { MouseButtons myButton = getButton(); if (myButton == kMouseButtonsAny) + // Any button allowed return true; if (myButton == kMouseButtonsNone) + // No button allowed return false; if (myButton == button) + // Exact match return true; return false; @@ -194,7 +197,9 @@ Hotspots::Hotspots(GobEngine *vm) : _vm(vm) { Hotspots::~Hotspots() { delete[] _hotspots; + // Pop the whole stack and free each element's memory while (!_stack.empty()) { + StackEntry backup = _stack.pop(); delete[] backup.hotspots; @@ -278,9 +283,11 @@ void Hotspots::recalculate(bool force) { Hotspot &spot = _hotspots[i]; if (!force && ((spot.flags & 0x80) != 0)) + // Not forcing a special hotspot continue; if (spot.funcPos == 0) + // Simple coordinates don't need update continue; // Setting the needed script @@ -420,6 +427,7 @@ void Hotspots::pop() { error("Hotspots::pop(): Not enough free space in the current Hotspot " "array to pop %d elements (got %d)", backup.size, kHotspotCount - i); + // Copy memcpy(destPtr, backup.hotspots, backup.size * sizeof(Hotspot)); _shouldPush = backup.shouldPush; @@ -474,6 +482,7 @@ void Hotspots::enter(uint16 index) { Hotspot &spot = _hotspots[index]; + // If requested, write the ID into a variable if ((spot.getState() == (kStateFilled | kStateType1)) || (spot.getState() == (kStateFilled | kStateType2))) WRITE_VAR(17, -(spot.id & 0x0FFF)); @@ -492,6 +501,7 @@ void Hotspots::leave(uint16 index) { Hotspot &spot = _hotspots[index]; + // If requested, write the ID into a variable if ((spot.getState() == (kStateFilled | kStateType1)) || (spot.getState() == (kStateFilled | kStateType2))) WRITE_VAR(17, spot.id & 0x0FFF); @@ -504,21 +514,26 @@ uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const { id = 0; index = 0; - if (type == kTypeMove) { + if (type == kTypeMove) { + // Check where the mouse was moved to for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; if (spot.isDisabled()) + // Only consider enabled hotspots continue; if (spot.getType() > kTypeMove) + // Only consider click and move hotspots continue; if (spot.getWindow() != 0) + // Only check the main window continue; if (!spot.isIn(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY)) + // If we're not in it, ignore it continue; id = spot.id; @@ -530,35 +545,44 @@ uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const { return 0; } else if (type == kTypeClick) { + // Check if something was clicked for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; if (spot.isDisabled()) + // Only consider enabled hotspots continue; if (spot.getWindow() != 0) + // Only check the main window continue; if (spot.getType() < kTypeMove) + // Only consider hotspots that can be clicked continue; if (!spot.isIn(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY)) + // If we're not in it, ignore it continue; if (!spot.buttonMatch(_vm->_game->_mouseButtons)) + // Don't follow hotspots with button requirements we don't meet continue; id = spot.id; index = i; if ((spot.getType() == kTypeMove) || (spot.getType() == kTypeClick)) + // It's a move or click => return the key return spot.key; + // Otherwise, the key has a different meaning, so ignore it return 0; } if (_vm->_game->_mouseButtons != kMouseButtonsLeft) + // Let the right mouse button act as an escape key return kKeyEscape; return 0; @@ -568,23 +592,29 @@ uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const { return 0; } -void Hotspots::checkHotspotChanged() { +bool Hotspots::checkHotspotChanged() { uint16 key, id, index; + // Get the current hotspot key = checkMouse(kTypeMove, id, index); if (key == _currentKey) - return; + // Nothing changed => nothing to do + return false; - if (isValid(_currentKey, _currentId, _currentIndex)) + // Leave the old area + if (isValid(_currentKey, _currentId,_currentIndex)) leave(_currentIndex); _currentKey = key; _currentId = id; _currentIndex = index; + // Enter the new one if (isValid(key, id, index)) enter(index); + + return true; } uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index) { @@ -601,6 +631,8 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index if (handleMouse) { if ((_vm->_draw->_cursorIndex == -1) && (_currentKey == 0)) { + // Last know state: No hotspot hit. Look if that changed + _currentKey = checkMouse(kTypeMove, _currentId, _currentIndex); if (isValid(_currentKey, _currentId, _currentIndex)) @@ -612,6 +644,7 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index uint32 startTime = _vm->_util->getTimeKey(); + // Update display _vm->_draw->blitInvalidated(); _vm->_video->retrace(); @@ -624,8 +657,10 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index return 0; } + // Anything changed? checkHotspotChanged(); + // Update display if (!_vm->_draw->_noInvalidated) { if (handleMouse) _vm->_draw->animateCursor(-1); @@ -634,21 +669,27 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index _vm->_video->waitRetrace(); } + // Update keyboard and mouse state key = _vm->_game->checkKeys(&_vm->_global->_inter_mouseX, &_vm->_global->_inter_mouseY, &_vm->_game->_mouseButtons, handleMouse); if (!handleMouse && (_vm->_game->_mouseButtons != kMouseButtonsNone)) { + // We don't want any mouse input but got one => Wait till it went away + _vm->_util->waitMouseRelease(0); key = 3; } if (key != 0) { + // Got a key press + if (handleMouse & 1) _vm->_draw->blitCursor(); id = 0; index = 0; + // Leave the current hotspot if (isValid(_currentKey, _currentId, _currentIndex)) leave(_currentIndex); @@ -659,8 +700,11 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index if (handleMouse) { if (_vm->_game->_mouseButtons != kMouseButtonsNone) { + // Mouse button pressed if (delay > 0) { + // If a delay was requested, wait the specified time + _vm->_draw->animateCursor(2); _vm->_util->delay(delay); } else if (handleMouse & 1) @@ -668,13 +712,17 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index _vm->_draw->animateCursor(-1); + // Which region was clicked? key = checkMouse(kTypeClick, id, index); if ((key != 0) || (id != 0)) { + // Got a valid region + if ( (handleMouse & 1) && ((delay <= 0) || (_vm->_game->_mouseButtons == kMouseButtonsNone))) _vm->_draw->blitCursor(); + // If the hotspot changed, leave the old one if (key != _currentKey) leave(_currentIndex); @@ -683,22 +731,26 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index } if (handleMouse & 4) + // Nothing further than one simple check was requested => return return 0; + // Leave the current area if (_currentKey != 0) leave(_currentIndex); + // No click, but do we have a move event? If so, enter that hotspot _currentKey = checkMouse(kTypeMove, _currentId, _currentIndex); if (isValid(_currentKey, _currentId, _currentIndex)) enter(_currentIndex); } else + // No mouse button pressed, check whether the position changed at least checkHotspotChanged(); - } if ((delay == -2) && (key == 0) && (_vm->_game->_mouseButtons == kMouseButtonsNone)) { + // Nothing found and no further handling requested. Return. id = 0; index = 0; @@ -711,9 +763,12 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index if ((delay < 0) && (key == 0) && (_vm->_game->_mouseButtons == kMouseButtonsNone)) { + // Look if we've maybe reached the timeout + uint32 curTime = _vm->_util->getTimeKey(); - // Timeout reached? if ((curTime + delay) > startTime) { + // If so, return + id = 0; index = 0; break; @@ -721,6 +776,7 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index } + // Sleep for a short amount of time _vm->_util->delay(10); } @@ -731,16 +787,20 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index uint16 Hotspots::check(uint8 handleMouse, int16 delay) { uint16 id, index; + // Check and ignore the id and index return Hotspots::check(handleMouse, delay, id, index); } -uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 height, +uint16 Hotspots::updateInput(uint16 xPos, uint16 yPos, uint16 width, uint16 height, uint16 backColor, uint16 frontColor, char *str, uint16 fontIndex, - Type type, int16 &duration, uint16 &id, uint16 index) { + Type type, int16 &duration, uint16 &id, uint16 &index) { - if ((fontIndex >= 8) || !_vm->_draw->_fonts[fontIndex]) + if ((fontIndex >= 8) || !_vm->_draw->_fonts[fontIndex]) { + warning("Hotspots::updateInput(): Invalid font specified: %d", fontIndex); return 0; + } + // Check if we need to consider mouse events bool handleMouse = false; if ( (_vm->_game->_handleMouse != 0) && ((_vm->_global->_useMouse != 0) || (_vm->_game->_forceHandleMouse != 0))) @@ -748,15 +808,20 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh const Video::FontDesc &font = *_vm->_draw->_fonts[fontIndex]; + // The font doesn't specify individual character widths => monospaced bool monoSpaced = (font.charWidths == 0); - uint32 pos = strlen(str); - uint32 editSize = monoSpaced ? (width / font.itemWidth) : 0; + // Current position in the string, preset to the end + uint32 pos = strlen(str); + /* Size of input field in characters. + * If the font is not monospaced, we can't know that */ + uint32 editSize = monoSpaced ? (width / font.itemWidth) : 0; uint16 key = 0; char tempStr[256]; while (1) { + // If we the edit field has enough space, add a space for the new character strncpy0(tempStr, str, 254); strcat(tempStr, " "); if ((editSize != 0) && strlen(tempStr) > editSize) @@ -767,12 +832,15 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh monoSpaced ? (editSize * font.itemWidth) : width, height, backColor); + // Print the current string, vertically centered printText(xPos, yPos + (height - font.itemHeight) / 2, tempStr, fontIndex, frontColor); + // If we've reached the end of the input field, set the cursor to the last character if ((editSize != 0) && (pos == editSize)) pos--; + // The character under the cursor char curSym = tempStr[pos]; if (_vm->_inter->_variables) @@ -790,13 +858,16 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh fillRect(cursorX, cursorY, cursorWidth, cursorHeight, frontColor); if (first) { + // The first time, purge old information too key = check(handleMouse, -1, id, index); if (key == 0) + // We didn't catch any input, let's try again with a real timeout key = check(handleMouse, -300, id, index); first = false; } else + // Try to catch a character key = check(handleMouse, -300, id, index); tempStr[0] = curSym; @@ -807,21 +878,27 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh cursorX, cursorY, cursorWidth, cursorHeight); fillRect(cursorX, cursorY, cursorWidth, cursorHeight, backColor); + // Print the current string, vertically centered printText(cursorX, yPos + (height - font.itemHeight) / 2, tempStr, fontIndex, frontColor); if ((key != 0) || (id != 0)) + // We did get a key, stop looking break; + // Try again key = check(handleMouse, -300, id, index); if ((key != 0) || (id != 0) || _vm->_inter->_terminate || _vm->shouldQuit()) + // We did get a key, stop looking break; if (duration > 0) { + // Look if we reached the time limit duration -= 600; if (duration <= 1) { + // If so, abort key = 0; id = 0; break; @@ -831,30 +908,37 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh if ((key == 0) || (id != 0) || _vm->_inter->_terminate || _vm->shouldQuit()) + // Got no key, or a region ID instead, return return 0; switch (key) { case kKeyRight: + // If possible, move the cursor right if ((pos > strlen(str)) || (pos > (editSize - 1)) || (editSize == 0)) { pos++; continue; } + // Continue downwards instead return kKeyDown; case kKeyLeft: + // If possible, move the cursor left if (pos > 0) { pos--; continue; } + // Continue upwards instead return kKeyUp; case kKeyBackspace: if (pos > 0) { + // Delete the character to the left _vm->_util->cutFromStr(str, pos - 1, 1); pos--; continue; } else { if (pos < strlen(str)) + // Delete the character to the right _vm->_util->cutFromStr(str, pos, 1); } @@ -862,6 +946,7 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh if (pos >= strlen(str)) continue; + // Delete the character to the right _vm->_util->cutFromStr(str, pos, 1); continue; @@ -881,6 +966,7 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh return key; case kKeyEscape: + // If we got an escape event, wait until the mouse buttons have been released if (_vm->_global->_useMouse != 0) continue; @@ -891,17 +977,21 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh ((_vm->_global->_useMouse != 0) || (_vm->_game->_forceHandleMouse != 0))) handleMouse = true; - while (_vm->_global->_pressedKeys[1] != 0) - ; + while (_vm->_global->_pressedKeys[1] != 0); continue; default: + // Got a "normal" key + uint16 savedKey = key; key &= 0xFF; if (((type == kTypeInputFloatNoLeave) || (type == kTypeInputFloatLeave)) && (key >= ' ') && (key <= 0xFF)) { + + // Only allow character found in numerical floating values + const char *str1 = "0123456789-.,+ "; const char *str2 = "0123456789-,,+ "; @@ -924,27 +1014,34 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh if ((key >= ' ') && (key <= 0xFF)) { if (editSize == 0) { + // Length of the string + current character + next one int length = _vm->_draw->stringLength(str, fontIndex) + font.charWidths[' ' - font.startItem] + font.charWidths[key - font.startItem]; if (length > width) + // We're above the limit, ignore the key continue; if (((int32) strlen(str)) >= (_vm->_global->_inter_animDataSize * 4 - 1)) + // Above the limit of character allowed in a string, ignore the key continue; } else { if (strlen(str) > editSize) + // We're over the upper character limit for this field continue; else if (editSize == strlen(str)) + // We've reached the upper limit, overwrite the last character _vm->_util->cutFromStr(str, strlen(str) - 1, 1); } + // Advance cursor pos++; tempStr[0] = key; tempStr[1] = 0; + // Add character _vm->_util->insertStr(tempStr, str, pos - 1); } @@ -952,22 +1049,25 @@ uint16 Hotspots::readString(uint16 xPos, uint16 yPos, uint16 width, uint16 heigh } } -uint16 Hotspots::handleInput(int16 time, uint16 inputCount, uint16 &curInput, +uint16 Hotspots::handleInputs(int16 time, uint16 inputCount, uint16 &curInput, InputDesc *inputs, uint16 &id, uint16 &index) { + // Redraw all texts in all inputs we currently manage updateAllTexts(inputs); for (int i = 0; i < 40; i++) - WRITE_VAR_OFFSET(i * 4 + 0x44, 0); + WRITE_VAR(17 + i, 0); while (1) { - uint16 hotspotIndex = findInput(curInput); + // Find the hotspot index to our current input + uint16 hotspotIndex = inputToHotspot(curInput); assert(hotspotIndex != 0xFFFF); Hotspot inputSpot = _hotspots[hotspotIndex]; - uint16 key = readString(inputSpot.left, inputSpot.top, + // Handle input events from that input field + uint16 key = updateInput(inputSpot.left, inputSpot.top, inputSpot.right - inputSpot.left + 1, inputSpot.bottom - inputSpot.top + 1, inputs[curInput].backColor, inputs[curInput].frontColor, @@ -980,15 +1080,19 @@ uint16 Hotspots::handleInput(int16 time, uint16 inputCount, uint16 &curInput, switch (key) { case kKeyNone: if (id == 0) + // No key and no hotspot => return return 0; if (_vm->_game->_mouseButtons != kMouseButtonsNone) + // Clicked something, get the hotspot index index = findClickedInput(index); if (!_hotspots[index].isInput()) + // It's no input, return return 0; - curInput = findNthInput(index); + // Get the associated input index + curInput = hotspotToInput(index); break; case kKeyF1: @@ -1004,12 +1108,11 @@ uint16 Hotspots::handleInput(int16 time, uint16 inputCount, uint16 &curInput, return key; case kKeyReturn: - // Just one input => return if (inputCount == 1) return kKeyReturn; - // End of input chain reached => wap + // End of input chain reached => wrap if (curInput == (inputCount - 1)) { curInput = 0; break; @@ -1044,6 +1147,8 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, byte window = 0; if ((type & 0x40) != 0) { + // Got a window ID + type -= 0x40; window = _vm->_game->_script->readByte(); } @@ -1052,12 +1157,14 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, uint16 left, top, width, height, right, bottom; uint32 funcPos = 0; if ((type & 0x80) != 0) { + // Complex coordinate expressions funcPos = _vm->_game->_script->pos(); left = _vm->_game->_script->readValExpr(); top = _vm->_game->_script->readValExpr(); width = _vm->_game->_script->readValExpr(); height = _vm->_game->_script->readValExpr(); } else { + // Immediate values funcPos = 0; left = _vm->_game->_script->readUint16(); top = _vm->_game->_script->readUint16(); @@ -1154,28 +1261,35 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, inputs[inputCount].fontIndex = _vm->_game->_script->readInt16(); inputs[inputCount].backColor = _vm->_game->_script->readByte(); inputs[inputCount].frontColor = _vm->_game->_script->readByte(); + inputs[inputCount].length = 0; inputs[inputCount].str = 0; if ((type >= kTypeInput2NoLeave) && (type <= kTypeInput3Leave)) { + uint16 length = _vm->_game->_script->readUint16(); + inputs[inputCount].str = - (const char *) (_vm->_game->_script->getData() + _vm->_game->_script->pos() + 2); - _vm->_game->_script->skip(_vm->_game->_script->peekUint16() + 2); + (const char *) (_vm->_game->_script->getData() + _vm->_game->_script->pos()); + + _vm->_game->_script->skip(length); } if (left == 0xFFFF) { - if ((type & 1) == 0) + if (!(type & 1)) + // No coordinates but a leave block => skip it _vm->_game->_script->skipBlock(); break; } font = _vm->_draw->_fonts[inputs[inputCount].fontIndex]; if (!font->charWidths) + // Monospaced font right = left + width * font->itemWidth - 1; funcEnter = 0; funcPos = 0; funcLeave = 0; if (!(type & 1)) { + // Got a leave funcLeave = _vm->_game->_script->pos(); _vm->_game->_script->skipBlock(); } @@ -1215,6 +1329,7 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, break; } + // Add the new hotspot add(i | (kStateFilled << 12), left, top, right, bottom, flags, key, funcEnter, funcLeave, funcPos); } @@ -1227,8 +1342,10 @@ void Hotspots::evaluate() { int16 var_26; int16 collStackPos; + // Push all local hotspots push(0); + // Find the current end of the hotspot block uint16 endIndex = 0; while (!_hotspots[endIndex].isEnd()) endIndex++; @@ -1237,15 +1354,19 @@ void Hotspots::evaluate() { _vm->_game->_script->skip(1); + // Number of new hotspots byte count = _vm->_game->_script->readByte(); - _vm->_game->_handleMouse = _vm->_game->_script->peekByte(0); - int16 duration = _vm->_game->_script->peekByte(1); - byte stackPos2 = _vm->_game->_script->peekByte(3); - byte descIndex = _vm->_game->_script->peekByte(4); - bool needRecalculation = _vm->_game->_script->peekByte(5) != 0; + // Parameters of this block + _vm->_game->_handleMouse = _vm->_game->_script->peekByte(0); + int16 duration = _vm->_game->_script->peekByte(1); + byte stackPos2 = _vm->_game->_script->peekByte(3); + byte descIndex = _vm->_game->_script->peekByte(4); + bool needRecalculation = _vm->_game->_script->peekByte(5) != 0; + // Seconds -> Milliseconds duration *= 1000; + if ((stackPos2 != 0) || (descIndex != 0)) { duration /= 100; if (_vm->_game->_script->peekByte(1) == 100) @@ -1256,6 +1377,7 @@ void Hotspots::evaluate() { _vm->_game->_script->skip(6); + // Clear current ID WRITE_VAR(16, 0); byte var_41 = 0; @@ -1267,9 +1389,12 @@ void Hotspots::evaluate() { bool hasInput = false; uint16 inputCount = 0; + + // Adding new hotspots for (uint16 i = 0; i < count; i++) evaluateNew(i, ids, inputs, validId, hasInput, inputCount); + // Recalculate all hotspots if requested if (needRecalculation) recalculate(true); @@ -1279,22 +1404,29 @@ void Hotspots::evaluate() { do { uint16 key = 0; if (hasInput) { + // Input + uint16 curInput = 0; - key = handleInput(duration, inputCount, curInput, inputs, id, index); + key = handleInputs(duration, inputCount, curInput, inputs, id, index); + // Notify the script of the current input index WRITE_VAR(55, curInput); if (key == kKeyReturn) { + // Return pressed, invoke input leave for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; if (!spot.isFilledEnabled()) + // Not filled or disabled continue; if ((spot.getType() & 1) != 0) + // Not an input with a leave function continue; if (spot.getType() <= kTypeClick) + // Not an input continue; id = spot.id; @@ -1305,20 +1437,29 @@ void Hotspots::evaluate() { break; } } else + // Normal move or click check key = check(_vm->_game->_handleMouse, -duration, id, index); + // Handle special number keys if (((key & 0xFF) >= ' ') && ((key & 0xFF) <= 0xFF) && ((key >> 8) > 1) && ((key >> 8) < 12)) key = '0' + (((key >> 8) - 1) % 10) + (key & 0xFF00); if (id == 0) { + // No hotspot area + if (key != 0) { + // But a key + + // Find the hotspot with that key associated for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; if (!spot.isFilledEnabled()) + // Not filled or disabled continue; + // Key match Catch all if ((spot.key == key) || (spot.key == 0x7FFF)) { id = spot.id; index = i; @@ -1327,6 +1468,9 @@ void Hotspots::evaluate() { } if (id == 0) { + // Didn't find such a hotspot + + // Try it again, this time case insensitively for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; @@ -1358,26 +1502,33 @@ void Hotspots::evaluate() { collStackPos++; if (collStackPos != stackPos2) + // Isn't yet the one wanted continue; id = spot.id; index = i; _vm->_inter->storeMouse(); if (VAR(16) != 0) + // We already handle a hotspot break; + // Notify the scripts that we now handle this hotspot if (Hotspot::getState(id) == kStateFilled) WRITE_VAR(16, ids[id & 0xFFF]); else WRITE_VAR(16, id & 0xFFF); if (spot.funcLeave != 0) { + // It has a leave function + uint32 timeKey = _vm->_util->getTimeKey(); call(spot.funcLeave); if (timeVal != 2) { + // Rest time we have left = time we had - time the leave took duration = timeVal - (_vm->_util->getTimeKey() - timeKey); + // Remove the buffer time if ((duration - var_46) < 3) { var_46 -= (duration - 3); duration = 3; @@ -1386,6 +1537,7 @@ void Hotspots::evaluate() { var_46 = 0; } + // Clamp if (duration > timeVal) duration = timeVal; @@ -1395,6 +1547,7 @@ void Hotspots::evaluate() { } if (VAR(16) == 0) + // Didn't find anything id = 0; else var_41 = 1; @@ -1406,6 +1559,7 @@ void Hotspots::evaluate() { if (descIndex != 0) { counter = 0; + // Enter the nth hotspot for (int i = endIndex; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; @@ -1421,6 +1575,7 @@ void Hotspots::evaluate() { } else { + // Enter the first hotspot for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; @@ -1431,6 +1586,7 @@ void Hotspots::evaluate() { } } + // Leave the current hotspot if ((_currentKey != 0) && (_hotspots[_currentIndex].funcLeave != 0)) call(_hotspots[_currentIndex].funcLeave); @@ -1445,15 +1601,18 @@ void Hotspots::evaluate() { break; if ((id == 0) || (_hotspots[index].funcLeave != 0)) + // We don't have a new ID, but haven't yet handled the leave function continue; _vm->_inter->storeMouse(); + // Notify the scripts of the currently handled hotspot if (Hotspot::getState(id) == kStateFilled) WRITE_VAR(16, ids[id & 0xFFF]); else WRITE_VAR(16, id & 0xFFF); + // Enter it if (_hotspots[index].funcEnter != 0) call(_hotspots[index].funcEnter); @@ -1470,23 +1629,30 @@ void Hotspots::evaluate() { for (int i = 0; i < kHotspotCount; i++) { Hotspot &spot = _hotspots[i]; + // Looking for all enabled inputs if (spot.isEnd()) continue; - if (!spot.isFilledEnabled()) continue; - if (!spot.isInput()) continue; - if (spot.getType() > kTypeInput3Leave) { + // Clean up numerical floating values + if (spot.getType() >= kTypeInputFloatNoLeave) { + // Get the string char *ptr; strncpy0(tempStr, GET_VARO_STR(spot.key), 255); + + // Remove spaces while ((ptr = strchr(tempStr, ' '))) _vm->_util->cutFromStr(tempStr, (ptr - tempStr), 1); + + // Exchange decimal separator if needed if (_vm->_global->_language == kLanguageBritish) while ((ptr = strchr(tempStr, '.'))) *ptr = ','; + + // Write it back WRITE_VARO_STR(spot.key, tempStr); } @@ -1498,6 +1664,7 @@ void Hotspots::evaluate() { if (spot.getType() < kTypeInput3NoLeave) _vm->_util->cleanupStr(tempStr); + // Look if we find a match between the wanted and the typed string int16 pos = 0; do { char spotStr[256]; @@ -1510,20 +1677,23 @@ void Hotspots::evaluate() { if (spot.getType() < kTypeInput3NoLeave) _vm->_util->cleanupStr(spotStr); + // Compare the entered string with the string we wanted if (strcmp(tempStr, spotStr) == 0) { WRITE_VAR(17, VAR(17) + 1); WRITE_VAR(17 + var_26, 1); break; } - } while (READ_LE_UINT16(inputs[var_24].str - 2) > pos); + } while (inputs[var_24].length > pos); + collStackPos++; - } else { + } else WRITE_VAR(17 + var_26, 2); - } + var_24++; var_26++; } + // Notify the scripts if we reached the requested hotspot if (collStackPos != (int16) VAR(17)) WRITE_VAR(17, 0); else @@ -1538,6 +1708,8 @@ void Hotspots::evaluate() { _vm->_inter->storeMouse(); if (VAR(16) == 0) { + // No hotspot currently handled, now we'll handle the newly found one + if (Hotspot::getState(id) == kStateFilled) WRITE_VAR(16, ids[id & 0xFFF]); else @@ -1547,14 +1719,16 @@ void Hotspots::evaluate() { _vm->_game->_script->setFinished(true); for (int i = 0; i < count; i++) + // Remove all local hotspots remove(i + (kStateFilled << 12)); for (int i = 0; i < kHotspotCount; i++) { Hotspot &spot = _hotspots[i]; - if ((spot.getState() == (kStateFilled | kStateType1)) || - (spot.getState() == (kStateFilled | kStateType2))) - spot.disable(); + // Disable the ones still there + if ((spot.getState() == (kStateFilled | kStateType1)) || + (spot.getState() == (kStateFilled | kStateType2))) + spot.disable(); } } @@ -1566,58 +1740,94 @@ int16 Hotspots::findCursor(uint16 x, uint16 y) const { Hotspot &spot = _hotspots[i]; if ((spot.getWindow() != 0) || spot.isDisabled()) + // Ignore disabled and non-main-windowed hotspots continue; if (!spot.isIn(x, y)) + // We're not in that hotspot, ignore it continue; if (spot.getCursor() == 0) { + // Hotspot doesn't itself specify a cursor... if (spot.getType() >= kTypeInput1NoLeave) { + // ...but the type has a generic one cursor = 3; break; } else if ((spot.getButton() != kMouseButtonsRight) && (cursor == 0)) + // ...but there's a generic "click" cursor cursor = 1; } else if (cursor == 0) + // Hotspot had an attached cursor index cursor = spot.getCursor(); } return cursor; } -uint16 Hotspots::findInput(uint16 input) const { +uint16 Hotspots::inputToHotspot(uint16 input) const { uint16 inputIndex = 0; for (int i = 0; i < kHotspotCount; i++) { Hotspot &spot = _hotspots[i]; if (!spot.isActiveInput()) + // Not an active input continue; if (inputIndex == input) + // We've found our input return i; + // Next one inputIndex++; } + // None found return 0xFFFF; } +uint16 Hotspots::hotspotToInput(uint16 hotspot) const { + uint16 input = 0; + + for (int i = 0; i < kHotspotCount; i++) { + Hotspot &spot = _hotspots[i]; + + if (!spot.isActiveInput()) + // Not an active input + continue; + + if (i == hotspot) + // We've found our hotspot + break; + + // Next one + input++; + } + + return input; +} + uint16 Hotspots::findClickedInput(uint16 index) const { for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { Hotspot &spot = _hotspots[i]; if (spot.getWindow() != 0) + // Ignore other windows continue; if (spot.isDisabled()) + // Ignore disabled hotspots continue; if (!spot.isIn(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY)) + // This one wasn't it continue; if (spot.getCursor() != 0) + // This one specifies a cursor, so we don't want it continue; if (!spot.isInput()) + // It's no input continue; index = i; @@ -1627,24 +1837,6 @@ uint16 Hotspots::findClickedInput(uint16 index) const { return index; } -uint16 Hotspots::findNthInput(uint16 n) const { - uint16 input = 0; - - for (int i = 0; i < kHotspotCount; i++) { - Hotspot &spot = _hotspots[i]; - - if (!spot.isActiveInput()) - continue; - - if (i == n) - break; - - input++; - } - - return input; -} - void Hotspots::getTextCursorPos(const Video::FontDesc &font, const char *str, uint32 pos, uint16 x, uint16 y, uint16 width, uint16 height, uint16 &cursorX, uint16 &cursorY, uint16 &cursorWidth, uint16 &cursorHeight) const { @@ -1657,6 +1849,7 @@ void Hotspots::getTextCursorPos(const Video::FontDesc &font, const char *str, cursorWidth = 1; cursorHeight = height; + // Iterate through the string and add each character's width for (uint32 i = 0; i < pos; i++) cursorX += font.charWidths[str[i] - font.startItem]; @@ -1699,25 +1892,33 @@ void Hotspots::updateAllTexts(const InputDesc *inputs) const { const Hotspot &spot = _hotspots[i]; if (spot.isEnd()) + // It's an end, we don't want it continue; if (!spot.isFilledEnabled()) + // This one's either not used or disabled continue; if (!spot.isInput()) + // Not an input continue; + // Get its text char tempStr[256]; strncpy0(tempStr, GET_VARO_STR(spot.key), 255); + // Coordinates uint16 x = spot.left; uint16 y = spot.top; uint16 width = spot.right - spot.left + 1; uint16 height = spot.bottom - spot.top + 1; + // Clear the background fillRect(x, y, width, height, inputs[input].backColor); - y += (width - _vm->_draw->_fonts[_vm->_draw->_fontIndex]->itemHeight) / 2; + // Center the text vertically + y += (height - _vm->_draw->_fonts[_vm->_draw->_fontIndex]->itemHeight) / 2; + // Draw it printText(x, y, tempStr, inputs[input].fontIndex, inputs[input].frontColor); input++; diff --git a/engines/gob/hotspots.h b/engines/gob/hotspots.h index 79a80526de..893991bfbe 100644 --- a/engines/gob/hotspots.h +++ b/engines/gob/hotspots.h @@ -66,6 +66,7 @@ public: Hotspots(GobEngine *vm); ~Hotspots(); + /** Remove all hotspots. */ void clear(); /** Add a hotspot, returning the new index. */ @@ -74,7 +75,9 @@ public: uint16 flags, uint16 key, uint16 funcEnter, uint16 funcLeave, uint16 funcPos); + /** Remove a specific hotspot. */ void remove(uint16 id); + /** Remove all hotspots in this state. */ void removeState(uint8 state); /** Push the current hotspots onto the stack. @@ -86,11 +89,15 @@ public: /** Pop hotspots from the stack. */ void pop(); + /** Check the current hotspot. */ uint16 check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index); + /** Check the current hotspot. */ uint16 check(uint8 handleMouse, int16 delay); + /** Evaluate hotspot changes. */ void evaluate(); + /** Return the cursor found in the hotspot to the coordinates. */ int16 findCursor(uint16 x, uint16 y) const; private: @@ -123,13 +130,13 @@ private: /** Is this hotspot the block end marker? */ bool isEnd() const; - bool isInput() const; + bool isInput() const; bool isActiveInput() const; - bool isFilled() const; + bool isFilled() const; bool isFilledEnabled() const; - bool isFilledNew() const; - bool isDisabled() const; + bool isFilledNew() const; + bool isDisabled() const; /** Are the specified coordinates in the hotspot? */ bool isIn(uint16 x, uint16 y) const; @@ -155,6 +162,7 @@ private: uint16 fontIndex; uint16 backColor; uint16 frontColor; + uint16 length; const char *str; }; @@ -178,6 +186,7 @@ private: */ void recalculate(bool force); + /** Is this a valid hotspot? */ bool isValid(uint16 key, uint16 id, uint16 index) const; /** Call a hotspot subroutine. */ @@ -190,32 +199,40 @@ private: /** Which hotspot is the mouse cursor currently at? */ uint16 checkMouse(Type type, uint16 &id, uint16 &index) const; - void checkHotspotChanged(); + /** Did the current hotspot change in the meantime? */ + bool checkHotspotChanged(); - uint16 readString(uint16 xPos, uint16 yPos, uint16 width, uint16 height, + /** Update events from a specific input. */ + uint16 updateInput(uint16 xPos, uint16 yPos, uint16 width, uint16 height, uint16 backColor, uint16 frontColor, char *str, uint16 fontIndex, - Type type, int16 &duration, uint16 &id, uint16 index); + Type type, int16 &duration, uint16 &id, uint16 &index); - uint16 handleInput(int16 time, uint16 inputCount, uint16 &curInput, + /** Handle all inputs we currently manage. */ + uint16 handleInputs(int16 time, uint16 inputCount, uint16 &curInput, InputDesc *inputs, uint16 &id, uint16 &index); + /** Evaluate adding new hotspots script commands. */ void evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, uint16 &validId, bool &hasInput, uint16 &inputCount); - // Finding certain inputs - uint16 findInput(uint16 input) const; + /** Find the hotspot index that corresponds to the input index. */ + uint16 inputToHotspot(uint16 input) const; + /** Find the input index that corresponds to the hotspot index. */ + uint16 hotspotToInput(uint16 hotspot) const; + /** Find the input that was clicked on. */ uint16 findClickedInput(uint16 index) const; - uint16 findNthInput(uint16 n) const; /** Calculate the graphical cursor position. */ void getTextCursorPos(const Video::FontDesc &font, const char *str, uint32 pos, uint16 x, uint16 y, uint16 width, uint16 height, uint16 &cursorX, uint16 &cursorY, uint16 &cursorWidth, uint16 &cursorHeight) const; - // Drawing functions + /** Fill that rectangle with the color. */ void fillRect(uint16 x, uint16 y, uint16 width, uint16 height, uint16 color) const; + /** Print the given text. */ void printText(uint16 x, uint16 y, const char *str, uint16 fontIndex, uint16 color) const; + /** Go through all inputs we manage and redraw their texts. */ void updateAllTexts(const InputDesc *inputs) const; }; -- cgit v1.2.3 From 08df8dc2721808c7019f49d9051e2eebfe8dad9c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 6 Jul 2009 02:46:59 +0000 Subject: Bugfix for node enabling/disabling, which was previously allowing the player to walk through closed doors and into the walls svn-id: r42162 --- engines/cruise/ctp.cpp | 4 ++-- engines/cruise/function.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/cruise/ctp.cpp b/engines/cruise/ctp.cpp index be4639af4d..11d5f582ed 100644 --- a/engines/cruise/ctp.cpp +++ b/engines/cruise/ctp.cpp @@ -209,9 +209,9 @@ int setNodeState(int nodeIdx, int nodeState) { int oldState = walkboxState[nodeIdx]; if (nodeState == -1) - return + return oldState; - walkboxState[nodeIdx] = nodeState; + walkboxState[nodeIdx] = nodeState; return oldState; } diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp index eab69c6846..d0443ef458 100644 --- a/engines/cruise/function.cpp +++ b/engines/cruise/function.cpp @@ -828,7 +828,7 @@ int16 Op_Preload(void) { } int16 Op_LoadCt(void) { - return initCt((char*)popPtr()); + return initCt((const char *)popPtr()); } int16 Op_EndAnim(void) { -- cgit v1.2.3 From dc0f6dce7698ce383ad7ca82f8ae1dcba984a044 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Mon, 6 Jul 2009 06:21:59 +0000 Subject: Use graphics surfaces for screen buffers, and always use correct pitch when writing to the frameBuffer. svn-id: r42163 --- engines/agos/agos.cpp | 35 +++++---- engines/agos/agos.h | 12 ++-- engines/agos/charset-fontdata.cpp | 20 ++++-- engines/agos/charset.cpp | 8 +-- engines/agos/draw.cpp | 110 ++++++++++++++++++---------- engines/agos/event.cpp | 4 +- engines/agos/gfx.cpp | 146 +++++++++++++++++++------------------- engines/agos/icons.cpp | 44 ++++++------ engines/agos/menus.cpp | 8 +-- engines/agos/oracle.cpp | 40 +++++------ engines/agos/verb.cpp | 4 +- engines/agos/vga.cpp | 25 ++++--- engines/agos/vga_e2.cpp | 46 ++++++------ engines/agos/vga_pn.cpp | 2 +- engines/agos/vga_s2.cpp | 4 +- engines/agos/vga_ww.cpp | 20 +++--- engines/agos/window.cpp | 16 ++--- 17 files changed, 305 insertions(+), 239 deletions(-) diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index cdbeeecd8e..4a8170b2a4 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -33,6 +33,8 @@ #include "agos/agos.h" #include "agos/vga.h" +#include "graphics/surface.h" + #include "sound/mididrv.h" #include "sound/mods/protracker.h" #include "sound/audiocd.h" @@ -182,8 +184,6 @@ AGOSEngine::AGOSEngine(OSystem *syst) _subroutineList = 0; - _dxSurfacePitch = 0; - _recursionDepth = 0; _lastVgaTick = 0; @@ -490,12 +490,13 @@ AGOSEngine::AGOSEngine(OSystem *syst) _backGroundBuf = 0; _backBuf = 0; _scaleBuf = 0; + _window4BackScn = 0; + _window6BackScn = 0; + printf("Cleared all\n"); _window3Flag = 0; _window4Flag = 0; _window6Flag = 0; - _window4BackScn = 0; - _window6BackScn = 0; _moveXMin = 0; _moveYMin = 0; @@ -580,26 +581,34 @@ Common::Error AGOSEngine::init() { syncSoundSettings(); // allocate buffers - _backGroundBuf = (byte *)calloc(_screenWidth * _screenHeight, 1); + _backGroundBuf = new Graphics::Surface(); + _backGroundBuf->create(_screenWidth, _screenHeight, 1); if (getGameType() == GType_FF || getGameType() == GType_PP) { - _backBuf = (byte *)calloc(_screenWidth * _screenHeight, 1); - _scaleBuf = (byte *)calloc(_screenWidth * _screenHeight, 1); + _backBuf = new Graphics::Surface(); + _backBuf->create(_screenWidth, _screenHeight, 1); + _scaleBuf = new Graphics::Surface(); + _scaleBuf->create(_screenWidth, _screenHeight, 1); } if (getGameType() == GType_SIMON2) { - _window4BackScn = (byte *)calloc(_screenWidth * _screenHeight, 1); + _window4BackScn = new Graphics::Surface(); + _window4BackScn->create(_screenWidth, _screenHeight, 1); } else if (getGameType() == GType_SIMON1) { - _window4BackScn = (byte *)calloc(_screenWidth * 134, 1); + _window4BackScn = new Graphics::Surface(); + _window4BackScn->create(_screenWidth, 134, 1); } else if (getGameType() == GType_WW || getGameType() == GType_ELVIRA2) { - _window4BackScn = (byte *)calloc(224 * 127, 1); + _window4BackScn = new Graphics::Surface(); + _window4BackScn->create(224, 127, 1); } else if (getGameType() == GType_ELVIRA1) { + _window4BackScn = new Graphics::Surface(); if (getPlatform() == Common::kPlatformAmiga && (getFeatures() & GF_DEMO)) { - _window4BackScn = (byte *)calloc(224 * 196, 1); + _window4BackScn->create(224, 196, 1); } else { - _window4BackScn = (byte *)calloc(224 * 144, 1); + _window4BackScn->create(224, 144, 1); } - _window6BackScn = (byte *)calloc(48 * 80, 1); + _window6BackScn = new Graphics::Surface(); + _window6BackScn->create(48, 80, 1); } setupGame(); diff --git a/engines/agos/agos.h b/engines/agos/agos.h index f6a85d498d..093f7bb039 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -276,8 +276,6 @@ protected: Subroutine *_subroutineList; - uint16 _dxSurfacePitch; - uint8 _recursionDepth; uint32 _lastVgaTick; @@ -527,8 +525,6 @@ protected: uint8 _window3Flag; uint8 _window4Flag; uint8 _window6Flag; - byte *_window4BackScn; - byte *_window6BackScn; uint16 _moveXMin, _moveYMin; uint16 _moveXMax, _moveYMax; @@ -566,9 +562,11 @@ protected: byte _saveLoadType, _saveLoadSlot; char _saveLoadName[108]; - byte *_backGroundBuf; - byte *_backBuf; - byte *_scaleBuf; + Graphics::Surface *_backGroundBuf; + Graphics::Surface *_backBuf; + Graphics::Surface *_scaleBuf; + Graphics::Surface *_window4BackScn; + Graphics::Surface *_window6BackScn; Common::RandomSource _rnd; diff --git a/engines/agos/charset-fontdata.cpp b/engines/agos/charset-fontdata.cpp index d23e772306..1cbc4f95dc 100644 --- a/engines/agos/charset-fontdata.cpp +++ b/engines/agos/charset-fontdata.cpp @@ -2090,7 +2090,7 @@ static const byte english_pnFont[] = { void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) { const byte *src; byte color, *dst; - uint h, w, i; + uint dstPitch, h, w, i; if (_noOracleScroll) return; @@ -2100,7 +2100,8 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) { Graphics::Surface *screen = _system->lockScreen(); if (getGameType() == GType_FF || getGameType() == GType_PP) { - dst = getBackGround() + y * _dxSurfacePitch + x + window->textColumnOffset; + dst = getBackGround(); + dstPitch = _backGroundBuf->pitch; h = 13; w = getFeebleFontSize(chr); @@ -2109,7 +2110,8 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) { else src = feeble_windowFont + (chr - 32) * 13; } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { - dst = (byte *)screen->pixels + y * _dxSurfacePitch + x + window->textColumnOffset; + dst = (byte *)screen->pixels; + dstPitch = screen->pitch; h = 8; w = 6; @@ -2145,7 +2147,8 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) { error("windowDrawChar: Unknown language %d", _language); } } else if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) { - dst = (byte *)screen->pixels + y * _dxSurfacePitch + x + window->textColumnOffset; + dst = (byte *)screen->pixels; + dstPitch = screen->pitch; h = 8; w = 6; @@ -2169,18 +2172,21 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) { error("windowDrawChar: Unknown language %d", _language); } } else if (getGameType() == GType_ELVIRA1) { - dst = (byte *)screen->pixels + y * _dxSurfacePitch + x + window->textColumnOffset; + dst = (byte *)screen->pixels; + dstPitch = screen->pitch; h = 8; w = 6; src = english_elvira1Font + (chr - 32) * 8; } else { - dst = (byte *)screen->pixels + y * _dxSurfacePitch + x + window->textColumnOffset; + dst = (byte *)screen->pixels; + dstPitch = screen->pitch; h = 8; w = 8; src = english_pnFont + (chr - 32) * 8; } + dst += y * dstPitch + x + window->textColumnOffset; color = window->textColor; if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) @@ -2201,7 +2207,7 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) { b <<= 1; } while (++i != w); - dst += _dxSurfacePitch; + dst += dstPitch; } while (--h); _system->unlockScreen(); diff --git a/engines/agos/charset.cpp b/engines/agos/charset.cpp index c60640d761..5b0a694312 100644 --- a/engines/agos/charset.cpp +++ b/engines/agos/charset.cpp @@ -639,13 +639,13 @@ void AGOSEngine::windowScroll(WindowBlock *window) { w = window->width * 8; h = (window->height -1) * 8; - dst = (byte *)screen->pixels + window->y * _screenWidth + window->x * 8; - src = dst + 8 * _screenWidth; + dst = (byte *)screen->pixels + window->y * screen->pitch + window->x * 8; + src = dst + 8 * screen->pitch; do { memcpy(dst, src, w); - src += _screenWidth; - dst += _screenWidth; + src += screen->pitch; + dst += screen->pitch; } while (--h); _system->unlockScreen(); diff --git a/engines/agos/draw.cpp b/engines/agos/draw.cpp index 19520e66e9..d09f02c76d 100644 --- a/engines/agos/draw.cpp +++ b/engines/agos/draw.cpp @@ -35,18 +35,15 @@ namespace AGOS { byte *AGOSEngine::getBackBuf() { - _dxSurfacePitch = _screenWidth; - return _backBuf; + return (byte *)_backBuf->pixels; } byte *AGOSEngine::getBackGround() { - _dxSurfacePitch = _screenWidth; - return _backGroundBuf; + return (byte *)_backGroundBuf->pixels; } byte *AGOSEngine::getScaleBuf() { - _dxSurfacePitch = _screenWidth; - return _scaleBuf; + return (byte *)_scaleBuf->pixels; } void AGOSEngine_Feeble::animateSpritesByY() { @@ -166,7 +163,7 @@ void AGOSEngine::animateSprites() { _wallOn--; VC10_state state; - state.srcPtr = getBackGround() + 3 * _screenWidth + 3 * 16; + state.srcPtr = getBackGround() + 3 * _backGroundBuf->pitch + 3 * 16; state.height = state.draw_height = 127; state.width = state.draw_width = 14; state.y = 0; @@ -230,7 +227,7 @@ void AGOSEngine::animateSprites() { debug(0, "Using special wall"); uint8 color, h, len; - byte *dst = _window4BackScn; + byte *dst = (byte *)_window4BackScn->pixels; color = (_variableArray[293] & 1) ? 13 : 15; _wallOn = 2; @@ -260,7 +257,7 @@ void AGOSEngine::animateSprites() { } else if (getGameType() == GType_ELVIRA2 && _variableArray[71] & 2) { // Used by the Unholy Barrier spell uint8 color, h, len; - byte *dst = _window4BackScn; + byte *dst = (byte *)_window4BackScn->pixels; color = 1; _wallOn = 2; @@ -495,11 +492,11 @@ void AGOSEngine::saveBackGround(VgaSprite *vsp) { int16 y = vsp->y - _scrollY; if (_window3Flag == 1) { - animTable->srcPtr = (const byte *)_window4BackScn; + animTable->srcPtr = (const byte *)_window4BackScn->pixels; } else { int xoffs = (_videoWindows[vsp->windowNum * 4 + 0] * 2 + x) * 8; int yoffs = (_videoWindows[vsp->windowNum * 4 + 1] + y); - animTable->srcPtr = getBackGround() + xoffs + yoffs * _screenWidth; + animTable->srcPtr = getBackGround() + yoffs * _backGroundBuf->pitch + xoffs; } animTable->x = x; @@ -571,39 +568,39 @@ void AGOSEngine::displayBoxStars() { dst = (byte *)screen->pixels; - dst += (((_dxSurfacePitch / 4) * y_) * 4) + x_; + dst += (((screen->pitch / 4) * y_) * 4) + x_; - b = _dxSurfacePitch; + b = screen->pitch; dst[4] = color; dst[b+1] = color; dst[b+4] = color; dst[b+7] = color; - b += _dxSurfacePitch; + b += screen->pitch; dst[b+2] = color; dst[b+4] = color; dst[b+6] = color; - b += _dxSurfacePitch; + b += screen->pitch; dst[b+3] = color; dst[b+5] = color; - b += _dxSurfacePitch; + b += screen->pitch; dst[b] = color; dst[b+1] = color; dst[b+2] = color; dst[b+6] = color; dst[b+7] = color; dst[b+8] = color; - b += _dxSurfacePitch; + b += screen->pitch; dst[b+3] = color; dst[b+5] = color; - b += _dxSurfacePitch; + b += screen->pitch; dst[b+2] = color; dst[b+4] = color; dst[b+6] = color; - b += _dxSurfacePitch; + b += screen->pitch; dst[b+1] = color; dst[b+4] = color; dst[b+7] = color; - b += _dxSurfacePitch; + b += screen->pitch; dst[b+4] = color; } } while (ha++, --count); @@ -645,7 +642,7 @@ void AGOSEngine::scrollScreen() { } src = _scrollImage + y / 2; - decodeRow(dst, src + readUint32Wrapper(src), _scrollWidth, _dxSurfacePitch); + decodeRow(dst, src + readUint32Wrapper(src), _scrollWidth, _backGroundBuf->pitch); _scrollY += _scrollFlag; vcWriteVar(250, _scrollY); @@ -670,13 +667,19 @@ void AGOSEngine::scrollScreen() { src = _scrollImage + x / 2; else src = _scrollImage + x * 4; - decodeColumn(dst, src + readUint32Wrapper(src), _scrollHeight, _dxSurfacePitch); + decodeColumn(dst, src + readUint32Wrapper(src), _scrollHeight, _backGroundBuf->pitch); _scrollX += _scrollFlag; vcWriteVar(251, _scrollX); if (getGameType() == GType_SIMON2) { - memcpy(_window4BackScn, _backGroundBuf, _scrollHeight * _screenWidth); + src = getBackGround(); + dst = (byte *)_window4BackScn->pixels; + for (int i = 0; i < _scrollHeight; i++) { + memcpy(dst, src, _screenWidth); + src += _backGroundBuf->pitch; + dst += _window4BackScn->pitch; + } } else { fillBackFromBackGround(_scrollHeight, _screenWidth); } @@ -707,27 +710,53 @@ void AGOSEngine::clearSurfaces() { _system->fillScreen(0); if (_backBuf) { - memset(_backBuf, 0, _screenHeight * _screenWidth); + memset(getBackBuf(), 0, _backBuf->h * _backBuf->pitch); } } void AGOSEngine::fillBackFromBackGround(uint16 height, uint16 width) { - memcpy(_backBuf, _backGroundBuf, height * width); + byte *src = getBackGround(); + byte *dst = getBackBuf(); + for (int i = 0; i < height; i++) { + memcpy(dst, src, width); + src += _backGroundBuf->pitch; + dst += _backBuf->pitch; + } } void AGOSEngine::fillBackFromFront() { Graphics::Surface *screen = _system->lockScreen(); - memcpy(_backBuf, (byte *)screen->pixels, _screenHeight * _screenWidth); + byte *src = (byte *)screen->pixels; + byte *dst = getBackBuf(); + + for (int i = 0; i < _screenHeight; i++) { + memcpy(dst, src, _screenWidth); + src += screen->pitch; + dst += _backBuf->pitch; + } _system->unlockScreen(); } void AGOSEngine::fillBackGroundFromBack() { - memcpy(_backGroundBuf, _backBuf, _screenHeight * _screenWidth); + byte *src = getBackBuf(); + byte *dst = getBackGround(); + for (int i = 0; i < _screenHeight; i++) { + memcpy(dst, src, _screenWidth); + src += _backBuf->pitch; + dst += _backGroundBuf->pitch; + } } void AGOSEngine::fillBackGroundFromFront() { Graphics::Surface *screen = _system->lockScreen(); - memcpy(_backGroundBuf, (byte *)screen->pixels, _screenHeight * _screenWidth); + byte *src = (byte *)screen->pixels; + byte *dst = getBackGround(); + + for (int i = 0; i < _screenHeight; i++) { + memcpy(dst, src, _screenWidth); + src += screen->pitch; + dst += _backGroundBuf->pitch; + } _system->unlockScreen(); } @@ -756,8 +785,13 @@ void AGOSEngine::displayScreen() { Graphics::Surface *screen = _system->lockScreen(); if (getGameType() == GType_PP || getGameType() == GType_FF) { - memcpy((byte *)screen->pixels, getBackBuf(), _screenWidth * _screenHeight); - + byte *src = getBackBuf(); + byte *dst = (byte *)screen->pixels; + for (int i = 0; i < _screenHeight; i++) { + memcpy(dst, src, _screenWidth); + src += _backBuf->pitch; + dst += screen->pitch; + } if (getGameId() != GID_DIMP) fillBackFromBackGround(_screenHeight, _screenWidth); } else { @@ -767,12 +801,12 @@ void AGOSEngine::displayScreen() { uint16 srcWidth, width, height; byte *dst = (byte *)screen->pixels; - const byte *src = _window4BackScn; + const byte *src = (const byte *)_window4BackScn->pixels; if (_window3Flag == 1) { src = getBackGround(); } - dst += (_moveYMin + _videoWindows[17]) * _screenWidth; + dst += (_moveYMin + _videoWindows[17]) * screen->pitch; dst += (_videoWindows[16] * 16) + _moveXMin; src += (_videoWindows[18] * 16 * _moveYMin); @@ -785,7 +819,7 @@ void AGOSEngine::displayScreen() { for (; height > 0; height--) { memcpy(dst, src, width); - dst += _screenWidth; + dst += screen->pitch; src += srcWidth; } @@ -798,12 +832,12 @@ void AGOSEngine::displayScreen() { if (_window6Flag == 2) { _window6Flag = 0; - byte *src = _window6BackScn; - byte *dst = (byte *)screen->pixels + 16320; + byte *src = (byte *)_window6BackScn->pixels; + byte *dst = (byte *)screen->pixels + 51 * screen->pitch; for (int i = 0; i < 80; i++) { - memcpy(dst, src, 48); - dst += _screenWidth; - src += 48; + memcpy(dst, src, _window6BackScn->w); + dst += screen->pitch; + src += _window6BackScn->pitch; } } } diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp index ad7b079d53..b9c16d3d86 100644 --- a/engines/agos/event.cpp +++ b/engines/agos/event.cpp @@ -367,12 +367,12 @@ void AGOSEngine::drawStuff(const byte *src, uint xoffs) { const uint8 y = (getPlatform() == Common::kPlatformAtariST) ? 132 : 135; Graphics::Surface *screen = _system->lockScreen(); - byte *dst = (byte *)screen->pixels + y * _screenWidth + xoffs; + byte *dst = (byte *)screen->pixels + y * screen->pitch + xoffs; for (uint h = 0; h < 6; h++) { memcpy(dst, src, 4); src += 4; - dst += _screenWidth; + dst += screen->pitch; } _system->unlockScreen(); diff --git a/engines/agos/gfx.cpp b/engines/agos/gfx.cpp index 4b2d2b3321..1755391ac3 100644 --- a/engines/agos/gfx.cpp +++ b/engines/agos/gfx.cpp @@ -272,13 +272,13 @@ void AGOSEngine_Feeble::scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scro byte *src = getScaleBuf(); byte *dst = getBackBuf(); - dst += _dxSurfacePitch * dstRect.top + dstRect.left; + dst += dstRect.top * _backBuf->pitch + dstRect.left; for (int dstY = 0; dstY < scaledH; dstY++) { if (dstRect.top + dstY >= 0 && dstRect.top + dstY < _screenHeight) { int srcY = (dstY * h) / scaledH; - byte *srcPtr = src + _dxSurfacePitch * srcY; - byte *dstPtr = dst + _dxSurfacePitch * dstY; + byte *srcPtr = src + _scaleBuf->pitch * srcY; + byte *dstPtr = dst + _backBuf->pitch * dstY; for (int dstX = 0; dstX < scaledW; dstX++) { if (dstRect.left + dstX >= 0 && dstRect.left + dstX < _screenWidth) { int srcX = (dstX * w) / scaledW; @@ -292,12 +292,12 @@ void AGOSEngine_Feeble::scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scro void AGOSEngine_Feeble::drawImage(VC10_state *state) { state->surf_addr = getBackBuf(); - state->surf_pitch = _dxSurfacePitch; + state->surf_pitch = _backBuf->pitch; if (state->flags & kDFCompressed) { if (state->flags & kDFScaled) { state->surf_addr = getScaleBuf(); - state->surf_pitch = _dxSurfacePitch; + state->surf_pitch = _scaleBuf->pitch; uint w, h; byte *src, *dst, *dstPtr; @@ -314,7 +314,7 @@ void AGOSEngine_Feeble::drawImage(VC10_state *state) { h = 0; do { *dst = *src; - dst += _screenWidth; + dst += state->surf_pitch; src++; } while (++h != state->draw_height); dstPtr++; @@ -330,7 +330,7 @@ void AGOSEngine_Feeble::drawImage(VC10_state *state) { } } else if (state->flags & kDFOverlayed) { state->surf_addr = getScaleBuf(); - state->surf_pitch = _dxSurfacePitch; + state->surf_pitch = _scaleBuf->pitch; state->surf_addr += (state->x + _scrollX) + (state->y + _scrollY) * state->surf_pitch; uint w, h; @@ -352,7 +352,7 @@ void AGOSEngine_Feeble::drawImage(VC10_state *state) { color = *src; if (color != 0) *dst = color; - dst += _screenWidth; + dst += state->surf_pitch; src++; } while (++h != state->draw_height); dstPtr++; @@ -406,7 +406,7 @@ void AGOSEngine_Feeble::drawImage(VC10_state *state) { color = *src; if (color) *dst = color; - dst += _screenWidth; + dst += state->surf_pitch; src++; } while (++h != state->draw_height); dstPtr++; @@ -425,7 +425,7 @@ void AGOSEngine_Feeble::drawImage(VC10_state *state) { color = *src; if ((state->flags & kDFNonTrans) || color != 0) *dst = color; - dst += _screenWidth; + dst += state->surf_pitch; src++; } while (++h != state->draw_height); dstPtr++; @@ -456,7 +456,7 @@ void AGOSEngine_Feeble::drawImage(VC10_state *state) { dst[count] = color; } } - dst += _screenWidth; + dst += state->surf_pitch; src += state->width; } while (--state->draw_height); } @@ -557,8 +557,8 @@ void AGOSEngine_Simon1::drawMaskedImage(VC10_state *state) { dst[count * 2 + 1] = src[count * 2 + 1]; } } - src += _screenWidth; - dst += _screenWidth; + src += state->surf2_pitch; + dst += state->surf_pitch; mask += state->width * 8; } while (--state->draw_height); } @@ -615,7 +615,7 @@ void AGOSEngine_Simon1::draw32ColorImage(VC10_state *state) { dst += 8; src += 5; } while (--count); - dstPtr += _screenWidth; + dstPtr += state->surf_pitch; } while (--state->draw_height); } else { src = state->srcPtr + (state->width * state->y_skip * 16) + (state->x_skip * 8); @@ -628,7 +628,7 @@ void AGOSEngine_Simon1::draw32ColorImage(VC10_state *state) { for (i = 0; i != state->draw_width; i++) if ((state->flags & kDFNonTrans) || src[i]) dst[i] = src[i] + state->paletteMod; - dst += _screenWidth; + dst += state->surf_pitch; src += state->width * 16; } while (--h); } @@ -648,10 +648,10 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) { uint16 xoffs, yoffs; if (getGameType() == GType_SIMON2) { state->surf2_addr = getBackGround(); - state->surf2_pitch = _screenWidth; + state->surf2_pitch = _backGroundBuf->pitch; - state->surf_addr = _window4BackScn; - state->surf_pitch = _screenWidth; + state->surf_addr = (byte *)_window4BackScn->pixels; + state->surf_pitch = _window4BackScn->pitch; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; yoffs = (vlut[1] - _videoWindows[17] + state->y); @@ -665,9 +665,9 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) { // The DOS Floppy demo was based off Waxworks engine if (_windowNum == 4 || (_windowNum >= 10 && _windowNum <= 27)) { state->surf2_addr = getBackGround(); - state->surf2_pitch = _screenWidth; + state->surf2_pitch = _backGroundBuf->pitch; - state->surf_addr = _window4BackScn; + state->surf_addr = (byte *)_window4BackScn; state->surf_pitch = _videoWindows[18] * 16; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; @@ -680,7 +680,7 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) { _window4Flag = 1; } else { state->surf_addr = (byte *)screen->pixels; - state->surf_pitch = _screenWidth; + state->surf_pitch = screen->pitch; xoffs = (vlut[0] * 2 + state->x) * 8; yoffs = vlut[1] + state->y; @@ -689,16 +689,16 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) { if (_windowNum == 3 || _windowNum == 4 || _windowNum >= 10) { if (_window3Flag == 1) { state->surf2_addr = getBackGround(); - state->surf2_pitch = _screenWidth; + state->surf2_pitch = _backGroundBuf->pitch; state->surf_addr = getBackGround(); - state->surf_pitch = _screenWidth; + state->surf_pitch = _backGroundBuf->pitch; } else { state->surf2_addr = getBackGround(); - state->surf2_pitch = _screenWidth; + state->surf2_pitch = _backGroundBuf->pitch; - state->surf_addr = _window4BackScn; - state->surf_pitch = _screenWidth; + state->surf_addr = (byte *)_window4BackScn->pixels; + state->surf_pitch = _window4BackScn->pitch; } xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; @@ -711,10 +711,10 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) { _window4Flag = 1; } else { state->surf2_addr = getBackGround(); - state->surf2_pitch = _screenWidth; + state->surf2_pitch = _backGroundBuf->pitch; state->surf_addr = (byte *)screen->pixels; - state->surf_pitch = _screenWidth; + state->surf_pitch = screen->pitch; xoffs = (vlut[0] * 2 + state->x) * 8; yoffs = vlut[1] + state->y; @@ -862,7 +862,7 @@ void AGOSEngine::drawImage(VC10_state *state) { uint16 xoffs = 0, yoffs = 0; if (getGameType() == GType_WW) { if (_windowNum == 4 || (_windowNum >= 10 && _windowNum <= 27)) { - state->surf_addr = _window4BackScn; + state->surf_addr = (byte *)_window4BackScn->pixels; state->surf_pitch = _videoWindows[18] * 16; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; @@ -875,14 +875,14 @@ void AGOSEngine::drawImage(VC10_state *state) { _window4Flag = 1; } else { state->surf_addr = (byte *)screen->pixels; - state->surf_pitch = _screenWidth; + state->surf_pitch = screen->pitch; xoffs = (vlut[0] * 2 + state->x) * 8; yoffs = vlut[1] + state->y; } } else if (getGameType() == GType_ELVIRA2) { if (_windowNum == 4 || _windowNum >= 10) { - state->surf_addr = _window4BackScn; + state->surf_addr = (byte *)_window4BackScn->pixels; state->surf_pitch = _videoWindows[18] * 16; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; @@ -895,26 +895,26 @@ void AGOSEngine::drawImage(VC10_state *state) { _window4Flag = 1; } else { state->surf_addr = (byte *)screen->pixels; - state->surf_pitch = _screenWidth; + state->surf_pitch = screen->pitch; xoffs = (vlut[0] * 2 + state->x) * 8; yoffs = vlut[1] + state->y; } } else if (getGameType() == GType_ELVIRA1) { if (_windowNum == 6) { - state->surf_addr = _window6BackScn; - state->surf_pitch = 48; + state->surf_addr = (byte *)_window6BackScn->pixels; + state->surf_pitch = _window6BackScn->pitch; xoffs = state->x * 8; yoffs = state->y; } else if (_windowNum == 2 || _windowNum == 3) { state->surf_addr = (byte *)screen->pixels; - state->surf_pitch = _screenWidth; + state->surf_pitch = screen->pitch; xoffs = (vlut[0] * 2 + state->x) * 8; yoffs = vlut[1] + state->y; } else { - state->surf_addr = _window4BackScn; + state->surf_addr = (byte *)_window4BackScn->pixels; state->surf_pitch = _videoWindows[18] * 16; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; @@ -928,7 +928,7 @@ void AGOSEngine::drawImage(VC10_state *state) { } } else { state->surf_addr = (byte *)screen->pixels; - state->surf_pitch = _screenWidth; + state->surf_pitch = screen->pitch; xoffs = (vlut[0] * 2 + state->x) * 8; yoffs = vlut[1] + state->y; @@ -957,7 +957,7 @@ void AGOSEngine::drawImage(VC10_state *state) { void AGOSEngine::horizontalScroll(VC10_state *state) { const byte *src; byte *dst; - int w; + int dstPitch, w; if (getGameType() == GType_FF) _scrollXMax = state->width - 640; @@ -974,9 +974,11 @@ void AGOSEngine::horizontalScroll(VC10_state *state) { vcWriteVar(251, _scrollX); if (getGameType() == GType_SIMON2) { - dst = _window4BackScn; + dst = (byte *)_window4BackScn->pixels; + dstPitch = _window4BackScn->pitch; } else { dst = getBackBuf(); + dstPitch = _backBuf->pitch; } if (getGameType() == GType_FF) @@ -985,7 +987,7 @@ void AGOSEngine::horizontalScroll(VC10_state *state) { src = state->srcPtr + _scrollX * 4; for (w = 0; w < _screenWidth; w += 8) { - decodeColumn(dst, src + readUint32Wrapper(src), state->height, _dxSurfacePitch); + decodeColumn(dst, src + readUint32Wrapper(src), state->height, dstPitch); dst += 8; src += 4; } @@ -1015,7 +1017,7 @@ void AGOSEngine::verticalScroll(VC10_state *state) { src = state->srcPtr + _scrollY / 2; for (h = 0; h < _screenHeight; h += 8) { - decodeRow(dst, src + READ_LE_UINT32(src), state->width, _dxSurfacePitch); + decodeRow(dst, src + READ_LE_UINT32(src), state->width, _backBuf->pitch); dst += 8 * state->width; src += 4; } @@ -1366,21 +1368,21 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas uint height = _videoWindows[updateWindow * 4 + 3]; Graphics::Surface *screen = _system->lockScreen(); - byte *dst = getBackGround() + xoffs + yoffs * _screenWidth; + byte *dst = (byte *)_backGroundBuf->getBasePtr(xoffs, yoffs); byte *src = 0; uint srcWidth = 0; if (getGameType() == GType_SIMON2) { - src = _window4BackScn + xoffs + yoffs * 320; + src = (byte *)_window4BackScn->getBasePtr(xoffs, yoffs); srcWidth = 320; } else if (getGameType() == GType_SIMON1 && (getFeatures() & GF_DEMO)) { // The DOS Floppy demo was based off Waxworks engine if (updateWindow == 4 || updateWindow >= 10) { - src = _window4BackScn; + src = (byte *)_window4BackScn->pixels; srcWidth = _videoWindows[18] * 16; } else if (updateWindow == 3 || updateWindow == 9) { - src = (byte *)screen->pixels + xoffs + yoffs * _screenWidth; - srcWidth = _screenWidth; + src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs; + srcWidth = screen->pitch; } else { _system->unlockScreen(); _videoLockOut &= ~0x20; @@ -1388,14 +1390,14 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas } } else if (getGameType() == GType_SIMON1) { if (updateWindow == 4) { - src = _window4BackScn; + src = (byte *)_window4BackScn->pixels; srcWidth = _videoWindows[18] * 16; } else if (updateWindow >= 10) { - src = _window4BackScn + xoffs + yoffs * 320; + src = (byte *)_window4BackScn->pixels + xoffs + yoffs * 320; srcWidth = _videoWindows[18] * 16; } else if (updateWindow == 0) { - src = (byte *)screen->pixels + xoffs + yoffs * _screenWidth; - srcWidth = _screenWidth; + src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs; + srcWidth = screen->pitch; } else { _system->unlockScreen(); _videoLockOut &= ~0x20; @@ -1403,11 +1405,11 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas } } else if (getGameType() == GType_WW) { if (updateWindow == 4 || updateWindow >= 10) { - src = _window4BackScn; + src = (byte *)_window4BackScn->pixels; srcWidth = _videoWindows[18] * 16; } else if (updateWindow == 3 || updateWindow == 9) { - src = (byte *)screen->pixels + xoffs + yoffs * _screenWidth; - srcWidth = _screenWidth; + src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs; + srcWidth = screen->pitch; } else { _system->unlockScreen(); _videoLockOut &= ~0x20; @@ -1415,11 +1417,11 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas } } else if (getGameType() == GType_ELVIRA2) { if (updateWindow == 4 || updateWindow >= 10) { - src = _window4BackScn; + src = (byte *)_window4BackScn->pixels; srcWidth = _videoWindows[18] * 16; } else if (updateWindow == 3) { - src = (byte *)screen->pixels + xoffs + yoffs * _screenWidth; - srcWidth = _screenWidth; + src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs; + srcWidth = screen->pitch; } else { _system->unlockScreen(); _videoLockOut &= ~0x20; @@ -1428,25 +1430,25 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas } else if (getGameType() == GType_ELVIRA1) { if (updateWindow == 6) { _window6Flag = 1; - src = _window6BackScn; + src = (byte *)_window6BackScn->pixels; srcWidth = 48; } else if (updateWindow == 2 || updateWindow == 3) { - src = (byte *)screen->pixels + xoffs + yoffs * _screenWidth; - srcWidth = _screenWidth; + src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs; + srcWidth = screen->pitch; } else { - src = _window4BackScn; + src = (byte *)_window4BackScn->pixels; srcWidth = _videoWindows[18] * 16; } } else { - src = (byte *)screen->pixels + xoffs + yoffs * _screenWidth; - srcWidth = _screenWidth; + src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs; + srcWidth = screen->pitch; } _boxStarHeight = height; for (; height > 0; height--) { memcpy(dst, src, width); - dst += _screenWidth; + dst += _backGroundBuf->pitch; src += srcWidth; } @@ -1455,15 +1457,15 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas dst = (byte *)screen->pixels + 48; memset(dst, color, 224); - dst = (byte *)screen->pixels + 132 * _screenWidth + 48; + dst = (byte *)screen->pixels + 132 * screen->pitch + 48; memset(dst, color, 224); } else if (getGameType() == GType_ELVIRA1 && updateWindow == 3 && _bottomPalette) { - dst = (byte *)screen->pixels + 133 * _screenWidth; - int size = 67 * _screenWidth; + dst = (byte *)screen->pixels + 133 * screen->pitch; - while (size--) { - *dst += 0x10; - dst++; + for (int h = 0; h < 67; h++) { + for (int w = 0; w < _screenWidth; w++) + dst[w] += 0x10; + dst += screen->pitch; } } @@ -1480,16 +1482,16 @@ void AGOSEngine::drawEdging() { Graphics::Surface *screen = _system->lockScreen(); - dst = (byte *)screen->pixels + 136 * _screenWidth; + dst = (byte *)screen->pixels + 136 * screen->pitch; uint8 len = 52; while (len--) { dst[0] = color; dst[319] = color; - dst += _screenWidth; + dst += screen->pitch; } - dst = (byte *)screen->pixels + 187 * _screenWidth; + dst = (byte *)screen->pixels + 187 * screen->pitch; memset(dst, color, _screenWidth); _system->unlockScreen(); diff --git a/engines/agos/icons.cpp b/engines/agos/icons.cpp index 0472b1192b..2fd93e64f2 100644 --- a/engines/agos/icons.cpp +++ b/engines/agos/icons.cpp @@ -211,15 +211,15 @@ void AGOSEngine_Simon2::drawIcon(WindowBlock *window, uint icon, uint x, uint y) dst += 110; dst += x; - dst += (y + window->y) * _dxSurfacePitch; + dst += (y + window->y) * screen->pitch; src = _iconFilePtr; src += READ_LE_UINT16(src + icon * 4 + 0); - decompressIcon(dst, src, 20, 10, 224, _dxSurfacePitch); + decompressIcon(dst, src, 20, 10, 224, screen->pitch); src = _iconFilePtr; src += READ_LE_UINT16(src + icon * 4 + 2); - decompressIcon(dst, src, 20, 10, 208, _dxSurfacePitch); + decompressIcon(dst, src, 20, 10, 208, screen->pitch); _system->unlockScreen(); @@ -236,17 +236,17 @@ void AGOSEngine_Simon1::drawIcon(WindowBlock *window, uint icon, uint x, uint y) dst = (byte *)screen->pixels; dst += (x + window->x) * 8; - dst += (y * 25 + window->y) * _dxSurfacePitch; + dst += (y * 25 + window->y) * screen->pitch; if (getPlatform() == Common::kPlatformAmiga) { src = _iconFilePtr; src += READ_BE_UINT32(src + icon * 4); uint8 color = (getFeatures() & GF_32COLOR) ? 224 : 240; - decompressIconPlanar(dst, src, 24, 12, color, _dxSurfacePitch); + decompressIconPlanar(dst, src, 24, 12, color, screen->pitch); } else { src = _iconFilePtr; src += READ_LE_UINT16(src + icon * 2); - decompressIcon(dst, src, 24, 12, 224, _dxSurfacePitch); + decompressIcon(dst, src, 24, 12, 224, screen->pitch); } _system->unlockScreen(); @@ -264,17 +264,17 @@ void AGOSEngine_Waxworks::drawIcon(WindowBlock *window, uint icon, uint x, uint dst = (byte *)screen->pixels; dst += (x + window->x) * 8; - dst += (y * 20 + window->y) * _dxSurfacePitch; + dst += (y * 20 + window->y) * screen->pitch; uint8 color = dst[0] & 0xF0; if (getPlatform() == Common::kPlatformAmiga) { src = _iconFilePtr; src += READ_BE_UINT32(src + icon * 4); - decompressIconPlanar(dst, src, 24, 10, color, _dxSurfacePitch); + decompressIconPlanar(dst, src, 24, 10, color, screen->pitch); } else { src = _iconFilePtr; src += READ_LE_UINT16(src + icon * 2); - decompressIcon(dst, src, 24, 10, color, _dxSurfacePitch); + decompressIcon(dst, src, 24, 10, color, screen->pitch); } _system->unlockScreen(); @@ -292,17 +292,17 @@ void AGOSEngine_Elvira2::drawIcon(WindowBlock *window, uint icon, uint x, uint y dst = (byte *)screen->pixels; dst += (x + window->x) * 8; - dst += (y * 8 + window->y) * _dxSurfacePitch; + dst += (y * 8 + window->y) * screen->pitch; uint color = dst[0] & 0xF0; if (getFeatures() & GF_PLANAR) { src = _iconFilePtr; src += READ_BE_UINT32(src + icon * 4); - decompressIconPlanar(dst, src, 24, 12, color, _dxSurfacePitch); + decompressIconPlanar(dst, src, 24, 12, color, screen->pitch); } else { src = _iconFilePtr; src += READ_LE_UINT16(src + icon * 2); - decompressIcon(dst, src, 24, 12, color, _dxSurfacePitch); + decompressIcon(dst, src, 24, 12, color, screen->pitch); } _system->unlockScreen(); @@ -320,16 +320,16 @@ void AGOSEngine_Elvira1::drawIcon(WindowBlock *window, uint icon, uint x, uint y dst = (byte *)screen->pixels; dst += (x + window->x) * 8; - dst += (y * 8 + window->y) * _dxSurfacePitch; + dst += (y * 8 + window->y) * screen->pitch; if (getFeatures() & GF_PLANAR) { src = _iconFilePtr; src += READ_BE_UINT16(src + icon * 2); - decompressIconPlanar(dst, src, 24, 12, 16, _dxSurfacePitch); + decompressIconPlanar(dst, src, 24, 12, 16, screen->pitch); } else { src = _iconFilePtr; src += icon * 288; - decompressIconPlanar(dst, src, 24, 12, 16, _dxSurfacePitch, false); + decompressIconPlanar(dst, src, 24, 12, 16, screen->pitch, false); } _system->unlockScreen(); @@ -344,14 +344,14 @@ void AGOSEngine::drawIcon(WindowBlock *window, uint icon, uint x, uint y) { _videoLockOut |= 0x8000; Graphics::Surface *screen = _system->lockScreen(); - dst = (byte *)screen->pixels + y * _dxSurfacePitch + x * 8; + dst = (byte *)screen->pixels + y * screen->pitch + x * 8; src = _iconFilePtr + icon * 146; if (icon == 0xFF) { // Draw Blank Icon for (int yp = 0; yp < 24; yp++) { memset(dst, 0, 24); - dst += _dxSurfacePitch; + dst += screen->pitch; } } else { uint8 palette[4]; @@ -364,7 +364,7 @@ void AGOSEngine::drawIcon(WindowBlock *window, uint icon, uint x, uint y) { uint32 v1 = (READ_BE_UINT16(src) << 8) | *(src + 4); uint32 v2 = (READ_BE_UINT16(src + 2) << 8) | *(src + 5); for (int xp = 0; xp < 24; ++xp, v1 >>= 1, v2 >>= 1) { - dst[yp * _screenWidth + (23 - xp)] = palette[((v1 & 1) << 1) | (v2 & 1)]; + dst[yp * screen->pitch + (23 - xp)] = palette[((v1 & 1) << 1) | (v2 & 1)]; } } } @@ -952,7 +952,7 @@ void AGOSEngine::drawArrow(uint16 x, uint16 y, int8 dir) { } Graphics::Surface *screen = _system->lockScreen(); - byte *dst = (byte *)screen->pixels + y * _screenWidth + x * 8; + byte *dst = (byte *)screen->pixels + y * screen->pitch + x * 8; for (h = 0; h < 19; h++) { for (w = 0; w < 16; w++) { @@ -960,7 +960,7 @@ void AGOSEngine::drawArrow(uint16 x, uint16 y, int8 dir) { } src += dir; - dst+= _screenWidth; + dst+= screen->pitch; } _system->unlockScreen(); @@ -1043,7 +1043,7 @@ static const byte hitBarData[12 * 7] = { // Personal Nightmare specific void AGOSEngine_PN::drawIconHitBar() { Graphics::Surface *screen = _system->lockScreen(); - byte *dst = (byte *)screen->pixels + 3 * _dxSurfacePitch + 6 * 8; + byte *dst = (byte *)screen->pixels + 3 * screen->pitch + 6 * 8; const byte *src = hitBarData; uint8 color = (getPlatform() == Common::kPlatformPC) ? 7 : 15; @@ -1058,7 +1058,7 @@ void AGOSEngine_PN::drawIconHitBar() { b <<= 1; } } - dst += _dxSurfacePitch; + dst += screen->pitch; } _system->unlockScreen(); diff --git a/engines/agos/menus.cpp b/engines/agos/menus.cpp index 9e71849c6e..df837a5e16 100644 --- a/engines/agos/menus.cpp +++ b/engines/agos/menus.cpp @@ -170,7 +170,7 @@ void AGOSEngine::unlightMenuStrip() { mouseOff(); Graphics::Surface *screen = _system->lockScreen(); - src = (byte *)screen->pixels + 2832; + src = (byte *)screen->pixels + 8 * screen->pitch + 272; w = 48; h = 82; @@ -179,7 +179,7 @@ void AGOSEngine::unlightMenuStrip() { if (src[i] != 0) src[i] = 14; } - src += _dxSurfacePitch; + src += screen->pitch; } while (--h); for (i = 120; i != 130; i++) @@ -198,7 +198,7 @@ void AGOSEngine::lightMenuBox(uint hitarea) { mouseOff(); Graphics::Surface *screen = _system->lockScreen(); - src = (byte *)screen->pixels + ha->y * _dxSurfacePitch + ha->x; + src = (byte *)screen->pixels + ha->y * screen->pitch + ha->x; w = ha->width; h = ha->height; @@ -207,7 +207,7 @@ void AGOSEngine::lightMenuBox(uint hitarea) { if (src[i] == 14) src[i] = 15; } - src += _dxSurfacePitch; + src += screen->pitch; } while (--h); _system->unlockScreen(); diff --git a/engines/agos/oracle.cpp b/engines/agos/oracle.cpp index 88346fa9f8..e7192ea2ec 100644 --- a/engines/agos/oracle.cpp +++ b/engines/agos/oracle.cpp @@ -246,28 +246,28 @@ void AGOSEngine_Feeble::scrollOracleUp() { byte *src, *dst; uint16 w, h; - dst = getBackGround() + 103 * _screenWidth + 136; - src = getBackGround() + 106 * _screenWidth + 136; + dst = getBackGround() + 103 * _backGroundBuf->pitch + 136; + src = getBackGround() + 106 * _backGroundBuf->pitch + 136; for (h = 0; h < 21; h++) { for (w = 0; w < 360; w++) { if (dst[w] == 0 || dst[w] == 113 || dst[w] == 116 || dst[w] == 252) dst[w] = src[w]; } - dst += _screenWidth; - src += _screenWidth; + dst += _backGroundBuf->pitch; + src += _backGroundBuf->pitch; } for (h = 0; h < 80; h++) { memcpy(dst, src, 360); - dst += _screenWidth; - src += _screenWidth; + dst += _backGroundBuf->pitch; + src += _backGroundBuf->pitch; } for (h = 0; h < 3; h++) { memset(dst, 0, 360); - dst += _screenWidth; - src += _screenWidth; + dst += _backGroundBuf->pitch; + src += _backGroundBuf->pitch; } } @@ -275,13 +275,13 @@ void AGOSEngine_Feeble::scrollOracleDown() { byte *src, *dst; uint16 w, h; - src = getBackGround() + 203 * _screenWidth + 136; - dst = getBackGround() + 206 * _screenWidth + 136; + src = getBackGround() + 203 * _backGroundBuf->pitch + 136; + dst = getBackGround() + 206 * _backGroundBuf->pitch + 136; for (h = 0; h < 77; h++) { memcpy(dst, src, 360); - dst -= _screenWidth; - src -= _screenWidth; + dst -= _backGroundBuf->pitch; + src -= _backGroundBuf->pitch; } for (h = 0; h < 24; h++) { @@ -294,8 +294,8 @@ void AGOSEngine_Feeble::scrollOracleDown() { src[w] = 0; } } - dst -= _screenWidth; - src -= _screenWidth; + dst -= _backGroundBuf->pitch; + src -= _backGroundBuf->pitch; } } @@ -315,7 +315,7 @@ void AGOSEngine_Feeble::oracleLogo() { srcRect.bottom = 43; src = _iconFilePtr; - dst = getBackBuf() + _screenWidth * dstRect.top + dstRect.left; + dst = getBackBuf() + _backBuf->pitch * dstRect.top + dstRect.left; for (h = 0; h < dstRect.height(); h++) { for (w = 0; w < dstRect.width(); w++) { @@ -323,7 +323,7 @@ void AGOSEngine_Feeble::oracleLogo() { dst[w] = src[w]; } src += 336; - dst += _screenWidth; + dst += _backBuf->pitch; } } @@ -355,7 +355,7 @@ void AGOSEngine_Feeble::swapCharacterLogo() { srcRect.right = srcRect.left + 42; src = _iconFilePtr + srcRect.top * 336 + srcRect.left; - dst = getBackBuf() + _screenWidth * dstRect.top + dstRect.left; + dst = getBackBuf() + _backBuf->pitch * dstRect.top + dstRect.left; for (h = 0; h < dstRect.height(); h++) { for (w = 0; w < dstRect.width(); w++) { @@ -363,7 +363,7 @@ void AGOSEngine_Feeble::swapCharacterLogo() { dst[w] = src[w]; } src += 336; - dst += _screenWidth; + dst += _backBuf->pitch; } } @@ -506,14 +506,14 @@ void AGOSEngine_Feeble::windowBackSpace(WindowBlock *window) { x = window->x + window->textColumn; y = window->y + window->textRow; - dst = getBackGround() + _dxSurfacePitch * y + x; + dst = getBackGround() + _backGroundBuf->pitch * y + x; for (h = 0; h < 13; h++) { for (w = 0; w < 8; w++) { if (dst[w] == 113 || dst[w] == 116 || dst[w] == 252) dst[w] = 0; } - dst += _screenWidth; + dst += _backGroundBuf->pitch; } _videoLockOut &= ~0x8000; diff --git a/engines/agos/verb.cpp b/engines/agos/verb.cpp index 2486f09626..8376ebb28e 100644 --- a/engines/agos/verb.cpp +++ b/engines/agos/verb.cpp @@ -967,7 +967,7 @@ void AGOSEngine::invertBox(HitArea *ha, byte a, byte b, byte c, byte d) { _videoLockOut |= 0x8000; Graphics::Surface *screen = _system->lockScreen(); - src = (byte *)screen->pixels + ha->y * _dxSurfacePitch + ha->x; + src = (byte *)screen->pixels + ha->y * screen->pitch + ha->x; // WORKAROUND: Hitareas for saved game names aren't adjusted for scrolling locations if (getGameType() == GType_SIMON2 && ha->id >= 208 && ha->id <= 213) { @@ -1019,7 +1019,7 @@ void AGOSEngine::invertBox(HitArea *ha, byte a, byte b, byte c, byte d) { } } } - src += _dxSurfacePitch; + src += screen->pitch; } while (--h); _system->unlockScreen(); diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp index eea53b9864..d2e620d86e 100644 --- a/engines/agos/vga.cpp +++ b/engines/agos/vga.cpp @@ -1182,11 +1182,12 @@ void AGOSEngine::vc31_setWindow() { void AGOSEngine::vc32_saveScreen() { if (getGameType() == GType_PN) { Graphics::Surface *screen = _system->lockScreen(); - byte *dst = getBackGround(); byte *src = (byte *)screen->pixels; - memcpy(dst, src, 64000); - + for (int i = 0; i < _screenHeight; i++) { + memcpy(dst, src, _screenWidth); + dst += screen->pitch; + } _system->unlockScreen(); } else { uint16 xoffs = _videoWindows[4 * 4 + 0] * 16; @@ -1194,12 +1195,12 @@ void AGOSEngine::vc32_saveScreen() { uint16 width = _videoWindows[4 * 4 + 2] * 16; uint16 height = _videoWindows[4 * 4 + 3]; - byte *dst = getBackGround() + xoffs + yoffs * _screenWidth; - byte *src = _window4BackScn; + byte *dst = (byte *)_backGroundBuf->getBasePtr(xoffs, yoffs); + byte *src = (byte *)_window4BackScn->pixels;; uint16 srcWidth = _videoWindows[4 * 4 + 2] * 16; for (; height > 0; height--) { memcpy(dst, src, width); - dst += _screenWidth; + dst += _backGroundBuf->pitch; src += srcWidth; } } @@ -1228,11 +1229,11 @@ void AGOSEngine::vc34_setMouseOff() { void AGOSEngine::clearVideoBackGround(uint16 num, uint16 color) { const uint16 *vlut = &_videoWindows[num * 4]; - byte *dst = getBackGround() + vlut[0] * 16 + vlut[1] * _dxSurfacePitch; + byte *dst = (byte *)_backGroundBuf->getBasePtr(vlut[0] * 16, vlut[1]); for (uint h = 0; h < vlut[3]; h++) { memset(dst, color, vlut[2] * 16); - dst += _screenWidth; + dst += _backGroundBuf->pitch; } } @@ -1250,14 +1251,18 @@ void AGOSEngine::clearVideoWindow(uint16 num, uint16 color) { if (getGameType() == GType_ELVIRA1 && num == 3) { Graphics::Surface *screen = _system->lockScreen(); - memset((byte *)screen->pixels, color, _screenWidth * _screenHeight); + byte *dst = (byte *)screen->pixels; + for (int i = 0; i < _screenHeight; i++) { + memset(dst, color, _screenWidth); + dst += screen->pitch; + } _system->unlockScreen(); } else if (num == 4) { const uint16 *vlut = &_videoWindows[num * 4]; uint16 xoffs = (vlut[0] - _videoWindows[16]) * 16; uint16 yoffs = (vlut[1] - _videoWindows[17]); uint16 dstWidth = _videoWindows[18] * 16; - byte *dst = _window4BackScn + xoffs + yoffs * dstWidth; + byte *dst = (byte *)_window4BackScn->pixels + xoffs + yoffs * dstWidth; setMoveRect(0, 0, vlut[2] * 16, vlut[3]); diff --git a/engines/agos/vga_e2.cpp b/engines/agos/vga_e2.cpp index 58d3329296..7f02398e13 100644 --- a/engines/agos/vga_e2.cpp +++ b/engines/agos/vga_e2.cpp @@ -77,7 +77,7 @@ void AGOSEngine::vc45_setWindowPalette() { uint8 height = vlut[3]; if (num == 4) { - byte *dst = _window4BackScn; + byte *dst = (byte *)_window4BackScn->pixels; for (uint8 h = 0; h < height; h++) { for (uint8 w = 0; w < width; w++) { @@ -90,7 +90,7 @@ void AGOSEngine::vc45_setWindowPalette() { } } else { Graphics::Surface *screen = _system->lockScreen(); - byte *dst = (byte *)screen->pixels + vlut[0] * 16 + vlut[1] * _dxSurfacePitch; + byte *dst = (byte *)screen->getBasePtr(vlut[0] * 16, vlut[1]); if (getGameType() == GType_ELVIRA2 && num == 7) { dst -= 8; @@ -104,7 +104,7 @@ void AGOSEngine::vc45_setWindowPalette() { val |= color * 16; WRITE_LE_UINT16(dst + w * 2, val); } - dst += _dxSurfacePitch; + dst += screen->pitch; } _system->unlockScreen(); @@ -218,18 +218,19 @@ void AGOSEngine::vc53_dissolveIn() { uint16 dissolveDelay = dissolveCheck * 2 / speed; uint16 dissolveCount = dissolveCheck * 2 / speed; + Graphics::Surface *screen = _system->lockScreen(); + int16 xoffs = _videoWindows[num * 4 + 0] * 16; int16 yoffs = _videoWindows[num * 4 + 1]; - int16 offs = xoffs + yoffs * _screenWidth; + int16 offs = xoffs + yoffs * screen->pitch; uint16 count = dissolveCheck * 2; while (count--) { - Graphics::Surface *screen = _system->lockScreen(); byte *dstPtr = (byte *)screen->pixels + offs; yoffs = _rnd.getRandomNumber(dissolveY); - dst = dstPtr + yoffs * _screenWidth; - src = _window4BackScn + yoffs * 224; + dst = dstPtr + yoffs * screen->pitch; + src = (byte *)_window4BackScn->pixels + yoffs * _window4BackScn->pitch; xoffs = _rnd.getRandomNumber(dissolveX); dst += xoffs; @@ -252,15 +253,15 @@ void AGOSEngine::vc53_dissolveIn() { dstOffs2 = dst; yoffs = (dissolveY - 1) * 2 - (yoffs * 2); - src = srcOffs + yoffs * 224; - dst = dstOffs + yoffs * _screenWidth; + src = srcOffs + yoffs * _window4BackScn->pitch; + dst = dstOffs + yoffs * screen->pitch; color = 0xF0; *dst &= color; *dst |= *src & 0xF; - dst = dstOffs2 + yoffs * _screenWidth; - src = srcOffs2 + yoffs * 224; + dst = dstOffs2 + yoffs * screen->pitch; + src = srcOffs2 + yoffs * _window4BackScn->pitch; *dst &= color; *dst |= *src & 0xF; @@ -291,19 +292,20 @@ void AGOSEngine::vc54_dissolveOut() { uint16 dissolveDelay = dissolveCheck * 2 / speed; uint16 dissolveCount = dissolveCheck * 2 / speed; + Graphics::Surface *screen = _system->lockScreen(); + int16 xoffs = _videoWindows[num * 4 + 0] * 16; int16 yoffs = _videoWindows[num * 4 + 1]; - int16 offs = xoffs + yoffs * _screenWidth; + int16 offs = xoffs + yoffs * screen->pitch; uint16 count = dissolveCheck * 2; while (count--) { - Graphics::Surface *screen = _system->lockScreen(); byte *dstPtr = (byte *)screen->pixels + offs; color |= dstPtr[0] & 0xF0; yoffs = _rnd.getRandomNumber(dissolveY); xoffs = _rnd.getRandomNumber(dissolveX); - dst = dstPtr + xoffs + yoffs * _screenWidth; + dst = dstPtr + xoffs + yoffs * screen->pitch; *dst = color; dstOffs = dst; @@ -313,7 +315,7 @@ void AGOSEngine::vc54_dissolveOut() { *dst = color; yoffs = (dissolveY - 1) * 2 - (yoffs * 2); - dst = dstOffs + yoffs * _screenWidth; + dst = dstOffs + yoffs * screen->pitch; *dst = color; dst += xoffs; @@ -354,18 +356,22 @@ void AGOSEngine::vc55_moveBox() { } void AGOSEngine::vc56_fullScreen() { - Graphics::Surface *screen = _system->lockScreen(); + uint8 palette[1024]; + Graphics::Surface *screen = _system->lockScreen(); byte *dst = (byte *)screen->pixels; - byte *src = _curVgaFile2 + 32; - - memcpy(dst, src + 768, _screenHeight * _screenWidth); + byte *src = _curVgaFile2 + 800; + for (int i = 0; i < _screenHeight; i++) { + memcpy(dst, src, _screenWidth); + src += 320; + dst += screen->pitch; + } _system->unlockScreen(); //fullFade(); - uint8 palette[1024]; + src = _curVgaFile2 + 32; for (int i = 0; i < 256; i++) { palette[i * 4 + 0] = *src++ * 4; palette[i * 4 + 1] = *src++ * 4; diff --git a/engines/agos/vga_pn.cpp b/engines/agos/vga_pn.cpp index e84248bb4d..32c6e15f00 100644 --- a/engines/agos/vga_pn.cpp +++ b/engines/agos/vga_pn.cpp @@ -168,7 +168,7 @@ void AGOSEngine::vc48_specialEffect() { if (dst[w] == 15) dst[w] = 4; } - dst += _screenWidth; + dst += screen->pitch; } _system->unlockScreen(); } else if (num == 2) { diff --git a/engines/agos/vga_s2.cpp b/engines/agos/vga_s2.cpp index 28a383547f..e133427d76 100644 --- a/engines/agos/vga_s2.cpp +++ b/engines/agos/vga_s2.cpp @@ -28,6 +28,8 @@ #include "agos/agos.h" #include "agos/intern.h" +#include "graphics/surface.h" + namespace AGOS { void AGOSEngine_Simon2::setupVideoOpcodes(VgaOpcodeProc *op) { @@ -215,7 +217,7 @@ void AGOSEngine_Simon2::clearVideoWindow(uint16 num, uint16 color) { uint16 xoffs = vlut[0] * 16; uint16 yoffs = vlut[1]; uint16 dstWidth = _videoWindows[18] * 16; - byte *dst = _window4BackScn + xoffs + yoffs * dstWidth; + byte *dst = (byte *)_window4BackScn->pixels + xoffs + yoffs * dstWidth; setMoveRect(0, 0, vlut[2] * 16, vlut[3]); diff --git a/engines/agos/vga_ww.cpp b/engines/agos/vga_ww.cpp index 4f6d510fbf..97c31b299c 100644 --- a/engines/agos/vga_ww.cpp +++ b/engines/agos/vga_ww.cpp @@ -145,14 +145,19 @@ void AGOSEngine::vc61() { uint h, tmp; Graphics::Surface *screen = _system->lockScreen(); + dstPtr = (byte *)screen->pixels; if (a == 6) { src = _curVgaFile2 + 800; - dstPtr = (byte *)screen->pixels; - memcpy(dstPtr, src, 64000); + + for (int i = 0; i < _screenHeight; i++) { + memcpy(dst, src, _screenWidth); + src += 320; + dst += screen->pitch; + } + tmp = 4 - 1; } else { - dstPtr = (byte *)screen->pixels; tmp = a - 1; } @@ -160,15 +165,14 @@ void AGOSEngine::vc61() { while (tmp--) src += 1536 * 16 + 1712; - src += 800; if (a != 5) { - dst = dstPtr + 7448; + dst = dstPtr + 23 * screen->pitch + 88; for (h = 0; h < 177; h++) { memcpy(dst, src, 144); src += 144; - dst += _screenWidth; + dst += screen->pitch; } if (a != 6) { @@ -179,11 +183,11 @@ void AGOSEngine::vc61() { src = _curVgaFile2 + 9984 * 16 + 15344; } - dst = dstPtr + 50296; + dst = dstPtr + 157 * screen->pitch + 56; for (h = 0; h < 17; h++) { memcpy(dst, src, 208); src += 208; - dst += _screenWidth; + dst += screen->pitch; } _system->unlockScreen(); diff --git a/engines/agos/window.cpp b/engines/agos/window.cpp index 8737498e79..a578568a03 100644 --- a/engines/agos/window.cpp +++ b/engines/agos/window.cpp @@ -128,14 +128,14 @@ void AGOSEngine_Feeble::colorWindow(WindowBlock *window) { _videoLockOut |= 0x8000; - dst = getBackGround() + _dxSurfacePitch * window->y + window->x; + dst = getBackGround() + _backGroundBuf->pitch * window->y + window->x; for (h = 0; h < window->height; h++) { for (w = 0; w < window->width; w++) { if (dst[w] == 113 || dst[w] == 116 || dst[w] == 252) dst[w] = window->fillColor; } - dst += _screenWidth; + dst += _backGroundBuf->pitch; } _videoLockOut &= ~0x8000; @@ -171,7 +171,7 @@ void AGOSEngine::colorBlock(WindowBlock *window, uint16 x, uint16 y, uint16 w, u _videoLockOut |= 0x8000; Graphics::Surface *screen = _system->lockScreen(); - byte *dst = (byte *)screen->pixels + y * _screenWidth + x; + byte *dst = (byte *)screen->pixels + y * screen->pitch + x; uint8 color = window->fillColor; if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) @@ -179,7 +179,7 @@ void AGOSEngine::colorBlock(WindowBlock *window, uint16 x, uint16 y, uint16 w, u do { memset(dst, color, w); - dst += _screenWidth; + dst += screen->pitch; } while (--h); _system->unlockScreen(); @@ -236,8 +236,8 @@ void AGOSEngine::restoreBlock(uint16 x, uint16 y, uint16 w, uint16 h) { dst = (byte *)screen->pixels; src = getBackGround(); - dst += y * _dxSurfacePitch; - src += y * _dxSurfacePitch; + dst += y * screen->pitch; + src += y * _backGroundBuf->pitch; uint8 paletteMod = 0; if (getGameType() == GType_ELVIRA1 && !(getFeatures() & GF_DEMO) && y >= 133) @@ -247,8 +247,8 @@ void AGOSEngine::restoreBlock(uint16 x, uint16 y, uint16 w, uint16 h) { for (i = x; i < w; i++) dst[i] = src[i] + paletteMod; y++; - dst += _dxSurfacePitch; - src += _dxSurfacePitch; + dst += screen->pitch; + src += _backGroundBuf->pitch; } _system->unlockScreen(); -- cgit v1.2.3 From 3ce15cb9b7c77560cd0f2b67e4407b9889ea0f9b Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Mon, 6 Jul 2009 06:24:04 +0000 Subject: Ooops, remove debug code. svn-id: r42164 --- engines/agos/agos.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 4a8170b2a4..9903952577 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -492,7 +492,6 @@ AGOSEngine::AGOSEngine(OSystem *syst) _scaleBuf = 0; _window4BackScn = 0; _window6BackScn = 0; - printf("Cleared all\n"); _window3Flag = 0; _window4Flag = 0; -- cgit v1.2.3 From 522b161becfc702350d84cf431b716b1330286db Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 6 Jul 2009 10:39:22 +0000 Subject: Replaced sciprintf() calls with printf, DebugPrintf, warning and error calls svn-id: r42167 --- engines/sci/console.cpp | 112 ++++++++++++++-------------- engines/sci/engine/gc.cpp | 32 +++----- engines/sci/engine/grammar.cpp | 40 +++++----- engines/sci/engine/kernel.cpp | 14 ++-- engines/sci/engine/kevent.cpp | 4 +- engines/sci/engine/kfile.cpp | 6 +- engines/sci/engine/kgraphics.cpp | 9 +-- engines/sci/engine/kmisc.cpp | 17 +++-- engines/sci/engine/kmovement.cpp | 4 +- engines/sci/engine/kpathing.cpp | 33 ++++----- engines/sci/engine/ksound.cpp | 140 +++++++++++++++++------------------ engines/sci/engine/kstring.cpp | 7 +- engines/sci/engine/memobj.cpp | 16 ++-- engines/sci/engine/said.cpp | 47 ++++++------ engines/sci/engine/said.y | 45 +++++------ engines/sci/engine/savegame.cpp | 32 ++++---- engines/sci/engine/script.cpp | 107 +++++++++++++------------- engines/sci/engine/scriptdebug.cpp | 72 +++++++++--------- engines/sci/engine/seg_manager.cpp | 47 ++++++------ engines/sci/engine/vm.cpp | 59 +++++++-------- engines/sci/gfx/font.cpp | 2 +- engines/sci/gfx/gfx_driver.cpp | 2 +- engines/sci/gfx/gfx_gui.cpp | 19 ++--- engines/sci/gfx/gfx_pixmap_scale.cpp | 10 +-- engines/sci/gfx/gfx_resmgr.cpp | 6 +- engines/sci/gfx/gfx_state_internal.h | 2 +- engines/sci/gfx/gfx_support.cpp | 8 +- engines/sci/gfx/gfx_system.h | 3 - engines/sci/gfx/gfx_tools.cpp | 2 +- engines/sci/gfx/gfx_widgets.cpp | 124 +++++++++++++++---------------- engines/sci/gfx/menubar.cpp | 4 +- engines/sci/gfx/operations.cpp | 125 ++++++++----------------------- engines/sci/gfx/res_cursor.cpp | 2 +- engines/sci/gfx/res_font.cpp | 16 ++-- engines/sci/gfx/res_pal.cpp | 6 +- engines/sci/gfx/res_pic.cpp | 16 ++-- engines/sci/gfx/res_view.cpp | 10 +-- engines/sci/resource.cpp | 13 ++-- engines/sci/sci.cpp | 1 + engines/sci/sci.h | 3 +- engines/sci/sfx/iterator.cpp | 35 +++++---- engines/sci/sfx/softseq/amiga.cpp | 53 ++++++------- engines/sci/sfx/songlib.cpp | 2 +- engines/sci/tools.cpp | 31 -------- engines/sci/tools.h | 7 -- engines/sci/vocabulary.cpp | 70 +++++++++--------- engines/sci/vocabulary.h | 2 +- 47 files changed, 653 insertions(+), 764 deletions(-) diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index d978915741..4ab10d9eb9 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -461,6 +461,7 @@ enum { int parseNodes(EngineState *s, int *i, int *pos, int type, int nr, int argc, const char **argv) { int nextToken = 0, nextValue = 0, newPos = 0, oldPos = 0; + Console *con = ((SciEngine *)g_engine)->getSciDebugger(); if (type == kParseNil) return 0; @@ -471,11 +472,11 @@ int parseNodes(EngineState *s, int *i, int *pos, int type, int nr, int argc, con return *pos; } if (type == kParseEndOfInput) { - sciprintf("Unbalanced parentheses\n"); + con->DebugPrintf("Unbalanced parentheses\n"); return -1; } if (type == kParseClosingParenthesis) { - sciprintf("Syntax error at token %d\n", *i); + con->DebugPrintf("Syntax error at token %d\n", *i); return -1; } @@ -505,7 +506,7 @@ int parseNodes(EngineState *s, int *i, int *pos, int type, int nr, int argc, con const char *token = argv[(*i)++]; if (strcmp(token, ")")) - sciprintf("Expected ')' at token %d\n", *i); + con->DebugPrintf("Expected ')' at token %d\n", *i); return oldPos; } @@ -2032,7 +2033,7 @@ bool Console::cmdSetAccumulator(int argc, const char **argv) { bool Console::cmdBacktrace(int argc, const char **argv) { DebugPrintf("Dumping the send/self/super/call/calle/callb stack:\n"); - DebugPrintf("Call stack (current base: 0x%x):\n", _vm->_gamestate->execution_stack_base); + printf("Call stack (current base: 0x%x):\n", _vm->_gamestate->execution_stack_base); Common::List::iterator iter; uint i = 0; @@ -2045,17 +2046,17 @@ bool Console::cmdBacktrace(int argc, const char **argv) { switch (call.type) { case EXEC_STACK_TYPE_CALL: {// Normal function - sciprintf(" %x:[%x] %s::%s(", i, call.origin, objname, (call.selector == -1) ? "" : + printf(" %x:[%x] %s::%s(", i, call.origin, objname, (call.selector == -1) ? "" : selector_name(_vm->_gamestate, call.selector)); } break; case EXEC_STACK_TYPE_KERNEL: // Kernel function - sciprintf(" %x:[%x] k%s(", i, call.origin, _vm->_gamestate->_kernel->getKernelName(-(call.selector) - 42).c_str()); + printf(" %x:[%x] k%s(", i, call.origin, _vm->_gamestate->_kernel->getKernelName(-(call.selector) - 42).c_str()); break; case EXEC_STACK_TYPE_VARSELECTOR: - sciprintf(" %x:[%x] vs%s %s::%s (", i, call.origin, (call.argc) ? "write" : "read", + printf(" %x:[%x] vs%s %s::%s (", i, call.origin, (call.argc) ? "write" : "read", objname, _vm->_gamestate->_kernel->getSelectorName(call.selector).c_str()); break; } @@ -2066,31 +2067,31 @@ bool Console::cmdBacktrace(int argc, const char **argv) { totalparamc = 16; for (paramc = 1; paramc <= totalparamc; paramc++) { - sciprintf("%04x:%04x", PRINT_REG(call.variables_argp[paramc])); + printf("%04x:%04x", PRINT_REG(call.variables_argp[paramc])); if (paramc < call.argc) - sciprintf(", "); + printf(", "); } if (call.argc > 16) - sciprintf("..."); + printf("..."); - sciprintf(")\n obj@%04x:%04x", PRINT_REG(call.objp)); + printf(")\n obj@%04x:%04x", PRINT_REG(call.objp)); if (call.type == EXEC_STACK_TYPE_CALL) { - sciprintf(" pc=%04x:%04x", PRINT_REG(call.addr.pc)); + printf(" pc=%04x:%04x", PRINT_REG(call.addr.pc)); if (call.sp == CALL_SP_CARRY) - sciprintf(" sp,fp:carry"); + printf(" sp,fp:carry"); else { - sciprintf(" sp=ST:%04x", (unsigned)(call.sp - _vm->_gamestate->stack_base)); - sciprintf(" fp=ST:%04x", (unsigned)(call.fp - _vm->_gamestate->stack_base)); + printf(" sp=ST:%04x", (unsigned)(call.sp - _vm->_gamestate->stack_base)); + printf(" fp=ST:%04x", (unsigned)(call.fp - _vm->_gamestate->stack_base)); } } else - sciprintf(" pc:none"); + printf(" pc:none"); - sciprintf(" argp:ST:%04x", (unsigned)(call.variables_argp - _vm->_gamestate->stack_base)); + printf(" argp:ST:%04x", (unsigned)(call.variables_argp - _vm->_gamestate->stack_base)); if (call.type == EXEC_STACK_TYPE_CALL) - sciprintf(" script: %d", (*(Script *)_vm->_gamestate->seg_manager->_heap[call.addr.pc.segment]).nr); - sciprintf("\n"); + printf(" script: %d", (*(Script *)_vm->_gamestate->seg_manager->_heap[call.addr.pc.segment]).nr); + printf("\n"); } return 0; @@ -2290,21 +2291,21 @@ bool Console::cmdSend(int argc, const char **argv) { selector_id = _vm->_gamestate->_kernel->findSelector(selector_name); if (selector_id < 0) { - sciprintf("Unknown selector: \"%s\"\n", selector_name); - return 1; + DebugPrintf("Unknown selector: \"%s\"\n", selector_name); + return true; } o = obj_get(_vm->_gamestate, object); if (o == NULL) { - sciprintf("Address \"%04x:%04x\" is not an object\n", PRINT_REG(object)); - return 1; + DebugPrintf("Address \"%04x:%04x\" is not an object\n", PRINT_REG(object)); + return true; } SelectorType selector_type = lookup_selector(_vm->_gamestate, object, selector_id, 0, &fptr); if (selector_type == kSelectorNone) { - sciprintf("Object does not support selector: \"%s\"\n", selector_name); - return 1; + DebugPrintf("Object does not support selector: \"%s\"\n", selector_name); + return true; } stackframe[0] = make_reg(0, selector_id); @@ -3043,42 +3044,43 @@ int printObject(EngineState *s, reg_t pos) { Object *obj = obj_get(s, pos); Object *var_container = obj; int i; + Console *con = ((SciEngine *)g_engine)->getSciDebugger(); if (!obj) { - sciprintf("[%04x:%04x]: Not an object.", PRINT_REG(pos)); + con->DebugPrintf("[%04x:%04x]: Not an object.", PRINT_REG(pos)); return 1; } // Object header - sciprintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(pos), obj_get_name(s, pos), + printf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(pos), obj_get_name(s, pos), obj->_variables.size(), obj->methods_nr); if (!(obj->_variables[SCRIPT_INFO_SELECTOR].offset & SCRIPT_INFO_CLASS)) var_container = obj_get(s, obj->_variables[SCRIPT_SUPERCLASS_SELECTOR]); - sciprintf(" -- member variables:\n"); + printf(" -- member variables:\n"); for (i = 0; (uint)i < obj->_variables.size(); i++) { - sciprintf(" "); + printf(" "); if (i < var_container->variable_names_nr) { - sciprintf("[%03x] %s = ", VM_OBJECT_GET_VARSELECTOR(var_container, i), selector_name(s, VM_OBJECT_GET_VARSELECTOR(var_container, i))); + printf("[%03x] %s = ", VM_OBJECT_GET_VARSELECTOR(var_container, i), selector_name(s, VM_OBJECT_GET_VARSELECTOR(var_container, i))); } else - sciprintf("p#%x = ", i); + printf("p#%x = ", i); reg_t val = obj->_variables[i]; - sciprintf("%04x:%04x", PRINT_REG(val)); + printf("%04x:%04x", PRINT_REG(val)); Object *ref = obj_get(s, val); if (ref) - sciprintf(" (%s)", obj_get_name(s, val)); + printf(" (%s)", obj_get_name(s, val)); - sciprintf("\n"); + printf("\n"); } - sciprintf(" -- methods:\n"); + printf(" -- methods:\n"); for (i = 0; i < obj->methods_nr; i++) { reg_t fptr = VM_OBJECT_READ_FUNCTION(obj, i); - sciprintf(" [%03x] %s = %04x:%04x\n", VM_OBJECT_GET_FUNCSELECTOR(obj, i), selector_name(s, VM_OBJECT_GET_FUNCSELECTOR(obj, i)), PRINT_REG(fptr)); + printf(" [%03x] %s = %04x:%04x\n", VM_OBJECT_GET_FUNCSELECTOR(obj, i), selector_name(s, VM_OBJECT_GET_FUNCSELECTOR(obj, i)), PRINT_REG(fptr)); } if (s->seg_manager->_heap[pos.segment]->getType() == MEM_OBJ_SCRIPT) - sciprintf("\nOwner script:\t%d\n", s->seg_manager->getScript(pos.segment)->nr); + printf("\nOwner script:\t%d\n", s->seg_manager->getScript(pos.segment)->nr); return 0; } @@ -3129,39 +3131,39 @@ static void viewobjinfo(EngineState *s, HeapPtr pos) { GETRECT(view, loop, signal, cel); - sciprintf("\n-- View information:\ncel %d/%d/%d at ", view, loop, cel); + printf("\n-- View information:\ncel %d/%d/%d at ", view, loop, cel); x = GET_SELECTOR(pos, x); y = GET_SELECTOR(pos, y); priority = GET_SELECTOR(pos, priority); if (s->_kernel->_selectorMap.z > 0) { z = GET_SELECTOR(pos, z); - sciprintf("(%d,%d,%d)\n", x, y, z); + printf("(%d,%d,%d)\n", x, y, z); } else - sciprintf("(%d,%d)\n", x, y); + printf("(%d,%d)\n", x, y); if (priority == -1) - sciprintf("No priority.\n\n"); + printf("No priority.\n\n"); else - sciprintf("Priority = %d (band starts at %d)\n\n", priority, PRIORITY_BAND_FIRST(priority)); + printf("Priority = %d (band starts at %d)\n\n", priority, PRIORITY_BAND_FIRST(priority)); if (have_rects) { - sciprintf("nsRect: [%d..%d]x[%d..%d]\n", nsLeft, nsRight, nsTop, nsBottom); - sciprintf("lsRect: [%d..%d]x[%d..%d]\n", lsLeft, lsRight, lsTop, lsBottom); - sciprintf("brRect: [%d..%d]x[%d..%d]\n", brLeft, brRight, brTop, brBottom); + printf("nsRect: [%d..%d]x[%d..%d]\n", nsLeft, nsRight, nsTop, nsBottom); + printf("lsRect: [%d..%d]x[%d..%d]\n", lsLeft, lsRight, lsTop, lsBottom); + printf("brRect: [%d..%d]x[%d..%d]\n", brLeft, brRight, brTop, brBottom); } nsrect = get_nsrect(s, pos, 0); nsrect_clipped = get_nsrect(s, pos, 1); brrect = set_base(s, pos); - sciprintf("new nsRect: [%d..%d]x[%d..%d]\n", nsrect.x, nsrect.xend, nsrect.y, nsrect.yend); - sciprintf("new clipped nsRect: [%d..%d]x[%d..%d]\n", nsrect_clipped.x, nsrect_clipped.xend, nsrect_clipped.y, nsrect_clipped.yend); - sciprintf("new brRect: [%d..%d]x[%d..%d]\n", brrect.x, brrect.xend, brrect.y, brrect.yend); - sciprintf("\n signals = %04x:\n", signal); + printf("new nsRect: [%d..%d]x[%d..%d]\n", nsrect.x, nsrect.xend, nsrect.y, nsrect.yend); + printf("new clipped nsRect: [%d..%d]x[%d..%d]\n", nsrect_clipped.x, nsrect_clipped.xend, nsrect_clipped.y, nsrect_clipped.yend); + printf("new brRect: [%d..%d]x[%d..%d]\n", brrect.x, brrect.xend, brrect.y, brrect.yend); + printf("\n signals = %04x:\n", signal); for (i = 0; i < 16; i++) if (signal & (1 << i)) - sciprintf(" %04x: %s\n", 1 << i, signals[i]); + printf(" %04x: %s\n", 1 << i, signals[i]); } #endif #undef GETRECT @@ -3183,17 +3185,17 @@ static int c_gfx_draw_viewobj(EngineState *s, const Common::Array & int brLeft, brRight, brBottom, brTop; if (!s) { - sciprintf("Not in debug state!\n"); + printf("Not in debug state!\n"); return 1; } if ((pos < 4) || (pos > 0xfff0)) { - sciprintf("Invalid address.\n"); + printf("Invalid address.\n"); return 1; } if (((int16)READ_LE_UINT16(s->heap + pos + SCRIPT_OBJECT_MAGIC_OFFSET)) != SCRIPT_OBJECT_MAGIC_NUMBER) { - sciprintf("Not an object.\n"); + printf("Not an object.\n"); return 0; } @@ -3204,7 +3206,7 @@ static int c_gfx_draw_viewobj(EngineState *s, const Common::Array & (lookup_selector(s, pos, s->_kernel->_selectorMap.nsTop, NULL) == kSelectorVariable); if (!is_view) { - sciprintf("Not a dynamic View object.\n"); + printf("Not a dynamic View object.\n"); return 0; } @@ -3239,7 +3241,7 @@ int c_stepover(EngineState *s, const Common::Array &cmdParams) { int opcode, opnumber; if (!g_debugstate_valid) { - sciprintf("Not in debug state\n"); + printf("Not in debug state\n"); return 1; } diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp index 1bfb66987e..63a20ddf25 100644 --- a/engines/sci/engine/gc.cpp +++ b/engines/sci/engine/gc.cpp @@ -29,7 +29,6 @@ namespace Sci { //#define DEBUG_GC -//#define DEBUG_GC_VERBOSE struct WorklistManager { Common::Array _worklist; @@ -39,9 +38,7 @@ struct WorklistManager { if (!reg.segment) // No numbers return; - #ifdef DEBUG_GC_VERBOSE - sciprintf("[GC] Adding %04x:%04x\n", PRINT_REG(reg)); - #endif + debugC(2, kDebugLevelGC, "[GC] Adding %04x:%04x\n", PRINT_REG(reg)); if (_map.contains(reg)) return; // already dealt with it @@ -92,9 +89,8 @@ reg_t_hash_map *find_all_used_references(EngineState *s) { for (pos = s->stack_base; pos < xs.sp; pos++) wm.push(*pos); } -#ifdef DEBUG_GC_VERBOSE - sciprintf("[GC] -- Finished adding value stack"); -#endif + + debugC(2, kDebugLevelGC, "[GC] -- Finished adding value stack"); // Init: Execution Stack Common::List::iterator iter; @@ -109,9 +105,8 @@ reg_t_hash_map *find_all_used_references(EngineState *s) { wm.push(*(es.getVarPointer(s))); } } -#ifdef DEBUG_GC_VERBOSE - sciprintf("[GC] -- Finished adding execution stack"); -#endif + + debugC(2, kDebugLevelGC, "[GC] -- Finished adding execution stack"); // Init: Explicitly loaded scripts for (i = 1; i < sm->_heap.size(); i++) @@ -129,18 +124,15 @@ reg_t_hash_map *find_all_used_references(EngineState *s) { } } } -#ifdef DEBUG_GC_VERBOSE - sciprintf("[GC] -- Finished explicitly loaded scripts, done with root set"); -#endif + + debugC(2, kDebugLevelGC, "[GC] -- Finished explicitly loaded scripts, done with root set\n"); // Run Worklist Algorithm while (!wm._worklist.empty()) { reg_t reg = wm._worklist.back(); wm._worklist.pop_back(); if (reg.segment != s->stack_segment) { // No need to repeat this one -#ifdef DEBUG_GC_VERBOSE - sciprintf("[GC] Checking %04x:%04x\n", PRINT_REG(reg)); -#endif + debugC(2, kDebugLevelGC, "[GC] Checking %04x:%04x\n", PRINT_REG(reg)); if (reg.segment < sm->_heap.size() && sm->_heap[reg.segment]) sm->_heap[reg.segment]->listAllOutgoingReferences(s, reg, &wm, add_outgoing_refs); } @@ -170,7 +162,7 @@ void free_unless_used(void *refcon, reg_t addr) { // Not found -> we can free it deallocator->mobj->freeAtAddress(deallocator->segmgr, addr); #ifdef DEBUG_GC - sciprintf("[GC] Deallocating %04x:%04x\n", PRINT_REG(addr)); + debugC(2, kDebugLevelGC, "[GC] Deallocating %04x:%04x\n", PRINT_REG(addr)); deallocator->segcount[deallocator->mobj->getType()]++; #endif } @@ -183,7 +175,7 @@ void run_gc(EngineState *s) { SegManager *sm = s->seg_manager; #ifdef DEBUG_GC - sciprintf("[GC] Running...\n"); + debugC(2, kDebugLevelGC, "[GC] Running...\n"); memset(&(deallocator.segcount), 0, sizeof(int) * (MEM_OBJ_MAX + 1)); #endif @@ -205,10 +197,10 @@ void run_gc(EngineState *s) { #ifdef DEBUG_GC { int i; - sciprintf("[GC] Summary:\n"); + debugC(2, kDebugLevelGC, "[GC] Summary:\n"); for (i = 0; i <= MEM_OBJ_MAX; i++) if (deallocator.segcount[i]) - sciprintf("\t%d\t* %s\n", deallocator.segcount[i], deallocator.segnames[i]); + debugC(2, kDebugLevelGC, "\t%d\t* %s\n", deallocator.segcount[i], deallocator.segnames[i]); } #endif } diff --git a/engines/sci/engine/grammar.cpp b/engines/sci/engine/grammar.cpp index e75441432d..26f540a373 100644 --- a/engines/sci/engine/grammar.cpp +++ b/engines/sci/engine/grammar.cpp @@ -51,51 +51,51 @@ static void vocab_print_rule(parse_rule_t *rule) { int wspace = 0; if (!rule) { - sciprintf("NULL rule"); + warning("NULL rule"); return; } - sciprintf("[%03x] -> ", rule->id); + printf("[%03x] -> ", rule->id); if (!rule->length) - sciprintf("e"); + printf("e"); for (i = 0; i < rule->length; i++) { uint token = rule->data[i]; if (token == TOKEN_OPAREN) { if (i == rule->first_special) - sciprintf("_"); + printf("_"); - sciprintf("("); + printf("("); wspace = 0; } else if (token == TOKEN_CPAREN) { if (i == rule->first_special) - sciprintf("_"); + printf("_"); - sciprintf(")"); + printf(")"); wspace = 0; } else { if (wspace) - sciprintf(" "); + printf(" "); if (i == rule->first_special) - sciprintf("_"); + printf("_"); if (token & TOKEN_TERMINAL_CLASS) - sciprintf("C(%04x)", token & 0xffff); + printf("C(%04x)", token & 0xffff); else if (token & TOKEN_TERMINAL_GROUP) - sciprintf("G(%04x)", token & 0xffff); + printf("G(%04x)", token & 0xffff); else if (token & TOKEN_STUFFING_WORD) - sciprintf("%03x", token & 0xffff); + printf("%03x", token & 0xffff); else - sciprintf("[%03x]", token); /* non-terminal */ + printf("[%03x]", token); /* non-terminal */ wspace = 1; } if (i == rule->first_special) - sciprintf("_"); + printf("_"); } - sciprintf(" [%d specials]", rule->specials_nr); + printf(" [%d specials]", rule->specials_nr); } static void _vfree(parse_rule_t *rule) { @@ -287,12 +287,12 @@ static parse_rule_list_t *_vocab_add_rule(parse_rule_list_t *list, parse_rule_t static void _vprl(parse_rule_list_t *list, int pos) { if (list) { - sciprintf("R%03d: ", pos); + printf("R%03d: ", pos); vocab_print_rule(list->rule); - sciprintf("\n"); + printf("\n"); _vprl(list->next, pos + 1); } else { - sciprintf("%d rules total.\n", pos); + printf("%d rules total.\n", pos); } } @@ -466,9 +466,9 @@ static int _vbpt_write_subexpression(parse_tree_node_t *nodes, int *pos, parse_r else writepos = _vbpt_append(nodes, pos, writepos, token & 0xffff); } else { - sciprintf("\nError in parser (grammar.cpp, _vbpt_write_subexpression()): Rule data broken in rule "); + printf("\nError in parser (grammar.cpp, _vbpt_write_subexpression()): Rule data broken in rule "); vocab_print_rule(rule); - sciprintf(", at token position %d\n", *pos); + printf(", at token position %d\n", *pos); return rulepos; } } diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 8ac629d87b..6d2e11043d 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -610,15 +610,15 @@ void Kernel::mapFunctions() { _kernelFuncs[functnr].signature = kfunct_mappers[found].signature; kernel_compile_signature(&(_kernelFuncs[functnr].signature)); ++mapped; - } else + } else { + //warning("Ignoring function %s\n", kfunct_mappers[found].name); ++ignored; + } } } // for all functions requesting to be mapped - sciprintf("Handled %d/%d kernel functions, mapping %d", mapped + ignored, getKernelNamesSize(), mapped); - if (ignored) - sciprintf(" and ignoring %d", ignored); - sciprintf(".\n"); + debugC(2, kDebugLevelVM, "Handled %d/%d kernel functions, mapping %d and ignoring %d.\n", + mapped + ignored, getKernelNamesSize(), mapped, ignored); return; } @@ -696,12 +696,12 @@ bool kernel_matches_signature(EngineState *s, const char *sig, int argc, const r int type = determine_reg_type(s, *argv, *sig & KSIG_ALLOW_INV); if (!type) { - sciprintf("[KERN] Could not determine type of ref %04x:%04x; failing signature check\n", PRINT_REG(*argv)); + warning("[KERN] Could not determine type of ref %04x:%04x; failing signature check", PRINT_REG(*argv)); return false; } if (type & KSIG_INVALID) { - sciprintf("[KERN] ref %04x:%04x was determined to be a %s, but the reference itself is invalid\n", + warning("[KERN] ref %04x:%04x was determined to be a %s, but the reference itself is invalid", PRINT_REG(*argv), kernel_argtype_description(type)); return false; } diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index e40368a5c0..744a965ef3 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -87,11 +87,11 @@ reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv) { case SCI_EVT_KEYBOARD: if ((e.buckybits & SCI_EVM_LSHIFT) && (e.buckybits & SCI_EVM_RSHIFT) && (e.data == '-')) { - sciprintf("Debug mode activated\n"); + printf("Debug mode activated\n"); debugState.seeking = kDebugSeekNothing; debugState.runningStep = 0; } else if ((e.buckybits & SCI_EVM_CTRL) && (e.data == '`')) { - sciprintf("Debug mode activated\n"); + printf("Debug mode activated\n"); debugState.seeking = kDebugSeekNothing; debugState.runningStep = 0; } else { diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index ed18c7fcd6..c03e69c6d0 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -334,7 +334,7 @@ reg_t kGetCWD(EngineState *s, int funct_nr, int argc, reg_t *argv) { void delete_savegame(EngineState *s, int savedir_nr) { Common::String filename = ((Sci::SciEngine*)g_engine)->getSavegameName(savedir_nr); - sciprintf("Deleting savegame '%s'\n", filename.c_str()); + //printf("Deleting savegame '%s'\n", filename.c_str()); Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager(); saveFileMan->removeSavefile(filename); @@ -664,14 +664,14 @@ reg_t kRestoreGame(EngineState *s, int funct_nr, int argc, reg_t *argv) { shrink_execution_stack(s, s->execution_stack_base + 1); } else { s->r_acc = make_reg(0, 1); - sciprintf("Restoring failed (game_id = '%s').\n", game_id); + warning("Restoring failed (game_id = '%s')", game_id); } return s->r_acc; } } s->r_acc = make_reg(0, 1); - sciprintf("Savegame #%d not found!\n", savedir_nr); + warning("Savegame #%d not found", savedir_nr); return s->r_acc; } diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 9d19f3f0c9..487813a4c7 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -417,7 +417,7 @@ reg_t kShow(EngineState *s, int funct_nr, int argc, reg_t *argv) { s->visual->draw(Common::Point(0, 0)); gfxop_update(s->gfx_state); - sciprintf("Switching visible map to %x\n", s->pic_visible_map); + debugC(2, kDebugLevelGraphics, "Switching visible map to %x\n", s->pic_visible_map); } break; @@ -439,13 +439,12 @@ reg_t kPicNotValid(EngineState *s, int funct_nr, int argc, reg_t *argv) { } void _k_redraw_box(EngineState *s, int x1, int y1, int x2, int y2) { - sciprintf("_k_redraw_box(): Unimplemented!\n"); + warning("_k_redraw_box(): Unimplemented"); #if 0 int i; ViewObject *list = s->dyn_views; - sciprintf("Reanimating views\n", s->dyn_views_nr); - + printf("Reanimating views\n", s->dyn_views_nr); for (i = 0;i < s->dyn_views_nr;i++) { *(list[i].underBitsp) = graph_save_box(s, list[i].nsLeft, list[i].nsTop, list[i].nsRight - list[i].nsLeft, @@ -2464,7 +2463,7 @@ reg_t kDisposeWindow(EngineState *s, int funct_nr, int argc, reg_t *argv) { while (id > 0 && (!s->visual->_portRefs[id] || (s->visual->_portRefs[id]->_flags & GFXW_FLAG_NO_IMPLICIT_SWITCH))) id--; - sciprintf("Activating port %d after disposing window %d\n", id, goner_nr); + debugC(2, kDebugLevelGraphics, "Activating port %d after disposing window %d\n", id, goner_nr); s->port = (id >= 0) ? s->visual->_portRefs[id] : 0; if (!s->port) diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 98fba97f0e..aefc010911 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -94,7 +94,7 @@ reg_t kFlushResources(EngineState *s, int funct_nr, int argc, reg_t *argv) { } reg_t kSetDebug(EngineState *s, int funct_nr, int argc, reg_t *argv) { - sciprintf("Debug mode activated\n"); + printf("Debug mode activated\n"); debugState.seeking = kDebugSeekNothing; debugState.runningStep = 0; @@ -238,13 +238,20 @@ reg_t kMemory(EngineState *s, int funct_nr, int argc, reg_t *argv) { } reg_t kstub(EngineState *s, int funct_nr, int argc, reg_t *argv) { - sciprintf("Unimplemented syscall: %s[%x](", s->_kernel->getKernelName(funct_nr).c_str(), funct_nr); + char tmpbuf[200]; + sprintf(tmpbuf, "Unimplemented syscall: %s[%x](", + s->_kernel->getKernelName(funct_nr).c_str(), funct_nr); for (int i = 0; i < argc; i++) { - sciprintf("%04x:%04x", PRINT_REG(argv[i])); - if (i + 1 < argc) sciprintf(", "); + char tmpbuf2[20]; + sprintf(tmpbuf2, "%04x:%04x", PRINT_REG(argv[i])); + if (i + 1 < argc) + strcat(tmpbuf2, ", "); + strcat(tmpbuf, tmpbuf2); } - sciprintf(")\n"); + strcat(tmpbuf, ")\n"); + + warning(tmpbuf); return NULL_REG; } diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp index 20a7be3aea..90db630bfa 100644 --- a/engines/sci/engine/kmovement.cpp +++ b/engines/sci/engine/kmovement.cpp @@ -275,7 +275,7 @@ static void bresenham_autodetect(EngineState *s) { buf = s->seg_manager->getScript(fptr.segment)->buf + fptr.offset; handle_movecnt = (s->_version <= SCI_VERSION_0 || checksum_bytes(buf, 8) == 0x216) ? INCREMENT_MOVECNT : IGNORE_MOVECNT; - sciprintf("b-moveCnt action based on checksum: %s\n", handle_movecnt == IGNORE_MOVECNT ? "ignore" : "increment"); + printf("b-moveCnt action based on checksum: %s\n", handle_movecnt == IGNORE_MOVECNT ? "ignore" : "increment"); } else { warning("bresenham_autodetect failed"); handle_movecnt = INCREMENT_MOVECNT; // Most games do this, so best guess @@ -313,7 +313,7 @@ reg_t kDoBresen(EngineState *s, int funct_nr, int argc, reg_t *argv) { bdelta = GET_SEL32SV(mover, b_incr); axis = GET_SEL32SV(mover, b_xAxis); - //sciprintf("movecnt %d, move speed %d\n", movcnt, max_movcnt); + //printf("movecnt %d, move speed %d\n", movcnt, max_movcnt); if (handle_movecnt) { if (max_movcnt > movcnt) { diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp index c254875230..da24a388fa 100644 --- a/engines/sci/engine/kpathing.cpp +++ b/engines/sci/engine/kpathing.cpp @@ -410,24 +410,24 @@ static void print_polygon(EngineState *s, reg_t polygon) { int is_reg_t = polygon_is_reg_t(point_array, size); Common::Point point; - sciprintf("%i:", type); + printf("%i:", type); for (i = 0; i < size; i++) { point = read_point(point_array, is_reg_t, i); - sciprintf(" (%i, %i)", point.x, point.y); + printf(" (%i, %i)", point.x, point.y); } point = read_point(point_array, is_reg_t, 0); - sciprintf(" (%i, %i);\n", point.x, point.y); + printf(" (%i, %i);\n", point.x, point.y); } static void print_input(EngineState *s, reg_t poly_list, Common::Point start, Common::Point end, int opt) { List *list; Node *node; - sciprintf("Start point: (%i, %i)\n", start.x, start.y); - sciprintf("End point: (%i, %i)\n", end.x, end.y); - sciprintf("Optimization level: %i\n", opt); + printf("Start point: (%i, %i)\n", start.x, start.y); + printf("End point: (%i, %i)\n", end.x, end.y); + printf("Optimization level: %i\n", opt); if (!poly_list.segment) return; @@ -439,7 +439,7 @@ static void print_input(EngineState *s, reg_t poly_list, Common::Point start, Co return; } - sciprintf("Polygons:\n"); + printf("Polygons:\n"); node = lookup_node(s, list->first); while (node) { @@ -1539,7 +1539,7 @@ static void dijkstra(PathfindingState *s) { } if (min == HUGE_DISTANCE) { - sciprintf("[avoidpath] Warning: end point (%i, %i) is unreachable\n", s->vertex_end->v.x, s->vertex_end->v.y); + warning("[avoidpath] End point (%i, %i) is unreachable", s->vertex_end->v.x, s->vertex_end->v.y); return; } @@ -1629,13 +1629,13 @@ static reg_t output_path(PathfindingState *p, EngineState *s) { POLY_SET_POINT(oref, offset, Common::Point(POLY_LAST_POINT, POLY_LAST_POINT)); #ifdef DEBUG_AVOIDPATH - sciprintf("[avoidpath] Returning path:"); + printf("[avoidpath] Returning path:"); for (int i = 0; i < offset; i++) { Common::Point pt; POLY_GET_POINT(oref, i, pt); - sciprintf(" (%i, %i)", pt.x, pt.y); + printf(" (%i, %i)", pt.x, pt.y); } - sciprintf("\n"); + printf("\n"); #endif return output; @@ -1677,7 +1677,7 @@ reg_t kAvoidPath(EngineState *s, int funct_nr, int argc, reg_t *argv) { PathfindingState *p; #ifdef DEBUG_AVOIDPATH - sciprintf("[avoidpath] Pathfinding input:\n"); + printf("[avoidpath] Pathfinding input:\n"); draw_point(s, start, 1); draw_point(s, end, 0); @@ -1690,16 +1690,16 @@ reg_t kAvoidPath(EngineState *s, int funct_nr, int argc, reg_t *argv) { p = convert_polygon_set(s, poly_list, start, end, opt); if (p && intersecting_polygons(p)) { - sciprintf("[avoidpath] Error: input set contains (self-)intersecting polygons\n"); + warning("[avoidpath] input set contains (self-)intersecting polygons"); delete p; p = NULL; } if (!p) { byte *oref; - sciprintf("[avoidpath] Error: pathfinding failed for following input:\n"); + printf("[avoidpath] Error: pathfinding failed for following input:\n"); print_input(s, poly_list, start, end, opt); - sciprintf("[avoidpath] Returning direct path from start point to end point\n"); + printf("[avoidpath] Returning direct path from start point to end point\n"); oref = s->seg_manager->allocDynmem(POLY_POINT_SIZE * 3, AVOIDPATH_DYNMEM_STRING, &output); @@ -1720,8 +1720,7 @@ reg_t kAvoidPath(EngineState *s, int funct_nr, int argc, reg_t *argv) { } default: - warning("Unknown AvoidPath subfunction %d", - argc); + warning("Unknown AvoidPath subfunction %d", argc); return NULL_REG; break; } diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index fa64ab4086..d6369cfcd1 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -194,7 +194,7 @@ void process_sound_events(EngineState *s) { /* Get all sound events, apply their break; default: - sciprintf("Unexpected result from sfx_poll: %d\n", result); + warning("Unexpected result from sfx_poll: %d", result); break; } } @@ -215,63 +215,63 @@ reg_t kDoSound_SCI0(EngineState *s, int funct_nr, int argc, reg_t *argv) { debugC(2, kDebugLevelSound, "Command 0x%x", command); switch (command) { case 0: - sciprintf("[InitObj]"); + debugC(2, kDebugLevelSound, "[InitObj]"); break; case 1: - sciprintf("[Play]"); + debugC(2, kDebugLevelSound, "[Play]"); break; case 2: - sciprintf("[NOP]"); + debugC(2, kDebugLevelSound, "[NOP]"); break; case 3: - sciprintf("[DisposeHandle]"); + debugC(2, kDebugLevelSound, "[DisposeHandle]"); break; case 4: - sciprintf("[SetSoundOn(?)]"); + debugC(2, kDebugLevelSound, "[SetSoundOn(?)]"); break; case 5: - sciprintf("[Stop]"); + debugC(2, kDebugLevelSound, "[Stop]"); break; case 6: - sciprintf("[Suspend]"); + debugC(2, kDebugLevelSound, "[Suspend]"); break; case 7: - sciprintf("[Resume]"); + debugC(2, kDebugLevelSound, "[Resume]"); break; case 8: - sciprintf("[Get(Set?)Volume]"); + debugC(2, kDebugLevelSound, "[Get(Set?)Volume]"); break; case 9: - sciprintf("[Signal: Obj changed]"); + debugC(2, kDebugLevelSound, "[Signal: Obj changed]"); break; case 10: - sciprintf("[Fade(?)]"); + debugC(2, kDebugLevelSound, "[Fade(?)]"); break; case 11: - sciprintf("[ChkDriver]"); + debugC(2, kDebugLevelSound, "[ChkDriver]"); break; case 12: - sciprintf("[PlayNextSong (formerly StopAll)]"); + debugC(2, kDebugLevelSound, "[PlayNextSong (formerly StopAll)]"); break; default: - sciprintf("[unknown]"); + debugC(2, kDebugLevelSound, "[unknown]"); break; } - sciprintf("("); + debugC(2, kDebugLevelSound, "("); for (i = 1; i < argc; i++) { - sciprintf("%04x:%04x", PRINT_REG(argv[i])); + debugC(2, kDebugLevelSound, "%04x:%04x", PRINT_REG(argv[i])); if (i + 1 < argc) - sciprintf(", "); + debugC(2, kDebugLevelSound, ", "); } - sciprintf(")\n"); + debugC(2, kDebugLevelSound, ")\n"); #endif // DEBUG_SOUND switch (command) { case _K_SCI0_SOUND_INIT_HANDLE: if (obj.segment) { - sciprintf("Initializing song number %d\n", GET_SEL32V(obj, number)); + debugC(2, kDebugLevelSound, "Initializing song number %d\n", GET_SEL32V(obj, number)); s->_sound.sfx_add_song(build_iterator(s, number, SCI_SONG_ITERATOR_TYPE_SCI0, handle), 0, handle, number); @@ -395,62 +395,62 @@ reg_t kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) { debugC(2, kDebugLevelSound, "Command 0x%x", command); switch (command) { case 0: - sciprintf("[MasterVolume]"); + debugC(2, kDebugLevelSound, "[MasterVolume]"); break; case 1: - sciprintf("[Mute]"); + debugC(2, kDebugLevelSound, "[Mute]"); break; case 2: - sciprintf("[NOP(2)]"); + debugC(2, kDebugLevelSound, "[NOP(2)]"); break; case 3: - sciprintf("[GetPolyphony]"); + debugC(2, kDebugLevelSound, "[GetPolyphony]"); break; case 4: - sciprintf("[Update]"); + debugC(2, kDebugLevelSound, "[Update]"); break; case 5: - sciprintf("[Init]"); + debugC(2, kDebugLevelSound, "[Init]"); break; case 6: - sciprintf("[Dispose]"); + debugC(2, kDebugLevelSound, "[Dispose]"); break; case 7: - sciprintf("[Play]"); + debugC(2, kDebugLevelSound, "[Play]"); break; case 8: - sciprintf("[Stop]"); + debugC(2, kDebugLevelSound, "[Stop]"); break; case 9: - sciprintf("[Suspend]"); + debugC(2, kDebugLevelSound, "[Suspend]"); break; case 10: - sciprintf("[Fade]"); + debugC(2, kDebugLevelSound, "[Fade]"); break; case 11: - sciprintf("[UpdateCues]"); + debugC(2, kDebugLevelSound, "[UpdateCues]"); break; case 12: - sciprintf("[MidiSend]"); + debugC(2, kDebugLevelSound, "[MidiSend]"); break; case 13: - sciprintf("[Reverb]"); + debugC(2, kDebugLevelSound, "[Reverb]"); break; case 14: - sciprintf("[Hold]"); + debugC(2, kDebugLevelSound, "[Hold]"); break; default: - sciprintf("[unknown]"); + debugC(2, kDebugLevelSound, "[unknown]"); break; } - sciprintf("("); + debugC(2, kDebugLevelSound, "("); for (i = 1; i < argc; i++) { - sciprintf("%04x:%04x", PRINT_REG(argv[i])); + debugC(2, kDebugLevelSound, "%04x:%04x", PRINT_REG(argv[i])); if (i + 1 < argc) - sciprintf(", "); + debugC(2, kDebugLevelSound, ", "); } - sciprintf(")\n"); + debugC(2, kDebugLevelSound, ")\n"); } #endif @@ -504,7 +504,7 @@ reg_t kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) { //int pri = GET_SEL32V(obj, pri); if (obj.segment && (s->resmgr->testResource(ResourceId(kResourceTypeSound, number)))) { - sciprintf("Initializing song number %d\n", number); + debugC(2, kDebugLevelSound, "Initializing song number %d\n", number); s->_sound.sfx_add_song(build_iterator(s, number, SCI_SONG_ITERATOR_TYPE_SCI1, handle), 0, handle, number); PUT_SEL32(obj, nodePtr, obj); @@ -685,80 +685,80 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { debugC(2, kDebugLevelSound, "Command 0x%x", command); switch (command) { case 0: - sciprintf("[MasterVolume]"); + debugC(2, kDebugLevelSound, "[MasterVolume]"); break; case 1: - sciprintf("[Mute]"); + debugC(2, kDebugLevelSound, "[Mute]"); break; case 2: - sciprintf("[NOP(2)]"); + debugC(2, kDebugLevelSound, "[NOP(2)]"); break; case 3: - sciprintf("[GetPolyphony]"); + debugC(2, kDebugLevelSound, "[GetPolyphony]"); break; case 4: - sciprintf("[GetAudioCapability]"); + debugC(2, kDebugLevelSound, "[GetAudioCapability]"); break; case 5: - sciprintf("[GlobalSuspend]"); + debugC(2, kDebugLevelSound, "[GlobalSuspend]"); break; case 6: - sciprintf("[Init]"); + debugC(2, kDebugLevelSound, "[Init]"); break; case 7: - sciprintf("[Dispose]"); + debugC(2, kDebugLevelSound, "[Dispose]"); break; case 8: - sciprintf("[Play]"); + debugC(2, kDebugLevelSound, "[Play]"); break; case 9: - sciprintf("[Stop]"); + debugC(2, kDebugLevelSound, "[Stop]"); break; case 10: - sciprintf("[SuspendHandle]"); + debugC(2, kDebugLevelSound, "[SuspendHandle]"); break; case 11: - sciprintf("[Fade]"); + debugC(2, kDebugLevelSound, "[Fade]"); break; case 12: - sciprintf("[Hold]"); + debugC(2, kDebugLevelSound, "[Hold]"); break; case 13: - sciprintf("[Unused(13)]"); + debugC(2, kDebugLevelSound, "[Unused(13)]"); break; case 14: - sciprintf("[SetVolume]"); + debugC(2, kDebugLevelSound, "[SetVolume]"); break; case 15: - sciprintf("[SetPriority]"); + debugC(2, kDebugLevelSound, "[SetPriority]"); break; case 16: - sciprintf("[SetLoop]"); + debugC(2, kDebugLevelSound, "[SetLoop]"); break; case 17: - sciprintf("[UpdateCues]"); + debugC(2, kDebugLevelSound, "[UpdateCues]"); break; case 18: - sciprintf("[MidiSend]"); + debugC(2, kDebugLevelSound, "[MidiSend]"); break; case 19: - sciprintf("[Reverb]"); + debugC(2, kDebugLevelSound, "[Reverb]"); break; case 20: - sciprintf("[UpdateVolPri]"); + debugC(2, kDebugLevelSound, "[UpdateVolPri]"); break; default: - sciprintf("[unknown]"); + debugC(2, kDebugLevelSound, "[unknown]"); break; } - sciprintf("("); + debugC(2, kDebugLevelSound, "("); for (i = 1; i < argc; i++) { - sciprintf("%04x:%04x", PRINT_REG(argv[i])); + debugC(2, kDebugLevelSound, "%04x:%04x", PRINT_REG(argv[i])); if (i + 1 < argc) - sciprintf(", "); + debugC(2, kDebugLevelSound, ", "); } - sciprintf(")\n"); + debugC(2, kDebugLevelSound, ")\n"); } #endif // DEBUG_SOUND @@ -808,11 +808,11 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (!GET_SEL32V(obj, nodePtr) && obj.segment) { if (!s->resmgr->testResource(ResourceId(kResourceTypeSound, number))) { - sciprintf("Could not open song number %d\n", number); + warning("Could not open song number %d", number); return NULL_REG; } - sciprintf("Initializing song number %d\n", number); + debugC(2, kDebugLevelSound, "Initializing song number %d\n", number); s->_sound.sfx_add_song(build_iterator(s, number, SCI_SONG_ITERATOR_TYPE_SCI1, handle), 0, handle, number); PUT_SEL32(obj, nodePtr, obj); @@ -838,7 +838,7 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { } if (obj.segment && (s->resmgr->testResource(ResourceId(kResourceTypeSound, number)))) { - sciprintf("Initializing song number %d\n", number); + debugC(2, kDebugLevelSound, "Initializing song number %d\n", number); s->_sound.sfx_add_song(build_iterator(s, number, SCI_SONG_ITERATOR_TYPE_SCI1, handle), 0, handle, number); PUT_SEL32(obj, nodePtr, obj); diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index 2a30a103b6..c572906285 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -112,7 +112,7 @@ reg_t kSaid(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (new_lastmatch != SAID_NO_MATCH) { /* Build and possibly display a parse tree */ #ifdef DEBUG_PARSER - sciprintf("Match.\n"); + printf("kSaid: Match.\n"); #endif s->r_acc = make_reg(0, 1); @@ -193,11 +193,6 @@ reg_t kParse(EngineState *s, int funct_nr, int argc, reg_t *argv) { s->parser_event = event; - if (s->parser_valid == 2) { - sciprintf("Parsing skipped: Parser in simparse mode\n"); - return s->r_acc; - } - bool res = s->_vocabulary->tokenizeString(words, string, &error); s->parser_valid = 0; /* not valid */ diff --git a/engines/sci/engine/memobj.cpp b/engines/sci/engine/memobj.cpp index 4d37d2aece..ab8e14efc7 100644 --- a/engines/sci/engine/memobj.cpp +++ b/engines/sci/engine/memobj.cpp @@ -159,7 +159,7 @@ bool Script::isValidOffset(uint16 offset) const { byte *Script::dereference(reg_t pointer, int *size) { if (pointer.offset > buf_size) { - sciprintf("Error: Attempt to dereference invalid pointer %04x:%04x into script segment (script size=%d)\n", + warning("Attempt to dereference invalid pointer %04x:%04x into script segment (script size=%d)\n", PRINT_REG(pointer), (uint)buf_size); return NULL; } @@ -231,9 +231,9 @@ reg_t Script::findCanonicAddress(SegManager *segmgr, reg_t addr) { void Script::freeAtAddress(SegManager *segmgr, reg_t addr) { /* - sciprintf("[GC] Freeing script %04x:%04x\n", PRINT_REG(addr)); + debugC(2, kDebugLevelGC, "[GC] Freeing script %04x:%04x\n", PRINT_REG(addr)); if (locals_segment) - sciprintf("[GC] Freeing locals %04x:0000\n", locals_segment); + debugC(2, kDebugLevelGC, "[GC] Freeing locals %04x:0000\n", locals_segment); */ if (_markedAsDeleted) @@ -289,7 +289,7 @@ void CloneTable::listAllOutgoingReferences(EngineState *s, reg_t addr, void *par // Note that this also includes the 'base' object, which is part of the script and therefore also emits the locals. (*note)(param, clone->pos); - //sciprintf("[GC] Reporting clone-pos %04x:%04x\n", PRINT_REG(clone->pos)); + //debugC(2, kDebugLevelGC, "[GC] Reporting clone-pos %04x:%04x\n", PRINT_REG(clone->pos)); } void CloneTable::freeAtAddress(SegManager *segmgr, reg_t addr) { @@ -302,15 +302,15 @@ void CloneTable::freeAtAddress(SegManager *segmgr, reg_t addr) { #ifdef GC_DEBUG if (!(victim_obj->flags & OBJECT_FLAG_FREED)) - sciprintf("[GC] Warning: Clone %04x:%04x not reachable and not freed (freeing now)\n", PRINT_REG(addr)); + warning("[GC] Clone %04x:%04x not reachable and not freed (freeing now)", PRINT_REG(addr)); #ifdef GC_DEBUG_VERBOSE else - sciprintf("[GC-DEBUG] Clone %04x:%04x: Freeing\n", PRINT_REG(addr)); + warning("[GC-DEBUG] Clone %04x:%04x: Freeing", PRINT_REG(addr)); #endif #endif /* - sciprintf("[GC] Clone %04x:%04x: Freeing\n", PRINT_REG(addr)); - sciprintf("[GC] Clone had pos %04x:%04x\n", PRINT_REG(victim_obj->pos)); + warning("[GC] Clone %04x:%04x: Freeing", PRINT_REG(addr)); + warning("[GC] Clone had pos %04x:%04x", PRINT_REG(victim_obj->pos)); */ clone_table->freeEntry(addr.offset); } diff --git a/engines/sci/engine/said.cpp b/engines/sci/engine/said.cpp index 327231857e..a6a3ee1405 100644 --- a/engines/sci/engine/said.cpp +++ b/engines/sci/engine/said.cpp @@ -172,9 +172,10 @@ namespace Sci { #ifdef SCI_DEBUG_PARSE_TREE_AUGMENTATION -#define scidprintf sciprintf +#define scidprintf printf #else -#define scidprintf if (0) sciprintf +void print_nothing(...) { } +#define scidprintf print_nothing #endif @@ -2027,23 +2028,23 @@ static int said_parse_spec(EngineState *s, byte *spec) { if (nextitem == SAID_TERM) yyparse(); else { - sciprintf("Error: SAID spec is too long\n"); + warning("SAID spec is too long"); return 1; } if (said_parse_error) { - sciprintf("Error while parsing SAID spec: %s\n", said_parse_error); + warning("Error while parsing SAID spec: %s", said_parse_error); free(said_parse_error); return 1; } if (said_tree_pos == 0) { - sciprintf("Error: Out of tree space while parsing SAID spec\n"); + warning("Out of tree space while parsing SAID spec"); return 1; } if (said_blessed != 1) { - sciprintf("Error: Found multiple top branches\n"); + warning("Found multiple top branches"); return 1; } @@ -2146,7 +2147,7 @@ static void aug_find_words_recursively(parse_tree_node_t *tree, int startpos, in if ((word = aug_get_wgroup(tree, pos))) { // found a word if (!refbranch && major == WORD_TYPE_BASE) { if ((*base_words_nr) == maxwords) { - sciprintf("Out of regular words\n"); + warning("Out of regular words"); return; // return gracefully } @@ -2156,7 +2157,7 @@ static void aug_find_words_recursively(parse_tree_node_t *tree, int startpos, in } if (major == WORD_TYPE_REF || refbranch) { if ((*ref_words_nr) == maxwords) { - sciprintf("Out of reference words\n"); + warning("Out of reference words"); return; // return gracefully } @@ -2165,7 +2166,7 @@ static void aug_find_words_recursively(parse_tree_node_t *tree, int startpos, in } if (major != WORD_TYPE_SYNTACTIC_SUGAR && major != WORD_TYPE_BASE && major != WORD_TYPE_REF) - sciprintf("aug_find_words_recursively(): Unknown word type %03x\n", major); + warning("aug_find_words_recursively(): Unknown word type %03x", major); } else // Did NOT find a word group: Attempt to recurse aug_find_words_recursively(tree, pos, base_words, base_words_nr, @@ -2210,7 +2211,7 @@ static int augment_match_expression_p(parse_tree_node_t *saidt, int augment_pos, int cmajor, cminor, cpos; cpos = aug_get_first_child(saidt, augment_pos, &cmajor, &cminor); if (!cpos) { - sciprintf("augment_match_expression_p(): Empty condition\n"); + warning("augment_match_expression_p(): Empty condition"); return 1; } @@ -2246,7 +2247,7 @@ static int augment_match_expression_p(parse_tree_node_t *saidt, int augment_pos, gchild = aug_get_next_sibling(saidt, gchild, &gc_major, &gc_minor); } } else - sciprintf("augment_match_expression_p(): Unknown type 141 minor number %3x\n", cminor); + warning("augment_match_expression_p(): Unknown type 141 minor number %3x", cminor); cpos = aug_get_next_sibling(saidt, cpos, &cmajor, &cminor); @@ -2277,7 +2278,7 @@ static int augment_match_expression_p(parse_tree_node_t *saidt, int augment_pos, gchild = aug_get_next_sibling(saidt, gchild, &gc_major, &gc_minor); } } else - sciprintf("augment_match_expression_p(): Unknown type 144 minor number %3x\n", cminor); + warning("augment_match_expression_p(): Unknown type 144 minor number %3x", cminor); cpos = aug_get_next_sibling(saidt, cpos, &cmajor, &cminor); @@ -2303,17 +2304,17 @@ static int augment_match_expression_p(parse_tree_node_t *saidt, int augment_pos, break; default: - sciprintf("augment_match_expression_p(): (subp1) Unkonwn sub-bracket predicate %03x\n", cmajor); + warning("augment_match_expression_p(): (subp1) Unkonwn sub-bracket predicate %03x", cmajor); } break; default: - sciprintf("augment_match_expression_p(): Unknown predicate %03x\n", major); + warning("augment_match_expression_p(): Unknown predicate %03x", major); } - scidprintf("Generic failure\n"); + warning("augment_match_expression_p(): Generic failure"); return 0; } @@ -2371,13 +2372,13 @@ static int augment_sentence_part(parse_tree_node_t *saidt, int augment_pos, pars aug_find_words(parset, parse_branch, base_words, &base_words_nr, ref_words, &ref_words_nr, AUGMENT_MAX_WORDS); foundwords |= (ref_words_nr | base_words_nr); #ifdef SCI_DEBUG_PARSE_TREE_AUGMENTATION - sciprintf("%d base words:", base_words_nr); + printf("%d base words:", base_words_nr); for (i = 0; i < base_words_nr; i++) - sciprintf(" %03x", base_words[i]); - sciprintf("\n%d reference words:", ref_words_nr); + printf(" %03x", base_words[i]); + printf("\n%d reference words:", ref_words_nr); for (i = 0; i < ref_words_nr; i++) - sciprintf(" %03x", ref_words[i]); - sciprintf("\n"); + printf(" %03x", ref_words[i]); + printf("\n"); #endif success = augment_sentence_expression(saidt, augment_pos, parset, parse_basepos, major, minor, @@ -2407,13 +2408,13 @@ static int augment_parse_nodes(parse_tree_node_t *parset, parse_tree_node_t *sai parse_basepos = aug_get_base_node(parset); if (!parse_basepos) { - sciprintf("augment_parse_nodes(): Parse tree is corrupt\n"); + warning("augment_parse_nodes(): Parse tree is corrupt"); return 0; } augment_basepos = aug_get_base_node(saidt); if (!augment_basepos) { - sciprintf("augment_parse_nodes(): Said tree is corrupt\n"); + warning("augment_parse_nodes(): Said tree is corrupt"); return 0; } @@ -2447,7 +2448,7 @@ int said(EngineState *s, byte *spec, int verbose) { if (s->parser_valid) { if (said_parse_spec(s, spec)) { - sciprintf("Offending spec was: "); + printf("Offending spec was: "); s->_vocabulary->decipherSaidBlock(spec); return SAID_NO_MATCH; } diff --git a/engines/sci/engine/said.y b/engines/sci/engine/said.y index 10906d94ef..9fde2fddd0 100644 --- a/engines/sci/engine/said.y +++ b/engines/sci/engine/said.y @@ -65,9 +65,10 @@ namespace Sci { #ifdef SCI_DEBUG_PARSE_TREE_AUGMENTATION -#define scidprintf sciprintf +#define scidprintf printf #else -#define scidprintf if (0) sciprintf +void print_nothing(...) { } +#define scidprintf print_nothing #endif @@ -383,23 +384,23 @@ static int said_parse_spec(EngineState *s, byte *spec) { if (nextitem == SAID_TERM) yyparse(); else { - sciprintf("Error: SAID spec is too long\n"); + warning("SAID spec is too long"); return 1; } if (said_parse_error) { - sciprintf("Error while parsing SAID spec: %s\n", said_parse_error); + warning("Error while parsing SAID spec: %s", said_parse_error); free(said_parse_error); return 1; } if (said_tree_pos == 0) { - sciprintf("Error: Out of tree space while parsing SAID spec\n"); + warning("Out of tree space while parsing SAID spec"); return 1; } if (said_blessed != 1) { - sciprintf("Error: Found multiple top branches\n"); + warning("Found multiple top branches"); return 1; } @@ -502,7 +503,7 @@ static void aug_find_words_recursively(parse_tree_node_t *tree, int startpos, in if ((word = aug_get_wgroup(tree, pos))) { // found a word if (!refbranch && major == WORD_TYPE_BASE) { if ((*base_words_nr) == maxwords) { - sciprintf("Out of regular words\n"); + warning("Out of regular words"); return; // return gracefully } @@ -512,7 +513,7 @@ static void aug_find_words_recursively(parse_tree_node_t *tree, int startpos, in } if (major == WORD_TYPE_REF || refbranch) { if ((*ref_words_nr) == maxwords) { - sciprintf("Out of reference words\n"); + warning("Out of reference words"); return; // return gracefully } @@ -521,7 +522,7 @@ static void aug_find_words_recursively(parse_tree_node_t *tree, int startpos, in } if (major != WORD_TYPE_SYNTACTIC_SUGAR && major != WORD_TYPE_BASE && major != WORD_TYPE_REF) - sciprintf("aug_find_words_recursively(): Unknown word type %03x\n", major); + warning("aug_find_words_recursively(): Unknown word type %03x", major); } else // Did NOT find a word group: Attempt to recurse aug_find_words_recursively(tree, pos, base_words, base_words_nr, @@ -566,7 +567,7 @@ static int augment_match_expression_p(parse_tree_node_t *saidt, int augment_pos, int cmajor, cminor, cpos; cpos = aug_get_first_child(saidt, augment_pos, &cmajor, &cminor); if (!cpos) { - sciprintf("augment_match_expression_p(): Empty condition\n"); + warning("augment_match_expression_p(): Empty condition"); return 1; } @@ -602,7 +603,7 @@ static int augment_match_expression_p(parse_tree_node_t *saidt, int augment_pos, gchild = aug_get_next_sibling(saidt, gchild, &gc_major, &gc_minor); } } else - sciprintf("augment_match_expression_p(): Unknown type 141 minor number %3x\n", cminor); + warning("augment_match_expression_p(): Unknown type 141 minor number %3x", cminor); cpos = aug_get_next_sibling(saidt, cpos, &cmajor, &cminor); @@ -633,7 +634,7 @@ static int augment_match_expression_p(parse_tree_node_t *saidt, int augment_pos, gchild = aug_get_next_sibling(saidt, gchild, &gc_major, &gc_minor); } } else - sciprintf("augment_match_expression_p(): Unknown type 144 minor number %3x\n", cminor); + warning("augment_match_expression_p(): Unknown type 144 minor number %3x", cminor); cpos = aug_get_next_sibling(saidt, cpos, &cmajor, &cminor); @@ -659,13 +660,13 @@ static int augment_match_expression_p(parse_tree_node_t *saidt, int augment_pos, break; default: - sciprintf("augment_match_expression_p(): (subp1) Unkonwn sub-bracket predicate %03x\n", cmajor); + warning("augment_match_expression_p(): (subp1) Unkonwn sub-bracket predicate %03x", cmajor); } break; default: - sciprintf("augment_match_expression_p(): Unknown predicate %03x\n", major); + warning("augment_match_expression_p(): Unknown predicate %03x", major); } @@ -727,13 +728,13 @@ static int augment_sentence_part(parse_tree_node_t *saidt, int augment_pos, pars aug_find_words(parset, parse_branch, base_words, &base_words_nr, ref_words, &ref_words_nr, AUGMENT_MAX_WORDS); foundwords |= (ref_words_nr | base_words_nr); #ifdef SCI_DEBUG_PARSE_TREE_AUGMENTATION - sciprintf("%d base words:", base_words_nr); + printf("%d base words:", base_words_nr); for (i = 0; i < base_words_nr; i++) - sciprintf(" %03x", base_words[i]); - sciprintf("\n%d reference words:", ref_words_nr); + printf(" %03x", base_words[i]); + printf("\n%d reference words:", ref_words_nr); for (i = 0; i < ref_words_nr; i++) - sciprintf(" %03x", ref_words[i]); - sciprintf("\n"); + printf(" %03x", ref_words[i]); + printf("\n"); #endif success = augment_sentence_expression(saidt, augment_pos, parset, parse_basepos, major, minor, @@ -763,13 +764,13 @@ static int augment_parse_nodes(parse_tree_node_t *parset, parse_tree_node_t *sai parse_basepos = aug_get_base_node(parset); if (!parse_basepos) { - sciprintf("augment_parse_nodes(): Parse tree is corrupt\n"); + warning("augment_parse_nodes(): Parse tree is corrupt"); return 0; } augment_basepos = aug_get_base_node(saidt); if (!augment_basepos) { - sciprintf("augment_parse_nodes(): Said tree is corrupt\n"); + warning("augment_parse_nodes(): Said tree is corrupt"); return 0; } @@ -803,7 +804,7 @@ int said(EngineState *s, byte *spec, int verbose) { if (s->parser_valid) { if (said_parse_spec(s, spec)) { - sciprintf("Offending spec was: "); + warning("Offending spec was: "); s->_vocabulary->decypherSaidBlock(spec); return SAID_NO_MATCH; } diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 146d65b56d..bfff828745 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -464,15 +464,15 @@ int gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename meta.savegame_time = ((curTime.tm_hour & 0xFF) << 16) | (((curTime.tm_min) & 0xFF) << 8) | ((curTime.tm_sec) & 0xFF); if (s->execution_stack_base) { - sciprintf("Cannot save from below kernel function\n"); + warning("Cannot save from below kernel function"); return 1; } /* if (s->sound_server) { if ((s->sound_server->save)(s, dirname)) { - sciprintf("Saving failed for the sound subsystem\n"); - chdir(".."); + warning("Saving failed for the sound subsystem"); + //chdir(".."); return 1; } } @@ -616,7 +616,7 @@ static void reconstruct_scripts(EngineState *s, SegManager *self) { base_obj = obj_get(s, scr->_objects[j]._variables[SCRIPT_SPECIES_SELECTOR]); if (!base_obj) { - sciprintf("Object without a base class: Script %d, index %d (reg address %04x:%04x\n", + warning("Object without a base class: Script %d, index %d (reg address %04x:%04x", scr->nr, j, PRINT_REG(scr->_objects[j]._variables[SCRIPT_SPECIES_SELECTOR])); continue; } @@ -646,18 +646,18 @@ static void reconstruct_clones(EngineState *s, SegManager *self) { CloneTable *ct = (CloneTable *)mobj; /* - sciprintf("Free list: "); + printf("Free list: "); for (uint j = ct->first_free; j != HEAPENTRY_INVALID; j = ct->_table[j].next_free) { - sciprintf("%d ", j); + printf("%d ", j); } - sciprintf("\n"); + printf("\n"); - sciprintf("Entries w/zero vars: "); + printf("Entries w/zero vars: "); for (uint j = 0; j < ct->_table.size(); j++) { if (ct->_table[j].variables == NULL) - sciprintf("%d ", j); + printf("%d ", j); } - sciprintf("\n"); + printf("\n"); */ for (uint j = 0; j < ct->_table.size(); j++) { @@ -669,7 +669,7 @@ static void reconstruct_clones(EngineState *s, SegManager *self) { CloneTable::Entry &seeker = ct->_table[j]; base_obj = obj_get(s, seeker._variables[SCRIPT_SPECIES_SELECTOR]); if (!base_obj) { - sciprintf("Clone entry without a base class: %d\n", j); + printf("Clone entry without a base class: %d\n", j); seeker.base = seeker.base_obj = NULL; seeker.base_vars = seeker.base_method = NULL; } else { @@ -729,7 +729,7 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { /* if (s->sound_server) { if ((s->sound_server->restore)(s, dirname)) { - sciprintf("Restoring failed for the sound subsystem\n"); + warning("Restoring failed for the sound subsystem"); return NULL; } } @@ -746,9 +746,9 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { if ((meta.savegame_version < MINIMUM_SAVEGAME_VERSION) || (meta.savegame_version > CURRENT_SAVEGAME_VERSION)) { if (meta.savegame_version < MINIMUM_SAVEGAME_VERSION) - sciprintf("Old savegame version detected- can't load\n"); + warning("Old savegame version detected- can't load"); else - sciprintf("Savegame version is %d- maximum supported is %0d\n", meta.savegame_version, CURRENT_SAVEGAME_VERSION); + warning("Savegame version is %d- maximum supported is %0d", meta.savegame_version, CURRENT_SAVEGAME_VERSION); return NULL; } @@ -864,9 +864,9 @@ bool get_savegame_metadata(Common::SeekableReadStream *stream, SavegameMetadata if ((meta->savegame_version < MINIMUM_SAVEGAME_VERSION) || (meta->savegame_version > CURRENT_SAVEGAME_VERSION)) { if (meta->savegame_version < MINIMUM_SAVEGAME_VERSION) - sciprintf("Old savegame version detected- can't load\n"); + warning("Old savegame version detected- can't load"); else - sciprintf("Savegame version is %d- maximum supported is %0d\n", meta->savegame_version, CURRENT_SAVEGAME_VERSION); + warning("Savegame version is %d- maximum supported is %0d", meta->savegame_version, CURRENT_SAVEGAME_VERSION); return false; } diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index d4bd094b4a..2939c6a646 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -103,7 +103,7 @@ void script_adjust_opcode_formats(int res_version) { g_opcode_formats[op_lofss][0] = Script_Offset; break; default: - sciprintf("script_adjust_opcode_formats(): Unknown script version %d\n", res_version); + error("script_adjust_opcode_formats(): Unknown script version %d\n", res_version); } } @@ -215,28 +215,27 @@ void Kernel::dumpScriptObject(char *data, int seeker, int objsize) { int namepos = (int16)READ_LE_UINT16((unsigned char *) data + 14 + seeker); int i = 0; - sciprintf("Object\n"); + printf("Object\n"); Common::hexdump((unsigned char *) data + seeker, objsize - 4, 16, seeker); //-4 because the size includes the two-word header - sciprintf("Name: %s\n", namepos ? ((char *)(data + namepos)) : ""); - sciprintf("Superclass: %x\n", superclass); - sciprintf("Species: %x\n", species); - sciprintf("-info-:%x\n", (int16)READ_LE_UINT16((unsigned char *) data + 12 + seeker) & 0xffff); + printf("Name: %s\n", namepos ? ((char *)(data + namepos)) : ""); + printf("Superclass: %x\n", superclass); + printf("Species: %x\n", species); + printf("-info-:%x\n", (int16)READ_LE_UINT16((unsigned char *) data + 12 + seeker) & 0xffff); - sciprintf("Function area offset: %x\n", (int16)READ_LE_UINT16((unsigned char *) data + seeker + 4)); - sciprintf("Selectors [%x]:\n", selectors = (selectorsize = (int16)READ_LE_UINT16((unsigned char *) data + seeker + 6))); + printf("Function area offset: %x\n", (int16)READ_LE_UINT16((unsigned char *) data + seeker + 4)); + printf("Selectors [%x]:\n", selectors = (selectorsize = (int16)READ_LE_UINT16((unsigned char *) data + seeker + 6))); seeker += 8; while (selectors--) { - sciprintf(" [#%03x] = 0x%x\n", i++, (int16)READ_LE_UINT16((unsigned char *)data + seeker) & 0xffff); - + printf(" [#%03x] = 0x%x\n", i++, (int16)READ_LE_UINT16((unsigned char *)data + seeker) & 0xffff); seeker += 2; } - sciprintf("Overridden functions: %x\n", selectors = overloads = (int16)READ_LE_UINT16((unsigned char *)data + seeker)); + printf("Overridden functions: %x\n", selectors = overloads = (int16)READ_LE_UINT16((unsigned char *)data + seeker)); seeker += 2; @@ -244,8 +243,8 @@ void Kernel::dumpScriptObject(char *data, int seeker, int objsize) { while (overloads--) { int selector = (int16)READ_LE_UINT16((unsigned char *) data + (seeker)); - sciprintf(" [%03x] %s: @", selector & 0xffff, (selector >= 0 && selector < (int)_selectorNames.size()) ? _selectorNames[selector].c_str() : ""); - sciprintf("%04x\n", (int16)READ_LE_UINT16((unsigned char *)data + seeker + selectors*2 + 2) & 0xffff); + printf(" [%03x] %s: @", selector & 0xffff, (selector >= 0 && selector < (int)_selectorNames.size()) ? _selectorNames[selector].c_str() : ""); + printf("%04x\n", (int16)READ_LE_UINT16((unsigned char *)data + seeker + selectors*2 + 2) & 0xffff); seeker += 2; } @@ -257,17 +256,17 @@ void Kernel::dumpScriptClass(char *data, int seeker, int objsize) { int superclass = (int16)READ_LE_UINT16((unsigned char *) data + 10 + seeker); int namepos = (int16)READ_LE_UINT16((unsigned char *) data + 14 + seeker); - sciprintf("Class\n"); + printf("Class\n"); Common::hexdump((unsigned char *) data + seeker, objsize - 4, 16, seeker); - sciprintf("Name: %s\n", namepos ? ((char *)data + namepos) : ""); - sciprintf("Superclass: %x\n", superclass); - sciprintf("Species: %x\n", species); - sciprintf("-info-:%x\n", (int16)READ_LE_UINT16((unsigned char *)data + 12 + seeker) & 0xffff); + printf("Name: %s\n", namepos ? ((char *)data + namepos) : ""); + printf("Superclass: %x\n", superclass); + printf("Species: %x\n", species); + printf("-info-:%x\n", (int16)READ_LE_UINT16((unsigned char *)data + 12 + seeker) & 0xffff); - sciprintf("Function area offset: %x\n", (int16)READ_LE_UINT16((unsigned char *)data + seeker + 4)); - sciprintf("Selectors [%x]:\n", selectors = (selectorsize = (int16)READ_LE_UINT16((unsigned char *)data + seeker + 6))); + printf("Function area offset: %x\n", (int16)READ_LE_UINT16((unsigned char *)data + seeker + 4)); + printf("Selectors [%x]:\n", selectors = (selectorsize = (int16)READ_LE_UINT16((unsigned char *)data + seeker + 6))); seeker += 8; selectorsize <<= 1; @@ -275,7 +274,7 @@ void Kernel::dumpScriptClass(char *data, int seeker, int objsize) { while (selectors--) { int selector = (int16)READ_LE_UINT16((unsigned char *) data + (seeker) + selectorsize); - sciprintf(" [%03x] %s = 0x%x\n", 0xffff & selector, (selector >= 0 && selector < (int)_selectorNames.size()) ? _selectorNames[selector].c_str() : "", + printf(" [%03x] %s = 0x%x\n", 0xffff & selector, (selector >= 0 && selector < (int)_selectorNames.size()) ? _selectorNames[selector].c_str() : "", (int16)READ_LE_UINT16((unsigned char *)data + seeker) & 0xffff); seeker += 2; @@ -283,16 +282,16 @@ void Kernel::dumpScriptClass(char *data, int seeker, int objsize) { seeker += selectorsize; - sciprintf("Overloaded functions: %x\n", selectors = overloads = (int16)READ_LE_UINT16((unsigned char *)data + seeker)); + printf("Overloaded functions: %x\n", selectors = overloads = (int16)READ_LE_UINT16((unsigned char *)data + seeker)); seeker += 2; while (overloads--) { int selector = (int16)READ_LE_UINT16((unsigned char *)data + (seeker)); fprintf(stderr, "selector=%d; selectorNames.size() =%d\n", selector, _selectorNames.size()); - sciprintf(" [%03x] %s: @", selector & 0xffff, (selector >= 0 && selector < (int)_selectorNames.size()) ? + printf(" [%03x] %s: @", selector & 0xffff, (selector >= 0 && selector < (int)_selectorNames.size()) ? _selectorNames[selector].c_str() : ""); - sciprintf("%04x\n", (int16)READ_LE_UINT16((unsigned char *)data + seeker + selectors * 2 + 2) & 0xffff); + printf("%04x\n", (int16)READ_LE_UINT16((unsigned char *)data + seeker + selectors * 2 + 2) & 0xffff); seeker += 2; } @@ -304,7 +303,7 @@ void Kernel::dissectScript(int scriptNumber, Vocabulary *vocab) { Resource *script = _resmgr->findResource(ResourceId(kResourceTypeScript, scriptNumber), 0); if (!script) { - sciprintf("Script not found!\n"); + warning("dissectScript(): Script not found!\n"); return; } @@ -314,17 +313,17 @@ void Kernel::dissectScript(int scriptNumber, Vocabulary *vocab) { unsigned int seeker = _seeker + 4; if (!objtype) { - sciprintf("End of script object (#0) encountered.\n"); - sciprintf("Classes: %i, Objects: %i, Export: %i,\n Var: %i (all base 10)", + printf("End of script object (#0) encountered.\n"); + printf("Classes: %i, Objects: %i, Export: %i,\n Var: %i (all base 10)", objectctr[6], objectctr[1], objectctr[7], objectctr[10]); return; } - sciprintf("\n"); + printf("\n"); objsize = (int16)READ_LE_UINT16(script->data + _seeker + 2); - sciprintf("Obj type #%x, size 0x%x: ", objtype, objsize); + printf("Obj type #%x, size 0x%x: ", objtype, objsize); _seeker += objsize; @@ -336,72 +335,72 @@ void Kernel::dissectScript(int scriptNumber, Vocabulary *vocab) { break; case SCI_OBJ_CODE: { - sciprintf("Code\n"); + printf("Code\n"); Common::hexdump(script->data + seeker, objsize - 4, 16, seeker); }; break; case 3: { - sciprintf("\n"); + printf("\n"); Common::hexdump(script->data + seeker, objsize - 4, 16, seeker); }; break; case SCI_OBJ_SAID: { - sciprintf("Said\n"); + printf("Said\n"); Common::hexdump(script->data + seeker, objsize - 4, 16, seeker); - sciprintf("%04x: ", seeker); + printf("%04x: ", seeker); while (seeker < _seeker) { unsigned char nextitem = script->data [seeker++]; if (nextitem == 0xFF) - sciprintf("\n%04x: ", seeker); + printf("\n%04x: ", seeker); else if (nextitem >= 0xF0) { switch (nextitem) { case 0xf0: - sciprintf(", "); + printf(", "); break; case 0xf1: - sciprintf("& "); + printf("& "); break; case 0xf2: - sciprintf("/ "); + printf("/ "); break; case 0xf3: - sciprintf("( "); + printf("( "); break; case 0xf4: - sciprintf(") "); + printf(") "); break; case 0xf5: - sciprintf("[ "); + printf("[ "); break; case 0xf6: - sciprintf("] "); + printf("] "); break; case 0xf7: - sciprintf("# "); + printf("# "); break; case 0xf8: - sciprintf("< "); + printf("< "); break; case 0xf9: - sciprintf("> "); + printf("> "); break; } } else { nextitem = nextitem << 8 | script->data [seeker++]; - sciprintf("%s[%03x] ", vocab->getAnyWordFromGroup(nextitem), nextitem); + printf("%s[%03x] ", vocab->getAnyWordFromGroup(nextitem), nextitem); } } - sciprintf("\n"); + printf("\n"); } break; case SCI_OBJ_STRINGS: { - sciprintf("Strings\n"); + printf("Strings\n"); while (script->data [seeker]) { - sciprintf("%04x: %s\n", seeker, script->data + seeker); + printf("%04x: %s\n", seeker, script->data + seeker); seeker += strlen((char *)script->data + seeker) + 1; } seeker++; // the ending zero byte @@ -413,37 +412,37 @@ void Kernel::dissectScript(int scriptNumber, Vocabulary *vocab) { break; case SCI_OBJ_EXPORTS: { - sciprintf("Exports\n"); + printf("Exports\n"); Common::hexdump((unsigned char *)script->data + seeker, objsize - 4, 16, seeker); }; break; case SCI_OBJ_POINTERS: { - sciprintf("Pointers\n"); + printf("Pointers\n"); Common::hexdump(script->data + seeker, objsize - 4, 16, seeker); }; break; case 9: { - sciprintf("\n"); + printf("\n"); Common::hexdump(script->data + seeker, objsize - 4, 16, seeker); }; break; case SCI_OBJ_LOCALVARS: { - sciprintf("Local vars\n"); + printf("Local vars\n"); Common::hexdump(script->data + seeker, objsize - 4, 16, seeker); }; break; default: - sciprintf("Unsupported!\n"); + printf("Unsupported!\n"); return; } } - sciprintf("Script ends without terminator\n"); + printf("Script ends without terminator\n"); } } // End of namespace Sci diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index a79fec2489..a524ddd365 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -42,7 +42,7 @@ int propertyOffsetToId(EngineState *s, int prop_ofs, reg_t objp) { int selectors; if (!obj) { - sciprintf("Applied propertyOffsetToId on non-object at %04x:%04x\n", PRINT_REG(objp)); + warning("Applied propertyOffsetToId on non-object at %04x:%04x", PRINT_REG(objp)); return -1; } @@ -59,7 +59,7 @@ int propertyOffsetToId(EngineState *s, int prop_ofs, reg_t objp) { } if (prop_ofs < 0 || (prop_ofs >> 1) >= selectors) { - sciprintf("Applied propertyOffsetToId to invalid property offset %x (property #%d not in [0..%d]) on object at %04x:%04x\n", + warning("Applied propertyOffsetToId to invalid property offset %x (property #%d not in [0..%d]) on object at %04x:%04x", prop_ofs, prop_ofs >> 1, selectors - 1, PRINT_REG(objp)); return -1; } @@ -81,7 +81,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod int i = 0; if (!mobj) { - sciprintf("Disassembly failed: Segment %04x non-existant or not a script\n", pos.segment); + warning("Disassembly failed: Segment %04x non-existant or not a script", pos.segment); return retval; } else script_entity = (Script *)mobj; @@ -90,7 +90,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod scr_size = script_entity->buf_size; if (pos.offset >= scr_size) { - sciprintf("Trying to disassemble beyond end of script\n"); + warning("Trying to disassemble beyond end of script"); return pos; } @@ -98,13 +98,13 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod opcode = opsize >> 1; if (!debugState.isValid) { - sciprintf("Not in debug state\n"); + warning("Not in debug state"); return retval; } opsize &= 1; // byte if true, word if false - sciprintf("%04x:%04x: ", PRINT_REG(pos)); + printf("%04x:%04x: ", PRINT_REG(pos)); if (print_bytecode) { while (g_opcode_formats[opcode][i]) { @@ -140,36 +140,36 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod } if (pos.offset + bytecount > scr_size) { - sciprintf("Operation arguments extend beyond end of script\n"); + warning("Operation arguments extend beyond end of script"); return retval; } for (i = 0; i < bytecount; i++) - sciprintf("%02x ", scr[pos.offset + i]); + printf("%02x ", scr[pos.offset + i]); for (i = bytecount; i < 5; i++) - sciprintf(" "); + printf(" "); } if (print_bw_tag) - sciprintf("[%c] ", opsize ? 'B' : 'W'); - sciprintf("%s", s->_kernel->getOpcode(opcode).name.c_str()); + printf("[%c] ", opsize ? 'B' : 'W'); + printf("%s", s->_kernel->getOpcode(opcode).name.c_str()); i = 0; while (g_opcode_formats[opcode][i]) { switch (g_opcode_formats[opcode][i++]) { case Script_Invalid: - sciprintf("-Invalid operation-"); + warning("-Invalid operation-"); break; case Script_SByte: case Script_Byte: - sciprintf(" %02x", scr[retval.offset++]); + printf(" %02x", scr[retval.offset++]); break; case Script_Word: case Script_SWord: - sciprintf(" %04x", 0xffff & (scr[retval.offset] | (scr[retval.offset+1] << 8))); + printf(" %04x", 0xffff & (scr[retval.offset] | (scr[retval.offset+1] << 8))); retval.offset += 2; break; @@ -188,11 +188,11 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod } if (opcode == op_callk) - sciprintf(" %s[%x]", (param_value < s->_kernel->_kernelFuncs.size()) ? + printf(" %s[%x]", (param_value < s->_kernel->_kernelFuncs.size()) ? ((param_value < s->_kernel->getKernelNamesSize()) ? s->_kernel->getKernelName(param_value).c_str() : "[Unknown(postulated)]") : "", param_value); else - sciprintf(opsize ? " %02x" : " %04x", param_value); + printf(opsize ? " %02x" : " %04x", param_value); break; @@ -203,7 +203,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod param_value = 0xffff & (scr[retval.offset] | (scr[retval.offset+1] << 8)); retval.offset += 2; } - sciprintf(opsize ? " %02x" : " %04x", param_value); + printf(opsize ? " %02x" : " %04x", param_value); break; case Script_SRelative: @@ -213,7 +213,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod param_value = 0xffff & (scr[retval.offset] | (scr[retval.offset+1] << 8)); retval.offset += 2; } - sciprintf(opsize ? " %02x [%04x]" : " %04x [%04x]", param_value, (0xffff) & (retval.offset + param_value)); + printf(opsize ? " %02x [%04x]" : " %04x [%04x]", param_value, (0xffff) & (retval.offset + param_value)); break; case Script_End: @@ -221,7 +221,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod break; default: - sciprintf("Internal assertion failed in 'disassemble', %s, L%d\n", __FILE__, __LINE__); + error("Internal assertion failed in disassemble()"); } } @@ -232,11 +232,11 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod int prop_ofs = scr[pos.offset + 1]; int prop_id = propertyOffsetToId(s, prop_ofs, *debugState.p_objp); - sciprintf(" (%s)", selector_name(s, prop_id)); + printf(" (%s)", selector_name(s, prop_id)); } } - sciprintf("\n"); + printf("\n"); if (pos == *debugState.p_pc) { // Extra information if debugging the current opcode if (opcode == op_callk) { @@ -246,14 +246,14 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod if (!(s->_flags & GF_SCI0_OLD)) argc += (*debugState.p_restadjust); - sciprintf(" Kernel params: ("); + printf(" Kernel params: ("); for (int j = 0; j < argc; j++) { - sciprintf("%04x:%04x", PRINT_REG((*debugState.p_sp)[j - stackframe])); + printf("%04x:%04x", PRINT_REG((*debugState.p_sp)[j - stackframe])); if (j + 1 < argc) - sciprintf(", "); + printf(", "); } - sciprintf(")\n"); + printf(")\n"); } else if ((opcode == op_send) || (opcode == op_self)) { int restmod = *debugState.p_restadjust; int stackframe = (scr[pos.offset + 1] >> 1) + restmod; @@ -278,32 +278,32 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod if (!name) name = ""; - sciprintf(" %s::%s[", name, (selector > s->_kernel->getSelectorNamesSize()) ? "" : selector_name(s, selector)); + printf(" %s::%s[", name, (selector > s->_kernel->getSelectorNamesSize()) ? "" : selector_name(s, selector)); switch (lookup_selector(s, called_obj_addr, selector, 0, &fun_ref)) { case kSelectorMethod: - sciprintf("FUNCT"); + printf("FUNCT"); argc += restmod; restmod = 0; break; case kSelectorVariable: - sciprintf("VAR"); + printf("VAR"); break; case kSelectorNone: - sciprintf("INVALID"); + printf("INVALID"); break; } - sciprintf("]("); + printf("]("); while (argc--) { - sciprintf("%04x:%04x", PRINT_REG(sb[- stackframe + 2])); + printf("%04x:%04x", PRINT_REG(sb[- stackframe + 2])); if (argc) - sciprintf(", "); + printf(", "); stackframe--; } - sciprintf(")\n"); + printf(")\n"); stackframe -= 2; } // while (stackframe > 0) } // Send-like opcodes @@ -328,11 +328,11 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t * debugState.p_pp = pp; debugState.p_objp = objp; debugState.p_restadjust = restadjust; - sciprintf("%d: acc=%04x:%04x ", script_step_counter, PRINT_REG(s->r_acc)); + printf("%d: acc=%04x:%04x ", script_step_counter, PRINT_REG(s->r_acc)); debugState.isValid = true; disassemble(s, *pc, 0, 1); if (debugState.seeking == kDebugSeekGlobal) - sciprintf("Global %d (0x%x) = %04x:%04x\n", debugState.seekSpecial, + printf("Global %d (0x%x) = %04x:%04x\n", debugState.seekSpecial, debugState.seekSpecial, PRINT_REG(s->script_000->locals_block->_locals[debugState.seekSpecial])); debugState.isValid = old_debugstate; @@ -404,7 +404,7 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t * debugState.p_var_max = variables_nr; debugState.p_var_base = variables_base; - sciprintf("Step #%d\n", script_step_counter); + printf("Step #%d\n", script_step_counter); disassemble(s, *pc, 0, 1); } diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index 2227167673..d81768c9c8 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -121,7 +121,7 @@ Script *SegManager::allocateScript(EngineState *s, int script_nr, SegmentId *seg // allocate the MemObject mem = memObjAllocate(*seg_id, script_nr, MEM_OBJ_SCRIPT); if (!mem) { - sciprintf("%s, %d, Not enough memory, ", __FILE__, __LINE__); + error("allocateScript: Not enough memory"); return NULL; } @@ -154,10 +154,10 @@ void SegManager::setScriptSize(Script &scr, EngineState *s, int script_nr) { } if (scr.buf_size > 65535) { - sciprintf("Script and heap sizes combined exceed 64K.\n" + error("Script and heap sizes combined exceed 64K.\n" "This means a fundamental design bug was made in SCI\n" "regarding SCI1.1 games.\nPlease report this so it can be" - "fixed in the next major version!\n"); + "fixed in the next major version"); return; } } @@ -172,7 +172,7 @@ int SegManager::initialiseScript(Script &scr, EngineState *s, int script_nr) { dbgPrint("scr.buf ", scr.buf); if (!scr.buf) { scr.freeScript(); - sciprintf("SegManager: Not enough memory space for script size"); + warning("SegManager: Not enough memory space for script size"); scr.buf_size = 0; return 0; } @@ -235,7 +235,7 @@ int SegManager::deallocateScript(int script_nr) { MemObject *SegManager::memObjAllocate(SegmentId segid, int hash_id, MemObjectType type) { MemObject *mem = MemObject::createMemObject(type); if (!mem) { - sciprintf("SegManager: invalid mobj "); + warning("SegManager: invalid mobj"); return NULL; } @@ -313,7 +313,7 @@ int SegManager::relocateBlock(Common::Array &block, int block_location, S return 0; if (rel & 1) { - sciprintf("Error: Attempt to relocate odd variable #%d.5e (relative to %04x)\n", idx, block_location); + warning("Attempt to relocate odd variable #%d.5e (relative to %04x)\n", idx, block_location); return 0; } block[idx].segment = segment; // Perform relocation @@ -372,18 +372,17 @@ void SegManager::scriptRelocate(reg_t block) { } if (!done) { - sciprintf("While processing relocation block %04x:%04x:\n", PRINT_REG(block)); - sciprintf("Relocation failed for index %04x (%d/%d)\n", pos, i + 1, count); + printf("While processing relocation block %04x:%04x:\n", PRINT_REG(block)); + printf("Relocation failed for index %04x (%d/%d)\n", pos, i + 1, count); if (scr->locals_block) - sciprintf("- locals: %d at %04x\n", scr->locals_block->_locals.size(), scr->locals_offset); + printf("- locals: %d at %04x\n", scr->locals_block->_locals.size(), scr->locals_offset); else - sciprintf("- No locals\n"); + printf("- No locals\n"); for (k = 0; k < scr->_objects.size(); k++) - sciprintf("- obj#%d at %04x w/ %d vars\n", k, scr->_objects[k].pos.offset, scr->_objects[k]._variables.size()); -// SQ3 script 71 has broken relocation entries. -// Since this is mainstream, we can't break out as we used to do. - sciprintf("Trying to continue anyway...\n"); -// BREAKPOINT(); + printf("- obj#%d at %04x w/ %d vars\n", k, scr->_objects[k].pos.offset, scr->_objects[k]._variables.size()); + // SQ3 script 71 has broken relocation entries. + // Since this is mainstream, we can't break out as we used to do. + printf("Trying to continue anyway...\n"); } } } @@ -413,15 +412,15 @@ void SegManager::heapRelocate(reg_t block) { } if (!done) { - sciprintf("While processing relocation block %04x:%04x:\n", PRINT_REG(block)); - sciprintf("Relocation failed for index %04x (%d/%d)\n", pos, i + 1, count); + printf("While processing relocation block %04x:%04x:\n", PRINT_REG(block)); + printf("Relocation failed for index %04x (%d/%d)\n", pos, i + 1, count); if (scr->locals_block) - sciprintf("- locals: %d at %04x\n", scr->locals_block->_locals.size(), scr->locals_offset); + printf("- locals: %d at %04x\n", scr->locals_block->_locals.size(), scr->locals_offset); else - sciprintf("- No locals\n"); + printf("- No locals\n"); for (k = 0; k < scr->_objects.size(); k++) - sciprintf("- obj#%d at %04x w/ %d vars\n", k, scr->_objects[k].pos.offset, scr->_objects[k]._variables.size()); - sciprintf("Triggering breakpoint...\n"); + printf("- obj#%d at %04x w/ %d vars\n", k, scr->_objects[k].pos.offset, scr->_objects[k]._variables.size()); + printf("Triggering breakpoint...\n"); error("Breakpoint in %s, line %d", __FILE__, __LINE__); } } @@ -596,7 +595,7 @@ void SegManager::scriptInitialiseLocals(reg_t location) { scr->locals_offset = location.offset; if (!(location.offset + count * 2 + 1 < scr->buf_size)) { - sciprintf("Locals extend beyond end of script: offset %04x, count %x vs size %x\n", location.offset, count, (uint)scr->buf_size); + warning("Locals extend beyond end of script: offset %04x, count %x vs size %x", location.offset, count, (uint)scr->buf_size); count = (scr->buf_size - location.offset) >> 1; } @@ -719,7 +718,7 @@ SegmentId SegManager::allocateStringFrags() { uint16 SegManager::validateExportFunc(int pubfunct, SegmentId seg) { Script *scr = getScript(seg); if (scr->exports_nr <= pubfunct) { - sciprintf("pubfunct is invalid"); + warning("validateExportFunc(): pubfunct is invalid"); return 0; } @@ -735,7 +734,7 @@ void SegManager::free_hunk_entry(reg_t addr) { HunkTable *ht = (HunkTable *)GET_SEGMENT(*this, addr.segment, MEM_OBJ_HUNK); if (!ht) { - sciprintf("Attempt to free Hunk from address %04x:%04x: Invalid segment type\n", PRINT_REG(addr)); + warning("Attempt to free Hunk from address %04x:%04x: Invalid segment type", PRINT_REG(addr)); return; } diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index a31af68323..09ed541d17 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -27,6 +27,7 @@ #include "common/stack.h" #include "sci/sci.h" +#include "sci/console.h" #include "sci/debug.h" // for g_debug_weak_validations #include "sci/resource.h" #include "sci/engine/state.h" @@ -135,10 +136,10 @@ static int validate_variable(reg_t *r, reg_t *stack_base, int type, int max, int if (type == VAR_PARAM || type == VAR_TEMP) { int total_offset = r - stack_base; if (total_offset < 0 || total_offset >= VM_STACK_SIZE) { - sciprintf("[VM] Access would be outside even of the stack (%d); access denied\n", total_offset); + warning("[VM] Access would be outside even of the stack (%d); access denied", total_offset); return 1; } else { - sciprintf("[VM] Access within stack boundaries; access granted.\n"); + debugC(2, kDebugLevelVM, "[VM] Access within stack boundaries; access granted.\n"); return 0; } } @@ -255,7 +256,8 @@ ExecStack *execute_method(EngineState *s, uint16 script, uint16 pubfunct, StackP bp = s->bp_list; while (bp) { if (bp->type == BREAK_EXPORT && bp->data.address == bpaddress) { - sciprintf("Break on script %d, export %d\n", script, pubfunct); + Console *con = ((SciEngine *)g_engine)->getSciDebugger(); + con->DebugPrintf("Break on script %d, export %d\n", script, pubfunct); breakpointFlag = true; break; } @@ -319,7 +321,8 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt cmplen = 256; if (bp->type == BREAK_SELECTOR && !strncmp(bp->data.name, method_name, cmplen)) { - sciprintf("Break on %s (in [%04x:%04x])\n", method_name, PRINT_REG(send_obj)); + Console *con = ((SciEngine *)g_engine)->getSciDebugger(); + con->DebugPrintf("Break on %s (in [%04x:%04x])\n", method_name, PRINT_REG(send_obj)); print_send_action = 1; breakpointFlag = true; break; @@ -329,7 +332,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt } #ifdef VM_DEBUG_SEND - sciprintf("Send to %04x:%04x, selector %04x (%s):", PRINT_REG(send_obj), selector, s->_selectorNames[selector].c_str()); + printf("Send to %04x:%04x, selector %04x (%s):", PRINT_REG(send_obj), selector, s->_selectorNames[selector].c_str()); #endif // VM_DEBUG_SEND ObjVarRef varp; @@ -349,17 +352,16 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt case kSelectorVariable: #ifdef VM_DEBUG_SEND - sciprintf("Varselector: "); if (argc) - sciprintf("Write %04x:%04x\n", PRINT_REG(argp[1])); + printf("Varselector: Write %04x:%04x\n", PRINT_REG(argp[1])); else - sciprintf("Read\n"); + printf("Varselector: Read\n"); #endif // VM_DEBUG_SEND switch (argc) { case 0: // Read selector if (print_send_action) { - sciprintf("[read selector]\n"); + printf("[read selector]\n"); print_send_action = 0; } // fallthrough @@ -372,7 +374,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt reg_t oldReg = *varp.getPointer(s); reg_t newReg = argp[1]; - sciprintf("[write to selector: change %04x:%04x to %04x:%04x]\n", PRINT_REG(oldReg), PRINT_REG(newReg)); + printf("[write to selector: change %04x:%04x to %04x:%04x]\n", PRINT_REG(oldReg), PRINT_REG(newReg)); print_send_action = 0; } CallsStruct call; @@ -386,9 +388,8 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt break; #ifdef STRICT_SEND default: - sciprintf("Send error: Variable selector %04x in %04x:%04x called with %04x params\n", selector, PRINT_REG(send_obj), argc); - script_debug_flag = 1; // Enter debug mode debugState.seeking = debugState.runningStep = 0; + error("Send error: Variable selector %04x in %04x:%04x called with %04x params", selector, PRINT_REG(send_obj), argc); #endif } break; @@ -396,16 +397,16 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt case kSelectorMethod: #ifdef VM_DEBUG_SEND - sciprintf("Funcselector("); + printf("Funcselector("); for (int i = 0; i < argc; i++) { - sciprintf(PREG, PRINT_REG(argp[i+1])); + printf(PREG, PRINT_REG(argp[i+1])); if (i + 1 < argc) - sciprintf(", "); + printf(", "); } - sciprintf(") at %04x:%04x\n", PRINT_REG(funcp)); + printf(") at %04x:%04x\n", PRINT_REG(funcp)); #endif // VM_DEBUG_SEND if (print_send_action) { - sciprintf("[invoke selector]\n"); + printf("[invoke selector]\n"); print_send_action = 0; } @@ -461,7 +462,7 @@ ExecStack *add_exec_stack_entry(EngineState *s, reg_t pc, StackPtr sp, reg_t obj // Returns new TOS element for the execution stack // locals_segment may be -1 if derived from the called object - //sciprintf("Exec stack: [%d/%d], origin %d, at %p\n", s->execution_stack_pos, s->_executionStack.size(), origin, s->execution_stack); + //printf("Exec stack: [%d/%d], origin %d, at %p\n", s->execution_stack_pos, s->_executionStack.size(), origin, s->execution_stack); ExecStack xstack; @@ -506,7 +507,7 @@ static reg_t pointer_add(EngineState *s, reg_t base, int offset) { MemObject *mobj = GET_SEGMENT_ANY(*s->seg_manager, base.segment); if (!mobj) { - error("[VM] Error: Attempt to add %d to invalid pointer %04x:%04x!", offset, PRINT_REG(base)); + error("[VM] Error: Attempt to add %d to invalid pointer %04x:%04x", offset, PRINT_REG(base)); return NULL_REG; } @@ -524,7 +525,7 @@ static reg_t pointer_add(EngineState *s, reg_t base, int offset) { break; default: - sciprintf("[VM] Error: Attempt to add %d to pointer %04x:%04x: Pointer arithmetics of this type unsupported!", offset, PRINT_REG(base)); + error("[VM] Error: Attempt to add %d to pointer %04x:%04x: Pointer arithmetics of this type unsupported", offset, PRINT_REG(base)); return NULL_REG; } @@ -1585,18 +1586,18 @@ int script_instantiate_common(EngineState *s, int script_nr, Resource **script, *heap = s->resmgr->findResource(ResourceId(kResourceTypeHeap, script_nr), 0); if (!*script || (s->_version >= SCI_VERSION_1_1 && !heap)) { - sciprintf("Script 0x%x requested but not found\n", script_nr); + warning("Script 0x%x requested but not found", script_nr); if (s->_version >= SCI_VERSION_1_1) { if (*heap) - sciprintf("Inconsistency: heap resource WAS found\n"); + warning("Inconsistency: heap resource WAS found"); else if (*script) - sciprintf("Inconsistency: script resource WAS found\n"); + warning("Inconsistency: script resource WAS found"); } return 0; } if (NULL == s) { - sciprintf("vm.c: script_instantiate(): NULL passed for \"s\"\n"); + warning("script_instantiate_common(): script_instantiate(): NULL passed for \"s\""); return 0; } @@ -1897,7 +1898,7 @@ void script_uninstantiate(EngineState *s, int script_nr) { if (s->_version < SCI_VERSION_1_1) script_uninstantiate_sci0(s, script_nr, reg.segment); else - sciprintf("FIXME: Add proper script uninstantiation for SCI 1.1\n"); + warning("FIXME: Add proper script uninstantiation for SCI 1.1"); if (scr->getLockers()) return; // if xxx.lockers > 0 @@ -1948,7 +1949,7 @@ static EngineState *_game_run(EngineState *&s, int restoring) { s = successor; if (script_abort_flag == 2) { - sciprintf("Restarting with replay()\n"); + debugC(2, kDebugLevelVM, "Restarting with replay()\n"); s->_executionStack.clear(); // Restart with replay _init_stack_base_with_selector(s, s->_kernel->_selectorMap.replay); @@ -1971,19 +1972,19 @@ int printObject(EngineState *s, reg_t pos); int game_run(EngineState **_s) { EngineState *s = *_s; - sciprintf(" Calling %s::play()\n", s->_gameName.c_str()); + debugC(2, kDebugLevelVM, "Calling %s::play()\n", s->_gameName.c_str()); _init_stack_base_with_selector(s, s->_kernel->_selectorMap.play); // Call the play selector // Now: Register the first element on the execution stack- if (!send_selector(s, s->game_obj, s->game_obj, s->stack_base, 2, s->stack_base)) { printObject(s, s->game_obj); - sciprintf("Failed to run the game! Aborting...\n"); + warning("Failed to run the game! Aborting..."); return 1; } // and ENGAGE! _game_run(*_s, 0); - sciprintf(" Game::play() finished.\n"); + debugC(2, kDebugLevelVM, "Game::play() finished.\n"); return 0; } diff --git a/engines/sci/gfx/font.cpp b/engines/sci/gfx/font.cpp index 0f1a19f1c0..9265cba040 100644 --- a/engines/sci/gfx/font.cpp +++ b/engines/sci/gfx/font.cpp @@ -186,7 +186,7 @@ gfx_pixmap_t *gfxr_draw_font(gfx_bitmap_font_t *font, const char *stext, int cha int ch = (int) text[i]; if (ch >= font->chars_nr) { - GFXERROR("Invalid character 0x%02x encountered!\n", text[i]); + error("Invalid character 0x%02x encountered", text[i]); return NULL; } diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp index c665eef3b8..0b1387074c 100644 --- a/engines/sci/gfx/gfx_driver.cpp +++ b/engines/sci/gfx/gfx_driver.cpp @@ -205,7 +205,7 @@ int GfxDriver::update(rect_t src, Common::Point dest, gfx_buffer_t buffer) { g_system->updateScreen(); break; default: - GFXERROR("Invalid buffer %d in update!\n", buffer); + error("Invalid buffer %d in update", buffer); return GFX_ERROR; } diff --git a/engines/sci/gfx/gfx_gui.cpp b/engines/sci/gfx/gfx_gui.cpp index fb05c0fe29..218bf1523e 100644 --- a/engines/sci/gfx/gfx_gui.cpp +++ b/engines/sci/gfx/gfx_gui.cpp @@ -81,14 +81,14 @@ void sciw_set_status_bar(EngineState *s, GfxPort *status_bar, const Common::Stri gfx_color_t black = s->ega_colors[0]; if (!status_bar->_visual) { - GFXERROR("Attempt to change title bar without visual!\n"); + error("Attempt to change title bar without visual"); return; } state = status_bar->_visual->_gfxState; if (!state) { - GFXERROR("Attempt to change title bar with stateless visual!\n"); + error("Attempt to change title bar with stateless visual"); return; } @@ -121,7 +121,8 @@ void sciw_set_status_bar(EngineState *s, GfxPort *status_bar, const Common::Stri static void sciw_make_window_fit(rect_t *rect, GfxPort *parent) { // This window is meant to cover the whole screen, so we allow it to go through. - if (rect->width == 319 && rect->height == 189) return; + if (rect->width == 319 && rect->height == 189) + return; if (rect->x + rect->width > parent->_bounds.x + parent->_bounds.width) rect->x -= (rect->x + rect->width) - (parent->_bounds.x + parent->_bounds.width) + 2; @@ -220,7 +221,7 @@ GfxPort *sciw_new_window(EngineState *s, if (!(flags & kWindowNoDropShadow)) { if (gfxop_set_color(state, &black, 0, 0, 0, 0x80, bgcolor.priority, -1)) { - GFXERROR("Could not get black/semitrans color entry!\n"); + error("Could not get black/semitrans color entry"); return NULL; } @@ -236,7 +237,7 @@ GfxPort *sciw_new_window(EngineState *s, // Draw frame if (gfxop_set_color(state, &black, 0, 0, 0, 0, bgcolor.priority, -1)) { - GFXERROR("Could not get black color entry!\n"); + error("Could not get black color entry"); return NULL; } @@ -418,7 +419,7 @@ GfxList *sciw_new_icon_control(GfxPort *port, reg_t ID, rect_t zone, int view, i gfxw_set_id(list, ID.segment, ID.offset); if (!port->_visual) { - GFXERROR("Attempting to create icon control for virtual port!\n"); + error("Attempting to create icon control for virtual port"); return NULL; } @@ -429,7 +430,7 @@ GfxList *sciw_new_icon_control(GfxPort *port, reg_t ID, rect_t zone, int view, i ALIGN_LEFT, ALIGN_TOP, GFXW_VIEW_FLAG_DONT_MODIFY_OFFSET); if (!icon) { - GFXERROR("Attempt to create icon control with cel %d/%d/%d (invalid)\n", view, loop, cel); + error("Attempt to create icon control with cel %d/%d/%d (invalid)", view, loop, cel); return NULL; } @@ -461,7 +462,7 @@ GfxList *sciw_new_list_control(GfxPort *port, reg_t ID, rect_t zone, int font_nr columns = (zone.height - 20); if (font_height <= 0) { - GFXERROR("Attempt to create list control with invalid font %d\n", font_nr); + error("Attempt to create list control with invalid font %d", font_nr); delete list; return NULL; } @@ -565,7 +566,7 @@ GfxPort *sciw_new_menu(EngineState *s, GfxPort *status_bar, Menubar *menubar, in return NULL; if (selection >= (int)menubar->_menus.size()) { - GFXERROR("Attempt to make menu #%d of %d\n", selection, menubar->_menus.size()); + error("Attempt to make menu #%d of %d", selection, menubar->_menus.size()); return NULL; } diff --git a/engines/sci/gfx/gfx_pixmap_scale.cpp b/engines/sci/gfx/gfx_pixmap_scale.cpp index 52c7b12396..034efafe8d 100644 --- a/engines/sci/gfx/gfx_pixmap_scale.cpp +++ b/engines/sci/gfx/gfx_pixmap_scale.cpp @@ -517,8 +517,7 @@ static void _gfx_xlate_pixmap_unfiltered(gfx_mode_t *mode, gfx_pixmap_t *pxm, in break; default: - GFXERROR("Invalid mode->bytespp=%d\n", mode->bytespp); - + error("Invalid mode->bytespp=%d", mode->bytespp); } if (pxm->flags & GFX_PIXMAP_FLAG_SCALED_INDEX) { @@ -562,8 +561,7 @@ static void _gfx_xlate_pixmap_linear(gfx_mode_t *mode, gfx_pixmap_t *pxm, int sc break; default: - GFXERROR("Invalid mode->bytespp=%d\n", mode->bytespp); - + error("Invalid mode->bytespp=%d", mode->bytespp); } } @@ -599,7 +597,7 @@ static void _gfx_xlate_pixmap_trilinear(gfx_mode_t *mode, gfx_pixmap_t *pxm, int break; default: - GFXERROR("Invalid mode->bytespp=%d\n", mode->bytespp); + error("Invalid mode->bytespp=%d", mode->bytespp); } } @@ -638,7 +636,7 @@ void gfx_xlate_pixmap(gfx_pixmap_t *pxm, gfx_mode_t *mode, gfx_xlate_filter_t fi break; default: - GFXERROR("Attempt to filter pixmap %04x in invalid mode #%d\n", pxm->ID, filter); + error("Attempt to filter pixmap %04x in invalid mode #%d", pxm->ID, filter); if (!was_allocated) { if (!mode->alpha_mask && pxm->colors_nr() < GFX_PIC_COLORS) diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index 1289997721..bece7b234d 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -165,7 +165,7 @@ int GfxResManager::getOptionsHash(gfx_resource_type_t type) { case GFX_RESOURCE_TYPES_NR: default: - GFXERROR("Invalid resource type: %d\n", type); + error("Invalid resource type: %d", type); return -1; } } @@ -349,7 +349,7 @@ gfxr_pic_t *GfxResManager::getPic(int num, int maps, int flags, int default_pale #endif if (!pic) { - GFXERROR("Failed to allocate scaled pic!\n"); + error("Failed to allocate scaled pic"); return NULL; } @@ -358,7 +358,7 @@ gfxr_pic_t *GfxResManager::getPic(int num, int maps, int flags, int default_pale if (need_unscaled) { unscaled_pic = gfxr_init_pic(&mode_1x1_color_index, GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _version >= SCI_VERSION_01_VGA); if (!unscaled_pic) { - GFXERROR("Failed to allocate unscaled pic!\n"); + error("Failed to allocate unscaled pic"); return NULL; } gfxr_clear_pic0(pic, SCI_TITLEBAR_SIZE); diff --git a/engines/sci/gfx/gfx_state_internal.h b/engines/sci/gfx/gfx_state_internal.h index 3f00b5213c..3beb0ea067 100644 --- a/engines/sci/gfx/gfx_state_internal.h +++ b/engines/sci/gfx/gfx_state_internal.h @@ -132,7 +132,7 @@ public: } /** - * Prints a string representation of the widget with sciprintf. + * Prints a string representation of the widget with printf. * * Will recursively print all of the widget's contents if the widget * contains further sub-widgets diff --git a/engines/sci/gfx/gfx_support.cpp b/engines/sci/gfx/gfx_support.cpp index 3a32752b9a..314e955367 100644 --- a/engines/sci/gfx/gfx_support.cpp +++ b/engines/sci/gfx/gfx_support.cpp @@ -94,7 +94,7 @@ static void gfx_draw_line_buffer(byte *buffer, int linewidth, int pixelwidth, return; default: - GFXERROR("pixelwidth=%d not supported!\n", pixelwidth); + error("pixelwidth=%d not supported", pixelwidth); return; } @@ -292,7 +292,7 @@ int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rect alpha_mask = mode->alpha_mask; if (!alpha_mask && pxm->alpha_map) { - GFXERROR("Invalid alpha mode: both pxm->alpha_map and alpha_mask are white!\n"); + error("Invalid alpha mode: both pxm->alpha_map and alpha_mask are white"); return GFX_ERROR; } @@ -335,7 +335,7 @@ int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rect xl, yl, alpha, bytes_per_alpha_line, bytes_per_alpha_pixel, alpha_mask, alpha_min, 0, 0, 0, 0); else { - GFXERROR("Invalid mode->bytespp: %d\n", mode->bytespp); + error("Invalid mode->bytespp: %d", mode->bytespp); return GFX_ERROR; } } else { // priority @@ -344,7 +344,7 @@ int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rect xl, yl, alpha, bytes_per_alpha_line, bytes_per_alpha_pixel, alpha_mask, alpha_min, priority_pos, priority_line_width, priority_skip, priority); else { - GFXERROR("Invalid mode->bytespp: %d\n", mode->bytespp); + error("Invalid mode->bytespp: %d", mode->bytespp); return GFX_ERROR; } } diff --git a/engines/sci/gfx/gfx_system.h b/engines/sci/gfx/gfx_system.h index 6b7724a6bd..855f9b196e 100644 --- a/engines/sci/gfx/gfx_system.h +++ b/engines/sci/gfx/gfx_system.h @@ -35,9 +35,6 @@ namespace Sci { #define GFX_DEBUG -/* General output macros */ -#define GFXERROR sciprintf("GFX Error: %s, L%d:", __FILE__, __LINE__); error - /***********************/ /*** Data structures ***/ /***********************/ diff --git a/engines/sci/gfx/gfx_tools.cpp b/engines/sci/gfx/gfx_tools.cpp index e89fb1572a..e3d35ecb14 100644 --- a/engines/sci/gfx/gfx_tools.cpp +++ b/engines/sci/gfx/gfx_tools.cpp @@ -245,7 +245,7 @@ gfx_pixmap_t *gfx_pixmap_scale_index_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode old_data = pixmap->index_data; if (!old_data) { - GFXERROR("Attempt to scale index data without index data!\n"); + error("Attempt to scale index data without index data!\n"); return pixmap; } diff --git a/engines/sci/gfx/gfx_widgets.cpp b/engines/sci/gfx/gfx_widgets.cpp index 2207309f48..12cec0ada6 100644 --- a/engines/sci/gfx/gfx_widgets.cpp +++ b/engines/sci/gfx/gfx_widgets.cpp @@ -81,7 +81,7 @@ static void _gfxw_debug_remove_widget(GfxWidget *widget) { static void indent(int indentation) { for (int i = 0; i < indentation; i++) - sciprintf(" "); + printf(" "); } void GfxWidget::printIntern(int indentation) const { @@ -92,35 +92,35 @@ void GfxWidget::printIntern(int indentation) const { if (_magic == GFXW_MAGIC_VALID) { if (_visual) - sciprintf("v "); + printf("v "); else - sciprintf("NoVis "); + printf("NoVis "); } else if (_magic == GFXW_MAGIC_INVALID) - sciprintf("INVALID "); + printf("INVALID "); - sciprintf("S%08x", _serial); + printf("S%08x", _serial); if (_ID != GFXW_NO_ID) { - sciprintf("#%x", _ID); + printf("#%x", _ID); if (_subID != GFXW_NO_ID) - sciprintf(":%x ", _subID); + printf(":%x ", _subID); else - sciprintf(" "); + printf(" "); } - sciprintf("[(%d,%d)(%dx%d)]", _bounds.x, _bounds.y, _bounds.width, _bounds.height); + printf("[(%d,%d)(%dx%d)]", _bounds.x, _bounds.y, _bounds.width, _bounds.height); for (i = 0; i < strlen(flags_list); i++) if (_flags & (1 << i)) - sciprintf("%c", flags_list[i]); + printf("%c", flags_list[i]); - sciprintf(" "); + printf(" "); } void GfxWidget::print(int indentation) const { printIntern(indentation); - sciprintf("", _type); + printf("", _type); } GfxWidget::GfxWidget(gfxw_widget_type_t type_) { @@ -149,13 +149,13 @@ GfxWidget::GfxWidget(gfxw_widget_type_t type_) { static int verify_widget(GfxWidget *widget) { if (!widget) { - GFXERROR("Attempt to use NULL widget\n"); + warning("Attempt to use NULL widget"); return 1; } else if (widget->_magic != GFXW_MAGIC_VALID) { if (widget->_magic == GFXW_MAGIC_INVALID) { - GFXERROR("Attempt to use invalidated widget\n"); + warning("Attempt to use invalidated widget"); } else { - GFXERROR("Attempt to use non-widget\n"); + warning("Attempt to use non-widget"); } return 1; } @@ -163,13 +163,13 @@ static int verify_widget(GfxWidget *widget) { } #define VERIFY_WIDGET(w) \ - if (verify_widget((GfxWidget *)(w))) { GFXERROR("Error occured while validating widget\n"); } + if (verify_widget((GfxWidget *)(w))) { error("Error occured while validating widget"); } #define GFX_ASSERT(_x) \ { \ int retval = (_x); \ if (retval == GFX_ERROR) { \ - GFXERROR("Error occured while drawing widget!\n"); \ + warning("Error occured while drawing widget"); \ return 1; \ } else if (retval == GFX_FATAL) { \ error("Fatal error occured while drawing widget!\nGraphics state invalid; aborting program..."); \ @@ -183,23 +183,23 @@ static int verify_widget(GfxWidget *widget) { // Assertion for drawing #define DRAW_ASSERT(widget, exp_type) \ if (!(widget)) { \ - sciprintf("L%d: NULL widget", __LINE__); \ + printf("L%d: NULL widget", __LINE__); \ return 1; \ } \ if ((widget)->_type != (exp_type)) { \ - sciprintf("L%d: Error in widget: Expected type " # exp_type "(%d) but got %d\n", __LINE__, exp_type, (widget)->_type); \ - sciprintf("Erroneous widget: "); \ + printf("L%d: Error in widget: Expected type " # exp_type "(%d) but got %d\n", __LINE__, exp_type, (widget)->_type); \ + printf("Erroneous widget: "); \ widget->print(4); \ - sciprintf("\n"); \ + printf("\n"); \ return 1; \ } \ if (!(widget->_flags & GFXW_FLAG_VISIBLE)) \ return 0; \ if (!(widget->_type == GFXW_VISUAL || widget->_visual)) { \ - sciprintf("L%d: Error while drawing widget: Widget has no visual\n", __LINE__); \ - sciprintf("Erroneous widget: "); \ + printf("L%d: Error while drawing widget: Widget has no visual\n", __LINE__); \ + printf("Erroneous widget: "); \ widget->print(1); \ - sciprintf("\n"); \ + printf("\n"); \ return 1; \ } @@ -253,8 +253,7 @@ void gfxw_remove_widget_from_container(GfxContainer *container, GfxWidget *widge GfxWidget **seekerp; if (!container) { - GFXERROR("Attempt to remove widget from NULL container!\n"); - error("gfxw_remove_widget_from_container() failed. Breakpoint in %s, line %d", __FILE__, __LINE__); + error("Attempt to remove widget from NULL container!\n"); } seekerp = &(container->_contents); @@ -271,10 +270,10 @@ void gfxw_remove_widget_from_container(GfxContainer *container, GfxWidget *widge seekerp = &((*seekerp)->_next); if (!*seekerp) { - GFXERROR("Internal error: Attempt to remove widget from container it was not contained in!\n"); - sciprintf("Widget:"); + printf("Internal error: Attempt to remove widget from container it was not contained in!\n"); + printf("Widget:"); widget->print(1); - sciprintf("Container:"); + printf("Container:"); widget->print(1); error("gfxw_remove_widget_from_container() failed. Breakpoint in %s, line %d", __FILE__, __LINE__); return; @@ -341,7 +340,7 @@ int GfxBox::draw(const Common::Point &pos) { void GfxBox::print(int indentation) const { printIntern(indentation); - sciprintf("BOX"); + printf("BOX"); } static int _gfxwop_box_superarea_of(GfxWidget *widget, GfxWidget *other) { @@ -472,7 +471,7 @@ int GfxRect::draw(const Common::Point &pos) { void GfxRect::print(int indentation) const { printIntern(indentation); - sciprintf("RECT"); + printf("RECT"); } void _gfxw_set_ops_RECT(GfxWidget *prim) { @@ -518,7 +517,7 @@ int GfxLine::draw(const Common::Point &pos) { void GfxLine::print(int indentation) const { printIntern(indentation); -// sciprintf("LINE"); +// printf("LINE"); } void _gfxw_set_ops_LINE(GfxWidget *prim) { @@ -598,13 +597,13 @@ void GfxView::print(int indentation) const { printIntern(indentation); if (_type == GFXW_STATIC_VIEW) - sciprintf("STATICVIEW"); + printf("STATICVIEW"); else if (_type == GFXW_VIEW) - sciprintf("VIEW"); + printf("VIEW"); else error("GfxView::print: Invalid type %d", _type); - sciprintf("(%d/%d/%d)@(%d,%d)[p:%d,c:%d]", _view, _loop, _cel, _pos.x, _pos.y, + printf("(%d/%d/%d)@(%d,%d)[p:%d,c:%d]", _view, _loop, _cel, _pos.x, _pos.y, (_color.mask & GFX_MASK_PRIORITY) ? _color.priority : -1, (_color.mask & GFX_MASK_CONTROL) ? _color.control : -1); } @@ -675,13 +674,13 @@ int GfxDynView::draw(const Common::Point &pos) { printIntern(indentation); if (_type == GFXW_DYN_VIEW) - sciprintf("DYNVIEW"); + printf("DYNVIEW"); else if (_type == GFXW_PIC_VIEW) - sciprintf("PICVIEW"); + printf("PICVIEW"); else error("GfxDynView::print: Invalid type %d", _type); - sciprintf(" SORT=%d z=%d seq=%d (%d/%d/%d)@(%d,%d)[p:%d,c:%d]; sig[%04x@%04X:%04X[%d]]", force_precedence, _z, + printf(" SORT=%d z=%d seq=%d (%d/%d/%d)@(%d,%d)[p:%d,c:%d]; sig[%04x@%04X:%04X[%d]]", force_precedence, _z, sequence, _view, _loop, _cel, _pos.x, _pos.y, (_color.mask & GFX_MASK_PRIORITY) ? _color.priority : -1, (_color.mask & GFX_MASK_CONTROL) ? _color.control : -1, signal, signalp.obj.segment, signalp.obj.offset, signalp.varindex); @@ -815,8 +814,7 @@ GfxText::~GfxText() { if (_textHandle) { GfxState *state = _visual ? _visual->_gfxState : NULL; if (!state) { - GFXERROR("Attempt to free text without supplying mode to free it from!\n"); - error("GfxText destructor failed. Breakpoint in %s, line %d", __FILE__, __LINE__); + error("Attempt to free text without supplying mode to free it from!\n"); } else { gfxop_free_text(state, _textHandle); _textHandle = NULL; @@ -838,7 +836,7 @@ int GfxText::draw(const Common::Point &pos) { void GfxText::print(int indentation) const { printIntern(indentation); - sciprintf("TEXT:'%s'", _text.c_str()); + printf("TEXT:'%s'", _text.c_str()); } static int _gfxwop_text_equals(GfxWidget *widget, GfxWidget *other) { @@ -964,11 +962,11 @@ static int _w_gfxwop_container_print_contents(const char *name, GfxWidget *widge indent(indentation); - sciprintf("--%s:\n", name); + printf("--%s:\n", name); while (seeker) { seeker->print(indentation + 1); - sciprintf("\n"); + printf("\n"); seeker = seeker->_next; } @@ -976,14 +974,14 @@ static int _w_gfxwop_container_print_contents(const char *name, GfxWidget *widge } void GfxContainer::print(int indentation) const { - sciprintf(" viszone=((%d,%d),(%dx%d))\n", zone.x, zone.y, zone.width, zone.height); + printf(" viszone=((%d,%d),(%dx%d))\n", zone.x, zone.y, zone.width, zone.height); indent(indentation); - sciprintf("--dirty:\n"); + printf("--dirty:\n"); for (DirtyRectList::const_iterator dirty = _dirtyRects.begin(); dirty != _dirtyRects.end(); ++dirty) { indent(indentation + 1); - sciprintf("dirty(%d,%d, (%dx%d))\n", dirty->x, dirty->y, dirty->width, dirty->height); + printf("dirty(%d,%d, (%dx%d))\n", dirty->x, dirty->y, dirty->width, dirty->height); } _w_gfxwop_container_print_contents("contents", _contents, indentation); @@ -1155,11 +1153,11 @@ static void _gfxw_dirtify_container(GfxContainer *container, GfxWidget *widget) static int _parentize_widget(GfxContainer *container, GfxWidget *widget) { if (widget->_parent) { - GFXERROR("_gfxwop_container_add(): Attempt to give second parent node to widget!\nWidget:"); + printf("_parentize_widget(): Attempt to give second parent node to widget!\nWidget:"); widget->print(3); - sciprintf("\nContainer:"); + printf("\nContainer:"); container->print(3); - + error("Error in _parentize_widget()"); return 1; } @@ -1253,9 +1251,9 @@ void GfxList::print(int indentation) const { printIntern(indentation); if (_type == GFXW_LIST) - sciprintf("LIST"); + printf("LIST"); else if (_type == GFXW_SORTED_LIST) - sciprintf("SORTED_LIST"); + printf("SORTED_LIST"); else error("GfxList::print: Invalid type %d", _type); @@ -1272,7 +1270,7 @@ static int _gfxwop_list_equals(GfxWidget *widget, GfxWidget *other) { if (!GFXW_IS_LIST(widget)) { warning("[GFX] _gfxwop_list_equals(): Method called on non-list"); widget->print(0); - sciprintf("\n"); + printf("\n"); return 0; } @@ -1316,11 +1314,11 @@ int _gfxwop_ordered_add(GfxContainer *container, GfxWidget *widget, int compare_ GfxWidget **seekerp = &(container->_contents); if (widget->_next) { - GFXERROR("_gfxwop_sorted_list_add(): Attempt to add widget to two lists!\nWidget:"); + printf("_gfxwop_ordered_add(): Attempt to add widget to two lists!\nWidget:"); widget->print(3); - sciprintf("\nList:"); + printf("\nList:"); container->print(3); - error("Breakpoint in %s, line %d", __FILE__, __LINE__); + error("Error in _gfxwop_ordered_add()"); } if (_gfxw_container_id_equals(container, widget)) @@ -1388,7 +1386,7 @@ int GfxVisual::draw(const Common::Point &pos) { int err = gfxop_clear_box(_gfxState, *dirty); if (err) { - GFXERROR("Error while clearing dirty rect (%d,%d,(%dx%d))\n", dirty->x, + error("Error while clearing dirty rect (%d,%d,(%dx%d))", dirty->x, dirty->y, dirty->width, dirty->height); if (err == GFX_FATAL) return err; @@ -1405,15 +1403,15 @@ int GfxVisual::draw(const Common::Point &pos) { void GfxVisual::print(int indentation) const { printIntern(indentation); - sciprintf("VISUAL; ports={"); + printf("VISUAL; ports={"); for (uint i = 0; i < _portRefs.size(); i++) { if (_portRefs[i]) { if (i != 0) - sciprintf(","); - sciprintf("%d", i); + printf(","); + printf("%d", i); } } - sciprintf("}\n"); + printf("}\n"); GfxContainer::print(indentation); } @@ -1519,10 +1517,10 @@ GfxPort::~GfxPort() { void GfxPort::print(int indentation) const { printIntern(indentation); - sciprintf("PORT"); - sciprintf(" font=%d drawpos=(%d,%d)", _font, draw_pos.x, draw_pos.y); + printf("PORT"); + printf(" font=%d drawpos=(%d,%d)", _font, draw_pos.x, draw_pos.y); if (gray_text) - sciprintf(" (gray)"); + printf(" (gray)"); GfxContainer::print(indentation); _w_gfxwop_container_print_contents("decorations", _decorations, indentation); diff --git a/engines/sci/gfx/menubar.cpp b/engines/sci/gfx/menubar.cpp index 9d3ed6a4a5..a5a43a7f00 100644 --- a/engines/sci/gfx/menubar.cpp +++ b/engines/sci/gfx/menubar.cpp @@ -334,7 +334,7 @@ int Menubar::setAttribute(EngineState *s, int menu_nr, int item_nr, int attribut break; default: - sciprintf("Attempt to set invalid attribute of menu %d, item %d: 0x%04x\n", menu_nr, item_nr, attribute); + error("Attempt to set invalid attribute of menu %d, item %d: 0x%04x", menu_nr, item_nr, attribute); return 1; } @@ -367,7 +367,7 @@ reg_t Menubar::getAttribute(int menu_nr, int item_nr, int attribute) const { return make_reg(0, item._tag); default: - sciprintf("Attempt to read invalid attribute from menu %d, item %d: 0x%04x\n", menu_nr, item_nr, attribute); + warning("Attempt to read invalid attribute from menu %d, item %d: 0x%04x", menu_nr, item_nr, attribute); return make_reg(0, -1); } } diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index 82b5e78117..4c0b8810d5 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -61,13 +61,6 @@ gfx_pixmap_color_t default_colors[DEFAULT_COLORS_NR] = {{GFX_COLOR_SYSTEM, 0x00, #define POINTER_VISIBLE_BUT_CLIPPED 2 -// Performs basic checks that apply to most functions -#define BASIC_CHECKS(error_retval) \ -if (!state) { \ - GFXERROR("Null state!\n"); \ - return error_retval; \ -} - // How to determine whether colors have to be allocated #define PALETTE_MODE state->driver->getMode()->palette @@ -157,7 +150,7 @@ static int _gfxop_grab_pixmap(GfxState *state, gfx_pixmap_t **pxmp, int x, int y int x,y; \ \ if (!pxm->index_data) { \ - GFXERROR("Attempt to draw control color %d on pixmap %d/%d/%d without index data", color, pxm->ID, pxm->loop, pxm->cel); \ + error("Attempt to draw control color %d on pixmap %d/%d/%d without index data", color, pxm->ID, pxm->loop, pxm->cel); \ return; \ } \ \ @@ -257,7 +250,7 @@ static int _gfxop_draw_pixmap(GfxDriver *driver, gfx_pixmap_t *pxm, int priority err = driver->drawPixmap(pxm, priority, src, clipped_dest, static_buf ? GFX_BUFFER_STATIC : GFX_BUFFER_BACK); if (err) { - GFXERROR("driver->draw_pixmap() returned err!\n"); + error("driver->draw_pixmap() returned error code"); return err; } @@ -301,7 +294,7 @@ static int _gfxop_update_box(GfxState *state, rect_t box) { _gfxop_scale_rect(&box, state->driver->getMode()); if ((retval = _gfxop_buffer_propagate_box(state, box, GFX_BUFFER_FRONT))) { - GFXERROR("Error occured while propagating box (%d,%d,%d,%d) to front buffer\n", box.x, box.y, box.width, box.height); + error("Error occured while propagating box (%d,%d,%d,%d) to front buffer", box.x, box.y, box.width, box.height); return retval; } return GFX_OK; @@ -354,7 +347,7 @@ void gfxdr_add_dirty(DirtyRectList &list, rect_t box, int strategy) { break; default: - GFXERROR("Attempt to use invalid dirty frame mode %d!\nPlease refer to gfx_options.h.", strategy); + error("Attempt to use invalid dirty frame mode %d!\nPlease refer to gfx_options.h", strategy); } } @@ -416,8 +409,6 @@ int gfxop_init(int version, bool isVGA, GfxState *state, gfx_options_t *options, //int color_depth = bpp ? bpp : 1; //int initialized = 0; - BASIC_CHECKS(GFX_FATAL); - state->options = options; state->visible_map = GFX_MASK_VISUAL; state->fullscreen_override = NULL; // No magical override @@ -444,8 +435,6 @@ int gfxop_init(int version, bool isVGA, GfxState *state, gfx_options_t *options, } int gfxop_exit(GfxState *state) { - BASIC_CHECKS(GFX_ERROR); - state->gfxResMan->freeResManager(); if (state->control_map) { @@ -520,7 +509,6 @@ int gfxop_scan_bitmask(GfxState *state, rect_t area, gfx_map_mask_t map) { int gfxop_set_clip_zone(GfxState *state, rect_t zone) { int xfact, yfact; - BASIC_CHECKS(GFX_ERROR); DDIRTY(stderr, "-- Setting clip zone %d %d %d %d\n", GFX_PRINT_RECT(zone)); @@ -557,8 +545,6 @@ int gfxop_set_color(GfxState *state, gfx_color_t *color, int r, int g, int b, in int mask = ((r >= 0 && g >= 0 && b >= 0) ? GFX_MASK_VISUAL : 0) | ((priority >= 0) ? GFX_MASK_PRIORITY : 0) | ((control >= 0) ? GFX_MASK_CONTROL : 0); - BASIC_CHECKS(GFX_FATAL); - if (PALETTE_MODE && a >= GFXOP_ALPHA_THRESHOLD) mask &= ~GFX_MASK_VISUAL; @@ -593,13 +579,11 @@ int gfxop_set_color(GfxState *state, gfx_color_t *colorOut, gfx_color_t &colorIn } int gfxop_set_system_color(GfxState *state, unsigned int index, gfx_color_t *color) { - BASIC_CHECKS(GFX_FATAL); - if (!PALETTE_MODE) return GFX_OK; if (index >= state->driver->getMode()->palette->size()) { - GFXERROR("Attempt to set invalid color index %02x as system color\n", color->visual.parent_index); + error("Attempt to set invalid color index %02x as system color", color->visual.parent_index); return GFX_ERROR; } @@ -752,7 +736,7 @@ static int simulate_stippled_line_draw(GfxDriver *driver, int skipone, Common::P Common::Point nextpos = Common::Point(start.x + xl, start.y + yl); if ((retval = driver->drawLine(start, nextpos, color, line_mode, GFX_LINE_STYLE_NORMAL))) { - GFXERROR("Failed to draw partial stippled line (%d,%d) -- (%d,%d)\n", start.x, start.y, nextpos.x, nextpos.y); + error("Failed to draw partial stippled line (%d,%d) -- (%d,%d)", start.x, start.y, nextpos.x, nextpos.y); return retval; } *posvar += delta; @@ -774,7 +758,7 @@ static int simulate_stippled_line_draw(GfxDriver *driver, int skipone, Common::P nextpos = Common::Point(start.x + xl, start.y + yl); if ((retval = driver->drawLine(start, nextpos, color, line_mode, GFX_LINE_STYLE_NORMAL))) { - GFXERROR("Failed to draw partial stippled line (%d,%d) -- (%d,%d)\n", start.x, start.y, nextpos.x, nextpos.y); + error("Failed to draw partial stippled line (%d,%d) -- (%d,%d)", start.x, start.y, nextpos.x, nextpos.y); return retval; } } @@ -787,7 +771,6 @@ static int _gfxop_draw_line_clipped(GfxState *state, Common::Point start, Common int retval; int skipone = (start.x ^ end.y) & 1; // Used for simulated line stippling - BASIC_CHECKS(GFX_FATAL); _gfxop_full_pointer_refresh(state); // First, make sure that the line is normalized @@ -813,7 +796,7 @@ static int _gfxop_draw_line_clipped(GfxState *state, Common::Point start, Common } if ((retval = state->driver->drawLine(start, end, color, line_mode, line_style))) { - GFXERROR("Failed to draw line (%d,%d) -- (%d,%d)\n", start.x, start.y, end.x, end.y); + error("Failed to draw line (%d,%d) -- (%d,%d)", start.x, start.y, end.x, end.y); return retval; } @@ -824,7 +807,6 @@ int gfxop_draw_line(GfxState *state, Common::Point start, Common::Point end, gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style) { int xfact, yfact; - BASIC_CHECKS(GFX_FATAL); _gfxop_add_dirty_x(state, gfx_rect(start.x, start.y, end.x - start.x, end.y - start.y)); xfact = state->driver->getMode()->xfact; @@ -855,7 +837,6 @@ int gfxop_draw_rectangle(GfxState *state, rect_t rect, gfx_color_t color, gfx_li Common::Point upper_left_u, upper_right_u, lower_left_u, lower_right_u; Common::Point upper_left, upper_right, lower_left, lower_right; - BASIC_CHECKS(GFX_FATAL); _gfxop_full_pointer_refresh(state); xfact = state->driver->getMode()->xfact; @@ -889,7 +870,7 @@ int gfxop_draw_rectangle(GfxState *state, rect_t rect, gfx_color_t color, gfx_li #undef PARTIAL_LINE if (retval) { - GFXERROR("Failed to draw rectangle (%d,%d)+(%d,%d)\n", rect.x, rect.y, rect.width, rect.height); + error("Failed to draw rectangle (%d,%d)+(%d,%d)", rect.x, rect.y, rect.width, rect.height); return retval; } @@ -906,7 +887,6 @@ int gfxop_draw_box(GfxState *state, rect_t box, gfx_color_t color1, gfx_color_t gfx_rectangle_fill_t driver_shade_type; rect_t new_box; - BASIC_CHECKS(GFX_FATAL); _gfxop_full_pointer_refresh(state); shade_type = GFX_BOX_SHADE_FLAT; @@ -959,7 +939,7 @@ int gfxop_draw_box(GfxState *state, rect_t box, gfx_color_t color1, gfx_color_t break; default: - GFXERROR("Invalid shade type: %d\n", shade_type); + error("Invalid shade type: %d", shade_type); return GFX_ERROR; } @@ -1020,7 +1000,7 @@ static int _gfxop_buffer_propagate_box(GfxState *state, rect_t box, gfx_buffer_t return GFX_OK; if ((err = state->driver->update(box, Common::Point(box.x, box.y), buffer))) { - GFXERROR("Error occured while updating region (%d,%d,%d,%d) in buffer %d\n", box.x, box.y, box.width, box.height, buffer); + error("Error occured while updating region (%d,%d,%d,%d) in buffer %d", box.x, box.y, box.width, box.height, buffer); return err; } @@ -1030,7 +1010,6 @@ static int _gfxop_buffer_propagate_box(GfxState *state, rect_t box, gfx_buffer_t extern int sci0_palette; int gfxop_clear_box(GfxState *state, rect_t box) { - BASIC_CHECKS(GFX_FATAL); _gfxop_full_pointer_refresh(state); _gfxop_add_dirty(state, box); DDIRTY(stderr, "[] clearing box %d %d %d %d\n", GFX_PRINT_RECT(box)); @@ -1077,11 +1056,7 @@ int gfxop_set_visible_map(GfxState *state, gfx_map_mask_t visible_map) { } int gfxop_update(GfxState *state) { - int retval; - - BASIC_CHECKS(GFX_FATAL); - - retval = _gfxop_clear_dirty_rec(state, state->_dirtyRects); + int retval = _gfxop_clear_dirty_rec(state, state->_dirtyRects); if (state->fullscreen_override) { // We've been asked to re-draw the active full-screen image, essentially. @@ -1092,7 +1067,7 @@ int gfxop_update(GfxState *state) { } if (retval) { - GFXERROR("Clearing the dirty rectangles failed!\n"); + error("Clearing the dirty rectangles failed"); } if (state->tag_mode) { @@ -1107,8 +1082,6 @@ int gfxop_update(GfxState *state) { } int gfxop_update_box(GfxState *state, rect_t box) { - BASIC_CHECKS(GFX_FATAL); - if (state->disable_dirty) _gfxop_update_box(state, box); else @@ -1118,15 +1091,12 @@ int gfxop_update_box(GfxState *state, rect_t box) { } int gfxop_enable_dirty_frames(GfxState *state) { - BASIC_CHECKS(GFX_ERROR); state->disable_dirty = 0; return GFX_OK; } int gfxop_disable_dirty_frames(GfxState *state) { - BASIC_CHECKS(GFX_ERROR); - state->disable_dirty = 1; return GFX_OK; @@ -1135,8 +1105,6 @@ int gfxop_disable_dirty_frames(GfxState *state) { // Pointer and IO ops int gfxop_sleep(GfxState *state, uint32 msecs) { - BASIC_CHECKS(GFX_FATAL); - uint32 time; const uint32 wakeup_time = g_system->getMillis() + msecs; @@ -1159,8 +1127,6 @@ int gfxop_sleep(GfxState *state, uint32 msecs) { } static int _gfxop_set_pointer(GfxState *state, gfx_pixmap_t *pxm, Common::Point *hotspot) { - BASIC_CHECKS(GFX_FATAL); - // FIXME: We may have to store this pxm somewhere, as the global palette // may change when a new PIC is loaded. The cursor has to be regenerated // from this pxm at that point. (An alternative might be to ensure the @@ -1173,8 +1139,6 @@ static int _gfxop_set_pointer(GfxState *state, gfx_pixmap_t *pxm, Common::Point } int gfxop_set_pointer_cursor(GfxState *state, int nr) { - BASIC_CHECKS(GFX_FATAL); - if (nr == GFXOP_NO_POINTER) return _gfxop_set_pointer(state, NULL, NULL); @@ -1190,8 +1154,6 @@ int gfxop_set_pointer_cursor(GfxState *state, int nr) { } int gfxop_set_pointer_view(GfxState *state, int nr, int loop, int cel, Common::Point *hotspot) { - BASIC_CHECKS(GFX_FATAL); - int real_loop = loop; int real_cel = cel; // FIXME: For now, don't palettize pointers @@ -1220,8 +1182,6 @@ int gfxop_set_pointer_view(GfxState *state, int nr, int loop, int cel, Common::P } int gfxop_set_pointer_position(GfxState *state, Common::Point pos) { - BASIC_CHECKS(GFX_ERROR); - state->pointer_pos = pos; if (pos.x > 320 || pos.y > 200) { @@ -1551,7 +1511,6 @@ sci_event_t gfxop_get_event(GfxState *state, unsigned int mask) { sci_event_t error_event = { SCI_EVT_ERROR, 0, 0, 0 }; sci_event_t event = { 0, 0, 0, 0 }; - BASIC_CHECKS(error_event); _gfxop_full_pointer_refresh(state); // Update the screen here, since it's called very often @@ -1614,8 +1573,6 @@ int gfxop_lookup_view_get_loops(GfxState *state, int nr) { int loop = 0, cel = 0; gfxr_view_t *view = NULL; - BASIC_CHECKS(GFX_ERROR); - view = state->gfxResMan->getView(nr, &loop, &cel, 0); if (!view) { @@ -1630,8 +1587,6 @@ int gfxop_lookup_view_get_cels(GfxState *state, int nr, int loop) { int real_loop = loop, cel = 0; gfxr_view_t *view = NULL; - BASIC_CHECKS(GFX_ERROR); - view = state->gfxResMan->getView(nr, &real_loop, &cel, 0); if (!view) { @@ -1645,8 +1600,6 @@ int gfxop_lookup_view_get_cels(GfxState *state, int nr, int loop) { } int gfxop_check_cel(GfxState *state, int nr, int *loop, int *cel) { - BASIC_CHECKS(GFX_ERROR); - gfxr_view_t *testView = state->gfxResMan->getView(nr, loop, cel, 0); if (!testView) { @@ -1660,7 +1613,6 @@ int gfxop_check_cel(GfxState *state, int nr, int *loop, int *cel) { int gfxop_overflow_cel(GfxState *state, int nr, int *loop, int *cel) { int loop_v = *loop; int cel_v = *cel; - BASIC_CHECKS(GFX_ERROR); gfxr_view_t *testView = state->gfxResMan->getView(nr, &loop_v, &cel_v, 0); @@ -1682,7 +1634,6 @@ int gfxop_overflow_cel(GfxState *state, int nr, int *loop, int *cel) { int gfxop_get_cel_parameters(GfxState *state, int nr, int loop, int cel, int *width, int *height, Common::Point *offset) { gfxr_view_t *view = NULL; gfx_pixmap_t *pxm = NULL; - BASIC_CHECKS(GFX_ERROR); view = state->gfxResMan->getView(nr, &loop, &cel, 0); @@ -1706,7 +1657,6 @@ static int _gfxop_draw_cel_buffer(GfxState *state, int nr, int loop, int cel, Co gfxr_view_t *view = NULL; gfx_pixmap_t *pxm = NULL; int old_x, old_y; - BASIC_CHECKS(GFX_FATAL); view = state->gfxResMan->getView(nr, &loop, &cel, palette); @@ -1777,8 +1727,6 @@ int *gfxop_get_pic_metainfo(GfxState *state) { } int gfxop_new_pic(GfxState *state, int nr, int flags, int default_palette) { - BASIC_CHECKS(GFX_FATAL); - state->gfxResMan->tagResources(); state->tag_mode = 1; state->palette_nr = default_palette; @@ -1791,15 +1739,16 @@ int gfxop_new_pic(GfxState *state, int nr, int flags, int default_palette) { } if (!state->pic || !state->pic_unscaled) { - GFXERROR("Could not retrieve background pic %d!\n", nr); + warning("Could not retrieve background pic %d", nr); if (state->pic) { - GFXERROR(" -- Inconsistency: scaled pic _was_ retrieved!\n"); + warning(" -- Inconsistency: scaled pic _was_ retrieved!"); } if (state->pic_unscaled) { - GFXERROR(" -- Inconsistency: unscaled pic _was_ retrieved!\n"); + warning(" -- Inconsistency: unscaled pic _was_ retrieved!"); } + error("Error occured in gfxop_new_pic()"); state->pic = state->pic_unscaled = NULL; return GFX_ERROR; } @@ -1810,17 +1759,15 @@ int gfxop_new_pic(GfxState *state, int nr, int flags, int default_palette) { } int gfxop_add_to_pic(GfxState *state, int nr, int flags, int default_palette) { - BASIC_CHECKS(GFX_FATAL); - if (!state->pic) { - GFXERROR("Attempt to add to pic with no pic active!\n"); + error("Attempt to add to pic with no pic active"); return GFX_ERROR; } state->pic = state->gfxResMan->addToPic(state->pic_nr, nr, flags, state->palette_nr, default_palette); if (!state->pic) { - GFXERROR("Could not add pic #%d to pic #%d!\n", state->pic_nr, nr); + error("Could not add pic #%d to pic #%d", state->pic_nr, nr); return GFX_ERROR; } @@ -1835,7 +1782,6 @@ int gfxop_add_to_pic(GfxState *state, int nr, int flags, int default_palette) { // replacing GfxState* state parameter with gfx_resstate_t* gfxResourceState and adjust callers accordingly int gfxop_get_font_height(GfxState *state, int font_nr) { gfx_bitmap_font_t *font; - BASIC_CHECKS(GFX_FATAL); font = state->gfxResMan->getFont(font_nr); @@ -1851,12 +1797,10 @@ int gfxop_get_text_params(GfxState *state, int font_nr, const char *text, int ma bool textsplits; gfx_bitmap_font_t *font; - BASIC_CHECKS(GFX_FATAL); - font = state->gfxResMan->getFont(font_nr); if (!font) { - GFXERROR("Attempt to calculate text size with invalid font #%d\n", font_nr); + error("Attempt to calculate text size with invalid font #%d", font_nr); *width = *height = 0; return GFX_ERROR; } @@ -1869,7 +1813,7 @@ int gfxop_get_text_params(GfxState *state, int font_nr, const char *text, int ma #endif if (!textsplits) { - GFXERROR("Could not calculate text size!"); + error("Could not calculate text size"); *width = *height = 0; return GFX_ERROR; } @@ -1885,21 +1829,20 @@ TextHandle *gfxop_new_text(GfxState *state, int font_nr, const Common::String &t TextHandle *handle; gfx_bitmap_font_t *font; int err = 0; - BASIC_CHECKS(NULL); // mapping text colors to palette err |= gfxop_set_color(state, &color1, color1); err |= gfxop_set_color(state, &color2, color2); err |= gfxop_set_color(state, &bg_color, bg_color); if (err) { - GFXERROR("Unable to set up colors"); + error("Unable to set up colors"); return NULL; } font = state->gfxResMan->getFont(font_nr); if (!font) { - GFXERROR("Attempt to draw text with invalid font #%d\n", font_nr); + error("Attempt to draw text with invalid font #%d", font_nr); return NULL; } @@ -1921,7 +1864,7 @@ TextHandle *gfxop_new_text(GfxState *state, int font_nr, const Common::String &t #endif if (!result) { - GFXERROR("Could not calculate text parameters in font #%d\n", font_nr); + error("Could not calculate text parameters in font #%d", font_nr); delete handle; return NULL; } @@ -1942,7 +1885,7 @@ TextHandle *gfxop_new_text(GfxState *state, int font_nr, const Common::String &t (bg_color.mask & GFX_MASK_VISUAL) ? &bg_color.visual : NULL); if (!handle->text_pixmaps[i]) { - GFXERROR("Failed to draw text pixmap for line %d/%d\n", i, handle->lines.size()); + error("Failed to draw text pixmap for line %d/%d", i, handle->lines.size()); delete handle; return NULL; } @@ -1957,8 +1900,6 @@ TextHandle *gfxop_new_text(GfxState *state, int font_nr, const Common::String &t } int gfxop_free_text(GfxState *state, TextHandle *handle) { - BASIC_CHECKS(GFX_ERROR); - delete handle; return GFX_OK; @@ -1983,11 +1924,10 @@ TextHandle::~TextHandle() { int gfxop_draw_text(GfxState *state, TextHandle *handle, rect_t zone) { int line_height; rect_t pos; - BASIC_CHECKS(GFX_FATAL); _gfxop_full_pointer_refresh(state); if (!handle) { - GFXERROR("Attempt to draw text with NULL handle!\n"); + error("Attempt to draw text with NULL handle"); return GFX_ERROR; } @@ -2016,7 +1956,7 @@ int gfxop_draw_text(GfxState *state, TextHandle *handle, rect_t zone) { break; default: - GFXERROR("Invalid vertical alignment %d!\n", handle->valign); + error("Invalid vertical alignment %d", handle->valign); return GFX_FATAL; // Internal error... } @@ -2032,7 +1972,7 @@ int gfxop_draw_text(GfxState *state, TextHandle *handle, rect_t zone) { #endif } if (!pxm) { - GFXERROR("Could not find text pixmap %d/%d\n", i, handle->lines.size()); + error("Could not find text pixmap %d/%d", i, handle->lines.size()); return GFX_ERROR; } @@ -2052,7 +1992,7 @@ int gfxop_draw_text(GfxState *state, TextHandle *handle, rect_t zone) { break; default: - GFXERROR("Invalid vertical alignment %d!\n", handle->valign); + error("Invalid vertical alignment %d", handle->valign); return GFX_FATAL; // Internal error... } @@ -2072,7 +2012,6 @@ int gfxop_draw_text(GfxState *state, TextHandle *handle, rect_t zone) { gfx_pixmap_t *gfxop_grab_pixmap(GfxState *state, rect_t area) { gfx_pixmap_t *pixmap = NULL; rect_t resultzone; // Ignored for this application - BASIC_CHECKS(NULL); _gfxop_full_pointer_refresh(state); _gfxop_scale_rect(&area, state->driver->getMode()); @@ -2084,10 +2023,9 @@ gfx_pixmap_t *gfxop_grab_pixmap(GfxState *state, rect_t area) { int gfxop_draw_pixmap(GfxState *state, gfx_pixmap_t *pxm, rect_t zone, Common::Point pos) { rect_t target; - BASIC_CHECKS(GFX_ERROR); if (!pxm) { - GFXERROR("Attempt to draw NULL pixmap!\n"); + error("Attempt to draw NULL pixmap"); return GFX_ERROR; } @@ -2098,7 +2036,7 @@ int gfxop_draw_pixmap(GfxState *state, gfx_pixmap_t *pxm, rect_t zone, Common::P _gfxop_add_dirty(state, target); if (!pxm) { - GFXERROR("Attempt to draw_pixmap with pxm=NULL\n"); + error("Attempt to draw_pixmap with pxm=NULL"); return GFX_ERROR; } @@ -2110,7 +2048,6 @@ int gfxop_draw_pixmap(GfxState *state, gfx_pixmap_t *pxm, rect_t zone, Common::P } int gfxop_free_pixmap(GfxState *state, gfx_pixmap_t *pxm) { - BASIC_CHECKS(GFX_ERROR); gfx_free_pixmap(pxm); return GFX_OK; } diff --git a/engines/sci/gfx/res_cursor.cpp b/engines/sci/gfx/res_cursor.cpp index f78134536c..9b3e64b8d5 100644 --- a/engines/sci/gfx/res_cursor.cpp +++ b/engines/sci/gfx/res_cursor.cpp @@ -53,7 +53,7 @@ gfx_pixmap_t *gfxr_draw_cursor(int id, byte *resource, int size, bool isSci01) { colors[3] = 2; if (size != CURSOR_RESOURCE_SIZE) { - GFXERROR("Expected resource size of %d, but found %d\n", CURSOR_RESOURCE_SIZE, size); + error("Expected resource size of %d, but found %d", CURSOR_RESOURCE_SIZE, size); return NULL; } diff --git a/engines/sci/gfx/res_font.cpp b/engines/sci/gfx/res_font.cpp index 7330df7441..cddbade845 100644 --- a/engines/sci/gfx/res_font.cpp +++ b/engines/sci/gfx/res_font.cpp @@ -44,12 +44,12 @@ static int calc_char(byte *dest, int total_width, int total_height, byte *src, i src += 2; if ((width >> 3) > total_width || height > total_height) { - GFXERROR("Weird character: width=%d/%d, height=%d/%d\n", width, total_width, height, total_height); + error("Weird character: width=%d/%d, height=%d/%d", width, total_width, height, total_height); return GFX_ERROR; } if (byte_width * height + 2 > size) { - GFXERROR("Character extends to %d of %d allowed bytes\n", byte_width * height + 2, size); + error("Character extends to %d of %d allowed bytes", byte_width * height + 2, size); return GFX_ERROR; } @@ -71,7 +71,7 @@ gfx_bitmap_font_t *gfxr_read_font(int id, byte *resource, int size) { ++font_counter; if (size < 6) { - GFXERROR("Font %04x size is %d- this is a joke, right?\n", id, size); + error("Font %04x size is %d", id, size); gfxr_free_font(font); return NULL; } @@ -81,15 +81,15 @@ gfx_bitmap_font_t *gfxr_read_font(int id, byte *resource, int size) { if (chars_nr < 0 || chars_nr > 256 || max_height < 0) { if (chars_nr < 0 || chars_nr > 256) - GFXERROR("Font %04x: Invalid number of characters: %d\n", id, chars_nr); + error("Font %04x: Invalid number of characters: %d", id, chars_nr); if (max_height < 0) - GFXERROR("Font %04x: Invalid font height: %d\n", id, max_height); + error("Font %04x: Invalid font height: %d", id, max_height); gfxr_free_font(font); return NULL; } if (size < 6 + chars_nr * 2) { - GFXERROR("Font %04x: Insufficient space for %d characters in font\n", id, chars_nr); + error("Font %04x: Insufficient space for %d characters in font", id, chars_nr); gfxr_free_font(font); return NULL; } @@ -101,7 +101,7 @@ gfx_bitmap_font_t *gfxr_read_font(int id, byte *resource, int size) { int offset = READ_LE_UINT16(resource + (i << 1) + 6); if (offset >= size) { - GFXERROR("Font %04x: Error: Character 0x%02x is at offset 0x%04x (beyond 0x%04x)\n", id, i, offset, size); + error("Font %04x: Error: Character 0x%02x is at offset 0x%04x (beyond 0x%04x)", id, i, offset, size); gfxr_free_font(font); return NULL; } @@ -130,7 +130,7 @@ gfx_bitmap_font_t *gfxr_read_font(int id, byte *resource, int size) { int offset = READ_LE_UINT16(resource + (i << 1) + 6); if (calc_char(font->data + (font->char_size * i), font->row_size, max_height, resource + offset, size - offset)) { - GFXERROR("Problem occured in font %04x, char %d/%d\n", id, i, chars_nr); + error("Problem occured in font %04x, char %d/%d", id, i, chars_nr); gfxr_free_font(font); return NULL; } diff --git a/engines/sci/gfx/res_pal.cpp b/engines/sci/gfx/res_pal.cpp index 0acc27a9b1..97e7297d43 100644 --- a/engines/sci/gfx/res_pal.cpp +++ b/engines/sci/gfx/res_pal.cpp @@ -76,7 +76,7 @@ Palette *gfxr_read_pal1(int id, byte *resource, int size) { unsigned int colors[MAX_COLORS] = {0}; if (size < PALETTE_START + 4) { - GFXERROR("Palette resource too small in %04x\n", id); + error("Palette resource too small in %04x", id); return NULL; } @@ -88,7 +88,7 @@ Palette *gfxr_read_pal1(int id, byte *resource, int size) { } if (counter < MAX_COLORS) { - GFXERROR("Palette %04x ends prematurely\n", id); + error("SCI1 palette %04x ends prematurely", id); return NULL; } @@ -117,7 +117,7 @@ Palette *gfxr_read_pal1_amiga(Common::File &file) { b2 = file.readByte(); if (b1 == EOF || b2 == EOF) { - GFXERROR("Palette file ends prematurely\n"); + error("Amiga palette file ends prematurely"); return NULL; } diff --git a/engines/sci/gfx/res_pic.cpp b/engines/sci/gfx/res_pic.cpp index 5ee2665b50..e7b34976b0 100644 --- a/engines/sci/gfx/res_pic.cpp +++ b/engines/sci/gfx/res_pic.cpp @@ -400,7 +400,7 @@ enum { #ifdef GFXR_DEBUG_PIC0 -#define p0printf sciprintf +#define p0printf printf #else void do_nothing(...) { } #define p0printf do_nothing @@ -1197,7 +1197,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, pal += default_palette; if (pal >= GFXR_PIC0_NUM_PALETTES) { - GFXERROR("Attempt to access invalid palette %d\n", pal); + error("Attempt to access invalid palette %d", pal); return; } @@ -1442,7 +1442,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, index %= GFXR_PIC0_PALETTE_SIZE; if (pal >= GFXR_PIC0_NUM_PALETTES) { - GFXERROR("Attempt to write to invalid palette %d\n", pal); + error("Attempt to write to invalid palette %d", pal); return; } palette[pal][index] = *(resource + pos++); @@ -1453,7 +1453,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, p0printf("Set palette @%d\n", pos); pal = *(resource + pos++); if (pal >= GFXR_PIC0_NUM_PALETTES) { - GFXERROR("Attempt to write to invalid palette %d\n", pal); + error("Attempt to write to invalid palette %d", pal); return; } @@ -1527,7 +1527,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, // *if it's not for some reason, we should die if (view->palette && view->palette->isShared() && !sci1) { - sciprintf("gfx_draw_pic0(): can't set a non-static palette for an embedded view!\n"); + warning("gfx_draw_pic0(): can't set a non-static palette for an embedded view"); } // For SCI0, use special color mapping to copy the low @@ -1602,7 +1602,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, if (!pic->priorityTable) { pic->priorityTable = (int*)malloc(16 * sizeof(int)); } else { - GFXERROR("pic->priorityTable is not NULL (%p); possible memory corruption", (void *)pic->priorityTable); + error("pic->priorityTable is not NULL (%p); possible memory corruption", (void *)pic->priorityTable); } pri_table = pic->priorityTable; @@ -1614,7 +1614,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, } default: - sciprintf("%s L%d: Warning: Unknown opx %02x\n", __FILE__, __LINE__, opx); + warning("gfxr_draw_pic01(): Unknown opx %02x", opx); return; } goto end_op_loop; @@ -1714,7 +1714,7 @@ void gfxr_dither_pic0(gfxr_pic_t *pic, int dmode, int pattern) { break; default: - GFXERROR("Invalid dither mode %d!\n", dmode); + error("Invalid dither mode %d", dmode); return; } diff --git a/engines/sci/gfx/res_view.cpp b/engines/sci/gfx/res_view.cpp index b30c57f38d..41cb55fa75 100644 --- a/engines/sci/gfx/res_view.cpp +++ b/engines/sci/gfx/res_view.cpp @@ -76,7 +76,7 @@ gfx_pixmap_t *gfxr_draw_cel0(int id, int loop, int cel, byte *resource, int size if (xl <= 0 || yl <= 0) { gfx_free_pixmap(retval); - GFXERROR("View %02x:(%d/%d) has invalid xl=%d or yl=%d\n", id, loop, cel, xl, yl); + error("View %02x:(%d/%d) has invalid xl=%d or yl=%d", id, loop, cel, xl, yl); return NULL; } @@ -123,7 +123,7 @@ gfx_pixmap_t *gfxr_draw_cel0(int id, int loop, int cel, byte *resource, int size color = retval->color_key; if (writepos + count > pixmap_size) { - GFXERROR("View %02x:(%d/%d) writes RLE data over its designated end at rel. offset 0x%04x\n", id, loop, cel, pos); + error("View %02x:(%d/%d) writes RLE data over its designated end at rel. offset 0x%04x", id, loop, cel, pos); return NULL; } @@ -143,7 +143,7 @@ gfxr_view_t *gfxr_draw_view0(int id, byte *resource, int size, int palette) { int palette_ofs = READ_LE_UINT16(resource + 6); if (size < V0_FIRST_LOOP_OFFSET + 8) { - GFXERROR("Attempt to draw empty view %04x\n", id); + error("Attempt to draw empty view %04x", id); return NULL; } @@ -166,7 +166,7 @@ gfxr_view_t *gfxr_draw_view0(int id, byte *resource, int size, int palette) { } if (view->loops_nr * 2 + V0_FIRST_LOOP_OFFSET > size) { - GFXERROR("View %04x: Not enough space in resource to accomodate for the claimed %d loops\n", id, view->loops_nr); + error("View %04x: Not enough space in resource to accomodate for the claimed %d loops", id, view->loops_nr); free(view); return NULL; } @@ -346,7 +346,7 @@ gfx_pixmap_t *gfxr_draw_cel1(int id, int loop, int cel, int mirrored, byte *reso if (xl <= 0 || yl <= 0) { gfx_free_pixmap(retval); - GFXERROR("View %02x:(%d/%d) has invalid xl=%d or yl=%d\n", id, loop, cel, xl, yl); + error("View %02x:(%d/%d) has invalid xl=%d or yl=%d", id, loop, cel, xl, yl); return NULL; } diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 7138a918a1..121def5949 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -570,7 +570,7 @@ ResourceManager::~ResourceManager() { void ResourceManager::removeFromLRU(Resource *res) { if (res->status != kResStatusEnqueued) { - sciprintf("Resmgr: Oops: trying to remove resource that isn't enqueued\n"); + warning("Resmgr: trying to remove resource that isn't enqueued"); return; } _LRU.remove(res); @@ -580,16 +580,15 @@ void ResourceManager::removeFromLRU(Resource *res) { void ResourceManager::addToLRU(Resource *res) { if (res->status != kResStatusAllocated) { - warning("Resmgr: Oops: trying to enqueue resource with state %d", res->status); + warning("Resmgr: trying to enqueue resource with state %d", res->status); return; } _LRU.push_front(res); _memoryLRU += res->size; -#if (SCI_VERBOSE_RESMGR > 1) +#if SCI_VERBOSE_RESMGR debug("Adding %s.%03d (%d bytes) to lru control: %d bytes total", getResourceTypeName(res->type), res->number, res->size, mgr->_memoryLRU); - #endif res->status = kResStatusEnqueued; } @@ -618,7 +617,7 @@ void ResourceManager::freeOldResources() { removeFromLRU(goner); goner->unalloc(); #ifdef SCI_VERBOSE_RESMGR - sciprintf("Resmgr-debug: LRU: Freeing %s.%03d (%d bytes)\n", getResourceTypeName(goner->type), goner->number, goner->size); + printf("Resmgr-debug: LRU: Freeing %s.%03d (%d bytes)\n", getResourceTypeName(goner->type), goner->number, goner->size); #endif } } @@ -641,7 +640,7 @@ Resource *ResourceManager::findResource(ResourceId id, bool lock) { if (id.number >= sci_max_resource_nr[_sciVersion]) { ResourceId moddedId = ResourceId(id.type, id.number % sci_max_resource_nr[_sciVersion], id.tuple); - sciprintf("[resmgr] Requested invalid resource %s, mapped to %s\n", + warning("[resmgr] Requested invalid resource %s, mapped to %s", id.toString().c_str(), moddedId.toString().c_str()); id = moddedId; } @@ -675,7 +674,7 @@ Resource *ResourceManager::findResource(ResourceId id, bool lock) { if (retval->data) return retval; else { - sciprintf("Resmgr: Failed to read %s\n", retval->id.toString().c_str()); + warning("Resmgr: Failed to read %s", retval->id.toString().c_str()); return NULL; } } diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 250460c5de..0826509a8b 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -87,6 +87,7 @@ SciEngine::SciEngine(OSystem *syst, const SciGameDescription *desc) Common::addDebugChannel(kDebugLevelDclInflate, "DCL", "DCL inflate debugging"); Common::addDebugChannel(kDebugLevelVM, "VM", "VM debugging"); Common::addDebugChannel(kDebugLevelScripts, "Scripts", "Notifies when scripts are unloaded"); + Common::addDebugChannel(kDebugLevelGC, "GC", "Garbage Collector debugging"); printf("SciEngine::SciEngine\n"); } diff --git a/engines/sci/sci.h b/engines/sci/sci.h index 9b5d1de689..f8cf4289e8 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -57,7 +57,8 @@ enum kDebugLevels { kDebugLevelAvoidPath = 1 << 16, kDebugLevelDclInflate = 1 << 17, kDebugLevelVM = 1 << 18, - kDebugLevelScripts = 1 << 19 + kDebugLevelScripts = 1 << 19, + kDebugLevelGC = 1 << 20 }; struct SciGameDescription { diff --git a/engines/sci/sfx/iterator.cpp b/engines/sci/sfx/iterator.cpp index c1acda7f6c..4e5b20a5d2 100644 --- a/engines/sci/sfx/iterator.cpp +++ b/engines/sci/sfx/iterator.cpp @@ -287,15 +287,15 @@ int BaseSongIterator::parseMidiCommand(byte *buf, int *result, SongIteratorChann voices += _polyphony[i]; } - sciprintf("SET_POLYPHONY(%d, %d) for a total of %d voices\n", midi_channel, buf[2], voices); - sciprintf("[iterator-1] DEBUG: Polyphony = [ "); + printf("SET_POLYPHONY(%d, %d) for a total of %d voices\n", midi_channel, buf[2], voices); + printf("[iterator] DEBUG: Polyphony = [ "); for (i = 0; i < self1->_numChannels; i++) - sciprintf("%d ", _polyphony[i]); - sciprintf("]\n"); - sciprintf("[iterator-1] DEBUG: Importance = [ "); + printf("%d ", _polyphony[i]); + printf("]\n"); + printf("[iterator] DEBUG: Importance = [ "); for (i = 0; i < self1->_numChannels; i++) - sciprintf("%d ", _importance[i]); - sciprintf("]\n"); + printf("%d ", _importance[i]); + printf("]\n"); } #endif break; @@ -304,7 +304,7 @@ int BaseSongIterator::parseMidiCommand(byte *buf, int *result, SongIteratorChann break; case SCI_MIDI_CHANNEL_MUTE: - sciprintf("CHANNEL_MUTE(%d, %d)\n", midi_channel, buf[2]); + warning("CHANNEL_MUTE(%d, %d)", midi_channel, buf[2]); break; case SCI_MIDI_HOLD: { @@ -680,7 +680,7 @@ int Sci1SongIterator::initSample(const int offset) { CHECK_FOR_END_ABSOLUTE((uint)offset + 10); if (_data[offset + 1] != 0) - sciprintf("[iterator-1] In sample at offset 0x04x: Byte #1 is %02x instead of zero\n", + warning("[iterator-1] In sample at offset 0x04x: Byte #1 is %02x instead of zero", _data[offset + 1]); rate = (int16)READ_LE_UINT16(_data.begin() + offset + 2); @@ -739,9 +739,7 @@ int Sci1SongIterator::initSong() { } if (_data[offset] == 0xff) { - sciprintf("[iterator-1] Song does not support" - " hardware 0x%02x\n", - _deviceId); + warning("[iterator] Song does not support hardware 0x%02x", _deviceId); return 1; } @@ -765,16 +763,18 @@ int Sci1SongIterator::initSong() { } else { /* Regular MIDI channel */ if (_numChannels >= MIDI_CHANNELS) { - sciprintf("[iterator-1] Warning: Song has more than %d channels, cutting them off\n", + warning("[iterator] Song has more than %d channels, cutting them off", MIDI_CHANNELS); break; /* Scan for remaining samples */ } else { int channel_nr = _data[track_offset] & 0xf; SongIteratorChannel &channel = _channels[_numChannels++]; + /* if (_data[track_offset] & 0xf0) printf("Channel %d has mapping bits %02x\n", channel_nr, _data[track_offset] & 0xf0); + */ // Add 2 to skip over header bytes */ channel.init(channel_nr, track_offset + 2, track_offset + end); @@ -801,8 +801,8 @@ int Sci1SongIterator::initSong() { for (Common::List::iterator seeker = _samples.begin(); seeker != _samples.end(); ++seeker) { int prev_last_time = last_time; - sciprintf("[iterator-1] Detected sample: %d Hz, %d bytes at time %d\n", - seeker->format.rate, seeker->size, seeker->delta); + //printf("[iterator] Detected sample: %d Hz, %d bytes at time %d\n", + // seeker->format.rate, seeker->size, seeker->delta); last_time = seeker->delta; seeker->delta -= prev_last_time; } @@ -884,8 +884,7 @@ Audio::AudioStream *Sci1SongIterator::getAudioStream() { int Sci1SongIterator::nextCommand(byte *buf, int *result) { if (!_initialised) { - sciprintf("[iterator-1] DEBUG: Initialising for %d\n", - _deviceId); + //printf("[iterator] DEBUG: Initialising for %d\n", _deviceId); _initialised = true; if (initSong()) return SI_FINISHED; @@ -1010,7 +1009,7 @@ SongIterator *Sci1SongIterator::handleMessage(Message msg) { ; if (_deviceId == 0xff) { - sciprintf("[iterator-1] Warning: Device %d(%d) not supported", + warning("[iterator] Device %d(%d) not supported", msg._arg.i & 0xff, sfx_pcm_available()); } if (_initialised) { diff --git a/engines/sci/sfx/softseq/amiga.cpp b/engines/sci/sfx/softseq/amiga.cpp index d097ec47f5..7eebadbf59 100644 --- a/engines/sci/sfx/softseq/amiga.cpp +++ b/engines/sci/sfx/softseq/amiga.cpp @@ -28,6 +28,7 @@ #include "common/file.h" #include "common/frac.h" +#include "common/util.h" namespace Sci { @@ -253,9 +254,9 @@ static void play_instrument(int16 *dest, channel_t *channel, int count) { static void change_instrument(int channel, int instrument) { #ifdef DEBUG if (bank.instruments[instrument]) - sciprintf("[sfx:seq:amiga] Setting channel %i to \"%s\" (%i)\n", channel, bank.instruments[instrument]->name, instrument); + printf("[sfx:seq:amiga] Setting channel %i to \"%s\" (%i)\n", channel, bank.instruments[instrument]->name, instrument); else - sciprintf("[sfx:seq:amiga] Warning: instrument %i does not exist (channel %i)\n", instrument, channel); + warning("[sfx:seq:amiga] instrument %i does not exist (channel %i)", instrument, channel); #endif hw_channels[channel].instrument = instrument; } @@ -283,7 +284,7 @@ static void stop_note(int ch, int note) { if (channel == CHANNELS_NR) { #ifdef DEBUG - sciprintf("[sfx:seq:amiga] Warning: cannot stop note %i on channel %i\n", note, ch); + warning("[sfx:seq:amiga] cannot stop note %i on channel %i", note, ch); #endif return; } @@ -300,14 +301,14 @@ static void start_note(int ch, int note, int velocity) { int channel; if (hw_channels[ch].instrument < 0 || hw_channels[ch].instrument > 255) { - sciprintf("[sfx:seq:amiga] Error: invalid instrument %i on channel %i\n", hw_channels[ch].instrument, ch); + warning("[sfx:seq:amiga] invalid instrument %i on channel %i", hw_channels[ch].instrument, ch); return; } instrument = bank.instruments[hw_channels[ch].instrument]; if (!instrument) { - sciprintf("[sfx:seq:amiga] Error: instrument %i does not exist\n", hw_channels[ch].instrument); + warning("[sfx:seq:amiga] instrument %i does not exist", hw_channels[ch].instrument); return; } @@ -316,7 +317,7 @@ static void start_note(int ch, int note, int velocity) { break; if (channel == CHANNELS_NR) { - sciprintf("[sfx:seq:amiga] Warning: could not find a free channel\n"); + warning("[sfx:seq:amiga] could not find a free channel"); return; } @@ -326,7 +327,7 @@ static void start_note(int ch, int note, int velocity) { int fnote = note + instrument->transpose; if (fnote < 0 || fnote > 127) { - sciprintf("[sfx:seq:amiga] Error: illegal note %i\n", fnote); + warning("[sfx:seq:amiga] illegal note %i\n", fnote); return; } @@ -369,7 +370,7 @@ static instrument_t *read_instrument(Common::File &file, int *id) { int i; if (file.read(header, 61) < 61) { - sciprintf("[sfx:seq:amiga] Error: failed to read instrument header\n"); + warning("[sfx:seq:amiga] failed to read instrument header"); return NULL; } @@ -402,31 +403,31 @@ static instrument_t *read_instrument(Common::File &file, int *id) { strncpy(instrument->name, (char *) header + 2, 29); instrument->name[29] = 0; #ifdef DEBUG - sciprintf("[sfx:seq:amiga] Reading instrument %i: \"%s\" (%i bytes)\n", + printf("[sfx:seq:amiga] Reading instrument %i: \"%s\" (%i bytes)\n", *id, instrument->name, size); - sciprintf(" Mode: %02x\n", instrument->mode); - sciprintf(" Looping: %s\n", instrument->mode & MODE_LOOP ? "on" : "off"); - sciprintf(" Pitch changes: %s\n", instrument->mode & MODE_PITCH ? "on" : "off"); - sciprintf(" Segment sizes: %i %i %i\n", seg_size[0], seg_size[1], seg_size[2]); - sciprintf(" Segment offsets: 0 %i %i\n", loop_offset, read_int32(header + 43)); + printf(" Mode: %02x\n", instrument->mode); + printf(" Looping: %s\n", instrument->mode & MODE_LOOP ? "on" : "off"); + printf(" Pitch changes: %s\n", instrument->mode & MODE_PITCH ? "on" : "off"); + printf(" Segment sizes: %i %i %i\n", seg_size[0], seg_size[1], seg_size[2]); + printf(" Segment offsets: 0 %i %i\n", loop_offset, read_int32(header + 43)); #endif instrument->samples = (int8 *) malloc(size + 1); if (file.read(instrument->samples, size) < (unsigned int)size) { - sciprintf("[sfx:seq:amiga] Error: failed to read instrument samples\n"); + warning("[sfx:seq:amiga] failed to read instrument samples"); return NULL; } if (instrument->mode & MODE_LOOP) { if (loop_offset + seg_size[1] > size) { #ifdef DEBUG - sciprintf("[sfx:seq:amiga] Warning: looping samples extend %i bytes past end of sample block\n", + warning("[sfx:seq:amiga] looping samples extend %i bytes past end of sample block", loop_offset + seg_size[1] - size); #endif seg_size[1] = size - loop_offset; } if (seg_size[1] < 0) { - sciprintf("[sfx:seq:amiga] Error: invalid looping point\n"); + warning("[sfx:seq:amiga] invalid looping point"); return NULL; } @@ -456,12 +457,12 @@ static Common::Error ami_init(sfx_softseq_t *self, byte *patch, int patch_len, b int i; if (!file.open("bank.001")) { - sciprintf("[sfx:seq:amiga] Error: file bank.001 not found\n"); + warning("[sfx:seq:amiga] file bank.001 not found"); return Common::kUnknownError; } if (file.read(header, 40) < 40) { - sciprintf("[sfx:seq:amiga] Error: failed to read header of file bank.001\n"); + warning("[sfx:seq:amiga] failed to read header of file bank.001"); return Common::kUnknownError; } @@ -482,7 +483,7 @@ static Common::Error ami_init(sfx_softseq_t *self, byte *patch, int patch_len, b strncpy(bank.name, (char *) header + 8, 29); bank.name[29] = 0; #ifdef DEBUG - sciprintf("[sfx:seq:amiga] Reading %i instruments from bank \"%s\"\n", bank.size, bank.name); + printf("[sfx:seq:amiga] Reading %i instruments from bank \"%s\"\n", bank.size, bank.name); #endif for (i = 0; i < bank.size; i++) { @@ -490,12 +491,12 @@ static Common::Error ami_init(sfx_softseq_t *self, byte *patch, int patch_len, b instrument_t *instrument = read_instrument(file, &id); if (!instrument) { - sciprintf("[sfx:seq:amiga] Error: failed to read bank.001\n"); + warning("[sfx:seq:amiga] failed to read bank.001"); return Common::kUnknownError; } if (id < 0 || id > 255) { - sciprintf("[sfx:seq:amiga] Error: instrument ID out of bounds\n"); + warning("[sfx:seq:amiga] Error: instrument ID out of bounds"); return Common::kUnknownError; } @@ -524,7 +525,7 @@ static void ami_event(sfx_softseq_t *self, byte command, int argc, byte *argv) { if (channel >= HW_CHANNELS_NR) { #ifdef DEBUG - sciprintf("[sfx:seq:amiga] Warning: received event for non-existing channel %i\n", channel); + warning("[sfx:seq:amiga] received event for non-existing channel %i", channel); #endif return; } @@ -543,21 +544,21 @@ static void ami_event(sfx_softseq_t *self, byte command, int argc, byte *argv) { break; case 0x0a: #ifdef DEBUG - sciprintf("[sfx:seq:amiga] Warning: ignoring pan 0x%02x event for channel %i\n", argv[1], channel); + warning("[sfx:seq:amiga] ignoring pan 0x%02x event for channel %i", argv[1], channel); #endif break; case 0x7b: stop_channel(channel); break; default: - sciprintf("[sfx:seq:amiga] Warning: unknown control event 0x%02x\n", argv[0]); + warning("[sfx:seq:amiga] unknown control event 0x%02x", argv[0]); } break; case 0xc0: change_instrument(channel, argv[0]); break; default: - sciprintf("[sfx:seq:amiga] Warning: unknown event %02x\n", command); + warning("[sfx:seq:amiga] unknown event %02x", command); } } diff --git a/engines/sci/sfx/songlib.cpp b/engines/sci/sfx/songlib.cpp index 3a6549a0d4..0fe6440e7a 100644 --- a/engines/sci/sfx/songlib.cpp +++ b/engines/sci/sfx/songlib.cpp @@ -74,7 +74,7 @@ void SongLibrary::addSong(Song *song) { int pri = song->_priority; if (NULL == song) { - sciprintf("addSong(): NULL passed for song\n"); + warning("addSong(): NULL passed for song"); return; } diff --git a/engines/sci/tools.cpp b/engines/sci/tools.cpp index d0e11aca09..b35c6ce7b6 100644 --- a/engines/sci/tools.cpp +++ b/engines/sci/tools.cpp @@ -45,35 +45,4 @@ int sci_ffs(int bits) { return retval; } -bool g_redirect_sciprintf_to_gui = false; - -void sciprintf(const char *fmt, ...) { - va_list argp; - - assert(fmt); - - // First determine how big a buffer we need - va_start(argp, fmt); - int bufsize = vsnprintf(0, 0, fmt, argp); - assert(bufsize >= 0); - va_end(argp); - - // Allocate buffer for the full printed string - char *buf = (char *)malloc(bufsize + 1); - assert(buf); - - // Print everything according to fmt into buf - va_start(argp, fmt); // reset argp - int bufsize2 = vsnprintf(buf, bufsize + 1, fmt, argp); - assert(bufsize == bufsize2); - va_end(argp); - - // Display the result suitably - if (g_redirect_sciprintf_to_gui) - ((SciEngine *)g_engine)->getSciDebugger()->DebugPrintf("%s", buf); - printf("%s", buf); - - free(buf); -} - } // End of namespace Sci diff --git a/engines/sci/tools.h b/engines/sci/tools.h index a4352837e8..b0d30aadb7 100644 --- a/engines/sci/tools.h +++ b/engines/sci/tools.h @@ -31,13 +31,6 @@ namespace Sci { -/** - * Prints a string to the console stack. - * @param fmt a printf-style format string - * @param Additional parameters as defined in fmt - */ -void sciprintf(const char *fmt, ...) GCC_PRINTF(1, 2); - /** Find first set bit in bits and return its index. Returns 0 if bits is 0. */ int sci_ffs(int bits); diff --git a/engines/sci/vocabulary.cpp b/engines/sci/vocabulary.cpp index 6616ac362d..144ec4cc73 100644 --- a/engines/sci/vocabulary.cpp +++ b/engines/sci/vocabulary.cpp @@ -351,46 +351,46 @@ void Vocabulary::decipherSaidBlock(byte *addr) { if (nextitem < 0xf0) { nextitem = nextitem << 8 | *addr++; - sciprintf(" %s[%03x]", getAnyWordFromGroup(nextitem), nextitem); + printf(" %s[%03x]", getAnyWordFromGroup(nextitem), nextitem); nextitem = 42; // Make sure that group 0xff doesn't abort } else switch (nextitem) { case 0xf0: - sciprintf(" ,"); + printf(" ,"); break; case 0xf1: - sciprintf(" &"); + printf(" &"); break; case 0xf2: - sciprintf(" /"); + printf(" /"); break; case 0xf3: - sciprintf(" ("); + printf(" ("); break; case 0xf4: - sciprintf(" )"); + printf(" )"); break; case 0xf5: - sciprintf(" ["); + printf(" ["); break; case 0xf6: - sciprintf(" ]"); + printf(" ]"); break; case 0xf7: - sciprintf(" #"); + printf(" #"); break; case 0xf8: - sciprintf(" <"); + printf(" <"); break; case 0xf9: - sciprintf(" >"); + printf(" >"); break; case 0xff: break; } } while (nextitem != 0xff); - sciprintf("\n"); + printf("\n"); } bool Vocabulary::tokenizeString(ResultWordList &retval, const char *sentence, char **error) { @@ -484,32 +484,32 @@ bool Kernel::hasKernelFunction(const char *functionName) const { void _vocab_recursive_ptree_dump_treelike(parse_tree_node_t *nodes, int nr, int prevnr) { if ((nr > VOCAB_TREE_NODES)/* || (nr < prevnr)*/) { - sciprintf("Error(%04x)", nr); + printf("Error(%04x)", nr); return; } if (nodes[nr].type == kParseTreeLeafNode) - //sciprintf("[%03x]%04x", nr, nodes[nr].content.value); - sciprintf("%x", nodes[nr].content.value); + //printf("[%03x]%04x", nr, nodes[nr].content.value); + printf("%x", nodes[nr].content.value); else { int lbranch = nodes[nr].content.branches[0]; int rbranch = nodes[nr].content.branches[1]; - //sciprintf("<[%03x]", nr); - sciprintf("<"); + //printf("<[%03x]", nr); + printf("<"); if (lbranch) _vocab_recursive_ptree_dump_treelike(nodes, lbranch, nr); else - sciprintf("NULL"); + printf("NULL"); - sciprintf(","); + printf(","); if (rbranch) _vocab_recursive_ptree_dump_treelike(nodes, rbranch, nr); else - sciprintf("NULL"); + printf("NULL"); - sciprintf(">"); + printf(">"); } } @@ -519,43 +519,43 @@ void _vocab_recursive_ptree_dump(parse_tree_node_t *nodes, int nr, int prevnr, i int i; if (nodes[nr].type == kParseTreeLeafNode) { - sciprintf("vocab_dump_parse_tree: Error: consp is nil for element %03x\n", nr); + printf("vocab_dump_parse_tree: Error: consp is nil for element %03x\n", nr); return; } if ((nr > VOCAB_TREE_NODES)/* || (nr < prevnr)*/) { - sciprintf("Error(%04x))", nr); + printf("Error(%04x))", nr); return; } if (lbranch) { if (nodes[lbranch].type == kParseTreeBranchNode) { - sciprintf("\n"); + printf("\n"); for (i = 0; i < blanks; i++) - sciprintf(" "); - sciprintf("("); + printf(" "); + printf("("); _vocab_recursive_ptree_dump(nodes, lbranch, nr, blanks + 1); - sciprintf(")\n"); + printf(")\n"); for (i = 0; i < blanks; i++) - sciprintf(" "); + printf(" "); } else - sciprintf("%x", nodes[lbranch].content.value); - sciprintf(" "); - }/* else sciprintf ("nil");*/ + printf("%x", nodes[lbranch].content.value); + printf(" "); + }/* else printf ("nil");*/ if (rbranch) { if (nodes[rbranch].type == kParseTreeBranchNode) _vocab_recursive_ptree_dump(nodes, rbranch, nr, blanks); else - sciprintf("%x", nodes[rbranch].content.value); - }/* else sciprintf("nil");*/ + printf("%x", nodes[rbranch].content.value); + }/* else printf("nil");*/ } void vocab_dump_parse_tree(const char *tree_name, parse_tree_node_t *nodes) { //_vocab_recursive_ptree_dump_treelike(nodes, 0, 0); - sciprintf("(setq %s \n'(", tree_name); + printf("(setq %s \n'(", tree_name); _vocab_recursive_ptree_dump(nodes, 0, 0, 1); - sciprintf("))\n"); + printf("))\n"); } void vocab_synonymize_tokens(ResultWordList &words, const SynonymList &synonyms) { diff --git a/engines/sci/vocabulary.h b/engines/sci/vocabulary.h index ce6d48c570..14e3ad6013 100644 --- a/engines/sci/vocabulary.h +++ b/engines/sci/vocabulary.h @@ -236,7 +236,7 @@ public: parse_rule_list_t *buildGNF(bool verbose = false); /** - * Deciphers a said block and dumps its content via sciprintf. + * Deciphers a said block and dumps its content via printf. * For debugging only. * @param pos pointer to the data to dump */ -- cgit v1.2.3 From 1f3f4ccdd29e227808eaa29affb7db432756092c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 6 Jul 2009 11:10:35 +0000 Subject: Fixed compilation svn-id: r42168 --- engines/sci/gfx/operations.cpp | 2 +- engines/sci/sfx/seq/map-mt32-to-gm.cpp | 36 +++++++++++++++++----------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index 4c0b8810d5..ac8e0ef9b0 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -1508,7 +1508,7 @@ static sci_event_t scummvm_get_event(GfxDriver *drv) { } sci_event_t gfxop_get_event(GfxState *state, unsigned int mask) { - sci_event_t error_event = { SCI_EVT_ERROR, 0, 0, 0 }; + //sci_event_t error_event = { SCI_EVT_ERROR, 0, 0, 0 }; sci_event_t event = { 0, 0, 0, 0 }; _gfxop_full_pointer_refresh(state); diff --git a/engines/sci/sfx/seq/map-mt32-to-gm.cpp b/engines/sci/sfx/seq/map-mt32-to-gm.cpp index 8b93f62043..269f6cb24f 100644 --- a/engines/sci/sfx/seq/map-mt32-to-gm.cpp +++ b/engines/sci/sfx/seq/map-mt32-to-gm.cpp @@ -582,19 +582,19 @@ static int8 lookup_rhythm_key(const char *iname) { static void print_map(int sci, int ins, int rhythm, int mt32) { #ifdef DEBUG_MT32_TO_GM if (ins == SFX_UNMAPPED || (ins == SFX_MAPPED_TO_RHYTHM && rhythm == SFX_UNMAPPED)) { - sciprintf("[MT32-to-GM] No mapping available for [%i] `%s' (%i)\n", + printf("[MT32-to-GM] No mapping available for [%i] `%s' (%i)\n", sci, MT32_PresetTimbreMaps[mt32].name, mt32); return; } if (ins == SFX_MAPPED_TO_RHYTHM) { - sciprintf("[MT32-to-GM] Mapping [%i] `%s' (%i) to `%s' [R] (%i)\n", + printf("[MT32-to-GM] Mapping [%i] `%s' (%i) to `%s' [R] (%i)\n", sci, MT32_PresetTimbreMaps[mt32].name, mt32, GM_Percussion_Names[rhythm], rhythm); return; } - sciprintf("[MT32-to-GM] Mapping [%i] `%s' (%i) to `%s' (%i)\n", + printf("[MT32-to-GM] Mapping [%i] `%s' (%i) to `%s' (%i)\n", sci, MT32_PresetTimbreMaps[mt32].name, mt32, GM_Instrument_Names[ins], ins); #endif @@ -608,18 +608,18 @@ static void print_map_mem(int sci, int ins, int rhythm, char *mt32) { name[10] = 0; if (ins == SFX_UNMAPPED || (ins == SFX_MAPPED_TO_RHYTHM && rhythm == SFX_UNMAPPED)) { - sciprintf("[MT32-to-GM] No mapping available for [%i] `%s'\n", + printf("[MT32-to-GM] No mapping available for [%i] `%s'\n", sci, name); return; } if (ins == SFX_MAPPED_TO_RHYTHM) { - sciprintf("[MT32-to-GM] Mapping [%i] `%s' to `%s' [R] (%i)\n", + printf("[MT32-to-GM] Mapping [%i] `%s' to `%s' [R] (%i)\n", sci, name, GM_Percussion_Names[rhythm], rhythm); return; } - sciprintf("[MT32-to-GM] Mapping [%i] `%s' to `%s' (%i)\n", + printf("[MT32-to-GM] Mapping [%i] `%s' to `%s' (%i)\n", sci, name, GM_Instrument_Names[ins], ins); #endif } @@ -627,19 +627,19 @@ static void print_map_mem(int sci, int ins, int rhythm, char *mt32) { static void print_map_rhythm(int sci, int ins, int rhythm, int mt32) { #ifdef DEBUG_MT32_TO_GM if (ins == SFX_UNMAPPED || (ins == SFX_MAPPED_TO_RHYTHM && rhythm == SFX_UNMAPPED)) { - sciprintf("[MT32-to-GM] No mapping available for [%i] `%s' [R] (%i)\n", + printf("[MT32-to-GM] No mapping available for [%i] `%s' [R] (%i)\n", sci, MT32_RhythmTimbreMaps[mt32].name, mt32); return; } if (ins == SFX_MAPPED_TO_RHYTHM) { - sciprintf("[MT32-to-GM] Mapping [%i] `%s' [R] (%i) to `%s' [R] (%i)\n", + printf("[MT32-to-GM] Mapping [%i] `%s' [R] (%i) to `%s' [R] (%i)\n", sci, MT32_RhythmTimbreMaps[mt32].name, mt32, GM_Percussion_Names[rhythm], rhythm); return; } - sciprintf("[MT32-to-GM] Mapping [%i] `%s' [R] (%i) to `%s' (%i)\n", + printf("[MT32-to-GM] Mapping [%i] `%s' [R] (%i) to `%s' (%i)\n", sci, MT32_RhythmTimbreMaps[mt32].name, mt32, GM_Instrument_Names[ins], ins); #endif @@ -653,12 +653,12 @@ static void print_map_rhythm_mem(int sci, int rhythm, char *mt32) { name[10] = 0; if (rhythm == SFX_UNMAPPED) { - sciprintf("[MT32-to-GM] No mapping available for [%i] `%s'\n", + printf("[MT32-to-GM] No mapping available for [%i] `%s'\n", sci, name); return; } - sciprintf("[MT32-to-GM] Mapping [%i] `%s' to `%s' (%i)\n", + printf("[MT32-to-GM] Mapping [%i] `%s' to `%s' (%i)\n", sci, name, GM_Percussion_Names[rhythm], rhythm); #endif } @@ -691,18 +691,18 @@ sfx_instrument_map_t *sfx_instrument_map_mt32_to_gm(byte *data, size_t size) { } if (!data) { - sciprintf("[MT32-to-GM] No MT-32 patch data supplied, using default mapping\n"); + printf("[MT32-to-GM] No MT-32 patch data supplied, using default mapping\n"); return map; } type = sfx_instrument_map_detect(data, size); if (type == SFX_MAP_UNKNOWN) { - sciprintf("[MT32-to-GM] Patch data format unknown, using default mapping\n"); + printf("[MT32-to-GM] Patch data format unknown, using default mapping\n"); return map; } if (type == SFX_MAP_MT32_GM) { - sciprintf("[MT32-to-GM] Patch data format not supported, using default mapping\n"); + printf("[MT32-to-GM] Patch data format not supported, using default mapping\n"); return map; } @@ -715,10 +715,10 @@ sfx_instrument_map_t *sfx_instrument_map_mt32_to_gm(byte *data, size_t size) { } else patches = 48; - sciprintf("[MT32-to-GM] %d MT-32 Patches detected\n", patches); - sciprintf("[MT32-to-GM] %d MT-32 Memory Timbres\n", memtimbres); + printf("[MT32-to-GM] %d MT-32 Patches detected\n", patches); + printf("[MT32-to-GM] %d MT-32 Memory Timbres\n", memtimbres); - sciprintf("[MT32-to-GM] Mapping patches..\n"); + printf("[MT32-to-GM] Mapping patches..\n"); for (i = 0; i < patches; i++) { char *name; @@ -765,7 +765,7 @@ sfx_instrument_map_t *sfx_instrument_map_mt32_to_gm(byte *data, size_t size) { } if (size > pos && ((0x100 * *(data + pos) + *(data + pos + 1)) == 0xDCBA)) { - sciprintf("[MT32-to-GM] Mapping percussion..\n"); + printf("[MT32-to-GM] Mapping percussion..\n"); for (i = 0; i < 64 ; i++) { number = *(data + pos + 4 * i + 2); -- cgit v1.2.3 From bceacbd9229cbd3ae4e1f14ab802a987f6a9ac81 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 6 Jul 2009 11:15:42 +0000 Subject: Added seChanged the warning displayed when a selector can't be mapped to a debugC - it's perfectly normal not to find certain selectors in certain SCI versions. Also, fixed the SCI version enums svn-id: r42169 --- engines/sci/sci.h | 4 ++-- engines/sci/vocabulary.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/sci/sci.h b/engines/sci/sci.h index f8cf4289e8..1fa9221fa7 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -75,8 +75,8 @@ enum SciGameVersions { SCI_VERSION_01_VGA = 3, SCI_VERSION_01_VGA_ODD = 4, SCI_VERSION_1 = 5, - SCI_VERSION_1_1 = 7, - SCI_VERSION_32 = 8 + SCI_VERSION_1_1 = 6, + SCI_VERSION_32 = 7 }; extern const char *versionNames[8]; diff --git a/engines/sci/vocabulary.cpp b/engines/sci/vocabulary.cpp index 144ec4cc73..dd56cdf88a 100644 --- a/engines/sci/vocabulary.cpp +++ b/engines/sci/vocabulary.cpp @@ -472,7 +472,7 @@ int Kernel::findSelector(const char *selectorName) const { return pos; } - warning("Could not map '%s' to any selector", selectorName); + debugC(2, kDebugLevelVM, "Could not map '%s' to any selector\n", selectorName); return -1; } -- cgit v1.2.3 From 87988c69ee0851a317f08c9ecff7d806db60723f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 6 Jul 2009 11:19:19 +0000 Subject: Assigned several unimplemented/unused kernel functions as stubs, so that we know when they're used and how they're called svn-id: r42170 --- engines/sci/engine/kernel.cpp | 23 ++++++++++++++++------- engines/sci/engine/kernel.h | 4 +--- engines/sci/engine/kmisc.cpp | 6 +++--- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 6d2e11043d..2f8461a34a 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -309,7 +309,7 @@ SciKernelFunction kfunct_mappers[] = { /*6f*/ DEFUN("6f", kTimesCos, "ii"), /*70*/ DEFUN("Graph", kGraph, ".*"), /*71*/ DEFUN("Joystick", kJoystick, ".*"), - /*72*/ NOFUN("unknown72"), + /*72*/ NOFUN("unknown72"), // ShiftScreen, perhaps? /*73*/ NOFUN("unknown73"), // Experimental functions @@ -322,7 +322,6 @@ SciKernelFunction kfunct_mappers[] = { /*(?)*/ DEFUN("IsItSkip", kIsItSkip, "iiiii"), // Non-experimental Functions without a fixed ID - DEFUN("CosMult", kTimesCos, "ii"), DEFUN("SinMult", kTimesSin, "ii"), /*(?)*/ DEFUN("CosDiv", kCosDiv, "ii"), @@ -341,6 +340,21 @@ SciKernelFunction kfunct_mappers[] = { // Special and NOP stuff {NULL, k_Unknown, NULL}, + // Stub functions + DEFUN("ShiftScreen", kStub, ".*"), + DEFUN("MemorySegment", kStub, ".*"), + DEFUN("ListOps", kStub, ".*"), + DEFUN("ATan", kStub, ".*"), + DEFUN("StrSplit", kStub, ".*"), + DEFUN("MergePoly", kStub, ".*"), + DEFUN("AssertPalette", kStub, ".*"), + DEFUN("TextColors", kStub, ".*"), + DEFUN("TextFonts", kStub, ".*"), + DEFUN("Record", kStub, ".*"), + DEFUN("PlayBack", kStub, ".*"), + DEFUN("DbugStr", kStub, ".*"), + DEFUN("Platform", kStub, ".*"), // SCI1 + {NULL, NULL, NULL} // Terminator }; @@ -779,11 +793,6 @@ void Kernel::setDefaultKernelNames() { offset = 4; } } - - if (_resmgr->_sciVersion == SCI_VERSION_1_1) { - // KQ6CD calls unimplemented function 0x26 - _kernelNames[0x26] = "Dummy"; - } } #ifdef ENABLE_SCI32 diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index da3d255329..9c92519cf0 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -509,12 +509,10 @@ reg_t kSetVideoMode(EngineState *s, int funct_nr, int argc, reg_t *argv); reg_t k_Unknown(EngineState *s, int funct_nr, int argc, reg_t *argv); // The Unknown/Unnamed kernel function -reg_t kstub(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kStub(EngineState *s, int funct_nr, int argc, reg_t *argv); // for unimplemented kernel functions reg_t kNOP(EngineState *s, int funct_nr, int argc, reg_t *argv); // for kernel functions that don't do anything -reg_t kFsciEmu(EngineState *s, int funct_nr, int argc, reg_t *argv); -// Emulating "old" kernel functions on the heap } // End of namespace Sci diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index aefc010911..8381bc2e13 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -237,9 +237,9 @@ reg_t kMemory(EngineState *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kstub(EngineState *s, int funct_nr, int argc, reg_t *argv) { +reg_t kStub(EngineState *s, int funct_nr, int argc, reg_t *argv) { char tmpbuf[200]; - sprintf(tmpbuf, "Unimplemented syscall: %s[%x](", + sprintf(tmpbuf, "Unimplemented syscall: %s[%x] (", s->_kernel->getKernelName(funct_nr).c_str(), funct_nr); for (int i = 0; i < argc; i++) { @@ -249,7 +249,7 @@ reg_t kstub(EngineState *s, int funct_nr, int argc, reg_t *argv) { strcat(tmpbuf2, ", "); strcat(tmpbuf, tmpbuf2); } - strcat(tmpbuf, ")\n"); + strcat(tmpbuf, ")"); warning(tmpbuf); -- cgit v1.2.3 From e182cc0b9fd7fff9148e69e3374acf027f72bf77 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Mon, 6 Jul 2009 11:19:37 +0000 Subject: Splitting up the big evaluate() function svn-id: r42171 --- engines/gob/hotspots.cpp | 636 +++++++++++++++++++++++++---------------------- engines/gob/hotspots.h | 50 +++- 2 files changed, 384 insertions(+), 302 deletions(-) diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index b717bd76df..02d112869a 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -128,6 +128,16 @@ bool Hotspots::Hotspot::isActiveInput() const { return true; } +bool Hotspots::Hotspot::isInputLeave() const { + if (!isInput()) + return false; + + if (!(getType() & 1)) + return true; + + return false; +} + bool Hotspots::Hotspot::isFilled() const { return getState() & kStateFilled; } @@ -518,7 +528,7 @@ uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const { // Check where the mouse was moved to for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { - Hotspot &spot = _hotspots[i]; + const Hotspot &spot = _hotspots[i]; if (spot.isDisabled()) // Only consider enabled hotspots @@ -548,7 +558,7 @@ uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const { // Check if something was clicked for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { - Hotspot &spot = _hotspots[i]; + const Hotspot &spot = _hotspots[i]; if (spot.isDisabled()) // Only consider enabled hotspots @@ -646,7 +656,7 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index // Update display _vm->_draw->blitInvalidated(); - _vm->_video->retrace(); + _vm->_video->waitRetrace(); uint16 key = 0; while (key == 0) { @@ -914,7 +924,8 @@ uint16 Hotspots::updateInput(uint16 xPos, uint16 yPos, uint16 width, uint16 heig switch (key) { case kKeyRight: // If possible, move the cursor right - if ((pos > strlen(str)) || (pos > (editSize - 1)) || (editSize == 0)) { + if (((editSize != 0) && ((pos > strlen(str)) || (pos > (editSize - 1)))) || + ((editSize == 0) && (pos > strlen(str)))) { pos++; continue; } @@ -1138,7 +1149,7 @@ uint16 Hotspots::handleInputs(int16 time, uint16 inputCount, uint16 &curInput, } void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, - uint16 &validId, bool &hasInput, uint16 &inputCount) { + uint16 &inputId, bool &hasInput, uint16 &inputCount) { ids[i] = 0; @@ -1300,7 +1311,7 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, break; case 20: - validId = i; + inputId = i; // Fall through to case 2 case kTypeClick: key = _vm->_game->_script->readInt16(); @@ -1334,13 +1345,62 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, flags, key, funcEnter, funcLeave, funcPos); } +bool Hotspots::evaluateFind(uint16 key, int16 timeVal, const uint16 *ids, + uint16 hotspotIndex1, uint16 hotspotIndex2, uint16 endIndex, + int16 &duration, uint16 &id, uint16 &index, bool &finished) { + + if (id != 0) + // We already found a hotspot, nothing to do + return true; + + if (key != 0) { + // We've got a key + + // Find the hotspot with that key associated + findKey(key, id, index); + if (id != 0) + // Found it + return true; + + // Try it case insensitively + findKeyCaseInsensitive(key, id, index); + if (id != 0) + // Found it + return true; + + return false; + } + + if (duration != 0) { + // We've got a time duration + + if (hotspotIndex1 != 0) { + finished = + leaveNthPlain(hotspotIndex1, endIndex, timeVal, ids, id, index, duration); + } else if (hotspotIndex2 != 0) { + findNthPlain(hotspotIndex2, endIndex, id, index); + } else { + findNthPlain(0, 0, id, index); + + // Leave the current hotspot + if ((_currentKey != 0) && (_hotspots[_currentIndex].funcLeave != 0)) + call(_hotspots[_currentIndex].funcLeave); + + _currentKey = 0; + } + + if (id != 0) + return true; + + return false; + } + + return false; +} + void Hotspots::evaluate() { InputDesc inputs[20]; uint16 ids[kHotspotCount]; - int16 counter; - int16 var_24; - int16 var_26; - int16 collStackPos; // Push all local hotspots push(0); @@ -1360,14 +1420,14 @@ void Hotspots::evaluate() { // Parameters of this block _vm->_game->_handleMouse = _vm->_game->_script->peekByte(0); int16 duration = _vm->_game->_script->peekByte(1); - byte stackPos2 = _vm->_game->_script->peekByte(3); - byte descIndex = _vm->_game->_script->peekByte(4); + byte hotspotIndex1 = _vm->_game->_script->peekByte(3); + byte hotspotIndex2 = _vm->_game->_script->peekByte(4); bool needRecalculation = _vm->_game->_script->peekByte(5) != 0; // Seconds -> Milliseconds duration *= 1000; - if ((stackPos2 != 0) || (descIndex != 0)) { + if ((hotspotIndex1 != 0) || (hotspotIndex2 != 0)) { duration /= 100; if (_vm->_game->_script->peekByte(1) == 100) duration = 2; @@ -1377,14 +1437,12 @@ void Hotspots::evaluate() { _vm->_game->_script->skip(6); - // Clear current ID - WRITE_VAR(16, 0); + setCurrentHotspot(0, 0); - byte var_41 = 0; - int16 var_46 = 0; + bool finishedDuration = false; uint16 id = 0; - uint16 validId = 0xFFFF; + uint16 inputId = 0xFFFF; uint16 index = 0; bool hasInput = false; @@ -1392,7 +1450,7 @@ void Hotspots::evaluate() { // Adding new hotspots for (uint16 i = 0; i < count; i++) - evaluateNew(i, ids, inputs, validId, hasInput, inputCount); + evaluateNew(i, ids, inputs, inputId, hasInput, inputCount); // Recalculate all hotspots if requested if (needRecalculation) @@ -1401,7 +1459,7 @@ void Hotspots::evaluate() { _vm->_game->_forceHandleMouse = 0; _vm->_util->clearKeyBuf(); - do { + while ((id == 0) && !_vm->_inter->_terminate && !_vm->shouldQuit()) { uint16 key = 0; if (hasInput) { // Input @@ -1411,193 +1469,23 @@ void Hotspots::evaluate() { key = handleInputs(duration, inputCount, curInput, inputs, id, index); // Notify the script of the current input index - WRITE_VAR(55, curInput); + WRITE_VAR(17 + 38, curInput); if (key == kKeyReturn) { // Return pressed, invoke input leave - for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { - Hotspot &spot = _hotspots[i]; - - if (!spot.isFilledEnabled()) - // Not filled or disabled - continue; - - if ((spot.getType() & 1) != 0) - // Not an input with a leave function - continue; - - if (spot.getType() <= kTypeClick) - // Not an input - continue; - - id = spot.id; - validId = spot.id & 0x7FFF; - index = i; - break; - } + findFirstInputLeave(id, inputId, index); break; } } else // Normal move or click check key = check(_vm->_game->_handleMouse, -duration, id, index); - // Handle special number keys - if (((key & 0xFF) >= ' ') && ((key & 0xFF) <= 0xFF) && - ((key >> 8) > 1) && ((key >> 8) < 12)) - key = '0' + (((key >> 8) - 1) % 10) + (key & 0xFF00); - - if (id == 0) { - // No hotspot area - - if (key != 0) { - // But a key - - // Find the hotspot with that key associated - for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { - Hotspot &spot = _hotspots[i]; - - if (!spot.isFilledEnabled()) - // Not filled or disabled - continue; - - // Key match Catch all - if ((spot.key == key) || (spot.key == 0x7FFF)) { - id = spot.id; - index = i; - break; - } - } - - if (id == 0) { - // Didn't find such a hotspot - - // Try it again, this time case insensitively - for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { - Hotspot &spot = _hotspots[i]; - - if (!spot.isFilledEnabled()) - continue; - - if ((spot.key & 0xFF00) != 0) - continue; - - if (spot.key == 0) - continue; - - if (toupper(key & 0xFF) == toupper(spot.key)) { - id = spot.id; - index = i; - break; - } - } - } - } else if (duration != 0) { - if (stackPos2 != 0) { - collStackPos = 0; - - for (int i = endIndex; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { - Hotspot &spot = _hotspots[i]; - - if (!spot.isFilledNew()) - continue; - - collStackPos++; - if (collStackPos != stackPos2) - // Isn't yet the one wanted - continue; - - id = spot.id; - index = i; - _vm->_inter->storeMouse(); - if (VAR(16) != 0) - // We already handle a hotspot - break; - - // Notify the scripts that we now handle this hotspot - if (Hotspot::getState(id) == kStateFilled) - WRITE_VAR(16, ids[id & 0xFFF]); - else - WRITE_VAR(16, id & 0xFFF); - - if (spot.funcLeave != 0) { - // It has a leave function - - uint32 timeKey = _vm->_util->getTimeKey(); - call(spot.funcLeave); - - if (timeVal != 2) { - // Rest time we have left = time we had - time the leave took - duration = timeVal - (_vm->_util->getTimeKey() - timeKey); - - // Remove the buffer time - if ((duration - var_46) < 3) { - var_46 -= (duration - 3); - duration = 3; - } else if (var_46 != 0) { - duration -= var_46; - var_46 = 0; - } - - // Clamp - if (duration > timeVal) - duration = timeVal; - - } else - duration = 2; - - } - - if (VAR(16) == 0) - // Didn't find anything - id = 0; - else - var_41 = 1; - - break; - } - - } else { - if (descIndex != 0) { - - counter = 0; - // Enter the nth hotspot - for (int i = endIndex; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { - Hotspot &spot = _hotspots[i]; + key = convertSpecialKey(key); - if (spot.isFilledNew()) { - if (++counter == descIndex) { - id = spot.id; - index = i; - break; - } - } + // Try to find a fitting hotspot + Hotspots::evaluateFind(key, timeVal, ids, hotspotIndex1, hotspotIndex2, endIndex, + duration, id, index, finishedDuration); - } - - } else { - - // Enter the first hotspot - for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { - Hotspot &spot = _hotspots[i]; - - if (spot.isFilledNew()) { - id = spot.id; - index = i; - break; - } - } - - // Leave the current hotspot - if ((_currentKey != 0) && (_hotspots[_currentIndex].funcLeave != 0)) - call(_hotspots[_currentIndex].funcLeave); - - _currentKey = 0; - } - - } - } - } - - if (var_41 != 0) + if (finishedDuration) break; if ((id == 0) || (_hotspots[index].funcLeave != 0)) @@ -1606,114 +1494,30 @@ void Hotspots::evaluate() { _vm->_inter->storeMouse(); - // Notify the scripts of the currently handled hotspot - if (Hotspot::getState(id) == kStateFilled) - WRITE_VAR(16, ids[id & 0xFFF]); - else - WRITE_VAR(16, id & 0xFFF); + setCurrentHotspot(ids, id); // Enter it if (_hotspots[index].funcEnter != 0) call(_hotspots[index].funcEnter); - WRITE_VAR(16, 0); + setCurrentHotspot(0, 0); id = 0; } - while ((id == 0) && !_vm->_inter->_terminate && !_vm->shouldQuit()); - - char tempStr[256]; - if ((id & 0xFFF) == validId) { - collStackPos = 0; - var_24 = 0; - var_26 = 1; - for (int i = 0; i < kHotspotCount; i++) { - Hotspot &spot = _hotspots[i]; - - // Looking for all enabled inputs - if (spot.isEnd()) - continue; - if (!spot.isFilledEnabled()) - continue; - if (!spot.isInput()) - continue; - - // Clean up numerical floating values - if (spot.getType() >= kTypeInputFloatNoLeave) { - // Get the string - char *ptr; - strncpy0(tempStr, GET_VARO_STR(spot.key), 255); - - // Remove spaces - while ((ptr = strchr(tempStr, ' '))) - _vm->_util->cutFromStr(tempStr, (ptr - tempStr), 1); - - // Exchange decimal separator if needed - if (_vm->_global->_language == kLanguageBritish) - while ((ptr = strchr(tempStr, '.'))) - *ptr = ','; - - // Write it back - WRITE_VARO_STR(spot.key, tempStr); - } - - if ((spot.getType() >= kTypeInput2NoLeave) && (spot.getType() <= kTypeInput3Leave)) { - const char *str = inputs[var_24].str; - strncpy0(tempStr, GET_VARO_STR(spot.key), 255); - - if (spot.getType() < kTypeInput3NoLeave) - _vm->_util->cleanupStr(tempStr); - - // Look if we find a match between the wanted and the typed string - int16 pos = 0; - do { - char spotStr[256]; - - strncpy0(spotStr, str, 255); - pos += strlen(str) + 1; - - str += strlen(str) + 1; - - if (spot.getType() < kTypeInput3NoLeave) - _vm->_util->cleanupStr(spotStr); - - // Compare the entered string with the string we wanted - if (strcmp(tempStr, spotStr) == 0) { - WRITE_VAR(17, VAR(17) + 1); - WRITE_VAR(17 + var_26, 1); - break; - } - } while (inputs[var_24].length > pos); - - collStackPos++; - } else - WRITE_VAR(17 + var_26, 2); - - var_24++; - var_26++; - } - - // Notify the scripts if we reached the requested hotspot - if (collStackPos != (int16) VAR(17)) - WRITE_VAR(17, 0); - else - WRITE_VAR(17, 1); - } + if ((id & 0xFFF) == inputId) + matchInputStrings(inputs); if (_vm->_game->_handleMouse == 1) _vm->_draw->blitCursor(); - if (!_vm->_inter->_terminate && (var_41 == 0)) { + if (!_vm->_inter->_terminate && (!finishedDuration)) { _vm->_game->_script->seek(_hotspots[index].funcLeave); _vm->_inter->storeMouse(); - if (VAR(16) == 0) { + if (getCurrentHotspot() == 0) { // No hotspot currently handled, now we'll handle the newly found one - if (Hotspot::getState(id) == kStateFilled) - WRITE_VAR(16, ids[id & 0xFFF]); - else - WRITE_VAR(16, id & 0xFFF); + setCurrentHotspot(ids, id); } } else _vm->_game->_script->setFinished(true); @@ -1737,7 +1541,7 @@ int16 Hotspots::findCursor(uint16 x, uint16 y) const { int16 cursor = 0; for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { - Hotspot &spot = _hotspots[i]; + const Hotspot &spot = _hotspots[i]; if ((spot.getWindow() != 0) || spot.isDisabled()) // Ignore disabled and non-main-windowed hotspots @@ -1767,7 +1571,7 @@ int16 Hotspots::findCursor(uint16 x, uint16 y) const { uint16 Hotspots::inputToHotspot(uint16 input) const { uint16 inputIndex = 0; for (int i = 0; i < kHotspotCount; i++) { - Hotspot &spot = _hotspots[i]; + const Hotspot &spot = _hotspots[i]; if (!spot.isActiveInput()) // Not an active input @@ -1789,7 +1593,7 @@ uint16 Hotspots::hotspotToInput(uint16 hotspot) const { uint16 input = 0; for (int i = 0; i < kHotspotCount; i++) { - Hotspot &spot = _hotspots[i]; + const Hotspot &spot = _hotspots[i]; if (!spot.isActiveInput()) // Not an active input @@ -1808,7 +1612,7 @@ uint16 Hotspots::hotspotToInput(uint16 hotspot) const { uint16 Hotspots::findClickedInput(uint16 index) const { for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { - Hotspot &spot = _hotspots[i]; + const Hotspot &spot = _hotspots[i]; if (spot.getWindow() != 0) // Ignore other windows @@ -1837,6 +1641,254 @@ uint16 Hotspots::findClickedInput(uint16 index) const { return index; } +bool Hotspots::findFirstInputLeave(uint16 &id, uint16 &inputId, uint16 &index) const { + for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { + const Hotspot &spot = _hotspots[i]; + + if (!spot.isFilledEnabled()) + // Not filled or disabled + continue; + + if (!spot.isInputLeave()) + // Not an input with a leave function + continue; + + id = spot.id; + inputId = spot.id & 0x7FFF; + index = i; + return true; + } + + return false; +} + +bool Hotspots::findKey(uint16 key, uint16 &id, uint16 &index) const { + id = 0; + index = 0; + + for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { + const Hotspot &spot = _hotspots[i]; + + if (!spot.isFilledEnabled()) + // Not filled or disabled + continue; + + // Key match Catch all + if ((spot.key == key) || (spot.key == 0x7FFF)) { + id = spot.id; + index = i; + return true; + } + } + + return false; +} + +bool Hotspots::findKeyCaseInsensitive(uint16 key, uint16 &id, uint16 &index) const { + id = 0; + index = 0; + + for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { + const Hotspot &spot = _hotspots[i]; + + if (!spot.isFilledEnabled()) + // Not filled or disabled, ignore + continue; + + if ((spot.key & 0xFF00) != 0) + continue; + + if (spot.key == 0) + // No associated key, ignore + continue; + + // Compare + if (toupper(key & 0xFF) == toupper(spot.key)) { + id = spot.id; + index = i; + return true; + } + } + + return false; +} + +bool Hotspots::findNthPlain(uint16 n, uint16 startIndex, uint16 &id, uint16 &index) const { + id = 0; + index = 0; + + uint16 counter = 0; + for (int i = startIndex; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { + const Hotspot &spot = _hotspots[i]; + + if (!spot.isFilledNew()) + // Not filled, ignore + continue; + + if (++counter != n) + // Not yet the one we want + continue; + + id = spot.id; + index = i; + return true; + } + + return false; +} + +bool Hotspots::leaveNthPlain(uint16 n, uint16 startIndex, int16 timeVal, const uint16 *ids, + uint16 &id, uint16 &index, int16 &duration) { + + id = 0; + index = 0; + + if (!findNthPlain(n, startIndex, id, index)) + // Doesn't exist + return false; + + _vm->_inter->storeMouse(); + + if (getCurrentHotspot() != 0) + // We already handle a hotspot + return false; + + setCurrentHotspot(ids, id); + + const Hotspot &spot = _hotspots[index]; + if (spot.funcLeave != 0) { + // It has a leave function + + uint32 startTime, callTime; + + // Call the leave and time it + startTime = _vm->_util->getTimeKey(); + call(spot.funcLeave); + callTime = _vm->_util->getTimeKey() - startTime; + + // Remove the time it took from the time we have available + duration = CLIP(timeVal - callTime, 2, timeVal); + } + + if (getCurrentHotspot() == 0) { + id = 0; + index = 0; + } + + return getCurrentHotspot() != 0; +} + +void Hotspots::setCurrentHotspot(const uint16 *ids, uint16 id) const { + if (!ids) { + WRITE_VAR(16, 0); + return; + } + + if (Hotspot::getState(id) == kStateFilled) + WRITE_VAR(16, ids[id & 0xFFF]); + else + WRITE_VAR(16, id & 0xFFF); +} + +uint32 Hotspots::getCurrentHotspot() const { + return VAR(16); +} + +void Hotspots::cleanFloatString(const Hotspot &spot) const { + char tempStr[256]; + + // Get the string + strncpy0(tempStr, GET_VARO_STR(spot.key), 255); + + // Remove spaces + char *ptr; + while ((ptr = strchr(tempStr, ' '))) + _vm->_util->cutFromStr(tempStr, (ptr - tempStr), 1); + + // Exchange decimal separator if needed + if (_vm->_global->_language == kLanguageBritish) + while ((ptr = strchr(tempStr, '.'))) + *ptr = ','; + + // Write it back + WRITE_VARO_STR(spot.key, tempStr); +} + +void Hotspots::checkStringMatch(const Hotspot &spot, const InputDesc &input, + uint16 inputPos) const { + + const char *str = input.str; + + char tempStr[256]; + char spotStr[256]; + + strncpy0(tempStr, GET_VARO_STR(spot.key), 255); + + if (spot.getType() < kTypeInput3NoLeave) + _vm->_util->cleanupStr(tempStr); + + uint16 pos = 0; + do { + strncpy0(spotStr, str, 255); + + pos += strlen(str) + 1; + str += strlen(str) + 1; + + if (spot.getType() < kTypeInput3NoLeave) + _vm->_util->cleanupStr(spotStr); + + // Compare the entered string with the string we wanted + if (strcmp(tempStr, spotStr) == 0) { + WRITE_VAR(17, VAR(17) + 1); + WRITE_VAR(17 + inputPos, 1); + break; + } + } while (input.length > pos); +} + +void Hotspots::matchInputStrings(const InputDesc *inputs) const { + uint16 strInputCount = 0; + uint16 inputIndex = 0; + uint16 inputPos = 1; + + for (int i = 0; i < kHotspotCount; i++) { + const Hotspot &spot = _hotspots[i]; + + // Looking for all enabled inputs + if (spot.isEnd()) + continue; + if (!spot.isFilledEnabled()) + continue; + if (!spot.isInput()) + continue; + + if (spot.getType() >= kTypeInputFloatNoLeave) + cleanFloatString(spot); + + if ((spot.getType() >= kTypeInput2NoLeave) && (spot.getType() <= kTypeInput3Leave)) { + + // Look if we find a match between the wanted and the typed string + checkStringMatch(spot, inputs[inputIndex], inputPos); + strInputCount++; + } else + WRITE_VAR(17 + inputPos, 2); + + inputIndex++; + inputPos++; + } + + // Notify the scripts if we reached the requested hotspot + WRITE_VAR(17, (uint32) (strInputCount == ((uint16) VAR(17)))); +} + +uint16 Hotspots::convertSpecialKey(uint16 key) const { + if (((key & 0xFF) >= ' ') && ((key & 0xFF) <= 0xFF) && + ((key >> 8) > 1) && ((key >> 8) < 12)) + key = '0' + (((key >> 8) - 1) % 10) + (key & 0xFF00); + + return key; +} + void Hotspots::getTextCursorPos(const Video::FontDesc &font, const char *str, uint32 pos, uint16 x, uint16 y, uint16 width, uint16 height, uint16 &cursorX, uint16 &cursorY, uint16 &cursorWidth, uint16 &cursorHeight) const { diff --git a/engines/gob/hotspots.h b/engines/gob/hotspots.h index 893991bfbe..c269cbb290 100644 --- a/engines/gob/hotspots.h +++ b/engines/gob/hotspots.h @@ -121,22 +121,23 @@ private: void clear(); - Type getType() const; + Type getType () const; MouseButtons getButton() const; - uint8 getWindow() const; - uint8 getCursor() const; - uint8 getState() const; + uint8 getWindow() const; + uint8 getCursor() const; + uint8 getState () const; /** Is this hotspot the block end marker? */ bool isEnd() const; - bool isInput() const; + bool isInput () const; bool isActiveInput() const; + bool isInputLeave () const; - bool isFilled() const; + bool isFilled () const; bool isFilledEnabled() const; - bool isFilledNew() const; - bool isDisabled() const; + bool isFilledNew () const; + bool isDisabled () const; /** Are the specified coordinates in the hotspot? */ bool isIn(uint16 x, uint16 y) const; @@ -146,7 +147,7 @@ private: static uint8 getState(uint16 id); void disable(); - void enable(); + void enable (); }; struct StackEntry { @@ -213,14 +214,43 @@ private: /** Evaluate adding new hotspots script commands. */ void evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, - uint16 &validId, bool &hasInput, uint16 &inputCount); + uint16 &inputId, bool &hasInput, uint16 &inputCount); + /** Find the hotspot requested by script commands. */ + bool evaluateFind(uint16 key, int16 timeVal, const uint16 *ids, + uint16 hotspotIndex1, uint16 hotspotIndex2, uint16 endIndex, + int16 &duration, uint16 &id, uint16 &index, bool &finished); + // Finding specific hotspots /** Find the hotspot index that corresponds to the input index. */ uint16 inputToHotspot(uint16 input) const; /** Find the input index that corresponds to the hotspot index. */ uint16 hotspotToInput(uint16 hotspot) const; /** Find the input that was clicked on. */ uint16 findClickedInput(uint16 index) const; + /** Find the first input hotspot with a leave function. */ + bool findFirstInputLeave(uint16 &id, uint16 &inputId, uint16 &index) const; + /** Find the hotspot with the matching key, case sensitively. */ + bool findKey(uint16 key, uint16 &id, uint16 &index) const; + /** Find the hotspot with the matching key, case insensitively. */ + bool findKeyCaseInsensitive(uint16 key, uint16 &id, uint16 &index) const; + /** Find the nth plain (without Type1 or Type2 state) hotspot. */ + bool findNthPlain(uint16 n, uint16 startIndex, uint16 &id, uint16 &index) const; + + /** Leave the nth plain (without Type1 or Type2 state) hotspot. */ + bool leaveNthPlain(uint16 n, uint16 startIndex, int16 timeVal, const uint16 *ids, + uint16 &id, uint16 &index, int16 &duration); + + // Hotspot ID variable access + void setCurrentHotspot(const uint16 *ids, uint16 id) const; + uint32 getCurrentHotspot() const; + + // String input functions + void cleanFloatString(const Hotspot &spot) const; + void checkStringMatch(const Hotspot &spot, const InputDesc &input, + uint16 inputPos) const; + void matchInputStrings(const InputDesc *inputs) const; + + uint16 convertSpecialKey(uint16 key) const; /** Calculate the graphical cursor position. */ void getTextCursorPos(const Video::FontDesc &font, const char *str, -- cgit v1.2.3 From 250a1a915a6645baa5586aebfe5978730bca9b5b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 6 Jul 2009 11:33:28 +0000 Subject: When a song isn't found, send a "stop handle" event so that the engine won't wait forever (e.g. in SQ4CD, perhaps others) svn-id: r42172 --- engines/sci/engine/ksound.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index d6369cfcd1..17f085028f 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -809,7 +809,10 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (!GET_SEL32V(obj, nodePtr) && obj.segment) { if (!s->resmgr->testResource(ResourceId(kResourceTypeSound, number))) { warning("Could not open song number %d", number); - return NULL_REG; + // Send a "stop handle" event so that the engine won't wait forever here + s->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED); + PUT_SEL32V(obj, signal, -1); + return s->r_acc; } debugC(2, kDebugLevelSound, "Initializing song number %d\n", number); -- cgit v1.2.3 From 3abc1e8375989b21d47f383f9184d74ca504951c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 6 Jul 2009 12:33:05 +0000 Subject: Removed all the current special cases coding for user (mouse press) waiting, and reimplemented it exactly the way the original did svn-id: r42173 --- engines/cruise/cruise_main.cpp | 80 +++++++++++------------------------------- engines/cruise/gfxModule.cpp | 7 ---- 2 files changed, 20 insertions(+), 67 deletions(-) diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index 26f66d4433..56f1c2c975 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -40,8 +40,6 @@ unsigned int timer = 0; gfxEntryStruct* linkedMsgList = NULL; -extern bool isBlack; - void drawBlackSolidBoxSmall() { // gfxModuleData.drawSolidBox(64,100,256,117,0); drawSolidBox(64, 100, 256, 117, 0); @@ -1343,6 +1341,8 @@ int CruiseEngine::processInput(void) { // Check for left mouse button click or Space to end user waiting if ((keyboardCode == Common::KEYCODE_SPACE) || (button == MB_LEFT)) userWait = 0; + + keyboardCode = Common::KEYCODE_INVALID; return 0; } @@ -1784,35 +1784,30 @@ void CruiseEngine::mainLoop(void) { // t_start=Osystem_GetTicks(); // readKeyboard(); - bool isUserWait = userWait != 0; + bool isUserWait = userWait != 0; playerDontAskQuit = processInput(); if (playerDontAskQuit) break; - if (isUserWait && !userWait) { - // User waiting has ended - changeScriptParamInList(-1, -1, &procHead, 9999, 0); - changeScriptParamInList(-1, -1, &relHead, 9999, 0); - - mainDraw(0); - flipScreen(); - } - if (enableUser) { userEnabled = 1; enableUser = 0; } - if (userWait < 1) { - manageScripts(&relHead); - manageScripts(&procHead); + if (isUserWait & !userWait) { + // User waiting has ended + changeScriptParamInList(-1, -1, &procHead, 9999, 0); + changeScriptParamInList(-1, -1, &relHead, 9999, 0); + } - removeFinishedScripts(&relHead); - removeFinishedScripts(&procHead); + manageScripts(&relHead); + manageScripts(&procHead); - processAnimation(); - } + removeFinishedScripts(&relHead); + removeFinishedScripts(&procHead); + + processAnimation(); if (remdo) { // ASSERT(0); @@ -1837,10 +1832,8 @@ void CruiseEngine::mainLoop(void) { PCFadeFlag = 0; /*if (!PCFadeFlag)*/ - if (!isUserWait) { - mainDraw(0); - flipScreen(); - } + mainDraw(userWait); + flipScreen(); if (userEnabled && !userWait && !autoTrack) { if (currentActiveMenu == -1) { @@ -1874,38 +1867,9 @@ void CruiseEngine::mainLoop(void) { changeCursor(CURSOR_NORMAL); } - if (isUserWait) { - // User Wait handling - if (userWait == 1) { - // Initial step - do { - // Make sure any previous mouse press is released - getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY); - } while (mouseButton != 0); - - ++userWait; -// mainDraw(0); -// flipScreen(); - } else { - // Standard handling -/* - manageScripts(&relHead); - manageScripts(&procHead); - - removeFinishedScripts(&relHead); - removeFinishedScripts(&procHead); -*/ - if (isBlack) { - // This is a bit of a hack to ensure that user waits directly after a palette fade - // have time to restore the palette before waiting starts - mainDraw(0); - flipScreen(); - } else { - // Draw the next screen - processAnimation(); - gfxModuleData_flipScreen(); - } - } + if (userWait == 1) { + // Waiting for press - original wait loop has been integrated into the + // main event loop continue; } @@ -1917,12 +1881,8 @@ void CruiseEngine::mainLoop(void) { char* pText = getText(autoMsg, autoOvl); - if (strlen(pText)) { + if (strlen(pText)) userWait = 1; - - mainDraw(0); - flipScreen(); - } } changeScriptParamInList(-1, -1, &relHead, 9998, 0); diff --git a/engines/cruise/gfxModule.cpp b/engines/cruise/gfxModule.cpp index 50e6587d90..47d3f49204 100644 --- a/engines/cruise/gfxModule.cpp +++ b/engines/cruise/gfxModule.cpp @@ -40,7 +40,6 @@ palEntry lpalette[256]; int palDirtyMin = 256; int palDirtyMax = -1; -bool isBlack = false; gfxModuleDataStruct gfxModuleData = { 0, // use Tandy @@ -238,12 +237,6 @@ void flip() { g_system->setPalette(paletteRGBA + palDirtyMin*4, palDirtyMin, palDirtyMax - palDirtyMin + 1); palDirtyMin = 256; palDirtyMax = -1; - - isBlack = true; - for (i = 0; i < 256; ++i) { - isBlack = (lpalette[i].R == 0) && (lpalette[i].G == 0) && (lpalette[i].B == 0); - if (!isBlack) break; - } } g_system->copyRectToScreen(globalScreen, 320, 0, 0, 320, 200); -- cgit v1.2.3 From b38c5f8c5c1f08db12e84d65a32be6462c38d232 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 6 Jul 2009 12:44:55 +0000 Subject: Proper handling of sound effects marked as music resources svn-id: r42174 --- engines/sci/engine/ksound.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 17f085028f..1e35efffaf 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -808,10 +808,18 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (!GET_SEL32V(obj, nodePtr) && obj.segment) { if (!s->resmgr->testResource(ResourceId(kResourceTypeSound, number))) { - warning("Could not open song number %d", number); - // Send a "stop handle" event so that the engine won't wait forever here - s->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED); - PUT_SEL32V(obj, signal, -1); + // Check if the resource exists as an audio resource - this can happen + // in SQ4CD and perhaps other games as well. If the resource exists, play + // it using map 65535 (sound effects map). + if (s->resmgr->testResource(ResourceId(kResourceTypeAudio, number))) { + // Found a relevant audio resource, play it + PUT_SEL32V(obj, signal, s->_sound.startAudio(65535, number)); + } else { + warning("Could not open song number %d", number); + // Send a "stop handle" event so that the engine won't wait forever here + s->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED); + PUT_SEL32V(obj, signal, -1); + } return s->r_acc; } @@ -966,6 +974,9 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } +/** + * Used for synthesized music playback + */ reg_t kDoSound(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (s->_kernel->_selectorMap.setVol != -1) return kDoSound_SCI1(s, funct_nr, argc, argv); @@ -975,7 +986,9 @@ reg_t kDoSound(EngineState *s, int funct_nr, int argc, reg_t *argv) { return kDoSound_SCI0(s, funct_nr, argc, argv); } -// Used for speech playback in CD games +/** + * Used for speech playback and digital soundtracks in CD games + */ reg_t kDoAudio(EngineState *s, int funct_nr, int argc, reg_t *argv) { Audio::Mixer *mixer = g_system->getMixer(); -- cgit v1.2.3 From de995433c6f7dcb7aac0c93870d08e5eaebe16c0 Mon Sep 17 00:00:00 2001 From: Joost Peters Date: Mon, 6 Jul 2009 13:09:50 +0000 Subject: add workaround for PSP compiler ICE svn-id: r42175 --- engines/gob/hotspots.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index 02d112869a..d47c31840d 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -1795,7 +1795,7 @@ uint32 Hotspots::getCurrentHotspot() const { } void Hotspots::cleanFloatString(const Hotspot &spot) const { - char tempStr[256]; + static char tempStr[256]; //the static keyword is unnecessary, but was added to work around a PSP compiler ICE. // Get the string strncpy0(tempStr, GET_VARO_STR(spot.key), 255); -- cgit v1.2.3 From 77c7c1cf813bc9bbc22d2ff3cf2a8d7af754bbf4 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Mon, 6 Jul 2009 13:52:47 +0000 Subject: Loop over the string instead of copying and then editing it (hopefully, the PSP GCC won't ICE again here :P) svn-id: r42176 --- engines/gob/hotspots.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index d47c31840d..fb8e29f528 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -1795,23 +1795,24 @@ uint32 Hotspots::getCurrentHotspot() const { } void Hotspots::cleanFloatString(const Hotspot &spot) const { - static char tempStr[256]; //the static keyword is unnecessary, but was added to work around a PSP compiler ICE. + char *to, *from; - // Get the string - strncpy0(tempStr, GET_VARO_STR(spot.key), 255); + to = from = GET_VARO_STR(spot.key); + for (int i = 0; (i < 257) && (*from != '\0'); i++, from++) { + char c = *from; + + // Skip spaces + if (c == ' ') + continue; - // Remove spaces - char *ptr; - while ((ptr = strchr(tempStr, ' '))) - _vm->_util->cutFromStr(tempStr, (ptr - tempStr), 1); + // Convert decimal separator if necessary + if ((_vm->_global->_language == kLanguageBritish) && (c == '.')) + c = ','; - // Exchange decimal separator if needed - if (_vm->_global->_language == kLanguageBritish) - while ((ptr = strchr(tempStr, '.'))) - *ptr = ','; + *to++ = c; + } - // Write it back - WRITE_VARO_STR(spot.key, tempStr); + *to = '\0'; } void Hotspots::checkStringMatch(const Hotspot &spot, const InputDesc &input, -- cgit v1.2.3 From 69a3e2759ed2682ef2c0cde8d77185bce4052019 Mon Sep 17 00:00:00 2001 From: Jordi Vilalta Prat Date: Mon, 6 Jul 2009 15:23:50 +0000 Subject: Groovie: Improve ROQ timing and audio sync (noticeable at least in the Clandestiny trailer) svn-id: r42177 --- engines/groovie/roq.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp index 28d0d23fc1..dcb8eafcb8 100644 --- a/engines/groovie/roq.cpp +++ b/engines/groovie/roq.cpp @@ -256,6 +256,7 @@ bool ROQPlayer::processBlock() { break; case 0x1013: // Hang assert(blockHeader.size == 0 && blockHeader.param == 0); + endframe = true; break; case 0x1020: // Mono sound samples ok = processBlockSoundMono(blockHeader); -- cgit v1.2.3 From 8f284ad396445549602369c9c2158280b9784fc2 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 6 Jul 2009 15:30:07 +0000 Subject: KQ6CD should be working correctly again svn-id: r42178 --- engines/sci/detection.cpp | 2 +- engines/sci/engine/kernel.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index 79088c86ff..9e73435977 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -1241,7 +1241,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "233394a5f33b475ae5975e7e9a420865", 8376352}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NONE}, 0, - 7, + SCI_VERSION_1_1, SCI_VERSION_1_1 }, diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 2f8461a34a..e2e13aea27 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -793,6 +793,11 @@ void Kernel::setDefaultKernelNames() { offset = 4; } } + + if (_resmgr->_sciVersion == SCI_VERSION_1_1) { + // HACK: KQ6CD calls unimplemented function 0x26 + _kernelNames[0x26] = "Dummy"; + } } #ifdef ENABLE_SCI32 -- cgit v1.2.3 From 30d1462da058b8e4f53e43885714556b1eaa0a55 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 6 Jul 2009 15:50:44 +0000 Subject: Swapped the music and audio resource check for SCI1.1 games. Digital sound effects are now preferred over the synthesized ones svn-id: r42179 --- engines/sci/engine/ksound.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 1e35efffaf..f1584bf975 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -807,20 +807,24 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { } if (!GET_SEL32V(obj, nodePtr) && obj.segment) { - if (!s->resmgr->testResource(ResourceId(kResourceTypeSound, number))) { - // Check if the resource exists as an audio resource - this can happen - // in SQ4CD and perhaps other games as well. If the resource exists, play - // it using map 65535 (sound effects map). - if (s->resmgr->testResource(ResourceId(kResourceTypeAudio, number))) { - // Found a relevant audio resource, play it - PUT_SEL32V(obj, signal, s->_sound.startAudio(65535, number)); - } else { + // In SCI1.1 games, sound effects are started from here. If we can find + // a relevant audio resource, play it, otherwise switch to synthesized + // effects. If the resource exists, play it using map 65535 (sound + // effects map) + if (s->resmgr->testResource(ResourceId(kResourceTypeAudio, number)) && + s->_version >= SCI_VERSION_1_1) { + // Found a relevant audio resource, play it + s->_sound.stopAudio(); + PUT_SEL32V(obj, signal, s->_sound.startAudio(65535, number)); + return s->r_acc; + } else { + if (!s->resmgr->testResource(ResourceId(kResourceTypeSound, number))) { warning("Could not open song number %d", number); // Send a "stop handle" event so that the engine won't wait forever here s->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED); PUT_SEL32V(obj, signal, -1); + return s->r_acc; } - return s->r_acc; } debugC(2, kDebugLevelSound, "Initializing song number %d\n", number); -- cgit v1.2.3 From c22010b3d2155c033e260bba267b7eb2409ce2ca Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 6 Jul 2009 16:17:03 +0000 Subject: Fix RTL from Kyra3 main menu. (It now doesn't quit ScummVM anymore) svn-id: r42180 --- engines/kyra/kyra_mr.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp index 871edd578d..a00b3a8956 100644 --- a/engines/kyra/kyra_mr.cpp +++ b/engines/kyra/kyra_mr.cpp @@ -310,16 +310,19 @@ Common::Error KyraEngine_MR::go() { break; case 3: - default: fadeOutMusic(60); _screen->fadeToBlack(60); uninitMainMenu(); quitGame(); running = false; + break; + + default: + break; } } - if (_showOutro) + if (_showOutro && !shouldQuit()) playVQA("CREDITS"); return Common::kNoError; -- cgit v1.2.3 From 219b0de0d2e30b14d1b6f767ec75fa00a7baf21d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 6 Jul 2009 16:22:14 +0000 Subject: Renamed SCI_VERSION_01 -> SCI_VERSION_01_EGA svn-id: r42181 --- engines/sci/detection.cpp | 34 +++++++++++++++++----------------- engines/sci/engine/game.cpp | 4 ++-- engines/sci/engine/kernel.cpp | 2 +- engines/sci/engine/ksound.cpp | 2 +- engines/sci/engine/savegame.cpp | 2 +- engines/sci/engine/script.cpp | 2 +- engines/sci/gfx/gfx_resmgr.cpp | 4 ++-- engines/sci/resource.cpp | 4 ++-- engines/sci/sci.h | 2 +- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index 9e73435977..f86810e6b9 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -949,8 +949,8 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "9ae2a13708d691cd42f9129173c4b39d", 820443}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, 0, - SCI_VERSION_01, - SCI_VERSION_01 + SCI_VERSION_01_EGA, + SCI_VERSION_01_EGA }, // King's Quest 1 SCI Remake - English DOS Non-Interactive Demo @@ -2066,8 +2066,8 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.001", 0, "9e33566515b18bee7915db448063bba2", 871853}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH}, 0, - SCI_VERSION_01, - SCI_VERSION_01 + SCI_VERSION_01_EGA, + SCI_VERSION_01_EGA }, // Mixed-Up Fairy Tales v1.000 - English DOS (supplied by markcoolio in bug report #2723791) @@ -2081,8 +2081,8 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "f79daa70390d73746742ffcfc3dc4471", 937580}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, 0, - SCI_VERSION_01, - SCI_VERSION_01 + SCI_VERSION_01_EGA, + SCI_VERSION_01_EGA }, // Mixed-Up Fairy Tales - English DOS Floppy (from jvprat) @@ -2095,8 +2095,8 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.003", 0, "dd6cef0c592eadb7e6be9a25307c57a2", 1344719}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, 0, - SCI_VERSION_01, - SCI_VERSION_01 + SCI_VERSION_01_EGA, + SCI_VERSION_01_EGA }, // Mixed-Up Mother Goose - English Amiga (from www.back2roots.org) @@ -2108,8 +2108,8 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "fb552ae550ca1dac19ed8f6a3767612d", 817191}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, 0, - SCI_VERSION_01, - SCI_VERSION_01 + SCI_VERSION_01_EGA, + SCI_VERSION_01_EGA }, // Mixed-Up Mother Goose v2.000 - English DOS Floppy (supplied by markcoolio in bug report #2723795) @@ -2119,8 +2119,8 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "b7ecd8ae9e254e80310b5a668b276e6e", 2948975}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, 0, - SCI_VERSION_01, - SCI_VERSION_01 + SCI_VERSION_01_EGA, + SCI_VERSION_01_EGA }, // Mixed-Up Mother Goose - English DOS CD (from jvprat) @@ -2520,7 +2520,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {NULL, 0, NULL, 0}}, Common::JA_JPN, Common::kPlatformPC98, 0, GUIO_NOSPEECH}, 0, SCI_VERSION_AUTODETECT, - SCI_VERSION_01 + SCI_VERSION_01_EGA }, // Quest for Glory 1 - Japanese PC-98 5.25" Floppy @@ -2533,7 +2533,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {NULL, 0, NULL, 0}}, Common::JA_JPN, Common::kPlatformPC98, 0, GUIO_NOSPEECH}, 0, SCI_VERSION_AUTODETECT, - SCI_VERSION_01 + SCI_VERSION_01_EGA }, // Quest for Glory 1 - English Amiga @@ -2606,7 +2606,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, 0, SCI_VERSION_AUTODETECT, - SCI_VERSION_01 + SCI_VERSION_01_EGA }, // Quest for Glory 2 - English (from FRG) @@ -2621,7 +2621,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, 0, SCI_VERSION_AUTODETECT, - SCI_VERSION_01 + SCI_VERSION_01_EGA }, // Quest for Glory 2 - English DOS @@ -2639,7 +2639,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, 0, SCI_VERSION_AUTODETECT, - SCI_VERSION_01 + SCI_VERSION_01_EGA }, // Quest for Glory 3 - English DOS Non-Interactive Demo (from FRG) diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index a1e7569967..7eb4c6731a 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -43,7 +43,7 @@ int _reset_graphics_input(EngineState *s) { gfx_color_t transparent = { PaletteEntry(), 0, -1, -1, 0 }; debug(2, "Initializing graphics"); - if (s->resmgr->_sciVersion <= SCI_VERSION_01 || (s->_flags & GF_SCI1_EGA)) { + if (s->resmgr->_sciVersion <= SCI_VERSION_01_EGA || (s->_flags & GF_SCI1_EGA)) { int i; for (i = 0; i < 16; i++) { @@ -181,7 +181,7 @@ static void _free_graphics_input(EngineState *s) { } int game_init_sound(EngineState *s, int sound_flags) { - if (s->resmgr->_sciVersion >= SCI_VERSION_01) + if (s->resmgr->_sciVersion >= SCI_VERSION_01_EGA) sound_flags |= SFX_STATE_FLAG_MULTIPLAY; s->sfx_init_flags = sound_flags; diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index e2e13aea27..80071b2847 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -832,7 +832,7 @@ bool Kernel::loadKernelNames() { switch (_resmgr->_sciVersion) { case SCI_VERSION_0: - case SCI_VERSION_01: + case SCI_VERSION_01_EGA: case SCI_VERSION_01_VGA: case SCI_VERSION_01_VGA_ODD: case SCI_VERSION_1: diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index f1584bf975..ef02f8ee21 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -154,7 +154,7 @@ void process_sound_events(EngineState *s) { /* Get all sound events, apply their SongHandle handle; int cue; - if (s->_version >= SCI_VERSION_01) + if (s->_version >= SCI_VERSION_01_EGA) return; /* SCI01 and later explicitly poll for everything */ diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index bfff828745..ade0304683 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -693,7 +693,7 @@ int _reset_graphics_input(EngineState *s); static void reconstruct_sounds(EngineState *s) { Song *seeker; - SongIteratorType it_type = s->resmgr->_sciVersion >= SCI_VERSION_01 ? SCI_SONG_ITERATOR_TYPE_SCI1 : SCI_SONG_ITERATOR_TYPE_SCI0; + SongIteratorType it_type = s->resmgr->_sciVersion >= SCI_VERSION_01_EGA ? SCI_SONG_ITERATOR_TYPE_SCI1 : SCI_SONG_ITERATOR_TYPE_SCI0; seeker = s->_sound._songlib._lib; diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index 2939c6a646..7db151148a 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -93,7 +93,7 @@ opcode_format g_opcode_formats[128][4] = { void script_adjust_opcode_formats(int res_version) { switch (res_version) { case SCI_VERSION_0: - case SCI_VERSION_01: + case SCI_VERSION_01_EGA: break; case SCI_VERSION_01_VGA: case SCI_VERSION_01_VGA_ODD: diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index bece7b234d..523a1e6ac4 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -530,9 +530,9 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) { int resid = GFXR_RES_ID(GFX_RESOURCE_TYPE_VIEW, nr); - if (_version < SCI_VERSION_01) + if (_version < SCI_VERSION_01_EGA) view = gfxr_draw_view0(resid, viewRes->data, viewRes->size, -1); - else if (_version == SCI_VERSION_01 || !_isVGA) + else if (_version == SCI_VERSION_01_EGA || !_isVGA) view = gfxr_draw_view0(resid, viewRes->data, viewRes->size, palette); else if (_version >= SCI_VERSION_01_VGA && _version <= SCI_VERSION_1) view = gfxr_draw_view1(resid, viewRes->data, viewRes->size, _staticPalette, false); diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 121def5949..15e05ea656 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -499,7 +499,7 @@ ResourceManager::ResourceManager(int version, int maxMemory) { } else if (testResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_MAIN_VOCAB))) { version = guessSciVersion(); if (version != SCI_VERSION_01_VGA) { - version = testResource(ResourceId(kResourceTypeVocab, 912)) ? SCI_VERSION_0 : SCI_VERSION_01; + version = testResource(ResourceId(kResourceTypeVocab, 912)) ? SCI_VERSION_0 : SCI_VERSION_01_EGA; } } else { version = guessSciVersion() ? SCI_VERSION_01_VGA : SCI_VERSION_0; @@ -525,7 +525,7 @@ ResourceManager::ResourceManager(int version, int maxMemory) { case SCI_VERSION_0: debug("Resmgr: Detected SCI0"); break; - case SCI_VERSION_01: + case SCI_VERSION_01_EGA: debug("Resmgr: Detected SCI01"); break; case SCI_VERSION_01_VGA: diff --git a/engines/sci/sci.h b/engines/sci/sci.h index 1fa9221fa7..4404165c53 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -71,7 +71,7 @@ struct SciGameDescription { enum SciGameVersions { SCI_VERSION_AUTODETECT = 0, SCI_VERSION_0 = 1, - SCI_VERSION_01 = 2, + SCI_VERSION_01_EGA = 2, SCI_VERSION_01_VGA = 3, SCI_VERSION_01_VGA_ODD = 4, SCI_VERSION_1 = 5, -- cgit v1.2.3 From 7f7edabbddbd5b797f4d62d9b9fb724bb3dfa797 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 7 Jul 2009 01:14:55 +0000 Subject: Bugfix so the game speed will correctly change after showing the credits when the game is restarted svn-id: r42196 --- engines/cruise/cruise_main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index 56f1c2c975..cb51401a29 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -512,6 +512,7 @@ void CruiseEngine::initAllData(void) { strcpy(lastOverlay, "AUTO00"); _gameSpeed = GAME_FRAME_DELAY_1; + _speedFlag = false; return; } -- cgit v1.2.3 From 5270c82523a1c224e979e436dbb9a75c95c2ec89 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 7 Jul 2009 02:49:33 +0000 Subject: Bugfix so that user delays work correctly svn-id: r42197 --- engines/cruise/cruise_main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index cb51401a29..faea3e1e3a 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -1292,11 +1292,6 @@ int CruiseEngine::processInput(void) { buttonDown = 0; } - if (userDelay && !userWait) { - userDelay--; - return 0; - } - // Check for Exit 'X' key if (keyboardCode == Common::KEYCODE_x) return 1; @@ -1796,6 +1791,11 @@ void CruiseEngine::mainLoop(void) { enableUser = 0; } + if (userDelay && !userWait) { + userDelay--; + continue; + } + if (isUserWait & !userWait) { // User waiting has ended changeScriptParamInList(-1, -1, &procHead, 9999, 0); -- cgit v1.2.3 From 7cc82cfea16b97a3660fea524c3b54aecbff8755 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 7 Jul 2009 02:51:42 +0000 Subject: Added workaround to briefly pause when displaying the first message of the shooting cut-scene, so it can be read properly svn-id: r42198 --- engines/cruise/function.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp index d0443ef458..0f0113afbf 100644 --- a/engines/cruise/function.cpp +++ b/engines/cruise/function.cpp @@ -817,6 +817,11 @@ int16 Op_AddMessage(void) { createTextObject(&cellHead, overlayIdx, var_8, var_6, var_4, var_2, color, masterScreen, currentScriptPtr->overlayNumber, currentScriptPtr->scriptNumber); + // WORKAROUND: The first message in the 'shooting cutscene' goes too fast on newer systems, + // so this introduces a delay so the user has more time to read the message + if ((overlayIdx == 46) && (var_8 == 0)) + userDelay = 3 * (1000 / GAME_FRAME_DELAY_2); + return 0; } -- cgit v1.2.3 From 3dd21aa218fe0f775fe3e1c1f208d7cd2bb3689a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 7 Jul 2009 06:23:09 +0000 Subject: Fix to the return values of the Op_GetMouseButton library function now allows the game's "Fisticuffs path" to work properly svn-id: r42199 --- engines/cruise/function.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp index 0f0113afbf..fb67cef91c 100644 --- a/engines/cruise/function.cpp +++ b/engines/cruise/function.cpp @@ -709,9 +709,7 @@ int16 Op_GetMouseButton(void) { getMouseStatus(&dummy, &mouseX, &mouseButton, &mouseY); - if (mouseButton) - return 1; - return 0; + return mouseButton; } int16 Op_AddCell(void) { -- cgit v1.2.3 From 0a8cd4a27d1b9ad7974697d6524b3455290f8990 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 7 Jul 2009 06:29:07 +0000 Subject: Removed unused define svn-id: r42200 --- engines/sci/engine/script.cpp | 2 -- engines/sci/engine/script.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index 7db151148a..e78f3fd77f 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -30,8 +30,6 @@ namespace Sci { -// #define SCRIPT_DEBUG - #define END Script_None opcode_format g_opcode_formats[128][4] = { diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h index 5b8dbe1869..98e5b08bb9 100644 --- a/engines/sci/engine/script.h +++ b/engines/sci/engine/script.h @@ -33,8 +33,6 @@ namespace Sci { struct EngineState; class ResourceManager; -/*#define SCRIPT_DEBUG */ - #define SCI_SCRIPTS_NR 1000 enum ScriptObjectTypes { -- cgit v1.2.3 From 2e3419c8cb22a686446777b45042436b5098c47f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 7 Jul 2009 06:53:53 +0000 Subject: Prevent a crash when the engine errors out before the game state is initialized svn-id: r42201 --- engines/sci/console.cpp | 6 ++++-- engines/sci/sci.cpp | 11 ++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 4ab10d9eb9..8f977c04c2 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -201,12 +201,14 @@ Console::~Console() { } void Console::preEnter() { - _vm->_gamestate->_sound.sfx_suspend(true); + if (_vm->_gamestate) + _vm->_gamestate->_sound.sfx_suspend(true); _vm->_mixer->pauseAll(true); } void Console::postEnter() { - _vm->_gamestate->_sound.sfx_suspend(false); + if (_vm->_gamestate) + _vm->_gamestate->_sound.sfx_suspend(false); _vm->_mixer->pauseAll(false); } diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 0826509a8b..fb5356ba64 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -89,6 +89,8 @@ SciEngine::SciEngine(OSystem *syst, const SciGameDescription *desc) Common::addDebugChannel(kDebugLevelScripts, "Scripts", "Notifies when scripts are unloaded"); Common::addDebugChannel(kDebugLevelGC, "GC", "Garbage Collector debugging"); + _gamestate = 0; + printf("SciEngine::SciEngine\n"); } @@ -251,11 +253,14 @@ Common::Error SciEngine::run() { // Invoked by error() when a severe error occurs GUI::Debugger *SciEngine::getDebugger() { - ExecStack *xs = &(_gamestate->_executionStack.back()); + if (_gamestate) { + ExecStack *xs = &(_gamestate->_executionStack.back()); + xs->addr.pc.offset = debugState.old_pc_offset; + xs->sp = debugState.old_sp; + } + debugState.runningStep = 0; // Stop multiple execution debugState.seeking = kDebugSeekNothing; // Stop special seeks - xs->addr.pc.offset = debugState.old_pc_offset; - xs->sp = debugState.old_sp; return _console; } -- cgit v1.2.3 From 1e568222e470eb711e1f1487de1642fd5c1725ea Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Tue, 7 Jul 2009 07:02:04 +0000 Subject: Set the correct sound rate for Personal Nightmare. svn-id: r42202 --- engines/agos/res_snd.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp index 60c79b2324..810f953bd7 100644 --- a/engines/agos/res_snd.cpp +++ b/engines/agos/res_snd.cpp @@ -527,6 +527,7 @@ void AGOSEngine::loadSound(uint16 sound, int16 pan, int16 vol, uint16 type) { void AGOSEngine::loadSound(uint16 sound, uint16 freq, uint16 flags) { byte *dst; uint32 offs, size = 0; + uint32 rate = 8000; if (_curSfxFile == NULL) return; @@ -570,13 +571,23 @@ void AGOSEngine::loadSound(uint16 sound, uint16 freq, uint16 flags) { offs = READ_BE_UINT32(dst + 8); } - // TODO: Handle other sound flags and frequency + if (getGameType() == GType_PN) { + if (freq == 0) { + rate = 4600; + } else if (freq == 1) { + rate = 7400; + } else { + rate = 9400; + } + } + + // TODO: Handle other sound flags in Amiga/AtariST versions if (flags == 2 && _sound->isSfxActive()) { - _sound->queueSound(dst + offs, sound, size, 8000); + _sound->queueSound(dst + offs, sound, size, rate); } else { if (flags == 0) _sound->stopSfx(); - _sound->playRawData(dst + offs, sound, size, 8000); + _sound->playRawData(dst + offs, sound, size, rate); } } -- cgit v1.2.3 From b50b5ae5a4d896a0319d661f16641e5b35855b60 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 7 Jul 2009 07:41:02 +0000 Subject: Removed the shooting workaround delay - the overlay number can vary, so it isn't a reliable way of identifying the specific message svn-id: r42205 --- engines/cruise/function.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp index fb67cef91c..6fe82f76d4 100644 --- a/engines/cruise/function.cpp +++ b/engines/cruise/function.cpp @@ -815,11 +815,6 @@ int16 Op_AddMessage(void) { createTextObject(&cellHead, overlayIdx, var_8, var_6, var_4, var_2, color, masterScreen, currentScriptPtr->overlayNumber, currentScriptPtr->scriptNumber); - // WORKAROUND: The first message in the 'shooting cutscene' goes too fast on newer systems, - // so this introduces a delay so the user has more time to read the message - if ((overlayIdx == 46) && (var_8 == 0)) - userDelay = 3 * (1000 / GAME_FRAME_DELAY_2); - return 0; } -- cgit v1.2.3 From c716e43a2bad7fbf7ad6e1ea0594a84cb24ae49b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 7 Jul 2009 07:44:25 +0000 Subject: - Added auto-detection for EGA graphics. As a result of this, GF_SCI1_EGA has been removed and versions SCI_VERSION_01_EGA and SCI_VERSION_01_VGA have been merged into SCI_VERSION_01 - Simplified the checks for EGA and VGA graphics - Fixed a bug in script_adjust_opcode_formats() - Simplified the code in GfxResManager::getView() a bit svn-id: r42206 --- engines/sci/detection.cpp | 40 ++++++++++++++++++------------------ engines/sci/engine/game.cpp | 12 +++++------ engines/sci/engine/kernel.cpp | 3 +-- engines/sci/engine/kgraphics.cpp | 20 +++++++++--------- engines/sci/engine/ksound.cpp | 2 +- engines/sci/engine/savegame.cpp | 2 +- engines/sci/engine/script.cpp | 3 +-- engines/sci/gfx/gfx_resmgr.cpp | 44 +++++++++++++++++++--------------------- engines/sci/gfx/gfx_resmgr.h | 6 ++---- engines/sci/gfx/gfx_resource.h | 11 +++++----- engines/sci/gfx/operations.cpp | 6 +++--- engines/sci/gfx/operations.h | 3 +-- engines/sci/gfx/res_view.cpp | 4 ++-- engines/sci/resource.cpp | 39 ++++++++++++++++++++++++++--------- engines/sci/resource.h | 3 +++ engines/sci/sci.cpp | 15 +++----------- engines/sci/sci.h | 24 +++++++--------------- engines/sci/vocabulary.cpp | 2 +- 18 files changed, 116 insertions(+), 123 deletions(-) diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index f86810e6b9..af03f1269c 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -457,7 +457,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.005", 0, "58942b1aa6d6ffeb66e9f8897fd4435f", 469243}, {"resource.006", 0, "8c767b3939add63d11274065e46aad04", 713158}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_SCI1_EGA, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -949,8 +949,8 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "9ae2a13708d691cd42f9129173c4b39d", 820443}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, 0, - SCI_VERSION_01_EGA, - SCI_VERSION_01_EGA + SCI_VERSION_01, + SCI_VERSION_01 }, // King's Quest 1 SCI Remake - English DOS Non-Interactive Demo @@ -2066,8 +2066,8 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.001", 0, "9e33566515b18bee7915db448063bba2", 871853}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH}, 0, - SCI_VERSION_01_EGA, - SCI_VERSION_01_EGA + SCI_VERSION_01, + SCI_VERSION_01 }, // Mixed-Up Fairy Tales v1.000 - English DOS (supplied by markcoolio in bug report #2723791) @@ -2081,8 +2081,8 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.004", 0, "f79daa70390d73746742ffcfc3dc4471", 937580}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, 0, - SCI_VERSION_01_EGA, - SCI_VERSION_01_EGA + SCI_VERSION_01, + SCI_VERSION_01 }, // Mixed-Up Fairy Tales - English DOS Floppy (from jvprat) @@ -2095,8 +2095,8 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.003", 0, "dd6cef0c592eadb7e6be9a25307c57a2", 1344719}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, 0, - SCI_VERSION_01_EGA, - SCI_VERSION_01_EGA + SCI_VERSION_01, + SCI_VERSION_01 }, // Mixed-Up Mother Goose - English Amiga (from www.back2roots.org) @@ -2108,8 +2108,8 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.002", 0, "fb552ae550ca1dac19ed8f6a3767612d", 817191}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, 0, - SCI_VERSION_01_EGA, - SCI_VERSION_01_EGA + SCI_VERSION_01, + SCI_VERSION_01 }, // Mixed-Up Mother Goose v2.000 - English DOS Floppy (supplied by markcoolio in bug report #2723795) @@ -2119,8 +2119,8 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "b7ecd8ae9e254e80310b5a668b276e6e", 2948975}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, 0, - SCI_VERSION_01_EGA, - SCI_VERSION_01_EGA + SCI_VERSION_01, + SCI_VERSION_01 }, // Mixed-Up Mother Goose - English DOS CD (from jvprat) @@ -2520,7 +2520,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {NULL, 0, NULL, 0}}, Common::JA_JPN, Common::kPlatformPC98, 0, GUIO_NOSPEECH}, 0, SCI_VERSION_AUTODETECT, - SCI_VERSION_01_EGA + SCI_VERSION_01 }, // Quest for Glory 1 - Japanese PC-98 5.25" Floppy @@ -2533,7 +2533,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {NULL, 0, NULL, 0}}, Common::JA_JPN, Common::kPlatformPC98, 0, GUIO_NOSPEECH}, 0, SCI_VERSION_AUTODETECT, - SCI_VERSION_01_EGA + SCI_VERSION_01 }, // Quest for Glory 1 - English Amiga @@ -2606,7 +2606,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH}, 0, SCI_VERSION_AUTODETECT, - SCI_VERSION_01_EGA + SCI_VERSION_01 }, // Quest for Glory 2 - English (from FRG) @@ -2621,7 +2621,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, 0, SCI_VERSION_AUTODETECT, - SCI_VERSION_01_EGA + SCI_VERSION_01 }, // Quest for Glory 2 - English DOS @@ -2639,7 +2639,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, 0, SCI_VERSION_AUTODETECT, - SCI_VERSION_01_EGA + SCI_VERSION_01 }, // Quest for Glory 3 - English DOS Non-Interactive Demo (from FRG) @@ -3125,7 +3125,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.001", 0, "454684e3a7a68cbca073945e50778447", 1187088}, {"resource.002", 0, "6dc668326cc22cb9e8bd8ca9e68d2a66", 1181249}, {NULL, 0, NULL, 0}}, Common::JA_JPN, Common::kPlatformPC98, 0, GUIO_NOSPEECH}, - GF_SCI1_EGA, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, @@ -3138,7 +3138,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.001", 0, "454684e3a7a68cbca073945e50778447", 1187088}, {"resource.002", 0, "6dc668326cc22cb9e8bd8ca9e68d2a66", 1181249}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC98, 0, GUIO_NOSPEECH}, - GF_SCI1_EGA, + 0, SCI_VERSION_AUTODETECT, SCI_VERSION_1 }, diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index 7eb4c6731a..e35fbf99f8 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -43,10 +43,8 @@ int _reset_graphics_input(EngineState *s) { gfx_color_t transparent = { PaletteEntry(), 0, -1, -1, 0 }; debug(2, "Initializing graphics"); - if (s->resmgr->_sciVersion <= SCI_VERSION_01_EGA || (s->_flags & GF_SCI1_EGA)) { - int i; - - for (i = 0; i < 16; i++) { + if (!s->resmgr->isVGA()) { + for (int i = 0; i < 16; i++) { if (gfxop_set_color(s->gfx_state, &(s->ega_colors[i]), gfx_sci0_image_colors[sci0_palette][i].r, gfx_sci0_image_colors[sci0_palette][i].g, gfx_sci0_image_colors[sci0_palette][i].b, 0, -1, -1)) { return 1; @@ -111,7 +109,7 @@ int _reset_graphics_input(EngineState *s) { s->iconbar_port = new GfxPort(s->visual, gfx_rect(0, 0, 320, 200), s->ega_colors[0], transparent); s->iconbar_port->_flags |= GFXW_FLAG_NO_IMPLICIT_SWITCH; - if (s->resmgr->_sciVersion >= SCI_VERSION_01_VGA) { + if (s->resmgr->isVGA()) { // This bit sets the foreground and background colors in VGA SCI games gfx_color_t fgcolor; gfx_color_t bgcolor; @@ -181,7 +179,7 @@ static void _free_graphics_input(EngineState *s) { } int game_init_sound(EngineState *s, int sound_flags) { - if (s->resmgr->_sciVersion >= SCI_VERSION_01_EGA) + if (s->resmgr->_sciVersion >= SCI_VERSION_01) sound_flags |= SFX_STATE_FLAG_MULTIPLAY; s->sfx_init_flags = sound_flags; @@ -466,7 +464,7 @@ int game_init(EngineState *s) { s->successor = NULL; // No successor s->_statusBarText.clear(); // Status bar is blank s->status_bar_foreground = 0; - s->status_bar_background = (s->resmgr->_sciVersion >= SCI_VERSION_01_VGA) ? 255 : 15; + s->status_bar_background = !s->resmgr->isVGA() ? 15 : 255; SystemString *str = &s->sys_strings->strings[SYS_STRING_PARSER_BASE]; str->name = strdup("parser-base"); diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 80071b2847..f869a3a9ea 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -832,8 +832,7 @@ bool Kernel::loadKernelNames() { switch (_resmgr->_sciVersion) { case SCI_VERSION_0: - case SCI_VERSION_01_EGA: - case SCI_VERSION_01_VGA: + case SCI_VERSION_01: case SCI_VERSION_01_VGA_ODD: case SCI_VERSION_1: case SCI_VERSION_1_1: diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 487813a4c7..435dd39d5a 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -269,7 +269,7 @@ void graph_restore_box(EngineState *s, reg_t handle) { } PaletteEntry get_pic_color(EngineState *s, int color) { - if (s->resmgr->_sciVersion < SCI_VERSION_01_VGA) + if (!s->resmgr->isVGA()) return s->ega_colors[color].visual; if (color == -1 || color == 255) // -1 occurs in Eco Quest 1. Not sure if this is the best approach, but it seems to work @@ -286,7 +286,7 @@ PaletteEntry get_pic_color(EngineState *s, int color) { static gfx_color_t graph_map_color(EngineState *s, int color, int priority, int control) { gfx_color_t retval; - if (s->resmgr->_sciVersion < SCI_VERSION_01_VGA) { + if (!s->resmgr->isVGA()) { retval = s->ega_colors[(color >=0 && color < 16)? color : 0]; gfxop_set_color(s->gfx_state, &retval, (color < 0) ? -1 : retval.visual.r, retval.visual.g, retval.visual.b, (color == -1) ? 255 : 0, priority, control); @@ -502,7 +502,7 @@ reg_t kGraph(EngineState *s, int funct_nr, int argc, reg_t *argv) { case K_GRAPH_GET_COLORS_NR: - return make_reg(0, s->resmgr->_sciVersion < SCI_VERSION_01_VGA ? 0x10 : 0x100); + return make_reg(0, !s->resmgr->isVGA() ? 0x10 : 0x100); break; case K_GRAPH_DRAW_LINE: { @@ -2502,7 +2502,7 @@ reg_t kNewWindow(EngineState *s, int funct_nr, int argc, reg_t *argv) { int16 bgColor = (argc > 8 + argextra) ? argv[8 + argextra].toSint16() : 255; if (bgColor >= 0) { - if (s->resmgr->_sciVersion < SCI_VERSION_01_VGA) + if (!s->resmgr->isVGA()) bgcolor.visual = get_pic_color(s, MIN(bgColor, 15)); else bgcolor.visual = get_pic_color(s, bgColor); @@ -2528,7 +2528,7 @@ reg_t kNewWindow(EngineState *s, int funct_nr, int argc, reg_t *argv) { black.alpha = 0; black.control = -1; black.priority = -1; - lWhite.visual = get_pic_color(s, s->resmgr->_sciVersion < SCI_VERSION_01_VGA ? 15 : 255); + lWhite.visual = get_pic_color(s, !s->resmgr->isVGA() ? 15 : 255); lWhite.mask = GFX_MASK_VISUAL; lWhite.alpha = 0; lWhite.priority = -1; @@ -3149,7 +3149,7 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) { bg_color = port->_bgcolor; // TODO: in SCI1VGA the default colors for text and background are #0 (black) // SCI0 case should be checked - if (s->resmgr->_sciVersion >= SCI_VERSION_01_VGA) { + if (s->resmgr->isVGA()) { // This priority check fixes the colors in the menus in KQ5 // TODO/FIXME: Is this correct? if (color0.priority >= 0) @@ -3191,10 +3191,10 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) { temp = argv[argpt++].toSint16(); debugC(2, kDebugLevelGraphics, "Display: set_color(%d)\n", temp); - if ((s->resmgr->_sciVersion < SCI_VERSION_01_VGA) && temp >= 0 && temp <= 15) + if (!s->resmgr->isVGA() && temp >= 0 && temp <= 15) color0 = (s->ega_colors[temp]); else - if (s->resmgr->_sciVersion >= SCI_VERSION_01_VGA && temp >= 0 && temp < 256) { + if (s->resmgr->isVGA() && temp >= 0 && temp < 256) { color0.visual = get_pic_color(s, temp); color0.mask = GFX_MASK_VISUAL; } else @@ -3208,10 +3208,10 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) { temp = argv[argpt++].toSint16(); debugC(2, kDebugLevelGraphics, "Display: set_bg_color(%d)\n", temp); - if (s->resmgr->_sciVersion < SCI_VERSION_01_VGA && temp >= 0 && temp <= 15) + if (!s->resmgr->isVGA() && temp >= 0 && temp <= 15) bg_color = s->ega_colors[temp]; else - if ((s->resmgr->_sciVersion >= SCI_VERSION_01_VGA) && temp >= 0 && temp <= 256) { + if (s->resmgr->isVGA() && temp >= 0 && temp <= 256) { bg_color.visual = get_pic_color(s, temp); bg_color.mask = GFX_MASK_VISUAL; } else diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index ef02f8ee21..f1584bf975 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -154,7 +154,7 @@ void process_sound_events(EngineState *s) { /* Get all sound events, apply their SongHandle handle; int cue; - if (s->_version >= SCI_VERSION_01_EGA) + if (s->_version >= SCI_VERSION_01) return; /* SCI01 and later explicitly poll for everything */ diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index ade0304683..bfff828745 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -693,7 +693,7 @@ int _reset_graphics_input(EngineState *s); static void reconstruct_sounds(EngineState *s) { Song *seeker; - SongIteratorType it_type = s->resmgr->_sciVersion >= SCI_VERSION_01_EGA ? SCI_SONG_ITERATOR_TYPE_SCI1 : SCI_SONG_ITERATOR_TYPE_SCI0; + SongIteratorType it_type = s->resmgr->_sciVersion >= SCI_VERSION_01 ? SCI_SONG_ITERATOR_TYPE_SCI1 : SCI_SONG_ITERATOR_TYPE_SCI0; seeker = s->_sound._songlib._lib; diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index e78f3fd77f..991955cd67 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -91,9 +91,8 @@ opcode_format g_opcode_formats[128][4] = { void script_adjust_opcode_formats(int res_version) { switch (res_version) { case SCI_VERSION_0: - case SCI_VERSION_01_EGA: break; - case SCI_VERSION_01_VGA: + case SCI_VERSION_01: case SCI_VERSION_01_VGA_ODD: case SCI_VERSION_1: case SCI_VERSION_1_1: diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index 523a1e6ac4..5a1556ca41 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -49,14 +49,14 @@ struct param_struct { GfxDriver *driver; }; -GfxResManager::GfxResManager(int version, bool isVGA, gfx_options_t *options, GfxDriver *driver, ResourceManager *resManager) : - _version(version), _isVGA(isVGA), _options(options), _driver(driver), _resManager(resManager), +GfxResManager::GfxResManager(int version, gfx_options_t *options, GfxDriver *driver, ResourceManager *resManager) : + _version(version), _options(options), _driver(driver), _resManager(resManager), _lockCounter(0), _tagLockCounter(0), _staticPalette(0) { gfxr_init_static_palette(); _portBounds = Common::Rect(0, 10, 320, 200); // default value, with a titlebar of 10px - if (_version < SCI_VERSION_01_VGA || !_isVGA) { + if (!_resManager->isVGA()) { _staticPalette = gfx_sci0_pic_colors->getref(); } else if (_version == SCI_VERSION_1_1) { debugC(2, kDebugLevelGraphics, "Palettes are not yet supported in this SCI version\n"); @@ -99,7 +99,7 @@ int GfxResManager::calculatePic(gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic if (_version == SCI_VERSION_1_1) gfxr_draw_pic11(unscaled_pic, flags, default_palette, res->size, res->data, &basic_style, res->id.number, _staticPalette, _portBounds); else - gfxr_draw_pic01(unscaled_pic, flags, default_palette, res->size, res->data, &basic_style, res->id.number, _isVGA, _staticPalette, _portBounds); + gfxr_draw_pic01(unscaled_pic, flags, default_palette, res->size, res->data, &basic_style, res->id.number, _resManager->isVGA(), _staticPalette, _portBounds); } if (scaled_pic && scaled_pic->undithered_buffer) @@ -108,9 +108,9 @@ int GfxResManager::calculatePic(gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic if (_version == SCI_VERSION_1_1) gfxr_draw_pic11(scaled_pic, flags, default_palette, res->size, res->data, &style, res->id.number, _staticPalette, _portBounds); else - gfxr_draw_pic01(scaled_pic, flags, default_palette, res->size, res->data, &style, res->id.number, _isVGA, _staticPalette, _portBounds); + gfxr_draw_pic01(scaled_pic, flags, default_palette, res->size, res->data, &style, res->id.number, _resManager->isVGA(), _staticPalette, _portBounds); - if (!_isVGA) { + if (!_resManager->isVGA()) { if (need_unscaled) gfxr_remove_artifacts_pic0(scaled_pic, unscaled_pic); @@ -144,7 +144,7 @@ int GfxResManager::getOptionsHash(gfx_resource_type_t type) { case GFX_RESOURCE_TYPE_PIC: #ifdef CUSTOM_GRAPHICS_OPTIONS - if (_version >= SCI_VERSION_01_VGA) + if (_resManager->isVGA()) // NOTE: here, it is assumed that the upper port bound is always 10, but this doesn't seem to matter for the // generated options hash anyway return 10; @@ -153,7 +153,7 @@ int GfxResManager::getOptionsHash(gfx_resource_type_t type) { | (_options->pic0_dither_pattern << 8) | (_options->pic0_brush_mode << 4) | (_options->pic0_line_mode); #else - if (_version >= SCI_VERSION_01_VGA) + if (_resManager->isVGA()) return 10; else return 0x10000 | (GFXR_DITHER_PATTERN_SCALED << 8) | (GFX_BRUSH_MODE_RANDOM_ELLIPSES << 4) | GFX_LINE_MODE_CORRECT; @@ -340,12 +340,12 @@ gfxr_pic_t *GfxResManager::getPic(int num, int maps, int flags, int default_pale #ifdef CUSTOM_GRAPHICS_OPTIONS if (_options->pic0_unscaled) { need_unscaled = 0; - pic = gfxr_init_pic(&mode_1x1_color_index, GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _version >= SCI_VERSION_01_VGA); + pic = gfxr_init_pic(&mode_1x1_color_index, GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resManager->isVGA()); } else - pic = gfxr_init_pic(_driver->getMode(), GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _version >= SCI_VERSION_01_VGA); + pic = gfxr_init_pic(_driver->getMode(), GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resManager->isVGA()); #else need_unscaled = 0; - pic = gfxr_init_pic(_driver->getMode(), GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _version >= SCI_VERSION_01_VGA); + pic = gfxr_init_pic(_driver->getMode(), GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resManager->isVGA()); #endif if (!pic) { @@ -356,7 +356,7 @@ gfxr_pic_t *GfxResManager::getPic(int num, int maps, int flags, int default_pale gfxr_clear_pic0(pic, SCI_TITLEBAR_SIZE); if (need_unscaled) { - unscaled_pic = gfxr_init_pic(&mode_1x1_color_index, GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _version >= SCI_VERSION_01_VGA); + unscaled_pic = gfxr_init_pic(&mode_1x1_color_index, GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resManager->isVGA()); if (!unscaled_pic) { error("Failed to allocate unscaled pic"); return NULL; @@ -529,17 +529,16 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) { return NULL; int resid = GFXR_RES_ID(GFX_RESOURCE_TYPE_VIEW, nr); + + if (!_resManager->isVGA()) { + int pal = (_version == SCI_VERSION_0) ? -1 : palette; + view = getEGAView(resid, viewRes->data, viewRes->size, pal); + } else { + if (_version < SCI_VERSION_1_1) + view = getVGAView(resid, viewRes->data, viewRes->size, _staticPalette, false); + else + view = getVGAView(resid, viewRes->data, viewRes->size, 0, true); - if (_version < SCI_VERSION_01_EGA) - view = gfxr_draw_view0(resid, viewRes->data, viewRes->size, -1); - else if (_version == SCI_VERSION_01_EGA || !_isVGA) - view = gfxr_draw_view0(resid, viewRes->data, viewRes->size, palette); - else if (_version >= SCI_VERSION_01_VGA && _version <= SCI_VERSION_1) - view = gfxr_draw_view1(resid, viewRes->data, viewRes->size, _staticPalette, false); - else if (_version >= SCI_VERSION_1_1) - view = gfxr_draw_view1(resid, viewRes->data, viewRes->size, 0, true); - - if (_isVGA) { if (!view->palette) { view->palette = new Palette(_staticPalette->size()); view->palette->name = "interpreter_get_view"; @@ -553,7 +552,6 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) { view->palette->setColor(i, sc.r, sc.g, sc.b); } } - } if (!res) { diff --git a/engines/sci/gfx/gfx_resmgr.h b/engines/sci/gfx/gfx_resmgr.h index 1f0f58dce9..8230e84aa0 100644 --- a/engines/sci/gfx/gfx_resmgr.h +++ b/engines/sci/gfx/gfx_resmgr.h @@ -90,7 +90,7 @@ typedef Common::HashMap IntResMap; /** Graphics resource manager */ class GfxResManager { public: - GfxResManager(int version, bool isVGA, gfx_options_t *options, + GfxResManager(int version, gfx_options_t *options, GfxDriver *driver, ResourceManager *resManager); ~GfxResManager(); @@ -311,14 +311,12 @@ public: * * @return Number of pallete entries */ - int getColorCount() - { + int getColorCount() { return _staticPalette ? _staticPalette->size() : 0; } private: int _version; - bool _isVGA; gfx_options_t *_options; GfxDriver *_driver; Palette *_staticPalette; diff --git a/engines/sci/gfx/gfx_resource.h b/engines/sci/gfx/gfx_resource.h index 780060bc4f..9c83cf07cd 100644 --- a/engines/sci/gfx/gfx_resource.h +++ b/engines/sci/gfx/gfx_resource.h @@ -245,7 +245,7 @@ void gfxr_remove_artifacts_pic0(gfxr_pic_t *dest, gfxr_pic_t *src); void gfxr_dither_pic0(gfxr_pic_t *pic, int mode, int pattern); /** - * Calculates a SCI0 view. + * Calculates an EGA view. * * @param[in] id Resource ID of the view * @param[in] resource Pointer to the resource to read @@ -253,7 +253,7 @@ void gfxr_dither_pic0(gfxr_pic_t *pic, int mode, int pattern); * @param[in] palette The palette to use * @return The resulting view */ -gfxr_view_t *gfxr_draw_view0(int id, byte *resource, int size, int palette); +gfxr_view_t *getEGAView(int id, byte *resource, int size, int palette); /** * Calculates a SCI cursor. @@ -265,8 +265,7 @@ gfxr_view_t *gfxr_draw_view0(int id, byte *resource, int size, int palette); * @return A newly allocated pixmap containing an index color * representation of the cursor */ -gfx_pixmap_t *gfxr_draw_cursor(int id, byte *resource, int size, - bool isSci01); +gfx_pixmap_t *gfxr_draw_cursor(int id, byte *resource, int size, bool isSci01); /** @} */ @@ -304,7 +303,7 @@ Palette *gfxr_read_pal1_amiga(Common::File &file); Palette *gfxr_read_pal11(int id, byte *resource, int size); /** - * Calculates an SCI1 view. + * Calculates a VGA view. * * @param[in] id Resource ID of the view * @param[in] resource Pointer to the resource to read @@ -313,7 +312,7 @@ Palette *gfxr_read_pal11(int id, byte *resource, int size); * @param[in] isSci11 true if SCI1.1, false otherwise * @return The resulting view */ -gfxr_view_t *gfxr_draw_view1(int id, byte *resource, int size, Palette *static_pal, bool isSci11); +gfxr_view_t *getVGAView(int id, byte *resource, int size, Palette *static_pal, bool isSci11); gfx_pixmap_t *gfxr_draw_cel1(int id, int loop, int cel, int mirrored, byte *resource, byte *cel_base, int size, gfxr_view_t *view, bool isAmiga, bool isSci11); /** @} */ diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index ac8e0ef9b0..f714ab0245 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -404,7 +404,7 @@ static void init_aux_pixmap(gfx_pixmap_t **pixmap) { (*pixmap)->palette = new Palette(default_colors, DEFAULT_COLORS_NR); } -int gfxop_init(int version, bool isVGA, GfxState *state, gfx_options_t *options, ResourceManager *resManager, +int gfxop_init(int version, GfxState *state, gfx_options_t *options, ResourceManager *resManager, int xfact, int yfact, gfx_color_mode_t bpp) { //int color_depth = bpp ? bpp : 1; //int initialized = 0; @@ -423,8 +423,8 @@ int gfxop_init(int version, bool isVGA, GfxState *state, gfx_options_t *options, state->driver = new GfxDriver(xfact, yfact, bpp); - state->gfxResMan = new GfxResManager(version, isVGA, state->options, state->driver, resManager); - + state->gfxResMan = new GfxResManager(version, state->options, state->driver, resManager); + gfxop_set_clip_zone(state, gfx_rect(0, 0, 320, 200)); init_aux_pixmap(&(state->control_map)); diff --git a/engines/sci/gfx/operations.h b/engines/sci/gfx/operations.h index 491b485da0..b9a16d4a27 100644 --- a/engines/sci/gfx/operations.h +++ b/engines/sci/gfx/operations.h @@ -135,7 +135,6 @@ struct GfxState { * Initializes a graphics mode. * * @param[in] version The interpreter version - * @param[in] isVGA true if using VGA resolution * @param[in] state The state to initialize * @param[in] xfact Horizontal scale factor * @param[in] yfact Vertical scale factors @@ -147,7 +146,7 @@ struct GfxState { * is unavailable, or GFX_FATAL if the graphics driver * is unable to provide any useful graphics support */ -int gfxop_init(int version, bool isVGA, GfxState *state, gfx_options_t *options, +int gfxop_init(int version, GfxState *state, gfx_options_t *options, ResourceManager *resManager, int xfact = 1, int yfact = 1, gfx_color_mode_t bpp = GFX_COLOR_MODE_INDEX); diff --git a/engines/sci/gfx/res_view.cpp b/engines/sci/gfx/res_view.cpp index 41cb55fa75..d484136f8e 100644 --- a/engines/sci/gfx/res_view.cpp +++ b/engines/sci/gfx/res_view.cpp @@ -135,7 +135,7 @@ gfx_pixmap_t *gfxr_draw_cel0(int id, int loop, int cel, byte *resource, int size return retval; } -gfxr_view_t *gfxr_draw_view0(int id, byte *resource, int size, int palette) { +gfxr_view_t *getEGAView(int id, byte *resource, int size, int palette) { int i; gfxr_view_t *view; int mirror_bitpos = 1; @@ -365,7 +365,7 @@ gfx_pixmap_t *gfxr_draw_cel1(int id, int loop, int cel, int mirrored, byte *reso return retval; } -gfxr_view_t *gfxr_draw_view1(int id, byte *resource, int size, Palette *static_pal, bool isSci11) { +gfxr_view_t *getVGAView(int id, byte *resource, int size, Palette *static_pal, bool isSci11) { uint16 palOffset = READ_LE_UINT16(resource + V1_PALETTE_OFFSET + (isSci11 ? 2 : 0)); uint16 headerSize = isSci11 ? READ_LE_UINT16(resource + V2_HEADER_SIZE) : 0; byte* seeker = resource + headerSize; diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 15e05ea656..a9de8ba112 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -358,7 +358,7 @@ int ResourceManager::guessSciVersion() { file.close(); if (compression == 3) { - return SCI_VERSION_01_VGA; + return SCI_VERSION_01; } } @@ -382,7 +382,7 @@ int ResourceManager::guessSciVersion() { file.close(); if (compression == 3) { - return SCI_VERSION_01_VGA; + return SCI_VERSION_01; } } @@ -495,14 +495,14 @@ ResourceManager::ResourceManager(int version, int maxMemory) { switch (_mapVersion) { case SCI_VERSION_0: if (testResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_MAIN_VOCAB))) { - version = guessSciVersion() ? SCI_VERSION_01_VGA : SCI_VERSION_0; + version = guessSciVersion() ? SCI_VERSION_01 : SCI_VERSION_0; } else if (testResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_MAIN_VOCAB))) { version = guessSciVersion(); - if (version != SCI_VERSION_01_VGA) { - version = testResource(ResourceId(kResourceTypeVocab, 912)) ? SCI_VERSION_0 : SCI_VERSION_01_EGA; + if (version != SCI_VERSION_01) { + version = testResource(ResourceId(kResourceTypeVocab, 912)) ? SCI_VERSION_0 : SCI_VERSION_01; } } else { - version = guessSciVersion() ? SCI_VERSION_01_VGA : SCI_VERSION_0; + version = guessSciVersion() ? SCI_VERSION_01 : SCI_VERSION_0; } break; case SCI_VERSION_01_VGA_ODD: @@ -519,18 +519,37 @@ ResourceManager::ResourceManager(int version, int maxMemory) { version = SCI_VERSION_AUTODETECT; } + _isVGA = false; + + // Determine if the game is using EGA graphics or not + if (version == SCI_VERSION_0) { + _isVGA = false; // There is no SCI0 VGA game + } else if (version >= SCI_VERSION_1_1) { + _isVGA = true; // There is no SCI11 EGA game + } else { + // SCI01 or SCI1: EGA games have the second byte of their views set + // to 0, VGA ones to non-zero + int i = 0; + + while (true) { + Resource *res = findResource(ResourceId(kResourceTypeView, i), 0); + if (res) { + _isVGA = (res->data[1] != 0); + break; + } + i++; + } + } + _sciVersion = version; // temporary version printout - should be reworked later switch (_sciVersion) { case SCI_VERSION_0: debug("Resmgr: Detected SCI0"); break; - case SCI_VERSION_01_EGA: + case SCI_VERSION_01: debug("Resmgr: Detected SCI01"); break; - case SCI_VERSION_01_VGA: - debug("Resmgr: Detected SCI01VGA - KQ5 or similar"); - break; case SCI_VERSION_01_VGA_ODD: debug("Resmgr: Detected SCI01VGA - Jones/CD or similar"); break; diff --git a/engines/sci/resource.h b/engines/sci/resource.h index 8ef42b171d..ad9e7a1d8d 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -214,6 +214,8 @@ public: int _mapVersion; //!< RESOURCE.MAP version int _volVersion; //!< RESOURCE.0xx version + bool isVGA() const { return _isVGA; } + /** * Creates a new SCI resource manager. * @param version The SCI version to look for; use SCI_VERSION_AUTODETECT @@ -265,6 +267,7 @@ public: void setAudioLanguage(int language); protected: + bool _isVGA; // Used to determine if the game has EGA or VGA graphics int _maxMemory; //!< Config option: Maximum total byte number allocated Common::List _sources; int _memoryLocked; //!< Amount of resource bytes in locked memory diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index fb5356ba64..698983acaf 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -43,11 +43,10 @@ namespace Sci { class GfxDriver; -const char *versionNames[8] = { +const char *versionNames[7] = { "Autodetected", "SCI0", - "SCI01 EGA", - "SCI01 VGA", + "SCI01", "SCI01 VGA ODD", "SCI1", "SCI1.1", @@ -151,9 +150,6 @@ Common::Error SciEngine::run() { // Verify that we haven't got an invalid game detection entry if (version < SCI_VERSION_1) { // SCI0/SCI01 - if (flags & GF_SCI1_EGA) { - error("This game entry is erroneous. It's marked as SCI0/SCI01, but it has SCI1 flags set"); - } } else if (version == SCI_VERSION_1) { // SCI1 @@ -162,10 +158,6 @@ Common::Error SciEngine::run() { error("This game entry is erroneous. It's marked as SCI1, but it has SCI0 flags set"); } } else if (version == SCI_VERSION_1_1 || version == SCI_VERSION_32) { - if (flags & GF_SCI1_EGA) { - error("This game entry is erroneous. It's marked as SCI1.1/SCI32, but it has SCI1 flags set"); - } - if (flags & GF_SCI0_OLD || flags & GF_SCI0_OLDGETTIME) { error("This game entry is erroneous. It's marked as SCI1.1/SCI32, but it has SCI0 flags set"); @@ -218,8 +210,7 @@ Common::Error SciEngine::run() { // Default config ends #endif - bool isVGA = _resmgr->_sciVersion >= SCI_VERSION_01_VGA && !(getFlags() & GF_SCI1_EGA); - if (gfxop_init(_resmgr->_sciVersion, isVGA, &gfx_state, &gfx_options, _resmgr)) { + if (gfxop_init(_resmgr->_sciVersion, &gfx_state, &gfx_options, _resmgr)) { warning("Graphics initialization failed. Aborting..."); return Common::kUnknownError; } diff --git a/engines/sci/sci.h b/engines/sci/sci.h index 4404165c53..82a0f80b34 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -71,15 +71,14 @@ struct SciGameDescription { enum SciGameVersions { SCI_VERSION_AUTODETECT = 0, SCI_VERSION_0 = 1, - SCI_VERSION_01_EGA = 2, - SCI_VERSION_01_VGA = 3, - SCI_VERSION_01_VGA_ODD = 4, - SCI_VERSION_1 = 5, - SCI_VERSION_1_1 = 6, - SCI_VERSION_32 = 7 + SCI_VERSION_01 = 2, + SCI_VERSION_01_VGA_ODD = 3, + SCI_VERSION_1 = 4, + SCI_VERSION_1_1 = 5, + SCI_VERSION_32 = 6 }; -extern const char *versionNames[8]; +extern const char *versionNames[7]; enum SciGameFlags { // SCI0 flags @@ -96,16 +95,7 @@ enum SciGameFlags { /* Applies to all versions before 0.000.629 * Older SCI versions had simpler code for GetTime() */ - GF_SCI0_OLDGETTIME = (1 << 1), - - // ---------------------------------------------------------------------------- - - // SCI1 flags - - /* - * Used to distinguish SCI1 EGA games - */ - GF_SCI1_EGA = (1 << 2) + GF_SCI0_OLDGETTIME = (1 << 1) }; class SciEngine : public Engine { diff --git a/engines/sci/vocabulary.cpp b/engines/sci/vocabulary.cpp index dd56cdf88a..5253e7885b 100644 --- a/engines/sci/vocabulary.cpp +++ b/engines/sci/vocabulary.cpp @@ -91,7 +91,7 @@ Vocabulary::Vocabulary(ResourceManager *resmgr) : _resmgr(resmgr) { debug(2, "Initializing vocabulary"); - if (_resmgr->_sciVersion < SCI_VERSION_01_VGA && loadParserWords()) { + if (_resmgr->_sciVersion <= SCI_VERSION_01 && loadParserWords()) { loadSuffixes(); if (loadBranches()) // Now build a GNF grammar out of this -- cgit v1.2.3 From 45b7e5bbc2ef9d70b004d5c341334f92448c373d Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Tue, 7 Jul 2009 07:51:18 +0000 Subject: Add detection of Playtoons 2 En svn-id: r42208 --- engines/gob/detection.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/engines/gob/detection.cpp b/engines/gob/detection.cpp index 9426c01ef2..f8a590e57e 100644 --- a/engines/gob/detection.cpp +++ b/engines/gob/detection.cpp @@ -3433,6 +3433,24 @@ static const GOBGameDescription gameDescriptions[] = { kFeatures640 | kFeaturesSCNDemo, 0, 0, 6 }, + { + { + "playtoons2", + "", + { + {"playtoon.stk", 0, "4772c96be88a57f0561519e4a1526c62", 24406262}, + {"spirou.stk", 0, "5d9c7644d0c47840169b4d016765cc1a", 9816201}, + {0, 0, 0, 0} + }, + EN_ANY, + kPlatformPC, + ADGF_NO_FLAGS, + GUIO_NOSUBTITLES | GUIO_NOSPEECH + }, + kGameTypePlaytoon, + kFeatures640, + "intro2.stk", 0, 0 + }, { { "playtoons2", -- cgit v1.2.3 From e4f6330418d0261c5270d178c39412b8a850c6b7 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 7 Jul 2009 07:51:26 +0000 Subject: Added a SCI1.1 case in the lofss opcode, like in the lofsa opcode (essentially, lofss and lofsa both load an offset, with lofsa loading it in the accumulator and lofss in the stack). lofss is rarely used in SCI1.1 games, which explains why no lofss-related crashes have been observed in SCI1.1 svn-id: r42209 --- engines/sci/engine/vm.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 09ed541d17..b3852f10ef 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -1211,10 +1211,15 @@ void run_vm(EngineState *s, int restoring) { case 0x3a: // lofss r_temp.segment = xs->addr.pc.segment; - if (s->_kernel->hasLofsAbsolute()) - r_temp.offset = opparams[0]; - else - r_temp.offset = xs->addr.pc.offset + opparams[0]; + if (s->_version >= SCI_VERSION_1_1) { + r_temp.offset = opparams[0] + local_script->script_size; + } else { + if (s->_kernel->hasLofsAbsolute()) + r_temp.offset = opparams[0]; + else + r_temp.offset = xs->addr.pc.offset + opparams[0]; + } + #ifndef DISABLE_VALIDATIONS if (r_temp.offset >= code_buf_size) { error("VM: lofss operation overflowed: %04x:%04x beyond end" -- cgit v1.2.3 From d55f7e72d0af649c472ccc8bb34a408ead3ae7f4 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 7 Jul 2009 10:28:05 +0000 Subject: Added auto-detection for games with older headers for script blocks, and removed game flag GF_SCI0_OLD svn-id: r42211 --- engines/sci/detection.cpp | 9 ++++---- engines/sci/engine/game.cpp | 8 +++---- engines/sci/engine/kernel.cpp | 47 +++++++++++++++++++++++++++++++++----- engines/sci/engine/kernel.h | 24 +++++++++++++++---- engines/sci/engine/kgraphics.cpp | 2 +- engines/sci/engine/savegame.cpp | 2 +- engines/sci/engine/scriptdebug.cpp | 2 +- engines/sci/engine/seg_manager.cpp | 2 +- engines/sci/engine/vm.cpp | 14 ++++++------ engines/sci/engine/vm.h | 2 +- engines/sci/sci.cpp | 10 ++------ engines/sci/sci.h | 11 +-------- 12 files changed, 84 insertions(+), 49 deletions(-) diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index af03f1269c..a9dac98572 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -31,7 +31,6 @@ namespace Sci { -#define GF_FOR_SCI0_BEFORE_395 (GF_SCI0_OLD | GF_SCI0_OLDGETTIME) #define GF_FOR_SCI0_BEFORE_629 GF_SCI0_OLDGETTIME // Titles of the games @@ -219,7 +218,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.map", 0, "39485580d34a72997f3d5b3aba4d24f1", 426}, {"resource.001", 0, "11391434f41c834090d7a1e9488ce936", 129739}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI0_BEFORE_395, + GF_FOR_SCI0_BEFORE_629, SCI_VERSION_AUTODETECT, SCI_VERSION_0 }, @@ -1032,7 +1031,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.006", 0, "851a62d00972dc4002f472cc0d84e71d", 333777}, {"resource.007", 0, "851a62d00972dc4002f472cc0d84e71d", 341038}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI0_BEFORE_395, + GF_FOR_SCI0_BEFORE_629, SCI_VERSION_AUTODETECT, SCI_VERSION_0 }, @@ -1049,7 +1048,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.006", 0, "0c8566848a76eea19a6d6220914030a7", 337288}, {"resource.007", 0, "0c8566848a76eea19a6d6220914030a7", 343882}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI0_BEFORE_395, + GF_FOR_SCI0_BEFORE_629, SCI_VERSION_AUTODETECT, SCI_VERSION_0 }, @@ -1616,7 +1615,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.005", 0, "96033f57accfca903750413fd09193c8", 274953}, {"resource.006", 0, "96033f57accfca903750413fd09193c8", 345818}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, - GF_FOR_SCI0_BEFORE_395, + GF_FOR_SCI0_BEFORE_629, SCI_VERSION_AUTODETECT, SCI_VERSION_0 }, diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index e35fbf99f8..ea03705fc2 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -257,7 +257,7 @@ static int create_class_table_sci0(EngineState *s) { Resource *script = s->resmgr->findResource(ResourceId(kResourceTypeScript, scriptnr), 0); if (script) { - if (s->_flags & GF_SCI0_OLD) + if (s->_kernel->hasOldScriptHeader()) magic_offset = seeker = 2; else magic_offset = seeker = 0; @@ -327,6 +327,9 @@ int script_init_engine(EngineState *s) { s->kernel_opt_flags = 0; + s->_kernel = new Kernel(s->resmgr); + s->_vocabulary = new Vocabulary(s->resmgr); + if (s->_version >= SCI_VERSION_1_1) result = create_class_table_sci11(s); else @@ -367,9 +370,6 @@ int script_init_engine(EngineState *s) { s->_executionStack.clear(); // Start without any execution stack s->execution_stack_base = -1; // No vm is running yet - s->_kernel = new Kernel(s->resmgr, (s->_flags & GF_SCI0_OLD)); - s->_vocabulary = new Vocabulary(s->resmgr); - s->restarting_flags = SCI_GAME_IS_NOT_RESTARTING; s->bp_list = NULL; // No breakpoints defined diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index f869a3a9ea..ddcaf53df9 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -367,10 +367,11 @@ static const char *argtype_description[] = { "Arithmetic" }; -Kernel::Kernel(ResourceManager *resmgr, bool isOldSci0) : _resmgr(resmgr) { +Kernel::Kernel(ResourceManager *resmgr) : _resmgr(resmgr) { memset(&_selectorMap, 0, sizeof(_selectorMap)); // FIXME: Remove this once/if we C++ify selector_map_t - loadSelectorNames(isOldSci0); + detectOldScriptHeader(); // must be called before loadSelectorNames() + loadSelectorNames(); mapSelectors(); // Map a few special selectors for later use loadOpcodes(); loadKernelNames(); @@ -390,6 +391,11 @@ Kernel::~Kernel() { } void Kernel::printAutoDetectedFeatures() { + if (_oldScriptHeader) + printf("Kernel auto-detection: game found to have old headers for script blocks\n"); + else + printf("Kernel auto-detection: game found to have newer headers for script blocks\n"); + if (_oldGfxFunctions) printf("Kernel auto-detection: game found to be using old graphics functions\n"); else @@ -411,15 +417,44 @@ void Kernel::printAutoDetectedFeatures() { printf("Kernel auto-detection: found SCI0 game using a SCI1 kernel table\n"); } -void Kernel::loadSelectorNames(bool isOldSci0) { - int count; +void Kernel::detectOldScriptHeader() { + if (_resmgr->_sciVersion != SCI_VERSION_0) { + _oldScriptHeader = false; + return; + } + + Resource *r = _resmgr->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SNAMES), 0); + + if (!r) // No such resource? + error("Kernel: Could not retrieve selector names"); + + int count = READ_LE_UINT16(r->data) + 1; // Counter is slightly off + + _oldScriptHeader = true; + + for (int i = 0; i < count; i++) { + int offset = READ_LE_UINT16(r->data + 2 + i * 2); + int len = READ_LE_UINT16(r->data + offset); + + Common::String tmp((const char *)r->data + offset + 2, len); + + // We determine if the game has old script headers by the existence of the + // "setTarget" selector. The "motionInited" selector can also be used for the + // same purpose + if (tmp == "setTarget") { + _oldScriptHeader = false; + break; + } + } +} +void Kernel::loadSelectorNames() { Resource *r = _resmgr->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SNAMES), 0); if (!r) // No such resource? error("Kernel: Could not retrieve selector names"); - count = READ_LE_UINT16(r->data) + 1; // Counter is slightly off + int count = READ_LE_UINT16(r->data) + 1; // Counter is slightly off for (int i = 0; i < count; i++) { int offset = READ_LE_UINT16(r->data + 2 + i * 2); @@ -431,7 +466,7 @@ void Kernel::loadSelectorNames(bool isOldSci0) { // Early SCI versions used the LSB in the selector ID as a read/write // toggle. To compensate for that, we add every selector name twice. - if (isOldSci0) + if (_oldScriptHeader) _selectorNames.push_back(tmp); } } diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index 9c92519cf0..e73914a7e7 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -57,7 +57,7 @@ struct KernelFuncWithSignature { class Kernel { public: - Kernel(ResourceManager *resmgr, bool isOldSci0); + Kernel(ResourceManager *resmgr); ~Kernel(); uint getOpcodesSize() const { return _opcodes.size(); } @@ -83,6 +83,16 @@ public: */ bool hasKernelFunction(const char *functionName) const; + /** + * Applies to all versions before 0.000.395 (i.e. KQ4 old, XMAS 1988 and LSL2). + * Old SCI versions used two word header for script blocks (first word equal + * to 0x82, meaning of the second one unknown). New SCI versions used one + * word header. + * Also, old SCI versions assign 120 degrees to left & right, and 60 to up + * and down. Later versions use an even 90 degree distribution. + */ + bool hasOldScriptHeader() const { return _oldScriptHeader; } + /** * Applies to all versions before 0.000.502 * Old SCI versions used to interpret the third DrawPic() parameter inversely, @@ -127,7 +137,12 @@ private: /** * Loads the kernel selector names. */ - void loadSelectorNames(bool isOldSci0); + void loadSelectorNames(); + + /** + * Maps special selectors + */ + void mapSelectors(); /** * Prints auto-detected features from selectors @@ -135,9 +150,9 @@ private: void printAutoDetectedFeatures(); /** - * Maps special selectors + * Detects if the game is using older script headers */ - void mapSelectors(); + void detectOldScriptHeader(); /** * Maps kernel functions @@ -151,6 +166,7 @@ private: bool loadOpcodes(); ResourceManager *_resmgr; + bool _oldScriptHeader; bool _oldGfxFunctions; bool _hasLofsAbsolute; diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 435dd39d5a..d46ce3b938 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -696,7 +696,7 @@ void _k_dirloop(reg_t obj, uint16 angle, EngineState *s, int funct_nr, int argc, angle %= 360; - if (!(s->_flags & GF_SCI0_OLD)) { + if (!s->_kernel->hasOldScriptHeader()) { if (angle < 45) loop = 3; else if (angle < 136) diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index bfff828745..f44af2b1cd 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -497,7 +497,7 @@ static SegmentId find_unique_seg_by_type(SegManager *self, int type) { } static byte *find_unique_script_block(EngineState *s, byte *buf, int type) { - if (s->_flags & GF_SCI0_OLD) + if (s->_kernel->hasOldScriptHeader()) buf += 2; do { diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index a524ddd365..d5f0a21385 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -243,7 +243,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod int stackframe = (scr[pos.offset + 2] >> 1) + (*debugState.p_restadjust); int argc = ((*debugState.p_sp)[- stackframe - 1]).offset; - if (!(s->_flags & GF_SCI0_OLD)) + if (!s->_kernel->hasOldScriptHeader()) argc += (*debugState.p_restadjust); printf(" Kernel params: ("); diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index d81768c9c8..74486ef015 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -138,7 +138,7 @@ void SegManager::setScriptSize(Script &scr, EngineState *s, int script_nr) { if (!script || (s->_version >= SCI_VERSION_1_1 && !heap)) { error("SegManager::setScriptSize: failed to load %s", !script ? "script" : "heap"); } - if (s->_flags & GF_SCI0_OLD) { + if (s->_kernel->hasOldScriptHeader()) { scr.buf_size = script->size + READ_LE_UINT16(script->data) * 2; //locals_size = READ_LE_UINT16(script->data) * 2; } else if (s->_version < SCI_VERSION_1_1) { diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index b3852f10ef..c6643b8a90 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -961,7 +961,7 @@ void run_vm(EngineState *s, int restoring) { gc_countdown(s); xs->sp -= (opparams[1] >> 1) + 1; - if (!(s->_flags & GF_SCI0_OLD)) { + if (!s->_kernel->hasOldScriptHeader()) { xs->sp -= restadjust; s->r_amp_rest = 0; // We just used up the restadjust, remember? } @@ -971,7 +971,7 @@ void run_vm(EngineState *s, int restoring) { } else { int argc = ASSERT_ARITHMETIC(xs->sp[0]); - if (!(s->_flags & GF_SCI0_OLD)) + if (!s->_kernel->hasOldScriptHeader()) argc += restadjust; if (s->_kernel->_kernelFuncs[opparams[0]].signature @@ -988,7 +988,7 @@ void run_vm(EngineState *s, int restoring) { xs_new = &(s->_executionStack.back()); s->_executionStackPosChanged = true; - if (!(s->_flags & GF_SCI0_OLD)) + if (!s->_kernel->hasOldScriptHeader()) restadjust = s->r_amp_rest; } @@ -1500,7 +1500,7 @@ SelectorType lookup_selector(EngineState *s, reg_t obj_location, Selector select // Early SCI versions used the LSB in the selector ID as a read/write // toggle, meaning that we must remove it for selector lookup. - if (s->_flags & GF_SCI0_OLD) + if (s->_kernel->hasOldScriptHeader()) selector_id &= ~1; if (!obj) { @@ -1659,7 +1659,7 @@ int script_instantiate_sci0(EngineState *s, int script_nr) { Script *scr = s->seg_manager->getScript(seg_id); - if (s->_flags & GF_SCI0_OLD) { + if (s->_kernel->hasOldScriptHeader()) { // int locals_nr = READ_LE_UINT16(script->data); @@ -1835,7 +1835,7 @@ int script_instantiate(EngineState *s, int script_nr) { } void script_uninstantiate_sci0(EngineState *s, int script_nr, SegmentId seg) { - reg_t reg = make_reg(seg, (s->_flags & GF_SCI0_OLD) ? 2 : 0); + reg_t reg = make_reg(seg, s->_kernel->hasOldScriptHeader() ? 2 : 0); int objtype, objlength; Script *scr = s->seg_manager->getScript(seg); @@ -1879,7 +1879,7 @@ void script_uninstantiate_sci0(EngineState *s, int script_nr, SegmentId seg) { } void script_uninstantiate(EngineState *s, int script_nr) { - reg_t reg = make_reg(0, (s->_flags & GF_SCI0_OLD) ? 2 : 0); + reg_t reg = make_reg(0, s->_kernel->hasOldScriptHeader() ? 2 : 0); reg.segment = s->seg_manager->segGet(script_nr); Script *scr = script_locate_by_segment(s, reg.segment); diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h index adaa064a6c..0536ec32ab 100644 --- a/engines/sci/engine/vm.h +++ b/engines/sci/engine/vm.h @@ -203,7 +203,7 @@ struct selector_map_t { Selector printLang; /**< Used for i18n */ Selector subtitleLang; Selector parseLang; - Selector motionCue; // Used to detect newer graphics functions semantics. + Selector motionCue; // Used to detect newer graphics functions semantics Selector sightAngle; // Used to detect some SCI0/SCI01 games which need a SCI1 table Selector setVol; // Used to detect newer sound semantics Selector egoMoveSpeed; // Used to detect SCI1 games which use absolute values in lofs diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 698983acaf..09c433edc2 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -151,19 +151,13 @@ Common::Error SciEngine::run() { if (version < SCI_VERSION_1) { // SCI0/SCI01 } else if (version == SCI_VERSION_1) { - // SCI1 - - if (flags & GF_SCI0_OLD || - flags & GF_SCI0_OLDGETTIME) { + if (flags & GF_SCI0_OLDGETTIME) { error("This game entry is erroneous. It's marked as SCI1, but it has SCI0 flags set"); } } else if (version == SCI_VERSION_1_1 || version == SCI_VERSION_32) { - if (flags & GF_SCI0_OLD || - flags & GF_SCI0_OLDGETTIME) { + if (flags & GF_SCI0_OLDGETTIME) { error("This game entry is erroneous. It's marked as SCI1.1/SCI32, but it has SCI0 flags set"); } - - // SCI1.1 / SCI32 } else { error ("Unknown SCI version in game entry"); } diff --git a/engines/sci/sci.h b/engines/sci/sci.h index 82a0f80b34..a2de5c3136 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -83,19 +83,10 @@ extern const char *versionNames[7]; enum SciGameFlags { // SCI0 flags - /* Applies to all versions before 0.000.395 (i.e. KQ4 old, XMAS 1988 and LSL2) - * Old SCI versions used two word header for script blocks (first word equal - * to 0x82, meaning of the second one unknown). New SCI versions used one - * word header. - * Also, old SCI versions assign 120 degrees to left & right, and 60 to up - * and down. Later versions use an even 90 degree distribution. - */ - GF_SCI0_OLD = (1 << 0), - /* Applies to all versions before 0.000.629 * Older SCI versions had simpler code for GetTime() */ - GF_SCI0_OLDGETTIME = (1 << 1) + GF_SCI0_OLDGETTIME = (1 << 0) }; class SciEngine : public Engine { -- cgit v1.2.3 From a9aaf56b3e81d46776a6fba574ab9833a8f21be1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 7 Jul 2009 11:14:18 +0000 Subject: Cleanup: added an enum for the auto-detected features, removed the selectors which are only used for auto-detection from the convenience selector map and placed feature auto-detection in a separate function. Also, now the automatically detected graphics resources are shown in the console. svn-id: r42212 --- engines/sci/engine/kernel.cpp | 118 ++++++++++++++++++++++-------------------- engines/sci/engine/kernel.h | 38 +++++++++----- engines/sci/engine/ksound.cpp | 4 +- engines/sci/engine/script.cpp | 4 -- engines/sci/engine/vm.h | 4 -- engines/sci/resource.cpp | 5 ++ 6 files changed, 95 insertions(+), 78 deletions(-) diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index ddcaf53df9..dd2d0dc61a 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -370,67 +370,31 @@ static const char *argtype_description[] = { Kernel::Kernel(ResourceManager *resmgr) : _resmgr(resmgr) { memset(&_selectorMap, 0, sizeof(_selectorMap)); // FIXME: Remove this once/if we C++ify selector_map_t - detectOldScriptHeader(); // must be called before loadSelectorNames() + detectSciFeatures(); // must be called before loadSelectorNames() loadSelectorNames(); - mapSelectors(); // Map a few special selectors for later use + mapSelectors(); // Map a few special selectors for later use loadOpcodes(); loadKernelNames(); - mapFunctions(); // Map the kernel functions - - // SCI0 games using old graphics functions (before version 0.000.502) did not have a - // motionCue selector - _oldGfxFunctions = (_selectorMap.motionCue == -1 && _resmgr->_sciVersion == SCI_VERSION_0); - - // SCI1 games which use absolute lofs have the egoMoveSpeed selector - _hasLofsAbsolute = (_selectorMap.egoMoveSpeed != -1 && _resmgr->_sciVersion < SCI_VERSION_1_1); - - printAutoDetectedFeatures(); + mapFunctions(); // Map the kernel functions } Kernel::~Kernel() { } -void Kernel::printAutoDetectedFeatures() { - if (_oldScriptHeader) - printf("Kernel auto-detection: game found to have old headers for script blocks\n"); - else - printf("Kernel auto-detection: game found to have newer headers for script blocks\n"); - - if (_oldGfxFunctions) - printf("Kernel auto-detection: game found to be using old graphics functions\n"); - else - printf("Kernel auto-detection: game found to be using newer graphics functions\n"); - - if (_hasLofsAbsolute) - printf("Kernel auto-detection: game found to be using absolute parameters for lofs\n"); - else - printf("Kernel auto-detection: game found to be using relative parameters for lofs\n"); - - if (_selectorMap.setVol != -1) - printf("Kernel auto-detection: using SCI1 sound functions\n"); - else if (_selectorMap.nodePtr != -1) - printf("Kernel auto-detection: using SCI01 sound functions\n"); - else - printf("Kernel auto-detection: using SCI0 sound functions\n"); - - if (_resmgr->_sciVersion == SCI_VERSION_0 && _selectorMap.sightAngle != -1) - printf("Kernel auto-detection: found SCI0 game using a SCI1 kernel table\n"); -} - -void Kernel::detectOldScriptHeader() { - if (_resmgr->_sciVersion != SCI_VERSION_0) { - _oldScriptHeader = false; - return; - } - +void Kernel::detectSciFeatures() { Resource *r = _resmgr->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SNAMES), 0); if (!r) // No such resource? error("Kernel: Could not retrieve selector names"); int count = READ_LE_UINT16(r->data) + 1; // Counter is slightly off + features = 0; - _oldScriptHeader = true; + // Initialize features based on SCI version + if (_resmgr->_sciVersion == SCI_VERSION_0) { + features |= kFeatureOldScriptHeader; + features |= kFeatureOldGfxFunctions; + } for (int i = 0; i < count; i++) { int offset = READ_LE_UINT16(r->data + 2 + i * 2); @@ -438,14 +402,58 @@ void Kernel::detectOldScriptHeader() { Common::String tmp((const char *)r->data + offset + 2, len); - // We determine if the game has old script headers by the existence of the - // "setTarget" selector. The "motionInited" selector can also be used for the - // same purpose - if (tmp == "setTarget") { - _oldScriptHeader = false; - break; - } + if (tmp == "setTarget") // "motionInited" can also be used + features &= ~kFeatureOldScriptHeader; + + if (tmp == "motionCue") + features &= ~kFeatureOldGfxFunctions; + + if (tmp == "egoMoveSpeed" && _resmgr->_sciVersion < SCI_VERSION_1_1) + features |= kFeatureLofsAbsolute; + + if (tmp == "sightAngle" && _resmgr->_sciVersion == SCI_VERSION_0) + features |= kFeatureSci0Sci1Table; + + if (tmp == "setVol") + features |= kFeatureSci1Sound; + + if (tmp == "nodePtr") + features |= kFeatureSci01Sound; } + + if (features & kFeatureSci1Sound) + features &= ~kFeatureSci01Sound; + + printf("Kernel auto-detected features:\n"); + + printf("Script block headers: "); + if (features & kFeatureOldScriptHeader) + printf("old\n"); + else + printf("new\n"); + + printf("Graphics functions: "); + if (features & kFeatureOldGfxFunctions) + printf("old\n"); + else + printf("new\n"); + + printf("lofs parameters: "); + if (features & kFeatureLofsAbsolute) + printf("absolute\n"); + else + printf("relative\n"); + + printf("Sound functions: "); + if (features & kFeatureSci1Sound) + printf("SCI1\n"); + else if (features & kFeatureSci01Sound) + printf("SCI01\n"); + else + printf("SCI0\n"); + + if (features & kFeatureSci0Sci1Table) + printf("Found SCI0 game using a SCI1 kernel table\n"); } void Kernel::loadSelectorNames() { @@ -466,7 +474,7 @@ void Kernel::loadSelectorNames() { // Early SCI versions used the LSB in the selector ID as a read/write // toggle. To compensate for that, we add every selector name twice. - if (_oldScriptHeader) + if (features & kFeatureOldScriptHeader) _selectorNames.push_back(tmp); } } @@ -806,7 +814,7 @@ void Kernel::setDefaultKernelNames() { // Check if we have a SCI01 game which uses a SCI1 kernel table (e.g. the KQ1 demo // and full version). We do this by checking if the sightAngle selector exists, as no // SCI0 game seems to have it - if (_selectorMap.sightAngle != -1 && isSci0) + if (features & kFeatureSci0Sci1Table) isSci0 = false; _kernelNames.resize(SCI_KNAMES_DEFAULT_ENTRIES_NR + (isSci0 ? 4 : 0)); diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index e73914a7e7..4814bd0317 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -55,6 +55,15 @@ struct KernelFuncWithSignature { Common::String orig_name; /**< Original name, in case we couldn't map it */ }; +enum AutoDetectedFeatures { + kFeatureOldScriptHeader = 1 << 0, + kFeatureOldGfxFunctions = 1 << 1, + kFeatureLofsAbsolute = 1 << 2, + kFeatureSci01Sound = 1 << 3, + kFeatureSci1Sound = 1 << 4, + kFeatureSci0Sci1Table = 1 << 5 +}; + class Kernel { public: Kernel(ResourceManager *resmgr); @@ -91,7 +100,7 @@ public: * Also, old SCI versions assign 120 degrees to left & right, and 60 to up * and down. Later versions use an even 90 degree distribution. */ - bool hasOldScriptHeader() const { return _oldScriptHeader; } + bool hasOldScriptHeader() const { return (features & kFeatureOldScriptHeader); } /** * Applies to all versions before 0.000.502 @@ -100,14 +109,24 @@ public: * Also, they used 15 priority zones from 42 to 200 instead of 14 priority * zones from 42 to 190. */ - bool usesOldGfxFunctions() const { return _oldGfxFunctions; } + bool usesOldGfxFunctions() const { return (features & kFeatureOldGfxFunctions); } /** * Applies to all SCI1 versions after 1.000.200 * In late SCI1 versions, the argument of lofs[as] instructions * is absolute rather than relative. */ - bool hasLofsAbsolute() const { return _hasLofsAbsolute; } + bool hasLofsAbsolute() const { return (features & kFeatureLofsAbsolute); } + + /** + * Determines if the game is using SCI01 sound functions + */ + bool usesSci01SoundFunctions() const { return (features & kFeatureSci01Sound); } + + /** + * Determines if the game is using SCI1 sound functions + */ + bool usesSci1SoundFunctions() const { return (features & kFeatureSci1Sound); } // Script dissection/dumping functions void dissectScript(int scriptNumber, Vocabulary *vocab); @@ -145,14 +164,9 @@ private: void mapSelectors(); /** - * Prints auto-detected features from selectors - */ - void printAutoDetectedFeatures(); - - /** - * Detects if the game is using older script headers + * Detects SCI features based on the existence of certain selectors */ - void detectOldScriptHeader(); + void detectSciFeatures(); /** * Maps kernel functions @@ -166,9 +180,7 @@ private: bool loadOpcodes(); ResourceManager *_resmgr; - bool _oldScriptHeader; - bool _oldGfxFunctions; - bool _hasLofsAbsolute; + uint32 features; // Kernel-related lists /** diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index f1584bf975..ba70bf9f73 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -982,9 +982,9 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { * Used for synthesized music playback */ reg_t kDoSound(EngineState *s, int funct_nr, int argc, reg_t *argv) { - if (s->_kernel->_selectorMap.setVol != -1) + if (s->_kernel->usesSci1SoundFunctions()) return kDoSound_SCI1(s, funct_nr, argc, argv); - else if (s->_kernel->_selectorMap.nodePtr != -1) + else if (s->_kernel->usesSci01SoundFunctions()) return kDoSound_SCI01(s, funct_nr, argc, argv); else return kDoSound_SCI0(s, funct_nr, argc, argv); diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index 991955cd67..b7529c33bd 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -199,10 +199,6 @@ void Kernel::mapSelectors() { FIND_SELECTOR(printLang); FIND_SELECTOR(subtitleLang); FIND_SELECTOR(parseLang); - FIND_SELECTOR(motionCue); - FIND_SELECTOR(sightAngle); - FIND_SELECTOR(setVol); - FIND_SELECTOR(egoMoveSpeed); } void Kernel::dumpScriptObject(char *data, int seeker, int objsize) { diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h index 0536ec32ab..a3fabbe44b 100644 --- a/engines/sci/engine/vm.h +++ b/engines/sci/engine/vm.h @@ -203,10 +203,6 @@ struct selector_map_t { Selector printLang; /**< Used for i18n */ Selector subtitleLang; Selector parseLang; - Selector motionCue; // Used to detect newer graphics functions semantics - Selector sightAngle; // Used to detect some SCI0/SCI01 games which need a SCI1 table - Selector setVol; // Used to detect newer sound semantics - Selector egoMoveSpeed; // Used to detect SCI1 games which use absolute values in lofs }; // A reference to an object's variable. diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index a9de8ba112..fee0822f84 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -568,6 +568,11 @@ ResourceManager::ResourceManager(int version, int maxMemory) { debug("Resmgr: Couldn't determine SCI version"); break; } + + if (_isVGA) + debug("Resmgr: Detected VGA graphic resources"); + else + debug("Resmgr: Detected non-VGA/EGA graphic resources"); } ResourceManager::~ResourceManager() { -- cgit v1.2.3 From a0ab8c9c0cb079f21e342d1a53283064bdffebe4 Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Tue, 7 Jul 2009 11:58:22 +0000 Subject: - Separate Playtoons gametypes from in GobEngine::initGameParts() - Add a specific save/load class for Playtoons as some specific files need to be tested svn-id: r42214 --- dists/msvc7/gob.vcproj | 3 ++ dists/msvc71/gob.vcproj | 3 ++ dists/msvc8/gob.vcproj | 4 ++ dists/msvc9/gob.vcproj | 8 +++ engines/gob/gob.cpp | 18 +++++-- engines/gob/module.mk | 1 + engines/gob/save/saveload.h | 24 +++++++++ engines/gob/save/saveload_playtoons.cpp | 88 +++++++++++++++++++++++++++++++++ 8 files changed, 146 insertions(+), 3 deletions(-) create mode 100644 engines/gob/save/saveload_playtoons.cpp diff --git a/dists/msvc7/gob.vcproj b/dists/msvc7/gob.vcproj index fd1cbb9dfe..9919d09c9f 100644 --- a/dists/msvc7/gob.vcproj +++ b/dists/msvc7/gob.vcproj @@ -397,6 +397,9 @@ + + diff --git a/dists/msvc71/gob.vcproj b/dists/msvc71/gob.vcproj index b005dbbd6e..0a5f869970 100644 --- a/dists/msvc71/gob.vcproj +++ b/dists/msvc71/gob.vcproj @@ -411,6 +411,9 @@ + + diff --git a/dists/msvc8/gob.vcproj b/dists/msvc8/gob.vcproj index 315cabc7d3..5137898c5d 100644 --- a/dists/msvc8/gob.vcproj +++ b/dists/msvc8/gob.vcproj @@ -518,6 +518,10 @@ RelativePath="..\..\engines\gob\save\saveconverter_v6.cpp" > + + diff --git a/dists/msvc9/gob.vcproj b/dists/msvc9/gob.vcproj index 60385473a5..7b339fbad9 100644 --- a/dists/msvc9/gob.vcproj +++ b/dists/msvc9/gob.vcproj @@ -535,6 +535,10 @@ RelativePath="..\..\engines\gob\save\savehandler.h" > + + @@ -559,6 +563,10 @@ RelativePath="..\..\engines\gob\save\saveload_v6.cpp" > + + diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 8605dfbd52..c5136344eb 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -421,9 +421,6 @@ bool GobEngine::initGameParts() { _saveLoad = new SaveLoad_v4(this, _targetName.c_str()); break; - case kGameTypePlaytoon: - case kGameTypePlaytnCk: - case kGameTypeBambou: case kGameTypeDynasty: _init = new Init_v3(this); _video = new Video_v2(this); @@ -449,6 +446,21 @@ bool GobEngine::initGameParts() { _saveLoad = new SaveLoad_v6(this, _targetName.c_str()); break; + case kGameTypePlaytoon: + case kGameTypePlaytnCk: + case kGameTypeBambou: + _init = new Init_v2(this); + _video = new Video_v2(this); +// _inter = new Inter_Playtoons(this); + _inter = new Inter_v4(this); + _mult = new Mult_v2(this); + _draw = new Draw_v2(this); + _map = new Map_v2(this); + _goblin = new Goblin_v2(this); + _scenery = new Scenery_v2(this); + _saveLoad = new SaveLoad_playtoons(this); + break; + default: deinitGameParts(); return false; diff --git a/engines/gob/module.mk b/engines/gob/module.mk index 66c1b0dbaf..611abb6038 100644 --- a/engines/gob/module.mk +++ b/engines/gob/module.mk @@ -64,6 +64,7 @@ MODULE_OBJS := \ save/saveload_v3.o \ save/saveload_v4.o \ save/saveload_v6.o \ + save/saveload_playtoons.o \ save/saveconverter.o \ save/saveconverter_v2.o \ save/saveconverter_v3.o \ diff --git a/engines/gob/save/saveload.h b/engines/gob/save/saveload.h index a74b64b883..8095b8c045 100644 --- a/engines/gob/save/saveload.h +++ b/engines/gob/save/saveload.h @@ -445,6 +445,30 @@ protected: SaveFile *getSaveFile(const char *fileName); }; +/** Save/Load class for Playtoons. */ +class SaveLoad_playtoons : public SaveLoad { +public: + SaveLoad_playtoons(GobEngine *vm); + virtual ~SaveLoad_playtoons(); + +protected: + struct SaveFile { + const char *sourceName; + SaveMode mode; + SaveHandler *handler; + const char *description; + }; + + static SaveFile _saveFiles[]; + + SaveMode getSaveMode(const char *fileName) const; + + const SaveFile *getSaveFile(const char *fileName) const; + + SaveFile *getSaveFile(const char *fileName); + +}; + } // End of namespace Gob #endif // GOB_SAVE_SAVELOAD_H diff --git a/engines/gob/save/saveload_playtoons.cpp b/engines/gob/save/saveload_playtoons.cpp new file mode 100644 index 0000000000..576a10294f --- /dev/null +++ b/engines/gob/save/saveload_playtoons.cpp @@ -0,0 +1,88 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "gob/save/saveload.h" +#include "gob/inter.h" +#include "gob/variables.h" + +namespace Gob { + +SaveLoad_playtoons::SaveFile SaveLoad_playtoons::_saveFiles[] = { + { "disk.001", kSaveModeExists, 0, 0}, // Playtoons 1 identification file + { "disk.002", kSaveModeExists, 0, 0}, // Playtoons 2 identification file + { "disk.003", kSaveModeExists, 0, 0}, // Playtoons 3 identification file + { "disk.004", kSaveModeExists, 0, 0}, // Playtoons 4 identification file + { "disk.005", kSaveModeExists, 0, 0}, // Playtoons 5 identification file + { "disk.006", kSaveModeExists, 0, 0}, // Playtoons CK 1 identification file + { "disk.007", kSaveModeExists, 0, 0}, // Playtoons CK 2 identification file + { "disk.008", kSaveModeExists, 0, 0}, // Playtoons CK 3 identification file + { "titre.001", kSaveModeExists, 0, 0}, // Playtoons 1 titles + { "titre.002", kSaveModeExists, 0, 0}, // Playtoons 2 titles + { "titre.003", kSaveModeExists, 0, 0}, // Playtoons 3 titles + { "titre.004", kSaveModeExists, 0, 0}, // Playtoons 4 titles + { "titre.005", kSaveModeExists, 0, 0}, // Playtoons 5 titles + { "titre.006", kSaveModeExists, 0, 0}, // Playtoons CK 1 empty title (???) + { "titre.007", kSaveModeExists, 0, 0}, // Playtoons CK 2 empty title (???) + { "titre.008", kSaveModeExists, 0, 0}, // Playtoons CK 3 empty title (???) + { "mdo.def", kSaveModeExists, 0, 0}, +}; + +SaveLoad::SaveMode SaveLoad_playtoons::getSaveMode(const char *fileName) const { + const SaveFile *saveFile = getSaveFile(fileName); + + if (saveFile) + return saveFile->mode; + + return kSaveModeNone; +} + +SaveLoad_playtoons::SaveLoad_playtoons(GobEngine *vm) : + SaveLoad(vm) { +} + +SaveLoad_playtoons::~SaveLoad_playtoons() { +} + +const SaveLoad_playtoons::SaveFile *SaveLoad_playtoons::getSaveFile(const char *fileName) const { + fileName = stripPath(fileName); + + for (int i = 0; i < ARRAYSIZE(_saveFiles); i++) + if (!scumm_stricmp(fileName, _saveFiles[i].sourceName)) + return &_saveFiles[i]; + + return 0; +} + +SaveLoad_playtoons::SaveFile *SaveLoad_playtoons::getSaveFile(const char *fileName) { + fileName = stripPath(fileName); + + for (int i = 0; i < ARRAYSIZE(_saveFiles); i++) + if (!scumm_stricmp(fileName, _saveFiles[i].sourceName)) + return &_saveFiles[i]; + + return 0; +} + +} // End of namespace Gob -- cgit v1.2.3 From add4d124b29a6de01d69cc8f2a8d236deb969425 Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Tue, 7 Jul 2009 12:03:27 +0000 Subject: - Add a new gametype for 'The Land of the Magic Stones' - Add detection of the french version - Add a new game feature for 800*600 svn-id: r42215 --- engines/gob/detection.cpp | 38 ++++++++++++++++++++++++++++++++++++-- engines/gob/gob.h | 4 +++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/engines/gob/detection.cpp b/engines/gob/detection.cpp index f8a590e57e..d7018f349e 100644 --- a/engines/gob/detection.cpp +++ b/engines/gob/detection.cpp @@ -71,6 +71,7 @@ static const PlainGameDescriptor gobGames[] = { {"bambou", "Playtoons Limited Edition - Bambou le sauveur de la jungle"}, {"fascination", "Fascination"}, {"geisha", "Geisha"}, + {"magicstones", "The Land of the Magic Stones"}, {"adibou4", "Adibou v4"}, {"adibouunknown", "Adibou (not yet supported)"}, {0, 0} @@ -3650,6 +3651,24 @@ static const GOBGameDescription gameDescriptions[] = { kFeatures640, "intro2.stk", 0, 0 }, + { + { + "magicstones", + "", + { + {"ed4.stk", 0, "98721a7cfdc5a358d7ac56b7c6d3ba3d", 541882}, + {"ed4cd.itk", 0, "0627a91d9a6f4772c33747ce752024c2", 606993908}, + {0, 0, 0, 0} + }, + FR_FRA, + kPlatformPC, + ADGF_NO_FLAGS, + GUIO_NOSUBTITLES | GUIO_NOSPEECH + }, + kGameTypeMagicStones, + kFeatures800, + "ed4.stk", "main.obc", 0 + }, { { "adibou4", @@ -4205,6 +4224,20 @@ static const GOBGameDescription fallbackDescs[] = { kFeaturesNone, "disk1.stk", "intro.tot", 0 }, + { + { + "magicstones", + "unknown", + AD_ENTRY1(0, 0), + UNK_LANG, + kPlatformPC, + ADGF_NO_FLAGS, + GUIO_NOSUBTITLES | GUIO_NOSPEECH + }, + kGameTypeMagicStones, + kFeatures800, + "ed4.stk", "main.obc", 0 + }, { { "adibou4", @@ -4259,8 +4292,9 @@ static const ADFileBasedFallback fileBased[] = { { &fallbackDescs[19], { "intro.stk", "bambou.itk", 0 } }, { &fallbackDescs[20], { "disk0.stk", "disk1.stk", "disk2.stk", "disk3.stk", 0 } }, { &fallbackDescs[21], { "disk1.stk", "disk2.stk", "disk3.stk", 0 } }, - { &fallbackDescs[22], { "adif41.stk", "adim41.stk", 0 } }, - { &fallbackDescs[23], { "coktelplayer.scn", 0 } }, + { &fallbackDescs[22], { "ed4.stk", 0 } }, + { &fallbackDescs[23], { "adif41.stk", "adim41.stk", 0 } }, + { &fallbackDescs[24], { "coktelplayer.scn", 0 } }, { 0, { 0 } } }; diff --git a/engines/gob/gob.h b/engines/gob/gob.h index 5047382316..d04a8b9834 100644 --- a/engines/gob/gob.h +++ b/engines/gob/gob.h @@ -108,6 +108,7 @@ enum GameType { kGameTypeBambou, kGameTypeFascination, kGameTypeGeisha, + kGameTypeMagicStones, kGameTypeAdibou4, kGameTypeAdibouUnknown }; @@ -119,7 +120,8 @@ enum Features { kFeaturesAdlib = 1 << 2, kFeatures640 = 1 << 3, kFeaturesSCNDemo = 1 << 4, - kFeaturesBATDemo = 1 << 5 + kFeaturesBATDemo = 1 << 5, + kFeatures800 = 1 << 6 }; enum { -- cgit v1.2.3 From 74670cc834636b431b168343511415ccbcc97a71 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 7 Jul 2009 12:29:55 +0000 Subject: Removed the superfluous sci_version_types array (it's essentially the same as the versionNames array) svn-id: r42216 --- engines/sci/console.cpp | 6 ++---- engines/sci/resource.cpp | 15 ++------------- engines/sci/resource.h | 2 -- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 8f977c04c2..2d11f39835 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -374,10 +374,8 @@ const char *selector_name(EngineState *s, int selector) { } bool Console::cmdGetVersion(int argc, const char **argv) { - int ver = _vm->getVersion(); - - DebugPrintf("Resource file version: %s\n", sci_version_types[_vm->getResMgr()->_sciVersion]); - DebugPrintf("Emulated interpreter version: %s\n", versionNames[ver]); + DebugPrintf("Resource file version: %s\n", versionNames[_vm->getResMgr()->_sciVersion]); + DebugPrintf("Emulated interpreter version: %s\n", versionNames[_vm->getVersion()]); return true; } diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index fee0822f84..b66c5de092 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -42,17 +42,6 @@ namespace Sci { //#define SCI_VERBOSE_RESMGR 1 -const char *sci_version_types[] = { - "SCI version undetermined (Autodetect failed / not run)", - "SCI version 0.xxx", - "SCI version 0.xxx w/ 1.000 compression", - "SCI version 1.000 w/ 0.xxx resource.map", - "SCI version 1.000 w/ special resource.map", - "SCI version 1.000", - "SCI version 1.001", - "SCI WIN/32" -}; - const int sci_max_resource_nr[] = {65536, 1000, 2048, 2048, 2048, 65536, 65536, 65536}; static const char *sci_error_types[] = { @@ -484,8 +473,8 @@ ResourceManager::ResourceManager(int version, int maxMemory) { _mapVersion = detectMapVersion(); _volVersion = detectVolVersion(); } - debug("Using resource map version %d %s", _mapVersion, sci_version_types[_mapVersion]); - debug("Using volume version %d %s", _volVersion, sci_version_types[_volVersion]); + debug("Using resource map version %d %s", _mapVersion, versionNames[_mapVersion]); + debug("Using volume version %d %s", _volVersion, versionNames[_volVersion]); scanNewSources(); addInternalSources(); diff --git a/engines/sci/resource.h b/engines/sci/resource.h index ad9e7a1d8d..1b54b28df9 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -82,10 +82,8 @@ enum ResSourceType { #define SCI1_RESMAP_ENTRIES_SIZE 6 #define SCI11_RESMAP_ENTRIES_SIZE 5 -extern const char *sci_version_types[]; extern const int sci_max_resource_nr[]; /**< Highest possible resource numbers */ - enum ResourceType { kResourceTypeView = 0, kResourceTypePic, -- cgit v1.2.3 From 09efaaa1c91854feaf19ba6fae1b702203984e26 Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Tue, 7 Jul 2009 12:51:21 +0000 Subject: Change SaveLoad_Playtoons case svn-id: r42217 --- engines/gob/gob.cpp | 6 +++++- engines/gob/gob.h | 1 + engines/gob/save/saveload.h | 8 +++++--- engines/gob/save/saveload_playtoons.cpp | 12 ++++++------ 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index c5136344eb..5fe5971e8c 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -205,6 +205,10 @@ bool GobEngine::isBATDemo() const { return (_features & kFeaturesBATDemo) != 0; } +bool GobEngine::is800() const { + return (_features & kFeatures800) != 0; +} + bool GobEngine::isDemo() const { return (isSCNDemo() || isBATDemo()); } @@ -458,7 +462,7 @@ bool GobEngine::initGameParts() { _map = new Map_v2(this); _goblin = new Goblin_v2(this); _scenery = new Scenery_v2(this); - _saveLoad = new SaveLoad_playtoons(this); + _saveLoad = new SaveLoad_Playtoons(this); break; default: diff --git a/engines/gob/gob.h b/engines/gob/gob.h index d04a8b9834..aa87881b05 100644 --- a/engines/gob/gob.h +++ b/engines/gob/gob.h @@ -218,6 +218,7 @@ public: bool hasAdlib() const; bool isSCNDemo() const; bool isBATDemo() const; + bool is800() const; bool isDemo() const; GobEngine(OSystem *syst); diff --git a/engines/gob/save/saveload.h b/engines/gob/save/saveload.h index 8095b8c045..8d785c7233 100644 --- a/engines/gob/save/saveload.h +++ b/engines/gob/save/saveload.h @@ -446,10 +446,12 @@ protected: }; /** Save/Load class for Playtoons. */ -class SaveLoad_playtoons : public SaveLoad { +/** Only used for the moment to check file presence */ + +class SaveLoad_Playtoons : public SaveLoad { public: - SaveLoad_playtoons(GobEngine *vm); - virtual ~SaveLoad_playtoons(); + SaveLoad_Playtoons(GobEngine *vm); + virtual ~SaveLoad_Playtoons(); protected: struct SaveFile { diff --git a/engines/gob/save/saveload_playtoons.cpp b/engines/gob/save/saveload_playtoons.cpp index 576a10294f..97da909e7c 100644 --- a/engines/gob/save/saveload_playtoons.cpp +++ b/engines/gob/save/saveload_playtoons.cpp @@ -29,7 +29,7 @@ namespace Gob { -SaveLoad_playtoons::SaveFile SaveLoad_playtoons::_saveFiles[] = { +SaveLoad_Playtoons::SaveFile SaveLoad_Playtoons::_saveFiles[] = { { "disk.001", kSaveModeExists, 0, 0}, // Playtoons 1 identification file { "disk.002", kSaveModeExists, 0, 0}, // Playtoons 2 identification file { "disk.003", kSaveModeExists, 0, 0}, // Playtoons 3 identification file @@ -49,7 +49,7 @@ SaveLoad_playtoons::SaveFile SaveLoad_playtoons::_saveFiles[] = { { "mdo.def", kSaveModeExists, 0, 0}, }; -SaveLoad::SaveMode SaveLoad_playtoons::getSaveMode(const char *fileName) const { +SaveLoad::SaveMode SaveLoad_Playtoons::getSaveMode(const char *fileName) const { const SaveFile *saveFile = getSaveFile(fileName); if (saveFile) @@ -58,14 +58,14 @@ SaveLoad::SaveMode SaveLoad_playtoons::getSaveMode(const char *fileName) const { return kSaveModeNone; } -SaveLoad_playtoons::SaveLoad_playtoons(GobEngine *vm) : +SaveLoad_Playtoons::SaveLoad_Playtoons(GobEngine *vm) : SaveLoad(vm) { } -SaveLoad_playtoons::~SaveLoad_playtoons() { +SaveLoad_Playtoons::~SaveLoad_Playtoons() { } -const SaveLoad_playtoons::SaveFile *SaveLoad_playtoons::getSaveFile(const char *fileName) const { +const SaveLoad_Playtoons::SaveFile *SaveLoad_Playtoons::getSaveFile(const char *fileName) const { fileName = stripPath(fileName); for (int i = 0; i < ARRAYSIZE(_saveFiles); i++) @@ -75,7 +75,7 @@ const SaveLoad_playtoons::SaveFile *SaveLoad_playtoons::getSaveFile(const char * return 0; } -SaveLoad_playtoons::SaveFile *SaveLoad_playtoons::getSaveFile(const char *fileName) { +SaveLoad_Playtoons::SaveFile *SaveLoad_Playtoons::getSaveFile(const char *fileName) { fileName = stripPath(fileName); for (int i = 0; i < ARRAYSIZE(_saveFiles); i++) -- cgit v1.2.3 From ab8c3d56b86d93dcd2c0debeb6ad57bf87910fd2 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 7 Jul 2009 13:39:24 +0000 Subject: Removed the weird checks for a maximum resource number (the sci_max_resource_nr array), as it doesn't serve any real purpose and leads to strange errors: if a resource is found which is bigger than the maximum number, it will be remapped to an incorrect number from this check. This makes KQ5CD work properly again (resources would be remapped to incorrect resource numbers from this code as a result of not updating this array with the latest SCI version merges). svn-id: r42219 --- engines/sci/engine/game.cpp | 2 +- engines/sci/resource.cpp | 13 +------------ engines/sci/resource.h | 2 -- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index ea03705fc2..861294cfa6 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -95,7 +95,7 @@ int _reset_graphics_input(EngineState *s) { font_nr = -1; do { resource = s->resmgr->testResource(ResourceId(kResourceTypeFont, ++font_nr)); - } while ((!resource) && (font_nr < sci_max_resource_nr[s->resmgr->_sciVersion])); + } while ((!resource) && (font_nr < 65536)); if (!resource) { debug(2, "No text font was found."); diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index b66c5de092..30e917557d 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -42,8 +42,6 @@ namespace Sci { //#define SCI_VERBOSE_RESMGR 1 -const int sci_max_resource_nr[] = {65536, 1000, 2048, 2048, 2048, 65536, 65536, 65536}; - static const char *sci_error_types[] = { "No error", "I/O error", @@ -649,16 +647,7 @@ Common::List *ResourceManager::listResources(ResourceType type, int } Resource *ResourceManager::findResource(ResourceId id, bool lock) { - Resource *retval; - - if (id.number >= sci_max_resource_nr[_sciVersion]) { - ResourceId moddedId = ResourceId(id.type, id.number % sci_max_resource_nr[_sciVersion], id.tuple); - warning("[resmgr] Requested invalid resource %s, mapped to %s", - id.toString().c_str(), moddedId.toString().c_str()); - id = moddedId; - } - - retval = testResource(id); + Resource *retval = testResource(id); if (!retval) return NULL; diff --git a/engines/sci/resource.h b/engines/sci/resource.h index 1b54b28df9..b212a36710 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -82,8 +82,6 @@ enum ResSourceType { #define SCI1_RESMAP_ENTRIES_SIZE 6 #define SCI11_RESMAP_ENTRIES_SIZE 5 -extern const int sci_max_resource_nr[]; /**< Highest possible resource numbers */ - enum ResourceType { kResourceTypeView = 0, kResourceTypePic, -- cgit v1.2.3 From 862308166645a5f7b5422473b434f0a8ec86d7b2 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 7 Jul 2009 14:22:23 +0000 Subject: Add generic functionallity to draw FM-Towns ROM. (To be used by KYRA and SCI) svn-id: r42221 --- graphics/module.mk | 1 + graphics/sjis.cpp | 151 +++++++++++++++++++++++++++++++++++++++++++++++++++++ graphics/sjis.h | 108 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 260 insertions(+) create mode 100644 graphics/sjis.cpp create mode 100644 graphics/sjis.h diff --git a/graphics/module.mk b/graphics/module.mk index bf93822bee..de386c18fe 100644 --- a/graphics/module.mk +++ b/graphics/module.mk @@ -14,6 +14,7 @@ MODULE_OBJS := \ primitives.o \ scaler.o \ scaler/thumbnail_intern.o \ + sjis.o \ surface.o \ thumbnail.o \ VectorRenderer.o \ diff --git a/graphics/sjis.cpp b/graphics/sjis.cpp new file mode 100644 index 0000000000..4421a86eef --- /dev/null +++ b/graphics/sjis.cpp @@ -0,0 +1,151 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + */ + +#include "graphics/sjis.h" + +#include "common/debug.h" + +namespace Graphics { + +bool FontTowns::loadFromStream(Common::ReadStream &stream) { + for (uint i = 0; i < (kFontRomSize / 2); ++i) + _fontData[i] = stream.readUint16BE(); + return !stream.err(); +} + +template +void FontTowns::drawCharIntern(const uint16 *glyph, uint8 *dst, int pitch, Color c1) const { + for (int y = getFontHeight(); y > 0; --y) { + Color *lineBuf = (Color *)dst; + uint16 line = *glyph++; + + for (int x = 0; x < 16; ++x) { + if (line & 0x8000) + *lineBuf = c1; + line <<= 1; + ++lineBuf; + } + + dst += pitch; + } +} + +void FontTowns::drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1) const { + const uint16 *glyphSource = _fontData + sjisToChunk(ch & 0xFF, ch >> 8) * 16; + + if (bpp == 1) + drawCharIntern(glyphSource, (uint8 *)dst, pitch, c1); + else if (bpp == 2) + drawCharIntern(glyphSource, (uint8 *)dst, pitch, c1); + else + error("FontTowns::drawChar: unsupported bpp: %d", bpp); +} + +uint FontTowns::sjisToChunk(uint8 f, uint8 s) { + // copied from scumm\charset.cpp + enum { + KANA = 0, + KANJI = 1, + EKANJI = 2 + }; + + int base = s - ((s + 1) % 32); + int c = 0, p = 0, chunk_f = 0, chunk = 0, cr = 0, kanjiType = KANA; + + if (f >= 0x81 && f <= 0x84) kanjiType = KANA; + if (f >= 0x88 && f <= 0x9f) kanjiType = KANJI; + if (f >= 0xe0 && f <= 0xea) kanjiType = EKANJI; + + if ((f > 0xe8 || (f == 0xe8 && base >= 0x9f)) || (f > 0x90 || (f == 0x90 && base >= 0x9f))) { + c = 48; //correction + p = -8; //correction + } + + if (kanjiType == KANA) {//Kana + chunk_f = (f - 0x81) * 2; + } else if (kanjiType == KANJI) {//Standard Kanji + p += f - 0x88; + chunk_f = c + 2 * p; + } else if (kanjiType == EKANJI) {//Enhanced Kanji + p += f - 0xe0; + chunk_f = c + 2 * p; + } + + // Base corrections + if (base == 0x7f && s == 0x7f) + base -= 0x20; + if (base == 0x9f && s == 0xbe) + base += 0x20; + if (base == 0xbf && s == 0xde) + base += 0x20; + //if (base == 0x7f && s == 0x9e) + // base += 0x20; + + switch (base) { + case 0x3f: + cr = 0; //3f + if (kanjiType == KANA) chunk = 1; + else if (kanjiType == KANJI) chunk = 31; + else if (kanjiType == EKANJI) chunk = 111; + break; + case 0x5f: + cr = 0; //5f + if (kanjiType == KANA) chunk = 17; + else if (kanjiType == KANJI) chunk = 47; + else if (kanjiType == EKANJI) chunk = 127; + break; + case 0x7f: + cr = -1; //80 + if (kanjiType == KANA) chunk = 9; + else if (kanjiType == KANJI) chunk = 63; + else if (kanjiType == EKANJI) chunk = 143; + break; + case 0x9f: + cr = 1; //9e + if (kanjiType == KANA) chunk = 2; + else if (kanjiType == KANJI) chunk = 32; + else if (kanjiType == EKANJI) chunk = 112; + break; + case 0xbf: + cr = 1; //be + if (kanjiType == KANA) chunk = 18; + else if (kanjiType == KANJI) chunk = 48; + else if (kanjiType == EKANJI) chunk = 128; + break; + case 0xdf: + cr = 1; //de + if (kanjiType == KANA) chunk = 10; + else if (kanjiType == KANJI) chunk = 64; + else if (kanjiType == EKANJI) chunk = 144; + break; + default: + debug(4, "Invalid Char! f %x s %x base %x c %d p %d", f, s, base, c, p); + } + + debug(6, "Kanji: %c%c f 0x%x s 0x%x base 0x%x c %d p %d chunk %d cr %d index %d", f, s, f, s, base, c, p, chunk, cr, ((chunk_f + chunk) * 32 + (s - base)) + cr); + return ((chunk_f + chunk) * 32 + (s - base)) + cr; +} + +} // end of namespace Graphics + diff --git a/graphics/sjis.h b/graphics/sjis.h new file mode 100644 index 0000000000..f6277b62a4 --- /dev/null +++ b/graphics/sjis.h @@ -0,0 +1,108 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + */ + +#ifndef GRAPHICS_SJIS_H +#define GRAPHICS_SJIS_H + +#include "common/scummsys.h" +#include "common/stream.h" + +#include "graphics/surface.h" + +namespace Graphics { + +/** + * A font that is able to draw SJIS encoded characters. + * + * The font is always monospaced. + */ +class FontSJIS { +public: + virtual ~FontSJIS() {} + + /** + * Returns the height of the font. + */ + virtual uint getFontHeight() const = 0; + + /** + * Returns the width of the font. + */ + virtual uint getFontWidth() const = 0; + + /** + * Draws a SJIS encoded character on the given surface. + */ + void drawChar(Graphics::Surface &dst, uint16 ch, int x, int y, uint32 c1) const { + drawChar(dst.getBasePtr(x, y), ch, c1, dst.pitch, dst.bytesPerPixel); + } + + /** + * Draws a SJIS char on the given raw buffer. + * + * @param dst pointer to the destination + * @param ch character to draw + * @param pitch pitch of the destination buffer (size in *bytes*) + * @param bpp bytes per pixel of the destination buffer + * @param c1 forground color + */ + virtual void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1) const = 0; +}; + +/** + * FM-Towns ROM based SJIS compatible font. + * + * This is used in KYRA and SCI. + */ +class FontTowns : public FontSJIS { +public: + /** + * Loads the ROM data from the given read stream. + */ + bool loadFromStream(Common::ReadStream &stream); + + uint getFontHeight() const { return 16; } + uint getFontWidth() const { return 16; } + + void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1) const; + +private: + template + void drawCharIntern(const uint16 *glyph, uint8 *dst, int pitch, Color c1) const; + + enum { + kFontRomSize = 262144 + }; + + uint16 _fontData[kFontRomSize / 2]; + + static uint sjisToChunk(uint8 low, uint8 high); +}; + +// TODO: Consider adding support for PC98 ROM + +} // end of namespace Graphics + +#endif + -- cgit v1.2.3 From ec2c7cfefa2daeb760cabbd7ded827377bb1121e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 7 Jul 2009 14:22:39 +0000 Subject: Adapt KYRA to use the new Graphics::FontSJIS code. svn-id: r42222 --- engines/kyra/screen.cpp | 277 ++++-------------------------------------------- engines/kyra/screen.h | 14 +-- 2 files changed, 25 insertions(+), 266 deletions(-) diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 963dc3f4d6..f66d2bea91 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -26,7 +26,10 @@ #include "common/endian.h" #include "common/system.h" + #include "graphics/cursorman.h" +#include "graphics/sjis.h" + #include "kyra/screen.h" #include "kyra/kyra_v1.h" #include "kyra/resource.h" @@ -43,6 +46,8 @@ Screen::Screen(KyraEngine_v1 *vm, OSystem *system) _drawShapeVar3 = 1; _drawShapeVar4 = 0; _drawShapeVar5 = 0; + + _sjisFont = 0; } Screen::~Screen() { @@ -56,8 +61,7 @@ Screen::~Screen() { _fonts[f].fontData = NULL; } - delete[] _sjisFontData; - delete[] _sjisTempPage; + delete _sjisFont; delete _screenPalette; delete _internFadePalette; delete[] _decodeShapeBuffer; @@ -78,8 +82,6 @@ bool Screen::init() { _useSJIS = false; _use16ColorMode = _vm->gameFlags().use16ColorMode; - _sjisTempPage = _sjisFontData = 0; - if (_vm->gameFlags().useHiResOverlay) { _useOverlays = true; _useSJIS = (_vm->gameFlags().lang == Common::JA_JPN); @@ -94,14 +96,17 @@ bool Screen::init() { } if (_useSJIS) { - if (!_sjisFontData) { + if (!_sjisFont) { // we use the FM-Towns font rom for PC-98, too, until we feel // like adding support for the PC-98 font //if (_vm->gameFlags().platform == Common::kPlatformFMTowns) { // FM-Towns - _sjisFontData = _vm->resource()->fileData("FMT_FNT.ROM", 0); - if (!_sjisFontData) - error("missing font rom ('FMT_FNT.ROM') required for this version"); + Common::SeekableReadStream *rom = _vm->resource()->createReadStream("FMT_FNT.ROM"); + Graphics::FontTowns *townsFont = new Graphics::FontTowns(); + if (!rom || !townsFont || !townsFont->loadFromStream(*rom)) + error("Could not load font rom ('FMT_FNT.ROM') required for this version"); + _sjisFont = townsFont; + delete rom; /*} else { // PC-98 _sjisFontData = _vm->resource()->fileData("FONT.ROM", 0); @@ -109,13 +114,6 @@ bool Screen::init() { error("missing font rom ('FONT.ROM') required for this version"); }*/ } - - if (!_sjisTempPage) { - _sjisTempPage = new uint8[420]; - assert(_sjisTempPage); - _sjisTempPage2 = _sjisTempPage + 60; - _sjisSourceChar = _sjisTempPage + 384; - } } } @@ -1027,8 +1025,8 @@ int Screen::getCharWidth(uint16 c) const { if (_vm->gameFlags().platform == Common::kPlatformAmiga) return 0; - if (c & 0xFF00) - return SJIS_CHARSIZE >> 1; + if ((c & 0xFF00) && _sjisFont) + return _sjisFont->getFontWidth() >> 1; if (_fonts[_currentFont].lastGlyph < c) return 0; @@ -1115,7 +1113,7 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2 c = READ_LE_UINT16(str - 1); ++str; charWidth = getCharWidth(c); - charHeight = SJIS_CHARSIZE >> 1; + charHeight = _sjisFont->getFontHeight() >> 1; drawCharSJIS(c, x, y); } @@ -3007,93 +3005,6 @@ void Screen::copyOverlayRegion(int x, int y, int x2, int y2, int w, int h, int s } } -// SJIS rendering - -namespace { -int SJIStoFMTChunk(int f, int s) { // copied from scumm\charset.cpp - enum { - KANA = 0, - KANJI = 1, - EKANJI = 2 - }; - int base = s - ((s + 1) % 32); - int c = 0, p = 0, chunk_f = 0, chunk = 0, cr = 0, kanjiType = KANA; - - if (f >= 0x81 && f <= 0x84) kanjiType = KANA; - if (f >= 0x88 && f <= 0x9f) kanjiType = KANJI; - if (f >= 0xe0 && f <= 0xea) kanjiType = EKANJI; - - if ((f > 0xe8 || (f == 0xe8 && base >= 0x9f)) || (f > 0x90 || (f == 0x90 && base >= 0x9f))) { - c = 48; //correction - p = -8; //correction - } - - if (kanjiType == KANA) {//Kana - chunk_f = (f - 0x81) * 2; - } else if (kanjiType == KANJI) {//Standard Kanji - p += f - 0x88; - chunk_f = c + 2 * p; - } else if (kanjiType == EKANJI) {//Enhanced Kanji - p += f - 0xe0; - chunk_f = c + 2 * p; - } - - // Base corrections - if (base == 0x7f && s == 0x7f) - base -= 0x20; - if (base == 0x9f && s == 0xbe) - base += 0x20; - if (base == 0xbf && s == 0xde) - base += 0x20; - //if (base == 0x7f && s == 0x9e) - // base += 0x20; - - switch (base) { - case 0x3f: - cr = 0; //3f - if (kanjiType == KANA) chunk = 1; - else if (kanjiType == KANJI) chunk = 31; - else if (kanjiType == EKANJI) chunk = 111; - break; - case 0x5f: - cr = 0; //5f - if (kanjiType == KANA) chunk = 17; - else if (kanjiType == KANJI) chunk = 47; - else if (kanjiType == EKANJI) chunk = 127; - break; - case 0x7f: - cr = -1; //80 - if (kanjiType == KANA) chunk = 9; - else if (kanjiType == KANJI) chunk = 63; - else if (kanjiType == EKANJI) chunk = 143; - break; - case 0x9f: - cr = 1; //9e - if (kanjiType == KANA) chunk = 2; - else if (kanjiType == KANJI) chunk = 32; - else if (kanjiType == EKANJI) chunk = 112; - break; - case 0xbf: - cr = 1; //be - if (kanjiType == KANA) chunk = 18; - else if (kanjiType == KANJI) chunk = 48; - else if (kanjiType == EKANJI) chunk = 128; - break; - case 0xdf: - cr = 1; //de - if (kanjiType == KANA) chunk = 10; - else if (kanjiType == KANJI) chunk = 64; - else if (kanjiType == EKANJI) chunk = 144; - break; - default: - debug(4, "Invalid Char! f %x s %x base %x c %d p %d", f, s, base, c, p); - } - - debug(6, "Kanji: %c%c f 0x%x s 0x%x base 0x%x c %d p %d chunk %d cr %d index %d", f, s, f, s, base, c, p, chunk, cr, ((chunk_f + chunk) * 32 + (s - base)) + cr); - return ((chunk_f + chunk) * 32 + (s - base)) + cr; -} -} // end of anonymous namespace - void Screen::drawCharSJIS(uint16 c, int x, int y) { int color1, color2; @@ -3107,12 +3018,8 @@ void Screen::drawCharSJIS(uint16 c, int x, int y) { color2 = _textColorsMap[0]; } - memset(_sjisTempPage2, _sjisInvisibleColor, 324); - memset(_sjisSourceChar, 0, 36); - memcpy(_sjisSourceChar, _sjisFontData + 0x20 * SJIStoFMTChunk(c & 0xff, c >> 8), 0x20); - if (_curPage == 0 || _curPage == 1) - addDirtyRect(x, y, SJIS_CHARSIZE >> 1, SJIS_CHARSIZE >> 1); + addDirtyRect(x, y, _sjisFont->getFontWidth() >> 1, _sjisFont->getFontHeight() >> 1); x <<= 1; y <<= 1; @@ -3124,154 +3031,10 @@ void Screen::drawCharSJIS(uint16 c, int x, int y) { } destPage += y * 640 + x; - uint8 *src = 0, *dst = 0; - - if (color2 != _sjisInvisibleColor) { - // draw color2 shadow - src = _sjisSourceChar; - dst = _sjisTempPage2; - for (int i = 0; i < SJIS_CHARSIZE; i++) { - *((uint16*)dst) = READ_LE_UINT16(src); - dst += 2; src += 2; - *dst++ = 0; - } - - src = _sjisTempPage2; - dst = _sjisTempPage; - memset(dst, 0, 60); - for (int i = 0; i < 48; i++) - *dst++ |= *src++; - - src = _sjisTempPage2; - dst = _sjisTempPage + 3; - for (int i = 0; i < 48; i++) - *dst++ |= *src++; - - src = _sjisTempPage2; - dst = _sjisTempPage + 6; - for (int i = 0; i < 48; i++) - *dst++ |= *src++; - - for (int i = 0; i < 2; i++) { - src = _sjisTempPage; - for (int ii = 0; ii < SJIS_CHARSIZE; ii++) { - uint8 cy2 = 0; - uint8 cy1 = 0; - for (int iii = 0; iii < 3; iii++) { - cy1 = *src & 1; - *src |= ((*src >> 1) | (cy2 << 7)); - cy2 = cy1; - src++; - } - } - } - - src = _sjisTempPage2; - for (int i = 0; i < SJIS_CHARSIZE; i++) { - uint8 cy2 = 0; - uint8 cy1 = 0; - for (int ii = 0; ii < 3; ii++) { - cy1 = *src & 1; - *src = ((*src >> 1) | (cy2 << 7)); - cy2 = cy1; - src++; - } - } - - src = _sjisTempPage2; - dst = _sjisTempPage + 3; - for (int i = 0; i < 48; i++) - *dst++ ^= *src++; - - memset(_sjisTempPage2, _sjisInvisibleColor, 324); - src = _sjisTempPage; - dst = _sjisTempPage2; - - uint8 height = SJIS_CHARSIZE * 3; - uint8 width = SJIS_CHARSIZE; - if (color2 & 0xff00) { - height -= 3; - width--; - dst += 0x13; - } - - for (int i = 0; i < height; i++) { - uint8 rs = *src++; - for (int ii = 0; ii < 8; ii++) { - if (rs & 0x80) - *dst = (color2 & 0xff); - rs <<= 1; - dst++; - - if (!--width) { - width = SJIS_CHARSIZE; - if (color2 & 0xff00) { - width--; - dst++; - } - break; - } - } - } - } - - // draw color1 char - src = _sjisSourceChar; - dst = _sjisTempPage; - - for (int i = 0; i < SJIS_CHARSIZE; i++) { - *(uint16*)dst = READ_LE_UINT16(src); - dst += 2; src += 2; - *dst++ = 0; - } - - src = _sjisTempPage; - dst = _sjisTempPage2; - if (color2 != _sjisInvisibleColor) - color1 = (color1 & 0xff) | 0x100; - - uint8 height = SJIS_CHARSIZE * 3; - uint8 width = SJIS_CHARSIZE; - if (color1 & 0xff00) { - height -= 3; - width--; - dst += 0x13; - } - - for (int i = 0; i < height; i++) { - uint8 rs = *src++; - for (int ii = 0; ii < 8; ii++) { - if (rs & 0x80) - *dst = (color1 & 0xff); - rs <<= 1; - dst++; - - if (!--width) { - width = SJIS_CHARSIZE; - if (color1 & 0xff00) { - width--; - dst++; - } - break; - } - } - } - - // copy char to surface - src = _sjisTempPage2; - dst = destPage; - int pitch = 640 - SJIS_CHARSIZE; - - for (int i = 0; i < SJIS_CHARSIZE; i++) { - for (int ii = 0; ii < SJIS_CHARSIZE; ii++) { - if (*src != _sjisInvisibleColor) - *dst = *src; - src++; - dst++; - } - dst += pitch; - } + // We used to have shadow around the gylphs, with the old drawing code, but that didn't + // match the original. + _sjisFont->drawChar(destPage, c, 640, 1, color1); } #pragma mark - diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index 956bd7107e..a7a7efa7ca 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -35,6 +35,10 @@ class OSystem; +namespace Graphics { +class FontSJIS; +} // end of namespace Graphics + namespace Kyra { typedef Common::Functor0 UpdateFunctor; @@ -360,11 +364,6 @@ protected: void drawCharANSI(uint8 c, int x, int y); void drawCharSJIS(uint16 c, int x, int y); - enum { - SJIS_CHARSIZE = 18, - SJIS_CHARS = 8192 - }; - int16 encodeShapeAndCalculateSize(uint8 *from, uint8 *to, int size); template static void wrapped_decodeFrameDelta(uint8 *dst, const uint8 *src); @@ -377,10 +376,7 @@ protected: bool _useSJIS; bool _use16ColorMode; - uint8 *_sjisFontData; - uint8 *_sjisTempPage; - uint8 *_sjisTempPage2; - uint8 *_sjisSourceChar; + Graphics::FontSJIS *_sjisFont; uint8 _sjisInvisibleColor; Palette *_screenPalette; -- cgit v1.2.3 From 9bdf1a2ab139d364ee30906a18dc05de8c88e487 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 7 Jul 2009 17:11:29 +0000 Subject: kFeatures800 -> kFeatures800x600 in order to have more meaningful name svn-id: r42229 --- engines/gob/detection.cpp | 4 ++-- engines/gob/gob.cpp | 4 ++-- engines/gob/gob.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/gob/detection.cpp b/engines/gob/detection.cpp index d7018f349e..3827c3635c 100644 --- a/engines/gob/detection.cpp +++ b/engines/gob/detection.cpp @@ -3666,7 +3666,7 @@ static const GOBGameDescription gameDescriptions[] = { GUIO_NOSUBTITLES | GUIO_NOSPEECH }, kGameTypeMagicStones, - kFeatures800, + kFeatures800x600, "ed4.stk", "main.obc", 0 }, { @@ -4235,7 +4235,7 @@ static const GOBGameDescription fallbackDescs[] = { GUIO_NOSUBTITLES | GUIO_NOSPEECH }, kGameTypeMagicStones, - kFeatures800, + kFeatures800x600, "ed4.stk", "main.obc", 0 }, { diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 5fe5971e8c..94255b1277 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -205,8 +205,8 @@ bool GobEngine::isBATDemo() const { return (_features & kFeaturesBATDemo) != 0; } -bool GobEngine::is800() const { - return (_features & kFeatures800) != 0; +bool GobEngine::is800x600() const { + return (_features & kFeatures800x600) != 0; } bool GobEngine::isDemo() const { diff --git a/engines/gob/gob.h b/engines/gob/gob.h index aa87881b05..02f6af51bf 100644 --- a/engines/gob/gob.h +++ b/engines/gob/gob.h @@ -121,7 +121,7 @@ enum Features { kFeatures640 = 1 << 3, kFeaturesSCNDemo = 1 << 4, kFeaturesBATDemo = 1 << 5, - kFeatures800 = 1 << 6 + kFeatures800x600 = 1 << 6 }; enum { @@ -218,7 +218,7 @@ public: bool hasAdlib() const; bool isSCNDemo() const; bool isBATDemo() const; - bool is800() const; + bool is800x600() const; bool isDemo() const; GobEngine(OSystem *syst); -- cgit v1.2.3 From 62eebc3e17f952defaa779ed1dc770570dac309d Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 7 Jul 2009 18:10:35 +0000 Subject: - Added support for outlined FM-Towns ROM drawing - Adapted KYRA to use that svn-id: r42230 --- engines/kyra/screen.cpp | 12 ++++++++--- graphics/sjis.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++------- graphics/sjis.h | 27 ++++++++++++++++++------ 3 files changed, 79 insertions(+), 16 deletions(-) diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index f66d2bea91..079529f1ef 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -114,9 +114,12 @@ bool Screen::init() { error("missing font rom ('FONT.ROM') required for this version"); }*/ } + + _sjisFont->enableShadow(!_use16ColorMode); } } + _curPage = 0; uint8 *pagePtr = new uint8[SCREEN_PAGE_SIZE * 8]; for (int pageNum = 0; pageNum < SCREEN_PAGE_NUM; pageNum += 2) @@ -3016,6 +3019,9 @@ void Screen::drawCharSJIS(uint16 c, int x, int y) { } else { color1 = _textColorsMap[1]; color2 = _textColorsMap[0]; + + if (color2 == _sjisInvisibleColor) + _sjisFont->enableShadow(false); } if (_curPage == 0 || _curPage == 1) @@ -3032,9 +3038,9 @@ void Screen::drawCharSJIS(uint16 c, int x, int y) { destPage += y * 640 + x; - // We used to have shadow around the gylphs, with the old drawing code, but that didn't - // match the original. - _sjisFont->drawChar(destPage, c, 640, 1, color1); + _sjisFont->drawChar(destPage, c, 640, 1, color1, color2); + + _sjisFont->enableShadow(!_use16ColorMode); } #pragma mark - diff --git a/graphics/sjis.cpp b/graphics/sjis.cpp index 4421a86eef..1478c1c286 100644 --- a/graphics/sjis.cpp +++ b/graphics/sjis.cpp @@ -34,9 +34,44 @@ bool FontTowns::loadFromStream(Common::ReadStream &stream) { return !stream.err(); } +template +void FontTowns::drawCharInternShadow(const uint16 *glyph, uint8 *dst, int pitch, Color c1, Color c2) const { + uint32 outlineGlyph[18]; + memset(outlineGlyph, 0, sizeof(outlineGlyph)); + + // Create an outline map including the original character + const uint16 *src = glyph; + for (int i = 0; i < 16; ++i) { + uint32 line = *src++; + line = (line << 2) | (line << 1) | (line << 0); + + outlineGlyph[i + 0] |= line; + outlineGlyph[i + 1] |= line; + outlineGlyph[i + 2] |= line; + } + + uint8 *dstLine = dst; + for (int y = 0; y < 18; ++y) { + Color *lineBuf = (Color *)dstLine; + uint32 line = outlineGlyph[y]; + + for (int x = 0; x < 18; ++x) { + if (line & 0x20000) + *lineBuf = c2; + line <<= 1; + ++lineBuf; + } + + dstLine += pitch; + } + + // draw the original char + drawCharIntern(glyph, dst + pitch + 1, pitch, c1); +} + template void FontTowns::drawCharIntern(const uint16 *glyph, uint8 *dst, int pitch, Color c1) const { - for (int y = getFontHeight(); y > 0; --y) { + for (int y = 0; y < 16; ++y) { Color *lineBuf = (Color *)dst; uint16 line = *glyph++; @@ -51,15 +86,22 @@ void FontTowns::drawCharIntern(const uint16 *glyph, uint8 *dst, int pitch, Color } } -void FontTowns::drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1) const { +void FontTowns::drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2) const { const uint16 *glyphSource = _fontData + sjisToChunk(ch & 0xFF, ch >> 8) * 16; - if (bpp == 1) - drawCharIntern(glyphSource, (uint8 *)dst, pitch, c1); - else if (bpp == 2) - drawCharIntern(glyphSource, (uint8 *)dst, pitch, c1); - else + if (bpp == 1) { + if (!_shadowEnabled) + drawCharIntern(glyphSource, (uint8 *)dst, pitch, c1); + else + drawCharInternShadow(glyphSource, (uint8 *)dst, pitch, c1, c2); + } else if (bpp == 2) { + if (!_shadowEnabled) + drawCharIntern(glyphSource, (uint8 *)dst, pitch, c1); + else + drawCharInternShadow(glyphSource, (uint8 *)dst, pitch, c1, c2); + } else { error("FontTowns::drawChar: unsupported bpp: %d", bpp); + } } uint FontTowns::sjisToChunk(uint8 f, uint8 s) { diff --git a/graphics/sjis.h b/graphics/sjis.h index f6277b62a4..63013dccf1 100644 --- a/graphics/sjis.h +++ b/graphics/sjis.h @@ -41,6 +41,14 @@ class FontSJIS { public: virtual ~FontSJIS() {} + /** + * Enable shadow drawing. + * + * After changing shadow state, getFontHeight and getFontWidth might return + * different values! + */ + virtual void enableShadow(bool enable) {} + /** * Returns the height of the font. */ @@ -54,8 +62,8 @@ public: /** * Draws a SJIS encoded character on the given surface. */ - void drawChar(Graphics::Surface &dst, uint16 ch, int x, int y, uint32 c1) const { - drawChar(dst.getBasePtr(x, y), ch, c1, dst.pitch, dst.bytesPerPixel); + void drawChar(Graphics::Surface &dst, uint16 ch, int x, int y, uint32 c1, uint32 c2) const { + drawChar(dst.getBasePtr(x, y), ch, c1, c2, dst.pitch, dst.bytesPerPixel); } /** @@ -66,8 +74,9 @@ public: * @param pitch pitch of the destination buffer (size in *bytes*) * @param bpp bytes per pixel of the destination buffer * @param c1 forground color + * @param c2 shadow/outline color */ - virtual void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1) const = 0; + virtual void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2) const = 0; }; /** @@ -82,12 +91,17 @@ public: */ bool loadFromStream(Common::ReadStream &stream); - uint getFontHeight() const { return 16; } - uint getFontWidth() const { return 16; } + void enableShadow(bool enable) { _shadowEnabled = enable; } - void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1) const; + uint getFontHeight() const { return _shadowEnabled ? 18 : 16; } + uint getFontWidth() const { return _shadowEnabled ? 18 : 16; } + + void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2) const; private: + template + void drawCharInternShadow(const uint16 *glyph, uint8 *dst, int pitch, Color c1, Color c2) const; + template void drawCharIntern(const uint16 *glyph, uint8 *dst, int pitch, Color c1) const; @@ -95,6 +109,7 @@ private: kFontRomSize = 262144 }; + bool _shadowEnabled; uint16 _fontData[kFontRomSize / 2]; static uint sjisToChunk(uint8 low, uint8 high); -- cgit v1.2.3 From 8c65d4d4a94f5a0330b1c86f6378ffada20dd1be Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 7 Jul 2009 18:17:30 +0000 Subject: - Rename FontSJIS::enableShadow to enableOutline. - Initialize outline to false by default in FontTowns. svn-id: r42231 --- engines/kyra/screen.cpp | 6 +++--- graphics/sjis.cpp | 10 +++++----- graphics/sjis.h | 20 +++++++++++--------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 079529f1ef..f0e2aec987 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -115,7 +115,7 @@ bool Screen::init() { }*/ } - _sjisFont->enableShadow(!_use16ColorMode); + _sjisFont->enableOutline(!_use16ColorMode); } } @@ -3021,7 +3021,7 @@ void Screen::drawCharSJIS(uint16 c, int x, int y) { color2 = _textColorsMap[0]; if (color2 == _sjisInvisibleColor) - _sjisFont->enableShadow(false); + _sjisFont->enableOutline(false); } if (_curPage == 0 || _curPage == 1) @@ -3040,7 +3040,7 @@ void Screen::drawCharSJIS(uint16 c, int x, int y) { _sjisFont->drawChar(destPage, c, 640, 1, color1, color2); - _sjisFont->enableShadow(!_use16ColorMode); + _sjisFont->enableOutline(!_use16ColorMode); } #pragma mark - diff --git a/graphics/sjis.cpp b/graphics/sjis.cpp index 1478c1c286..176ec8eda5 100644 --- a/graphics/sjis.cpp +++ b/graphics/sjis.cpp @@ -35,7 +35,7 @@ bool FontTowns::loadFromStream(Common::ReadStream &stream) { } template -void FontTowns::drawCharInternShadow(const uint16 *glyph, uint8 *dst, int pitch, Color c1, Color c2) const { +void FontTowns::drawCharInternOutline(const uint16 *glyph, uint8 *dst, int pitch, Color c1, Color c2) const { uint32 outlineGlyph[18]; memset(outlineGlyph, 0, sizeof(outlineGlyph)); @@ -90,15 +90,15 @@ void FontTowns::drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, ui const uint16 *glyphSource = _fontData + sjisToChunk(ch & 0xFF, ch >> 8) * 16; if (bpp == 1) { - if (!_shadowEnabled) + if (!_outlineEnabled) drawCharIntern(glyphSource, (uint8 *)dst, pitch, c1); else - drawCharInternShadow(glyphSource, (uint8 *)dst, pitch, c1, c2); + drawCharInternOutline(glyphSource, (uint8 *)dst, pitch, c1, c2); } else if (bpp == 2) { - if (!_shadowEnabled) + if (!_outlineEnabled) drawCharIntern(glyphSource, (uint8 *)dst, pitch, c1); else - drawCharInternShadow(glyphSource, (uint8 *)dst, pitch, c1, c2); + drawCharInternOutline(glyphSource, (uint8 *)dst, pitch, c1, c2); } else { error("FontTowns::drawChar: unsupported bpp: %d", bpp); } diff --git a/graphics/sjis.h b/graphics/sjis.h index 63013dccf1..9a20670bf3 100644 --- a/graphics/sjis.h +++ b/graphics/sjis.h @@ -42,12 +42,12 @@ public: virtual ~FontSJIS() {} /** - * Enable shadow drawing. + * Enable outline drawing. * - * After changing shadow state, getFontHeight and getFontWidth might return + * After changing outline state, getFontHeight and getFontWidth might return * different values! */ - virtual void enableShadow(bool enable) {} + virtual void enableOutline(bool enable) {} /** * Returns the height of the font. @@ -74,7 +74,7 @@ public: * @param pitch pitch of the destination buffer (size in *bytes*) * @param bpp bytes per pixel of the destination buffer * @param c1 forground color - * @param c2 shadow/outline color + * @param c2 outline color */ virtual void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2) const = 0; }; @@ -86,21 +86,23 @@ public: */ class FontTowns : public FontSJIS { public: + FontTowns() : _outlineEnabled(false) {} + /** * Loads the ROM data from the given read stream. */ bool loadFromStream(Common::ReadStream &stream); - void enableShadow(bool enable) { _shadowEnabled = enable; } + void enableOutline(bool enable) { _outlineEnabled = enable; } - uint getFontHeight() const { return _shadowEnabled ? 18 : 16; } - uint getFontWidth() const { return _shadowEnabled ? 18 : 16; } + uint getFontHeight() const { return _outlineEnabled ? 18 : 16; } + uint getFontWidth() const { return _outlineEnabled ? 18 : 16; } void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2) const; private: template - void drawCharInternShadow(const uint16 *glyph, uint8 *dst, int pitch, Color c1, Color c2) const; + void drawCharInternOutline(const uint16 *glyph, uint8 *dst, int pitch, Color c1, Color c2) const; template void drawCharIntern(const uint16 *glyph, uint8 *dst, int pitch, Color c1) const; @@ -109,7 +111,7 @@ private: kFontRomSize = 262144 }; - bool _shadowEnabled; + bool _outlineEnabled; uint16 _fontData[kFontRomSize / 2]; static uint sjisToChunk(uint8 low, uint8 high); -- cgit v1.2.3 From e35dd4df1c1f84e29210a4ce263d4b85ea4caf53 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 7 Jul 2009 19:00:39 +0000 Subject: Change "FM-Towns" to "FM-TOWNS" for consistency. svn-id: r42232 --- engines/kyra/detection.cpp | 4 ++-- engines/kyra/saveload.cpp | 2 +- engines/kyra/screen.cpp | 6 +++--- graphics/sjis.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp index 63d15419d2..3199a043e7 100644 --- a/engines/kyra/detection.cpp +++ b/engines/kyra/detection.cpp @@ -230,7 +230,7 @@ const KYRAGameDescription adGameDescs[] = { KYRA1_FLOPPY_FLAGS }, - { // FM-Towns version + { // FM-TOWNS version { "kyra1", 0, @@ -638,7 +638,7 @@ const KYRAGameDescription adGameDescs[] = { KYRA2_DEMO_FLAGS }, - { // FM-Towns + { // FM-TOWNS { "kyra2", 0, diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp index ecd6bbe450..a1aaf77d51 100644 --- a/engines/kyra/saveload.cpp +++ b/engines/kyra/saveload.cpp @@ -168,7 +168,7 @@ Common::SeekableReadStream *KyraEngine_v1::openSaveForReading(const char *filena delete in; return 0; } else if ((header.flags & GF_FMTOWNS) && !(_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98)) { - warning("Can not load FM-Towns/PC98 savefile for this (non FM-Towns/PC98) gameversion"); + warning("Can not load FM-TOWNS/PC98 savefile for this (non FM-TOWNS/PC98) gameversion"); delete in; return 0; } diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index f0e2aec987..426907c871 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -97,10 +97,10 @@ bool Screen::init() { if (_useSJIS) { if (!_sjisFont) { - // we use the FM-Towns font rom for PC-98, too, until we feel + // we use the FM-TOWNS font rom for PC-98, too, until we feel // like adding support for the PC-98 font //if (_vm->gameFlags().platform == Common::kPlatformFMTowns) { - // FM-Towns + // FM-TOWNS Common::SeekableReadStream *rom = _vm->resource()->createReadStream("FMT_FNT.ROM"); Graphics::FontTowns *townsFont = new Graphics::FontTowns(); if (!rom || !townsFont || !townsFont->loadFromStream(*rom)) @@ -658,7 +658,7 @@ void Screen::copyToPage0(int y, int h, uint8 page, uint8 *seqBuf) { } addDirtyRect(0, y, SCREEN_W, h); // This would remove the text in the end sequence of - // the (Kyrandia 1) FM-Towns version. + // the (Kyrandia 1) FM-TOWNS version. // Since this method is just used for the Seqplayer // this shouldn't be a problem anywhere else, so it's // safe to disable the call here. diff --git a/graphics/sjis.h b/graphics/sjis.h index 9a20670bf3..c7eeeed9f6 100644 --- a/graphics/sjis.h +++ b/graphics/sjis.h @@ -80,7 +80,7 @@ public: }; /** - * FM-Towns ROM based SJIS compatible font. + * FM-TOWNS ROM based SJIS compatible font. * * This is used in KYRA and SCI. */ -- cgit v1.2.3 From 2a117d9a90df395a388919d2734024d19f24b8f3 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 7 Jul 2009 19:00:51 +0000 Subject: Add guards to only include SJIS font code, when KYRA or SCI is enabled. svn-id: r42233 --- graphics/sjis.cpp | 8 ++++++++ graphics/sjis.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/graphics/sjis.cpp b/graphics/sjis.cpp index 176ec8eda5..7459c98f6c 100644 --- a/graphics/sjis.cpp +++ b/graphics/sjis.cpp @@ -22,6 +22,12 @@ * $Id$ */ +// The code in this files is currently only used in KYRA and SCI. +// So if no of those is enabled, we will not compile it. +// If you plan to use this code in another engine, you will have +// to add the proper defined check here and in sjis.h +#if defined(ENABLE_KYRA) || defined(ENABLE_SCI) + #include "graphics/sjis.h" #include "common/debug.h" @@ -191,3 +197,5 @@ uint FontTowns::sjisToChunk(uint8 f, uint8 s) { } // end of namespace Graphics +#endif // defined(ENABLE_KYRA) || defined(ENABLE_SCI) + diff --git a/graphics/sjis.h b/graphics/sjis.h index c7eeeed9f6..ca5fc95004 100644 --- a/graphics/sjis.h +++ b/graphics/sjis.h @@ -22,6 +22,12 @@ * $Id$ */ +// The code in this files is currently only used in KYRA and SCI. +// So if no of those is enabled, we will not compile it. +// If you plan to use this code in another engine, you will have +// to add the proper defined check here and in sjis.cpp +#if defined(ENABLE_KYRA) || defined(ENABLE_SCI) + #ifndef GRAPHICS_SJIS_H #define GRAPHICS_SJIS_H @@ -123,3 +129,5 @@ private: #endif +#endif // defined(ENABLE_KYRA) || defined(ENABLE_SCI) + -- cgit v1.2.3 From 832540f64f6f0c9a77029fce17d4f06516c688ef Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 7 Jul 2009 19:18:32 +0000 Subject: Simply compile guard of SJIS code and fix comment. svn-id: r42234 --- graphics/sjis.cpp | 10 +++------- graphics/sjis.h | 8 +++++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/graphics/sjis.cpp b/graphics/sjis.cpp index 7459c98f6c..5392a1c9a4 100644 --- a/graphics/sjis.cpp +++ b/graphics/sjis.cpp @@ -22,14 +22,10 @@ * $Id$ */ -// The code in this files is currently only used in KYRA and SCI. -// So if no of those is enabled, we will not compile it. -// If you plan to use this code in another engine, you will have -// to add the proper defined check here and in sjis.h -#if defined(ENABLE_KYRA) || defined(ENABLE_SCI) - #include "graphics/sjis.h" +#ifdef GRAPHICS_SJIS_H + #include "common/debug.h" namespace Graphics { @@ -197,5 +193,5 @@ uint FontTowns::sjisToChunk(uint8 f, uint8 s) { } // end of namespace Graphics -#endif // defined(ENABLE_KYRA) || defined(ENABLE_SCI) +#endif // defined(GRAPHICS_SJIS_H) diff --git a/graphics/sjis.h b/graphics/sjis.h index ca5fc95004..f7321742af 100644 --- a/graphics/sjis.h +++ b/graphics/sjis.h @@ -22,10 +22,12 @@ * $Id$ */ -// The code in this files is currently only used in KYRA and SCI. -// So if no of those is enabled, we will not compile it. +// The code in this file is currently only used in KYRA and SCI. +// So if neither of those is enabled, we will skip compiling it. // If you plan to use this code in another engine, you will have -// to add the proper defined check here and in sjis.cpp +// to add the proper define check here. +// Also please add the define check at the comment after the +// matching #endif further down this file. #if defined(ENABLE_KYRA) || defined(ENABLE_SCI) #ifndef GRAPHICS_SJIS_H -- cgit v1.2.3 From 4dc454581cb9a8f673cf10e9508eeb1325570f79 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 7 Jul 2009 19:18:53 +0000 Subject: Change all uses of FM-Towns/fm-towns to FM-TOWNS. svn-id: r42235 --- NEWS | 2 +- engines/kyra/sequences_hof.cpp | 10 +++++----- engines/kyra/sequences_lok.cpp | 2 +- engines/scumm/verbs.cpp | 2 +- tools/create_kyradat/create_kyradat.cpp | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/NEWS b/NEWS index ce18b0fea7..2ab1cf239c 100644 --- a/NEWS +++ b/NEWS @@ -323,7 +323,7 @@ For a more comprehensive changelog for the latest experimental SVN code, see: - Renamed Simon engine to AGOS. Kyrandia: - - Added support for FM-Towns version (both English and Japanese). + - Added support for FM-TOWNS version (both English and Japanese). BASS: - Fixed long-standing font bug. We were using the control panel font for diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp index 90b2fdd580..81ab237e0f 100644 --- a/engines/kyra/sequences_hof.cpp +++ b/engines/kyra/sequences_hof.cpp @@ -770,12 +770,12 @@ int KyraEngine_HoF::seq_introDragon(WSAMovie_v2 *wsaObj, int x, int y, int frm) } int KyraEngine_HoF::seq_introDarm(WSAMovie_v2 *wsaObj, int x, int y, int frm) { - //NULLSUB (at least in fm-towns version) + //NULLSUB (at least in FM-TOWNS version) return frm; } int KyraEngine_HoF::seq_introLibrary2(WSAMovie_v2 *wsaObj, int x, int y, int frm) { - //NULLSUB (at least in fm-towns version) + //NULLSUB (at least in FM-TOWNS version) return frm; } @@ -788,7 +788,7 @@ int KyraEngine_HoF::seq_introMarco(WSAMovie_v2 *wsaObj, int x, int y, int frm) { } int KyraEngine_HoF::seq_introHand1a(WSAMovie_v2 *wsaObj, int x, int y, int frm) { - //NULLSUB (at least in fm-towns version) + //NULLSUB (at least in FM-TOWNS version) return frm; } @@ -805,12 +805,12 @@ int KyraEngine_HoF::seq_introHand1c(WSAMovie_v2 *wsaObj, int x, int y, int frm) } int KyraEngine_HoF::seq_introHand2(WSAMovie_v2 *wsaObj, int x, int y, int frm) { - //NULLSUB (at least in fm-towns version) + //NULLSUB (at least in FM-TOWNS version) return frm; } int KyraEngine_HoF::seq_introHand3(WSAMovie_v2 *wsaObj, int x, int y, int frm) { - //NULLSUB (at least in fm-towns version) + //NULLSUB (at least in FM-TOWNS version) return frm; } diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp index d483409090..0279831c9d 100644 --- a/engines/kyra/sequences_lok.cpp +++ b/engines/kyra/sequences_lok.cpp @@ -1049,7 +1049,7 @@ void KyraEngine_LoK::seq_playCredits() { _screen->setTextColorMap(colorMap); _screen->_charWidth = -1; - // we only need this for the fm-towns version + // we only need this for the FM-TOWNS version if (_flags.platform == Common::kPlatformFMTowns && _configMusic == 1) snd_playWanderScoreViaMap(53, 1); diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp index e62d9406d3..81b28ce563 100644 --- a/engines/scumm/verbs.cpp +++ b/engines/scumm/verbs.cpp @@ -567,7 +567,7 @@ void ScummEngine::checkExecVerbs() { } if (_game.platform == Common::kPlatformFMTowns && _game.version == 3) { - // HACK: In the FM-Towns games Indy3, Loom and Zak the most significant bit is set for special keys + // HACK: In the FM-TOWNS games Indy3, Loom and Zak the most significant bit is set for special keys // like F5 (=0x8005) or joystick buttons (mask 0xFE00, e.g. SELECT=0xFE40 for the save/load menu). // Hence the distinction with (_mouseAndKeyboardStat < MBS_MAX_KEY) between mouse- and key-events is not applicable // to this games, so we have to remap the special keys here. diff --git a/tools/create_kyradat/create_kyradat.cpp b/tools/create_kyradat/create_kyradat.cpp index a87a6eeaa6..ead0c232b1 100644 --- a/tools/create_kyradat/create_kyradat.cpp +++ b/tools/create_kyradat/create_kyradat.cpp @@ -507,14 +507,14 @@ bool extractStrings(PAKFile &out, const Game *g, const byte *data, const uint32 if (g->special == kFMTownsVersionE || g->special == kFMTownsVersionJ || g->special == k2TownsFile1E || g->special == k2TownsFile1J || g->special == k2TownsFile2E || g->special == k2TownsFile2J || fmtPatch == 5) { - // prevents creation of empty entries (which we have mostly between all strings in the fm-towns version) + // prevents creation of empty entries (which we have mostly between all strings in the FM-TOWNS version) while (!data[++i]) { if (i == size) break; targetsize--; } if (fmtPatch == 1) { - // Here is the first step of the extra treatment for all fm-towns string arrays that + // Here is the first step of the extra treatment for all FM-TOWNS string arrays that // contain more than one string and which the original code // addresses via stringname[boolJapanese]. // We simply skip every other string @@ -593,7 +593,7 @@ bool extractStrings(PAKFile &out, const Game *g, const byte *data, const uint32 } if (fmtPatch == 1) { - // Here is the extra treatment for all fm-towns string arrays that + // Here is the extra treatment for all FM-TOWNS string arrays that // contain more than one string and which the original code // addresses via stringname[boolJapanese]. // We simply skip every other string @@ -637,7 +637,7 @@ bool extractStrings(PAKFile &out, const Game *g, const byte *data, const uint32 } bool extractRooms(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch) { - // different entry size for the fm-towns version + // different entry size for the FM-TOWNS version const int roomEntrySize = (g->special == kFMTownsVersionE || g->special == kFMTownsVersionJ) ? (0x69) : ((g->special == kAmigaVersion) ? 0x52 : 0x51); const int countRooms = size / roomEntrySize; -- cgit v1.2.3 From 802abfd8cbaf3143f2c66053a4839ee3914596ce Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 7 Jul 2009 20:01:15 +0000 Subject: Added a workaround for incorrect font references in LSL1VGA (which was the original purpose of the code removed in rev. 42219) svn-id: r42238 --- engines/sci/gfx/gfx_resmgr.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index 5a1556ca41..4a97d94f31 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -616,6 +616,12 @@ gfx_bitmap_font_t *GfxResManager::getFont(int num, bool scaled) { gfx_resource_t *res = NULL; int hash = getOptionsHash(GFX_RESOURCE_TYPE_FONT); + // Workaround: LSL1VGA mixes its own internal fonts with the global + // SCI ones, so we translate them here + if (!resMap.contains(num) && num >= 2048) + if (!_resManager->testResource(ResourceId(kResourceTypeFont, num))) + num = num - 2048; + res = resMap.contains(num) ? resMap[num] : NULL; if (!res || res->mode != hash) { -- cgit v1.2.3 From ee15f8f51ad5ec1a6fd776c4a12fb4167dfec8ed Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 7 Jul 2009 20:17:07 +0000 Subject: Improved the LSL1VGA workaround after talking with waltervn svn-id: r42239 --- engines/sci/gfx/gfx_resmgr.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index 4a97d94f31..d6d5a9ec3c 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -617,10 +617,9 @@ gfx_bitmap_font_t *GfxResManager::getFont(int num, bool scaled) { int hash = getOptionsHash(GFX_RESOURCE_TYPE_FONT); // Workaround: LSL1VGA mixes its own internal fonts with the global - // SCI ones, so we translate them here - if (!resMap.contains(num) && num >= 2048) - if (!_resManager->testResource(ResourceId(kResourceTypeFont, num))) - num = num - 2048; + // SCI ones, so we translate them here, by removing their extra bits + if (!resMap.contains(num) && !_resManager->testResource(ResourceId(kResourceTypeFont, num))) + num = num & 0x7ff; res = resMap.contains(num) ? resMap[num] : NULL; -- cgit v1.2.3 From a62b26ea8026666fd658337bcc061c1c4e2ab3f9 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 7 Jul 2009 20:43:27 +0000 Subject: Silenced the very chatty song iterator console messages by converting them to appropriate debug messages svn-id: r42240 --- engines/sci/engine/ksound.cpp | 4 ++-- engines/sci/gfx/gfx_resmgr.cpp | 2 +- engines/sci/sfx/iterator.cpp | 23 ++++++++++++----------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index ba70bf9f73..7614b2bc10 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -940,14 +940,14 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { case SI_ABSOLUTE_CUE: signal = cue; - fprintf(stderr, "[CUE] %04x:%04x Absolute Cue: %d\n", + debugC(2, kDebugLevelSound, "[CUE] %04x:%04x Absolute Cue: %d\n", PRINT_REG(obj), signal); PUT_SEL32V(obj, signal, signal); break; case SI_RELATIVE_CUE: - fprintf(stderr, "[CUE] %04x:%04x Relative Cue: %d\n", + debugC(2, kDebugLevelSound, "[CUE] %04x:%04x Relative Cue: %d\n", PRINT_REG(obj), cue); PUT_SEL32V(obj, dataInc, cue); diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index d6d5a9ec3c..98c5c12a70 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -619,7 +619,7 @@ gfx_bitmap_font_t *GfxResManager::getFont(int num, bool scaled) { // Workaround: LSL1VGA mixes its own internal fonts with the global // SCI ones, so we translate them here, by removing their extra bits if (!resMap.contains(num) && !_resManager->testResource(ResourceId(kResourceTypeFont, num))) - num = num & 0x7ff; + num = num & 0x7ff; res = resMap.contains(num) ? resMap[num] : NULL; diff --git a/engines/sci/sfx/iterator.cpp b/engines/sci/sfx/iterator.cpp index 4e5b20a5d2..ebba4bceac 100644 --- a/engines/sci/sfx/iterator.cpp +++ b/engines/sci/sfx/iterator.cpp @@ -27,6 +27,7 @@ #include "common/util.h" +#include "sci/sci.h" #include "sci/sfx/iterator_internal.h" #include "sci/sfx/misc.h" // for sfx_player_tell_synth #include "sci/tools.h" @@ -233,7 +234,7 @@ int BaseSongIterator::parseMidiCommand(byte *buf, int *result, SongIteratorChann channel->state = SI_STATE_DELTA_TIME; channel->total_timepos = channel->loop_timepos; channel->last_cmd = 0xfe; - fprintf(stderr, "Looping song iterator %08lx.\n", ID); + debugC(2, kDebugLevelSound, "Looping song iterator %08lx.\n", ID); return SI_LOOP; } else { channel->state = SI_STATE_FINISHED; @@ -379,7 +380,7 @@ int BaseSongIterator::processMidi(byte *buf, int *result, channel->state = SI_STATE_FINISHED; delay = (size * 50 + format.rate - 1) / format.rate; /* number of ticks to completion*/ - fprintf(stderr, "delaying %d ticks\n", delay); + debugC(2, kDebugLevelSound, "delaying %d ticks\n", delay); return delay; } @@ -523,7 +524,7 @@ static int _sci0_get_pcm_data(Sci0SongIterator *self, } static Audio::AudioStream *makeStream(byte *data, int size, sfx_pcm_config_t conf) { - printf("Playing PCM data of size %d, rate %d\n", size, conf.rate); + debugC(2, kDebugLevelSound, "Playing PCM data of size %d, rate %d\n", size, conf.rate); // Duplicate the data byte *sound = (byte *)malloc(size); @@ -563,7 +564,7 @@ SongIterator *Sci0SongIterator::handleMessage(Message msg) { case _SIMSG_BASEMSG_PRINT: print_tabs_id(msg._arg.i, ID); - fprintf(stderr, "SCI0: dev=%d, active-chan=%d, size=%d, loops=%d\n", + debugC(2, kDebugLevelSound, "SCI0: dev=%d, active-chan=%d, size=%d, loops=%d\n", _deviceId, _numActiveChannels, _data.size(), _loops); break; @@ -980,7 +981,7 @@ SongIterator *Sci1SongIterator::handleMessage(Message msg) { playmask |= _channels[i].playmask; print_tabs_id(msg._arg.i, ID); - fprintf(stderr, "SCI1: chan-nr=%d, playmask=%04x\n", + debugC(2, kDebugLevelSound, "SCI1: chan-nr=%d, playmask=%04x\n", _numChannels, playmask); } break; @@ -1142,7 +1143,7 @@ public: SongIterator *CleanupSongIterator::handleMessage(Message msg) { if (msg._class == _SIMSG_BASEMSG_PRINT && msg._type == _SIMSG_BASEMSG_PRINT) { print_tabs_id(msg._arg.i, ID); - fprintf(stderr, "CLEANUP\n"); + debugC(2, kDebugLevelSound, "CLEANUP\n"); } return NULL; @@ -1208,7 +1209,7 @@ SongIterator *FastForwardSongIterator::handleMessage(Message msg) { if (msg._class == _SIMSG_BASE && msg._type == _SIMSG_BASEMSG_PRINT) { print_tabs_id(msg._arg.i, ID); - fprintf(stderr, "FASTFORWARD:\n"); + debugC(2, kDebugLevelSound, "FASTFORWARD:\n"); msg._arg.i++; } @@ -1532,7 +1533,7 @@ SongIterator *TeeSongIterator::handleMessage(Message msg) { if (msg._class == _SIMSG_BASE && msg._type == _SIMSG_BASEMSG_PRINT) { print_tabs_id(msg._arg.i, ID); - fprintf(stderr, "TEE:\n"); + debugC(2, kDebugLevelSound, "TEE:\n"); msg._arg.i++; } @@ -1576,15 +1577,15 @@ int songit_next(SongIterator **it, byte *buf, int *result, int mask) { do { retval = (*it)->nextCommand(buf, result); if (retval == SI_MORPH) { - fprintf(stderr, " Morphing %p (stored at %p)\n", (void *)*it, (void *)it); + debugC(2, kDebugLevelSound, " Morphing %p (stored at %p)\n", (void *)*it, (void *)it); if (!SIMSG_SEND((*it), SIMSG_ACK_MORPH)) { error("SI_MORPH failed. Breakpoint in %s, line %d", __FILE__, __LINE__); } else - fprintf(stderr, "SI_MORPH successful\n"); + debugC(2, kDebugLevelSound, "SI_MORPH successful\n"); } if (retval == SI_FINISHED) - fprintf(stderr, "[song-iterator] Song finished. mask = %04x, cm=%04x\n", + debugC(2, kDebugLevelSound, "[song-iterator] Song finished. mask = %04x, cm=%04x\n", mask, (*it)->channel_mask); if (retval == SI_FINISHED && (mask & IT_READER_MAY_CLEAN) -- cgit v1.2.3 From 20ca572e4561665e840409b34404c8de82e3bc04 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 8 Jul 2009 01:07:41 +0000 Subject: Fix recent regression in vc61(). svn-id: r42252 --- engines/agos/vga_ww.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/agos/vga_ww.cpp b/engines/agos/vga_ww.cpp index 97c31b299c..e7f2ad7807 100644 --- a/engines/agos/vga_ww.cpp +++ b/engines/agos/vga_ww.cpp @@ -149,6 +149,7 @@ void AGOSEngine::vc61() { if (a == 6) { src = _curVgaFile2 + 800; + dst = dstPtr; for (int i = 0; i < _screenHeight; i++) { memcpy(dst, src, _screenWidth); -- cgit v1.2.3 From 4f39ef18c1eaf04d5187a4f01701980c03ab08d0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 8 Jul 2009 07:09:03 +0000 Subject: Synced the MSVC project files of the gob engine svn-id: r42255 --- dists/msvc8/gob.vcproj | 8 ++++---- dists/msvc9/gob.vcproj | 4 ---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/dists/msvc8/gob.vcproj b/dists/msvc8/gob.vcproj index 5137898c5d..e0335ee352 100644 --- a/dists/msvc8/gob.vcproj +++ b/dists/msvc8/gob.vcproj @@ -518,10 +518,6 @@ RelativePath="..\..\engines\gob\save\saveconverter_v6.cpp" > - - @@ -562,6 +558,10 @@ RelativePath="..\..\engines\gob\save\saveload_v6.cpp" > + + diff --git a/dists/msvc9/gob.vcproj b/dists/msvc9/gob.vcproj index 7b339fbad9..306f12c1a3 100644 --- a/dists/msvc9/gob.vcproj +++ b/dists/msvc9/gob.vcproj @@ -535,10 +535,6 @@ RelativePath="..\..\engines\gob\save\savehandler.h" > - - -- cgit v1.2.3 From c3a335aacb68eff9638747562a38543d415cbf06 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 8 Jul 2009 07:11:43 +0000 Subject: Updated the MSVC project files of the scummvm project (added graphics/sjis.*) svn-id: r42256 --- dists/msvc7/scummvm.vcproj | 6 ++++++ dists/msvc71/scummvm.vcproj | 6 ++++++ dists/msvc8/scummvm.vcproj | 8 ++++++++ dists/msvc9/scummvm.vcproj | 8 ++++++++ 4 files changed, 28 insertions(+) diff --git a/dists/msvc7/scummvm.vcproj b/dists/msvc7/scummvm.vcproj index aee0ca2032..9df46a3486 100644 --- a/dists/msvc7/scummvm.vcproj +++ b/dists/msvc7/scummvm.vcproj @@ -1096,6 +1096,12 @@ + + + + diff --git a/dists/msvc71/scummvm.vcproj b/dists/msvc71/scummvm.vcproj index aa9e3b9066..8bc0084305 100644 --- a/dists/msvc71/scummvm.vcproj +++ b/dists/msvc71/scummvm.vcproj @@ -1110,6 +1110,12 @@ + + + + diff --git a/dists/msvc8/scummvm.vcproj b/dists/msvc8/scummvm.vcproj index a88167c0b0..d8809cd110 100644 --- a/dists/msvc8/scummvm.vcproj +++ b/dists/msvc8/scummvm.vcproj @@ -1492,6 +1492,14 @@ RelativePath="..\..\graphics\scaler.h" > + + + + diff --git a/dists/msvc9/scummvm.vcproj b/dists/msvc9/scummvm.vcproj index 6bbc21f9e4..d48039d379 100644 --- a/dists/msvc9/scummvm.vcproj +++ b/dists/msvc9/scummvm.vcproj @@ -1497,6 +1497,14 @@ RelativePath="..\..\graphics\scaler.h" > + + + + -- cgit v1.2.3 From 570d157ff336d62f3e1c9435ebe1c13ed8332c08 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 8 Jul 2009 07:13:56 +0000 Subject: The ENABLE_* flags are only checked for *.cpp files in MSVC, so move the ENABLE_* checks to sjis.cpp to fix compilation under MSVC svn-id: r42257 --- graphics/sjis.cpp | 13 +++++++++---- graphics/sjis.h | 10 ---------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/graphics/sjis.cpp b/graphics/sjis.cpp index 5392a1c9a4..95736cf401 100644 --- a/graphics/sjis.cpp +++ b/graphics/sjis.cpp @@ -23,11 +23,16 @@ */ #include "graphics/sjis.h" - -#ifdef GRAPHICS_SJIS_H - #include "common/debug.h" +// The code in this file is currently only used in KYRA and SCI. +// So if neither of those is enabled, we will skip compiling it. +// If you plan to use this code in another engine, you will have +// to add the proper define check here. +// Also please add the define check at the comment after the +// matching #endif further down this file. +#if defined(ENABLE_KYRA) || defined(ENABLE_SCI) + namespace Graphics { bool FontTowns::loadFromStream(Common::ReadStream &stream) { @@ -193,5 +198,5 @@ uint FontTowns::sjisToChunk(uint8 f, uint8 s) { } // end of namespace Graphics -#endif // defined(GRAPHICS_SJIS_H) +#endif // defined(ENABLE_KYRA) || defined(ENABLE_SCI) diff --git a/graphics/sjis.h b/graphics/sjis.h index f7321742af..c7eeeed9f6 100644 --- a/graphics/sjis.h +++ b/graphics/sjis.h @@ -22,14 +22,6 @@ * $Id$ */ -// The code in this file is currently only used in KYRA and SCI. -// So if neither of those is enabled, we will skip compiling it. -// If you plan to use this code in another engine, you will have -// to add the proper define check here. -// Also please add the define check at the comment after the -// matching #endif further down this file. -#if defined(ENABLE_KYRA) || defined(ENABLE_SCI) - #ifndef GRAPHICS_SJIS_H #define GRAPHICS_SJIS_H @@ -131,5 +123,3 @@ private: #endif -#endif // defined(ENABLE_KYRA) || defined(ENABLE_SCI) - -- cgit v1.2.3 From 4e44217047ba7f361412b9b550c7eafa013d8fbe Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 8 Jul 2009 07:25:09 +0000 Subject: Also added the ENABLE_IHNM and ENABLE_SAGA2 preprocessor definitions to the scummvm project files, not only the saga project files svn-id: r42258 --- dists/msvc7/scummvm.vcproj | 4 ++-- dists/msvc71/scummvm.vcproj | 4 ++-- dists/msvc8/scummvm.vcproj | 4 ++-- dists/msvc9/scummvm.vcproj | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dists/msvc7/scummvm.vcproj b/dists/msvc7/scummvm.vcproj index 9df46a3486..33ff4e4f68 100644 --- a/dists/msvc7/scummvm.vcproj +++ b/dists/msvc7/scummvm.vcproj @@ -22,7 +22,7 @@ Optimization="0" InlineFunctionExpansion="0" AdditionalIncludeDirectories="../../;../../engines" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_NASM;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_NASM;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_IHNM;ENABLE_SAGA2;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" MinimalRebuild="TRUE" ExceptionHandling="TRUE" BasicRuntimeChecks="3" @@ -80,7 +80,7 @@ FavorSizeOrSpeed="2" OmitFramePointers="TRUE" AdditionalIncludeDirectories="../../;../../engines" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_IHNM;ENABLE_SAGA2;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" StringPooling="TRUE" MinimalRebuild="FALSE" ExceptionHandling="TRUE" diff --git a/dists/msvc71/scummvm.vcproj b/dists/msvc71/scummvm.vcproj index 8bc0084305..3c61ed6f02 100644 --- a/dists/msvc71/scummvm.vcproj +++ b/dists/msvc71/scummvm.vcproj @@ -22,7 +22,7 @@ Optimization="0" InlineFunctionExpansion="0" AdditionalIncludeDirectories="../../;../../engines" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_NASM;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_NASM;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_IHNM;ENABLE_SAGA2;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" MinimalRebuild="TRUE" ExceptionHandling="TRUE" BasicRuntimeChecks="3" @@ -86,7 +86,7 @@ FavorSizeOrSpeed="2" OmitFramePointers="TRUE" AdditionalIncludeDirectories="../../;../../engines" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_IHNM;ENABLE_SAGA2;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" StringPooling="TRUE" MinimalRebuild="FALSE" ExceptionHandling="TRUE" diff --git a/dists/msvc8/scummvm.vcproj b/dists/msvc8/scummvm.vcproj index d8809cd110..93c6232f67 100644 --- a/dists/msvc8/scummvm.vcproj +++ b/dists/msvc8/scummvm.vcproj @@ -43,7 +43,7 @@ Optimization="0" InlineFunctionExpansion="0" AdditionalIncludeDirectories="../../;../../engines" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_NASM;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_NASM;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_IHNM;ENABLE_SAGA2;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" MinimalRebuild="true" ExceptionHandling="1" BasicRuntimeChecks="3" @@ -135,7 +135,7 @@ FavorSizeOrSpeed="2" OmitFramePointers="true" AdditionalIncludeDirectories="../../;../../engines" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_IHNM;ENABLE_SAGA2;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" StringPooling="true" MinimalRebuild="false" ExceptionHandling="1" diff --git a/dists/msvc9/scummvm.vcproj b/dists/msvc9/scummvm.vcproj index d48039d379..730988c8a7 100644 --- a/dists/msvc9/scummvm.vcproj +++ b/dists/msvc9/scummvm.vcproj @@ -44,7 +44,7 @@ Optimization="0" InlineFunctionExpansion="0" AdditionalIncludeDirectories="../../;../../engines" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_NASM;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_NASM;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_IHNM;ENABLE_SAGA2;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" MinimalRebuild="true" ExceptionHandling="1" BasicRuntimeChecks="3" @@ -138,7 +138,7 @@ FavorSizeOrSpeed="2" OmitFramePointers="true" AdditionalIncludeDirectories="../../;../../engines" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_IHNM;ENABLE_SAGA2;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" StringPooling="true" MinimalRebuild="false" ExceptionHandling="1" -- cgit v1.2.3 From 90422f6bd3e7f4b6c1df82124ce5000986822651 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 8 Jul 2009 07:28:13 +0000 Subject: Added guards to only include the Shorten audio code when the SAGA2 code in the SAGA engine is enabled svn-id: r42259 --- sound/shorten.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sound/shorten.cpp b/sound/shorten.cpp index b550a5afec..d1031aed3a 100644 --- a/sound/shorten.cpp +++ b/sound/shorten.cpp @@ -23,6 +23,14 @@ * */ +// The code in this file is currently only used in SAGA2 (in the +// SAGA engine), so if that engine isn't enabled, we will skip +// compiling it. If you plan to use this code in another engine, +// you will have to add the proper define check here. +// Also please add the define check at the comment after the +// matching #endif further down this file. +#if defined(ENABLE_SAGA2) + // Based on etree's Shorten tool, version 3.6.1 // http://etree.org/shnutils/shorten/ @@ -526,3 +534,6 @@ AudioStream *makeShortenStream(Common::SeekableReadStream &stream) { } } // End of namespace Audio + +#endif // defined(ENABLE_SAGA2) + -- cgit v1.2.3 From 62499054a0639fd9bca6b0573bca3b664e8561fe Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 8 Jul 2009 10:25:37 +0000 Subject: Some cleanup for the script debugger code: - Renamed struct DebugState to ScriptState and r_amp_rest to restAdjust inside EngineState. Changed restAdjust to be a uint16 (actually it is a uint16, but it was being casted back and forth from an unsigned integer, so this clears up its type and size) - Moved the script state variables from inside the run_vm() into the ScriptState struct, so that they can be accessed by the console commands and the script debugger all the time, and removed the weird isValid code svn-id: r42260 --- engines/sci/console.cpp | 80 +++++------ engines/sci/debug.h | 20 ++- engines/sci/engine/game.cpp | 2 +- engines/sci/engine/kevent.cpp | 12 +- engines/sci/engine/kmisc.cpp | 4 +- engines/sci/engine/scriptdebug.cpp | 97 ++++--------- engines/sci/engine/state.cpp | 2 +- engines/sci/engine/state.h | 2 +- engines/sci/engine/vm.cpp | 283 ++++++++++++++++++------------------- engines/sci/engine/vm.h | 46 ++---- engines/sci/sci.cpp | 8 +- 11 files changed, 243 insertions(+), 313 deletions(-) diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 2d11f39835..667a39c063 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -190,11 +190,10 @@ Console::Console(SciEngine *vm) : GUI::Debugger() { "Dirty frames management\n"); */ - debugState.isValid = false; - debugState.seeking = kDebugSeekNothing; - debugState.seekLevel = 0; - debugState.runningStep = 0; - debugState.stopOnEvent = false; + scriptState.seeking = kDebugSeekNothing; + scriptState.seekLevel = 0; + scriptState.runningStep = 0; + scriptState.stopOnEvent = false; } Console::~Console() { @@ -546,13 +545,13 @@ bool Console::cmdSetParseNodes(int argc, const char **argv) { bool Console::cmdRegisters(int argc, const char **argv) { DebugPrintf("Current register values:\n"); - DebugPrintf("acc=%04x:%04x prev=%04x:%04x &rest=%x\n", PRINT_REG(_vm->_gamestate->r_acc), PRINT_REG(_vm->_gamestate->r_prev), *debugState.p_restadjust); + DebugPrintf("acc=%04x:%04x prev=%04x:%04x &rest=%x\n", PRINT_REG(_vm->_gamestate->r_acc), PRINT_REG(_vm->_gamestate->r_prev), scriptState.restadjust); if (!_vm->_gamestate->_executionStack.empty()) { EngineState *s = _vm->_gamestate; // for PRINT_STK DebugPrintf("pc=%04x:%04x obj=%04x:%04x fp=ST:%04x sp=ST:%04x\n", - PRINT_REG(*debugState.p_pc), PRINT_REG(*debugState.p_objp), - PRINT_STK(*debugState.p_pp), PRINT_STK(*debugState.p_sp)); + PRINT_REG(scriptState.xs->addr.pc), PRINT_REG(scriptState.xs->objp), + PRINT_STK(scriptState.xs->fp), PRINT_STK(scriptState.xs->sp)); } else DebugPrintf("\n"); @@ -846,7 +845,6 @@ bool Console::cmdRestoreGame(int argc, const char **argv) { _vm->_gamestate->successor = newstate; // Set successor script_abort_flag = 2; // Abort current game with replay - debugState.isValid = false; shrink_execution_stack(_vm->_gamestate, _vm->_gamestate->execution_stack_base + 1); return 0; @@ -877,7 +875,6 @@ bool Console::cmdRestartGame(int argc, const char **argv) { _vm->_gamestate->restarting_flags |= SCI_GAME_IS_RESTARTING_NOW; script_abort_flag = 1; - debugState.isValid = false; return false; } @@ -1705,9 +1702,9 @@ bool Console::cmdVMVarlist(int argc, const char **argv) { DebugPrintf("Addresses of variables in the VM:\n"); for (int i = 0; i < 4; i++) { - DebugPrintf("%s vars at %04x:%04x ", varnames[i], PRINT_REG(make_reg(debugState.p_var_segs[i], debugState.p_vars[i] - debugState.p_var_base[i]))); - if (debugState.p_var_max) - DebugPrintf(" total %d", debugState.p_var_max[i]); + DebugPrintf("%s vars at %04x:%04x ", varnames[i], PRINT_REG(make_reg(scriptState.variables_seg[i], scriptState.variables[i] - scriptState.variables_base[i]))); + if (scriptState.variables_max) + DebugPrintf(" total %d", scriptState.variables_max[i]); DebugPrintf("\n"); } @@ -1743,17 +1740,17 @@ bool Console::cmdVMVars(int argc, const char **argv) { return true; } - if ((debugState.p_var_max) && (debugState.p_var_max[vartype] <= idx)) { - DebugPrintf("Max. index is %d (0x%x)\n", debugState.p_var_max[vartype], debugState.p_var_max[vartype]); + if ((scriptState.variables_max) && (scriptState.variables_max[vartype] <= idx)) { + DebugPrintf("Max. index is %d (0x%x)\n", scriptState.variables_max[vartype], scriptState.variables_max[vartype]); return true; } switch (argc) { case 2: - DebugPrintf("%s var %d == %04x:%04x\n", varnames[vartype], idx, PRINT_REG(debugState.p_vars[vartype][idx])); + DebugPrintf("%s var %d == %04x:%04x\n", varnames[vartype], idx, PRINT_REG(scriptState.variables[vartype][idx])); break; case 3: - if (parse_reg_t(_vm->_gamestate, argv[3], &debugState.p_vars[vartype][idx])) { + if (parse_reg_t(_vm->_gamestate, argv[3], &scriptState.variables[vartype][idx])) { DebugPrintf("Invalid address passed.\n"); DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; @@ -1992,7 +1989,7 @@ bool Console::cmdViewObject(int argc, const char **argv) { bool Console::cmdViewActiveObject(int argc, const char **argv) { DebugPrintf("Information on the currently active object or class:\n"); - printObject(_vm->_gamestate, *debugState.p_objp); + printObject(_vm->_gamestate, scriptState.xs->objp); return true; } @@ -2099,24 +2096,21 @@ bool Console::cmdBacktrace(int argc, const char **argv) { } bool Console::cmdStep(int argc, const char **argv) { - debugState.isValid = false; if (argc == 2 && atoi(argv[1]) > 0) - debugState.runningStep = atoi(argv[1]) - 1; + scriptState.runningStep = atoi(argv[1]) - 1; return true; } bool Console::cmdStepEvent(int argc, const char **argv) { - debugState.stopOnEvent = true; - debugState.isValid = false; + scriptState.stopOnEvent = true; return true; } bool Console::cmdStepRet(int argc, const char **argv) { - debugState.seeking = kDebugSeekLevelRet; - debugState.seekLevel = _vm->_gamestate->_executionStack.size() - 1; - debugState.isValid = false; + scriptState.seeking = kDebugSeekLevelRet; + scriptState.seekLevel = _vm->_gamestate->_executionStack.size() - 1; return true; } @@ -2128,9 +2122,8 @@ bool Console::cmdStepGlobal(int argc, const char **argv) { return true; } - debugState.seeking = kDebugSeekGlobal; - debugState.seekSpecial = atoi(argv[1]); - debugState.isValid = false; + scriptState.seeking = kDebugSeekGlobal; + scriptState.seekSpecial = atoi(argv[1]); return true; } @@ -2158,12 +2151,10 @@ bool Console::cmdStepCallk(int argc, const char **argv) { } } - debugState.seeking = kDebugSeekSpecialCallk; - debugState.seekSpecial = callk_index; - debugState.isValid = false; + scriptState.seeking = kDebugSeekSpecialCallk; + scriptState.seekSpecial = callk_index; } else { - debugState.seeking = kDebugSeekCallk; - debugState.isValid = false; + scriptState.seeking = kDebugSeekCallk; } return true; @@ -2339,8 +2330,7 @@ bool Console::cmdSend(int argc, const char **argv) { } bool Console::cmdGo(int argc, const char **argv) { - debugState.seeking = kDebugSeekNothing; - debugState.isValid = false; + scriptState.seeking = kDebugSeekNothing; return true; } @@ -2754,9 +2744,8 @@ bool Console::cmdExit(int argc, const char **argv) { if (!scumm_stricmp(argv[1], "game")) { // Quit gracefully script_abort_flag = 1; // Terminate VM - debugState.isValid = false; - debugState.seeking = kDebugSeekNothing; - debugState.runningStep = 0; + scriptState.seeking = kDebugSeekNothing; + scriptState.runningStep = 0; } else if (!scumm_stricmp(argv[1], "now")) { // Quit ungracefully @@ -3245,34 +3234,33 @@ int c_stepover(EngineState *s, const Common::Array &cmdParams) { return 1; } - debugState.isValid = false; opcode = s->_heap[*p_pc]; opnumber = opcode >> 1; if (opnumber == 0x22 /* callb */ || opnumber == 0x23 /* calle */ || opnumber == 0x25 /* send */ || opnumber == 0x2a /* self */ || opnumber == 0x2b /* super */) { - debugState.seeking = kDebugSeekSO; - debugState.seekLevel = s->_executionStack.size()-1; - // Store in debugState.seekSpecial the offset of the next command after send + scriptState.seeking = kDebugSeekSO; + scriptState.seekLevel = s->_executionStack.size()-1; + // Store in scriptState.seekSpecial the offset of the next command after send switch (opcode) { case 0x46: // calle W - debugState.seekSpecial = *p_pc + 5; + scriptState.seekSpecial = *p_pc + 5; break; case 0x44: // callb W case 0x47: // calle B case 0x56: // super W - debugState.seekSpecial = *p_pc + 4; + scriptState.seekSpecial = *p_pc + 4; break; case 0x45: // callb B case 0x57: // super B case 0x4A: // send W case 0x54: // self W - debugState.seekSpecial = *p_pc + 3; + scriptState.seekSpecial = *p_pc + 3; break; default: - debugState.seekSpecial = *p_pc + 2; + scriptState.seekSpecial = *p_pc + 2; } } diff --git a/engines/sci/debug.h b/engines/sci/debug.h index fbd98e0d6f..ccf0602600 100644 --- a/engines/sci/debug.h +++ b/engines/sci/debug.h @@ -37,8 +37,7 @@ enum DebugSeeking { kDebugSeekGlobal = 5 // Step forward until one specified global variable is modified }; -struct DebugState { - bool isValid; +struct ScriptState { bool stopOnEvent; DebugSeeking seeking; // Stepping forward until some special condition is met int runningStep; // Set to > 0 to allow multiple stepping @@ -46,15 +45,12 @@ struct DebugState { int seekSpecial; // Used for special seeks int old_pc_offset; StackPtr old_sp; - reg_t *p_pc; - StackPtr *p_sp; - StackPtr *p_pp; - reg_t *p_objp; - int *p_restadjust; - SegmentId *p_var_segs; - reg_t **p_vars; - reg_t **p_var_base; - int *p_var_max; // May be NULL even in valid state! + ExecStack *xs; + uint16 restadjust; + reg_t *variables[4]; // global, local, temp, param, as immediate pointers + reg_t *variables_base[4]; // Used for referencing VM ops + SegmentId variables_seg[4]; // Same as above, contains segment IDs + int variables_max[4]; // Max. values for all variables }; // Various global variables used for debugging are declared here @@ -62,7 +58,7 @@ extern int g_debug_sleeptime_factor; extern int g_debug_simulated_key; extern bool g_debug_track_mouse_clicks; extern bool g_debug_weak_validations; -extern DebugState debugState; +extern ScriptState scriptState; } // End of namespace Sci diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index 861294cfa6..5b4c30f6b3 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -365,7 +365,7 @@ int script_init_engine(EngineState *s) { s->r_acc = s->r_prev = NULL_REG; - s->r_amp_rest = 0; + s->restAdjust = 0; s->_executionStack.clear(); // Start without any execution stack s->execution_stack_base = -1; // No vm is running yet diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index 744a965ef3..c4b3f5d71a 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -88,12 +88,12 @@ reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv) { case SCI_EVT_KEYBOARD: if ((e.buckybits & SCI_EVM_LSHIFT) && (e.buckybits & SCI_EVM_RSHIFT) && (e.data == '-')) { printf("Debug mode activated\n"); - debugState.seeking = kDebugSeekNothing; - debugState.runningStep = 0; + scriptState.seeking = kDebugSeekNothing; + scriptState.runningStep = 0; } else if ((e.buckybits & SCI_EVM_CTRL) && (e.data == '`')) { printf("Debug mode activated\n"); - debugState.seeking = kDebugSeekNothing; - debugState.runningStep = 0; + scriptState.seeking = kDebugSeekNothing; + scriptState.runningStep = 0; } else { PUT_SEL32V(obj, type, SCI_EVT_KEYBOARD); // Keyboard event s->r_acc = make_reg(0, 1); @@ -137,8 +137,8 @@ reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv) { s->r_acc = NULL_REG; // Unknown or no event } - if ((s->r_acc.offset) && (debugState.stopOnEvent)) { - debugState.stopOnEvent = false; + if ((s->r_acc.offset) && (scriptState.stopOnEvent)) { + scriptState.stopOnEvent = false; // A SCI event occured, and we have been asked to stop, so open the debug console Console *con = ((Sci::SciEngine*)g_engine)->getSciDebugger(); diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 8381bc2e13..7e0aca5b7a 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -96,8 +96,8 @@ reg_t kFlushResources(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t kSetDebug(EngineState *s, int funct_nr, int argc, reg_t *argv) { printf("Debug mode activated\n"); - debugState.seeking = kDebugSeekNothing; - debugState.runningStep = 0; + scriptState.seeking = kDebugSeekNothing; + scriptState.runningStep = 0; return s->r_acc; } diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index d5f0a21385..9f69d21e2a 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -34,7 +34,7 @@ namespace Sci { extern const char *selector_name(EngineState *s, int selector); -DebugState debugState; +ScriptState scriptState; int propertyOffsetToId(EngineState *s, int prop_ofs, reg_t objp) { Object *obj = obj_get(s, objp); @@ -97,11 +97,6 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod opsize = scr[pos.offset]; opcode = opsize >> 1; - if (!debugState.isValid) { - warning("Not in debug state"); - return retval; - } - opsize &= 1; // byte if true, word if false printf("%04x:%04x: ", PRINT_REG(pos)); @@ -226,11 +221,11 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod } } - if (pos == *debugState.p_pc) { // Extra information if debugging the current opcode + if (pos == scriptState.xs->addr.pc) { // Extra information if debugging the current opcode if ((opcode == op_pTos) || (opcode == op_sTop) || (opcode == op_pToa) || (opcode == op_aTop) || (opcode == op_dpToa) || (opcode == op_ipToa) || (opcode == op_dpTos) || (opcode == op_ipTos)) { int prop_ofs = scr[pos.offset + 1]; - int prop_id = propertyOffsetToId(s, prop_ofs, *debugState.p_objp); + int prop_id = propertyOffsetToId(s, prop_ofs, scriptState.xs->objp); printf(" (%s)", selector_name(s, prop_id)); } @@ -238,38 +233,38 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod printf("\n"); - if (pos == *debugState.p_pc) { // Extra information if debugging the current opcode + if (pos == scriptState.xs->addr.pc) { // Extra information if debugging the current opcode if (opcode == op_callk) { - int stackframe = (scr[pos.offset + 2] >> 1) + (*debugState.p_restadjust); - int argc = ((*debugState.p_sp)[- stackframe - 1]).offset; + int stackframe = (scr[pos.offset + 2] >> 1) + (scriptState.restadjust); + int argc = ((scriptState.xs->sp)[- stackframe - 1]).offset; if (!s->_kernel->hasOldScriptHeader()) - argc += (*debugState.p_restadjust); + argc += (scriptState.restadjust); printf(" Kernel params: ("); for (int j = 0; j < argc; j++) { - printf("%04x:%04x", PRINT_REG((*debugState.p_sp)[j - stackframe])); + printf("%04x:%04x", PRINT_REG((scriptState.xs->sp)[j - stackframe])); if (j + 1 < argc) printf(", "); } printf(")\n"); } else if ((opcode == op_send) || (opcode == op_self)) { - int restmod = *debugState.p_restadjust; + int restmod = scriptState.restadjust; int stackframe = (scr[pos.offset + 1] >> 1) + restmod; - reg_t *sb = *debugState.p_sp; + reg_t *sb = scriptState.xs->sp; uint16 selector; reg_t fun_ref; while (stackframe > 0) { int argc = sb[- stackframe + 1].offset; const char *name = NULL; - reg_t called_obj_addr = *debugState.p_objp; + reg_t called_obj_addr = scriptState.xs->objp; if (opcode == op_send) called_obj_addr = s->r_acc; else if (opcode == op_self) - called_obj_addr = *debugState.p_objp; + called_obj_addr = scriptState.xs->objp; selector = sb[- stackframe].offset; @@ -313,45 +308,30 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod } -void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t *objp, int *restadjust, - SegmentId *segids, reg_t **variables, reg_t **variables_base, int *variables_nr, int bp) { +void script_debug(EngineState *s, bool bp) { // Do we support a separate console? - bool old_debugstate = debugState.isValid; - - debugState.p_var_segs = segids; - debugState.p_vars = variables; - debugState.p_var_max = variables_nr; - debugState.p_var_base = variables_base; - debugState.p_pc = pc; - debugState.p_sp = sp; - debugState.p_pp = pp; - debugState.p_objp = objp; - debugState.p_restadjust = restadjust; printf("%d: acc=%04x:%04x ", script_step_counter, PRINT_REG(s->r_acc)); - debugState.isValid = true; - disassemble(s, *pc, 0, 1); - if (debugState.seeking == kDebugSeekGlobal) - printf("Global %d (0x%x) = %04x:%04x\n", debugState.seekSpecial, - debugState.seekSpecial, PRINT_REG(s->script_000->locals_block->_locals[debugState.seekSpecial])); - - debugState.isValid = old_debugstate; + disassemble(s, scriptState.xs->addr.pc, 0, 1); + if (scriptState.seeking == kDebugSeekGlobal) + printf("Global %d (0x%x) = %04x:%04x\n", scriptState.seekSpecial, + scriptState.seekSpecial, PRINT_REG(s->script_000->locals_block->_locals[scriptState.seekSpecial])); - if (debugState.seeking && !bp) { // Are we looking for something special? - MemObject *mobj = GET_SEGMENT(*s->seg_manager, pc->segment, MEM_OBJ_SCRIPT); + if (scriptState.seeking && !bp) { // Are we looking for something special? + MemObject *mobj = GET_SEGMENT(*s->seg_manager, scriptState.xs->addr.pc.segment, MEM_OBJ_SCRIPT); if (mobj) { Script *scr = (Script *)mobj; byte *code_buf = scr->buf; int code_buf_size = scr->buf_size; - int opcode = pc->offset >= code_buf_size ? 0 : code_buf[pc->offset]; + int opcode = scriptState.xs->addr.pc.offset >= code_buf_size ? 0 : code_buf[scriptState.xs->addr.pc.offset]; int op = opcode >> 1; - int paramb1 = pc->offset + 1 >= code_buf_size ? 0 : code_buf[pc->offset + 1]; - int paramf1 = (opcode & 1) ? paramb1 : (pc->offset + 2 >= code_buf_size ? 0 : (int16)READ_LE_UINT16(code_buf + pc->offset + 1)); + int paramb1 = scriptState.xs->addr.pc.offset + 1 >= code_buf_size ? 0 : code_buf[scriptState.xs->addr.pc.offset + 1]; + int paramf1 = (opcode & 1) ? paramb1 : (scriptState.xs->addr.pc.offset + 2 >= code_buf_size ? 0 : (int16)READ_LE_UINT16(code_buf + scriptState.xs->addr.pc.offset + 1)); - switch (debugState.seeking) { + switch (scriptState.seeking) { case kDebugSeekSpecialCallk: - if (paramb1 != debugState.seekSpecial) + if (paramb1 != scriptState.seekSpecial) return; case kDebugSeekCallk: { @@ -361,7 +341,7 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t * } case kDebugSeekLevelRet: { - if ((op != op_ret) || (debugState.seekLevel < (int)s->_executionStack.size()-1)) + if ((op != op_ret) || (scriptState.seekLevel < (int)s->_executionStack.size()-1)) return; break; } @@ -373,7 +353,7 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t * return; // param or temp if ((op & 0x3) && s->_executionStack.back().local_segment > 0) return; // locals and not running in script.000 - if (paramf1 != debugState.seekSpecial) + if (paramf1 != scriptState.seekSpecial) return; // CORRECT global? break; @@ -382,32 +362,17 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t * break; case kDebugSeekNothing: - // FIXME: Unhandled? + // We seek nothing, so just continue break; } - debugState.seeking = kDebugSeekNothing; + scriptState.seeking = kDebugSeekNothing; // OK, found whatever we were looking for } } - - debugState.isValid = (debugState.runningStep == 0); - - if (debugState.isValid) { - debugState.p_pc = pc; - debugState.p_sp = sp; - debugState.p_pp = pp; - debugState.p_objp = objp; - debugState.p_restadjust = restadjust; - debugState.p_var_segs = segids; - debugState.p_vars = variables; - debugState.p_var_max = variables_nr; - debugState.p_var_base = variables_base; - - printf("Step #%d\n", script_step_counter); - disassemble(s, *pc, 0, 1); - } - + + printf("Step #%d\n", script_step_counter); + disassemble(s, scriptState.xs->addr.pc, 0, 1); } } // End of namespace Sci diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index e618077d54..c43fe9b6de 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -87,7 +87,7 @@ EngineState::EngineState(ResourceManager *res, sci_version_t version, uint32 fla _executionStackPosChanged = false; r_acc = NULL_REG; - r_amp_rest = 0; + restAdjust = 0; r_prev = NULL_REG; stack_segment = 0; diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index ecfb9fe6f7..92a5b5e411 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -208,7 +208,7 @@ public: bool _executionStackPosChanged; /**< Set to true if the execution stack position should be re-evaluated by the vm */ reg_t r_acc; /**< Accumulator */ - unsigned int r_amp_rest; /**< &rest register (only used for save games) */ + uint16 restAdjust; /**< &rest register (only used for save games) */ reg_t r_prev; /**< previous comparison result */ SegmentId stack_segment; /**< Heap area for the stack to use */ diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index c6643b8a90..9bbdb90e0c 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -177,8 +177,8 @@ static void validate_write_var(reg_t *r, reg_t *stack_base, int type, int max, i #endif -#define READ_VAR(type, index, def) validate_read_var(variables[type], s->stack_base, type, variables_max[type], index, __LINE__, def) -#define WRITE_VAR(type, index, value) validate_write_var(variables[type], s->stack_base, type, variables_max[type], index, __LINE__, value) +#define READ_VAR(type, index, def) validate_read_var(scriptState.variables[type], s->stack_base, type, scriptState.variables_max[type], index, __LINE__, def) +#define WRITE_VAR(type, index, value) validate_write_var(scriptState.variables[type], s->stack_base, type, scriptState.variables_max[type], index, __LINE__, value) #define WRITE_VAR16(type, index, value) WRITE_VAR(type, index, make_reg(0, value)); #define ACC_ARITHMETIC_L(op) make_reg(0, (op validate_arithmetic(s->r_acc))) @@ -220,15 +220,15 @@ reg_t get_class_address(EngineState *s, int classnr, SCRIPT_GET lock, reg_t call #define PUSH(v) PUSH32(make_reg(0, v)) #define POP() (validate_arithmetic(POP32())) // 32 bit: -#define PUSH32(a) (*(validate_stack_addr(s, (xs->sp)++)) = (a)) -#define POP32() (*(validate_stack_addr(s, --(xs->sp)))) +#define PUSH32(a) (*(validate_stack_addr(s, (scriptState.xs->sp)++)) = (a)) +#define POP32() (*(validate_stack_addr(s, --(scriptState.xs->sp)))) // Getting instruction parameters -#define GET_OP_BYTE() ((uint8)code_buf[(xs->addr.pc.offset)++]) -#define GET_OP_WORD() (READ_LE_UINT16(code_buf + ((xs->addr.pc.offset) += 2) - 2)) +#define GET_OP_BYTE() ((uint8)code_buf[(scriptState.xs->addr.pc.offset)++]) +#define GET_OP_WORD() (READ_LE_UINT16(code_buf + ((scriptState.xs->addr.pc.offset) += 2) - 2)) #define GET_OP_FLEX() ((opcode & 1)? GET_OP_BYTE() : GET_OP_WORD()) -#define GET_OP_SIGNED_BYTE() ((int8)(code_buf[(xs->addr.pc.offset)++])) -#define GET_OP_SIGNED_WORD() (((int16)READ_LE_UINT16(code_buf + ((xs->addr.pc.offset) += 2) - 2))) +#define GET_OP_SIGNED_BYTE() ((int8)(code_buf[(scriptState.xs->addr.pc.offset)++])) +#define GET_OP_SIGNED_WORD() (((int16)READ_LE_UINT16(code_buf + ((scriptState.xs->addr.pc.offset) += 2) - 2))) #define GET_OP_SIGNED_FLEX() ((opcode & 1)? GET_OP_SIGNED_BYTE() : GET_OP_SIGNED_WORD()) ExecStack *execute_method(EngineState *s, uint16 script, uint16 pubfunct, StackPtr sp, reg_t calling_obj, uint16 argc, StackPtr argp) { @@ -388,7 +388,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt break; #ifdef STRICT_SEND default: - debugState.seeking = debugState.runningStep = 0; + scriptState.seeking = scriptState.runningStep = 0; error("Send error: Variable selector %04x in %04x:%04x called with %04x params", selector, PRINT_REG(send_obj), argc); #endif } @@ -543,11 +543,7 @@ static const byte _fake_return_buffer[2] = {op_ret << 1, op_ret << 1}; void run_vm(EngineState *s, int restoring) { assert(s); - reg_t *variables[4]; // global, local, temp, param, as immediate pointers - reg_t *variables_base[4]; // Used for referencing VM ops - SegmentId variables_seg[4]; // Same as above, contains segment IDs #ifndef DISABLE_VALIDATIONS - int variables_max[4]; // Max. values for all variables unsigned int code_buf_size = 0 ; // (Avoid spurious warning) #endif int temp; @@ -556,13 +552,13 @@ void run_vm(EngineState *s, int restoring) { StackPtr s_temp; // Temporary stack pointer int16 opparams[4]; // opcode parameters - int restadjust = s->r_amp_rest; + scriptState.restadjust = s->restAdjust; // &rest adjusts the parameter count by this value // Current execution data: - ExecStack *xs = &(s->_executionStack.back()); + scriptState.xs = &(s->_executionStack.back()); ExecStack *xs_new = NULL; - Object *obj = obj_get(s, xs->objp); - Script *local_script = script_locate_by_segment(s, xs->local_segment); + Object *obj = obj_get(s, scriptState.xs->objp); + Script *local_script = script_locate_by_segment(s, scriptState.xs->local_segment); int old_execution_stack_base = s->execution_stack_base; // Used to detect the stack bottom, for "physical" returns const byte *code_buf = NULL; // (Avoid spurious warning) @@ -577,22 +573,20 @@ void run_vm(EngineState *s, int restoring) { #ifndef DISABLE_VALIDATIONS // Initialize maximum variable count if (s->script_000->locals_block) - variables_max[VAR_GLOBAL] = s->script_000->locals_block->_locals.size(); + scriptState.variables_max[VAR_GLOBAL] = s->script_000->locals_block->_locals.size(); else - variables_max[VAR_GLOBAL] = 0; + scriptState.variables_max[VAR_GLOBAL] = 0; #endif - variables_seg[VAR_GLOBAL] = s->script_000->locals_segment; - variables_seg[VAR_TEMP] = variables_seg[VAR_PARAM] = s->stack_segment; - variables_base[VAR_TEMP] = variables_base[VAR_PARAM] = s->stack_base; + scriptState.variables_seg[VAR_GLOBAL] = s->script_000->locals_segment; + scriptState.variables_seg[VAR_TEMP] = scriptState.variables_seg[VAR_PARAM] = s->stack_segment; + scriptState.variables_base[VAR_TEMP] = scriptState.variables_base[VAR_PARAM] = s->stack_base; // SCI code reads the zeroeth argument to determine argc if (s->script_000->locals_block) - variables_base[VAR_GLOBAL] = variables[VAR_GLOBAL] = s->script_000->locals_block->_locals.begin(); + scriptState.variables_base[VAR_GLOBAL] = scriptState.variables[VAR_GLOBAL] = s->script_000->locals_block->_locals.begin(); else - variables_base[VAR_GLOBAL] = variables[VAR_GLOBAL] = NULL; - - + scriptState.variables_base[VAR_GLOBAL] = scriptState.variables[VAR_GLOBAL] = NULL; s->_executionStackPosChanged = true; // Force initialization @@ -602,58 +596,58 @@ void run_vm(EngineState *s, int restoring) { int var_type; // See description below int var_number; - debugState.old_pc_offset = xs->addr.pc.offset; - debugState.old_sp = xs->sp; + scriptState.old_pc_offset = scriptState.xs->addr.pc.offset; + scriptState.old_sp = scriptState.xs->sp; if (s->_executionStackPosChanged) { Script *scr; - xs = &(s->_executionStack.back()); + scriptState.xs = &(s->_executionStack.back()); s->_executionStackPosChanged = false; - scr = script_locate_by_segment(s, xs->addr.pc.segment); + scr = script_locate_by_segment(s, scriptState.xs->addr.pc.segment); if (!scr) { // No script? Implicit return via fake instruction buffer - warning("Running on non-existant script in segment %x", xs->addr.pc.segment); + warning("Running on non-existant script in segment %x", scriptState.xs->addr.pc.segment); code_buf = _fake_return_buffer; #ifndef DISABLE_VALIDATIONS code_buf_size = 2; #endif - xs->addr.pc.offset = 1; + scriptState.xs->addr.pc.offset = 1; scr = NULL; obj = NULL; } else { - obj = obj_get(s, xs->objp); + obj = obj_get(s, scriptState.xs->objp); code_buf = scr->buf; #ifndef DISABLE_VALIDATIONS code_buf_size = scr->buf_size; #endif - local_script = script_locate_by_segment(s, xs->local_segment); + local_script = script_locate_by_segment(s, scriptState.xs->local_segment); if (!local_script) { - warning("Could not find local script from segment %x", xs->local_segment); + warning("Could not find local script from segment %x", scriptState.xs->local_segment); local_script = NULL; - variables_base[VAR_LOCAL] = variables[VAR_LOCAL] = NULL; + scriptState.variables_base[VAR_LOCAL] = scriptState.variables[VAR_LOCAL] = NULL; #ifndef DISABLE_VALIDATIONS - variables_max[VAR_LOCAL] = 0; + scriptState.variables_max[VAR_LOCAL] = 0; #endif } else { - variables_seg[VAR_LOCAL] = local_script->locals_segment; + scriptState.variables_seg[VAR_LOCAL] = local_script->locals_segment; if (local_script->locals_block) - variables_base[VAR_LOCAL] = variables[VAR_LOCAL] = local_script->locals_block->_locals.begin(); + scriptState.variables_base[VAR_LOCAL] = scriptState.variables[VAR_LOCAL] = local_script->locals_block->_locals.begin(); else - variables_base[VAR_LOCAL] = variables[VAR_LOCAL] = NULL; + scriptState.variables_base[VAR_LOCAL] = scriptState.variables[VAR_LOCAL] = NULL; #ifndef DISABLE_VALIDATIONS if (local_script->locals_block) - variables_max[VAR_LOCAL] = local_script->locals_block->_locals.size(); + scriptState.variables_max[VAR_LOCAL] = local_script->locals_block->_locals.size(); else - variables_max[VAR_LOCAL] = 0; - variables_max[VAR_TEMP] = xs->sp - xs->fp; - variables_max[VAR_PARAM] = xs->argc + 1; + scriptState.variables_max[VAR_LOCAL] = 0; + scriptState.variables_max[VAR_TEMP] = scriptState.xs->sp - scriptState.xs->fp; + scriptState.variables_max[VAR_PARAM] = scriptState.xs->argc + 1; #endif } - variables[VAR_TEMP] = xs->fp; - variables[VAR_PARAM] = xs->variables_argp; + scriptState.variables[VAR_TEMP] = scriptState.xs->fp; + scriptState.variables[VAR_PARAM] = scriptState.xs->variables_argp; } } @@ -665,24 +659,18 @@ void run_vm(EngineState *s, int restoring) { #if 0 // Debug if this has been requested: if (script_debug_flag || sci_debug_flags) { - script_debug(s, &(xs->addr.pc), &(xs->sp), &(xs->fp), &(xs->objp), &restadjust, variables_seg, variables, variables_base, -#ifdef DISABLE_VALIDATIONS - NULL, -#else - variables_max, -#endif - breakpointFlag); + script_debug(s, breakpointFlag); breakpointFlag = false; } #endif #ifndef DISABLE_VALIDATIONS - if (xs->sp < xs->fp) + if (scriptState.xs->sp < scriptState.xs->fp) error("run_vm(): stack underflow"); - variables_max[VAR_TEMP] = xs->sp - xs->fp; + scriptState.variables_max[VAR_TEMP] = scriptState.xs->sp - scriptState.xs->fp; - if (xs->addr.pc.offset >= code_buf_size) + if (scriptState.xs->addr.pc.offset >= code_buf_size) error("run_vm(): program counter gone astray"); #endif @@ -900,16 +888,16 @@ void run_vm(EngineState *s, int restoring) { case 0x17: // bt if (s->r_acc.offset || s->r_acc.segment) - xs->addr.pc.offset += opparams[0]; + scriptState.xs->addr.pc.offset += opparams[0]; break; case 0x18: // bnt if (!(s->r_acc.offset || s->r_acc.segment)) - xs->addr.pc.offset += opparams[0]; + scriptState.xs->addr.pc.offset += opparams[0]; break; case 0x19: // jmp - xs->addr.pc.offset += opparams[0]; + scriptState.xs->addr.pc.offset += opparams[0]; break; case 0x1a: // ldi @@ -925,33 +913,36 @@ void run_vm(EngineState *s, int restoring) { break; case 0x1d: // toss - xs->sp--; + scriptState.xs->sp--; break; case 0x1e: // dup - r_temp = xs->sp[-1]; + r_temp = scriptState.xs->sp[-1]; PUSH32(r_temp); break; case 0x1f: { // link int i; for (i = 0; i < opparams[0]; i++) - xs->sp[i] = NULL_REG; - xs->sp += opparams[0]; + scriptState.xs->sp[i] = NULL_REG; + scriptState.xs->sp += opparams[0]; break; } case 0x20: { // call int argc = (opparams[1] >> 1) // Given as offset, but we need count - + 1 + restadjust; - StackPtr call_base = xs->sp - argc; - xs->sp[1].offset += restadjust; - - xs_new = add_exec_stack_entry(s, make_reg(xs->addr.pc.segment, xs->addr.pc.offset + opparams[0]), - xs->sp, xs->objp, (validate_arithmetic(*call_base)) + restadjust, - call_base, NULL_SELECTOR, xs->objp, s->_executionStack.size()-1, xs->local_segment); - restadjust = 0; // Used up the &rest adjustment - xs->sp = call_base; + + 1 + scriptState.restadjust; + StackPtr call_base = scriptState.xs->sp - argc; + scriptState.xs->sp[1].offset += scriptState.restadjust; + + xs_new = add_exec_stack_entry(s, make_reg(scriptState.xs->addr.pc.segment, + scriptState.xs->addr.pc.offset + opparams[0]), + scriptState.xs->sp, scriptState.xs->objp, + (validate_arithmetic(*call_base)) + scriptState.restadjust, + call_base, NULL_SELECTOR, scriptState.xs->objp, + s->_executionStack.size()-1, scriptState.xs->local_segment); + scriptState.restadjust = 0; // Used up the &rest adjustment + scriptState.xs->sp = call_base; s->_executionStackPosChanged = true; break; @@ -960,25 +951,28 @@ void run_vm(EngineState *s, int restoring) { case 0x21: // callk gc_countdown(s); - xs->sp -= (opparams[1] >> 1) + 1; + scriptState.xs->sp -= (opparams[1] >> 1) + 1; if (!s->_kernel->hasOldScriptHeader()) { - xs->sp -= restadjust; - s->r_amp_rest = 0; // We just used up the restadjust, remember? + scriptState.xs->sp -= scriptState.restadjust; + s->restAdjust = 0; // We just used up the restadjust, remember? } if (opparams[0] >= (int)s->_kernel->_kernelFuncs.size()) { error("Invalid kernel function 0x%x requested\n", opparams[0]); } else { - int argc = ASSERT_ARITHMETIC(xs->sp[0]); + int argc = ASSERT_ARITHMETIC(scriptState.xs->sp[0]); if (!s->_kernel->hasOldScriptHeader()) - argc += restadjust; + argc += scriptState.restadjust; if (s->_kernel->_kernelFuncs[opparams[0]].signature - && !kernel_matches_signature(s, s->_kernel->_kernelFuncs[opparams[0]].signature, argc, xs->sp + 1)) { + && !kernel_matches_signature(s, + s->_kernel->_kernelFuncs[opparams[0]].signature, argc, + scriptState.xs->sp + 1)) { error("[VM] Invalid arguments to kernel call %x\n", opparams[0]); } else { - s->r_acc = s->_kernel->_kernelFuncs[opparams[0]].fun(s, opparams[0], argc, xs->sp + 1); + s->r_acc = s->_kernel->_kernelFuncs[opparams[0]].fun(s, opparams[0], + argc, scriptState.xs->sp + 1); } // Call kernel function @@ -989,31 +983,33 @@ void run_vm(EngineState *s, int restoring) { s->_executionStackPosChanged = true; if (!s->_kernel->hasOldScriptHeader()) - restadjust = s->r_amp_rest; + scriptState.restadjust = s->restAdjust; } break; case 0x22: // callb - temp = ((opparams[1] >> 1) + restadjust + 1); - s_temp = xs->sp; - xs->sp -= temp; - - xs->sp[0].offset += restadjust; - xs_new = execute_method(s, 0, opparams[0], s_temp, xs->objp, xs->sp[0].offset, xs->sp); - restadjust = 0; // Used up the &rest adjustment + temp = ((opparams[1] >> 1) + scriptState.restadjust + 1); + s_temp = scriptState.xs->sp; + scriptState.xs->sp -= temp; + + scriptState.xs->sp[0].offset += scriptState.restadjust; + xs_new = execute_method(s, 0, opparams[0], s_temp, scriptState.xs->objp, + scriptState.xs->sp[0].offset, scriptState.xs->sp); + scriptState.restadjust = 0; // Used up the &rest adjustment if (xs_new) // in case of error, keep old stack s->_executionStackPosChanged = true; break; case 0x23: // calle - temp = ((opparams[2] >> 1) + restadjust + 1); - s_temp = xs->sp; - xs->sp -= temp; + temp = ((opparams[2] >> 1) + scriptState.restadjust + 1); + s_temp = scriptState.xs->sp; + scriptState.xs->sp -= temp; - xs->sp[0].offset += restadjust; - xs_new = execute_method(s, opparams[0], opparams[1], s_temp, xs->objp, xs->sp[0].offset, xs->sp); - restadjust = 0; // Used up the &rest adjustment + scriptState.xs->sp[0].offset += scriptState.restadjust; + xs_new = execute_method(s, opparams[0], opparams[1], s_temp, scriptState.xs->objp, + scriptState.xs->sp[0].offset, scriptState.xs->sp); + scriptState.restadjust = 0; // Used up the &rest adjustment if (xs_new) // in case of error, keep old stack s->_executionStackPosChanged = true; @@ -1021,8 +1017,8 @@ void run_vm(EngineState *s, int restoring) { case 0x24: // ret do { - StackPtr old_sp2 = xs->sp; - StackPtr old_fp = xs->fp; + StackPtr old_sp2 = scriptState.xs->sp; + StackPtr old_fp = scriptState.xs->fp; ExecStack *old_xs = &(s->_executionStack.back()); if ((int)s->_executionStack.size()-1 == s->execution_stack_base) { // Have we reached the base? @@ -1031,7 +1027,7 @@ void run_vm(EngineState *s, int restoring) { s->_executionStack.pop_back(); s->_executionStackPosChanged = true; - s->r_amp_rest = restadjust; // Update &rest + s->restAdjust = scriptState.restadjust; // Update &rest return; // "Hard" return } @@ -1046,80 +1042,84 @@ void run_vm(EngineState *s, int restoring) { // Not reached the base, so let's do a soft return s->_executionStack.pop_back(); s->_executionStackPosChanged = true; - xs = &(s->_executionStack.back()); + scriptState.xs = &(s->_executionStack.back()); - if (xs->sp == CALL_SP_CARRY // Used in sends to 'carry' the stack pointer - || xs->type != EXEC_STACK_TYPE_CALL) { - xs->sp = old_sp2; - xs->fp = old_fp; + if (scriptState.xs->sp == CALL_SP_CARRY // Used in sends to 'carry' the stack pointer + || scriptState.xs->type != EXEC_STACK_TYPE_CALL) { + scriptState.xs->sp = old_sp2; + scriptState.xs->fp = old_fp; } - } while (xs->type == EXEC_STACK_TYPE_VARSELECTOR); + } while (scriptState.xs->type == EXEC_STACK_TYPE_VARSELECTOR); // Iterate over all varselector accesses s->_executionStackPosChanged = true; - xs_new = xs; + xs_new = scriptState.xs; break; case 0x25: // send - s_temp = xs->sp; - xs->sp -= ((opparams[0] >> 1) + restadjust); // Adjust stack + s_temp = scriptState.xs->sp; + scriptState.xs->sp -= ((opparams[0] >> 1) + scriptState.restadjust); // Adjust stack - xs->sp[1].offset += restadjust; - xs_new = send_selector(s, s->r_acc, s->r_acc, s_temp, (int)(opparams[0] >> 1) + (uint16)restadjust, xs->sp); + scriptState.xs->sp[1].offset += scriptState.restadjust; + xs_new = send_selector(s, s->r_acc, s->r_acc, s_temp, + (int)(opparams[0] >> 1) + scriptState.restadjust, scriptState.xs->sp); - if (xs_new && xs_new != xs) + if (xs_new && xs_new != scriptState.xs) s->_executionStackPosChanged = true; - restadjust = 0; + scriptState.restadjust = 0; break; case 0x28: // class - s->r_acc = get_class_address(s, (unsigned)opparams[0], SCRIPT_GET_LOCK, xs->addr.pc); + s->r_acc = get_class_address(s, (unsigned)opparams[0], SCRIPT_GET_LOCK, + scriptState.xs->addr.pc); break; case 0x2a: // self - s_temp = xs->sp; - xs->sp -= ((opparams[0] >> 1) + restadjust); // Adjust stack + s_temp = scriptState.xs->sp; + scriptState.xs->sp -= ((opparams[0] >> 1) + scriptState.restadjust); // Adjust stack - xs->sp[1].offset += restadjust; - xs_new = send_selector(s, xs->objp, xs->objp, s_temp, (int)(opparams[0] >> 1) + (uint16)restadjust, xs->sp); + scriptState.xs->sp[1].offset += scriptState.restadjust; + xs_new = send_selector(s, scriptState.xs->objp, scriptState.xs->objp, + s_temp, (int)(opparams[0] >> 1) + scriptState.restadjust, + scriptState.xs->sp); - if (xs_new && xs_new != xs) + if (xs_new && xs_new != scriptState.xs) s->_executionStackPosChanged = true; - restadjust = 0; + scriptState.restadjust = 0; break; case 0x2b: // super - r_temp = get_class_address(s, opparams[0], SCRIPT_GET_LOAD, xs->addr.pc); + r_temp = get_class_address(s, opparams[0], SCRIPT_GET_LOAD, scriptState.xs->addr.pc); if (!r_temp.segment) error("[VM]: Invalid superclass in object"); else { - s_temp = xs->sp; - xs->sp -= ((opparams[1] >> 1) + restadjust); // Adjust stack + s_temp = scriptState.xs->sp; + scriptState.xs->sp -= ((opparams[1] >> 1) + scriptState.restadjust); // Adjust stack - xs->sp[1].offset += restadjust; - xs_new = send_selector(s, r_temp, xs->objp, s_temp, (int)(opparams[1] >> 1) + (uint16)restadjust, xs->sp); + scriptState.xs->sp[1].offset += scriptState.restadjust; + xs_new = send_selector(s, r_temp, scriptState.xs->objp, s_temp, + (int)(opparams[1] >> 1) + scriptState.restadjust, + scriptState.xs->sp); - if (xs_new && xs_new != xs) + if (xs_new && xs_new != scriptState.xs) s->_executionStackPosChanged = true; - restadjust = 0; + scriptState.restadjust = 0; } break; case 0x2c: // &rest temp = (uint16) opparams[0]; // First argument - restadjust = xs->argc - temp + 1; // +1 because temp counts the paramcount while argc doesn't - if (restadjust < 0) - restadjust = 0; + scriptState.restadjust = MAX(scriptState.xs->argc - temp + 1, 0); // +1 because temp counts the paramcount while argc doesn't - for (; temp <= xs->argc; temp++) - PUSH32(xs->variables_argp[temp]); + for (; temp <= scriptState.xs->argc; temp++) + PUSH32(scriptState.xs->variables_argp[temp]); break; @@ -1128,8 +1128,8 @@ void run_vm(EngineState *s, int restoring) { var_number = temp & 0x03; // Get variable type // Get variable block offset - r_temp.segment = variables_seg[var_number]; - r_temp.offset = variables[var_number] - variables_base[var_number]; + r_temp.segment = scriptState.variables_seg[var_number]; + r_temp.offset = scriptState.variables[var_number] - scriptState.variables_base[var_number]; if (temp & 0x08) // Add accumulator offset if requested r_temp.offset += signed_validate_arithmetic(s->r_acc); @@ -1142,7 +1142,7 @@ void run_vm(EngineState *s, int restoring) { case 0x2e: // selfID - s->r_acc = xs->objp; + s->r_acc = scriptState.xs->objp; break; case 0x30: // pprev @@ -1189,7 +1189,7 @@ void run_vm(EngineState *s, int restoring) { case 0x39: // lofsa - s->r_acc.segment = xs->addr.pc.segment; + s->r_acc.segment = scriptState.xs->addr.pc.segment; if (s->_version >= SCI_VERSION_1_1) { s->r_acc.offset = opparams[0] + local_script->script_size; @@ -1197,7 +1197,7 @@ void run_vm(EngineState *s, int restoring) { if (s->_kernel->hasLofsAbsolute()) s->r_acc.offset = opparams[0]; else - s->r_acc.offset = xs->addr.pc.offset + opparams[0]; + s->r_acc.offset = scriptState.xs->addr.pc.offset + opparams[0]; } #ifndef DISABLE_VALIDATIONS @@ -1209,7 +1209,7 @@ void run_vm(EngineState *s, int restoring) { break; case 0x3a: // lofss - r_temp.segment = xs->addr.pc.segment; + r_temp.segment = scriptState.xs->addr.pc.segment; if (s->_version >= SCI_VERSION_1_1) { r_temp.offset = opparams[0] + local_script->script_size; @@ -1217,7 +1217,7 @@ void run_vm(EngineState *s, int restoring) { if (s->_kernel->hasLofsAbsolute()) r_temp.offset = opparams[0]; else - r_temp.offset = xs->addr.pc.offset + opparams[0]; + r_temp.offset = scriptState.xs->addr.pc.offset + opparams[0]; } #ifndef DISABLE_VALIDATIONS @@ -1242,7 +1242,7 @@ void run_vm(EngineState *s, int restoring) { break; case 0x3e: // pushSelf - PUSH32(xs->objp); + PUSH32(scriptState.xs->objp); break; case 0x40: // lag @@ -1410,12 +1410,12 @@ void run_vm(EngineState *s, int restoring) { } // switch(opcode >> 1) if (s->_executionStackPosChanged) // Force initialization - xs = xs_new; + scriptState.xs = xs_new; //#ifndef DISABLE_VALIDATIONS - if (xs != &(s->_executionStack.back())) { + if (scriptState.xs != &(s->_executionStack.back())) { warning("xs is stale (%p vs %p); last command was %02x", - (void *)xs, (void *)&(s->_executionStack.back()), + (void *)scriptState.xs, (void *)&(s->_executionStack.back()), opnumber); } //#endif @@ -2037,9 +2037,8 @@ const char *obj_get_name(EngineState *s, reg_t pos) { void quit_vm() { script_abort_flag = 1; // Terminate VM - debugState.isValid = false; - debugState.seeking = kDebugSeekNothing; - debugState.runningStep = 0; + scriptState.seeking = kDebugSeekNothing; + scriptState.runningStep = 0; } void shrink_execution_stack(EngineState *s, uint size) { diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h index a3fabbe44b..1472fae97c 100644 --- a/engines/sci/engine/vm.h +++ b/engines/sci/engine/vm.h @@ -243,24 +243,23 @@ enum ExecStackType { }; struct ExecStack { - reg_t objp; - reg_t sendp; /**< Pointer to the object containing the invoked method */ + reg_t objp; // Pointer to the beginning of the current object + reg_t sendp; // Pointer to the object containing the invoked method union { - ObjVarRef varp; /**< Variable pointer for r/w access */ - reg_t pc; /**< Not accurate for the TOS element */ + ObjVarRef varp; // Variable pointer for r/w access + reg_t pc; // Pointer to the initial program counter. Not accurate for the TOS element } addr; - StackPtr fp; /**< Frame pointer */ - StackPtr sp; /**< Stack pointer */ + StackPtr fp; // Frame pointer + StackPtr sp; // Stack pointer int argc; - /* former variables[4]: [all other values are derived] */ - StackPtr variables_argp; /**< Argument pointer */ - SegmentId local_segment; /**< local variables etc. */ + StackPtr variables_argp; // Argument pointer + SegmentId local_segment; // local variables etc - Selector selector; /**< The selector which was used to call or -1 if not applicable */ - int origin; /**< The stack frame position the call was made from, or -1 if it was the initial call. */ + Selector selector; // The selector which was used to call or -1 if not applicable + int origin; // The stack frame position the call was made from, or -1 if it was the initial call ExecStackType type; reg_t* getVarPointer(EngineState *s) const; @@ -409,27 +408,10 @@ void vm_handle_fatal_error(EngineState *s, int line, const char *file); /** * Debugger functionality - * @param[in] s The state at which debugging should take - * place - * @param[in] pc Pointer to the program counter - * @param[in] sp Pointer to the stack pointer - * @param[in] pp Pointer to the frame pointer - * @param[in] objp Pointer to the object base pointer - * @param[in] restadjust Pointer to the &rest adjustment value - * @param[in] segids four-element array containing segment IDs - * for locals etc. - * @param[in] variables four-element array referencing registers - * for globals etc. - * @param[in] variables_base four-element array referencing register - * bases for temps etc. - * @param[in] variables_nr four-element array giving sizes for params - * etc. (may be NULL) - * @param[in] bp Flag, set to 1 when a breakpoint is - * triggered - */ -void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, - reg_t *objp, int *restadjust, SegmentId *segids, reg_t **variables, - reg_t **variables_base, int *variables_nr, int bp); + * @param[in] s The state at which debugging should take place + * @param[in] bp Flag, set to true when a breakpoint is triggered + */ +void script_debug(EngineState *s, bool bp); /** * Initializes a EngineState block diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 09c433edc2..9c94e2edde 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -240,12 +240,12 @@ Common::Error SciEngine::run() { GUI::Debugger *SciEngine::getDebugger() { if (_gamestate) { ExecStack *xs = &(_gamestate->_executionStack.back()); - xs->addr.pc.offset = debugState.old_pc_offset; - xs->sp = debugState.old_sp; + xs->addr.pc.offset = scriptState.old_pc_offset; + xs->sp = scriptState.old_sp; } - debugState.runningStep = 0; // Stop multiple execution - debugState.seeking = kDebugSeekNothing; // Stop special seeks + scriptState.runningStep = 0; // Stop multiple execution + scriptState.seeking = kDebugSeekNothing; // Stop special seeks return _console; } -- cgit v1.2.3 From a764f274f83b72c4fafa5ad1c72127462c7c9410 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 8 Jul 2009 10:35:51 +0000 Subject: Fixed saving/loading again (broken with the latest changes for game feature auto-detection) svn-id: r42261 --- engines/sci/engine/savegame.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index f44af2b1cd..83f65db81c 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -756,6 +756,22 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { // FIXME: Do in-place loading at some point, instead of creating a new EngineState instance from scratch. retval = new EngineState(s->resmgr, s->_version, s->_flags); + // static parser information: + assert(0 == retval->_vocabulary); + retval->_vocabulary = s->_vocabulary; +// s->_vocabulary = 0; // FIXME: We should set s->_vocabulary to 0 here, +// else it could be freed when the old EngineState is freed. Luckily, this freeing currently +// never happens, so we don't need to. + + retval->parser_base = make_reg(s->sys_strings_segment, SYS_STRING_PARSER_BASE); + + // static VM/Kernel information: + assert(0 == retval->_kernel); + retval->_kernel = s->_kernel; +// s->_kernel = 0; // FIXME: We should set s->_kernel to 0 here, +// else it could be freed when the old EngineState is freed. Luckily, this freeing currently +// never happens, so we don't need to. + // Copy some old data retval->gfx_state = s->gfx_state; retval->sound_mute = s->sound_mute; @@ -813,22 +829,6 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { retval->last_wait_time = g_system->getMillis(); retval->game_start_time = g_system->getMillis() - retval->game_time * 1000; - // static parser information: - assert(0 == retval->_vocabulary); - retval->_vocabulary = s->_vocabulary; -// s->_vocabulary = 0; // FIXME: We should set s->_vocabulary to 0 here, -// else it could be freed when the old EngineState is freed. Luckily, this freeing currently -// never happens, so we don't need to. - - retval->parser_base = make_reg(s->sys_strings_segment, SYS_STRING_PARSER_BASE); - - // static VM/Kernel information: - assert(0 == retval->_kernel); - retval->_kernel = s->_kernel; -// s->_kernel = 0; // FIXME: We should set s->_kernel to 0 here, -// else it could be freed when the old EngineState is freed. Luckily, this freeing currently -// never happens, so we don't need to. - // Copy breakpoint information from current game instance retval->have_bp = s->have_bp; retval->bp_list = s->bp_list; -- cgit v1.2.3 From d351c7b9cb6cb46da9bb141c9ca90aba021c1602 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 8 Jul 2009 10:44:25 +0000 Subject: Only the kernel needs to be initialized before anything else, when saving/loading svn-id: r42262 --- engines/sci/engine/savegame.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 83f65db81c..e167e7eca8 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -756,18 +756,9 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { // FIXME: Do in-place loading at some point, instead of creating a new EngineState instance from scratch. retval = new EngineState(s->resmgr, s->_version, s->_flags); - // static parser information: - assert(0 == retval->_vocabulary); - retval->_vocabulary = s->_vocabulary; -// s->_vocabulary = 0; // FIXME: We should set s->_vocabulary to 0 here, -// else it could be freed when the old EngineState is freed. Luckily, this freeing currently -// never happens, so we don't need to. - - retval->parser_base = make_reg(s->sys_strings_segment, SYS_STRING_PARSER_BASE); - // static VM/Kernel information: assert(0 == retval->_kernel); - retval->_kernel = s->_kernel; + retval->_kernel = s->_kernel; // needs to be initialized before _reset_graphics_input is called // s->_kernel = 0; // FIXME: We should set s->_kernel to 0 here, // else it could be freed when the old EngineState is freed. Luckily, this freeing currently // never happens, so we don't need to. @@ -829,6 +820,15 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { retval->last_wait_time = g_system->getMillis(); retval->game_start_time = g_system->getMillis() - retval->game_time * 1000; + // static parser information: + assert(0 == retval->_vocabulary); + retval->_vocabulary = s->_vocabulary; +// s->_vocabulary = 0; // FIXME: We should set s->_vocabulary to 0 here, +// else it could be freed when the old EngineState is freed. Luckily, this freeing currently +// never happens, so we don't need to. + + retval->parser_base = make_reg(s->sys_strings_segment, SYS_STRING_PARSER_BASE); + // Copy breakpoint information from current game instance retval->have_bp = s->have_bp; retval->bp_list = s->bp_list; -- cgit v1.2.3 From 5ca94c5cce2ca0b42bb678835d9e141456bbae5b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 8 Jul 2009 13:08:51 +0000 Subject: - Moved printObject inside the Console class - Enabled the parts where disassemble() is called svn-id: r42263 --- engines/sci/console.cpp | 41 +++++++++++++++++++---------------------- engines/sci/console.h | 4 +++- engines/sci/engine/vm.cpp | 5 ++--- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 667a39c063..7f20e4013d 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -1927,7 +1927,7 @@ bool Console::cmdViewReference(int argc, const char **argv) { break; case KSIG_OBJECT: DebugPrintf("object\n"); - printObject(_vm->_gamestate, reg); + printObject(reg); break; case KSIG_REF: { int size; @@ -1982,21 +1982,21 @@ bool Console::cmdViewObject(int argc, const char **argv) { } DebugPrintf("Information on the object at the given address:\n"); - printObject(_vm->_gamestate, addr); + printObject(addr); return true; } bool Console::cmdViewActiveObject(int argc, const char **argv) { DebugPrintf("Information on the currently active object or class:\n"); - printObject(_vm->_gamestate, scriptState.xs->objp); + printObject(scriptState.xs->objp); return true; } bool Console::cmdViewAccumulatorObject(int argc, const char **argv) { DebugPrintf("Information on the currently active object or class at the address indexed by the accumulator:\n"); - printObject(_vm->_gamestate, _vm->_gamestate->r_acc); + printObject(_vm->_gamestate->r_acc); return true; } @@ -2195,8 +2195,7 @@ bool Console::cmdDissassemble(int argc, const char **argv) { } do { - // TODO - //addr = disassemble(_vm->_gamestate, addr, 0, 0); + addr = disassemble(_vm->_gamestate, addr, 0, 0); } while (addr.offset > 0); return true; @@ -2247,9 +2246,7 @@ bool Console::cmdDissassembleAddress(int argc, const char **argv) { } do { - // TODO - //vpc = disassemble(_vm->_gamestate, vpc, do_bwc, do_bytes); - + vpc = disassemble(_vm->_gamestate, vpc, do_bwc, do_bytes); } while ((vpc.offset > 0) && (vpc.offset + 6 < size) && (--op_count)); return true; @@ -3029,47 +3026,47 @@ int Console::printNode(reg_t addr) { return 0; } -int printObject(EngineState *s, reg_t pos) { +int Console::printObject(reg_t pos) { + EngineState *s = _vm->_gamestate; // for the several defines in this function Object *obj = obj_get(s, pos); Object *var_container = obj; int i; - Console *con = ((SciEngine *)g_engine)->getSciDebugger(); if (!obj) { - con->DebugPrintf("[%04x:%04x]: Not an object.", PRINT_REG(pos)); + DebugPrintf("[%04x:%04x]: Not an object.", PRINT_REG(pos)); return 1; } // Object header - printf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(pos), obj_get_name(s, pos), + DebugPrintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(pos), obj_get_name(s, pos), obj->_variables.size(), obj->methods_nr); if (!(obj->_variables[SCRIPT_INFO_SELECTOR].offset & SCRIPT_INFO_CLASS)) var_container = obj_get(s, obj->_variables[SCRIPT_SUPERCLASS_SELECTOR]); - printf(" -- member variables:\n"); + DebugPrintf(" -- member variables:\n"); for (i = 0; (uint)i < obj->_variables.size(); i++) { printf(" "); if (i < var_container->variable_names_nr) { - printf("[%03x] %s = ", VM_OBJECT_GET_VARSELECTOR(var_container, i), selector_name(s, VM_OBJECT_GET_VARSELECTOR(var_container, i))); + DebugPrintf("[%03x] %s = ", VM_OBJECT_GET_VARSELECTOR(var_container, i), selector_name(s, VM_OBJECT_GET_VARSELECTOR(var_container, i))); } else - printf("p#%x = ", i); + DebugPrintf("p#%x = ", i); reg_t val = obj->_variables[i]; - printf("%04x:%04x", PRINT_REG(val)); + DebugPrintf("%04x:%04x", PRINT_REG(val)); Object *ref = obj_get(s, val); if (ref) - printf(" (%s)", obj_get_name(s, val)); + DebugPrintf(" (%s)", obj_get_name(s, val)); - printf("\n"); + DebugPrintf("\n"); } - printf(" -- methods:\n"); + DebugPrintf(" -- methods:\n"); for (i = 0; i < obj->methods_nr; i++) { reg_t fptr = VM_OBJECT_READ_FUNCTION(obj, i); - printf(" [%03x] %s = %04x:%04x\n", VM_OBJECT_GET_FUNCSELECTOR(obj, i), selector_name(s, VM_OBJECT_GET_FUNCSELECTOR(obj, i)), PRINT_REG(fptr)); + DebugPrintf(" [%03x] %s = %04x:%04x\n", VM_OBJECT_GET_FUNCSELECTOR(obj, i), selector_name(s, VM_OBJECT_GET_FUNCSELECTOR(obj, i)), PRINT_REG(fptr)); } if (s->seg_manager->_heap[pos.segment]->getType() == MEM_OBJ_SCRIPT) - printf("\nOwner script:\t%d\n", s->seg_manager->getScript(pos.segment)->nr); + DebugPrintf("\nOwner script:\t%d\n", s->seg_manager->getScript(pos.segment)->nr); return 0; } diff --git a/engines/sci/console.h b/engines/sci/console.h index bc07ddb530..8d1299dd1e 100644 --- a/engines/sci/console.h +++ b/engines/sci/console.h @@ -37,7 +37,7 @@ struct List; // Refer to the "addresses" command on how to pass address parameters int parse_reg_t(EngineState *s, const char *str, reg_t *dest); -int printObject(EngineState *s, reg_t pos); +reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecode); class Console : public GUI::Debugger { public: @@ -46,6 +46,8 @@ public: void preEnter(); void postEnter(); + int printObject(reg_t pos); + private: // General bool cmdHelp(int argc, const char **argv); diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 9bbdb90e0c..e0ac60f152 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -1972,8 +1972,6 @@ static EngineState *_game_run(EngineState *&s, int restoring) { return s; } -int printObject(EngineState *s, reg_t pos); - int game_run(EngineState **_s) { EngineState *s = *_s; @@ -1982,7 +1980,8 @@ int game_run(EngineState **_s) { // Now: Register the first element on the execution stack- if (!send_selector(s, s->game_obj, s->game_obj, s->stack_base, 2, s->stack_base)) { - printObject(s, s->game_obj); + Console *con = ((SciEngine *)g_engine)->getSciDebugger(); + con->printObject(s->game_obj); warning("Failed to run the game! Aborting..."); return 1; } -- cgit v1.2.3 From 2950bc28c4d14b5991c9fb4e854644d1c4f93a0f Mon Sep 17 00:00:00 2001 From: Florian Kagerer Date: Wed, 8 Jul 2009 20:19:23 +0000 Subject: LOL: fix long standing bugs in the battle system (hit chance, damage, etc) by adapting original style random number generator svn-id: r42269 --- engines/kyra/lol.cpp | 53 +++++++++++++++++++++++++++++++------------- engines/kyra/lol.h | 5 +++-- engines/kyra/scene_lol.cpp | 4 ++-- engines/kyra/script_lol.cpp | 19 ++++++++++------ engines/kyra/sprites_lol.cpp | 8 +++---- engines/kyra/timer_lol.cpp | 4 ++-- 6 files changed, 60 insertions(+), 33 deletions(-) diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 7c4b073f29..8f00708e43 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -214,8 +214,6 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy _compassBroken = _drainMagic = 0; _dialogueField = false; - _rndSpecial = 0x12349876; - _buttonData = 0; _activeButtons = 0; gui_resetButtonList(); @@ -1082,7 +1080,7 @@ bool LoLEngine::addCharacter(int id) { loadCharFaceShapes(numChars, id); - _characters[numChars].nextAnimUpdateCountdown = (int16) _rnd.getRandomNumberRng(1, 12) + 6; + _characters[numChars].nextAnimUpdateCountdown = (int16) generateRandomNumber(1, 12) + 6; for (i = 0; i < 11; i++) { if (_characters[numChars].items[i]) { @@ -1176,7 +1174,7 @@ void LoLEngine::updatePortraitSpeechAnim() { } } - int f = _rnd.getRandomNumberRng(1, 6) - 1; + int f = generateRandomNumber(1, 6) - 1; if (f == _characters[_updateCharNum].curFaceFrame) f++; if (f > 5) @@ -1404,24 +1402,24 @@ void LoLEngine::increaseExperience(int charNum, int skill, uint32 points) { switch (skill) { case 0: _txt->printMessage(0x8003, getLangString(0x4023), _characters[charNum].name); - inc = _rnd.getRandomNumberRng(4, 6); + inc = generateRandomNumber(4, 6); _characters[charNum].hitPointsCur += inc; _characters[charNum].hitPointsMax += inc; break; case 1: _txt->printMessage(0x8003, getLangString(0x4025), _characters[charNum].name); - inc = _rnd.getRandomNumberRng(2, 6); + inc = generateRandomNumber(2, 6); _characters[charNum].hitPointsCur += inc; _characters[charNum].hitPointsMax += inc; break; case 2: _txt->printMessage(0x8003, getLangString(0x4024), _characters[charNum].name); - inc = (_characters[charNum].defaultModifiers[6] * (_rnd.getRandomNumberRng(1, 8) + 17)) >> 8; + inc = (_characters[charNum].defaultModifiers[6] * (generateRandomNumber(1, 8) + 17)) >> 8; _characters[charNum].magicPointsCur += inc; _characters[charNum].magicPointsMax += inc; - inc = _rnd.getRandomNumberRng(1, 6); + inc = generateRandomNumber(1, 6); _characters[charNum].hitPointsCur += inc; _characters[charNum].hitPointsMax += inc; break; @@ -1874,6 +1872,29 @@ void LoLEngine::delay(uint32 millis, bool doUpdate, bool) { } } +int LoLEngine::generateRandomNumber(int min, int max) { + // The output produced by this random number generator + // differs a lot from _rnd.getRandomNumberRng(). Using + // _rnd.getRandomNumberRng() instead of this function + // here will break the fighting system! + + if (min <= 0 || max <= 0) + return 0; + + int res = 0; + int d = 0; + + do { + int val = (((int)_rnd.getRandomNumber(0x7fff) * max) / 0x8000) + 1; + if (val > max) + val -= max; + res += val; + d++; + } while (d < min); + + return res; +} + void LoLEngine::updateEnvironmentalSfx(int soundId) { snd_processEnvironmentalSoundEffect(soundId, _currentBlock); } @@ -2260,7 +2281,7 @@ int LoLEngine::processMagicIce(int charNum, int spellLevel) { } else { uint16 o = _levelBlockProperties[calcNewBlockPosition(_currentBlock, _currentDirection)].assignedObjects; while (o & 0x8000) { - int might = _rnd.getRandomNumberRng(iceDamageMin[spellLevel], iceDamageMax[spellLevel]) + iceDamageAdd[spellLevel]; + int might = generateRandomNumber(iceDamageMin[spellLevel], iceDamageMax[spellLevel]) + iceDamageAdd[spellLevel]; int dmg = calcInflictableDamagePerItem(charNum, 0, might, 3, 2); MonsterInPlay *m = &_monsters[o & 0x7fff]; @@ -3192,7 +3213,7 @@ int LoLEngine::battleHitSkillTest(int16 attacker, int16 target, int skill) { evadeChanceModifier = _characters[target].defaultModifiers[3]; } - int r = _rnd.getRandomNumberRng(1, 100); + int r = generateRandomNumber(1, 100); if (r >= sk) return 2; @@ -3230,9 +3251,9 @@ int LoLEngine::inflictDamage(uint16 target, int damage, uint16 attacker, int ski m->hitPoints -= damage; m->damageReceived = 0x8000 | damage; m->flags |= 0x10; - m->hitOffsX = _rnd.getRandomNumberRng(1, 24); + m->hitOffsX = generateRandomNumber(1, 24); m->hitOffsX -= 12; - m->hitOffsY = _rnd.getRandomNumberRng(1, 24); + m->hitOffsY = generateRandomNumber(1, 24); m->hitOffsY -= 12; m->hitPoints = CLIP(m->hitPoints, 0, m->properties->hitPoints); @@ -3436,7 +3457,7 @@ void LoLEngine::checkForPartyDeath() { } void LoLEngine::applyMonsterAttackSkill(MonsterInPlay *monster, int16 target, int16 damage) { - if (_rnd.getRandomNumberRng(1, 100) > monster->properties->attackSkillChance) + if (generateRandomNumber(1, 100) > monster->properties->attackSkillChance) return; int t = 0; @@ -3506,7 +3527,7 @@ void LoLEngine::applyMonsterAttackSkill(MonsterInPlay *monster, int16 target, in } void LoLEngine::applyMonsterDefenseSkill(MonsterInPlay *monster, int16 attacker, int flags, int skill, int damage) { - if (_rnd.getRandomNumberRng(1, 100) > monster->properties->defenseSkillChance) + if (generateRandomNumber(1, 100) > monster->properties->defenseSkillChance) return; int itm = 0; @@ -3593,7 +3614,7 @@ int LoLEngine::paralyzePoisonCharacter(int charNum, int typeFlag, int immunityFl if (!(_characters[charNum].flags & 1) || (_characters[charNum].flags & immunityFlags)) return 0; - if ((int)_rnd.getRandomNumberRng(1, 100) > hitChance) + if ((int)generateRandomNumber(1, 100) > hitChance) return 0; int r = 0; @@ -3711,7 +3732,7 @@ void LoLEngine::launchMagicViper() { _screen->copyPage(12, 0); _screen->copyPage(12, 2); - int t = _rnd.getRandomNumberRng(1, 4); + int t = generateRandomNumber(1, 4); for (int i = 0; i < 4; i++) { if (!(_characters[i].flags & 1)) { diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index 12000c31fa..8fafa450b3 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -642,6 +642,7 @@ private: int olol_setWallType(EMCState *script); int olol_getWallType(EMCState *script); int olol_drawScene(EMCState *script); + int olol_getRand(EMCState *script); int olol_moveParty(EMCState *script); int olol_delay(EMCState *script); int olol_setGameFlag(EMCState *script); @@ -1313,6 +1314,7 @@ private: // misc void delay(uint32 millis, bool doUpdate = false, bool isMainLoop = false); + int generateRandomNumber(int min, int max); uint8 _compassBroken; uint8 _drainMagic; @@ -1320,8 +1322,7 @@ private: uint8 *_pageBuffer1; uint8 *_pageBuffer2; - uint32 _rndSpecial; - + // spells typedef Common::Functor1Mem SpellProc; Common::Array _spellProcs; diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index 945495517f..403b4cc69c 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -552,14 +552,14 @@ void LoLEngine::updateLampStatus() { if (_lampEffect == -1) { if (_screen->_fadeFlag == 0) setPaletteBrightness(_screen->getPalette(0), _brightness, newLampEffect); - _lampStatusTimer = _system->getMillis() + (10 + _rnd.getRandomNumberRng(1, 30)) * _tickLength; + _lampStatusTimer = _system->getMillis() + (10 + generateRandomNumber(1, 30)) * _tickLength; } else { if ((_lampEffect & 0xfe) == (newLampEffect & 0xfe)) { if (_system->getMillis() <= _lampStatusTimer) { newLampEffect = _lampEffect; } else { newLampEffect = _lampEffect ^ 1; - _lampStatusTimer = _system->getMillis() + (10 + _rnd.getRandomNumberRng(1, 30)) * _tickLength; + _lampStatusTimer = _system->getMillis() + (10 + generateRandomNumber(1, 30)) * _tickLength; } } else { if (_screen->_fadeFlag == 0) diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index a606419722..18b8d81ef9 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -135,6 +135,11 @@ int LoLEngine::olol_drawScene(EMCState *script) { return 1; } +int LoLEngine::olol_getRand(EMCState *script) { + debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_getRand(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); + return generateRandomNumber(stackPos(0), stackPos(1)); +} + int LoLEngine::olol_moveParty(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_moveParty(%p) (%d)", (const void *)script, stackPos(0)); int mode = stackPos(0); @@ -831,10 +836,10 @@ int LoLEngine::olol_initMonster(EMCState *script) { l->hitPoints = (l->properties->hitPoints * _monsterModifiers[_monsterDifficulty]) >> 8; if (_currentLevel == 12 && l->type == 2) - l->hitPoints = (l->hitPoints * (_rnd.getRandomNumberRng(1, 128) + 192)) >> 8; + l->hitPoints = (l->hitPoints * (generateRandomNumber(1, 128) + 192)) >> 8; l->numDistAttacks = l->properties->numDistAttacks; - l->distAttackTick = _rnd.getRandomNumberRng(1, calcMonsterSkillLevel(l->id | 0x8000, 8)) - 1; + l->distAttackTick = generateRandomNumber(1, calcMonsterSkillLevel(l->id | 0x8000, 8)) - 1; l->flyingHeight = 2; l->flags = stackPos(5); l->assignedItems = 0; @@ -1366,18 +1371,18 @@ int LoLEngine::olol_characterSkillTest(EMCState *script){ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_characterSkillTest(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); int skill = stackPos(0); int n = countActiveCharacters(); - uint m = 0; + int m = 0; int c = 0; for (int i = 0; i < n ; i++) { - uint v = _characters[i].skillModifiers[skill] + _characters[i].skillLevels[skill] + 25; + int v = _characters[i].skillModifiers[skill] + _characters[i].skillLevels[skill] + 25; if (v > m) { m = v; c = i; } } - return (_rnd.getRandomNumberRng(1, 100) > m) ? -1 : c; + return (generateRandomNumber(1, 100) > m) ? -1 : c; } int LoLEngine::olol_countAllMonsters(EMCState *script){ @@ -1440,7 +1445,7 @@ int LoLEngine::olol_calcInflictableDamage(EMCState *script) { int LoLEngine::olol_getInflictedDamage(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_getInflictedDamage(%p) (%d)", (const void *)script, stackPos(0)); int mx = stackPos(0); - return mx ? _rnd.getRandomNumberRng(2, mx) : 0; + return generateRandomNumber(2, mx); } int LoLEngine::olol_checkForCertainPartyMember(EMCState *script) { @@ -2617,7 +2622,7 @@ void LoLEngine::setupOpcodeTable() { Opcode(olol_setWallType); Opcode(olol_getWallType); Opcode(olol_drawScene); - Opcode(o1_getRand); + Opcode(olol_getRand); // 0x04 Opcode(olol_moveParty); diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp index 8cee1dc5fc..b1edecb318 100644 --- a/engines/kyra/sprites_lol.cpp +++ b/engines/kyra/sprites_lol.cpp @@ -1071,7 +1071,7 @@ void LoLEngine::updateMonster(MonsterInPlay *monster) { monster->speedTick = 0; if (monster->properties->flags & 0x40) { - monster->hitPoints += _rnd.getRandomNumberRng(1, 8); + monster->hitPoints += generateRandomNumber(1, 8); if (monster->hitPoints > monster->properties->hitPoints) monster->hitPoints = monster->properties->hitPoints; } @@ -1264,7 +1264,7 @@ bool LoLEngine::chasePartyWithDistanceAttacks(MonsterInPlay *monster) { int s = 0; if (monster->flags & 0x10) { - s = monster->properties->numDistWeapons ? _rnd.getRandomNumberRng(1, monster->properties->numDistWeapons) : 0; + s = monster->properties->numDistWeapons ? generateRandomNumber(1, monster->properties->numDistWeapons) : 0; } else { s = monster->curDistWeapon++; if (monster->curDistWeapon >= monster->properties->numDistWeapons) @@ -1344,7 +1344,7 @@ void LoLEngine::chasePartyWithCloseAttacks(MonsterInPlay *monster) { if (hit) { int mx = calcInflictableDamage(m, dst, hit); - int dmg = mx ? _rnd.getRandomNumberRng(2, mx) : 0; + int dmg = generateRandomNumber(2, mx ); inflictDamage(dst, dmg, m, 0, 0); applyMonsterAttackSkill(monster, dst, dmg); } @@ -1364,7 +1364,7 @@ void LoLEngine::chasePartyWithCloseAttacks(MonsterInPlay *monster) { walkMonster(monster); } else { setMonsterDirection(monster, monster->destDirection); - setMonsterMode(monster, (_rnd.getRandomNumberRng(1, 100) <= 50) ? 4 : 3); + setMonsterMode(monster, (generateRandomNumber(1, 100) <= 50) ? 4 : 3); } } diff --git a/engines/kyra/timer_lol.cpp b/engines/kyra/timer_lol.cpp index 84c4f8b19d..0a17c0993c 100644 --- a/engines/kyra/timer_lol.cpp +++ b/engines/kyra/timer_lol.cpp @@ -147,7 +147,7 @@ void LoLEngine::timerSpecialCharacterUpdate(int timerNum) { break; case 3: - v = _rnd.getRandomNumberRng(1, 2); + v = generateRandomNumber(1, 2); if (inflictDamage(i, v, 0x8000, 0, 0x80)) { _txt->printMessage(2, getLangString(0x4022), _characters[i].name); _characters[i].characterUpdateDelay[ii] = 10; @@ -241,7 +241,7 @@ void LoLEngine::timerUpdatePortraitAnimations(int skipUpdate) { } else { _characters[i].curFaceFrame = 0; gui_drawCharPortraitWithStats(i); - _characters[i].nextAnimUpdateCountdown = (int16) _rnd.getRandomNumberRng(1, 12) + 6; + _characters[i].nextAnimUpdateCountdown = (int16) generateRandomNumber(1, 12) + 6; } } } -- cgit v1.2.3 From a212a9da7e28b476ec2d8417e54c9adf9a551291 Mon Sep 17 00:00:00 2001 From: Florian Kagerer Date: Wed, 8 Jul 2009 20:32:34 +0000 Subject: LOL: rename new function in last commit according to LordHoto's suggestion svn-id: r42270 --- engines/kyra/lol.cpp | 45 ++++++++++++++++++++------------------------ engines/kyra/lol.h | 4 ++-- engines/kyra/scene_lol.cpp | 4 ++-- engines/kyra/script_lol.cpp | 16 ++++++++-------- engines/kyra/sprites_lol.cpp | 8 ++++---- engines/kyra/timer_lol.cpp | 4 ++-- 6 files changed, 38 insertions(+), 43 deletions(-) diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 8f00708e43..33ba2bff7e 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -1080,7 +1080,7 @@ bool LoLEngine::addCharacter(int id) { loadCharFaceShapes(numChars, id); - _characters[numChars].nextAnimUpdateCountdown = (int16) generateRandomNumber(1, 12) + 6; + _characters[numChars].nextAnimUpdateCountdown = (int16) rollDice(1, 12) + 6; for (i = 0; i < 11; i++) { if (_characters[numChars].items[i]) { @@ -1174,7 +1174,7 @@ void LoLEngine::updatePortraitSpeechAnim() { } } - int f = generateRandomNumber(1, 6) - 1; + int f = rollDice(1, 6) - 1; if (f == _characters[_updateCharNum].curFaceFrame) f++; if (f > 5) @@ -1402,24 +1402,24 @@ void LoLEngine::increaseExperience(int charNum, int skill, uint32 points) { switch (skill) { case 0: _txt->printMessage(0x8003, getLangString(0x4023), _characters[charNum].name); - inc = generateRandomNumber(4, 6); + inc = rollDice(4, 6); _characters[charNum].hitPointsCur += inc; _characters[charNum].hitPointsMax += inc; break; case 1: _txt->printMessage(0x8003, getLangString(0x4025), _characters[charNum].name); - inc = generateRandomNumber(2, 6); + inc = rollDice(2, 6); _characters[charNum].hitPointsCur += inc; _characters[charNum].hitPointsMax += inc; break; case 2: _txt->printMessage(0x8003, getLangString(0x4024), _characters[charNum].name); - inc = (_characters[charNum].defaultModifiers[6] * (generateRandomNumber(1, 8) + 17)) >> 8; + inc = (_characters[charNum].defaultModifiers[6] * (rollDice(1, 8) + 17)) >> 8; _characters[charNum].magicPointsCur += inc; _characters[charNum].magicPointsMax += inc; - inc = generateRandomNumber(1, 6); + inc = rollDice(1, 6); _characters[charNum].hitPointsCur += inc; _characters[charNum].hitPointsMax += inc; break; @@ -1872,25 +1872,20 @@ void LoLEngine::delay(uint32 millis, bool doUpdate, bool) { } } -int LoLEngine::generateRandomNumber(int min, int max) { - // The output produced by this random number generator - // differs a lot from _rnd.getRandomNumberRng(). Using - // _rnd.getRandomNumberRng() instead of this function - // here will break the fighting system! - - if (min <= 0 || max <= 0) +int LoLEngine::rollDice(int times, int pips) { + if (times <= 0 || pips <= 0) return 0; int res = 0; int d = 0; do { - int val = (((int)_rnd.getRandomNumber(0x7fff) * max) / 0x8000) + 1; - if (val > max) - val -= max; + int val = (((int)_rnd.getRandomNumber(0x7fff) * pips) / 0x8000) + 1; + if (val > pips) + val -= pips; res += val; d++; - } while (d < min); + } while (d < times); return res; } @@ -2281,7 +2276,7 @@ int LoLEngine::processMagicIce(int charNum, int spellLevel) { } else { uint16 o = _levelBlockProperties[calcNewBlockPosition(_currentBlock, _currentDirection)].assignedObjects; while (o & 0x8000) { - int might = generateRandomNumber(iceDamageMin[spellLevel], iceDamageMax[spellLevel]) + iceDamageAdd[spellLevel]; + int might = rollDice(iceDamageMin[spellLevel], iceDamageMax[spellLevel]) + iceDamageAdd[spellLevel]; int dmg = calcInflictableDamagePerItem(charNum, 0, might, 3, 2); MonsterInPlay *m = &_monsters[o & 0x7fff]; @@ -3213,7 +3208,7 @@ int LoLEngine::battleHitSkillTest(int16 attacker, int16 target, int skill) { evadeChanceModifier = _characters[target].defaultModifiers[3]; } - int r = generateRandomNumber(1, 100); + int r = rollDice(1, 100); if (r >= sk) return 2; @@ -3251,9 +3246,9 @@ int LoLEngine::inflictDamage(uint16 target, int damage, uint16 attacker, int ski m->hitPoints -= damage; m->damageReceived = 0x8000 | damage; m->flags |= 0x10; - m->hitOffsX = generateRandomNumber(1, 24); + m->hitOffsX = rollDice(1, 24); m->hitOffsX -= 12; - m->hitOffsY = generateRandomNumber(1, 24); + m->hitOffsY = rollDice(1, 24); m->hitOffsY -= 12; m->hitPoints = CLIP(m->hitPoints, 0, m->properties->hitPoints); @@ -3457,7 +3452,7 @@ void LoLEngine::checkForPartyDeath() { } void LoLEngine::applyMonsterAttackSkill(MonsterInPlay *monster, int16 target, int16 damage) { - if (generateRandomNumber(1, 100) > monster->properties->attackSkillChance) + if (rollDice(1, 100) > monster->properties->attackSkillChance) return; int t = 0; @@ -3527,7 +3522,7 @@ void LoLEngine::applyMonsterAttackSkill(MonsterInPlay *monster, int16 target, in } void LoLEngine::applyMonsterDefenseSkill(MonsterInPlay *monster, int16 attacker, int flags, int skill, int damage) { - if (generateRandomNumber(1, 100) > monster->properties->defenseSkillChance) + if (rollDice(1, 100) > monster->properties->defenseSkillChance) return; int itm = 0; @@ -3614,7 +3609,7 @@ int LoLEngine::paralyzePoisonCharacter(int charNum, int typeFlag, int immunityFl if (!(_characters[charNum].flags & 1) || (_characters[charNum].flags & immunityFlags)) return 0; - if ((int)generateRandomNumber(1, 100) > hitChance) + if ((int)rollDice(1, 100) > hitChance) return 0; int r = 0; @@ -3732,7 +3727,7 @@ void LoLEngine::launchMagicViper() { _screen->copyPage(12, 0); _screen->copyPage(12, 2); - int t = generateRandomNumber(1, 4); + int t = rollDice(1, 4); for (int i = 0; i < 4; i++) { if (!(_characters[i].flags & 1)) { diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index 8fafa450b3..f4ac597b5c 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -642,7 +642,7 @@ private: int olol_setWallType(EMCState *script); int olol_getWallType(EMCState *script); int olol_drawScene(EMCState *script); - int olol_getRand(EMCState *script); + int olol_rollDice(EMCState *script); int olol_moveParty(EMCState *script); int olol_delay(EMCState *script); int olol_setGameFlag(EMCState *script); @@ -1314,7 +1314,7 @@ private: // misc void delay(uint32 millis, bool doUpdate = false, bool isMainLoop = false); - int generateRandomNumber(int min, int max); + int rollDice(int times, int pips); uint8 _compassBroken; uint8 _drainMagic; diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index 403b4cc69c..32ee7a4d77 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -552,14 +552,14 @@ void LoLEngine::updateLampStatus() { if (_lampEffect == -1) { if (_screen->_fadeFlag == 0) setPaletteBrightness(_screen->getPalette(0), _brightness, newLampEffect); - _lampStatusTimer = _system->getMillis() + (10 + generateRandomNumber(1, 30)) * _tickLength; + _lampStatusTimer = _system->getMillis() + (10 + rollDice(1, 30)) * _tickLength; } else { if ((_lampEffect & 0xfe) == (newLampEffect & 0xfe)) { if (_system->getMillis() <= _lampStatusTimer) { newLampEffect = _lampEffect; } else { newLampEffect = _lampEffect ^ 1; - _lampStatusTimer = _system->getMillis() + (10 + generateRandomNumber(1, 30)) * _tickLength; + _lampStatusTimer = _system->getMillis() + (10 + rollDice(1, 30)) * _tickLength; } } else { if (_screen->_fadeFlag == 0) diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index 18b8d81ef9..611ad8f9ef 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -135,9 +135,9 @@ int LoLEngine::olol_drawScene(EMCState *script) { return 1; } -int LoLEngine::olol_getRand(EMCState *script) { - debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_getRand(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); - return generateRandomNumber(stackPos(0), stackPos(1)); +int LoLEngine::olol_rollDice(EMCState *script) { + debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_rollDice(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); + return rollDice(stackPos(0), stackPos(1)); } int LoLEngine::olol_moveParty(EMCState *script) { @@ -836,10 +836,10 @@ int LoLEngine::olol_initMonster(EMCState *script) { l->hitPoints = (l->properties->hitPoints * _monsterModifiers[_monsterDifficulty]) >> 8; if (_currentLevel == 12 && l->type == 2) - l->hitPoints = (l->hitPoints * (generateRandomNumber(1, 128) + 192)) >> 8; + l->hitPoints = (l->hitPoints * (rollDice(1, 128) + 192)) >> 8; l->numDistAttacks = l->properties->numDistAttacks; - l->distAttackTick = generateRandomNumber(1, calcMonsterSkillLevel(l->id | 0x8000, 8)) - 1; + l->distAttackTick = rollDice(1, calcMonsterSkillLevel(l->id | 0x8000, 8)) - 1; l->flyingHeight = 2; l->flags = stackPos(5); l->assignedItems = 0; @@ -1382,7 +1382,7 @@ int LoLEngine::olol_characterSkillTest(EMCState *script){ } } - return (generateRandomNumber(1, 100) > m) ? -1 : c; + return (rollDice(1, 100) > m) ? -1 : c; } int LoLEngine::olol_countAllMonsters(EMCState *script){ @@ -1445,7 +1445,7 @@ int LoLEngine::olol_calcInflictableDamage(EMCState *script) { int LoLEngine::olol_getInflictedDamage(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_getInflictedDamage(%p) (%d)", (const void *)script, stackPos(0)); int mx = stackPos(0); - return generateRandomNumber(2, mx); + return rollDice(2, mx); } int LoLEngine::olol_checkForCertainPartyMember(EMCState *script) { @@ -2622,7 +2622,7 @@ void LoLEngine::setupOpcodeTable() { Opcode(olol_setWallType); Opcode(olol_getWallType); Opcode(olol_drawScene); - Opcode(olol_getRand); + Opcode(olol_rollDice); // 0x04 Opcode(olol_moveParty); diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp index b1edecb318..f644feeb65 100644 --- a/engines/kyra/sprites_lol.cpp +++ b/engines/kyra/sprites_lol.cpp @@ -1071,7 +1071,7 @@ void LoLEngine::updateMonster(MonsterInPlay *monster) { monster->speedTick = 0; if (monster->properties->flags & 0x40) { - monster->hitPoints += generateRandomNumber(1, 8); + monster->hitPoints += rollDice(1, 8); if (monster->hitPoints > monster->properties->hitPoints) monster->hitPoints = monster->properties->hitPoints; } @@ -1264,7 +1264,7 @@ bool LoLEngine::chasePartyWithDistanceAttacks(MonsterInPlay *monster) { int s = 0; if (monster->flags & 0x10) { - s = monster->properties->numDistWeapons ? generateRandomNumber(1, monster->properties->numDistWeapons) : 0; + s = monster->properties->numDistWeapons ? rollDice(1, monster->properties->numDistWeapons) : 0; } else { s = monster->curDistWeapon++; if (monster->curDistWeapon >= monster->properties->numDistWeapons) @@ -1344,7 +1344,7 @@ void LoLEngine::chasePartyWithCloseAttacks(MonsterInPlay *monster) { if (hit) { int mx = calcInflictableDamage(m, dst, hit); - int dmg = generateRandomNumber(2, mx ); + int dmg = rollDice(2, mx ); inflictDamage(dst, dmg, m, 0, 0); applyMonsterAttackSkill(monster, dst, dmg); } @@ -1364,7 +1364,7 @@ void LoLEngine::chasePartyWithCloseAttacks(MonsterInPlay *monster) { walkMonster(monster); } else { setMonsterDirection(monster, monster->destDirection); - setMonsterMode(monster, (generateRandomNumber(1, 100) <= 50) ? 4 : 3); + setMonsterMode(monster, (rollDice(1, 100) <= 50) ? 4 : 3); } } diff --git a/engines/kyra/timer_lol.cpp b/engines/kyra/timer_lol.cpp index 0a17c0993c..fb3a7c2565 100644 --- a/engines/kyra/timer_lol.cpp +++ b/engines/kyra/timer_lol.cpp @@ -147,7 +147,7 @@ void LoLEngine::timerSpecialCharacterUpdate(int timerNum) { break; case 3: - v = generateRandomNumber(1, 2); + v = rollDice(1, 2); if (inflictDamage(i, v, 0x8000, 0, 0x80)) { _txt->printMessage(2, getLangString(0x4022), _characters[i].name); _characters[i].characterUpdateDelay[ii] = 10; @@ -241,7 +241,7 @@ void LoLEngine::timerUpdatePortraitAnimations(int skipUpdate) { } else { _characters[i].curFaceFrame = 0; gui_drawCharPortraitWithStats(i); - _characters[i].nextAnimUpdateCountdown = (int16) generateRandomNumber(1, 12) + 6; + _characters[i].nextAnimUpdateCountdown = (int16) rollDice(1, 12) + 6; } } } -- cgit v1.2.3 From c7eedb573ac3ac1bd4c8f8e64d75ee8ee931bc50 Mon Sep 17 00:00:00 2001 From: Florian Kagerer Date: Wed, 8 Jul 2009 21:12:03 +0000 Subject: LOL: cleanup svn-id: r42271 --- engines/kyra/lol.cpp | 4 ++-- engines/kyra/timer_lol.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 33ba2bff7e..f2617dc8b4 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -1080,7 +1080,7 @@ bool LoLEngine::addCharacter(int id) { loadCharFaceShapes(numChars, id); - _characters[numChars].nextAnimUpdateCountdown = (int16) rollDice(1, 12) + 6; + _characters[numChars].nextAnimUpdateCountdown = rollDice(1, 12) + 6; for (i = 0; i < 11; i++) { if (_characters[numChars].items[i]) { @@ -3609,7 +3609,7 @@ int LoLEngine::paralyzePoisonCharacter(int charNum, int typeFlag, int immunityFl if (!(_characters[charNum].flags & 1) || (_characters[charNum].flags & immunityFlags)) return 0; - if ((int)rollDice(1, 100) > hitChance) + if (rollDice(1, 100) > hitChance) return 0; int r = 0; diff --git a/engines/kyra/timer_lol.cpp b/engines/kyra/timer_lol.cpp index fb3a7c2565..0e43487217 100644 --- a/engines/kyra/timer_lol.cpp +++ b/engines/kyra/timer_lol.cpp @@ -241,7 +241,7 @@ void LoLEngine::timerUpdatePortraitAnimations(int skipUpdate) { } else { _characters[i].curFaceFrame = 0; gui_drawCharPortraitWithStats(i); - _characters[i].nextAnimUpdateCountdown = (int16) rollDice(1, 12) + 6; + _characters[i].nextAnimUpdateCountdown = rollDice(1, 12) + 6; } } } -- cgit v1.2.3 From 3823ae285f92c0b39d141b6132a4187b1e83b6be Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Thu, 9 Jul 2009 02:54:10 +0000 Subject: Giving Font its own real class svn-id: r42277 --- engines/gob/dataio.cpp | 5 +- engines/gob/draw.cpp | 60 ++++++++++++++++-------- engines/gob/draw.h | 9 +++- engines/gob/draw_v1.cpp | 37 +++++++++------ engines/gob/draw_v2.cpp | 47 +++++++++---------- engines/gob/driver_vga.cpp | 16 +++---- engines/gob/driver_vga.h | 2 +- engines/gob/gob.cpp | 2 +- engines/gob/hotspots.cpp | 37 +++++++-------- engines/gob/hotspots.h | 3 +- engines/gob/init.cpp | 7 ++- engines/gob/inter_v1.cpp | 5 +- engines/gob/inter_v5.cpp | 30 ++++++------ engines/gob/util.cpp | 32 ------------- engines/gob/util.h | 6 +-- engines/gob/video.cpp | 112 +++++++++++++++++++++++++++++++-------------- engines/gob/video.h | 51 +++++++++++++-------- 17 files changed, 255 insertions(+), 206 deletions(-) diff --git a/engines/gob/dataio.cpp b/engines/gob/dataio.cpp index f59fa80e8d..99cf7c1193 100644 --- a/engines/gob/dataio.cpp +++ b/engines/gob/dataio.cpp @@ -488,6 +488,9 @@ int16 DataIO::openData(const char *path) { } bool DataIO::existData(const char *path) { + if (!path || (path[0] == '\0')) + return false; + int16 handle = openData(path); if (handle < 0) @@ -584,7 +587,7 @@ byte *DataIO::getData(const char *path) { } DataStream *DataIO::getDataStream(const char *path) { - if (!path || (path[0] == '\0') || !existData(path)) + if (!existData(path)) return 0; uint32 size = getDataSize(path); diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp index c20bece7b4..fb3cb9bbcd 100644 --- a/engines/gob/draw.cpp +++ b/engines/gob/draw.cpp @@ -29,6 +29,7 @@ #include "gob/draw.h" #include "gob/global.h" #include "gob/util.h" +#include "gob/dataio.h" #include "gob/game.h" #include "gob/script.h" #include "gob/inter.h" @@ -60,7 +61,7 @@ Draw::Draw(GobEngine *vm) : _vm(vm) { _backDeltaX = 0; _backDeltaY = 0; - for (int i = 0; i < 8; i++) + for (int i = 0; i < kFontCount; i++) _fonts[i] = 0; _spritesArray.resize(SPRITES_COUNT); @@ -128,7 +129,7 @@ Draw::Draw(GobEngine *vm) : _vm(vm) { } Draw::~Draw() { - for (int i = 0; i < 8; i++) + for (int i = 0; i < kFontCount; i++) delete _fonts[i]; } @@ -346,6 +347,8 @@ int Draw::stringLength(const char *str, int16 fontIndex) { if ((fontIndex < 0) || (fontIndex > 7) || !_fonts[fontIndex]) return 0; + Font &font = *_fonts[fontIndex]; + int len = 0; if (_vm->_global->_language == 10) { @@ -355,16 +358,16 @@ int Draw::stringLength(const char *str, int16 fontIndex) { len += japaneseExtraCharLen[4]; i++; } else - len += _fonts[fontIndex]->itemWidth; + len += font.getCharWidth(); } } else { - if (_fonts[fontIndex]->charWidths) - while (*str != 0) - len += *(_fonts[fontIndex]->charWidths + (*str++ - _fonts[fontIndex]->startItem)); + if (!font.isMonospaced()) + while (*str != '\0') + len += font.getCharWidth(*str++); else - len = (strlen(str) * _fonts[fontIndex]->itemWidth); + len = strlen(str) * font.getCharWidth(); } @@ -372,14 +375,11 @@ int Draw::stringLength(const char *str, int16 fontIndex) { } void Draw::drawString(const char *str, int16 x, int16 y, int16 color1, int16 color2, - int16 transp, SurfaceDesc &dest, Video::FontDesc *font) { + int16 transp, SurfaceDesc &dest, const Font &font) { while (*str != '\0') { _vm->_video->drawLetter(*str, x, y, font, transp, color1, color2, dest); - if (!font->charWidths) - x += font->itemWidth; - else - x += *(font->charWidths + (*str - font->startItem)); + x += font.getCharWidth(*str); str++; } } @@ -407,23 +407,23 @@ void Draw::printTextCentered(int16 id, int16 left, int16 top, int16 right, if (str[0] == '\0') return; - int16 width = 0; - _transparency = 1; _destSpriteX = left; _destSpriteY = top; _fontIndex = fontIndex; _frontColor = color; _textToPrint = str; - if (_fonts[fontIndex]->charWidths != 0) { - uint8 *widths = _fonts[fontIndex]->charWidths; - int length = strlen(str); - for (int i = 0; i < length; i++) - width += *(widths + (str[i] - _fonts[_fontIndex]->startItem)); + Font &font = *_fonts[fontIndex]; + + int16 width = 0; + if (!font.isMonospaced()) { + const char *s = str; + while (*s != '\0') + width += font.getCharWidth(*s++); } else - width = strlen(str) * _fonts[fontIndex]->itemWidth; + width = strlen(str) * font.getCharWidth(); adjustCoords(1, &width, 0); _destSpriteX += (right - left + 1 - width) / 2; @@ -546,4 +546,24 @@ void Draw::wobble(SurfaceDesc &surfDesc) { delete[] offsets; } +Font *Draw::loadFont(const char *path) const { + if (!_vm->_dataIO->existData(path)) + return 0; + + byte *data = _vm->_dataIO->getData(path); + + return new Font(data); +} + +bool Draw::loadFont(int fontIndex, const char *path) { + if ((fontIndex < 0) || (fontIndex >= kFontCount)) + return false; + + delete _fonts[fontIndex]; + + _fonts[fontIndex] = loadFont(path); + + return _fonts[fontIndex] != 0; +} + } // End of namespace Gob diff --git a/engines/gob/draw.h b/engines/gob/draw.h index 26f78ce3b3..ba32df0c3e 100644 --- a/engines/gob/draw.h +++ b/engines/gob/draw.h @@ -45,6 +45,8 @@ namespace Gob { class Draw { public: + static const int kFontCount = 8; + struct FontToSprite { int8 sprite; int8 base; @@ -76,7 +78,7 @@ public: int16 _backDeltaY; FontToSprite _fontToSprite[4]; - Video::FontDesc *_fonts[8]; + Font *_fonts[kFontCount]; Common::Array _spritesArray; @@ -152,7 +154,7 @@ public: } int stringLength(const char *str, int16 fontIndex); void drawString(const char *str, int16 x, int16 y, int16 color1, int16 color2, - int16 transp, SurfaceDesc &dest, Video::FontDesc *font); + int16 transp, SurfaceDesc &dest, const Font &font); void printTextCentered(int16 id, int16 left, int16 top, int16 right, int16 bottom, const char *str, int16 fontIndex, int16 color); int32 getSpriteRectSize(int16 index); @@ -161,6 +163,9 @@ public: static const int16 _wobbleTable[360]; void wobble(SurfaceDesc &surfDesc); + Font *loadFont(const char *path) const; + bool loadFont(int fontIndex, const char *path); + virtual void initScreen() = 0; virtual void closeScreen() = 0; virtual void blitCursor() = 0; diff --git a/engines/gob/draw_v1.cpp b/engines/gob/draw_v1.cpp index 91f2a45637..e2cfcb613d 100644 --- a/engines/gob/draw_v1.cpp +++ b/engines/gob/draw_v1.cpp @@ -248,7 +248,7 @@ void Draw_v1::printTotText(int16 id) { _letterToPrint = (char) *ptr; spriteOperation(DRAW_DRAWLETTER); _destSpriteX += - _fonts[_fontIndex]->itemWidth; + _fonts[_fontIndex]->getCharWidth(); ptr++; } else { cmd = ptrEnd[17] & 0x7F; @@ -281,7 +281,7 @@ void Draw_v1::printTotText(int16 id) { spriteOperation(DRAW_PRINTTEXT); if (ptrEnd[17] & 0x80) { if (ptr[1] == ' ') { - _destSpriteX += _fonts[_fontIndex]->itemWidth; + _destSpriteX += _fonts[_fontIndex]->getCharWidth(); while (ptr[1] == ' ') ptr++; if (ptr[1] == 2) { @@ -290,10 +290,10 @@ void Draw_v1::printTotText(int16 id) { } } else if (ptr[1] == 2 && READ_LE_UINT16(ptr + 4) == _destSpriteY) { ptr += 5; - _destSpriteX += _fonts[_fontIndex]->itemWidth; + _destSpriteX += _fonts[_fontIndex]->getCharWidth(); } } else { - _destSpriteX = destSpriteX + _fonts[_fontIndex]->itemWidth; + _destSpriteX = destSpriteX + _fonts[_fontIndex]->getCharWidth(); } ptrEnd += 23; ptr++; @@ -341,6 +341,7 @@ void Draw_v1::spriteOperation(int16 operation) { } } + Font *font = 0; switch (operation) { case DRAW_BLITSURF: _vm->_video->drawSprite(*_spritesArray[_sourceSurface], @@ -402,20 +403,25 @@ void Draw_v1::spriteOperation(int16 operation) { break; case DRAW_PRINTTEXT: + font = _fonts[_fontIndex]; + if (!font) { + warning("Trying to print \"%s\" with undefined font %d", _textToPrint, _fontIndex); + break; + } + len = strlen(_textToPrint); dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, - _destSpriteX + len * _fonts[_fontIndex]->itemWidth - 1, - _destSpriteY + _fonts[_fontIndex]->itemHeight - 1); + _destSpriteX + len * font->getCharWidth() - 1, + _destSpriteY + font->getCharHeight() - 1); for (int i = 0; i < len; i++) { _vm->_video->drawLetter(_textToPrint[i], _destSpriteX, _destSpriteY, - _fonts[_fontIndex], - _transparency, + *font, _transparency, _frontColor, _backColor, *_spritesArray[_destSurface]); - _destSpriteX += _fonts[_fontIndex]->itemWidth; + _destSpriteX += font->getCharWidth(); } break; @@ -458,14 +464,19 @@ void Draw_v1::spriteOperation(int16 operation) { break; case DRAW_DRAWLETTER: + font = _fonts[_fontIndex]; + if (!font) { + warning("Trying to print \'%c\' with undefined font %d", _letterToPrint, _fontIndex); + break; + } + if (_fontToSprite[_fontIndex].sprite == -1) { dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, - _destSpriteX + _fonts[_fontIndex]->itemWidth - 1, - _destSpriteY + _fonts[_fontIndex]->itemHeight - 1); + _destSpriteX + font->getCharWidth() - 1, + _destSpriteY + font->getCharHeight() - 1); _vm->_video->drawLetter(_letterToPrint, _destSpriteX, _destSpriteY, - _fonts[_fontIndex], - _transparency, + *font, _transparency, _frontColor, _backColor, *_spritesArray[_destSurface]); break; diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp index a0be23516c..8fe70589a7 100644 --- a/engines/gob/draw_v2.cpp +++ b/engines/gob/draw_v2.cpp @@ -371,14 +371,14 @@ void Draw_v2::printTotText(int16 id) { if ((((*ptr >= 1) && (*ptr <= 7)) || (*ptr == 10)) && (strPos != 0)) { str[MAX(strPos, strPos2)] = 0; strPosBak = strPos; - width = strlen(str) * _fonts[fontIndex]->itemWidth; + width = strlen(str) * _fonts[fontIndex]->getCharWidth(); adjustCoords(1, &width, 0); if (colCmd & 0x0F) { rectLeft = offX - 2; rectTop = offY - 2; rectRight = offX + width + 1; - rectBottom = _fonts[fontIndex]->itemHeight; + rectBottom = _fonts[fontIndex]->getCharHeight(); adjustCoords(1, &rectBottom, 0); rectBottom += offY + 1; adjustCoords(0, &rectLeft, &rectTop); @@ -404,9 +404,9 @@ void Draw_v2::printTotText(int16 id) { if (_needAdjust != 2) { if ((_destSpriteX >= destX) && (_destSpriteY >= destY) && - (((_fonts[_fontIndex]->itemHeight / 2) + _destSpriteY - 1) <= spriteBottom)) { + (((_fonts[_fontIndex]->getCharHeight() / 2) + _destSpriteY - 1) <= spriteBottom)) { while (((_destSpriteX + width - 1) > spriteRight) && (width > 0)) { - width -= _fonts[_fontIndex]->itemWidth / 2; + width -= _fonts[_fontIndex]->getCharWidth() / 2; str[strlen(str) - 1] = '\0'; } spriteOperation(DRAW_PRINTTEXT); @@ -419,8 +419,8 @@ void Draw_v2::printTotText(int16 id) { if (mask[strPos] == '\0') continue; - rectLeft = _fonts[fontIndex]->itemWidth; - rectTop = _fonts[fontIndex]->itemHeight; + rectLeft = _fonts[fontIndex]->getCharWidth(); + rectTop = _fonts[fontIndex]->getCharHeight(); adjustCoords(1, &rectLeft, &rectTop); _destSpriteX = strPos * rectLeft + offX; _spriteRight = _destSpriteX + rectLeft - 1; @@ -430,7 +430,7 @@ void Draw_v2::printTotText(int16 id) { } } - rectLeft = _fonts[_fontIndex]->itemWidth; + rectLeft = _fonts[_fontIndex]->getCharWidth(); adjustCoords(1, &rectLeft, 0); offX += strPosBak * rectLeft; strPos = 0; @@ -598,8 +598,6 @@ void Draw_v2::spriteOperation(int16 operation) { int16 left; int16 ratio; Resource *resource; - // Always assigned to -1 in Game::loadTotFile() - int16 someHandle = -1; deltaVeto = (operation & 0x10) != 0; operation &= 0x0F; @@ -761,8 +759,13 @@ void Draw_v2::spriteOperation(int16 operation) { left = _destSpriteX; if ((_fontIndex >= 4) || (_fontToSprite[_fontIndex].sprite == -1)) { + Font *font = _fonts[_fontIndex]; + if (!font) { + warning("Trying to print \"%s\" with undefined font %d", _textToPrint, _fontIndex); + break; + } - if (!_fonts[_fontIndex]->charWidths) { + if (font->isMonospaced()) { if (((int8) _textToPrint[0]) == -1) { _vm->validateLanguage(); @@ -770,26 +773,20 @@ void Draw_v2::spriteOperation(int16 operation) { len = *dataBuf++; for (int i = 0; i < len; i++, dataBuf += 2) { _vm->_video->drawLetter(READ_LE_UINT16(dataBuf), _destSpriteX, - _destSpriteY, _fonts[_fontIndex], _transparency, _frontColor, + _destSpriteY, *font, _transparency, _frontColor, _backColor, *_spritesArray[_destSurface]); } } else { drawString(_textToPrint, _destSpriteX, _destSpriteY, _frontColor, - _backColor, _transparency, *_spritesArray[_destSurface], - _fonts[_fontIndex]); - _destSpriteX += len * _fonts[_fontIndex]->itemWidth; + _backColor, _transparency, *_spritesArray[_destSurface], *font); + _destSpriteX += len * font->getCharWidth(); } } else { for (int i = 0; i < len; i++) { - if ((someHandle < 0) || (_textToPrint[i] != ' ')) { - _vm->_video->drawLetter(_textToPrint[i], _destSpriteX, - _destSpriteY, _fonts[_fontIndex], _transparency, - _frontColor, _backColor, *_spritesArray[_destSurface]); - _destSpriteX += *(_fonts[_fontIndex]->charWidths + - (_textToPrint[i] - _fonts[_fontIndex]->startItem)); - } - else - _destSpriteX += _fonts[_fontIndex]->itemWidth; + _vm->_video->drawLetter(_textToPrint[i], _destSpriteX, + _destSpriteY, *font, _transparency, + _frontColor, _backColor, *_spritesArray[_destSurface]); + _destSpriteX += font->getCharWidth(_textToPrint[i]); } } @@ -813,7 +810,7 @@ void Draw_v2::spriteOperation(int16 operation) { } dirtiedRect(_destSurface, left, _destSpriteY, - _destSpriteX - 1, _destSpriteY + _fonts[_fontIndex]->itemHeight - 1); + _destSpriteX - 1, _destSpriteY + _fonts[_fontIndex]->getCharHeight() - 1); break; case DRAW_DRAWBAR: @@ -884,7 +881,7 @@ void Draw_v2::spriteOperation(int16 operation) { _sourceSurface = sourceSurface; if (operation == DRAW_PRINTTEXT) { - len = _fonts[_fontIndex]->itemWidth; + len = _fonts[_fontIndex]->getCharWidth(); adjustCoords(1, &len, 0); _destSpriteX += len * strlen(_textToPrint); } diff --git a/engines/gob/driver_vga.cpp b/engines/gob/driver_vga.cpp index aff971164f..c93962c206 100644 --- a/engines/gob/driver_vga.cpp +++ b/engines/gob/driver_vga.cpp @@ -70,24 +70,22 @@ void VGAVideoDriver::fillRect(SurfaceDesc &dest, int16 left, int16 top, } void VGAVideoDriver::drawLetter(unsigned char item, int16 x, int16 y, - Video::FontDesc *fontDesc, byte color1, byte color2, + const Font &font, byte color1, byte color2, byte transp, SurfaceDesc &dest) { - byte *src, *dst; uint16 data; - src = fontDesc->dataPtr + - (item - fontDesc->startItem) * (fontDesc->itemSize & 0xFF); - dst = dest.getVidMem() + x + dest.getWidth() * y; + const byte *src = font.getCharData(item); + byte *dst = dest.getVidMem() + x + dest.getWidth() * y; - int nWidth = fontDesc->itemWidth; + int nWidth = font.getCharWidth(); if (nWidth & 7) nWidth = (nWidth & 0xF8) + 8; nWidth >>= 3; - for (int i = 0; i < fontDesc->itemHeight; i++) { - int width = fontDesc->itemWidth; + for (int i = 0; i < font.getCharHeight(); i++) { + int width = font.getCharWidth(); for (int k = 0; k < nWidth; k++) { @@ -106,7 +104,7 @@ void VGAVideoDriver::drawLetter(unsigned char item, int16 x, int16 y, } - dst += dest.getWidth() - fontDesc->itemWidth; + dst += dest.getWidth() - font.getCharWidth(); } } diff --git a/engines/gob/driver_vga.h b/engines/gob/driver_vga.h index c50ea5c475..3102016cb5 100644 --- a/engines/gob/driver_vga.h +++ b/engines/gob/driver_vga.h @@ -41,7 +41,7 @@ public: void fillRect(SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, byte color); void drawLetter(unsigned char item, int16 x, int16 y, - Video::FontDesc *fontDesc, byte color1, byte color2, + const Font &font, byte color1, byte color2, byte transp, SurfaceDesc &dest); void drawSprite(SurfaceDesc &source, SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp); diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 94255b1277..fa4f04eab8 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -456,7 +456,7 @@ bool GobEngine::initGameParts() { _init = new Init_v2(this); _video = new Video_v2(this); // _inter = new Inter_Playtoons(this); - _inter = new Inter_v4(this); + _inter = new Inter_v6(this); _mult = new Mult_v2(this); _draw = new Draw_v2(this); _map = new Map_v2(this); diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index fb8e29f528..b218634d4e 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -805,7 +805,7 @@ uint16 Hotspots::updateInput(uint16 xPos, uint16 yPos, uint16 width, uint16 heig uint16 backColor, uint16 frontColor, char *str, uint16 fontIndex, Type type, int16 &duration, uint16 &id, uint16 &index) { - if ((fontIndex >= 8) || !_vm->_draw->_fonts[fontIndex]) { + if ((fontIndex >= Draw::kFontCount) || !_vm->_draw->_fonts[fontIndex]) { warning("Hotspots::updateInput(): Invalid font specified: %d", fontIndex); return 0; } @@ -816,16 +816,13 @@ uint16 Hotspots::updateInput(uint16 xPos, uint16 yPos, uint16 width, uint16 heig ((_vm->_global->_useMouse != 0) || (_vm->_game->_forceHandleMouse != 0))) handleMouse = true; - const Video::FontDesc &font = *_vm->_draw->_fonts[fontIndex]; - - // The font doesn't specify individual character widths => monospaced - bool monoSpaced = (font.charWidths == 0); + const Font &font = *_vm->_draw->_fonts[fontIndex]; // Current position in the string, preset to the end uint32 pos = strlen(str); /* Size of input field in characters. * If the font is not monospaced, we can't know that */ - uint32 editSize = monoSpaced ? (width / font.itemWidth) : 0; + uint32 editSize = font.isMonospaced() ? (width / font.getCharWidth()) : 0; uint16 key = 0; char tempStr[256]; @@ -839,11 +836,11 @@ uint16 Hotspots::updateInput(uint16 xPos, uint16 yPos, uint16 width, uint16 heig // Clear input area fillRect(xPos, yPos, - monoSpaced ? (editSize * font.itemWidth) : width, height, + font.isMonospaced() ? (editSize * font.getCharWidth()) : width, height, backColor); // Print the current string, vertically centered - printText(xPos, yPos + (height - font.itemHeight) / 2, + printText(xPos, yPos + (height - font.getCharHeight()) / 2, tempStr, fontIndex, frontColor); // If we've reached the end of the input field, set the cursor to the last character @@ -889,7 +886,7 @@ uint16 Hotspots::updateInput(uint16 xPos, uint16 yPos, uint16 width, uint16 heig fillRect(cursorX, cursorY, cursorWidth, cursorHeight, backColor); // Print the current string, vertically centered - printText(cursorX, yPos + (height - font.itemHeight) / 2, + printText(cursorX, yPos + (height - font.getCharHeight()) / 2, tempStr, fontIndex, frontColor); if ((key != 0) || (id != 0)) @@ -1027,8 +1024,7 @@ uint16 Hotspots::updateInput(uint16 xPos, uint16 yPos, uint16 width, uint16 heig if (editSize == 0) { // Length of the string + current character + next one int length = _vm->_draw->stringLength(str, fontIndex) + - font.charWidths[' ' - font.startItem] + - font.charWidths[key - font.startItem]; + font.getCharWidth(' ') + font.getCharWidth(key); if (length > width) // We're above the limit, ignore the key @@ -1220,7 +1216,7 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, int16 key = 0; int16 flags = 0; - Video::FontDesc *font = 0; + Font *font = 0; uint32 funcEnter = 0, funcLeave = 0; // Evaluate parameters for the new hotspot @@ -1292,9 +1288,8 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, } font = _vm->_draw->_fonts[inputs[inputCount].fontIndex]; - if (!font->charWidths) - // Monospaced font - right = left + width * font->itemWidth - 1; + if (font->isMonospaced()) + right = left + width * font->getCharWidth() - 1; funcEnter = 0; funcPos = 0; @@ -1890,11 +1885,11 @@ uint16 Hotspots::convertSpecialKey(uint16 key) const { return key; } -void Hotspots::getTextCursorPos(const Video::FontDesc &font, const char *str, +void Hotspots::getTextCursorPos(const Font &font, const char *str, uint32 pos, uint16 x, uint16 y, uint16 width, uint16 height, uint16 &cursorX, uint16 &cursorY, uint16 &cursorWidth, uint16 &cursorHeight) const { - if (font.charWidths) { + if (!font.isMonospaced()) { // Cursor to the right of the current character cursorX = x; @@ -1904,14 +1899,14 @@ void Hotspots::getTextCursorPos(const Video::FontDesc &font, const char *str, // Iterate through the string and add each character's width for (uint32 i = 0; i < pos; i++) - cursorX += font.charWidths[str[i] - font.startItem]; + cursorX += font.getCharWidth(str[i]); } else { // Cursor underlining the current character - cursorX = x + font.itemWidth * pos; + cursorX = x + font.getCharWidth() * pos; cursorY = y + height - 1; - cursorWidth = font.itemWidth; + cursorWidth = font.getCharWidth(); cursorHeight = 1; } } @@ -1969,7 +1964,7 @@ void Hotspots::updateAllTexts(const InputDesc *inputs) const { fillRect(x, y, width, height, inputs[input].backColor); // Center the text vertically - y += (height - _vm->_draw->_fonts[_vm->_draw->_fontIndex]->itemHeight) / 2; + y += (height - _vm->_draw->_fonts[_vm->_draw->_fontIndex]->getCharHeight()) / 2; // Draw it printText(x, y, tempStr, inputs[input].fontIndex, inputs[input].frontColor); diff --git a/engines/gob/hotspots.h b/engines/gob/hotspots.h index c269cbb290..a389987c27 100644 --- a/engines/gob/hotspots.h +++ b/engines/gob/hotspots.h @@ -32,6 +32,7 @@ namespace Gob { +class Font; class Script; class Hotspots { @@ -253,7 +254,7 @@ private: uint16 convertSpecialKey(uint16 key) const; /** Calculate the graphical cursor position. */ - void getTextCursorPos(const Video::FontDesc &font, const char *str, + void getTextCursorPos(const Font &font, const char *str, uint32 pos, uint16 x, uint16 y, uint16 width, uint16 height, uint16 &cursorX, uint16 &cursorY, uint16 &cursorWidth, uint16 &cursorHeight) const; diff --git a/engines/gob/init.cpp b/engines/gob/init.cpp index f9a22f52fb..faf85a5b41 100644 --- a/engines/gob/init.cpp +++ b/engines/gob/init.cpp @@ -123,8 +123,7 @@ void Init::initGame() { if (!_vm->_dataIO->existData("intro.inf")) { for (int i = 0; i < 4; i++) - if (_vm->_dataIO->existData(_fontNames[i])) - _vm->_draw->_fonts[i] = _vm->_util->loadFont(_fontNames[i]); + _vm->_draw->loadFont(i, _fontNames[i]); } else { infBuf = _vm->_dataIO->getData("intro.inf"); @@ -140,8 +139,8 @@ void Init::initGame() { buffer[j] = 0; strcat(buffer, ".let"); - if (_vm->_dataIO->existData(buffer)) - _vm->_draw->_fonts[i] = _vm->_util->loadFont(buffer); + + _vm->_draw->loadFont(i, buffer); if ((infPtr + 1) >= infEnd) break; diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp index 7c5094d175..69c392b198 100644 --- a/engines/gob/inter_v1.cpp +++ b/engines/gob/inter_v1.cpp @@ -1712,12 +1712,9 @@ bool Inter_v1::o1_loadFont(OpFuncParams ¶ms) { _vm->_game->_script->evalExpr(0); index = _vm->_game->_script->readInt16(); - delete _vm->_draw->_fonts[index]; - _vm->_draw->animateCursor(4); - _vm->_draw->_fonts[index] = - _vm->_util->loadFont(_vm->_game->_script->getResultStr()); + _vm->_draw->loadFont(index, _vm->_game->_script->getResultStr()); return false; } diff --git a/engines/gob/inter_v5.cpp b/engines/gob/inter_v5.cpp index 1c20851c8d..986bad7cd3 100644 --- a/engines/gob/inter_v5.cpp +++ b/engines/gob/inter_v5.cpp @@ -266,9 +266,9 @@ void Inter_v5::o5_spaceShooter(OpGobParams ¶ms) { void Inter_v5::o5_getSystemCDSpeed(OpGobParams ¶ms) { WRITE_VAR_UINT32(_vm->_game->_script->readInt16(), 100); // Fudging 100% - Video::FontDesc *font; - if ((font = _vm->_util->loadFont("SPEED.LET"))) { - _vm->_draw->drawString("100 %", 402, 89, 112, 144, 0, *_vm->_draw->_backSurface, font); + Font *font; + if ((font = _vm->_draw->loadFont("SPEED.LET"))) { + _vm->_draw->drawString("100 %", 402, 89, 112, 144, 0, *_vm->_draw->_backSurface, *font); _vm->_draw->forceBlit(); delete font; @@ -278,9 +278,9 @@ void Inter_v5::o5_getSystemCDSpeed(OpGobParams ¶ms) { void Inter_v5::o5_getSystemRAM(OpGobParams ¶ms) { WRITE_VAR_UINT32(_vm->_game->_script->readInt16(), 100); // Fudging 100% - Video::FontDesc *font; - if ((font = _vm->_util->loadFont("SPEED.LET"))) { - _vm->_draw->drawString("100 %", 402, 168, 112, 144, 0, *_vm->_draw->_backSurface, font); + Font *font; + if ((font = _vm->_draw->loadFont("SPEED.LET"))) { + _vm->_draw->drawString("100 %", 402, 168, 112, 144, 0, *_vm->_draw->_backSurface, *font); _vm->_draw->forceBlit(); delete font; @@ -290,9 +290,9 @@ void Inter_v5::o5_getSystemRAM(OpGobParams ¶ms) { void Inter_v5::o5_getSystemCPUSpeed(OpGobParams ¶ms) { WRITE_VAR_UINT32(_vm->_game->_script->readInt16(), 100); // Fudging 100% - Video::FontDesc *font; - if ((font = _vm->_util->loadFont("SPEED.LET"))) { - _vm->_draw->drawString("100 %", 402, 248, 112, 144, 0, *_vm->_draw->_backSurface, font); + Font *font; + if ((font = _vm->_draw->loadFont("SPEED.LET"))) { + _vm->_draw->drawString("100 %", 402, 248, 112, 144, 0, *_vm->_draw->_backSurface, *font); _vm->_draw->forceBlit(); delete font; @@ -302,9 +302,9 @@ void Inter_v5::o5_getSystemCPUSpeed(OpGobParams ¶ms) { void Inter_v5::o5_getSystemDrawSpeed(OpGobParams ¶ms) { WRITE_VAR_UINT32(_vm->_game->_script->readInt16(), 100); // Fudging 100% - Video::FontDesc *font; - if ((font = _vm->_util->loadFont("SPEED.LET"))) { - _vm->_draw->drawString("100 %", 402, 326, 112, 144, 0, *_vm->_draw->_backSurface, font); + Font *font; + if ((font = _vm->_draw->loadFont("SPEED.LET"))) { + _vm->_draw->drawString("100 %", 402, 326, 112, 144, 0, *_vm->_draw->_backSurface, *font); _vm->_draw->forceBlit(); delete font; @@ -314,9 +314,9 @@ void Inter_v5::o5_getSystemDrawSpeed(OpGobParams ¶ms) { void Inter_v5::o5_totalSystemSpecs(OpGobParams ¶ms) { WRITE_VAR_UINT32(_vm->_game->_script->readInt16(), 100); // Fudging 100% - Video::FontDesc *font; - if ((font = _vm->_util->loadFont("SPEED.LET"))) { - _vm->_draw->drawString("100 %", 402, 405, 112, 144, 0, *_vm->_draw->_backSurface, font); + Font *font; + if ((font = _vm->_draw->loadFont("SPEED.LET"))) { + _vm->_draw->drawString("100 %", 402, 405, 112, 144, 0, *_vm->_draw->_backSurface, *font); _vm->_draw->forceBlit(); delete font; diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index 429b0269cf..356eb3c643 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -379,38 +379,6 @@ void Util::setScrollOffset(int16 x, int16 y) { _vm->_video->waitRetrace(); } -Video::FontDesc *Util::loadFont(const char *path) { - Video::FontDesc *fontDesc = new Video::FontDesc; - byte *data; - - if (!fontDesc) - return 0; - - data = _vm->_dataIO->getData(path); - if (!data) { - delete fontDesc; - return 0; - } - - fontDesc->dataPtr = data + 4; - fontDesc->itemWidth = data[0] & 0x7F; - fontDesc->itemHeight = data[1]; - fontDesc->startItem = data[2]; - fontDesc->endItem = data[3]; - - fontDesc->itemSize = - ((fontDesc->itemWidth - 1) / 8 + 1) * fontDesc->itemHeight; - fontDesc->bitWidth = fontDesc->itemWidth; - - if (data[0] & 0x80) - fontDesc->charWidths = data + 4 + fontDesc->itemSize * - (fontDesc->endItem - fontDesc->startItem + 1); - else - fontDesc->charWidths = 0; - - return fontDesc; -} - void Util::insertStr(const char *str1, char *str2, int16 pos) { int len1 = strlen(str1); int len2 = strlen(str2); diff --git a/engines/gob/util.h b/engines/gob/util.h index 088a78a64d..82e2df94de 100644 --- a/engines/gob/util.h +++ b/engines/gob/util.h @@ -28,10 +28,10 @@ #include "common/keyboard.h" -#include "gob/video.h" - namespace Gob { +class GobEngine; + #define KEYBUFSIZE 16 enum MouseButtons { @@ -121,8 +121,6 @@ public: void waitEndFrame(); void setScrollOffset(int16 x = -1, int16 y = -1); - Video::FontDesc *loadFont(const char *path); - static void insertStr(const char *str1, char *str2, int16 pos); static void cutFromStr(char *str, int16 from, int16 cutlen); static void cleanupStr(char *str); diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp index 3b4822cc77..f05ee8565f 100644 --- a/engines/gob/video.cpp +++ b/engines/gob/video.cpp @@ -40,6 +40,82 @@ namespace Gob { +Font::Font(const byte *data) : _dataPtr(data) { + assert(data); + + bool hasWidths = _dataPtr[0] & 0x80; + + _data = _dataPtr + 4; + _itemWidth = _dataPtr[0] & 0x7F; + _itemHeight = _dataPtr[1]; + _startItem = _dataPtr[2]; + _endItem = _dataPtr[3]; + _charWidths = 0; + + uint8 rowAlignedBits = (_itemWidth - 1) / 8 + 1; + + _itemSize = rowAlignedBits * _itemHeight; + _bitWidth = _itemWidth; + + if (hasWidths) + _charWidths = _dataPtr + 4 + _itemSize * getCharCount(); +} + +Font::~Font() { + delete _dataPtr; +} + +uint8 Font::getCharWidth(uint8 c) const { + if (!_charWidths || (_endItem == 0)) + return _itemWidth; + + if ((c < _startItem) || (c > _endItem)) + return _itemWidth; + + return _charWidths[c - _startItem]; +} + +uint8 Font::getCharWidth() const { + return _itemWidth; +} + +uint8 Font::getCharHeight() const { + return _itemHeight; +} + +uint16 Font::getCharCount() const { + return _endItem - _startItem + 1; +} + +uint8 Font::getFirstChar() const { + return _startItem; +} + +uint8 Font::getLastChar() const { + return _endItem; +} + +uint8 Font::getCharSize() const { + return _itemSize; +} + +bool Font::isMonospaced() const { + return _charWidths == 0; +} + +const byte *Font::getCharData(uint8 c) const { + if (_endItem == 0) { + warning("Font::getCharData(): _endItem == 0"); + return 0; + } + + if ((c < _startItem) || (c > _endItem)) + return 0; + + return _data + (c - _startItem) * _itemSize; +} + + SurfaceDesc::SurfaceDesc(int16 vidMode, int16 width, int16 height, byte *vidMem) : _width(width), _height(height) { @@ -381,41 +457,9 @@ void Video::drawSpriteDouble(SurfaceDesc &source, SurfaceDesc &dest, _videoDriver->drawSpriteDouble(source, dest, left, top, right, bottom, x, y, transp); } -void Video::drawLetter(int16 item, int16 x, int16 y, FontDesc *fontDesc, +void Video::drawLetter(int16 item, int16 x, int16 y, const Font &font, int16 color1, int16 color2, int16 transp, SurfaceDesc &dest) { - byte *dataPtr; - byte *itemData; - int16 itemSize; - int16 newItem; - int16 curItem; - int16 newItemPos; - int16 curItemPos; - - if (fontDesc->endItem == 0) { - itemSize = fontDesc->itemSize + 3; - dataPtr = fontDesc->dataPtr; - // startItem - curItem = READ_LE_UINT16(dataPtr - 2) - 1; - - curItemPos = 0; - do { - newItemPos = ((curItemPos + curItem) / 2) * itemSize; - itemData = fontDesc->dataPtr + newItemPos; - newItem = (READ_LE_UINT16(itemData) & 0x7FFF); - if (item > newItem) - curItem = newItemPos - 1; - else - curItemPos = newItemPos + 1; - } while ((newItem != item) && (curItemPos <= curItem)); - - if (newItem != item) - return; - - fontDesc->dataPtr = itemData + 3; - item = 0; - } - - _videoDriver->drawLetter((unsigned char)item, x, y, fontDesc, color1, color2, transp, dest); + _videoDriver->drawLetter((unsigned char)item, x, y, font, color1, color2, transp, dest); } void Video::drawPackedSprite(byte *sprBuf, int16 width, int16 height, diff --git a/engines/gob/video.h b/engines/gob/video.h index 8716a637c2..b8a46598b7 100644 --- a/engines/gob/video.h +++ b/engines/gob/video.h @@ -38,6 +38,36 @@ namespace Graphics { namespace Gob { +class Font { +public: + uint8 getCharWidth (uint8 c) const; + uint8 getCharWidth () const; + uint8 getCharHeight() const; + uint16 getCharCount () const; + uint8 getFirstChar () const; + uint8 getLastChar () const; + uint8 getCharSize () const; + + bool isMonospaced() const; + + const byte *getCharData(uint8 c) const; + + Font(const byte *data); + ~Font(); + +private: + const byte *_dataPtr; + const byte *_data; + const uint8 *_charWidths; + + int8 _itemWidth; + int8 _itemHeight; + uint8 _startItem; + uint8 _endItem; + int8 _itemSize; + int8 _bitWidth; +}; + // Some Surfaces are simultaneous in Draw::spritesArray and discrete // variables, so if in doubt you should use a SurfaceDescPtr shared // pointer object to refer to any SurfaceDesc. @@ -70,23 +100,6 @@ typedef Common::SharedPtr SurfaceDescPtr; class Video { public: - struct FontDesc { - byte *dataPtr; - int8 itemWidth; - int8 itemHeight; - uint8 startItem; - uint8 endItem; - int8 itemSize; - int8 bitWidth; - uint8 *charWidths; - FontDesc() : dataPtr(0), itemWidth(0), itemHeight(0), startItem(0), - endItem(0), itemSize(0), bitWidth(0) {} - ~FontDesc() { - if (dataPtr) - delete[] (dataPtr - 4); - } - }; - #define GDR_VERSION 4 #define PRIMARY_SURFACE 0x80 @@ -154,7 +167,7 @@ public: int16 x, int16 y, int16 transp); void drawSpriteDouble(SurfaceDesc &source, SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp); - void drawLetter(int16 item, int16 x, int16 y, FontDesc *fontDesc, + void drawLetter(int16 item, int16 x, int16 y, const Font &font, int16 color1, int16 color2, int16 transp, SurfaceDesc &dest); void drawPackedSprite(byte *sprBuf, int16 width, int16 height, int16 x, int16 y, int16 transp, SurfaceDesc &dest); @@ -266,7 +279,7 @@ public: virtual void drawSpriteDouble(SurfaceDesc &source, SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp) = 0; virtual void fillRect(SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, byte color) = 0; virtual void putPixel(int16 x, int16 y, byte color, SurfaceDesc &dest) = 0; - virtual void drawLetter(unsigned char item, int16 x, int16 y, Video::FontDesc *fontDesc, byte color1, byte color2, byte transp, SurfaceDesc &dest) = 0; + virtual void drawLetter(unsigned char item, int16 x, int16 y, const Font &font, byte color1, byte color2, byte transp, SurfaceDesc &dest) = 0; virtual void drawLine(SurfaceDesc &dest, int16 x0, int16 y0, int16 x1, int16 y1, byte color) = 0; virtual void drawPackedSprite(byte *sprBuf, int16 width, int16 height, int16 x, int16 y, byte transp, SurfaceDesc &dest) = 0; }; -- cgit v1.2.3 From 22a48e6c39cdeca154f42027a17efea3794edd82 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 9 Jul 2009 03:07:30 +0000 Subject: Changed the status of the cruise engine to be enabled by default svn-id: r42278 --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index b2a94bf9dd..f8f01bee1c 100755 --- a/configure +++ b/configure @@ -73,7 +73,7 @@ add_engine agi "AGI" yes add_engine agos "AGOS" yes "pn" add_engine pn "Personal Nightmare" no add_engine cine "Cinematique evo 1" yes -add_engine cruise "Cinematique evo 2" no +add_engine cruise "Cinematique evo 2" yes add_engine drascula "Drascula: The Vampire Strikes Back" yes add_engine gob "Gobli*ns" yes add_engine groovie "Groovie" yes -- cgit v1.2.3 From 8a7a81ed30697fea81a22c544543295f65f43835 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Thu, 9 Jul 2009 09:39:51 +0000 Subject: Warn instead of crash when a video frame part was found although the header says there's no video svn-id: r42286 --- graphics/video/coktelvideo/coktelvideo.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/graphics/video/coktelvideo/coktelvideo.cpp b/graphics/video/coktelvideo/coktelvideo.cpp index 8603e125a6..995247acaa 100644 --- a/graphics/video/coktelvideo/coktelvideo.cpp +++ b/graphics/video/coktelvideo/coktelvideo.cpp @@ -1324,7 +1324,9 @@ CoktelVideo::State Vmd::processFrame(uint16 frame) { _stream->skip(part.size); } - } else if (part.type == kPartTypeVideo) { + } else if ((part.type == kPartTypeVideo) && !_hasVideo) { + warning("Header claims there's no video, but video frame part found"); + } else if ((part.type == kPartTypeVideo) && _hasVideo) { state.flags &= ~kStateNoVideoData; uint32 size = part.size; -- cgit v1.2.3 From 8a783bdd7602f8fa2718fb5967505b00812ed70d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 9 Jul 2009 13:17:46 +0000 Subject: Renamed sound/iff.* to sound/iff_sound.* to fix an issue with the upcoming changes to the MSVC project files (sound/iff.* produces iff.obj, which clashes with iff.obj from graphics/iff.*) svn-id: r42287 --- engines/parallaction/sound.h | 2 +- sound/iff.cpp | 106 ------------------------------------------- sound/iff.h | 60 ------------------------ sound/iff_sound.cpp | 106 +++++++++++++++++++++++++++++++++++++++++++ sound/iff_sound.h | 60 ++++++++++++++++++++++++ sound/module.mk | 2 +- 6 files changed, 168 insertions(+), 168 deletions(-) delete mode 100644 sound/iff.cpp delete mode 100644 sound/iff.h create mode 100644 sound/iff_sound.cpp create mode 100644 sound/iff_sound.h diff --git a/engines/parallaction/sound.h b/engines/parallaction/sound.h index 8fcfb94a9a..5a2c5e1c38 100644 --- a/engines/parallaction/sound.h +++ b/engines/parallaction/sound.h @@ -30,7 +30,7 @@ #include "common/mutex.h" #include "sound/audiostream.h" -#include "sound/iff.h" +#include "sound/iff_sound.h" #include "sound/mixer.h" #include "sound/mididrv.h" diff --git a/sound/iff.cpp b/sound/iff.cpp deleted file mode 100644 index 1df58b178c..0000000000 --- a/sound/iff.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#include "sound/iff.h" -#include "sound/audiostream.h" -#include "sound/mixer.h" -#include "common/func.h" - -namespace Audio { - -void Voice8Header::load(Common::ReadStream &stream) { - stream.read(this, sizeof(Voice8Header)); - oneShotHiSamples = FROM_BE_32(oneShotHiSamples); - repeatHiSamples = FROM_BE_32(repeatHiSamples); - samplesPerHiCycle = FROM_BE_32(samplesPerHiCycle); - samplesPerSec = FROM_BE_16(samplesPerSec); - volume = FROM_BE_32(volume); -} - - - -struct A8SVXLoader { - Voice8Header _header; - int8 *_data; - uint32 _dataSize; - - void load(Common::ReadStream &input) { - Common::IFFParser parser(&input); - Common::Functor1Mem< Common::IFFChunk&, bool, A8SVXLoader > c(this, &A8SVXLoader::callback); - parser.parse(c); - } - - bool callback(Common::IFFChunk &chunk) { - switch (chunk._type) { - case ID_VHDR: - _header.load(*chunk._stream); - break; - - case ID_BODY: - _dataSize = chunk._size; - _data = (int8*)malloc(_dataSize); - assert(_data); - loadData(chunk._stream); - return true; - } - - return false; - } - - void loadData(Common::ReadStream *stream) { - switch (_header.compression) { - case 0: - stream->read(_data, _dataSize); - break; - - case 1: - // implement other formats here - error("compressed IFF audio is not supported"); - break; - } - - } -}; - - -AudioStream *make8SVXStream(Common::ReadStream &input, bool loop) { - A8SVXLoader loader; - loader.load(input); - - uint32 loopStart = 0, loopEnd = 0, flags = 0; - if (loop) { - // the standard way to loop 8SVX audio implies use of the oneShotHiSamples and - // repeatHiSamples fields - loopStart = 0; - loopEnd = loader._header.oneShotHiSamples + loader._header.repeatHiSamples; - flags |= Audio::Mixer::FLAG_LOOP; - } - - flags |= Audio::Mixer::FLAG_AUTOFREE; - - return Audio::makeLinearInputStream((byte *)loader._data, loader._dataSize, loader._header.samplesPerSec, flags, loopStart, loopEnd); -} - -} diff --git a/sound/iff.h b/sound/iff.h deleted file mode 100644 index 82106cb75e..0000000000 --- a/sound/iff.h +++ /dev/null @@ -1,60 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -/** - * Sound decoder used in engines: - * - parallaction - */ - -#ifndef SOUND_IFF_H -#define SOUND_IFF_H - -#include "common/iff_container.h" -#include "sound/audiostream.h" - -namespace Audio { - -struct Voice8Header { - uint32 oneShotHiSamples; - uint32 repeatHiSamples; - uint32 samplesPerHiCycle; - uint16 samplesPerSec; - byte octaves; - byte compression; - uint32 volume; - - Voice8Header() { - memset(this, 0, sizeof(Voice8Header)); - } - - void load(Common::ReadStream &stream); -}; - -AudioStream *make8SVXStream(Common::ReadStream &stream, bool loop); - - -} - -#endif diff --git a/sound/iff_sound.cpp b/sound/iff_sound.cpp new file mode 100644 index 0000000000..60a1486ed5 --- /dev/null +++ b/sound/iff_sound.cpp @@ -0,0 +1,106 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "sound/iff_sound.h" +#include "sound/audiostream.h" +#include "sound/mixer.h" +#include "common/func.h" + +namespace Audio { + +void Voice8Header::load(Common::ReadStream &stream) { + stream.read(this, sizeof(Voice8Header)); + oneShotHiSamples = FROM_BE_32(oneShotHiSamples); + repeatHiSamples = FROM_BE_32(repeatHiSamples); + samplesPerHiCycle = FROM_BE_32(samplesPerHiCycle); + samplesPerSec = FROM_BE_16(samplesPerSec); + volume = FROM_BE_32(volume); +} + + + +struct A8SVXLoader { + Voice8Header _header; + int8 *_data; + uint32 _dataSize; + + void load(Common::ReadStream &input) { + Common::IFFParser parser(&input); + Common::Functor1Mem< Common::IFFChunk&, bool, A8SVXLoader > c(this, &A8SVXLoader::callback); + parser.parse(c); + } + + bool callback(Common::IFFChunk &chunk) { + switch (chunk._type) { + case ID_VHDR: + _header.load(*chunk._stream); + break; + + case ID_BODY: + _dataSize = chunk._size; + _data = (int8*)malloc(_dataSize); + assert(_data); + loadData(chunk._stream); + return true; + } + + return false; + } + + void loadData(Common::ReadStream *stream) { + switch (_header.compression) { + case 0: + stream->read(_data, _dataSize); + break; + + case 1: + // implement other formats here + error("compressed IFF audio is not supported"); + break; + } + + } +}; + + +AudioStream *make8SVXStream(Common::ReadStream &input, bool loop) { + A8SVXLoader loader; + loader.load(input); + + uint32 loopStart = 0, loopEnd = 0, flags = 0; + if (loop) { + // the standard way to loop 8SVX audio implies use of the oneShotHiSamples and + // repeatHiSamples fields + loopStart = 0; + loopEnd = loader._header.oneShotHiSamples + loader._header.repeatHiSamples; + flags |= Audio::Mixer::FLAG_LOOP; + } + + flags |= Audio::Mixer::FLAG_AUTOFREE; + + return Audio::makeLinearInputStream((byte *)loader._data, loader._dataSize, loader._header.samplesPerSec, flags, loopStart, loopEnd); +} + +} diff --git a/sound/iff_sound.h b/sound/iff_sound.h new file mode 100644 index 0000000000..82106cb75e --- /dev/null +++ b/sound/iff_sound.h @@ -0,0 +1,60 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +/** + * Sound decoder used in engines: + * - parallaction + */ + +#ifndef SOUND_IFF_H +#define SOUND_IFF_H + +#include "common/iff_container.h" +#include "sound/audiostream.h" + +namespace Audio { + +struct Voice8Header { + uint32 oneShotHiSamples; + uint32 repeatHiSamples; + uint32 samplesPerHiCycle; + uint16 samplesPerSec; + byte octaves; + byte compression; + uint32 volume; + + Voice8Header() { + memset(this, 0, sizeof(Voice8Header)); + } + + void load(Common::ReadStream &stream); +}; + +AudioStream *make8SVXStream(Common::ReadStream &stream, bool loop); + + +} + +#endif diff --git a/sound/module.mk b/sound/module.mk index dba9501a38..3bcdd47c56 100644 --- a/sound/module.mk +++ b/sound/module.mk @@ -5,7 +5,7 @@ MODULE_OBJS := \ aiff.o \ audiocd.o \ audiostream.o \ - iff.o \ + iff_sound.o \ flac.o \ fmopl.o \ mididrv.o \ -- cgit v1.2.3 From aa66cf3fd8e8db52384653240276349fa39e2a15 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 9 Jul 2009 15:12:35 +0000 Subject: - Rewrote and greatly simplified the MSVC8 and MSVC9 project files so that they use common compilation properties, based on patch #2774908. These common properties make it much simpler to change options and compilation defines globally, similar to how GCC *.mk files do. Also, this fixes problems where an ENABLE_* define was set for one project file but not another (like the situation in revisions 42257 and 42259). It's now much easier to construct a tool which will create the project files dynamically. - Dropped support for MSVC7 and MSVC7.1 for now (as they don't support common compilation properties and it's no longer easy to construct them from the MSVC8 ones) - hopefully, they will return in the future, once we got a more sophisticated tool to create them - Simplified the MSVC9 <-> MSVC8 conversion tools a bit svn-id: r42288 --- dists/msvc7/agi.vcproj | 268 ----- dists/msvc7/agos.vcproj | 280 ----- dists/msvc7/cine.vcproj | 223 ---- dists/msvc7/cruise.vcproj | 283 ----- dists/msvc7/drascula.vcproj | 151 --- dists/msvc7/gob.vcproj | 469 -------- dists/msvc7/groovie.vcproj | 190 ---- dists/msvc7/igor.vcproj | 226 ---- dists/msvc7/kyra.vcproj | 457 -------- dists/msvc7/lure.vcproj | 241 ----- dists/msvc7/m4.vcproj | 283 ----- dists/msvc7/made.vcproj | 184 ---- dists/msvc7/parallaction.vcproj | 244 ----- dists/msvc7/queen.vcproj | 232 ---- dists/msvc7/saga.vcproj | 289 ----- dists/msvc7/sci.vcproj | 454 -------- dists/msvc7/scumm.vcproj | 613 ----------- dists/msvc7/scummvm.sln | 185 ---- dists/msvc7/scummvm.vcproj | 1308 ---------------------- dists/msvc7/sky.vcproj | 244 ----- dists/msvc7/sword1.vcproj | 223 ---- dists/msvc7/sword2.vcproj | 256 ----- dists/msvc7/tinsel.vcproj | 370 ------- dists/msvc7/touche.vcproj | 145 --- dists/msvc7/tucker.vcproj | 139 --- dists/msvc71/agi.vcproj | 282 ----- dists/msvc71/agos.vcproj | 294 ----- dists/msvc71/cine.vcproj | 237 ---- dists/msvc71/cruise.vcproj | 297 ----- dists/msvc71/drascula.vcproj | 165 --- dists/msvc71/gob.vcproj | 483 --------- dists/msvc71/groovie.vcproj | 204 ---- dists/msvc71/igor.vcproj | 240 ----- dists/msvc71/kyra.vcproj | 471 -------- dists/msvc71/lure.vcproj | 255 ----- dists/msvc71/m4.vcproj | 297 ----- dists/msvc71/made.vcproj | 198 ---- dists/msvc71/parallaction.vcproj | 258 ----- dists/msvc71/queen.vcproj | 246 ----- dists/msvc71/saga.vcproj | 303 ------ dists/msvc71/sci.vcproj | 468 -------- dists/msvc71/scumm.vcproj | 627 ----------- dists/msvc71/scummvm.sln | 231 ---- dists/msvc71/scummvm.vcproj | 1322 ----------------------- dists/msvc71/sky.vcproj | 258 ----- dists/msvc71/sword1.vcproj | 237 ---- dists/msvc71/sword2.vcproj | 270 ----- dists/msvc71/tinsel.vcproj | 384 ------- dists/msvc71/touche.vcproj | 159 --- dists/msvc71/tucker.vcproj | 153 --- dists/msvc8/ScummVM_Debug.vsprops | 25 + dists/msvc8/ScummVM_Global.vsprops | 30 + dists/msvc8/ScummVM_Release.vsprops | 24 + dists/msvc8/agi.vcproj | 424 +------- dists/msvc8/agos.vcproj | 444 ++------ dists/msvc8/cine.vcproj | 349 +----- dists/msvc8/cruise.vcproj | 449 ++------ dists/msvc8/drascula.vcproj | 229 +--- dists/msvc8/gob.vcproj | 758 +++---------- dists/msvc8/groovie.vcproj | 298 +----- dists/msvc8/igor.vcproj | 353 +----- dists/msvc8/kyra.vcproj | 739 ++----------- dists/msvc8/lure.vcproj | 379 +------ dists/msvc8/m4.vcproj | 449 ++------ dists/msvc8/made.vcproj | 284 +---- dists/msvc8/parallaction.vcproj | 384 +------ dists/msvc8/queen.vcproj | 364 +------ dists/msvc8/saga.vcproj | 459 ++------ dists/msvc8/sci.vcproj | 729 ++----------- dists/msvc8/scumm.vcproj | 995 +++-------------- dists/msvc8/scummvm.sln | 2 +- dists/msvc8/scummvm.vcproj | 2020 +++++++--------------------------- dists/msvc8/sky.vcproj | 383 +------ dists/msvc8/sword1.vcproj | 349 +----- dists/msvc8/sword2.vcproj | 404 +------ dists/msvc8/tinsel.vcproj | 594 ++-------- dists/msvc8/touche.vcproj | 219 +--- dists/msvc8/tucker.vcproj | 209 +--- dists/msvc8_to_msvc7_71.bat | 102 -- dists/msvc8_to_msvc9.bat | 4 +- dists/msvc9/ScummVM_Debug.vsprops | 25 + dists/msvc9/ScummVM_Global.vsprops | 30 + dists/msvc9/ScummVM_Release.vsprops | 24 + dists/msvc9/agi.vcproj | 424 +------- dists/msvc9/agos.vcproj | 444 ++------ dists/msvc9/cine.vcproj | 349 +----- dists/msvc9/cruise.vcproj | 449 ++------ dists/msvc9/drascula.vcproj | 229 +--- dists/msvc9/gob.vcproj | 758 +++---------- dists/msvc9/groovie.vcproj | 298 +----- dists/msvc9/igor.vcproj | 353 +----- dists/msvc9/kyra.vcproj | 739 ++----------- dists/msvc9/lure.vcproj | 379 +------ dists/msvc9/m4.vcproj | 449 ++------ dists/msvc9/made.vcproj | 284 +---- dists/msvc9/parallaction.vcproj | 384 +------ dists/msvc9/queen.vcproj | 364 +------ dists/msvc9/saga.vcproj | 459 ++------ dists/msvc9/sci.vcproj | 729 ++----------- dists/msvc9/scumm.vcproj | 995 +++-------------- dists/msvc9/scummvm.vcproj | 2024 +++++++---------------------------- dists/msvc9/sky.vcproj | 383 +------ dists/msvc9/sword1.vcproj | 349 +----- dists/msvc9/sword2.vcproj | 404 +------ dists/msvc9/tinsel.vcproj | 594 ++-------- dists/msvc9/touche.vcproj | 219 +--- dists/msvc9/tucker.vcproj | 209 +--- dists/msvc9_to_msvc8.bat | 5 +- 108 files changed, 3669 insertions(+), 37430 deletions(-) delete mode 100644 dists/msvc7/agi.vcproj delete mode 100644 dists/msvc7/agos.vcproj delete mode 100644 dists/msvc7/cine.vcproj delete mode 100644 dists/msvc7/cruise.vcproj delete mode 100644 dists/msvc7/drascula.vcproj delete mode 100644 dists/msvc7/gob.vcproj delete mode 100644 dists/msvc7/groovie.vcproj delete mode 100644 dists/msvc7/igor.vcproj delete mode 100644 dists/msvc7/kyra.vcproj delete mode 100644 dists/msvc7/lure.vcproj delete mode 100644 dists/msvc7/m4.vcproj delete mode 100644 dists/msvc7/made.vcproj delete mode 100644 dists/msvc7/parallaction.vcproj delete mode 100644 dists/msvc7/queen.vcproj delete mode 100644 dists/msvc7/saga.vcproj delete mode 100644 dists/msvc7/sci.vcproj delete mode 100644 dists/msvc7/scumm.vcproj delete mode 100644 dists/msvc7/scummvm.sln delete mode 100644 dists/msvc7/scummvm.vcproj delete mode 100644 dists/msvc7/sky.vcproj delete mode 100644 dists/msvc7/sword1.vcproj delete mode 100644 dists/msvc7/sword2.vcproj delete mode 100644 dists/msvc7/tinsel.vcproj delete mode 100644 dists/msvc7/touche.vcproj delete mode 100644 dists/msvc7/tucker.vcproj delete mode 100644 dists/msvc71/agi.vcproj delete mode 100644 dists/msvc71/agos.vcproj delete mode 100644 dists/msvc71/cine.vcproj delete mode 100644 dists/msvc71/cruise.vcproj delete mode 100644 dists/msvc71/drascula.vcproj delete mode 100644 dists/msvc71/gob.vcproj delete mode 100644 dists/msvc71/groovie.vcproj delete mode 100644 dists/msvc71/igor.vcproj delete mode 100644 dists/msvc71/kyra.vcproj delete mode 100644 dists/msvc71/lure.vcproj delete mode 100644 dists/msvc71/m4.vcproj delete mode 100644 dists/msvc71/made.vcproj delete mode 100644 dists/msvc71/parallaction.vcproj delete mode 100644 dists/msvc71/queen.vcproj delete mode 100644 dists/msvc71/saga.vcproj delete mode 100644 dists/msvc71/sci.vcproj delete mode 100644 dists/msvc71/scumm.vcproj delete mode 100644 dists/msvc71/scummvm.sln delete mode 100644 dists/msvc71/scummvm.vcproj delete mode 100644 dists/msvc71/sky.vcproj delete mode 100644 dists/msvc71/sword1.vcproj delete mode 100644 dists/msvc71/sword2.vcproj delete mode 100644 dists/msvc71/tinsel.vcproj delete mode 100644 dists/msvc71/touche.vcproj delete mode 100644 dists/msvc71/tucker.vcproj create mode 100644 dists/msvc8/ScummVM_Debug.vsprops create mode 100644 dists/msvc8/ScummVM_Global.vsprops create mode 100644 dists/msvc8/ScummVM_Release.vsprops delete mode 100644 dists/msvc8_to_msvc7_71.bat create mode 100644 dists/msvc9/ScummVM_Debug.vsprops create mode 100644 dists/msvc9/ScummVM_Global.vsprops create mode 100644 dists/msvc9/ScummVM_Release.vsprops diff --git a/dists/msvc7/agi.vcproj b/dists/msvc7/agi.vcproj deleted file mode 100644 index 1bbeeb0364..0000000000 --- a/dists/msvc7/agi.vcproj +++ /dev/null @@ -1,268 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/agos.vcproj b/dists/msvc7/agos.vcproj deleted file mode 100644 index 4e9882dc7a..0000000000 --- a/dists/msvc7/agos.vcproj +++ /dev/null @@ -1,280 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/cine.vcproj b/dists/msvc7/cine.vcproj deleted file mode 100644 index e5363f7724..0000000000 --- a/dists/msvc7/cine.vcproj +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/cruise.vcproj b/dists/msvc7/cruise.vcproj deleted file mode 100644 index 8a1bd8a7a0..0000000000 --- a/dists/msvc7/cruise.vcproj +++ /dev/null @@ -1,283 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/drascula.vcproj b/dists/msvc7/drascula.vcproj deleted file mode 100644 index 70f51b89c3..0000000000 --- a/dists/msvc7/drascula.vcproj +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/gob.vcproj b/dists/msvc7/gob.vcproj deleted file mode 100644 index 9919d09c9f..0000000000 --- a/dists/msvc7/gob.vcproj +++ /dev/null @@ -1,469 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/groovie.vcproj b/dists/msvc7/groovie.vcproj deleted file mode 100644 index 84bd30bbd7..0000000000 --- a/dists/msvc7/groovie.vcproj +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/igor.vcproj b/dists/msvc7/igor.vcproj deleted file mode 100644 index 1f25143030..0000000000 --- a/dists/msvc7/igor.vcproj +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/kyra.vcproj b/dists/msvc7/kyra.vcproj deleted file mode 100644 index cf1bee5dde..0000000000 --- a/dists/msvc7/kyra.vcproj +++ /dev/null @@ -1,457 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/lure.vcproj b/dists/msvc7/lure.vcproj deleted file mode 100644 index af6c4ebc23..0000000000 --- a/dists/msvc7/lure.vcproj +++ /dev/null @@ -1,241 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/m4.vcproj b/dists/msvc7/m4.vcproj deleted file mode 100644 index d4c700db0e..0000000000 --- a/dists/msvc7/m4.vcproj +++ /dev/null @@ -1,283 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/made.vcproj b/dists/msvc7/made.vcproj deleted file mode 100644 index 922658c318..0000000000 --- a/dists/msvc7/made.vcproj +++ /dev/null @@ -1,184 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/parallaction.vcproj b/dists/msvc7/parallaction.vcproj deleted file mode 100644 index a5ded11e4f..0000000000 --- a/dists/msvc7/parallaction.vcproj +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/queen.vcproj b/dists/msvc7/queen.vcproj deleted file mode 100644 index afc0aa17e3..0000000000 --- a/dists/msvc7/queen.vcproj +++ /dev/null @@ -1,232 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/saga.vcproj b/dists/msvc7/saga.vcproj deleted file mode 100644 index 7bab826b12..0000000000 --- a/dists/msvc7/saga.vcproj +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/sci.vcproj b/dists/msvc7/sci.vcproj deleted file mode 100644 index c62600ad9a..0000000000 --- a/dists/msvc7/sci.vcproj +++ /dev/null @@ -1,454 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/scumm.vcproj b/dists/msvc7/scumm.vcproj deleted file mode 100644 index 9d8e22eff6..0000000000 --- a/dists/msvc7/scumm.vcproj +++ /dev/null @@ -1,613 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/scummvm.sln b/dists/msvc7/scummvm.sln deleted file mode 100644 index 7c3010df07..0000000000 --- a/dists/msvc7/scummvm.sln +++ /dev/null @@ -1,185 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 7.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scummvm", "scummvm.vcproj", "{8434CB15-D08F-427D-9E6D-581AE5B28440}" - ProjectSection(ProjectDependencies) = postProject - {8863B00B-059A-471E-876D-A955ECEFD0D2} = {8863B00B-059A-471E-876D-A955ECEFD0D2} - {53F17B2B-0412-4EC3-A999-ED0537BB5223} = {53F17B2B-0412-4EC3-A999-ED0537BB5223} - {CF888EE2-239C-40D7-83F1-1CDD4F7D56E3} = {CF888EE2-239C-40D7-83F1-1CDD4F7D56E3} - {FF064FD0-AF6E-11DD-AD8B-0800200C9A66} = {FF064FD0-AF6E-11DD-AD8B-0800200C9A66} - {676DB4C5-9A3E-4EE1-8483-EBB79DC0700E} = {676DB4C5-9A3E-4EE1-8483-EBB79DC0700E} - {83945CAF-87A0-4202-8BA4-87A0CB15D78A} = {83945CAF-87A0-4202-8BA4-87A0CB15D78A} - {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC} = {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC} - {0068957B-E2E1-4988-8C87-D541D84DAF20} = {0068957B-E2E1-4988-8C87-D541D84DAF20} - {976D947A-A45F-4437-991E-412F695C64C7} = {976D947A-A45F-4437-991E-412F695C64C7} - {E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA} = {E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA} - {F5F57066-CDF4-4F80-B9E7-7F4D21850D6E} = {F5F57066-CDF4-4F80-B9E7-7F4D21850D6E} - {6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7} = {6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7} - {22AA7760-2C91-11DD-BD0B-0800200C9A66} = {22AA7760-2C91-11DD-BD0B-0800200C9A66} - {B5527758-2F51-4CCD-AAE1-B0E28654BD6A} = {B5527758-2F51-4CCD-AAE1-B0E28654BD6A} - {D4986356-D0BB-4981-924A-854157BDF11F} = {D4986356-D0BB-4981-924A-854157BDF11F} - {1CA4AC50-5426-433A-8B5E-FFE39568098E} = {1CA4AC50-5426-433A-8B5E-FFE39568098E} - {B6AFD548-63D2-40CD-A652-E87095AFCBAF} = {B6AFD548-63D2-40CD-A652-E87095AFCBAF} - {2C1EA540-0B09-11DD-BD00-000000000000} = {2C1EA540-0B09-11DD-BD00-000000000000} - {E29B5D40-08F7-11DD-BD0B-0800200C9A66} = {E29B5D40-08F7-11DD-BD0B-0800200C9A66} - {C8AAE83E-198B-4ECA-A877-166827953979} = {C8AAE83E-198B-4ECA-A877-166827953979} - {1A1CA028-61B5-4A6C-A918-F5D8721AB1AC} = {1A1CA028-61B5-4A6C-A918-F5D8721AB1AC} - {6D576A24-B9CE-11DC-BC77-8D2856D89593} = {6D576A24-B9CE-11DC-BC77-8D2856D89593} - {6CC3E421-779D-4E80-8100-520886A0F9FF} = {6CC3E421-779D-4E80-8100-520886A0F9FF} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sword2", "sword2.vcproj", "{6CC3E421-779D-4E80-8100-520886A0F9FF}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "queen", "queen.vcproj", "{6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scumm", "scumm.vcproj", "{B6AFD548-63D2-40CD-A652-E87095AFCBAF}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "agos", "agos.vcproj", "{E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sky", "sky.vcproj", "{B5527758-2F51-4CCD-AAE1-B0E28654BD6A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sword1", "sword1.vcproj", "{C8AAE83E-198B-4ECA-A877-166827953979}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kyra", "kyra.vcproj", "{9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "saga", "saga.vcproj", "{676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gob", "gob.vcproj", "{976D947A-A45F-4437-991E-412F695C64C7}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lure", "lure.vcproj", "{1A1CA028-61B5-4A6C-A918-F5D8721AB1AC}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cine", "cine.vcproj", "{1CA4AC50-5426-433A-8B5E-FFE39568098E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "agi", "agi.vcproj", "{F5F57066-CDF4-4F80-B9E7-7F4D21850D6E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "touche", "touche.vcproj", "{D4986356-D0BB-4981-924A-854157BDF11F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "parallaction", "parallaction.vcproj", "{0068957B-E2E1-4988-8C87-D541D84DAF20}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cruise", "cruise.vcproj", "{8863B00B-059A-471E-876D-A955ECEFD0D2}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "drascula", "drascula.vcproj", "{CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "igor", "igor.vcproj", "{83945CAF-87A0-4202-8BA4-87A0CB15D78A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "m4", "m4.vcproj", "{6D576A24-B9CE-11DC-BC77-8D2856D89593}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "made", "made.vcproj", "{E29B5D40-08F7-11DD-BD0B-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinsel", "tinsel.vcproj", "{22AA7760-2C91-11DD-BD0B-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tucker", "tucker.vcproj", "{FF064FD0-AF6E-11DD-AD8B-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "groovie", "groovie.vcproj", "{2C1EA540-0B09-11DD-BD00-000000000000}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sci", "sci.vcproj", "{53F17B2B-0412-4EC3-A999-ED0537BB5223}" -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - {8434CB15-D08F-427D-9E6D-581AE5B28440}.Debug|Win32.ActiveCfg = Debug|Win32 - {8434CB15-D08F-427D-9E6D-581AE5B28440}.Debug|Win32.Build.0 = Debug|Win32 - {8434CB15-D08F-427D-9E6D-581AE5B28440}.Release|Win32.ActiveCfg = Release|Win32 - {8434CB15-D08F-427D-9E6D-581AE5B28440}.Release|Win32.Build.0 = Release|Win32 - {6CC3E421-779D-4E80-8100-520886A0F9FF}.Debug|Win32.ActiveCfg = Debug|Win32 - {6CC3E421-779D-4E80-8100-520886A0F9FF}.Debug|Win32.Build.0 = Debug|Win32 - {6CC3E421-779D-4E80-8100-520886A0F9FF}.Release|Win32.ActiveCfg = Release|Win32 - {6CC3E421-779D-4E80-8100-520886A0F9FF}.Release|Win32.Build.0 = Release|Win32 - {6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7}.Debug|Win32.ActiveCfg = Debug|Win32 - {6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7}.Debug|Win32.Build.0 = Debug|Win32 - {6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7}.Release|Win32.ActiveCfg = Release|Win32 - {6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7}.Release|Win32.Build.0 = Release|Win32 - {B6AFD548-63D2-40CD-A652-E87095AFCBAF}.Debug|Win32.ActiveCfg = Debug|Win32 - {B6AFD548-63D2-40CD-A652-E87095AFCBAF}.Debug|Win32.Build.0 = Debug|Win32 - {B6AFD548-63D2-40CD-A652-E87095AFCBAF}.Release|Win32.ActiveCfg = Release|Win32 - {B6AFD548-63D2-40CD-A652-E87095AFCBAF}.Release|Win32.Build.0 = Release|Win32 - {E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA}.Debug|Win32.ActiveCfg = Debug|Win32 - {E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA}.Debug|Win32.Build.0 = Debug|Win32 - {E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA}.Release|Win32.ActiveCfg = Release|Win32 - {E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA}.Release|Win32.Build.0 = Release|Win32 - {B5527758-2F51-4CCD-AAE1-B0E28654BD6A}.Debug|Win32.ActiveCfg = Debug|Win32 - {B5527758-2F51-4CCD-AAE1-B0E28654BD6A}.Debug|Win32.Build.0 = Debug|Win32 - {B5527758-2F51-4CCD-AAE1-B0E28654BD6A}.Release|Win32.ActiveCfg = Release|Win32 - {B5527758-2F51-4CCD-AAE1-B0E28654BD6A}.Release|Win32.Build.0 = Release|Win32 - {C8AAE83E-198B-4ECA-A877-166827953979}.Debug|Win32.ActiveCfg = Debug|Win32 - {C8AAE83E-198B-4ECA-A877-166827953979}.Debug|Win32.Build.0 = Debug|Win32 - {C8AAE83E-198B-4ECA-A877-166827953979}.Release|Win32.ActiveCfg = Release|Win32 - {C8AAE83E-198B-4ECA-A877-166827953979}.Release|Win32.Build.0 = Release|Win32 - {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}.Debug|Win32.ActiveCfg = Debug|Win32 - {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}.Debug|Win32.Build.0 = Debug|Win32 - {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}.Release|Win32.ActiveCfg = Release|Win32 - {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}.Release|Win32.Build.0 = Release|Win32 - {676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}.Debug|Win32.ActiveCfg = Debug|Win32 - {676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}.Debug|Win32.Build.0 = Debug|Win32 - {676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}.Release|Win32.ActiveCfg = Release|Win32 - {676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}.Release|Win32.Build.0 = Release|Win32 - {976D947A-A45F-4437-991E-412F695C64C7}.Debug|Win32.ActiveCfg = Debug|Win32 - {976D947A-A45F-4437-991E-412F695C64C7}.Debug|Win32.Build.0 = Debug|Win32 - {976D947A-A45F-4437-991E-412F695C64C7}.Release|Win32.ActiveCfg = Release|Win32 - {976D947A-A45F-4437-991E-412F695C64C7}.Release|Win32.Build.0 = Release|Win32 - {1A1CA028-61B5-4A6C-A918-F5D8721AB1AC}.Debug|Win32.ActiveCfg = Debug|Win32 - {1A1CA028-61B5-4A6C-A918-F5D8721AB1AC}.Debug|Win32.Build.0 = Debug|Win32 - {1A1CA028-61B5-4A6C-A918-F5D8721AB1AC}.Release|Win32.ActiveCfg = Release|Win32 - {1A1CA028-61B5-4A6C-A918-F5D8721AB1AC}.Release|Win32.Build.0 = Release|Win32 - {1CA4AC50-5426-433A-8B5E-FFE39568098E}.Debug|Win32.ActiveCfg = Debug|Win32 - {1CA4AC50-5426-433A-8B5E-FFE39568098E}.Debug|Win32.Build.0 = Debug|Win32 - {1CA4AC50-5426-433A-8B5E-FFE39568098E}.Release|Win32.ActiveCfg = Release|Win32 - {1CA4AC50-5426-433A-8B5E-FFE39568098E}.Release|Win32.Build.0 = Release|Win32 - {F5F57066-CDF4-4F80-B9E7-7F4D21850D6E}.Debug|Win32.ActiveCfg = Debug|Win32 - {F5F57066-CDF4-4F80-B9E7-7F4D21850D6E}.Debug|Win32.Build.0 = Debug|Win32 - {F5F57066-CDF4-4F80-B9E7-7F4D21850D6E}.Release|Win32.ActiveCfg = Release|Win32 - {F5F57066-CDF4-4F80-B9E7-7F4D21850D6E}.Release|Win32.Build.0 = Release|Win32 - {D4986356-D0BB-4981-924A-854157BDF11F}.Debug|Win32.ActiveCfg = Debug|Win32 - {D4986356-D0BB-4981-924A-854157BDF11F}.Debug|Win32.Build.0 = Debug|Win32 - {D4986356-D0BB-4981-924A-854157BDF11F}.Release|Win32.ActiveCfg = Release|Win32 - {D4986356-D0BB-4981-924A-854157BDF11F}.Release|Win32.Build.0 = Release|Win32 - {0068957B-E2E1-4988-8C87-D541D84DAF20}.Debug|Win32.ActiveCfg = Debug|Win32 - {0068957B-E2E1-4988-8C87-D541D84DAF20}.Debug|Win32.Build.0 = Debug|Win32 - {0068957B-E2E1-4988-8C87-D541D84DAF20}.Release|Win32.ActiveCfg = Release|Win32 - {0068957B-E2E1-4988-8C87-D541D84DAF20}.Release|Win32.Build.0 = Release|Win32 - {8863B00B-059A-471E-876D-A955ECEFD0D2}.Debug|Win32.ActiveCfg = Debug|Win32 - {8863B00B-059A-471E-876D-A955ECEFD0D2}.Debug|Win32.Build.0 = Debug|Win32 - {8863B00B-059A-471E-876D-A955ECEFD0D2}.Release|Win32.ActiveCfg = Release|Win32 - {8863B00B-059A-471E-876D-A955ECEFD0D2}.Release|Win32.Build.0 = Release|Win32 - {CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}.Debug|Win32.ActiveCfg = Debug|Win32 - {CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}.Debug|Win32.Build.0 = Debug|Win32 - {CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}.Release|Win32.ActiveCfg = Release|Win32 - {CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}.Release|Win32.Build.0 = Release|Win32 - {83945CAF-87A0-4202-8BA4-87A0CB15D78A}.Debug|Win32.ActiveCfg = Debug|Win32 - {83945CAF-87A0-4202-8BA4-87A0CB15D78A}.Debug|Win32.Build.0 = Debug|Win32 - {83945CAF-87A0-4202-8BA4-87A0CB15D78A}.Release|Win32.ActiveCfg = Release|Win32 - {83945CAF-87A0-4202-8BA4-87A0CB15D78A}.Release|Win32.Build.0 = Release|Win32 - {6D576A24-B9CE-11DC-BC77-8D2856D89593}.Debug|Win32.ActiveCfg = Debug|Win32 - {6D576A24-B9CE-11DC-BC77-8D2856D89593}.Debug|Win32.Build.0 = Debug|Win32 - {6D576A24-B9CE-11DC-BC77-8D2856D89593}.Release|Win32.ActiveCfg = Release|Win32 - {6D576A24-B9CE-11DC-BC77-8D2856D89593}.Release|Win32.Build.0 = Release|Win32 - {E29B5D40-08F7-11DD-BD0B-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {E29B5D40-08F7-11DD-BD0B-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {E29B5D40-08F7-11DD-BD0B-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {E29B5D40-08F7-11DD-BD0B-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {22AA7760-2C91-11DD-BD0B-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {22AA7760-2C91-11DD-BD0B-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {22AA7760-2C91-11DD-BD0B-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {22AA7760-2C91-11DD-BD0B-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {FF064FD0-AF6E-11DD-AD8B-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {FF064FD0-AF6E-11DD-AD8B-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {FF064FD0-AF6E-11DD-AD8B-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {FF064FD0-AF6E-11DD-AD8B-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {2C1EA540-0B09-11DD-BD00-000000000000}.Debug|Win32.ActiveCfg = Debug|Win32 - {2C1EA540-0B09-11DD-BD00-000000000000}.Debug|Win32.Build.0 = Debug|Win32 - {2C1EA540-0B09-11DD-BD00-000000000000}.Release|Win32.ActiveCfg = Release|Win32 - {2C1EA540-0B09-11DD-BD00-000000000000}.Release|Win32.Build.0 = Release|Win32 - {53F17B2B-0412-4EC3-A999-ED0537BB5223}.Debug|Win32.ActiveCfg = Debug|Win32 - {53F17B2B-0412-4EC3-A999-ED0537BB5223}.Debug|Win32.Build.0 = Debug|Win32 - {53F17B2B-0412-4EC3-A999-ED0537BB5223}.Release|Win32.ActiveCfg = Release|Win32 - {53F17B2B-0412-4EC3-A999-ED0537BB5223}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/dists/msvc7/scummvm.vcproj b/dists/msvc7/scummvm.vcproj deleted file mode 100644 index 33ff4e4f68..0000000000 --- a/dists/msvc7/scummvm.vcproj +++ /dev/null @@ -1,1308 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/sky.vcproj b/dists/msvc7/sky.vcproj deleted file mode 100644 index 4e3842c993..0000000000 --- a/dists/msvc7/sky.vcproj +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/sword1.vcproj b/dists/msvc7/sword1.vcproj deleted file mode 100644 index 998f43a02b..0000000000 --- a/dists/msvc7/sword1.vcproj +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/sword2.vcproj b/dists/msvc7/sword2.vcproj deleted file mode 100644 index 5da67dda34..0000000000 --- a/dists/msvc7/sword2.vcproj +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/tinsel.vcproj b/dists/msvc7/tinsel.vcproj deleted file mode 100644 index 4b1ed05830..0000000000 --- a/dists/msvc7/tinsel.vcproj +++ /dev/null @@ -1,370 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/touche.vcproj b/dists/msvc7/touche.vcproj deleted file mode 100644 index 52fc1d2d91..0000000000 --- a/dists/msvc7/touche.vcproj +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc7/tucker.vcproj b/dists/msvc7/tucker.vcproj deleted file mode 100644 index 10084b59c2..0000000000 --- a/dists/msvc7/tucker.vcproj +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/agi.vcproj b/dists/msvc71/agi.vcproj deleted file mode 100644 index 4b5c0fa10e..0000000000 --- a/dists/msvc71/agi.vcproj +++ /dev/null @@ -1,282 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/agos.vcproj b/dists/msvc71/agos.vcproj deleted file mode 100644 index 059da5c3f1..0000000000 --- a/dists/msvc71/agos.vcproj +++ /dev/null @@ -1,294 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/cine.vcproj b/dists/msvc71/cine.vcproj deleted file mode 100644 index 3b1973c3b0..0000000000 --- a/dists/msvc71/cine.vcproj +++ /dev/null @@ -1,237 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/cruise.vcproj b/dists/msvc71/cruise.vcproj deleted file mode 100644 index b5c33b8ca2..0000000000 --- a/dists/msvc71/cruise.vcproj +++ /dev/null @@ -1,297 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/drascula.vcproj b/dists/msvc71/drascula.vcproj deleted file mode 100644 index 63922e333b..0000000000 --- a/dists/msvc71/drascula.vcproj +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/gob.vcproj b/dists/msvc71/gob.vcproj deleted file mode 100644 index 0a5f869970..0000000000 --- a/dists/msvc71/gob.vcproj +++ /dev/null @@ -1,483 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/groovie.vcproj b/dists/msvc71/groovie.vcproj deleted file mode 100644 index 1e1ac8d7c7..0000000000 --- a/dists/msvc71/groovie.vcproj +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/igor.vcproj b/dists/msvc71/igor.vcproj deleted file mode 100644 index 10b744e9b3..0000000000 --- a/dists/msvc71/igor.vcproj +++ /dev/null @@ -1,240 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/kyra.vcproj b/dists/msvc71/kyra.vcproj deleted file mode 100644 index f37e479012..0000000000 --- a/dists/msvc71/kyra.vcproj +++ /dev/null @@ -1,471 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/lure.vcproj b/dists/msvc71/lure.vcproj deleted file mode 100644 index 94d672229a..0000000000 --- a/dists/msvc71/lure.vcproj +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/m4.vcproj b/dists/msvc71/m4.vcproj deleted file mode 100644 index ea1ca572eb..0000000000 --- a/dists/msvc71/m4.vcproj +++ /dev/null @@ -1,297 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/made.vcproj b/dists/msvc71/made.vcproj deleted file mode 100644 index a233f28e58..0000000000 --- a/dists/msvc71/made.vcproj +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/parallaction.vcproj b/dists/msvc71/parallaction.vcproj deleted file mode 100644 index 5e57f5e581..0000000000 --- a/dists/msvc71/parallaction.vcproj +++ /dev/null @@ -1,258 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/queen.vcproj b/dists/msvc71/queen.vcproj deleted file mode 100644 index e301f12726..0000000000 --- a/dists/msvc71/queen.vcproj +++ /dev/null @@ -1,246 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/saga.vcproj b/dists/msvc71/saga.vcproj deleted file mode 100644 index d4a5628368..0000000000 --- a/dists/msvc71/saga.vcproj +++ /dev/null @@ -1,303 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/sci.vcproj b/dists/msvc71/sci.vcproj deleted file mode 100644 index 564c5666dc..0000000000 --- a/dists/msvc71/sci.vcproj +++ /dev/null @@ -1,468 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/scumm.vcproj b/dists/msvc71/scumm.vcproj deleted file mode 100644 index d6b7555c1f..0000000000 --- a/dists/msvc71/scumm.vcproj +++ /dev/null @@ -1,627 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/scummvm.sln b/dists/msvc71/scummvm.sln deleted file mode 100644 index 05e30e965b..0000000000 --- a/dists/msvc71/scummvm.sln +++ /dev/null @@ -1,231 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scummvm", "scummvm.vcproj", "{8434CB15-D08F-427D-9E6D-581AE5B28440}" - ProjectSection(ProjectDependencies) = postProject - {8863B00B-059A-471E-876D-A955ECEFD0D2} = {8863B00B-059A-471E-876D-A955ECEFD0D2} - {53F17B2B-0412-4EC3-A999-ED0537BB5223} = {53F17B2B-0412-4EC3-A999-ED0537BB5223} - {CF888EE2-239C-40D7-83F1-1CDD4F7D56E3} = {CF888EE2-239C-40D7-83F1-1CDD4F7D56E3} - {FF064FD0-AF6E-11DD-AD8B-0800200C9A66} = {FF064FD0-AF6E-11DD-AD8B-0800200C9A66} - {676DB4C5-9A3E-4EE1-8483-EBB79DC0700E} = {676DB4C5-9A3E-4EE1-8483-EBB79DC0700E} - {83945CAF-87A0-4202-8BA4-87A0CB15D78A} = {83945CAF-87A0-4202-8BA4-87A0CB15D78A} - {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC} = {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC} - {0068957B-E2E1-4988-8C87-D541D84DAF20} = {0068957B-E2E1-4988-8C87-D541D84DAF20} - {976D947A-A45F-4437-991E-412F695C64C7} = {976D947A-A45F-4437-991E-412F695C64C7} - {E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA} = {E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA} - {F5F57066-CDF4-4F80-B9E7-7F4D21850D6E} = {F5F57066-CDF4-4F80-B9E7-7F4D21850D6E} - {6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7} = {6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7} - {22AA7760-2C91-11DD-BD0B-0800200C9A66} = {22AA7760-2C91-11DD-BD0B-0800200C9A66} - {B5527758-2F51-4CCD-AAE1-B0E28654BD6A} = {B5527758-2F51-4CCD-AAE1-B0E28654BD6A} - {D4986356-D0BB-4981-924A-854157BDF11F} = {D4986356-D0BB-4981-924A-854157BDF11F} - {1CA4AC50-5426-433A-8B5E-FFE39568098E} = {1CA4AC50-5426-433A-8B5E-FFE39568098E} - {B6AFD548-63D2-40CD-A652-E87095AFCBAF} = {B6AFD548-63D2-40CD-A652-E87095AFCBAF} - {2C1EA540-0B09-11DD-BD00-000000000000} = {2C1EA540-0B09-11DD-BD00-000000000000} - {E29B5D40-08F7-11DD-BD0B-0800200C9A66} = {E29B5D40-08F7-11DD-BD0B-0800200C9A66} - {C8AAE83E-198B-4ECA-A877-166827953979} = {C8AAE83E-198B-4ECA-A877-166827953979} - {1A1CA028-61B5-4A6C-A918-F5D8721AB1AC} = {1A1CA028-61B5-4A6C-A918-F5D8721AB1AC} - {6D576A24-B9CE-11DC-BC77-8D2856D89593} = {6D576A24-B9CE-11DC-BC77-8D2856D89593} - {6CC3E421-779D-4E80-8100-520886A0F9FF} = {6CC3E421-779D-4E80-8100-520886A0F9FF} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sword2", "sword2.vcproj", "{6CC3E421-779D-4E80-8100-520886A0F9FF}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "queen", "queen.vcproj", "{6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scumm", "scumm.vcproj", "{B6AFD548-63D2-40CD-A652-E87095AFCBAF}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "agos", "agos.vcproj", "{E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sky", "sky.vcproj", "{B5527758-2F51-4CCD-AAE1-B0E28654BD6A}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sword1", "sword1.vcproj", "{C8AAE83E-198B-4ECA-A877-166827953979}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kyra", "kyra.vcproj", "{9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "saga", "saga.vcproj", "{676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gob", "gob.vcproj", "{976D947A-A45F-4437-991E-412F695C64C7}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lure", "lure.vcproj", "{1A1CA028-61B5-4A6C-A918-F5D8721AB1AC}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cine", "cine.vcproj", "{1CA4AC50-5426-433A-8B5E-FFE39568098E}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "agi", "agi.vcproj", "{F5F57066-CDF4-4F80-B9E7-7F4D21850D6E}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "touche", "touche.vcproj", "{D4986356-D0BB-4981-924A-854157BDF11F}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "parallaction", "parallaction.vcproj", "{0068957B-E2E1-4988-8C87-D541D84DAF20}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cruise", "cruise.vcproj", "{8863B00B-059A-471E-876D-A955ECEFD0D2}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "drascula", "drascula.vcproj", "{CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "igor", "igor.vcproj", "{83945CAF-87A0-4202-8BA4-87A0CB15D78A}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "m4", "m4.vcproj", "{6D576A24-B9CE-11DC-BC77-8D2856D89593}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "made", "made.vcproj", "{E29B5D40-08F7-11DD-BD0B-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinsel", "tinsel.vcproj", "{22AA7760-2C91-11DD-BD0B-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tucker", "tucker.vcproj", "{FF064FD0-AF6E-11DD-AD8B-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "groovie", "groovie.vcproj", "{2C1EA540-0B09-11DD-BD00-000000000000}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sci", "sci.vcproj", "{53F17B2B-0412-4EC3-A999-ED0537BB5223}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - {8434CB15-D08F-427D-9E6D-581AE5B28440}.Debug|Win32.ActiveCfg = Debug|Win32 - {8434CB15-D08F-427D-9E6D-581AE5B28440}.Debug|Win32.Build.0 = Debug|Win32 - {8434CB15-D08F-427D-9E6D-581AE5B28440}.Release|Win32.ActiveCfg = Release|Win32 - {8434CB15-D08F-427D-9E6D-581AE5B28440}.Release|Win32.Build.0 = Release|Win32 - {6CC3E421-779D-4E80-8100-520886A0F9FF}.Debug|Win32.ActiveCfg = Debug|Win32 - {6CC3E421-779D-4E80-8100-520886A0F9FF}.Debug|Win32.Build.0 = Debug|Win32 - {6CC3E421-779D-4E80-8100-520886A0F9FF}.Release|Win32.ActiveCfg = Release|Win32 - {6CC3E421-779D-4E80-8100-520886A0F9FF}.Release|Win32.Build.0 = Release|Win32 - {6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7}.Debug|Win32.ActiveCfg = Debug|Win32 - {6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7}.Debug|Win32.Build.0 = Debug|Win32 - {6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7}.Release|Win32.ActiveCfg = Release|Win32 - {6A55AF61-7CA1-49E0-9385-59C1FE9D4DB7}.Release|Win32.Build.0 = Release|Win32 - {B6AFD548-63D2-40CD-A652-E87095AFCBAF}.Debug|Win32.ActiveCfg = Debug|Win32 - {B6AFD548-63D2-40CD-A652-E87095AFCBAF}.Debug|Win32.Build.0 = Debug|Win32 - {B6AFD548-63D2-40CD-A652-E87095AFCBAF}.Release|Win32.ActiveCfg = Release|Win32 - {B6AFD548-63D2-40CD-A652-E87095AFCBAF}.Release|Win32.Build.0 = Release|Win32 - {E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA}.Debug|Win32.ActiveCfg = Debug|Win32 - {E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA}.Debug|Win32.Build.0 = Debug|Win32 - {E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA}.Release|Win32.ActiveCfg = Release|Win32 - {E0EC9C72-A33E-49DA-B1DC-BB44B9799BFA}.Release|Win32.Build.0 = Release|Win32 - {B5527758-2F51-4CCD-AAE1-B0E28654BD6A}.Debug|Win32.ActiveCfg = Debug|Win32 - {B5527758-2F51-4CCD-AAE1-B0E28654BD6A}.Debug|Win32.Build.0 = Debug|Win32 - {B5527758-2F51-4CCD-AAE1-B0E28654BD6A}.Release|Win32.ActiveCfg = Release|Win32 - {B5527758-2F51-4CCD-AAE1-B0E28654BD6A}.Release|Win32.Build.0 = Release|Win32 - {C8AAE83E-198B-4ECA-A877-166827953979}.Debug|Win32.ActiveCfg = Debug|Win32 - {C8AAE83E-198B-4ECA-A877-166827953979}.Debug|Win32.Build.0 = Debug|Win32 - {C8AAE83E-198B-4ECA-A877-166827953979}.Release|Win32.ActiveCfg = Release|Win32 - {C8AAE83E-198B-4ECA-A877-166827953979}.Release|Win32.Build.0 = Release|Win32 - {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}.Debug|Win32.ActiveCfg = Debug|Win32 - {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}.Debug|Win32.Build.0 = Debug|Win32 - {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}.Release|Win32.ActiveCfg = Release|Win32 - {9D9A98A0-F88F-4CA2-B8FF-462470EBE3EC}.Release|Win32.Build.0 = Release|Win32 - {676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}.Debug|Win32.ActiveCfg = Debug|Win32 - {676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}.Debug|Win32.Build.0 = Debug|Win32 - {676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}.Release|Win32.ActiveCfg = Release|Win32 - {676DB4C5-9A3E-4EE1-8483-EBB79DC0700E}.Release|Win32.Build.0 = Release|Win32 - {976D947A-A45F-4437-991E-412F695C64C7}.Debug|Win32.ActiveCfg = Debug|Win32 - {976D947A-A45F-4437-991E-412F695C64C7}.Debug|Win32.Build.0 = Debug|Win32 - {976D947A-A45F-4437-991E-412F695C64C7}.Release|Win32.ActiveCfg = Release|Win32 - {976D947A-A45F-4437-991E-412F695C64C7}.Release|Win32.Build.0 = Release|Win32 - {1A1CA028-61B5-4A6C-A918-F5D8721AB1AC}.Debug|Win32.ActiveCfg = Debug|Win32 - {1A1CA028-61B5-4A6C-A918-F5D8721AB1AC}.Debug|Win32.Build.0 = Debug|Win32 - {1A1CA028-61B5-4A6C-A918-F5D8721AB1AC}.Release|Win32.ActiveCfg = Release|Win32 - {1A1CA028-61B5-4A6C-A918-F5D8721AB1AC}.Release|Win32.Build.0 = Release|Win32 - {1CA4AC50-5426-433A-8B5E-FFE39568098E}.Debug|Win32.ActiveCfg = Debug|Win32 - {1CA4AC50-5426-433A-8B5E-FFE39568098E}.Debug|Win32.Build.0 = Debug|Win32 - {1CA4AC50-5426-433A-8B5E-FFE39568098E}.Release|Win32.ActiveCfg = Release|Win32 - {1CA4AC50-5426-433A-8B5E-FFE39568098E}.Release|Win32.Build.0 = Release|Win32 - {F5F57066-CDF4-4F80-B9E7-7F4D21850D6E}.Debug|Win32.ActiveCfg = Debug|Win32 - {F5F57066-CDF4-4F80-B9E7-7F4D21850D6E}.Debug|Win32.Build.0 = Debug|Win32 - {F5F57066-CDF4-4F80-B9E7-7F4D21850D6E}.Release|Win32.ActiveCfg = Release|Win32 - {F5F57066-CDF4-4F80-B9E7-7F4D21850D6E}.Release|Win32.Build.0 = Release|Win32 - {D4986356-D0BB-4981-924A-854157BDF11F}.Debug|Win32.ActiveCfg = Debug|Win32 - {D4986356-D0BB-4981-924A-854157BDF11F}.Debug|Win32.Build.0 = Debug|Win32 - {D4986356-D0BB-4981-924A-854157BDF11F}.Release|Win32.ActiveCfg = Release|Win32 - {D4986356-D0BB-4981-924A-854157BDF11F}.Release|Win32.Build.0 = Release|Win32 - {0068957B-E2E1-4988-8C87-D541D84DAF20}.Debug|Win32.ActiveCfg = Debug|Win32 - {0068957B-E2E1-4988-8C87-D541D84DAF20}.Debug|Win32.Build.0 = Debug|Win32 - {0068957B-E2E1-4988-8C87-D541D84DAF20}.Release|Win32.ActiveCfg = Release|Win32 - {0068957B-E2E1-4988-8C87-D541D84DAF20}.Release|Win32.Build.0 = Release|Win32 - {8863B00B-059A-471E-876D-A955ECEFD0D2}.Debug|Win32.ActiveCfg = Debug|Win32 - {8863B00B-059A-471E-876D-A955ECEFD0D2}.Debug|Win32.Build.0 = Debug|Win32 - {8863B00B-059A-471E-876D-A955ECEFD0D2}.Release|Win32.ActiveCfg = Release|Win32 - {8863B00B-059A-471E-876D-A955ECEFD0D2}.Release|Win32.Build.0 = Release|Win32 - {CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}.Debug|Win32.ActiveCfg = Debug|Win32 - {CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}.Debug|Win32.Build.0 = Debug|Win32 - {CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}.Release|Win32.ActiveCfg = Release|Win32 - {CF888EE2-239C-40D7-83F1-1CDD4F7D56E3}.Release|Win32.Build.0 = Release|Win32 - {83945CAF-87A0-4202-8BA4-87A0CB15D78A}.Debug|Win32.ActiveCfg = Debug|Win32 - {83945CAF-87A0-4202-8BA4-87A0CB15D78A}.Debug|Win32.Build.0 = Debug|Win32 - {83945CAF-87A0-4202-8BA4-87A0CB15D78A}.Release|Win32.ActiveCfg = Release|Win32 - {83945CAF-87A0-4202-8BA4-87A0CB15D78A}.Release|Win32.Build.0 = Release|Win32 - {6D576A24-B9CE-11DC-BC77-8D2856D89593}.Debug|Win32.ActiveCfg = Debug|Win32 - {6D576A24-B9CE-11DC-BC77-8D2856D89593}.Debug|Win32.Build.0 = Debug|Win32 - {6D576A24-B9CE-11DC-BC77-8D2856D89593}.Release|Win32.ActiveCfg = Release|Win32 - {6D576A24-B9CE-11DC-BC77-8D2856D89593}.Release|Win32.Build.0 = Release|Win32 - {E29B5D40-08F7-11DD-BD0B-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {E29B5D40-08F7-11DD-BD0B-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {E29B5D40-08F7-11DD-BD0B-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {E29B5D40-08F7-11DD-BD0B-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {22AA7760-2C91-11DD-BD0B-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {22AA7760-2C91-11DD-BD0B-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {22AA7760-2C91-11DD-BD0B-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {22AA7760-2C91-11DD-BD0B-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {FF064FD0-AF6E-11DD-AD8B-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {FF064FD0-AF6E-11DD-AD8B-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {FF064FD0-AF6E-11DD-AD8B-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {FF064FD0-AF6E-11DD-AD8B-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {2C1EA540-0B09-11DD-BD00-000000000000}.Debug|Win32.ActiveCfg = Debug|Win32 - {2C1EA540-0B09-11DD-BD00-000000000000}.Debug|Win32.Build.0 = Debug|Win32 - {2C1EA540-0B09-11DD-BD00-000000000000}.Release|Win32.ActiveCfg = Release|Win32 - {2C1EA540-0B09-11DD-BD00-000000000000}.Release|Win32.Build.0 = Release|Win32 - {53F17B2B-0412-4EC3-A999-ED0537BB5223}.Debug|Win32.ActiveCfg = Debug|Win32 - {53F17B2B-0412-4EC3-A999-ED0537BB5223}.Debug|Win32.Build.0 = Debug|Win32 - {53F17B2B-0412-4EC3-A999-ED0537BB5223}.Release|Win32.ActiveCfg = Release|Win32 - {53F17B2B-0412-4EC3-A999-ED0537BB5223}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/dists/msvc71/scummvm.vcproj b/dists/msvc71/scummvm.vcproj deleted file mode 100644 index 3c61ed6f02..0000000000 --- a/dists/msvc71/scummvm.vcproj +++ /dev/null @@ -1,1322 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/sky.vcproj b/dists/msvc71/sky.vcproj deleted file mode 100644 index 88025caba1..0000000000 --- a/dists/msvc71/sky.vcproj +++ /dev/null @@ -1,258 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/sword1.vcproj b/dists/msvc71/sword1.vcproj deleted file mode 100644 index 31a677d866..0000000000 --- a/dists/msvc71/sword1.vcproj +++ /dev/null @@ -1,237 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/sword2.vcproj b/dists/msvc71/sword2.vcproj deleted file mode 100644 index f6256a3300..0000000000 --- a/dists/msvc71/sword2.vcproj +++ /dev/null @@ -1,270 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/tinsel.vcproj b/dists/msvc71/tinsel.vcproj deleted file mode 100644 index 6b3920b1d1..0000000000 --- a/dists/msvc71/tinsel.vcproj +++ /dev/null @@ -1,384 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/touche.vcproj b/dists/msvc71/touche.vcproj deleted file mode 100644 index 33b80e9b48..0000000000 --- a/dists/msvc71/touche.vcproj +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc71/tucker.vcproj b/dists/msvc71/tucker.vcproj deleted file mode 100644 index 8ceffd432f..0000000000 --- a/dists/msvc71/tucker.vcproj +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dists/msvc8/ScummVM_Debug.vsprops b/dists/msvc8/ScummVM_Debug.vsprops new file mode 100644 index 0000000000..910096cab6 --- /dev/null +++ b/dists/msvc8/ScummVM_Debug.vsprops @@ -0,0 +1,25 @@ + + + + + diff --git a/dists/msvc8/ScummVM_Global.vsprops b/dists/msvc8/ScummVM_Global.vsprops new file mode 100644 index 0000000000..7ba00aac7b --- /dev/null +++ b/dists/msvc8/ScummVM_Global.vsprops @@ -0,0 +1,30 @@ + + + + + + diff --git a/dists/msvc8/ScummVM_Release.vsprops b/dists/msvc8/ScummVM_Release.vsprops new file mode 100644 index 0000000000..837be3b94c --- /dev/null +++ b/dists/msvc8/ScummVM_Release.vsprops @@ -0,0 +1,24 @@ + + + + + diff --git a/dists/msvc8/agi.vcproj b/dists/msvc8/agi.vcproj index 08d734221b..705be31ae4 100644 --- a/dists/msvc8/agi.vcproj +++ b/dists/msvc8/agi.vcproj @@ -8,377 +8,65 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/agos.vcproj b/dists/msvc8/agos.vcproj index be21dc9f2a..5d6fe215b2 100644 --- a/dists/msvc8/agos.vcproj +++ b/dists/msvc8/agos.vcproj @@ -8,393 +8,69 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/cine.vcproj b/dists/msvc8/cine.vcproj index 3abcd9250b..59a95fae26 100644 --- a/dists/msvc8/cine.vcproj +++ b/dists/msvc8/cine.vcproj @@ -8,317 +8,50 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/cruise.vcproj b/dists/msvc8/cruise.vcproj index df65453e4d..89b82ae8e6 100644 --- a/dists/msvc8/cruise.vcproj +++ b/dists/msvc8/cruise.vcproj @@ -8,397 +8,70 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/drascula.vcproj b/dists/msvc8/drascula.vcproj index e096b33239..7481d2d81a 100644 --- a/dists/msvc8/drascula.vcproj +++ b/dists/msvc8/drascula.vcproj @@ -8,221 +8,26 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/gob.vcproj b/dists/msvc8/gob.vcproj index e0335ee352..5878abe30b 100644 --- a/dists/msvc8/gob.vcproj +++ b/dists/msvc8/gob.vcproj @@ -8,645 +8,133 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/groovie.vcproj b/dists/msvc8/groovie.vcproj index 14ab5726fc..5404803ae9 100644 --- a/dists/msvc8/groovie.vcproj +++ b/dists/msvc8/groovie.vcproj @@ -8,275 +8,41 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/igor.vcproj b/dists/msvc8/igor.vcproj index dbfc5cc6bc..f40b41ff2f 100644 --- a/dists/msvc8/igor.vcproj +++ b/dists/msvc8/igor.vcproj @@ -8,321 +8,52 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + - - diff --git a/dists/msvc8/kyra.vcproj b/dists/msvc8/kyra.vcproj index 940be7996f..7aba5b0856 100644 --- a/dists/msvc8/kyra.vcproj +++ b/dists/msvc8/kyra.vcproj @@ -8,629 +8,128 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/lure.vcproj b/dists/msvc8/lure.vcproj index 5102e74117..221eccf426 100644 --- a/dists/msvc8/lure.vcproj +++ b/dists/msvc8/lure.vcproj @@ -8,341 +8,56 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/m4.vcproj b/dists/msvc8/m4.vcproj index 9d27e60132..b522ecef78 100644 --- a/dists/msvc8/m4.vcproj +++ b/dists/msvc8/m4.vcproj @@ -8,397 +8,70 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/made.vcproj b/dists/msvc8/made.vcproj index 13b32b61d5..aa2a2ec01e 100644 --- a/dists/msvc8/made.vcproj +++ b/dists/msvc8/made.vcproj @@ -8,265 +8,37 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/parallaction.vcproj b/dists/msvc8/parallaction.vcproj index 75b32bbf6e..ee4bb0ce23 100644 --- a/dists/msvc8/parallaction.vcproj +++ b/dists/msvc8/parallaction.vcproj @@ -8,345 +8,57 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/queen.vcproj b/dists/msvc8/queen.vcproj index eec37976bf..610d90738c 100644 --- a/dists/msvc8/queen.vcproj +++ b/dists/msvc8/queen.vcproj @@ -8,329 +8,53 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/saga.vcproj b/dists/msvc8/saga.vcproj index 4cd1c62a7c..f6d6e7b87b 100644 --- a/dists/msvc8/saga.vcproj +++ b/dists/msvc8/saga.vcproj @@ -8,405 +8,72 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/sci.vcproj b/dists/msvc8/sci.vcproj index b85419c515..ec0c392a49 100644 --- a/dists/msvc8/sci.vcproj +++ b/dists/msvc8/sci.vcproj @@ -8,625 +8,132 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/scumm.vcproj b/dists/msvc8/scumm.vcproj index 6e9e70da97..e71317ac16 100644 --- a/dists/msvc8/scumm.vcproj +++ b/dists/msvc8/scumm.vcproj @@ -8,837 +8,186 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/scummvm.sln b/dists/msvc8/scummvm.sln index 6c5bee71e4..810ce8498c 100644 --- a/dists/msvc8/scummvm.sln +++ b/dists/msvc8/scummvm.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 +# Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scummvm", "scummvm.vcproj", "{8434CB15-D08F-427D-9E6D-581AE5B28440}" ProjectSection(ProjectDependencies) = postProject {8863B00B-059A-471E-876D-A955ECEFD0D2} = {8863B00B-059A-471E-876D-A955ECEFD0D2} diff --git a/dists/msvc8/scummvm.vcproj b/dists/msvc8/scummvm.vcproj index 93c6232f67..27e37add0b 100644 --- a/dists/msvc8/scummvm.vcproj +++ b/dists/msvc8/scummvm.vcproj @@ -8,984 +8,209 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - + + + + + - - - - - + + + - - - - - - - - - - - - + + + + + + + @@ -1008,549 +233,152 @@ /> - - - - + + - - - - - - - - - - - - - - - - + + + + + + + + + - - - + + - - - - - + + + - - - - - - - + + + + - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1573,14 +401,8 @@ /> - - - - + + @@ -1603,169 +425,51 @@ /> - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - diff --git a/dists/msvc8/sky.vcproj b/dists/msvc8/sky.vcproj index 5a91684f7c..5a9b6117d3 100644 --- a/dists/msvc8/sky.vcproj +++ b/dists/msvc8/sky.vcproj @@ -8,345 +8,58 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/sword1.vcproj b/dists/msvc8/sword1.vcproj index b21f4ec22b..e09577e5c5 100644 --- a/dists/msvc8/sword1.vcproj +++ b/dists/msvc8/sword1.vcproj @@ -8,317 +8,50 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/sword2.vcproj b/dists/msvc8/sword2.vcproj index b90f38be9f..d0cbe3d639 100644 --- a/dists/msvc8/sword2.vcproj +++ b/dists/msvc8/sword2.vcproj @@ -8,361 +8,61 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/tinsel.vcproj b/dists/msvc8/tinsel.vcproj index b14cf9735a..07f3975a6e 100644 --- a/dists/msvc8/tinsel.vcproj +++ b/dists/msvc8/tinsel.vcproj @@ -8,513 +8,101 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc8/touche.vcproj b/dists/msvc8/touche.vcproj index d314a910da..b05b3e98ad 100644 --- a/dists/msvc8/touche.vcproj +++ b/dists/msvc8/touche.vcproj @@ -8,213 +8,24 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - diff --git a/dists/msvc8/tucker.vcproj b/dists/msvc8/tucker.vcproj index 9dae4e7fa3..0d7e5ed2fb 100644 --- a/dists/msvc8/tucker.vcproj +++ b/dists/msvc8/tucker.vcproj @@ -8,205 +8,22 @@ Keyword="Win32Proj" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - diff --git a/dists/msvc8_to_msvc7_71.bat b/dists/msvc8_to_msvc7_71.bat deleted file mode 100644 index 146403f268..0000000000 --- a/dists/msvc8_to_msvc7_71.bat +++ /dev/null @@ -1,102 +0,0 @@ -@echo off -rem This batch file is used to convert MSVC8 (Visual Studio 2005) project files to -rem MSVC71 (Visual Studio 2003) and MSVC7 (Visual Studio 2002) ones -rem You need the Windows version of GNU rpl -rem Get it here: -rem http://gnuwin32.sourceforge.net/packages/rpl.htm -rem Place rpl.exe from the bin folder inside the archive in the folder where -rem this batch file resides - -if not exist rpl.exe goto no_rpl - -echo Creating MSVC71 project files from the MSVC8 ones -copy /y msvc8\*.vcproj msvc71\ -copy /y msvc8\*.sln msvc71\ -rpl -e -q "Version=\"8.00\"" "Version=\"7.10\"" msvc71\*.vcproj -rpl -e -q "Version=\"8,00\"" "Version=\"7,10\"" msvc71\*.vcproj -for %%i in (msvc71\*.vcproj) do rpl -e -q "RootNamespace=\"%%~ni\"\n" "" %%i -rpl -e -q "RootNamespace=" "#RootNamespace=" msvc71\*.vcproj -rpl -e -q "\t\tKeyword=" "\tKeyword=" msvc71\*.vcproj -rpl -e -q "\t\n\t\n" "" msvc71\*.vcproj -rpl -e -q " /wd4996" "" msvc71\*.vcproj -rpl -e -q "ExceptionHandling=\"1\"" "ExceptionHandling=\"true\"" msvc71\*.vcproj -rpl -e -q "\t\t\t\n" "" msvc71\*.vcproj -rpl -e -q "\t\t\t\n" "" msvc71\*.vcproj -rpl -e -q "\t\t\t\n" "" msvc71\*.vcproj -rpl -e -q "\t\t\t\n" "" msvc71\*.vcproj -rpl -e -q "\t\t\t\n" "" msvc71\*.vcproj -rpl -e -q "\t\t\t\n" "" msvc71\*.vcproj -rpl -e -q "WholeProgramOptimization=\"1\"" "WholeProgramOptimization=\"true\"" msvc71\*.vcproj -rpl -e -q "ExceptionHandling=\"1\"" "ExceptionHandling=\"true\"" msvc71\*.vcproj -rem Change multi-line XML closing tags to single line -rpl -e -q "\"\n\t\0x3e\n" "\"\0x3e\n" msvc71\*.vcproj -rpl -e -q "\"\n\t/\0x3e\n" "\"/\0x3e\n" msvc71\*.vcproj -rpl -e -q "\"\n\t\t\0x3e\n" "\"\0x3e\n" msvc71\*.vcproj -rpl -e -q "\"\n\t\t/\0x3e\n" "\"/\0x3e\n" msvc71\*.vcproj -rpl -e -q "\"\n\t\t\t\0x3e\n" "\"\0x3e\n" msvc71\*.vcproj -rpl -e -q "\"\n\t\t\t/\0x3e\n" "\"/\0x3e\n" msvc71\*.vcproj -rpl -e -q "\"\n\t\t\t\t\0x3e\n" "\"\0x3e\n" msvc71\*.vcproj -rpl -e -q "\"\n\t\t\t\t/\0x3e\n" "\"/\0x3e\n" msvc71\*.vcproj -rpl -e -q "\"\n\t\t\t\t\t\0x3e\n" "\"\0x3e\n" msvc71\*.vcproj -rpl -e -q "\"\n\t\t\t\t\t/\0x3e\n" "\"/\0x3e\n" msvc71\*.vcproj -rpl -e -q "\"\n\t\t\t\t\t\t\0x3e\n" "\"\0x3e\n" msvc71\*.vcproj -rpl -e -q "\"\n\t\t\t\t\t\t/\0x3e\n" "\"/\0x3e\n" msvc71\*.vcproj -rem Change lower case true and false to upper case -rpl -e -q "\"true\"" "\"TRUE\"" msvc71\*.vcproj -rpl -e -q "\"false\"" "\"FALSE\"" msvc71\*.vcproj -rem The following are mainly line swaps to keep layout the same -rpl -e -q "\t\t\t\n" "" msvc71\*.vcproj -rpl -e -q "\t\t\t\n" "" msvc71\*.vcproj -rpl -e -q "\t\t\t\n" "" msvc71\*.vcproj -rpl -e -q "\t\t\t\n" "" msvc71\*.vcproj -rpl -e -q "\t\t\t\n" "" msvc71\*.vcproj -rpl -e -q "\t\t\t\n" "" msvc71\*.vcproj -rpl -e -q ".lib\"/\0x3e\n" ".lib\"/\0x3e\n\t\t\t\n" "\"VCPostBuildEventTool\"/>\n\t\t\t\n" msvc71\*.vcproj -rpl -e -q "\"VCPreBuildEventTool\"/>\n" "\"VCPreBuildEventTool\"/>\n\t\t\t\n" msvc71\*.vcproj -rpl -e -q "\"VCPreLinkEventTool\"/>\n" "\"VCPreLinkEventTool\"/>\n\t\t\t\n" msvc71\*.vcproj -rpl -e -q "\"VCResourceCompilerTool\"/>\n" "\"VCResourceCompilerTool\"/>\n\t\t\t\n" msvc71\*.vcproj -rpl -e -q "\"VCWebServiceProxyGeneratorTool\"/>\n" "\"VCWebServiceProxyGeneratorTool\"/>\n\t\t\t\n" msvc71\*.vcproj -rpl -e -q "\"VCXMLDataGeneratorTool\"/>\n" "\"VCXMLDataGeneratorTool\"/>\n\t\t\t\n" msvc71\*.vcproj -rpl -e -q "\"VCManagedWrapperGeneratorTool\"/>\n" "\"VCManagedWrapperGeneratorTool\"/>\n\t\t\t\n" msvc71\*.vcproj - -rpl -e -q "Format Version 9.00" "Format Version 8.00" msvc71\scummvm.sln -rpl -e -q "Format Version 9,00" "Format Version 8,00" msvc71\scummvm.sln -rpl -e -q "# Visual C++ Express 2005\n" "" msvc71\scummvm.sln -rpl -e -q "# Visual Studio 2005\n" "" msvc71\scummvm.sln -rpl -e -q "\"\nEndProject\n" "\"\n\tProjectSection(ProjectDependencies) = postProject\n\tEndProjectSection\nEndProject\n" msvc71\scummvm.sln -rpl -e -q "SolutionConfigurationPlatforms" "SolutionConfiguration" msvc71\scummvm.sln -rpl -e -q "ProjectConfigurationPlatforms" "ProjectDependencies" msvc71\scummvm.sln -rpl -e -q "Debug|Win32 = Debug|Win32" "Debug = Debug" msvc71\scummvm.sln -rpl -e -q "Release|Win32 = Release|Win32" "Release = Release" msvc71\scummvm.sln -rpl -e -q "EndGlobal\n" "\tGlobalSection(ExtensibilityGlobals) = postSolution\n\tEndGlobalSection\nEndGlobal\n" msvc71\scummvm.sln -rpl -e -q "EndGlobal\n" "\tGlobalSection(ExtensibilityAddIns) = postSolution\n\tEndGlobalSection\nEndGlobal\n" msvc71\scummvm.sln - -echo Creating MSVC71 project files from the MSVC7 ones -copy /y msvc71\*.vcproj msvc7\ -copy /y msvc71\*.sln msvc7\ -rpl -e -q "Version=\"7.10\"" "Version=\"7.00\"" msvc7\*.vcproj -rpl -e -q "Version=\"7,10\"" "Version=\"7,00\"" msvc7\*.vcproj -rpl -e -q "\t\t\t\n" "" msvc7\*.vcproj -rpl -e -q "\t\t\t\n" "" msvc7\*.vcproj -rpl -e -q "\t\t\t\n" "" msvc7\*.vcproj -rpl -e -q "\t\n\t\n" "" msvc7\*.vcproj - -rpl -e -q "Format Version 8.00" "Format Version 7.00" msvc7\scummvm.sln -rpl -e -q "Format Version 8,00" "Format Version 7,00" msvc7\scummvm.sln -rpl -e -q "\tProjectSection(ProjectDependencies) = postProject\n\tEndProjectSection\n" "" msvc7\scummvm.sln -goto the_end - -:no_rpl -echo You need the Windows version of GNU rpl -echo Get it here: -echo http://gnuwin32.sourceforge.net/packages/rpl.htm -echo Place rpl.exe from the bin folder inside the archive in the folder where -echo this batch file resides - -:the_end -pause diff --git a/dists/msvc8_to_msvc9.bat b/dists/msvc8_to_msvc9.bat index b8d62b9244..1faacbd1a6 100644 --- a/dists/msvc8_to_msvc9.bat +++ b/dists/msvc8_to_msvc9.bat @@ -11,14 +11,12 @@ if not exist rpl.exe goto no_rpl echo Creating MSVC9 project files from the MSVC8 ones copy /y msvc8\*.vcproj msvc9\ copy /y msvc8\*.sln msvc9\ +copy /y msvc8\*.vsprops msvc9\ rpl -e -q "Version=\"8.00\"" "Version=\"9.00\"" msvc9\*.vcproj rpl -e -q "Version=\"8,00\"" "Version=\"9,00\"" msvc9\*.vcproj rpl -e -q "Keyword=\"Win32Proj\"" "Keyword=\"Win32Proj\"\n\tTargetFrameworkVersion=\"131072\"" msvc9\*.vcproj -rpl -e -q "EntryPointSymbol=\"WinMainCRTStartup\"" "EntryPointSymbol=\"WinMainCRTStartup\"\n\t\t\t\tRandomizedBaseAddress=\"1\"\n\t\t\t\tDataExecutionPrevention=\"0\"" msvc9\scummvm.vcproj rpl -e -q "Format Version 9.00" "Format Version 10.00" msvc9\scummvm.sln rpl -e -q "Format Version 9,00" "Format Version 10,00" msvc9\scummvm.sln -rpl -e -q "# Visual C++ Express 2005" "# Visual C++ Express 2008" msvc9\scummvm.sln -rpl -e -q "# Visual Studio 2005" "# Visual Studio 2008" msvc9\scummvm.sln goto the_end :no_rpl diff --git a/dists/msvc9/ScummVM_Debug.vsprops b/dists/msvc9/ScummVM_Debug.vsprops new file mode 100644 index 0000000000..910096cab6 --- /dev/null +++ b/dists/msvc9/ScummVM_Debug.vsprops @@ -0,0 +1,25 @@ + + + + + diff --git a/dists/msvc9/ScummVM_Global.vsprops b/dists/msvc9/ScummVM_Global.vsprops new file mode 100644 index 0000000000..7ba00aac7b --- /dev/null +++ b/dists/msvc9/ScummVM_Global.vsprops @@ -0,0 +1,30 @@ + + + + + + diff --git a/dists/msvc9/ScummVM_Release.vsprops b/dists/msvc9/ScummVM_Release.vsprops new file mode 100644 index 0000000000..837be3b94c --- /dev/null +++ b/dists/msvc9/ScummVM_Release.vsprops @@ -0,0 +1,24 @@ + + + + + diff --git a/dists/msvc9/agi.vcproj b/dists/msvc9/agi.vcproj index de79be933d..5b5494cfe1 100644 --- a/dists/msvc9/agi.vcproj +++ b/dists/msvc9/agi.vcproj @@ -9,377 +9,65 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/agos.vcproj b/dists/msvc9/agos.vcproj index a5126717d4..b352dff3e1 100644 --- a/dists/msvc9/agos.vcproj +++ b/dists/msvc9/agos.vcproj @@ -9,393 +9,69 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/cine.vcproj b/dists/msvc9/cine.vcproj index 68d12a8f52..c78db8e649 100644 --- a/dists/msvc9/cine.vcproj +++ b/dists/msvc9/cine.vcproj @@ -9,317 +9,50 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/cruise.vcproj b/dists/msvc9/cruise.vcproj index a6f521b721..1a68736c66 100644 --- a/dists/msvc9/cruise.vcproj +++ b/dists/msvc9/cruise.vcproj @@ -9,397 +9,70 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/drascula.vcproj b/dists/msvc9/drascula.vcproj index a0ed0eaa09..786436608f 100644 --- a/dists/msvc9/drascula.vcproj +++ b/dists/msvc9/drascula.vcproj @@ -9,221 +9,26 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/gob.vcproj b/dists/msvc9/gob.vcproj index 306f12c1a3..8852e59fa3 100644 --- a/dists/msvc9/gob.vcproj +++ b/dists/msvc9/gob.vcproj @@ -9,645 +9,133 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/groovie.vcproj b/dists/msvc9/groovie.vcproj index 61c18ab6da..c3ce8f0f58 100644 --- a/dists/msvc9/groovie.vcproj +++ b/dists/msvc9/groovie.vcproj @@ -9,275 +9,41 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/igor.vcproj b/dists/msvc9/igor.vcproj index b812db787c..0d0b8739a7 100644 --- a/dists/msvc9/igor.vcproj +++ b/dists/msvc9/igor.vcproj @@ -9,321 +9,52 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + - - diff --git a/dists/msvc9/kyra.vcproj b/dists/msvc9/kyra.vcproj index e3902094e5..98b2609718 100644 --- a/dists/msvc9/kyra.vcproj +++ b/dists/msvc9/kyra.vcproj @@ -9,629 +9,128 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/lure.vcproj b/dists/msvc9/lure.vcproj index 2915a69dbc..a4590a40e7 100644 --- a/dists/msvc9/lure.vcproj +++ b/dists/msvc9/lure.vcproj @@ -9,341 +9,56 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/m4.vcproj b/dists/msvc9/m4.vcproj index 89cf4cef78..3bd8fc1e5c 100644 --- a/dists/msvc9/m4.vcproj +++ b/dists/msvc9/m4.vcproj @@ -9,397 +9,70 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/made.vcproj b/dists/msvc9/made.vcproj index 880b484be3..5272eae1b5 100644 --- a/dists/msvc9/made.vcproj +++ b/dists/msvc9/made.vcproj @@ -9,265 +9,37 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/parallaction.vcproj b/dists/msvc9/parallaction.vcproj index f5fc1cee79..acefaedf41 100644 --- a/dists/msvc9/parallaction.vcproj +++ b/dists/msvc9/parallaction.vcproj @@ -9,345 +9,57 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/queen.vcproj b/dists/msvc9/queen.vcproj index 384cede45c..787cbfab93 100644 --- a/dists/msvc9/queen.vcproj +++ b/dists/msvc9/queen.vcproj @@ -9,329 +9,53 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/saga.vcproj b/dists/msvc9/saga.vcproj index 98ef1b426b..993793d7b3 100644 --- a/dists/msvc9/saga.vcproj +++ b/dists/msvc9/saga.vcproj @@ -9,405 +9,72 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/sci.vcproj b/dists/msvc9/sci.vcproj index 3a90afd545..d5a5f37f6c 100644 --- a/dists/msvc9/sci.vcproj +++ b/dists/msvc9/sci.vcproj @@ -9,625 +9,132 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/scumm.vcproj b/dists/msvc9/scumm.vcproj index d9214f7ff0..c2c116ef8b 100644 --- a/dists/msvc9/scumm.vcproj +++ b/dists/msvc9/scumm.vcproj @@ -9,837 +9,186 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/scummvm.vcproj b/dists/msvc9/scummvm.vcproj index 730988c8a7..edcf9c4ebc 100644 --- a/dists/msvc9/scummvm.vcproj +++ b/dists/msvc9/scummvm.vcproj @@ -9,988 +9,209 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - + + + + + - - - - - + + + - - - - - - - - - - - - + + + + + + + @@ -1013,549 +234,152 @@ /> - - - - + + - - - - - - - - - - - - - - - - + + + + + + + + + - - - + + - - - - - + + + - - - - - - - + + + + - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1578,14 +402,8 @@ /> - - - - + + @@ -1608,169 +426,51 @@ /> - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - diff --git a/dists/msvc9/sky.vcproj b/dists/msvc9/sky.vcproj index 82a5131fdf..bc412315b2 100644 --- a/dists/msvc9/sky.vcproj +++ b/dists/msvc9/sky.vcproj @@ -9,345 +9,58 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/sword1.vcproj b/dists/msvc9/sword1.vcproj index c94cbe387f..13dfb89db9 100644 --- a/dists/msvc9/sword1.vcproj +++ b/dists/msvc9/sword1.vcproj @@ -9,317 +9,50 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/sword2.vcproj b/dists/msvc9/sword2.vcproj index fb8c4d8db1..bcca55b340 100644 --- a/dists/msvc9/sword2.vcproj +++ b/dists/msvc9/sword2.vcproj @@ -9,361 +9,61 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/tinsel.vcproj b/dists/msvc9/tinsel.vcproj index 21638f9856..8f6a060bb9 100644 --- a/dists/msvc9/tinsel.vcproj +++ b/dists/msvc9/tinsel.vcproj @@ -9,513 +9,101 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/dists/msvc9/touche.vcproj b/dists/msvc9/touche.vcproj index 0ff5673c56..02167e4cf4 100644 --- a/dists/msvc9/touche.vcproj +++ b/dists/msvc9/touche.vcproj @@ -9,213 +9,24 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - diff --git a/dists/msvc9/tucker.vcproj b/dists/msvc9/tucker.vcproj index 3d08c60c3a..5589745a4f 100644 --- a/dists/msvc9/tucker.vcproj +++ b/dists/msvc9/tucker.vcproj @@ -9,205 +9,22 @@ TargetFrameworkVersion="131072" > - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - diff --git a/dists/msvc9_to_msvc8.bat b/dists/msvc9_to_msvc8.bat index 39fab8bc4a..c4e4e17cb9 100644 --- a/dists/msvc9_to_msvc8.bat +++ b/dists/msvc9_to_msvc8.bat @@ -11,15 +11,12 @@ if not exist rpl.exe goto no_rpl echo Creating MSVC8 project files from the MSVC9 ones copy /y msvc9\*.vcproj msvc8\ copy /y msvc9\*.sln msvc8\ +copy /y msvc9\*.vsprops msvc8\ rpl -e -q "Version=\"9.00\"" "Version=\"8.00\"" msvc8\*.vcproj rpl -e -q "Version=\"9,00\"" "Version=\"8,00\"" msvc8\*.vcproj rpl -e -q "\tTargetFrameworkVersion=\"131072\"\n" "" msvc8\*.vcproj -rpl -e -q "\t\t\t\tRandomizedBaseAddress=\"1\"\n" "" msvc8\scummvm.vcproj -rpl -e -q "\t\t\t\tDataExecutionPrevention=\"0\"\n" "" msvc8\scummvm.vcproj rpl -e -q "Format Version 10.00" "Format Version 9.00" msvc8\scummvm.sln rpl -e -q "Format Version 10,00" "Format Version 9,00" msvc8\scummvm.sln -rpl -e -q "# Visual C++ Express 2008" "# Visual C++ Express 2005" msvc8\scummvm.sln -rpl -e -q "# Visual Studio 2008" "# Visual Studio 2005" msvc8\scummvm.sln goto the_end :no_rpl -- cgit v1.2.3 From a0a675e42d71df188da25fa3b8fab99249874ee9 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 9 Jul 2009 15:15:49 +0000 Subject: Reverted commit #42257, as the original issue was with the compilation process of MSVC and the ENABLE_* checks work correctly svn-id: r42289 --- graphics/sjis.cpp | 13 ++++--------- graphics/sjis.h | 10 ++++++++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/graphics/sjis.cpp b/graphics/sjis.cpp index 95736cf401..5392a1c9a4 100644 --- a/graphics/sjis.cpp +++ b/graphics/sjis.cpp @@ -23,15 +23,10 @@ */ #include "graphics/sjis.h" -#include "common/debug.h" -// The code in this file is currently only used in KYRA and SCI. -// So if neither of those is enabled, we will skip compiling it. -// If you plan to use this code in another engine, you will have -// to add the proper define check here. -// Also please add the define check at the comment after the -// matching #endif further down this file. -#if defined(ENABLE_KYRA) || defined(ENABLE_SCI) +#ifdef GRAPHICS_SJIS_H + +#include "common/debug.h" namespace Graphics { @@ -198,5 +193,5 @@ uint FontTowns::sjisToChunk(uint8 f, uint8 s) { } // end of namespace Graphics -#endif // defined(ENABLE_KYRA) || defined(ENABLE_SCI) +#endif // defined(GRAPHICS_SJIS_H) diff --git a/graphics/sjis.h b/graphics/sjis.h index c7eeeed9f6..f7321742af 100644 --- a/graphics/sjis.h +++ b/graphics/sjis.h @@ -22,6 +22,14 @@ * $Id$ */ +// The code in this file is currently only used in KYRA and SCI. +// So if neither of those is enabled, we will skip compiling it. +// If you plan to use this code in another engine, you will have +// to add the proper define check here. +// Also please add the define check at the comment after the +// matching #endif further down this file. +#if defined(ENABLE_KYRA) || defined(ENABLE_SCI) + #ifndef GRAPHICS_SJIS_H #define GRAPHICS_SJIS_H @@ -123,3 +131,5 @@ private: #endif +#endif // defined(ENABLE_KYRA) || defined(ENABLE_SCI) + -- cgit v1.2.3 From b1bd18040808a7632c6d74eed2ccb97d569af1f4 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 9 Jul 2009 15:17:45 +0000 Subject: Added proper safeguards for shorten.*, thereby fixing commit 42259 svn-id: r42290 --- sound/shorten.cpp | 13 ++++--------- sound/shorten.h | 12 ++++++++++++ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/sound/shorten.cpp b/sound/shorten.cpp index d1031aed3a..e8066a49be 100644 --- a/sound/shorten.cpp +++ b/sound/shorten.cpp @@ -23,13 +23,9 @@ * */ -// The code in this file is currently only used in SAGA2 (in the -// SAGA engine), so if that engine isn't enabled, we will skip -// compiling it. If you plan to use this code in another engine, -// you will have to add the proper define check here. -// Also please add the define check at the comment after the -// matching #endif further down this file. -#if defined(ENABLE_SAGA2) +#include "sound/shorten.h" + +#ifdef SOUND_SHORTEN_H // Based on etree's Shorten tool, version 3.6.1 // http://etree.org/shnutils/shorten/ @@ -40,7 +36,6 @@ #include "common/util.h" #include "common/stream.h" -#include "sound/shorten.h" #include "sound/audiostream.h" #include "sound/mixer.h" @@ -535,5 +530,5 @@ AudioStream *makeShortenStream(Common::SeekableReadStream &stream) { } // End of namespace Audio -#endif // defined(ENABLE_SAGA2) +#endif // defined(SOUND_SHORTEN_H) diff --git a/sound/shorten.h b/sound/shorten.h index fa45ecc65d..c2a40280d3 100644 --- a/sound/shorten.h +++ b/sound/shorten.h @@ -23,6 +23,14 @@ * */ +// The code in this file is currently only used in SAGA2 (in the +// SAGA engine), so if that engine isn't enabled, we will skip +// compiling it. If you plan to use this code in another engine, +// you will have to add the proper define check here. +// Also please add the define check at the comment after the +// matching #endif further down this file. +#if defined(ENABLE_SAGA2) + #ifndef SOUND_SHORTEN_H #define SOUND_SHORTEN_H @@ -53,3 +61,7 @@ AudioStream *makeShortenStream(Common::ReadStream &stream); } // End of namespace Audio #endif + +#endif // defined(ENABLE_SAGA2) + + -- cgit v1.2.3 From a7c96e15268d15a0a13f0cf5321a7c51587aa3f9 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 9 Jul 2009 15:32:06 +0000 Subject: Cleanup. svn-id: r42292 --- engines/kyra/lol.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index f2617dc8b4..4be0e413e1 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -1901,7 +1901,7 @@ int LoLEngine::castSpell(int charNum, int spellType, int spellLevel) { _activeSpell.spell = spellType; _activeSpell.p = &_spellProperties[spellType]; - _activeSpell.level = spellLevel < 0 ? -spellLevel : spellLevel; + _activeSpell.level = ABS(spellLevel); if ((_spellProperties[spellType].flags & 0x100) && testWallFlag(calcNewBlockPosition(_currentBlock, _currentDirection), _currentDirection, 1)) { _txt->printMessage(2, getLangString(0x4257)); -- cgit v1.2.3 From a17333ed1b817303ca08b0f73fbdf4bf9bdef1fd Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 9 Jul 2009 15:32:25 +0000 Subject: Cleanup rollDice (the results of the old and the new function are almost identical). svn-id: r42293 --- engines/kyra/lol.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 4be0e413e1..d2c8be9556 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -1877,15 +1877,8 @@ int LoLEngine::rollDice(int times, int pips) { return 0; int res = 0; - int d = 0; - - do { - int val = (((int)_rnd.getRandomNumber(0x7fff) * pips) / 0x8000) + 1; - if (val > pips) - val -= pips; - res += val; - d++; - } while (d < times); + while (times--) + res += _rnd.getRandomNumberRng(1, pips); return res; } -- cgit v1.2.3 From 982153e0ab72214c6a6a51caee32bb018cbbdabb Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 9 Jul 2009 15:46:26 +0000 Subject: restAdjust should be a signed integer. Fixes crashes with SCI1 games that take absolute lofs parameters (a regression of commit #42260) svn-id: r42297 --- engines/sci/debug.h | 2 +- engines/sci/engine/state.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/sci/debug.h b/engines/sci/debug.h index ccf0602600..0963159c98 100644 --- a/engines/sci/debug.h +++ b/engines/sci/debug.h @@ -46,7 +46,7 @@ struct ScriptState { int old_pc_offset; StackPtr old_sp; ExecStack *xs; - uint16 restadjust; + int16 restadjust; reg_t *variables[4]; // global, local, temp, param, as immediate pointers reg_t *variables_base[4]; // Used for referencing VM ops SegmentId variables_seg[4]; // Same as above, contains segment IDs diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index 92a5b5e411..1759b26dcb 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -208,7 +208,7 @@ public: bool _executionStackPosChanged; /**< Set to true if the execution stack position should be re-evaluated by the vm */ reg_t r_acc; /**< Accumulator */ - uint16 restAdjust; /**< &rest register (only used for save games) */ + int16 restAdjust; /**< &rest register (only used for save games) */ reg_t r_prev; /**< previous comparison result */ SegmentId stack_segment; /**< Heap area for the stack to use */ -- cgit v1.2.3 From 717de7800c9bd6b822d56771393beec42f3bc1bb Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 9 Jul 2009 15:54:18 +0000 Subject: Applied patch #2818845 - "SCI: resource.map detection for SCI1/1.1 fixed", with some slight formatting changes svn-id: r42300 --- engines/sci/detection.cpp | 8 +++---- engines/sci/resource.cpp | 54 ++++++++++++++++++++++++++++++----------------- 2 files changed, 39 insertions(+), 23 deletions(-) diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index a9dac98572..a80baf182e 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -1850,7 +1850,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "4462fe48c7452d98fddcec327a3e738d", 5789138}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, 0, - SCI_VERSION_1_1, + SCI_VERSION_AUTODETECT, SCI_VERSION_1_1 }, @@ -1861,7 +1861,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "57d5fe8bb9e044158514476ea7678eb0", 5754790}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NONE}, 0, - SCI_VERSION_1_1, + SCI_VERSION_AUTODETECT, SCI_VERSION_1_1 }, @@ -2574,7 +2574,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "ecace1a2771846b1a8aa1afdd44111a0", 6570147}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, 0, - SCI_VERSION_1, + SCI_VERSION_AUTODETECT, SCI_VERSION_1_1 }, @@ -2585,7 +2585,7 @@ static const struct SciGameDescription SciGameDescriptions[] = { {"resource.000", 0, "ec6f5cf369054dd3e5392995e9975b9e", 768218}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH}, 0, - SCI_VERSION_1, + SCI_VERSION_AUTODETECT, SCI_VERSION_1_1 }, diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 30e917557d..a1d7fa7a41 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -728,26 +728,39 @@ int ResourceManager::detectMapVersion() { } return SCI_VERSION_0; } - // SCI1E/L and some SCI1.1 maps have last directory entry set to 0xFF - // and offset set to filesize - // SCI1 have 6-bytes entries, while SCI1.1 have 5-byte entries - file.seek(1, SEEK_SET); - uint16 off1, off = file.readUint16LE(); - uint16 nEntries = off / 3; - file.seek(1, SEEK_CUR); - file.seek(off - 3, SEEK_SET); - if (file.readByte() == 0xFF && file.readUint16LE() == file.size()) { - file.seek(3, SEEK_SET); - for (int i = 0; i < nEntries; i++) { - file.seek(1, SEEK_CUR); - off1 = file.readUint16LE(); - if ((off1 - off) % 5 && (off1 - off) % 6 == 0) - return SCI_VERSION_1; - if ((off1 - off) % 5 == 0 && (off1 - off) % 6) - return SCI_VERSION_1_1; - off = off1; + + // SCI1 and SCI1.1 maps consist of a fixed 3-byte header, a directory list (3-bytes each) that has one entry + // of id FFh and points to EOF. The actual entries have 6-bytes on SCI1 and 5-bytes on SCI1.1 + byte directoryType = 0; + uint16 directoryOffset = 0; + uint16 lastDirectoryOffset = 0; + uint16 directorySize = 0; + int mapDetected = 0; + file.seek(0, SEEK_SET); + while (!file.eos()) { + directoryType = file.readByte(); + directoryOffset = file.readUint16LE(); + if ((directoryType < 0x80) || ((directoryType > 0xA0) && (directoryType != 0xFF))) + break; + // Offset is above file size? -> definitely not SCI1/SCI1.1 + if (directoryOffset > file.size()) + break; + if (lastDirectoryOffset) { + directorySize = directoryOffset - lastDirectoryOffset; + if ((directorySize % 5) && (directorySize % 6 == 0)) + mapDetected = SCI_VERSION_1; + if ((directorySize % 5 == 0) && (directorySize % 6)) + mapDetected = SCI_VERSION_1_1; } - return SCI_VERSION_1; + if (directoryType==0xFF) { + // FFh entry needs to point to EOF + if (directoryOffset != file.size()) + break; + if (mapDetected) + return mapDetected; + return SCI_VERSION_1; + } + lastDirectoryOffset = directoryOffset; } #ifdef ENABLE_SCI32 @@ -974,6 +987,9 @@ int ResourceManager::readResourceMapSCI0(ResourceSource *map) { res->file_offset = offset & (((~bMask) << 24) | 0xFFFFFF); res->id = resId; res->source = getVolume(map, offset >> bShift); + if (!res->source) { + warning("Could not get volume for resource %d, VolumeID %d\n", resId, offset >> bShift); + } _resMap.setVal(resId, res); } } while (!file.eos()); -- cgit v1.2.3 From 0aa83f14c760ae790b738e5957fb8c3d9930697f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 9 Jul 2009 15:59:20 +0000 Subject: Fix wrong format arugment. svn-id: r42301 --- engines/sci/resource.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index a1d7fa7a41..9d791f615c 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -988,7 +988,7 @@ int ResourceManager::readResourceMapSCI0(ResourceSource *map) { res->id = resId; res->source = getVolume(map, offset >> bShift); if (!res->source) { - warning("Could not get volume for resource %d, VolumeID %d\n", resId, offset >> bShift); + warning("Could not get volume for resource %d, VolumeID %d\n", id, offset >> bShift); } _resMap.setVal(resId, res); } -- cgit v1.2.3 From 1ac515c629898f7642d55588141d6168293a9331 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 9 Jul 2009 16:16:08 +0000 Subject: By comparing the commit log of r42300, it seems that "off" was renamed to "lastDirectoryOffset". I changed the SCI32 specific code to use that now. I can't assure this is anyhow correct, so anyone with knowledge of this code please check it. svn-id: r42303 --- engines/sci/resource.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 9d791f615c..b248729503 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -766,7 +766,7 @@ int ResourceManager::detectMapVersion() { #ifdef ENABLE_SCI32 // late SCI1.1 and SCI32 maps have last directory entry set to 0xFF // offset set to filesize and 4 more bytes - file.seek(off - 7, SEEK_SET); + file.seek(lastDirectoryOffset - 7, SEEK_SET); if (file.readByte() == 0xFF && file.readUint16LE() == file.size()) return SCI_VERSION_32; // TODO : check if there is a difference between these maps #endif -- cgit v1.2.3 From 5d0d67e5742d9a65ad9c944a86ff3223ff967042 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 9 Jul 2009 16:23:22 +0000 Subject: Add fixme about SCI32 specific code. svn-id: r42305 --- engines/sci/resource.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index b248729503..6d33c77179 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -766,6 +766,12 @@ int ResourceManager::detectMapVersion() { #ifdef ENABLE_SCI32 // late SCI1.1 and SCI32 maps have last directory entry set to 0xFF // offset set to filesize and 4 more bytes + + // TODO/FIXME: This code was not updated in r43000, which changed the behavior of this + // function a lot. To make it compile again "off" was changed to the newly introduced + // "lastDirectoryOffset". This is probably not the correct fix, since before r43000 + // the loop above could not prematurely terminate and thus this would always check the + // last directory entry instead of the last checked directory entry. file.seek(lastDirectoryOffset - 7, SEEK_SET); if (file.readByte() == 0xFF && file.readUint16LE() == file.size()) return SCI_VERSION_32; // TODO : check if there is a difference between these maps -- cgit v1.2.3 From e8e9b882275b8dc5d77db3b1faaf30466c7b7a31 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 9 Jul 2009 16:24:59 +0000 Subject: Oops specify the correct revsision number in the fixme. svn-id: r42306 --- engines/sci/resource.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 6d33c77179..5fdc286894 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -767,7 +767,7 @@ int ResourceManager::detectMapVersion() { // late SCI1.1 and SCI32 maps have last directory entry set to 0xFF // offset set to filesize and 4 more bytes - // TODO/FIXME: This code was not updated in r43000, which changed the behavior of this + // TODO/FIXME: This code was not updated in r42300, which changed the behavior of this // function a lot. To make it compile again "off" was changed to the newly introduced // "lastDirectoryOffset". This is probably not the correct fix, since before r43000 // the loop above could not prematurely terminate and thus this would always check the -- cgit v1.2.3 From 637ddaece41048f15eb0d818b0acf895ad6a0833 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 10 Jul 2009 00:49:13 +0000 Subject: Changed the status of the Tinsel engine to be enabled by default svn-id: r42322 --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index f8f01bee1c..61e1c8800d 100755 --- a/configure +++ b/configure @@ -93,7 +93,7 @@ add_engine sci32 "SCI32 games" no add_engine sky "Beneath a Steel Sky" yes add_engine sword1 "Broken Sword 1" yes add_engine sword2 "Broken Sword 2" yes -add_engine tinsel "Tinsel" no +add_engine tinsel "Tinsel" yes add_engine touche "Touche: The Adventures of the Fifth Musketeer" yes add_engine tucker "Bud Tucker in Double Trouble" yes -- cgit v1.2.3 From 03ee1c9f2c7e0050368b2ed453957dc777696051 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 10 Jul 2009 08:40:44 +0000 Subject: Mention cruise support svn-id: r42328 --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 2ab1cf239c..29a09e564f 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ For a more comprehensive changelog for the latest experimental SVN code, see: - Added support for Leather Goddesses of Phobos 2. - Added support for The Manhole. - Added support for Rodney's Funscreen. + - Added support for Cruise for a Corpse. General: - Added experimental AdLib emulator from DOSBox. -- cgit v1.2.3 From dfe8ec9be0ede93de536a9bac26974751c7e534b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 10 Jul 2009 18:53:40 +0000 Subject: Applied patch #2819665 - "SCI: cell palette fix for QfG3/SQ5/etc." svn-id: r42345 --- engines/sci/gfx/gfx_resmgr.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index 98c5c12a70..9e9a8d2d13 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -600,6 +600,8 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) { } if (!cel_data->data) { + if (!cel_data->palette) + cel_data->palette = view->palette->getref(); #ifdef CUSTOM_GRAPHICS_OPTIONS gfx_get_res_config(_options, cel_data); gfx_xlate_pixmap(cel_data, _driver->getMode(), _options->view_xlate_filter); -- cgit v1.2.3 From 4b37e6ad8c344e7075f67d23146b35250eeac484 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 10 Jul 2009 19:06:24 +0000 Subject: This is 1.0.0svn svn-id: r42346 --- base/internal_version.h | 2 +- dists/redhat/scummvm.spec | 3 +-- dists/scummvm.rc | 10 +++++----- dists/slackware/scummvm.SlackBuild | 2 +- dists/wii/meta.xml | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/base/internal_version.h b/base/internal_version.h index 8f327e9edd..0838e8ad2a 100644 --- a/base/internal_version.h +++ b/base/internal_version.h @@ -2,4 +2,4 @@ #define SCUMMVM_SVN_REVISION #endif -#define SCUMMVM_VERSION "0.14.0svn" SCUMMVM_SVN_REVISION +#define SCUMMVM_VERSION "1.0.0svn" SCUMMVM_SVN_REVISION diff --git a/dists/redhat/scummvm.spec b/dists/redhat/scummvm.spec index e98c37a2cb..75d54f357e 100644 --- a/dists/redhat/scummvm.spec +++ b/dists/redhat/scummvm.spec @@ -7,7 +7,7 @@ # Prologue information #------------------------------------------------------------------------------ Name : scummvm -Version : 0.14.0svn +Version : 1.0.0svn Release : 1 Summary : Graphic adventure game interpreter Group : Interpreters @@ -58,7 +58,6 @@ make install -m755 -D scummvm %{buildroot}%{_bindir}/scummvm install -m644 -D dists/scummvm.6 %{buildroot}%{_mandir}/man6/scummvm.6 install -m644 -D icons/scummvm.xpm %{buildroot}%{_datadir}/pixmaps/scummvm.xpm -install -m644 -D gui/themes/scummclassic.zip %{buildroot}%{_datadir}/scummvm/scummclassic.zip install -m644 -D gui/themes/scummmodern.zip %{buildroot}%{_datadir}/scummvm/scummmodern.zip install -m644 -D dists/pred.dic %{buildroot}%{_datadir}/scummvm/pred.dic install -m644 -D dists/engine-data/kyra.dat %{buildroot}%{_datadir}/scummvm/kyra.dat diff --git a/dists/scummvm.rc b/dists/scummvm.rc index 32bc97895a..7ec37a4a00 100644 --- a/dists/scummvm.rc +++ b/dists/scummvm.rc @@ -7,8 +7,8 @@ IDI_ICON ICON DISCARDABLE "../../icons/scummvm.ico" #endif VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,14,0,0 - PRODUCTVERSION 0,14,0,0 + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -25,13 +25,13 @@ BEGIN BEGIN VALUE "Comments", "Look! A three headed monkey (TM)! .. Nice use of the TM!\0" VALUE "FileDescription", "http://www.scummvm.org/\0" - VALUE "FileVersion", "0.14.0svn\0" + VALUE "FileVersion", "1.0.0svn\0" VALUE "InternalName", "scummvm\0" - VALUE "LegalCopyright", "Copyright © 2001-2009 The ScummVM Team\0" + VALUE "LegalCopyright", "Copyright © 2001-2008 The ScummVM Team\0" VALUE "LegalTrademarks", "'SCUMM', and all SCUMM games are a TM of LucasArts. Simon The Sorcerer is a TM of AdventureSoft. Beneath a Steel Sky and Broken Sword are a TM of Revolution. Flight of the Amazon Queen is a TM of John Passfield and Steve Stamatiadis. \0" VALUE "OriginalFilename", "scummvm.exe\0" VALUE "ProductName", "ScummVM\0" - VALUE "ProductVersion", "0.14.0svn\0" + VALUE "ProductVersion", "1.0.0svn\0" END END BLOCK "VarFileInfo" diff --git a/dists/slackware/scummvm.SlackBuild b/dists/slackware/scummvm.SlackBuild index 130491420b..095581bf52 100755 --- a/dists/slackware/scummvm.SlackBuild +++ b/dists/slackware/scummvm.SlackBuild @@ -8,7 +8,7 @@ if [ "$TMP" = "" ]; then fi PKG=$TMP/package-scummvm -VERSION=0.14.0svn +VERSION=1.0.0svn ARCH=i486 BUILD=1 diff --git a/dists/wii/meta.xml b/dists/wii/meta.xml index f8ccbde5e8..a0cb6838fc 100644 --- a/dists/wii/meta.xml +++ b/dists/wii/meta.xml @@ -2,7 +2,7 @@ ScummVM The ScummVM Team - 0.14.0svn@REVISION@ + 1.0.0svn@REVISION@ @TIMESTAMP@ Point & Click Adventures ScummVM is a program which allows you to run certain classic graphical point-and-click adventure games, provided you already have their data files. The clever part about this: ScummVM just replaces the executables shipped with the games, allowing you to play them on systems for which they were never designed! -- cgit v1.2.3 From ad7c50e70d09695abd8a61b5631c2883d7e6b387 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Fri, 10 Jul 2009 21:49:47 +0000 Subject: Fixing mismatched delete svn-id: r42354 --- engines/gob/video.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp index f05ee8565f..98350af738 100644 --- a/engines/gob/video.cpp +++ b/engines/gob/video.cpp @@ -62,7 +62,7 @@ Font::Font(const byte *data) : _dataPtr(data) { } Font::~Font() { - delete _dataPtr; + delete[] _dataPtr; } uint8 Font::getCharWidth(uint8 c) const { -- cgit v1.2.3 From c73e42154fa0251a85243c29ba0b3d46a13496ff Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Fri, 10 Jul 2009 22:11:36 +0000 Subject: Mention the Gob savegame format change and change the version from 0.14.0 to 1.0.0 there too svn-id: r42355 --- NEWS | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 29a09e564f..60fc870a33 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,7 @@ For a more comprehensive changelog for the latest experimental SVN code, see: http://scummvm.svn.sourceforge.net/viewvc/scummvm/?view=log -0.14.0 (2009-??-??) +1.0.0 (2009-??-??) New Games: - Added support for Discworld. - Added support for Discworld 2 - Missing Presumed ...!?. @@ -37,6 +37,10 @@ For a more comprehensive changelog for the latest experimental SVN code, see: - Dropped support for playing cutscene sound without the video. - Added support for the PlayStation version. + Gob: + - Introduced a new savegame format to fix a fatal flaw of the old one, + breaking compatibility with old savegames made on big-endian systems. + KYRA: - Added support for PC Speaker based music and sound effects. - Added support for 16 color dithering in Kyrandia PC-9801 (Japanese version -- cgit v1.2.3 From 1f24fe43a237f606f801d7ae97effef957463eb4 Mon Sep 17 00:00:00 2001 From: Fabio Battaglia Date: Fri, 10 Jul 2009 22:13:27 +0000 Subject: tinsel: proper detection entry for Discworld 1 Italian only CD svn-id: r42356 --- engines/tinsel/detection.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp index 3ca8adf30d..a3f921505a 100644 --- a/engines/tinsel/detection.cpp +++ b/engines/tinsel/detection.cpp @@ -163,6 +163,28 @@ static const TinselGameDescription gameDescriptions[] = { TINSEL_V1, }, + { // Italian CD with english speech and *.gra files. + // Note: It contains only italian subtitles, but inside english.txt + { + "dw", + "CD", + { + {"dw.gra", 0, "c8808ccd988d603dd35dff42013ae7fd", 781656}, + {"english.txt", 0, "15f0703f85477d7fab4280bf938b61c1", 237774}, + {"english.smp", 0, NULL, -1}, + {NULL, 0, NULL, 0} + }, + Common::IT_ITA, + Common::kPlatformPC, + ADGF_DROPLANGUAGE, + GUIO_NONE + }, + GID_DW1, + 0, + GF_CD | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, + TINSEL_V1, + }, + { // Multilingual CD with english speech and *.gra files. // Note: It contains no english subtitles. { @@ -187,6 +209,7 @@ static const TinselGameDescription gameDescriptions[] = { GF_CD | GF_USE_4FLAGS | GF_ENHANCED_AUDIO_SUPPORT, TINSEL_V1, }, + { { "dw", -- cgit v1.2.3 From 1462efb52dcdfb033f15c0c987bc49d64fdf73d8 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 10 Jul 2009 22:29:25 +0000 Subject: Recreate FSNode after calling checkPath since checkPath may have created the directory the FSNode points to, invalidating its cached metadata. In the future, it might be nice to add a FSNode::rescan() function for this? This fixes #2793187 . svn-id: r42357 --- backends/saves/default/default-saves.cpp | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp index 69af78404d..70b9977d8f 100644 --- a/backends/saves/default/default-saves.cpp +++ b/backends/saves/default/default-saves.cpp @@ -55,11 +55,14 @@ void DefaultSaveFileManager::checkPath(const Common::FSNode &dir) { } Common::StringList DefaultSaveFileManager::listSavefiles(const Common::String &pattern) { - Common::FSNode savePath(getSavePath()); - checkPath(savePath); + Common::String savePathName = getSavePath(); + checkPath(Common::FSNode(savePathName)); if (getError() != Common::kNoError) return Common::StringList(); + // recreate FSNode since checkPath may have changed/created the directory + Common::FSNode savePath(savePathName); + Common::FSDirectory dir(savePath); Common::ArchiveMemberList savefiles; Common::StringList results; @@ -76,11 +79,14 @@ Common::StringList DefaultSaveFileManager::listSavefiles(const Common::String &p Common::InSaveFile *DefaultSaveFileManager::openForLoading(const Common::String &filename) { // Ensure that the savepath is valid. If not, generate an appropriate error. - Common::FSNode savePath(getSavePath()); - checkPath(savePath); + Common::String savePathName = getSavePath(); + checkPath(Common::FSNode(savePathName)); if (getError() != Common::kNoError) return 0; + // recreate FSNode since checkPath may have changed/created the directory + Common::FSNode savePath(savePathName); + Common::FSNode file = savePath.getChild(filename); if (!file.exists()) return 0; @@ -93,11 +99,14 @@ Common::InSaveFile *DefaultSaveFileManager::openForLoading(const Common::String Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String &filename) { // Ensure that the savepath is valid. If not, generate an appropriate error. - Common::FSNode savePath(getSavePath()); - checkPath(savePath); + Common::String savePathName = getSavePath(); + checkPath(Common::FSNode(savePathName)); if (getError() != Common::kNoError) return 0; + // recreate FSNode since checkPath may have changed/created the directory + Common::FSNode savePath(savePathName); + Common::FSNode file = savePath.getChild(filename); // Open the file for saving @@ -107,13 +116,14 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String } bool DefaultSaveFileManager::removeSavefile(const Common::String &filename) { - clearError(); - - Common::FSNode savePath(getSavePath()); - checkPath(savePath); + Common::String savePathName = getSavePath(); + checkPath(Common::FSNode(savePathName)); if (getError() != Common::kNoError) return false; + // recreate FSNode since checkPath may have changed/created the directory + Common::FSNode savePath(savePathName); + Common::FSNode file = savePath.getChild(filename); // FIXME: remove does not exist on all systems. If your port fails to -- cgit v1.2.3 From 272e9487aaab6119fd643c3443fddbdfedb2f73e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 10 Jul 2009 22:46:36 +0000 Subject: Restored several files after the version update. .in files are THE sources, and have to be modified, not the files generated from them. svn-id: r42358 --- dists/redhat/scummvm.spec | 1 + dists/redhat/scummvm.spec.in | 1 + dists/scummvm.rc | 2 +- dists/scummvm.rc.in | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dists/redhat/scummvm.spec b/dists/redhat/scummvm.spec index 75d54f357e..9981940678 100644 --- a/dists/redhat/scummvm.spec +++ b/dists/redhat/scummvm.spec @@ -58,6 +58,7 @@ make install -m755 -D scummvm %{buildroot}%{_bindir}/scummvm install -m644 -D dists/scummvm.6 %{buildroot}%{_mandir}/man6/scummvm.6 install -m644 -D icons/scummvm.xpm %{buildroot}%{_datadir}/pixmaps/scummvm.xpm +install -m644 -D gui/themes/scummclassic.zip %{buildroot}%{_datadir}/scummvm/scummclassic.zip install -m644 -D gui/themes/scummmodern.zip %{buildroot}%{_datadir}/scummvm/scummmodern.zip install -m644 -D dists/pred.dic %{buildroot}%{_datadir}/scummvm/pred.dic install -m644 -D dists/engine-data/kyra.dat %{buildroot}%{_datadir}/scummvm/kyra.dat diff --git a/dists/redhat/scummvm.spec.in b/dists/redhat/scummvm.spec.in index 1b3aebe448..ecff229514 100644 --- a/dists/redhat/scummvm.spec.in +++ b/dists/redhat/scummvm.spec.in @@ -58,6 +58,7 @@ make install -m755 -D scummvm %{buildroot}%{_bindir}/scummvm install -m644 -D dists/scummvm.6 %{buildroot}%{_mandir}/man6/scummvm.6 install -m644 -D icons/scummvm.xpm %{buildroot}%{_datadir}/pixmaps/scummvm.xpm +install -m644 -D gui/themes/scummclassic.zip %{buildroot}%{_datadir}/scummvm/scummclassic.zip install -m644 -D gui/themes/scummmodern.zip %{buildroot}%{_datadir}/scummvm/scummmodern.zip install -m644 -D dists/pred.dic %{buildroot}%{_datadir}/scummvm/pred.dic install -m644 -D dists/engine-data/kyra.dat %{buildroot}%{_datadir}/scummvm/kyra.dat diff --git a/dists/scummvm.rc b/dists/scummvm.rc index 7ec37a4a00..2b794fdded 100644 --- a/dists/scummvm.rc +++ b/dists/scummvm.rc @@ -27,7 +27,7 @@ BEGIN VALUE "FileDescription", "http://www.scummvm.org/\0" VALUE "FileVersion", "1.0.0svn\0" VALUE "InternalName", "scummvm\0" - VALUE "LegalCopyright", "Copyright © 2001-2008 The ScummVM Team\0" + VALUE "LegalCopyright", "Copyright © 2001-2009 The ScummVM Team\0" VALUE "LegalTrademarks", "'SCUMM', and all SCUMM games are a TM of LucasArts. Simon The Sorcerer is a TM of AdventureSoft. Beneath a Steel Sky and Broken Sword are a TM of Revolution. Flight of the Amazon Queen is a TM of John Passfield and Steve Stamatiadis. \0" VALUE "OriginalFilename", "scummvm.exe\0" VALUE "ProductName", "ScummVM\0" diff --git a/dists/scummvm.rc.in b/dists/scummvm.rc.in index 80672d54e7..a2d70e87f8 100644 --- a/dists/scummvm.rc.in +++ b/dists/scummvm.rc.in @@ -27,7 +27,7 @@ BEGIN VALUE "FileDescription", "http://www.scummvm.org/\0" VALUE "FileVersion", "@VERSION@\0" VALUE "InternalName", "scummvm\0" - VALUE "LegalCopyright", "Copyright © 2001-2008 The ScummVM Team\0" + VALUE "LegalCopyright", "Copyright © 2001-2009 The ScummVM Team\0" VALUE "LegalTrademarks", "'SCUMM', and all SCUMM games are a TM of LucasArts. Simon The Sorcerer is a TM of AdventureSoft. Beneath a Steel Sky and Broken Sword are a TM of Revolution. Flight of the Amazon Queen is a TM of John Passfield and Steve Stamatiadis. \0" VALUE "OriginalFilename", "scummvm.exe\0" VALUE "ProductName", "ScummVM\0" -- cgit v1.2.3 From 8eee50103ce40287058966e201d65aade5f1f688 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sat, 11 Jul 2009 00:38:50 +0000 Subject: Fix recent regression in AGOSEngine_Simon1::drawImage(). svn-id: r42360 --- engines/agos/gfx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/agos/gfx.cpp b/engines/agos/gfx.cpp index 1755391ac3..1b5a820260 100644 --- a/engines/agos/gfx.cpp +++ b/engines/agos/gfx.cpp @@ -667,7 +667,7 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) { state->surf2_addr = getBackGround(); state->surf2_pitch = _backGroundBuf->pitch; - state->surf_addr = (byte *)_window4BackScn; + state->surf_addr = (byte *)_window4BackScn->pixels; state->surf_pitch = _videoWindows[18] * 16; xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8; -- cgit v1.2.3 From ad67a714dd9e4373cb5a1d78fba2b00e1db32352 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 11 Jul 2009 00:47:32 +0000 Subject: Fix SAGA outline generation algorithm for characters that are copies of earlier characters. (5 characters in IHNM.) This fixes #1904624. svn-id: r42361 --- engines/saga/font.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/engines/saga/font.cpp b/engines/saga/font.cpp index 175ab01478..1c1c3100c4 100644 --- a/engines/saga/font.cpp +++ b/engines/saga/font.cpp @@ -165,6 +165,25 @@ void Font::createOutline(FontData *font) { index += indexOffset; } + bool skip = false; + + if (i > 0 && font->normal.fontCharEntry[i].width != 0 && font->normal.fontCharEntry[i].index < font->normal.fontCharEntry[i-1].index) { + // Some characters are copies of earlier characters. + // Look up the original, and make sure not to grow the size of + // the outline font twice. + skip = true; + bool found = false; + for (int j = 0; j < i; j++) { + if (font->normal.fontCharEntry[i].index == font->normal.fontCharEntry[j].index) { + index = font->outline.fontCharEntry[j].index; + found = true; + break; + } + } + if (!found) + error("Invalid index backreference in font char %d", i); + } + font->outline.fontCharEntry[i].index = index; font->outline.fontCharEntry[i].tracking = font->normal.fontCharEntry[i].tracking; font->outline.fontCharEntry[i].flag = font->normal.fontCharEntry[i].flag; @@ -173,14 +192,16 @@ void Font::createOutline(FontData *font) { newByteWidth = getByteLen(font->normal.fontCharEntry[i].width + 2); oldByteWidth = getByteLen(font->normal.fontCharEntry[i].width); - if (newByteWidth > oldByteWidth) { + if (!skip && newByteWidth > oldByteWidth) { indexOffset++; } } font->outline.fontCharEntry[i].width = font->normal.fontCharEntry[i].width + 2; font->outline.fontCharEntry[i].byteWidth = newByteWidth; - newRowLength += newByteWidth; + + if (!skip) + newRowLength += newByteWidth; } debug(2, "New row length: %d", newRowLength); @@ -196,6 +217,10 @@ void Font::createOutline(FontData *font) { // Generate outline font representation for (i = 0; i < FONT_CHARCOUNT; i++) { + if (i > 0 && font->normal.fontCharEntry[i].index < font->normal.fontCharEntry[i-1].index) { + // Skip copies + continue; + } for (row = 0; row < font->normal.header.charHeight; row++) { for (currentByte = 0; currentByte < font->outline.fontCharEntry[i].byteWidth; currentByte++) { basePointer = font->outline.font + font->outline.fontCharEntry[i].index + currentByte; -- cgit v1.2.3 From fb38a1b0ba74b3295ab9851448da841194aa82d9 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sat, 11 Jul 2009 01:40:53 +0000 Subject: Fix bug #2819628 - DETECTOR: Atlantis CD sets wrong gui options. svn-id: r42364 --- engines/scumm/detection_tables.h | 6 ++-- engines/scumm/scumm-md5.h | 64 ++++++++++++++++++++-------------------- tools/scumm-md5.txt | 62 +++++++++++++++++++------------------- 3 files changed, 66 insertions(+), 66 deletions(-) diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h index 2ea593c571..92024a21cc 100644 --- a/engines/scumm/detection_tables.h +++ b/engines/scumm/detection_tables.h @@ -230,13 +230,13 @@ static const GameSettings gameVariantsTable[] = { {"monkey2", 0, 0, GID_MONKEY2, 5, 0, MDT_ADLIB | MDT_MIDI, 0, UNK, GUIO_NOSPEECH}, - {"atlantis", 0, 0, GID_INDY4, 5, 0, MDT_ADLIB | MDT_MIDI, 0, UNK, GUIO_NOSPEECH}, + {"atlantis", "", 0, GID_INDY4, 5, 0, MDT_ADLIB | MDT_MIDI, 0, UNK, GUIO_NOSPEECH}, {"atlantis", "CD" , 0, GID_INDY4, 5, 0, MDT_ADLIB | MDT_MIDI, 0, UNK, GUIO_NONE}, - {"tentacle", 0, 0, GID_TENTACLE, 6, 0, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO_NOSPEECH}, + {"tentacle", "", 0, GID_TENTACLE, 6, 0, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO_NOSPEECH}, {"tentacle", "CD", 0, GID_TENTACLE, 6, 0, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO_NONE}, - {"samnmax", 0, 0, GID_SAMNMAX, 6, 0, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO_NOSPEECH}, + {"samnmax", "", 0, GID_SAMNMAX, 6, 0, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO_NOSPEECH}, {"samnmax", "CD", 0, GID_SAMNMAX, 6, 0, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO_NONE}, #ifdef ENABLE_SCUMM_7_8 diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h index 8ab4e00caa..5bb0e097dc 100644 --- a/engines/scumm/scumm-md5.h +++ b/engines/scumm/scumm-md5.h @@ -1,5 +1,5 @@ /* - This file was generated by the md5table tool on Fri May 15 10:19:51 2009 + This file was generated by the md5table tool on Sat Jul 11 01:37:44 2009 DO NOT EDIT MANUALLY! */ @@ -20,7 +20,7 @@ static const MD5Table md5table[] = { { "035deab53b47bc43abc763560d0f8d4b", "atlantis", "", "Demo", -1, Common::EN_ANY, Common::kPlatformPC }, { "037385a953789190298494d92b89b3d0", "catalog", "HE 72", "Demo", -1, Common::EN_ANY, Common::kPlatformWindows }, { "03d3b18ee3fd68114e2a687c871e38d5", "freddi4", "HE 99", "Mini Game", -1, Common::EN_USA, Common::kPlatformWindows }, - { "0425954a9db5c340861672892c3e678d", "samnmax", "", "Demo", -1, Common::EN_ANY, Common::kPlatformUnknown }, + { "0425954a9db5c340861672892c3e678d", "samnmax", "CD", "Demo", -1, Common::EN_ANY, Common::kPlatformUnknown }, { "04401d747f1a2c1c4b388daff71ed378", "ft", "", "", 535405461, Common::DE_DEU, Common::kPlatformMacintosh }, { "04687cdf7f975a89d2474929f7b80946", "indy3", "FM-TOWNS", "", 7552, Common::EN_ANY, Common::kPlatformFMTowns }, { "0557df19f046a84c2fdc63507c6616cb", "farm", "HE 72", "Demo", -1, Common::NL_NLD, Common::kPlatformWindows }, @@ -53,10 +53,10 @@ static const MD5Table md5table[] = { { "0e96ab45a4eb72acc1b46813976589fd", "activity", "", "", -1, Common::EN_ANY, Common::kPlatformMacintosh }, { "0e9b01430e31d9fcd94071d433bbc6bf", "loom", "No Adlib", "EGA", -1, Common::FR_FRA, Common::kPlatformAtariST }, { "0f5935bd5e88ba6f09e558d64459746d", "thinker1", "", "Demo", 30919, Common::EN_USA, Common::kPlatformWindows }, - { "0f6f2e716ba896a44e5059bba1de7ca9", "samnmax", "", "CD", -1, Common::IT_ITA, Common::kPlatformUnknown }, + { "0f6f2e716ba896a44e5059bba1de7ca9", "samnmax", "CD", "CD", -1, Common::IT_ITA, Common::kPlatformUnknown }, { "0f9c7a76657f0840b8f7ccb5bffeb9f4", "indy3", "No Adlib", "EGA", -1, Common::FR_FRA, Common::kPlatformAtariST }, { "0f9d3317910ac7a9f449243118884ada", "puttzoo", "", "", 42070, Common::DE_DEU, Common::kPlatformWindows }, - { "0fb73eddfcf584c02ba097984df131ba", "samnmax", "", "CD", 9080, Common::DE_DEU, Common::kPlatformUnknown }, + { "0fb73eddfcf584c02ba097984df131ba", "samnmax", "CD", "CD", 9080, Common::DE_DEU, Common::kPlatformUnknown }, { "1005456bfe351c1b679e1ff2dc2849e9", "puttzoo", "", "", -1, Common::UNK_LANG, Common::kPlatformWindows }, { "100b4c8403ad6a83d4bf7dbf83e44dc4", "spyfox", "", "", -1, Common::FR_FRA, Common::kPlatformWindows }, { "10d8e66cd11049ce64815ebb9fd76eb3", "spyozon", "", "", -1, Common::FR_FRA, Common::kPlatformUnknown }, @@ -74,20 +74,20 @@ static const MD5Table md5table[] = { { "15e03ffbfeddb9c2aebc13dcb2a4a8f4", "monkey", "VGA", "VGA", 8357, Common::EN_ANY, Common::kPlatformPC }, { "15f588e887e857e8c56fe6ade4956168", "atlantis", "", "Floppy", -1, Common::ES_ESP, Common::kPlatformAmiga }, { "16542a7342a918bfe4ba512007d36c47", "FreddisFunShop", "HE 99L", "", -1, Common::EN_USA, Common::kPlatformUnknown }, - { "166553538ff320c69edafeee29525419", "samnmax", "", "CD", -1, Common::EN_ANY, Common::kPlatformMacintosh }, + { "166553538ff320c69edafeee29525419", "samnmax", "CD", "CD", -1, Common::EN_ANY, Common::kPlatformMacintosh }, { "16effd200aa6b8abe9c569c3e578814d", "freddi4", "HE 99", "Demo", -1, Common::NL_NLD, Common::kPlatformWindows }, { "179879b6e35c1ead0d93aab26db0951b", "fbear", "HE 70", "", 13381, Common::EN_ANY, Common::kPlatformWindows }, { "17b5d5e6af4ae89d62631641d66d5a05", "indy3", "VGA", "VGA", -1, Common::IT_ITA, Common::kPlatformPC }, { "17f7296f63c78642724f057fd8e736a7", "maniac", "NES", "extracted", -1, Common::EN_GRB, Common::kPlatformNES }, - { "17fa250eb72dae2dad511ba79c0b6b0a", "tentacle", "", "Demo", -1, Common::FR_FRA, Common::kPlatformPC }, - { "182344899c2e2998fca0bebcd82aa81a", "atlantis", "", "CD", 12035, Common::EN_ANY, Common::kPlatformPC }, + { "17fa250eb72dae2dad511ba79c0b6b0a", "tentacle", "CD", "Demo", -1, Common::FR_FRA, Common::kPlatformPC }, + { "182344899c2e2998fca0bebcd82aa81a", "atlantis", "CD", "CD", 12035, Common::EN_ANY, Common::kPlatformPC }, { "183d7464902d40d00800e8ee1f04117c", "maniac", "V2", "V2", 1988, Common::DE_DEU, Common::kPlatformPC }, { "1875b90fade138c9253a8e967007031a", "indy3", "VGA", "VGA", 6295, Common::EN_ANY, Common::kPlatformPC }, { "187d315f6b5168f68680dfe8c3d76a3e", "loom", "EGA", "EGA", -1, Common::HB_ISR, Common::kPlatformPC }, { "1900e501a52fbf55bde6e4196f6d2aa6", "zak", "V2", "V2", -1, Common::IT_ITA, Common::kPlatformPC }, { "19263586f749a560c1adf8b3393a9593", "socks", "HE 85", "", -1, Common::RU_RUS, Common::kPlatformWindows }, { "19bf6938a94698296bcb0c99c31c91a7", "spyfox2", "", "Demo", -1, Common::EN_GRB, Common::kPlatformWindows }, - { "1a6e5ae2777a6a33f06ffc0226210934", "atlantis", "", "CD", -1, Common::EN_ANY, Common::kPlatformMacintosh }, + { "1a6e5ae2777a6a33f06ffc0226210934", "atlantis", "CD", "CD", -1, Common::EN_ANY, Common::kPlatformMacintosh }, { "1c792d28376d45e145cb916bca0400a2", "spyfox2", "", "Demo", -1, Common::NL_NLD, Common::kPlatformUnknown }, { "1c7e7db2cfab1ad62746ab680a634204", "maniac", "NES", "extracted", -1, Common::FR_FRA, Common::kPlatformNES }, { "1ca86e2cf9aaa2068738a1e5ba477e60", "zak", "FM-TOWNS", "", -1, Common::JA_JPN, Common::kPlatformFMTowns }, @@ -117,11 +117,11 @@ static const MD5Table md5table[] = { { "2723fea3dae0cb47768c424b145ae0e7", "tentacle", "", "Floppy", 7932, Common::EN_ANY, Common::kPlatformPC }, { "27b2ef1653089fe5b897d9cc89ce784f", "balloon", "HE 80", "", -1, Common::RU_RUS, Common::kPlatformWindows }, { "27b3a4224ad63d5b04627595c1c1a025", "zak", "V2", "V2", -1, Common::IT_ITA, Common::kPlatformAmiga }, - { "28d24a33448fab6795850bc9f159a4a2", "atlantis", "", "Demo", 11170, Common::JA_JPN, Common::kPlatformFMTowns }, + { "28d24a33448fab6795850bc9f159a4a2", "atlantis", "CD", "Demo", 11170, Common::JA_JPN, Common::kPlatformFMTowns }, { "28ef68ee3ed76d7e2ee8ee13c15fbd5b", "loom", "EGA", "EGA", 5748, Common::EN_ANY, Common::kPlatformPC }, { "28f07458f1b6c24e118a1ea056827701", "lost", "HE 99", "", -1, Common::NL_NLD, Common::kPlatformUnknown }, { "2a208ffbcd0e83e86f4356e6f64aa6e1", "loom", "EGA", "EGA", -1, Common::ES_ESP, Common::kPlatformPC }, - { "2a41b53cf1a90b6e6f26c10cc6041084", "tentacle", "", "Demo", 2439158, Common::EN_ANY, Common::kPlatformMacintosh }, + { "2a41b53cf1a90b6e6f26c10cc6041084", "tentacle", "CD", "Demo", 2439158, Common::EN_ANY, Common::kPlatformMacintosh }, { "2a446817ffcabfef8716e0c456ecaf81", "puttzoo", "", "Demo", -1, Common::DE_DEU, Common::kPlatformWindows }, { "2a8658dbd13d84d1bce64a71a35995eb", "pajama2", "HE 99", "Demo", -1, Common::HB_ISR, Common::kPlatformWindows }, { "2c04aacffb8428f30ccf4f734fbe3adc", "activity", "", "", -1, Common::EN_ANY, Common::kPlatformPC }, @@ -130,7 +130,7 @@ static const MD5Table md5table[] = { { "2d388339d6050d8ccaa757b64633954e", "zak", "FM-TOWNS", "Demo", 7520, Common::EN_ANY, Common::kPlatformFMTowns }, { "2d4536a56e01da4b02eb021e7770afa2", "zak", "FM-TOWNS", "", 7520, Common::EN_ANY, Common::kPlatformFMTowns }, { "2d4acbdcfd8e374c9da8c2e7303a5cd0", "BluesBirthday", "", "Demo", -1, Common::EN_ANY, Common::kPlatformUnknown }, - { "2d9d46f23cb07bbc90b8ad464d3e4ff8", "atlantis", "", "CD", -1, Common::EN_ANY, Common::kPlatformMacintosh }, + { "2d9d46f23cb07bbc90b8ad464d3e4ff8", "atlantis", "CD", "CD", -1, Common::EN_ANY, Common::kPlatformMacintosh }, { "2e85f7aa054930c692a5b1bed1dfc295", "football2002", "", "Demo", -1, Common::EN_ANY, Common::kPlatformUnknown }, { "2e8a1f76ea33bc5e04347646feee173d", "pajama3", "", "", -1, Common::DE_DEU, Common::kPlatformUnknown }, { "2fe369ad70f52a8cf7ad6077ee64f81a", "loom", "EGA", "EGA", -1, Common::DE_DEU, Common::kPlatformAmiga }, @@ -165,7 +165,7 @@ static const MD5Table md5table[] = { { "3a03dab514e4038df192d8a8de469788", "atlantis", "", "Floppy", -1, Common::EN_ANY, Common::kPlatformAmiga }, { "3a0c35f3c147b98a2bdf8d400cfc4ab5", "indy3", "FM-TOWNS", "", -1, Common::JA_JPN, Common::kPlatformFMTowns }, { "3a3e592b074f595489f7f11e150c398d", "puttzoo", "HE 99", "Updated", -1, Common::EN_USA, Common::kPlatformWindows }, - { "3a5d13675e9a23aedac0bac7730f0ac1", "samnmax", "", "CD", -1, Common::FR_FRA, Common::kPlatformMacintosh }, + { "3a5d13675e9a23aedac0bac7730f0ac1", "samnmax", "CD", "CD", -1, Common::FR_FRA, Common::kPlatformMacintosh }, { "3a5ec90d556d4920976c5578bfbfaf79", "maniac", "NES", "extracted", -1, Common::DE_DEU, Common::kPlatformNES }, { "3af61c5edf8e15b43dbafd285b2e9777", "puttcircus", "", "Demo", -1, Common::HB_ISR, Common::kPlatformWindows }, { "3b301b7892f883ce42ab4be6a274fea6", "samnmax", "", "Floppy", -1, Common::EN_ANY, Common::kPlatformPC }, @@ -176,7 +176,7 @@ static const MD5Table md5table[] = { { "3df6ead57930488bc61e6e41901d0e97", "fbear", "HE 61", "", -1, Common::EN_ANY, Common::kPlatformMacintosh }, { "3e48298920fab9b7aec5a971e1bd1fab", "pajama3", "", "Demo", -1, Common::EN_GRB, Common::kPlatformWindows }, { "40564ec47da48a67787d1f9bd043902a", "maniac", "V2 Demo", "V2 Demo", 1988, Common::EN_ANY, Common::kPlatformPC }, - { "4167a92a1d46baa4f4127d918d561f88", "tentacle", "", "CD", 7932, Common::EN_ANY, Common::kPlatformUnknown }, + { "4167a92a1d46baa4f4127d918d561f88", "tentacle", "CD", "CD", 7932, Common::EN_ANY, Common::kPlatformUnknown }, { "41958e24d03181ff9a381a66d048a581", "ft", "", "", -1, Common::PT_BRA, Common::kPlatformUnknown }, { "425205754fa749f4f0b0dd9d09fa45fd", "football", "", "Demo", -1, Common::EN_ANY, Common::kPlatformUnknown }, { "430bc518017b6fac046f58bab6baad5d", "monkey2", "", "", -1, Common::JA_JPN, Common::kPlatformFMTowns }, @@ -195,13 +195,13 @@ static const MD5Table md5table[] = { { "4aa93cb30e485b728504ba3a693f12bf", "pajama", "HE 100", "", -1, Common::RU_RUS, Common::kPlatformWindows }, { "4af4a6b248103c1fe9edef619677f540", "puttmoon", "", "Demo", -1, Common::EN_ANY, Common::kPlatformMacintosh }, { "4ba37f835be11a59d969f90f272f575b", "water", "HE 80", "", -1, Common::EN_USA, Common::kPlatformUnknown }, - { "4ba7fb331296c283e73d8f5b2096e551", "samnmax", "", "CD", -1, Common::ES_ESP, Common::kPlatformUnknown }, + { "4ba7fb331296c283e73d8f5b2096e551", "samnmax", "CD", "CD", -1, Common::ES_ESP, Common::kPlatformUnknown }, { "4bedb49943df95a9c900a5a82ccbe9de", "ft", "", "", -1, Common::FR_FRA, Common::kPlatformUnknown }, { "4bfa4a43684bcb437f7fb47f457a0aa5", "socks", "HE 99", "", -1, Common::NL_NLD, Common::kPlatformUnknown }, { "4c4820518e16e1a0e3616a3b021a04f3", "catalog", "HE CUP", "Preview", 10927456, Common::DE_DEU, Common::kPlatformUnknown }, { "4cb9c3618f71668f8e4346c8f323fa82", "monkey2", "", "", 10700, Common::EN_ANY, Common::kPlatformMacintosh }, { "4ce2d5b355964bbcb5e5ce73236ef868", "freddicove", "HE 100", "", -1, Common::RU_RUS, Common::kPlatformWindows }, - { "4d34042713958b971cb139fba4658586", "atlantis", "", "", -1, Common::JA_JPN, Common::kPlatformFMTowns }, + { "4d34042713958b971cb139fba4658586", "atlantis", "CD", "", -1, Common::JA_JPN, Common::kPlatformFMTowns }, { "4dbff3787aedcd96b0b325f2d92d7ad9", "maze", "HE 100", "Updated", -1, Common::EN_USA, Common::kPlatformUnknown }, { "4dc780f1bc587a193ce8a97652791438", "loom", "EGA", "EGA", -1, Common::EN_ANY, Common::kPlatformAmiga }, { "4e5867848ee61bc30d157e2c94eee9b4", "PuttTime", "HE 90", "Demo", 18394, Common::EN_USA, Common::kPlatformUnknown }, @@ -212,7 +212,7 @@ static const MD5Table md5table[] = { { "4f267a901719623de7dde83e47d5b474", "atlantis", "", "Floppy", -1, Common::DE_DEU, Common::kPlatformAmiga }, { "4f580a021eee026f3b4589e17d130d78", "freddi4", "", "", -1, Common::UNK_LANG, Common::kPlatformUnknown }, { "4fa6870d9bc8c313b65d54b1da5a1891", "pajama", "", "", -1, Common::NL_NLD, Common::kPlatformWindows }, - { "4fbbe9f64b8bc547503a379a301183ce", "tentacle", "", "CD", -1, Common::IT_ITA, Common::kPlatformUnknown }, + { "4fbbe9f64b8bc547503a379a301183ce", "tentacle", "CD", "CD", -1, Common::IT_ITA, Common::kPlatformUnknown }, { "4fe6a2e8df3c4536b278fdd2fbcb181e", "pajama3", "", "Mini Game", -1, Common::EN_ANY, Common::kPlatformWindows }, { "5057fb0e99e5aa29df1836329232f101", "freddi2", "HE 80", "", -1, Common::UNK_LANG, Common::kPlatformWindows }, { "507bb360688dc4180fdf0d7597352a69", "freddi", "HE 73", "", 26402, Common::SE_SWE, Common::kPlatformWindows }, @@ -289,9 +289,9 @@ static const MD5Table md5table[] = { { "6bf70eee5de3d24d2403e0dd3d267e8a", "spyfox", "", "", 49221, Common::UNK_LANG, Common::kPlatformWindows }, { "6c2bff0e327f2962e809c2e1a82d7309", "monkey", "VGA", "VGA", -1, Common::EN_ANY, Common::kPlatformAmiga }, { "6d1baa1065ac5f7b210be8ebe4235e49", "freddi", "HE 73", "", -1, Common::NL_NLD, Common::kPlatformMacintosh }, - { "6dead580b0ff14d5f7b33b4219f04159", "samnmax", "", "Demo", 16556335, Common::EN_ANY, Common::kPlatformMacintosh }, + { "6dead580b0ff14d5f7b33b4219f04159", "samnmax", "CD", "Demo", 16556335, Common::EN_ANY, Common::kPlatformMacintosh }, { "6df20c50c1ab19799de9be7ae7716881", "fbear", "HE 61", "Demo", -1, Common::EN_ANY, Common::kPlatformMacintosh }, - { "6e959d65358eedf9b68b81e304b97fa4", "tentacle", "", "CD", 7932, Common::DE_DEU, Common::kPlatformUnknown }, + { "6e959d65358eedf9b68b81e304b97fa4", "tentacle", "CD", "CD", 7932, Common::DE_DEU, Common::kPlatformUnknown }, { "6ea966b4d660c870b9ee790d1fbfc535", "monkey2", "", "", -1, Common::ES_ESP, Common::kPlatformAmiga }, { "6f0be328c64d689bb606d22a389e1b0f", "loom", "No Adlib", "EGA", 5748, Common::EN_ANY, Common::kPlatformMacintosh }, { "6f6ef668c608c7f534fea6e6d3878dde", "indy3", "EGA", "EGA", -1, Common::DE_DEU, Common::kPlatformPC }, @@ -332,7 +332,7 @@ static const MD5Table md5table[] = { { "7ddeaf52c8b9a50551ce0aa2ac811d07", "BluesABCTime", "", "Demo", -1, Common::EN_ANY, Common::kPlatformUnknown }, { "7e151c17adf624f1966c8fc5827c95e9", "puttputt", "HE 61", "", -1, Common::EN_ANY, Common::kPlatform3DO }, { "7ea2da67ebabea4ac20cee9f4f9d2934", "airport", "", "Demo", -1, Common::EN_ANY, Common::kPlatformMacintosh }, - { "7edd665bbede7ea8b7233f8e650be6f8", "samnmax", "", "CD", -1, Common::FR_FRA, Common::kPlatformUnknown }, + { "7edd665bbede7ea8b7233f8e650be6f8", "samnmax", "CD", "CD", -1, Common::FR_FRA, Common::kPlatformUnknown }, { "7f45ddd6dbfbf8f80c0c0efea4c295bc", "maniac", "V1", "V1", 1972, Common::EN_ANY, Common::kPlatformPC }, { "7f945525abcd48015adf1632637a44a1", "pajama", "", "Demo", -1, Common::FR_FRA, Common::kPlatformUnknown }, { "7fc6cdb46b4c9d384c52327f4bca6416", "football", "", "", -1, Common::EN_ANY, Common::kPlatformUnknown }, @@ -354,12 +354,12 @@ static const MD5Table md5table[] = { { "87df3e0074624040407764b7c5e710b9", "pajama", "", "Demo", 18354, Common::NL_NLD, Common::kPlatformWindows }, { "87f6e8037b7cc996e13474b491a7a98e", "maniac", "V2", "V2", -1, Common::IT_ITA, Common::kPlatformPC }, { "8801fb4a1200b347f7a38523339526dd", "jungle", "", "", -1, Common::EN_ANY, Common::kPlatformWindows }, - { "883af4b0af4f77a92f1dcf1d0a283140", "tentacle", "", "CD", -1, Common::ES_ESP, Common::kPlatformUnknown }, + { "883af4b0af4f77a92f1dcf1d0a283140", "tentacle", "CD", "CD", -1, Common::ES_ESP, Common::kPlatformUnknown }, { "898ce8eb1234a955ef75e87141902bb3", "freddi3", "", "", -1, Common::RU_RUS, Common::kPlatformWindows }, { "898eaa21f79cf8d4f08db856244689ff", "pajama", "HE 99", "Updated", 66505, Common::EN_ANY, Common::kPlatformWindows }, { "89cfc425566003ff74b7dc7b3e6fd469", "indy3", "EGA", "EGA", -1, Common::FR_FRA, Common::kPlatformPC }, { "8a484262363a8e18be87112454f1456b", "pjgames", "", "", -1, Common::EN_USA, Common::kPlatformUnknown }, - { "8aa05d3cdb0e795436043f0546af2da2", "tentacle", "", "CD?", -1, Common::FR_FRA, Common::kPlatformUnknown }, + { "8aa05d3cdb0e795436043f0546af2da2", "tentacle", "CD", "CD?", -1, Common::FR_FRA, Common::kPlatformUnknown }, { "8aed489aba45d2b9fb8a04079c9c6e6a", "baseball", "HE CUP", "Preview", 12876596, Common::UNK_LANG, Common::kPlatformUnknown }, { "8afb3cf9f95abf208358e984f0c9e738", "funpack", "", "", -1, Common::EN_ANY, Common::kPlatform3DO }, { "8bdb0bf87b5e303dd35693afb9351215", "ft", "", "", -1, Common::DE_DEU, Common::kPlatformUnknown }, @@ -367,7 +367,7 @@ static const MD5Table md5table[] = { { "8de13897f0121c79d29a2377159f9ad0", "socks", "HE 99", "Updated", -1, Common::EN_ANY, Common::kPlatformWindows }, { "8e3241ddd6c8dadf64305e8740d45e13", "balloon", "HE 100", "Updated", -1, Common::EN_ANY, Common::kPlatformUnknown }, { "8e4ee4db46954bfe2912e259a16fad82", "monkey2", "", "", -1, Common::FR_FRA, Common::kPlatformPC }, - { "8e9417564f33790815445b2136efa667", "atlantis", "", "CD", 11915, Common::JA_JPN, Common::kPlatformMacintosh }, + { "8e9417564f33790815445b2136efa667", "atlantis", "CD", "CD", 11915, Common::JA_JPN, Common::kPlatformMacintosh }, { "8e9830a6f2702be5b22c8fa0a6aaf977", "freddi2", "HE 80", "", -1, Common::NL_NLD, Common::kPlatformMacintosh }, { "8eb84cee9b429314c7f0bdcf560723eb", "monkey", "FM-TOWNS", "", -1, Common::EN_ANY, Common::kPlatformFMTowns }, { "8ee63cafb1fe9d62aa0d5a23117e70e7", "freddi2", "HE 100", "Updated", -1, Common::EN_USA, Common::kPlatformUnknown }, @@ -395,7 +395,7 @@ static const MD5Table md5table[] = { { "98744fe66ff730e8c2b3b1f58803ab0b", "atlantis", "", "Demo", -1, Common::EN_ANY, Common::kPlatformPC }, { "99128b6a5bdd9831d9682fb8b5cbf8d4", "BluesBirthday", "", "Yellow", -1, Common::EN_ANY, Common::kPlatformUnknown }, { "99a3699f80b8f776efae592b44b9b991", "maniac", "V2", "V2", -1, Common::FR_FRA, Common::kPlatformPC }, - { "99b6f822b0b2612415407865438697d6", "atlantis", "", "Demo", -1, Common::EN_ANY, Common::kPlatformPC }, + { "99b6f822b0b2612415407865438697d6", "atlantis", "CD", "Demo", -1, Common::EN_ANY, Common::kPlatformPC }, { "9b7452b5cd6d3ffb2b2f5118010af84f", "ft", "Demo", "Demo", 116463537, Common::EN_ANY, Common::kPlatformMacintosh }, { "9bc548e179cdb0767009401c094d0895", "maniac", "V2", "V2", -1, Common::DE_DEU, Common::kPlatformAmiga }, { "9bd2a8f72613e715c199246dd511e10f", "atlantis", "", "Floppy", -1, Common::ES_ESP, Common::kPlatformPC }, @@ -441,7 +441,7 @@ static const MD5Table md5table[] = { { "aaa587701cde7e74692c68c1024b85eb", "puttrace", "HE 99", "Demo", -1, Common::NL_NLD, Common::kPlatformUnknown }, { "aaa7f36a253f277dd29dd1c051b0e4b9", "indy3", "No Adlib", "EGA", -1, Common::DE_DEU, Common::kPlatformAtariST }, { "ab0693e9324cfcf498fdcbb12acf8bb4", "puttcircus", "", "", -1, Common::EN_ANY, Common::kPlatformUnknown }, - { "ac1642b6edfb8521ca03760126f1c250", "tentacle", "", "Demo", -1, Common::DE_DEU, Common::kPlatformPC }, + { "ac1642b6edfb8521ca03760126f1c250", "tentacle", "CD", "Demo", -1, Common::DE_DEU, Common::kPlatformPC }, { "ac62d50e39492ee3738b4e83a5ac780f", "freddi2", "HE 80", "", -1, Common::NL_NLD, Common::kPlatformWindows }, { "acad97ab1c6fc2a5b2d98abf6db4a190", "tentacle", "", "Floppy", -1, Common::EN_ANY, Common::kPlatformUnknown }, { "ae94f110a14ce71fc515d5b648827a8f", "tentacle", "", "Floppy", -1, Common::ES_ESP, Common::kPlatformPC }, @@ -492,15 +492,15 @@ static const MD5Table md5table[] = { { "c6907d44f1166941d982864cd42cdc89", "pajama2", "HE 99", "", -1, Common::DE_DEU, Common::kPlatformUnknown }, { "c782fbbe74a987c3df8ac73cd3e289ed", "freddi", "HE 73", "", -1, Common::SE_SWE, Common::kPlatformMacintosh }, { "c7890e038806df2bb5c0c8c6f1986ea2", "monkey", "VGA", "VGA", -1, Common::EN_ANY, Common::kPlatformPC }, - { "c7be10f775404fd9785a8b92a06d240c", "atlantis", "", "", -1, Common::EN_ANY, Common::kPlatformFMTowns }, + { "c7be10f775404fd9785a8b92a06d240c", "atlantis", "CD", "", -1, Common::EN_ANY, Common::kPlatformFMTowns }, { "c7c492a107ec520d7a7943037d0ca54a", "freddi", "HE 71", "Demo", -1, Common::NL_NLD, Common::kPlatformWindows }, - { "c83079157ec765a28de445aec9768d60", "tentacle", "", "Demo", 7477, Common::EN_ANY, Common::kPlatformUnknown }, + { "c83079157ec765a28de445aec9768d60", "tentacle", "CD", "Demo", 7477, Common::EN_ANY, Common::kPlatformUnknown }, { "c8575e0b973ff1723aba6cd92c642db2", "puttrace", "HE 99", "Demo", -1, Common::FR_FRA, Common::kPlatformWindows }, { "c8aac5e3e701874e2fa4117896f9e1b1", "freddi", "HE 73", "Demo", -1, Common::EN_ANY, Common::kPlatformMacintosh }, { "c8c5baadcbfc8d0372ed4335abace8a7", "pajama3", "", "Demo", -1, Common::FR_FRA, Common::kPlatformWindows }, { "c9717ee6059f1e43b768b464493d2fba", "fbpack", "", "", -1, Common::JA_JPN, Common::kPlatform3DO }, { "cb1559e8405d17a5a278a6b5ad9338d1", "freddi3", "", "Demo", 22718, Common::EN_ANY, Common::kPlatformUnknown }, - { "cc04a076779379524ed4d9c5ee3c6fb1", "tentacle", "", "CD", 282467632, Common::EN_ANY, Common::kPlatformMacintosh }, + { "cc04a076779379524ed4d9c5ee3c6fb1", "tentacle", "CD", "CD", 282467632, Common::EN_ANY, Common::kPlatformMacintosh }, { "cc0c4111449054f1692bb3c0c5e04629", "BluesBirthday", "", "Demo", -1, Common::EN_ANY, Common::kPlatformUnknown }, { "cc8ba2b0df2f9c450bcf055fe2711979", "samnmax", "", "Demo", 7485, Common::DE_DEU, Common::kPlatformPC }, { "cd424f143a141bc59226ad83a6e40f51", "maze", "HE 98.5", "", -1, Common::NL_NLD, Common::kPlatformUnknown }, @@ -525,7 +525,7 @@ static const MD5Table md5table[] = { { "d220d154aafbfa12bd6f3ab1b2dae420", "puttzoo", "", "Demo", -1, Common::DE_DEU, Common::kPlatformMacintosh }, { "d2cc8e31bce61e6cf2951249e10638fe", "basketball", "", "", -1, Common::EN_ANY, Common::kPlatformUnknown }, { "d37c55388294b66e53e7ced3af88fa68", "freddi2", "HE 100", "Updated Demo", -1, Common::EN_ANY, Common::kPlatformUnknown }, - { "d43352a805d78b5f4936c6d7779bf575", "samnmax", "", "CD", -1, Common::RU_RUS, Common::kPlatformPC }, + { "d43352a805d78b5f4936c6d7779bf575", "samnmax", "CD", "CD", -1, Common::RU_RUS, Common::kPlatformPC }, { "d4aac997e2f4e15341f0bfbf905419bd", "PuttTime", "HE 99", "", 62698, Common::EN_GRB, Common::kPlatformWindows }, { "d4b8ee426b1afd3e53bc0cf020418cf6", "dog", "HE 99", "", -1, Common::EN_ANY, Common::kPlatformWindows }, { "d4cccb5af88f3e77f370896e9ba8c5f9", "freddi", "HE 71", "", -1, Common::UNK_LANG, Common::kPlatformWindows }, @@ -543,8 +543,8 @@ static const MD5Table md5table[] = { { "d831f7c048574dd9d5d85db2a1468099", "maniac", "C64", "", -1, Common::EN_ANY, Common::kPlatformC64 }, { "d8323015ecb8b10bf53474f6e6b0ae33", "dig", "", "", 16304, Common::UNK_LANG, Common::kPlatformUnknown }, { "d8d07efcb88f396bee0b402b10c3b1c9", "maniac", "NES", "", 262144, Common::EN_GRB, Common::kPlatformNES }, - { "d917f311a448e3cc7239c31bddb00dd2", "samnmax", "", "CD", 9080, Common::EN_ANY, Common::kPlatformUnknown }, - { "d9d0dd93d16ab4dec55cabc2b86bbd17", "samnmax", "", "Demo", 6478, Common::EN_ANY, Common::kPlatformPC }, + { "d917f311a448e3cc7239c31bddb00dd2", "samnmax", "CD", "CD", 9080, Common::EN_ANY, Common::kPlatformUnknown }, + { "d9d0dd93d16ab4dec55cabc2b86bbd17", "samnmax", "CD", "Demo", 6478, Common::EN_ANY, Common::kPlatformPC }, { "da09e666fc8f5b78d7b0ac65d1a3b56e", "monkey2", "", "", 11135, Common::EN_ANY, Common::kPlatformFMTowns }, { "da6269b18fcb08189c0aa9c95533cce2", "monkey", "CD", "CD", 8955, Common::IT_ITA, Common::kPlatformPC }, { "da669b20271b85182e9c17a2a37ea02e", "monkey2", "", "", -1, Common::DE_DEU, Common::kPlatformAmiga }, @@ -584,7 +584,7 @@ static const MD5Table md5table[] = { { "ecc4340c2b801f5af8da4e00c0e432d9", "puttcircus", "", "", -1, Common::NL_NLD, Common::kPlatformUnknown }, { "ed2b074bc3166087a747acb2a3c6abb0", "freddi3", "HE 98.5", "Demo", -1, Common::DE_DEU, Common::kPlatformUnknown }, { "ed361270102e355afe5236954216aba2", "lost", "", "", -1, Common::EN_USA, Common::kPlatformUnknown }, - { "ede149fda3edfc1dbd7347e0737cb583", "tentacle", "", "CD", -1, Common::FR_FRA, Common::kPlatformMacintosh }, + { "ede149fda3edfc1dbd7347e0737cb583", "tentacle", "CD", "CD", -1, Common::FR_FRA, Common::kPlatformMacintosh }, { "edfdb24a499d92c59f824c52987c0eec", "atlantis", "", "Floppy", -1, Common::FR_FRA, Common::kPlatformPC }, { "ee41f6afbc5b26fa475754b56fe92048", "puttputt", "HE 61", "", 8032, Common::JA_JPN, Common::kPlatform3DO }, { "ee785fe2569bc9965526e774f7ab86f1", "spyfox", "HE 99", "", -1, Common::FR_FRA, Common::kPlatformMacintosh }, @@ -602,7 +602,7 @@ static const MD5Table md5table[] = { { "f3d55aea441e260e9e9c7d2a187097e0", "puttzoo", "", "Demo", 14337, Common::EN_ANY, Common::kPlatformWindows }, { "f40a7f495f59188ca57a9d1d50301bb6", "puttputt", "Demo", "Demo", -1, Common::EN_ANY, Common::kPlatformMacintosh }, { "f5228b0cc1c19e6ea8268ba2eeb61f60", "freddi", "HE 73", "Demo", -1, Common::FR_FRA, Common::kPlatformWindows }, - { "f73883f13b5a302749a5bad31d909780", "tentacle", "", "CD", -1, Common::DE_DEU, Common::kPlatformMacintosh }, + { "f73883f13b5a302749a5bad31d909780", "tentacle", "CD", "CD", -1, Common::DE_DEU, Common::kPlatformMacintosh }, { "f7711f9264d4d43c2a1518ec7c10a607", "pajama3", "", "", 79382, Common::EN_USA, Common::kPlatformUnknown }, { "f79e60c17cca601e411f1f75e8ee9b5a", "spyfox2", "", "", 51286, Common::UNK_LANG, Common::kPlatformUnknown }, { "f8be685007a8b425ba2a455da732f59f", "pajama2", "HE 99", "", -1, Common::FR_FRA, Common::kPlatformMacintosh }, diff --git a/tools/scumm-md5.txt b/tools/scumm-md5.txt index 4e57644b73..56b1334b3e 100644 --- a/tools/scumm-md5.txt +++ b/tools/scumm-md5.txt @@ -276,18 +276,18 @@ atlantis Indiana Jones and the Fate of Atlantis 06b187468113f9ae5a400b148a847fac 12075 en Mac - Floppy six data files Lars N sbye Christensen d6dd0646404768a63e963891a96daadd 12035 en Mac - Floppy two data files Fingolfin - 182344899c2e2998fca0bebcd82aa81a 12035 en DOS - CD - Fingolfin - 1a6e5ae2777a6a33f06ffc0226210934 -1 en Mac - CD - Scott Summers - 2d9d46f23cb07bbc90b8ad464d3e4ff8 -1 en Mac - CD Mac bundle Joachim Eberhard - 8e9417564f33790815445b2136efa667 11915 jp Mac - CD - Petr Maruska + 182344899c2e2998fca0bebcd82aa81a 12035 en DOS CD CD - Fingolfin + 1a6e5ae2777a6a33f06ffc0226210934 -1 en Mac CD CD - Scott Summers + 2d9d46f23cb07bbc90b8ad464d3e4ff8 -1 en Mac CD CD Mac bundle Joachim Eberhard + 8e9417564f33790815445b2136efa667 11915 jp Mac CD CD - Petr Maruska - c7be10f775404fd9785a8b92a06d240c -1 en FM-TOWNS - - - dhewg, Andrea Petrucci - 4d34042713958b971cb139fba4658586 -1 jp FM-TOWNS - - - Andrea Petrucci + c7be10f775404fd9785a8b92a06d240c -1 en FM-TOWNS CD - - dhewg, Andrea Petrucci + 4d34042713958b971cb139fba4658586 -1 jp FM-TOWNS CD - - Andrea Petrucci 035deab53b47bc43abc763560d0f8d4b -1 en DOS - Demo - 98744fe66ff730e8c2b3b1f58803ab0b -1 en DOS - Demo - Simon Krumrein, sev - 99b6f822b0b2612415407865438697d6 -1 en DOS - Demo non-interactive - 28d24a33448fab6795850bc9f159a4a2 11170 jp FM-TOWNS - Demo non-interactive khalek, Fingolfin + 99b6f822b0b2612415407865438697d6 -1 en DOS CD Demo non-interactive + 28d24a33448fab6795850bc9f159a4a2 11170 jp FM-TOWNS CD Demo non-interactive khalek, Fingolfin tentacle Day of the Tentacle acad97ab1c6fc2a5b2d98abf6db4a190 -1 en All? - Floppy Version A ? @@ -298,19 +298,19 @@ tentacle Day of the Tentacle 50fcdc982a25063b78ad46bf389b8e8d -1 it DOS - Floppy - Andrea Petrucci ae94f110a14ce71fc515d5b648827a8f -1 es DOS - Floppy - abnog, Andrea Petrucci - 4167a92a1d46baa4f4127d918d561f88 7932 en All? - CD - Fingolfin - 8aa05d3cdb0e795436043f0546af2da2 -1 fr All? - CD? - Andrea Petrucci - 6e959d65358eedf9b68b81e304b97fa4 7932 de All? - CD - Fingolfin - 4fbbe9f64b8bc547503a379a301183ce -1 it All? - CD - Andrea Petrucci - 883af4b0af4f77a92f1dcf1d0a283140 -1 es All? - CD - Andrea Petrucci - cc04a076779379524ed4d9c5ee3c6fb1 282467632 en Mac - CD Mac bundle Fingolfin, Joachim Eberhard - ede149fda3edfc1dbd7347e0737cb583 -1 fr Mac - CD Mac bundle ThierryFR - f73883f13b5a302749a5bad31d909780 -1 de Mac - CD Mac bundle morrissey + 4167a92a1d46baa4f4127d918d561f88 7932 en All? CD CD - Fingolfin + 8aa05d3cdb0e795436043f0546af2da2 -1 fr All? CD CD? - Andrea Petrucci + 6e959d65358eedf9b68b81e304b97fa4 7932 de All? CD CD - Fingolfin + 4fbbe9f64b8bc547503a379a301183ce -1 it All? CD CD - Andrea Petrucci + 883af4b0af4f77a92f1dcf1d0a283140 -1 es All? CD CD - Andrea Petrucci + cc04a076779379524ed4d9c5ee3c6fb1 282467632 en Mac CD CD Mac bundle Fingolfin, Joachim Eberhard + ede149fda3edfc1dbd7347e0737cb583 -1 fr Mac CD CD Mac bundle ThierryFR + f73883f13b5a302749a5bad31d909780 -1 de Mac CD CD Mac bundle morrissey - c83079157ec765a28de445aec9768d60 7477 en All - Demo - Fingolfin - 17fa250eb72dae2dad511ba79c0b6b0a -1 fr DOS - Demo - cyx - ac1642b6edfb8521ca03760126f1c250 -1 de DOS - Demo - Simon Krumrein, sev - 2a41b53cf1a90b6e6f26c10cc6041084 2439158 en Mac - Demo Mac bundle Fingolfin + c83079157ec765a28de445aec9768d60 7477 en All CD Demo - Fingolfin + 17fa250eb72dae2dad511ba79c0b6b0a -1 fr DOS CD Demo - cyx + ac1642b6edfb8521ca03760126f1c250 -1 de DOS CD Demo - Simon Krumrein, sev + 2a41b53cf1a90b6e6f26c10cc6041084 2439158 en Mac CD Demo Mac bundle Fingolfin samnmax Sam & Max Hit the Road 3b301b7892f883ce42ab4be6a274fea6 -1 en DOS - Floppy - Andrea Petrucci @@ -320,21 +320,21 @@ samnmax Sam & Max Hit the Road b289a2a8cbedbf45786e0b4ad2f510f1 -1 it DOS - Floppy - Andrea Petrucci fc53ce0e5f6562b1c1e1b4b8203acafb -1 es DOS - Floppy - Andrea Petrucci - d917f311a448e3cc7239c31bddb00dd2 9080 en All? - CD - Fingolfin - 7edd665bbede7ea8b7233f8e650be6f8 -1 fr All? - CD - Andrea Petrucci - 0fb73eddfcf584c02ba097984df131ba 9080 de All? - CD - Fingolfin - 0f6f2e716ba896a44e5059bba1de7ca9 -1 it All? - CD - Andrea Petrucci - 4ba7fb331296c283e73d8f5b2096e551 -1 es All? - CD - Andrea Petrucci - d43352a805d78b5f4936c6d7779bf575 -1 ru DOS - CD - - 166553538ff320c69edafeee29525419 -1 en Mac - CD Mac bundle Joachim Eberhard - 3a5d13675e9a23aedac0bac7730f0ac1 -1 fr Mac - CD Mac bundle ThierryFR + d917f311a448e3cc7239c31bddb00dd2 9080 en All? CD CD - Fingolfin + 7edd665bbede7ea8b7233f8e650be6f8 -1 fr All? CD CD - Andrea Petrucci + 0fb73eddfcf584c02ba097984df131ba 9080 de All? CD CD - Fingolfin + 0f6f2e716ba896a44e5059bba1de7ca9 -1 it All? CD CD - Andrea Petrucci + 4ba7fb331296c283e73d8f5b2096e551 -1 es All? CD CD - Andrea Petrucci + d43352a805d78b5f4936c6d7779bf575 -1 ru DOS CD CD - + 166553538ff320c69edafeee29525419 -1 en Mac CD CD Mac bundle Joachim Eberhard + 3a5d13675e9a23aedac0bac7730f0ac1 -1 fr Mac CD CD Mac bundle ThierryFR c3196c5349e53e387aaff1533d95e53a -1 en DOS - Demo - 0e4c5d54a0ad4b26132e78b5ea76642a 6485 en DOS - Demo WIP Fingolfin - d9d0dd93d16ab4dec55cabc2b86bbd17 6478 en DOS - Demo non-interactive Fingolfin + d9d0dd93d16ab4dec55cabc2b86bbd17 6478 en DOS CD Demo non-interactive Fingolfin cc8ba2b0df2f9c450bcf055fe2711979 7485 de DOS - Demo - Simon Krumrein, sev, Fingolfin - 0425954a9db5c340861672892c3e678d -1 en All - Demo - Kirben - 6dead580b0ff14d5f7b33b4219f04159 16556335 en Mac - Demo Mac bundle Fingolfin + 0425954a9db5c340861672892c3e678d -1 en All CD Demo - Kirben + 6dead580b0ff14d5f7b33b4219f04159 16556335 en Mac CD Demo Mac bundle Fingolfin ft Full Throttle 41958e24d03181ff9a381a66d048a581 -1 br All? - - - Danilo E.S. -- cgit v1.2.3 From 3080cc2905d86173c5b304434e3bf1cfd654d53f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 11 Jul 2009 01:54:27 +0000 Subject: Fix graphics not updating, when loading a save in Kyra1. This fixes problems when loading saves in rooms like Brynn's temple, which play animations directly on scene enter. svn-id: r42365 --- engines/kyra/saveload_lok.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/engines/kyra/saveload_lok.cpp b/engines/kyra/saveload_lok.cpp index c481794e53..c59f2bebf6 100644 --- a/engines/kyra/saveload_lok.cpp +++ b/engines/kyra/saveload_lok.cpp @@ -167,7 +167,6 @@ Common::Error KyraEngine_LoK::loadGameState(int slot) { } } - _screen->_disableScreen = true; loadMainScreen(8); if (queryGameFlag(0x2D)) { @@ -185,19 +184,16 @@ Common::Error KyraEngine_LoK::loadGameState(int slot) { setHandItem(_itemInHand); _animator->setBrandonAnimSeqSize(3, 48); redrawInventory(0); - _animator->_noDrawShapesFlag = 1; + _brandonPosX = brandonX; + _brandonPosY = brandonY; enterNewScene(_currentCharacter->sceneId, _currentCharacter->facing, 0, 0, 1); - _animator->_noDrawShapesFlag = 0; - _currentCharacter->x1 = brandonX; - _currentCharacter->y1 = brandonY; _animator->animRefreshNPC(0); _animator->restoreAllObjectBackgrounds(); _animator->preserveAnyChangedBackgrounds(); _animator->prepDrawAllObjects(); _animator->copyChangedObjectsForward(0); _screen->copyRegion(8, 8, 8, 8, 304, 128, 2, 0); - _screen->_disableScreen = false; _screen->updateScreen(); setMousePos(brandonX, brandonY); -- cgit v1.2.3 From a93008713a435d20d145729b2f403d475cd71cc0 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 11 Jul 2009 01:54:42 +0000 Subject: Removed the now uneeded "Screen::_disableScreen" flag. svn-id: r42366 --- engines/kyra/screen.cpp | 4 ---- engines/kyra/screen.h | 1 - 2 files changed, 5 deletions(-) diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 426907c871..6c2c48cb02 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -74,7 +74,6 @@ Screen::~Screen() { } bool Screen::init() { - _disableScreen = false; _debugEnabled = false; memset(_sjisOverlayPtrs, 0, sizeof(_sjisOverlayPtrs)); @@ -219,9 +218,6 @@ void Screen::setResolution() { } void Screen::updateScreen() { - if (_disableScreen) - return; - if (_useOverlays) updateDirtyRectsOvl(); else diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index a7a7efa7ca..d8380d104d 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -335,7 +335,6 @@ public: uint8 *_shapePages[2]; int _maskMinY, _maskMaxY; FontId _currentFont; - bool _disableScreen; // decoding functions static void decodeFrame3(const uint8 *src, uint8 *dst, uint32 size); -- cgit v1.2.3 From dd9b6fffff8a84e6ee3a6ac8a7f1e6a73da58aba Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 11 Jul 2009 05:10:13 +0000 Subject: Bugfix to show the mouse cursor when restarting the game after returning to launcher svn-id: r42368 --- engines/cruise/font.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/cruise/font.cpp b/engines/cruise/font.cpp index 8da3621bdc..c1afba3c45 100644 --- a/engines/cruise/font.cpp +++ b/engines/cruise/font.cpp @@ -159,7 +159,9 @@ void initSystem(void) { switchPal = 0; masterScreen = 0; + changeCursor(CURSOR_NOMOUSE); changeCursor(CURSOR_NORMAL); + mouseOn(); strcpy(cmdLine, ""); -- cgit v1.2.3 From 99d81ac2edd689def2713b7a88e9114343cc4ef0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 11 Jul 2009 05:12:17 +0000 Subject: Active background screens are now properly freed when the game exits svn-id: r42369 --- engines/cruise/cruise.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/engines/cruise/cruise.cpp b/engines/cruise/cruise.cpp index 4656704cb8..a2726f2da6 100644 --- a/engines/cruise/cruise.cpp +++ b/engines/cruise/cruise.cpp @@ -139,6 +139,14 @@ void CruiseEngine::initialize() { void CruiseEngine::deinitialise() { polyStructNorm.clear(); polyStructExp.clear(); + + // Clear any backgrounds + for (int i = 0; i < 8; ++i) { + if (backgroundScreens[i]) { + free(backgroundScreens[i]); + backgroundScreens[i] = NULL; + } + } } bool CruiseEngine::loadLanguageStrings() { -- cgit v1.2.3 From 2c96ca84f36d42353bed7f8830efd3822e4dde85 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 11 Jul 2009 05:14:42 +0000 Subject: Added initialisation of paging screens when the game starts svn-id: r42370 --- engines/cruise/cruise.cpp | 1 + engines/cruise/gfxModule.cpp | 6 ++++++ engines/cruise/gfxModule.h | 1 + 3 files changed, 8 insertions(+) diff --git a/engines/cruise/cruise.cpp b/engines/cruise/cruise.cpp index a2726f2da6..3d3a44a36c 100644 --- a/engines/cruise/cruise.cpp +++ b/engines/cruise/cruise.cpp @@ -118,6 +118,7 @@ void CruiseEngine::initialize() { // video init stuff initSystem(); + gfxModuleData_Init(); // another bit of video init diff --git a/engines/cruise/gfxModule.cpp b/engines/cruise/gfxModule.cpp index 47d3f49204..003a335e42 100644 --- a/engines/cruise/gfxModule.cpp +++ b/engines/cruise/gfxModule.cpp @@ -217,6 +217,12 @@ void gfxCopyRect(const uint8 *sourceBuffer, int width, int height, byte *dest, i } } +void gfxModuleData_Init(void) { + memset(globalScreen, 0, 320 * 200); + memset(page00, 0, 320 * 200); + memset(page10, 0, 320 * 200); +} + void gfxModuleData_flipScreen(void) { memcpy(globalScreen, gfxModuleData.pPage00, 320 * 200); diff --git a/engines/cruise/gfxModule.h b/engines/cruise/gfxModule.h index 4b06e62991..dc085d8b0d 100644 --- a/engines/cruise/gfxModule.h +++ b/engines/cruise/gfxModule.h @@ -56,6 +56,7 @@ void gfxCopyRect(const uint8 *sourceBuffer, int width, int height, byte *dest, i void gfxModuleData_gfxCopyScreen(const uint8 *sourcePtr, uint8 *destPtr); void convertGfxFromMode4(const uint8 *sourcePtr, int width, int height, uint8 *destPtr); void convertGfxFromMode5(const uint8 *sourcePtr, int width, int height, uint8 *destPtr); +void gfxModuleData_Init(void); void gfxModuleData_flipScreen(void); //void gfxModuleData_setPal(uint8 * ptr); void gfxModuleData_convertOldPalColor(uint16 oldColor, uint8 *pOutput); -- cgit v1.2.3 From 763c6c8ca1fc11acb4206ebb7859e1e904c0454b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Jul 2009 06:19:29 +0000 Subject: Fixed regression in the script parser from commit 42260 svn-id: r42371 --- engines/sci/console.cpp | 7 +-- engines/sci/debug.h | 2 +- engines/sci/engine/scriptdebug.cpp | 6 +-- engines/sci/engine/vm.cpp | 90 +++++++++++++++++++------------------- 4 files changed, 50 insertions(+), 55 deletions(-) diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 7f20e4013d..ebf9656739 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -545,7 +545,7 @@ bool Console::cmdSetParseNodes(int argc, const char **argv) { bool Console::cmdRegisters(int argc, const char **argv) { DebugPrintf("Current register values:\n"); - DebugPrintf("acc=%04x:%04x prev=%04x:%04x &rest=%x\n", PRINT_REG(_vm->_gamestate->r_acc), PRINT_REG(_vm->_gamestate->r_prev), scriptState.restadjust); + DebugPrintf("acc=%04x:%04x prev=%04x:%04x &rest=%x\n", PRINT_REG(_vm->_gamestate->r_acc), PRINT_REG(_vm->_gamestate->r_prev), scriptState.restAdjust); if (!_vm->_gamestate->_executionStack.empty()) { EngineState *s = _vm->_gamestate; // for PRINT_STK @@ -3226,11 +3226,6 @@ static int c_gfx_draw_viewobj(EngineState *s, const Common::Array & int c_stepover(EngineState *s, const Common::Array &cmdParams) { int opcode, opnumber; - if (!g_debugstate_valid) { - printf("Not in debug state\n"); - return 1; - } - opcode = s->_heap[*p_pc]; opnumber = opcode >> 1; if (opnumber == 0x22 /* callb */ || opnumber == 0x23 /* calle */ || diff --git a/engines/sci/debug.h b/engines/sci/debug.h index 0963159c98..cd2de2b3a9 100644 --- a/engines/sci/debug.h +++ b/engines/sci/debug.h @@ -46,7 +46,7 @@ struct ScriptState { int old_pc_offset; StackPtr old_sp; ExecStack *xs; - int16 restadjust; + int16 restAdjust; reg_t *variables[4]; // global, local, temp, param, as immediate pointers reg_t *variables_base[4]; // Used for referencing VM ops SegmentId variables_seg[4]; // Same as above, contains segment IDs diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index 9f69d21e2a..7f5f201079 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -235,11 +235,11 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod if (pos == scriptState.xs->addr.pc) { // Extra information if debugging the current opcode if (opcode == op_callk) { - int stackframe = (scr[pos.offset + 2] >> 1) + (scriptState.restadjust); + int stackframe = (scr[pos.offset + 2] >> 1) + (scriptState.restAdjust); int argc = ((scriptState.xs->sp)[- stackframe - 1]).offset; if (!s->_kernel->hasOldScriptHeader()) - argc += (scriptState.restadjust); + argc += (scriptState.restAdjust); printf(" Kernel params: ("); @@ -250,7 +250,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod } printf(")\n"); } else if ((opcode == op_send) || (opcode == op_self)) { - int restmod = scriptState.restadjust; + int restmod = scriptState.restAdjust; int stackframe = (scr[pos.offset + 1] >> 1) + restmod; reg_t *sb = scriptState.xs->sp; uint16 selector; diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index e0ac60f152..d220547c92 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -552,7 +552,7 @@ void run_vm(EngineState *s, int restoring) { StackPtr s_temp; // Temporary stack pointer int16 opparams[4]; // opcode parameters - scriptState.restadjust = s->restAdjust; + scriptState.restAdjust = s->restAdjust; // &rest adjusts the parameter count by this value // Current execution data: scriptState.xs = &(s->_executionStack.back()); @@ -931,17 +931,17 @@ void run_vm(EngineState *s, int restoring) { case 0x20: { // call int argc = (opparams[1] >> 1) // Given as offset, but we need count - + 1 + scriptState.restadjust; + + 1 + scriptState.restAdjust; StackPtr call_base = scriptState.xs->sp - argc; - scriptState.xs->sp[1].offset += scriptState.restadjust; - - xs_new = add_exec_stack_entry(s, make_reg(scriptState.xs->addr.pc.segment, - scriptState.xs->addr.pc.offset + opparams[0]), - scriptState.xs->sp, scriptState.xs->objp, - (validate_arithmetic(*call_base)) + scriptState.restadjust, - call_base, NULL_SELECTOR, scriptState.xs->objp, - s->_executionStack.size()-1, scriptState.xs->local_segment); - scriptState.restadjust = 0; // Used up the &rest adjustment + scriptState.xs->sp[1].offset += scriptState.restAdjust; + + xs_new = add_exec_stack_entry(s, make_reg(scriptState.xs->addr.pc.segment, + scriptState.xs->addr.pc.offset + opparams[0]), + scriptState.xs->sp, scriptState.xs->objp, + (validate_arithmetic(*call_base)) + scriptState.restAdjust, + call_base, NULL_SELECTOR, scriptState.xs->objp, + s->_executionStack.size()-1, scriptState.xs->local_segment); + scriptState.restAdjust = 0; // Used up the &rest adjustment scriptState.xs->sp = call_base; s->_executionStackPosChanged = true; @@ -953,8 +953,8 @@ void run_vm(EngineState *s, int restoring) { scriptState.xs->sp -= (opparams[1] >> 1) + 1; if (!s->_kernel->hasOldScriptHeader()) { - scriptState.xs->sp -= scriptState.restadjust; - s->restAdjust = 0; // We just used up the restadjust, remember? + scriptState.xs->sp -= scriptState.restAdjust; + s->restAdjust = 0; // We just used up the scriptState.restAdjust, remember? } if (opparams[0] >= (int)s->_kernel->_kernelFuncs.size()) { @@ -963,15 +963,15 @@ void run_vm(EngineState *s, int restoring) { int argc = ASSERT_ARITHMETIC(scriptState.xs->sp[0]); if (!s->_kernel->hasOldScriptHeader()) - argc += scriptState.restadjust; + argc += scriptState.restAdjust; if (s->_kernel->_kernelFuncs[opparams[0]].signature - && !kernel_matches_signature(s, - s->_kernel->_kernelFuncs[opparams[0]].signature, argc, - scriptState.xs->sp + 1)) { + && !kernel_matches_signature(s, + s->_kernel->_kernelFuncs[opparams[0]].signature, argc, + scriptState.xs->sp + 1)) { error("[VM] Invalid arguments to kernel call %x\n", opparams[0]); } else { - s->r_acc = s->_kernel->_kernelFuncs[opparams[0]].fun(s, opparams[0], + s->r_acc = s->_kernel->_kernelFuncs[opparams[0]].fun(s, opparams[0], argc, scriptState.xs->sp + 1); } // Call kernel function @@ -983,33 +983,33 @@ void run_vm(EngineState *s, int restoring) { s->_executionStackPosChanged = true; if (!s->_kernel->hasOldScriptHeader()) - scriptState.restadjust = s->restAdjust; + scriptState.restAdjust = s->restAdjust; } break; case 0x22: // callb - temp = ((opparams[1] >> 1) + scriptState.restadjust + 1); + temp = ((opparams[1] >> 1) + scriptState.restAdjust + 1); s_temp = scriptState.xs->sp; scriptState.xs->sp -= temp; - scriptState.xs->sp[0].offset += scriptState.restadjust; - xs_new = execute_method(s, 0, opparams[0], s_temp, scriptState.xs->objp, + scriptState.xs->sp[0].offset += scriptState.restAdjust; + xs_new = execute_method(s, 0, opparams[0], s_temp, scriptState.xs->objp, scriptState.xs->sp[0].offset, scriptState.xs->sp); - scriptState.restadjust = 0; // Used up the &rest adjustment + scriptState.restAdjust = 0; // Used up the &rest adjustment if (xs_new) // in case of error, keep old stack s->_executionStackPosChanged = true; break; case 0x23: // calle - temp = ((opparams[2] >> 1) + scriptState.restadjust + 1); + temp = ((opparams[2] >> 1) + scriptState.restAdjust + 1); s_temp = scriptState.xs->sp; scriptState.xs->sp -= temp; - scriptState.xs->sp[0].offset += scriptState.restadjust; - xs_new = execute_method(s, opparams[0], opparams[1], s_temp, scriptState.xs->objp, + scriptState.xs->sp[0].offset += scriptState.restAdjust; + xs_new = execute_method(s, opparams[0], opparams[1], s_temp, scriptState.xs->objp, scriptState.xs->sp[0].offset, scriptState.xs->sp); - scriptState.restadjust = 0; // Used up the &rest adjustment + scriptState.restAdjust = 0; // Used up the &rest adjustment if (xs_new) // in case of error, keep old stack s->_executionStackPosChanged = true; @@ -1027,7 +1027,7 @@ void run_vm(EngineState *s, int restoring) { s->_executionStack.pop_back(); s->_executionStackPosChanged = true; - s->restAdjust = scriptState.restadjust; // Update &rest + s->restAdjust = scriptState.restAdjust; // Update &rest return; // "Hard" return } @@ -1059,37 +1059,37 @@ void run_vm(EngineState *s, int restoring) { case 0x25: // send s_temp = scriptState.xs->sp; - scriptState.xs->sp -= ((opparams[0] >> 1) + scriptState.restadjust); // Adjust stack + scriptState.xs->sp -= ((opparams[0] >> 1) + scriptState.restAdjust); // Adjust stack - scriptState.xs->sp[1].offset += scriptState.restadjust; - xs_new = send_selector(s, s->r_acc, s->r_acc, s_temp, - (int)(opparams[0] >> 1) + scriptState.restadjust, scriptState.xs->sp); + scriptState.xs->sp[1].offset += scriptState.restAdjust; + xs_new = send_selector(s, s->r_acc, s->r_acc, s_temp, + (int)(opparams[0] >> 1) + (uint16)scriptState.restAdjust, scriptState.xs->sp); if (xs_new && xs_new != scriptState.xs) s->_executionStackPosChanged = true; - scriptState.restadjust = 0; + scriptState.restAdjust = 0; break; case 0x28: // class - s->r_acc = get_class_address(s, (unsigned)opparams[0], SCRIPT_GET_LOCK, + s->r_acc = get_class_address(s, (unsigned)opparams[0], SCRIPT_GET_LOCK, scriptState.xs->addr.pc); break; case 0x2a: // self s_temp = scriptState.xs->sp; - scriptState.xs->sp -= ((opparams[0] >> 1) + scriptState.restadjust); // Adjust stack + scriptState.xs->sp -= ((opparams[0] >> 1) + scriptState.restAdjust); // Adjust stack - scriptState.xs->sp[1].offset += scriptState.restadjust; - xs_new = send_selector(s, scriptState.xs->objp, scriptState.xs->objp, - s_temp, (int)(opparams[0] >> 1) + scriptState.restadjust, + scriptState.xs->sp[1].offset += scriptState.restAdjust; + xs_new = send_selector(s, scriptState.xs->objp, scriptState.xs->objp, + s_temp, (int)(opparams[0] >> 1) + (uint16)scriptState.restAdjust, scriptState.xs->sp); if (xs_new && xs_new != scriptState.xs) s->_executionStackPosChanged = true; - scriptState.restadjust = 0; + scriptState.restAdjust = 0; break; case 0x2b: // super @@ -1099,24 +1099,24 @@ void run_vm(EngineState *s, int restoring) { error("[VM]: Invalid superclass in object"); else { s_temp = scriptState.xs->sp; - scriptState.xs->sp -= ((opparams[1] >> 1) + scriptState.restadjust); // Adjust stack + scriptState.xs->sp -= ((opparams[1] >> 1) + scriptState.restAdjust); // Adjust stack - scriptState.xs->sp[1].offset += scriptState.restadjust; - xs_new = send_selector(s, r_temp, scriptState.xs->objp, s_temp, - (int)(opparams[1] >> 1) + scriptState.restadjust, + scriptState.xs->sp[1].offset += scriptState.restAdjust; + xs_new = send_selector(s, r_temp, scriptState.xs->objp, s_temp, + (int)(opparams[1] >> 1) + (uint16)scriptState.restAdjust, scriptState.xs->sp); if (xs_new && xs_new != scriptState.xs) s->_executionStackPosChanged = true; - scriptState.restadjust = 0; + scriptState.restAdjust = 0; } break; case 0x2c: // &rest temp = (uint16) opparams[0]; // First argument - scriptState.restadjust = MAX(scriptState.xs->argc - temp + 1, 0); // +1 because temp counts the paramcount while argc doesn't + scriptState.restAdjust = MAX(scriptState.xs->argc - temp + 1, 0); // +1 because temp counts the paramcount while argc doesn't for (; temp <= scriptState.xs->argc; temp++) PUSH32(scriptState.xs->variables_argp[temp]); -- cgit v1.2.3 From 0b47fa50aeed43fbd2643edbda293c1bd698f5c4 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Jul 2009 06:33:19 +0000 Subject: Applied a slightly modified patch from clone2727 which adds static selector names to some demos which are missing them (KQ4, LSL1, LSL3, Iceman and Christmas1992) svn-id: r42372 --- dists/msvc8/sci.vcproj | 1 + dists/msvc9/sci.vcproj | 1 + engines/sci/engine/kernel.cpp | 40 ++- engines/sci/engine/kernel.h | 6 + engines/sci/engine/static_selectors.cpp | 429 ++++++++++++++++++++++++++++++++ engines/sci/module.mk | 1 + 6 files changed, 470 insertions(+), 8 deletions(-) create mode 100644 engines/sci/engine/static_selectors.cpp diff --git a/dists/msvc8/sci.vcproj b/dists/msvc8/sci.vcproj index ec0c392a49..4a9862d7f6 100644 --- a/dists/msvc8/sci.vcproj +++ b/dists/msvc8/sci.vcproj @@ -50,6 +50,7 @@ + diff --git a/dists/msvc9/sci.vcproj b/dists/msvc9/sci.vcproj index d5a5f37f6c..1fe6c97ec8 100644 --- a/dists/msvc9/sci.vcproj +++ b/dists/msvc9/sci.vcproj @@ -51,6 +51,7 @@ + diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index dd2d0dc61a..83a2ee4dec 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -384,10 +384,14 @@ Kernel::~Kernel() { void Kernel::detectSciFeatures() { Resource *r = _resmgr->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SNAMES), 0); - if (!r) // No such resource? + Common::StringList staticSelectorTable; + + if (!r) { // No such resource? + staticSelectorTable = checkStaticSelectorNames(); error("Kernel: Could not retrieve selector names"); + } - int count = READ_LE_UINT16(r->data) + 1; // Counter is slightly off + int count = staticSelectorTable.empty() ? READ_LE_UINT16(r->data) + 1 : staticSelectorTable.size(); // Counter is slightly off features = 0; // Initialize features based on SCI version @@ -397,10 +401,16 @@ void Kernel::detectSciFeatures() { } for (int i = 0; i < count; i++) { - int offset = READ_LE_UINT16(r->data + 2 + i * 2); - int len = READ_LE_UINT16(r->data + offset); - - Common::String tmp((const char *)r->data + offset + 2, len); + Common::String tmp; + + if (staticSelectorTable.empty()) { + int offset = READ_LE_UINT16(r->data + 2 + i * 2); + int len = READ_LE_UINT16(r->data + offset); + + tmp = Common::String((const char *)r->data + offset + 2, len); + } else { + tmp = staticSelectorTable[i]; + } if (tmp == "setTarget") // "motionInited" can also be used features &= ~kFeatureOldScriptHeader; @@ -459,8 +469,22 @@ void Kernel::detectSciFeatures() { void Kernel::loadSelectorNames() { Resource *r = _resmgr->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SNAMES), 0); - if (!r) // No such resource? - error("Kernel: Could not retrieve selector names"); + if (!r) { // No such resource? + // Check if we have a table for this game + // Some demos do not have a selector table + Common::StringList staticSelectorTable = checkStaticSelectorNames(); + + if (staticSelectorTable.empty()) + error("Kernel: Could not retrieve selector names"); + + for (uint32 i = 0; i < staticSelectorTable.size(); i++) { + _selectorNames.push_back(staticSelectorTable[i]); + if (features & kFeatureOldScriptHeader) + _selectorNames.push_back(staticSelectorTable[i]); + } + + return; + } int count = READ_LE_UINT16(r->data) + 1; // Counter is slightly off diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index 4814bd0317..17997e4a20 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -157,6 +157,12 @@ private: * Loads the kernel selector names. */ void loadSelectorNames(); + + /** + * Check for any hardcoded selector table we might have that can be used + * if a game is missing the selector names. + */ + Common::StringList checkStaticSelectorNames(); /** * Maps special selectors diff --git a/engines/sci/engine/static_selectors.cpp b/engines/sci/engine/static_selectors.cpp new file mode 100644 index 0000000000..497a0ad769 --- /dev/null +++ b/engines/sci/engine/static_selectors.cpp @@ -0,0 +1,429 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +// We place selector vocab name tables here for any game that doesn't have +// them. This includes the King's Quest IV Demo and LSL3 Demo. + +#ifndef SCI_STATIC_SELECTORS_H +#define SCI_STATIC_SELECTORS_H + +#include "sci/engine/kernel.h" + +namespace Sci { + +struct SelectorRemap { + const char *name; + uint32 slot; +}; + +// Taken from King's Quest IV (Full Game) +static const SelectorRemap kq4_demo_selectors[] = { + { "init", 87 }, + { "play", 42 }, + { "replay", 65 }, + { "x", 4 }, + { "y", 3 }, + { "z", 85 }, + { "priority", 63 }, + { "view", 5 }, + { "loop", 6 }, + { "cel", 7 }, + { "brLeft", 20 }, + { "brRight", 22 }, + { "brTop", 19 }, + { "brBottom", 21 }, + { "xStep", 54 }, + { "yStep", 55 }, + { "nsBottom", 11 }, + { "nsTop", 9 }, + { "nsLeft", 10 }, + { "nsRight", 12 }, + { "font", 33 }, + { "text", 26 }, + { "type", 34 }, + { "state", 32 }, + { "doit", 60 }, + { "delete", 84 }, + { "signal", 17 }, + { "underBits", 8 }, + { "canBeHere", 57 }, + { "client", 45 }, + { "dx", 46 }, + { "dy", 47 }, + { "xStep", 54 }, + { "yStep", 55 }, + { "b-moveCnt", 48 }, + { "b-i1", 49 }, + { "b-i2", 50 }, + { "b-di", 51 }, + { "b-xAxis", 52 }, + { "b-incr", 53 }, + { "completed", 158 }, + { "illegalBits", 18 }, + { "dispose", 88 }, + { "prevSignal", 129 }, + { "message", 40 }, + { "modifiers", 64 }, + { "cue", 121 }, + { "owner", 130 }, + { "handle", 44 }, + { "number", 43 }, + { "max", 37 }, + { "cursor", 36 }, + { "claimed", 76 }, + { "edgeHit", 225 }, + { "wordFail", 71 }, + { "syntaxFail", 72 }, + { "semanticFail", 73 }, + { "cycler", 165 }, + { "elements", 27 }, + { "lsTop", 13 }, + { "lsBottom", 15 }, + { "lsLeft", 14 }, + { "lsRight", 16 }, + { "baseSetter", 208 }, + { "who", 39 }, + { "distance", 173 }, + { "mover", 59 }, + { "looper", 62 }, + { "isBlocked", 61 }, + { "heading", 58 }, + { "mode", 30 }, + { "caller", 119 }, + { "moveDone", 169 }, + { "size", 96 }, + { "moveSpeed", 56 }, + { "motionCue", 161 }, + { "setTarget", 171 } +}; + +// Taken from EcoQuest 2 (Demo) +static const SelectorRemap christmas1992_selectors[] = { + { "init", 110 }, + { "play", 39 }, + { "replay", 62 }, + { "x", 1 }, + { "y", 0 }, + { "z", 82 }, + { "priority", 60 }, + { "view", 2 }, + { "loop", 3 }, + { "cel", 4 }, + { "brLeft", 17 }, + { "brRight", 19 }, + { "brTop", 16 }, + { "brBottom", 18 }, + { "xStep", 51 }, + { "yStep", 52 }, + { "nsBottom", 8 }, + { "nsTop", 6 }, + { "nsLeft", 7 }, + { "nsRight", 9 }, + { "font", 30 }, + { "text", 23 }, + { "type", 31 }, + { "state", 29 }, + { "doit", 57 }, + { "delete", 81 }, + { "signal", 14 }, + { "underBits", 5 }, + { "canBeHere", 450 }, + { "client", 42 }, + { "dx", 43 }, + { "dy", 44 }, + { "xStep", 51 }, + { "yStep", 52 }, + { "b-moveCnt", 45 }, + { "b-i1", 46 }, + { "b-i2", 47 }, + { "b-di", 48 }, + { "b-xAxis", 49 }, + { "b-incr", 50 }, + { "completed", 250 }, + { "illegalBits", 15 }, + { "dispose", 111 }, + { "prevSignal", 171 }, + { "message", 37 }, + { "modifiers", 61 }, + { "cue", 145 }, + { "owner", 172 }, + { "handle", 90 }, + { "number", 40 }, + { "max", 34 }, + { "cursor", 33 }, + { "claimed", 73 }, + { "edgeHit", 333 }, + { "wordFail", 68 }, + { "syntaxFail", 69 }, + { "semanticFail", 70 }, + { "cycler", 255 }, + { "elements", 24 }, + { "lsTop", 10 }, + { "lsBottom", 12 }, + { "lsLeft", 11 }, + { "lsRight", 13 }, + { "baseSetter", 310 }, + { "who", 36 }, + { "distance", 264 }, + { "mover", 56 }, + { "looper", 59 }, + { "isBlocked", 58 }, + { "heading", 55 }, + { "mode", 27 }, + { "caller", 143 }, + { "moveDone", 97 }, + { "vol", 94 }, + { "pri", 95 }, + { "min", 91 }, + { "sec", 92 }, + { "frame", 93 }, + { "dataInc", 89 }, + { "size", 86 }, + { "palette", 88 }, + { "moveSpeed", 53 }, + { "cantBeHere", 54 }, + { "nodePtr", 41 }, + { "flags", 99 }, + { "points", 87 }, + { "syncCue", 271 }, + { "syncTime", 270 }, + { "printLang", 84 }, + { "subtitleLang", 85 }, + { "parseLang", 83 }, + { "setVol", 178 } +}; + +// Taken from Leisure Suit Larry 1 VGA (Full Game) +static const SelectorRemap lsl1_demo_selectors[] = { + { "init", 104 }, + { "play", 42 }, + { "replay", 65 }, + { "x", 4 }, + { "y", 3 }, + { "z", 85 }, + { "priority", 63 }, + { "view", 5 }, + { "loop", 6 }, + { "cel", 7 }, + { "brLeft", 20 }, + { "brRight", 22 }, + { "brTop", 19 }, + { "brBottom", 21 }, + { "xStep", 54 }, + { "yStep", 55 }, + { "nsBottom", 11 }, + { "nsTop", 9 }, + { "nsLeft", 10 }, + { "nsRight", 12 }, + { "font", 33 }, + { "text", 26 }, + { "type", 34 }, + { "state", 32 }, + { "doit", 60 }, + { "delete", 84 }, + { "signal", 17 }, + { "underBits", 8 }, + { "canBeHere", 232 }, + { "client", 45 }, + { "dx", 46 }, + { "dy", 47 }, + { "xStep", 54 }, + { "yStep", 55 }, + { "b-moveCnt", 48 }, + { "b-i1", 49 }, + { "b-i2", 50 }, + { "b-di", 51 }, + { "b-xAxis", 52 }, + { "b-incr", 53 }, + { "completed", 210 }, + { "illegalBits", 18 }, + { "dispose", 105 }, + { "prevSignal", 149 }, + { "message", 40 }, + { "modifiers", 64 }, + { "cue", 136 }, + { "owner", 150 }, + { "handle", 93 }, + { "number", 43 }, + { "max", 37 }, + { "cursor", 36 }, + { "claimed", 76 }, + { "edgeHit", 321 }, + { "wordFail", 71 }, + { "syntaxFail", 72 }, + { "semanticFail", 73 }, + { "cycler", 215 }, + { "elements", 27 }, + { "lsTop", 13 }, + { "lsBottom", 15 }, + { "lsLeft", 14 }, + { "lsRight", 16 }, + { "baseSetter", 290 }, + { "who", 39 }, + { "distance", 224 }, + { "mover", 59 }, + { "looper", 62 }, + { "isBlocked", 61 }, + { "heading", 58 }, + { "mode", 30 }, + { "caller", 134 }, + { "moveDone", 100 }, + { "vol", 97 }, + { "pri", 98 }, + { "min", 94 }, + { "sec", 95 }, + { "frame", 96 }, + { "dataInc", 92 }, + { "size", 89 }, + { "palette", 91 }, + { "moveSpeed", 56 }, + { "cantBeHere", 57 }, + { "nodePtr", 44 }, + { "flags", 102 }, + { "points", 90 }, + { "syncCue", 248 }, + { "syncTime", 247 }, + { "printLang", 87 }, + { "subtitleLang", 88 }, + { "parseLang", 86 }, + { "setVol", 156 }, + { "motionCue", 213 }, + { "setTarget", 221 }, + { "egoMoveSpeed", 370 } +}; + +// Taken from Codename: Iceman (Full Game) +static const SelectorRemap iceman_demo_selectors[] = { + { "init", 87 }, + { "play", 42 }, + { "replay", 65 }, + { "x", 4 }, + { "y", 3 }, + { "z", 85 }, + { "priority", 63 }, + { "view", 5 }, + { "loop", 6 }, + { "cel", 7 }, + { "brLeft", 20 }, + { "brRight", 22 }, + { "brTop", 19 }, + { "brBottom", 21 }, + { "xStep", 54 }, + { "yStep", 55 }, + { "nsBottom", 11 }, + { "nsTop", 9 }, + { "nsLeft", 10 }, + { "nsRight", 12 }, + { "font", 33 }, + { "text", 26 }, + { "type", 34 }, + { "state", 32 }, + { "doit", 60 }, + { "delete", 84 }, + { "signal", 17 }, + { "underBits", 8 }, + { "canBeHere", 57 }, + { "client", 45 }, + { "dx", 46 }, + { "dy", 47 }, + { "xStep", 54 }, + { "yStep", 55 }, + { "b-moveCnt", 48 }, + { "b-i1", 49 }, + { "b-i2", 50 }, + { "b-di", 51 }, + { "b-xAxis", 52 }, + { "b-incr", 53 }, + { "completed", 159 }, + { "illegalBits", 18 }, + { "dispose", 88 }, + { "prevSignal", 129 }, + { "message", 40 }, + { "modifiers", 64 }, + { "cue", 121 }, + { "owner", 130 }, + { "handle", 44 }, + { "number", 43 }, + { "max", 37 }, + { "cursor", 36 }, + { "claimed", 76 }, + { "edgeHit", 236 }, + { "wordFail", 71 }, + { "syntaxFail", 72 }, + { "semanticFail", 73 }, + { "cycler", 164 }, + { "elements", 27 }, + { "lsTop", 13 }, + { "lsBottom", 15 }, + { "lsLeft", 14 }, + { "lsRight", 16 }, + { "baseSetter", 207 }, + { "who", 39 }, + { "distance", 173 }, + { "mover", 59 }, + { "looper", 62 }, + { "isBlocked", 61 }, + { "heading", 58 }, + { "mode", 30 }, + { "caller", 119 }, + { "moveDone", 170 }, + { "size", 96 }, + { "moveSpeed", 56 }, + { "flags", 368 }, + { "points", 316 }, + { "motionCue", 162 }, + { "setTarget", 171 } +}; + +// A macro for loading one of the above tables in the function below +#define USE_SELECTOR_TABLE(x) \ + do { \ + for (uint32 i = 0; i < ARRAYSIZE(x); i++) { \ + if (x[i].slot >= names.size()) \ + names.resize(x[i].slot + 1); \ + names[x[i].slot] = x[i].name; \ + } \ + } while (0) + +Common::StringList Kernel::checkStaticSelectorNames() { + Common::String gameID = ((SciEngine*)g_engine)->getGameID(); + + Common::StringList names; + + if (gameID == "kq4sci") + USE_SELECTOR_TABLE(kq4_demo_selectors); + else if (gameID == "lsl3" || gameID == "iceman") // identical, except iceman has "flags" + USE_SELECTOR_TABLE(iceman_demo_selectors); + else if (gameID == "christmas1992") + USE_SELECTOR_TABLE(christmas1992_selectors); + else if (gameID == "lsl1sci") + USE_SELECTOR_TABLE(lsl1_demo_selectors); + + return names; +} + +} // End of namespace Sci + +#endif SCI_STATIC_SELECTORS_H diff --git a/engines/sci/module.mk b/engines/sci/module.mk index f2c58bcd8d..bada214b61 100644 --- a/engines/sci/module.mk +++ b/engines/sci/module.mk @@ -33,6 +33,7 @@ MODULE_OBJS = \ engine/script.o \ engine/scriptdebug.o \ engine/seg_manager.o \ + engine/static_selectors.o \ engine/stringfrag.o \ engine/state.o \ engine/vm.o \ -- cgit v1.2.3 From 4f2b8579829d0f32345e6932814af54c181d2cd8 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Jul 2009 06:34:25 +0000 Subject: Removed an invalid detection entry svn-id: r42373 --- engines/sci/detection.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index a80baf182e..566d82405a 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -800,16 +800,6 @@ static const struct SciGameDescription SciGameDescriptions[] = { }, #endif // ENABLE_SCI32 - // Hoyle 1 - English DOS Non-Interactive Demo - {{"hoyle1", "Demo", { - {"resource.map", 0, "60f764020a6b788bbbe415dbc2ccb9f3", 931}, - {"resource.000", 0, "5fe3670e3ddcd4f85c10013b5453141a", 615522}, - {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH}, - GF_FOR_SCI0_BEFORE_629, - SCI_VERSION_AUTODETECT, - SCI_VERSION_0 - }, - // Hoyle 1 - English DOS (supplied by wibble92 in bug report #2644547) // SCI interpreter version 0.000.530 {{"hoyle1", "", { -- cgit v1.2.3 From 28dd343e08afb9eeb8318d06c8c18eb6b48fd210 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Jul 2009 06:43:01 +0000 Subject: Applied slightly modified patch 2819002 - "SCI: resource-view-patch on SQ5/German fix" svn-id: r42374 --- engines/sci/resource.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 5fdc286894..a0aa40bcd5 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -883,6 +883,21 @@ void ResourceManager::processPatch(ResourceSource *source, ResourceType restype, debug("Patching %s failed - resource type mismatch", source->location_name.c_str()); return; } + + // Fixes SQ5/German, patch file special case logic taken from SCI View disassembly + if (patch_data_offset & 0x80) { + switch (patch_data_offset & 0x7F) { + case 0: + patch_data_offset = 24; + break; + case 1: + patch_data_offset = 2; + break; + default: + warning("Resource patch unsupported special case %X\n", patch_data_offset); + } + } + if (patch_data_offset + 2 >= fsize) { debug("Patching %s failed - patch starting at offset %d can't be in file of size %d", source->location_name.c_str(), patch_data_offset + 2, fsize); -- cgit v1.2.3 From 2b5fac58d5323847042e53f114ad94ce2d526f3b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Jul 2009 06:53:39 +0000 Subject: Applied patch 2818733 - "SCI: Timer iterator for audio resources played via doSound" svn-id: r42375 --- engines/sci/engine/ksound.cpp | 17 ++++++++++++----- engines/sci/sfx/iterator.cpp | 35 +++++++++++++++++++++++++++++++++++ engines/sci/sfx/iterator.h | 6 ++++++ engines/sci/sfx/iterator_internal.h | 22 ++++++++++++++++++++++ 4 files changed, 75 insertions(+), 5 deletions(-) diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 7614b2bc10..4ba8971397 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -148,6 +148,9 @@ SongIterator *build_iterator(EngineState *s, int song_nr, SongIteratorType type, return songit_new(song->data, song->size, type, id); } +SongIterator *build_timeriterator(EngineState *s, int delta) { + return new_timer_iterator(delta); +} void process_sound_events(EngineState *s) { /* Get all sound events, apply their changes to the heap */ int result; @@ -798,6 +801,7 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { int looping = GET_SEL32V(obj, loop); //int vol = GET_SEL32V(obj, vol); int pri = GET_SEL32V(obj, pri); + int sampleLen = 0; Song *song = s->_sound._songlib.findSong(handle); if (GET_SEL32V(obj, nodePtr) && (song && number != song->_resourceNum)) { @@ -815,8 +819,11 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { s->_version >= SCI_VERSION_1_1) { // Found a relevant audio resource, play it s->_sound.stopAudio(); - PUT_SEL32V(obj, signal, s->_sound.startAudio(65535, number)); - return s->r_acc; + warning("Initializing audio resource instead of requested sound resource %d\n", number); + sampleLen = s->_sound.startAudio(65535, number); + // Also create iterator, that will fire SI_FINISHED event, when the sound is done playing + s->_sound.sfx_add_song(build_timeriterator(s, sampleLen), 0, handle, number); + PUT_SEL32V(obj, signal, sampleLen); } else { if (!s->resmgr->testResource(ResourceId(kResourceTypeSound, number))) { warning("Could not open song number %d", number); @@ -825,11 +832,11 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { PUT_SEL32V(obj, signal, -1); return s->r_acc; } + debugC(2, kDebugLevelSound, "Initializing song number %d\n", number); + s->_sound.sfx_add_song(build_iterator(s, number, SCI_SONG_ITERATOR_TYPE_SCI1, + handle), 0, handle, number); } - debugC(2, kDebugLevelSound, "Initializing song number %d\n", number); - s->_sound.sfx_add_song(build_iterator(s, number, SCI_SONG_ITERATOR_TYPE_SCI1, - handle), 0, handle, number); PUT_SEL32(obj, nodePtr, obj); PUT_SEL32(obj, handle, obj); } diff --git a/engines/sci/sfx/iterator.cpp b/engines/sci/sfx/iterator.cpp index ebba4bceac..6c5706a8c1 100644 --- a/engines/sci/sfx/iterator.cpp +++ b/engines/sci/sfx/iterator.cpp @@ -1164,6 +1164,41 @@ int CleanupSongIterator::nextCommand(byte *buf, int *result) { return SI_FINISHED; } +/**********************/ +/*-- Timer iterator --*/ +/**********************/ +TimerSongIterator::TimerSongIterator(int delta) + : _delta(delta) { +} + +int TimerSongIterator::nextCommand(byte *buf, int *result) { + if (_delta) { + return _delta; + } + return SI_FINISHED; +} + +SongIterator *TimerSongIterator::handleMessage(Message msg) { + return NULL; +} + +int TimerSongIterator::getTimepos() { + return 0; +} + +Audio::AudioStream *TimerSongIterator::getAudioStream() { + return NULL; +} + +SongIterator *TimerSongIterator::clone(int delta) { + TimerSongIterator *newit = new TimerSongIterator(*this); + return newit; +} + +SongIterator *new_timer_iterator(int delta) { + return new TimerSongIterator(delta); +} + /**********************************/ /*-- Fast-forward song iterator --*/ /**********************************/ diff --git a/engines/sci/sfx/iterator.h b/engines/sci/sfx/iterator.h index 547c479bbf..4e6df367c9 100644 --- a/engines/sci/sfx/iterator.h +++ b/engines/sci/sfx/iterator.h @@ -281,6 +281,12 @@ int songit_next(SongIterator **it, byte *buf, int *result, int mask); */ SongIterator *songit_new(byte *data, uint size, SongIteratorType type, songit_id_t id); +/* Constructs a new song timer iterator object +** Parameters: (int) delta: The delta after which to fire SI_FINISHED +** Returns : (SongIterator *) A newly allocated but uninitialized song +** iterator +*/ +SongIterator *new_timer_iterator(int delta); /* Handles a message to the song iterator ** Parameters: (SongIterator **): A reference to the variable storing the song iterator diff --git a/engines/sci/sfx/iterator_internal.h b/engines/sci/sfx/iterator_internal.h index 7d5a17fd25..00044b8ab7 100644 --- a/engines/sci/sfx/iterator_internal.h +++ b/engines/sci/sfx/iterator_internal.h @@ -181,6 +181,28 @@ private: #define PLAYMASK_NONE 0x0 +/***************************/ +/*--------- Timer ---------*/ +/***************************/ + +/** + * A song iterator which waits a specified time and then fires + * SI_FINISHED. Used by DoSound, where audio resources are played (SCI1) + */ +class TimerSongIterator : public SongIterator { +protected: + int _delta; /**!< Remaining time */ + +public: + TimerSongIterator(int delta); + + int nextCommand(byte *buf, int *result); + Audio::AudioStream *getAudioStream(); + SongIterator *handleMessage(Message msg); + int getTimepos(); + SongIterator *clone(int delta); +}; + /**********************************/ /*--------- Fast Forward ---------*/ /**********************************/ -- cgit v1.2.3 From 9594beb39fa6eb6c9bad7572989f0eb50fc3bc32 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sat, 11 Jul 2009 07:03:28 +0000 Subject: Only error out, if checkStaticSelectorNames() fails. svn-id: r42376 --- engines/sci/engine/kernel.cpp | 3 ++- engines/sci/engine/static_selectors.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 83a2ee4dec..4133f4cb3b 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -388,7 +388,8 @@ void Kernel::detectSciFeatures() { if (!r) { // No such resource? staticSelectorTable = checkStaticSelectorNames(); - error("Kernel: Could not retrieve selector names"); + if (staticSelectorTable.empty()) + error("Kernel: Could not retrieve selector names"); } int count = staticSelectorTable.empty() ? READ_LE_UINT16(r->data) + 1 : staticSelectorTable.size(); // Counter is slightly off diff --git a/engines/sci/engine/static_selectors.cpp b/engines/sci/engine/static_selectors.cpp index 497a0ad769..c1d0ad9bac 100644 --- a/engines/sci/engine/static_selectors.cpp +++ b/engines/sci/engine/static_selectors.cpp @@ -426,4 +426,4 @@ Common::StringList Kernel::checkStaticSelectorNames() { } // End of namespace Sci -#endif SCI_STATIC_SELECTORS_H +#endif // SCI_STATIC_SELECTORS_H -- cgit v1.2.3 From 6bf91ab66f392df80ae1171d7882127b1ab81dcf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 11 Jul 2009 08:16:55 +0000 Subject: Bugfix to properly save the currently playing midi music when saving a scene svn-id: r42377 --- engines/tinsel/music.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp index f80217b4f4..12d9f0393a 100644 --- a/engines/tinsel/music.cpp +++ b/engines/tinsel/music.cpp @@ -207,6 +207,10 @@ bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) { if (track > 0) { StopMidi(); + // StopMidi resets these fields, so set them again + currentMidi = dwFileOffset; + currentLoop = bLoop; + // try to play track, but don't fall back to a true CD AudioCD.play(track, bLoop ? -1 : 1, 0, 0, true); -- cgit v1.2.3 From d3d06626e41a28c70b489a164a018c0ba65d0547 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 11 Jul 2009 09:45:25 +0000 Subject: Fix oversight in r42361 and also handle consecutive copied characters in SAGA. svn-id: r42378 --- engines/saga/font.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/saga/font.cpp b/engines/saga/font.cpp index 1c1c3100c4..d58d1a8900 100644 --- a/engines/saga/font.cpp +++ b/engines/saga/font.cpp @@ -154,6 +154,7 @@ void Font::createOutline(FontData *font) { unsigned char *destPointer2; unsigned char *destPointer3; unsigned char charRep; + int nextIndex = 0; // Populate new font style character data @@ -167,7 +168,7 @@ void Font::createOutline(FontData *font) { bool skip = false; - if (i > 0 && font->normal.fontCharEntry[i].width != 0 && font->normal.fontCharEntry[i].index < font->normal.fontCharEntry[i-1].index) { + if (font->normal.fontCharEntry[i].width != 0 && font->normal.fontCharEntry[i].index < nextIndex) { // Some characters are copies of earlier characters. // Look up the original, and make sure not to grow the size of // the outline font twice. @@ -200,8 +201,10 @@ void Font::createOutline(FontData *font) { font->outline.fontCharEntry[i].width = font->normal.fontCharEntry[i].width + 2; font->outline.fontCharEntry[i].byteWidth = newByteWidth; - if (!skip) + if (!skip) { newRowLength += newByteWidth; + nextIndex = font->normal.fontCharEntry[i].index + oldByteWidth; + } } debug(2, "New row length: %d", newRowLength); -- cgit v1.2.3 From 2ceea652e62b301adea4628cebe4116191aa4998 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sat, 11 Jul 2009 10:24:06 +0000 Subject: Explicitely instantiate the decompressWizImage() templates, so that they won't be optimized away, as they are also used in akos.cpp svn-id: r42380 --- engines/scumm/he/wiz_he.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp index b23b7ac869..4c20ed7835 100644 --- a/engines/scumm/he/wiz_he.cpp +++ b/engines/scumm/he/wiz_he.cpp @@ -831,6 +831,11 @@ void Wiz::decompressWizImage(uint8 *dst, int dstPitch, const uint8 *src, const C } } +// NOTE: These templates are used outside this file. We don't want the compiler to optimize them away, so we need to explicitely instantiate them. +template void Wiz::decompressWizImage(uint8 *dst, int dstPitch, const uint8 *src, const Common::Rect &srcRect, int flags, const uint8 *palPtr, const uint8 *xmapPtr); +template void Wiz::decompressWizImage(uint8 *dst, int dstPitch, const uint8 *src, const Common::Rect &srcRect, int flags, const uint8 *palPtr, const uint8 *xmapPtr); +template void Wiz::decompressWizImage(uint8 *dst, int dstPitch, const uint8 *src, const Common::Rect &srcRect, int flags, const uint8 *palPtr, const uint8 *xmapPtr); + template void Wiz::decompressRawWizImage(uint8 *dst, int dstPitch, const uint8 *src, int srcPitch, int w, int h, int transColor, const uint8 *palPtr) { if (type == kWizRMap) { -- cgit v1.2.3 From 1c02b93b7093c436978d8ad8916dabf43cd1591e Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sat, 11 Jul 2009 12:23:42 +0000 Subject: Fix pinball type mini game in Putt-Putt Enters The Race. svn-id: r42382 --- engines/scumm/he/logic_he.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/scumm/he/logic_he.cpp b/engines/scumm/he/logic_he.cpp index a095622173..a24f4d4665 100644 --- a/engines/scumm/he/logic_he.cpp +++ b/engines/scumm/he/logic_he.cpp @@ -357,8 +357,8 @@ int32 LogicHErace::op_1140(int32 *args) { const double scalarProduct = x * args[0] + y * args[1]; // Finally compute the projection of (arg2,arg3) onto (arg0,arg1) - double projX = args[0] - 2 * scalarProduct * args[2]; - double projY = args[1] - 2 * scalarProduct * args[3]; + double projX = args[0] - 2 * scalarProduct * x; + double projY = args[1] - 2 * scalarProduct * y; projX = projX * 20.0 / 23.0; // FIXME: Why is this here? -- cgit v1.2.3 From 8dd34921945ea0ce7f77e6c71ec5fbafaeb77622 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 11 Jul 2009 15:00:40 +0000 Subject: SCI: don't let TimerSongIterator loop forever, and don't immediately signal completion when starting it. This fixes a sync issue with the departing spaceship at the start of SQ4CD (after the intro). svn-id: r42385 --- engines/sci/engine/ksound.cpp | 1 - engines/sci/sfx/iterator.cpp | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 4ba8971397..95c2eaab1d 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -823,7 +823,6 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { sampleLen = s->_sound.startAudio(65535, number); // Also create iterator, that will fire SI_FINISHED event, when the sound is done playing s->_sound.sfx_add_song(build_timeriterator(s, sampleLen), 0, handle, number); - PUT_SEL32V(obj, signal, sampleLen); } else { if (!s->resmgr->testResource(ResourceId(kResourceTypeSound, number))) { warning("Could not open song number %d", number); diff --git a/engines/sci/sfx/iterator.cpp b/engines/sci/sfx/iterator.cpp index 6c5706a8c1..dc2979abda 100644 --- a/engines/sci/sfx/iterator.cpp +++ b/engines/sci/sfx/iterator.cpp @@ -1173,7 +1173,9 @@ TimerSongIterator::TimerSongIterator(int delta) int TimerSongIterator::nextCommand(byte *buf, int *result) { if (_delta) { - return _delta; + int d = _delta; + _delta = 0; + return d; } return SI_FINISHED; } -- cgit v1.2.3 From 848b9cda03ce5417ea2c89612fc411699643ff9c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Jul 2009 16:07:14 +0000 Subject: If we fail to auto-detect either the volume or the map version, set the one to be equal to the other svn-id: r42386 --- engines/sci/resource.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index a0aa40bcd5..b425c23876 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -470,6 +470,15 @@ ResourceManager::ResourceManager(int version, int maxMemory) { } else { _mapVersion = detectMapVersion(); _volVersion = detectVolVersion(); + if (_volVersion == 0 && _mapVersion > 0) { + warning("Volume version not detected, but map version has been detected. Setting volume version to map version"); + _volVersion = _mapVersion; + } + + if (_mapVersion == 0 && _volVersion > 0) { + warning("Map version not detected, but volume version has been detected. Setting map version to volume version"); + _mapVersion = _volVersion; + } } debug("Using resource map version %d %s", _mapVersion, versionNames[_mapVersion]); debug("Using volume version %d %s", _volVersion, versionNames[_volVersion]); -- cgit v1.2.3 From 4f0888b8b65531c71c7aefafd9dda0d662a0dfc1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Jul 2009 17:25:49 +0000 Subject: Removed the version parameter from GfxResManager svn-id: r42387 --- engines/sci/gfx/gfx_resmgr.cpp | 5 +++-- engines/sci/gfx/gfx_resmgr.h | 4 +--- engines/sci/gfx/operations.cpp | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index 9e9a8d2d13..f4c5fdf0dd 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -49,12 +49,13 @@ struct param_struct { GfxDriver *driver; }; -GfxResManager::GfxResManager(int version, gfx_options_t *options, GfxDriver *driver, ResourceManager *resManager) : - _version(version), _options(options), _driver(driver), _resManager(resManager), +GfxResManager::GfxResManager(gfx_options_t *options, GfxDriver *driver, ResourceManager *resManager) : + _options(options), _driver(driver), _resManager(resManager), _lockCounter(0), _tagLockCounter(0), _staticPalette(0) { gfxr_init_static_palette(); _portBounds = Common::Rect(0, 10, 320, 200); // default value, with a titlebar of 10px + _version = resManager->_volVersion; if (!_resManager->isVGA()) { _staticPalette = gfx_sci0_pic_colors->getref(); diff --git a/engines/sci/gfx/gfx_resmgr.h b/engines/sci/gfx/gfx_resmgr.h index 8230e84aa0..fc4e0b3d6f 100644 --- a/engines/sci/gfx/gfx_resmgr.h +++ b/engines/sci/gfx/gfx_resmgr.h @@ -90,9 +90,7 @@ typedef Common::HashMap IntResMap; /** Graphics resource manager */ class GfxResManager { public: - GfxResManager(int version, gfx_options_t *options, - GfxDriver *driver, ResourceManager *resManager); - + GfxResManager(gfx_options_t *options, GfxDriver *driver, ResourceManager *resManager); ~GfxResManager(); /** diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index f714ab0245..2c536912b3 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -423,7 +423,7 @@ int gfxop_init(int version, GfxState *state, gfx_options_t *options, ResourceMan state->driver = new GfxDriver(xfact, yfact, bpp); - state->gfxResMan = new GfxResManager(version, state->options, state->driver, resManager); + state->gfxResMan = new GfxResManager(state->options, state->driver, resManager); gfxop_set_clip_zone(state, gfx_rect(0, 0, 320, 200)); -- cgit v1.2.3 From f0892cdcbef2dff7a9f072d2bb7df42aa3d44a14 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Jul 2009 19:00:56 +0000 Subject: Some work on QFG1VGA (looks like a mix of SCI1 and SCI1.1) svn-id: r42393 --- engines/sci/gfx/gfx_resmgr.cpp | 5 +++++ engines/sci/resource.cpp | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index f4c5fdf0dd..4a3c79feef 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -57,6 +57,11 @@ GfxResManager::GfxResManager(gfx_options_t *options, GfxDriver *driver, Resource _portBounds = Common::Rect(0, 10, 320, 200); // default value, with a titlebar of 10px _version = resManager->_volVersion; + // Workaround for QFG1 VGA (has SCI 1.1 view data with SCI 1 compression) + if (_version == SCI_VERSION_1 && !strcmp(((SciEngine*)g_engine)->getGameID(), "qfg1")) { + _version = SCI_VERSION_1_1; + } + if (!_resManager->isVGA()) { _staticPalette = gfx_sci0_pic_colors->getref(); } else if (_version == SCI_VERSION_1_1) { diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index b425c23876..d99f9f0771 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -537,6 +537,12 @@ ResourceManager::ResourceManager(int version, int maxMemory) { } } + // Workaround for QFG1 VGA (has SCI 1.1 view data with SCI 1 compression) + if (version == SCI_VERSION_1 && !strcmp(((SciEngine*)g_engine)->getGameID(), "qfg1")) { + debug("Resmgr: Detected QFG1 VGA"); + _isVGA = true; + } + _sciVersion = version; // temporary version printout - should be reworked later switch (_sciVersion) { @@ -721,7 +727,7 @@ int ResourceManager::detectMapVersion() { } } if (file.isOpen() == false) { - warning("Failed to open resource map file"); + error("Failed to open resource map file"); return SCI_VERSION_AUTODETECT; } // detection @@ -801,7 +807,7 @@ int ResourceManager::detectVolVersion() { } } if (file.isOpen() == false) { - warning("Failed to open volume file"); + error("Failed to open volume file"); return SCI_VERSION_AUTODETECT; } // SCI0 volume format: {wResId wPacked+4 wUnpacked wCompression} = 8 bytes -- cgit v1.2.3 From 116d2254119476f58b6b135b7a06a207f38fb5d0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Jul 2009 19:38:41 +0000 Subject: Changed an incorrect warning back to scidprintf - the relevant message is for testing only svn-id: r42394 --- engines/sci/engine/said.cpp | 2 +- engines/sci/engine/said.y | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/sci/engine/said.cpp b/engines/sci/engine/said.cpp index a6a3ee1405..921fa4e599 100644 --- a/engines/sci/engine/said.cpp +++ b/engines/sci/engine/said.cpp @@ -2314,7 +2314,7 @@ static int augment_match_expression_p(parse_tree_node_t *saidt, int augment_pos, } - warning("augment_match_expression_p(): Generic failure"); + scidprintf("augment_match_expression_p(): Generic failure\n"); return 0; } diff --git a/engines/sci/engine/said.y b/engines/sci/engine/said.y index 9fde2fddd0..c1c8424cb5 100644 --- a/engines/sci/engine/said.y +++ b/engines/sci/engine/said.y @@ -670,7 +670,7 @@ static int augment_match_expression_p(parse_tree_node_t *saidt, int augment_pos, } - scidprintf("Generic failure\n"); + scidprintf("augment_match_expression_p(): Generic failure\n"); return 0; } -- cgit v1.2.3 From 31a0c8090513023596351174aa48f787ca6384b3 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Jul 2009 23:45:54 +0000 Subject: Moved the kernel and the vocabulary outside of the engine state (they're static data, which never changes during a game) svn-id: r42398 --- engines/sci/console.cpp | 64 +++++++++++++++++++------------------- engines/sci/engine/game.cpp | 14 ++------- engines/sci/engine/kernel.h | 8 ++--- engines/sci/engine/kgraphics.cpp | 34 ++++++++++---------- engines/sci/engine/kmisc.cpp | 4 +-- engines/sci/engine/kmovement.cpp | 4 +-- engines/sci/engine/kscripts.cpp | 6 ++-- engines/sci/engine/ksound.cpp | 4 +-- engines/sci/engine/kstring.cpp | 7 +++-- engines/sci/engine/said.cpp | 2 +- engines/sci/engine/said.y | 2 +- engines/sci/engine/savegame.cpp | 14 +-------- engines/sci/engine/scriptdebug.cpp | 10 +++--- engines/sci/engine/seg_manager.cpp | 2 +- engines/sci/engine/state.cpp | 3 -- engines/sci/engine/state.h | 5 +-- engines/sci/engine/vm.cpp | 34 ++++++++++---------- engines/sci/engine/vm.h | 2 +- engines/sci/sci.cpp | 7 +++-- engines/sci/sci.h | 8 ++++- 20 files changed, 109 insertions(+), 125 deletions(-) diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index ebf9656739..7c1a165ec1 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -366,8 +366,8 @@ ResourceType parseResourceType(const char *resid) { } const char *selector_name(EngineState *s, int selector) { - if (selector >= 0 && selector < (int)s->_kernel->getSelectorNamesSize()) - return s->_kernel->getSelectorName(selector).c_str(); + if (selector >= 0 && selector < (int)((SciEngine*)g_engine)->getKernel()->getSelectorNamesSize()) + return ((SciEngine*)g_engine)->getKernel()->getSelectorName(selector).c_str(); else return "--INVALID--"; } @@ -381,8 +381,8 @@ bool Console::cmdGetVersion(int argc, const char **argv) { bool Console::cmdOpcodes(int argc, const char **argv) { DebugPrintf("Opcode names in numeric order [index: type name]:\n"); - for (uint seeker = 0; seeker < _vm->_gamestate->_kernel->getOpcodesSize(); seeker++) { - opcode op = _vm->_gamestate->_kernel->getOpcode(seeker); + for (uint seeker = 0; seeker < _vm->getKernel()->getOpcodesSize(); seeker++) { + opcode op = _vm->getKernel()->getOpcode(seeker); DebugPrintf("%03x: %03x %20s | ", seeker, op.type, op.name.c_str()); if ((seeker % 3) == 2) DebugPrintf("\n"); @@ -400,9 +400,9 @@ bool Console::cmdSelector(int argc, const char **argv) { return true; } - for (uint seeker = 0; seeker < _vm->_gamestate->_kernel->getSelectorNamesSize(); seeker++) { - if (!scumm_stricmp(_vm->_gamestate->_kernel->getSelectorName(seeker).c_str(), argv[1])) { - DebugPrintf("Selector %s found at %03x\n", _vm->_gamestate->_kernel->getSelectorName(seeker).c_str(), seeker); + for (uint seeker = 0; seeker < _vm->getKernel()->getSelectorNamesSize(); seeker++) { + if (!scumm_stricmp(_vm->getKernel()->getSelectorName(seeker).c_str(), argv[1])) { + DebugPrintf("Selector %s found at %03x\n", _vm->getKernel()->getSelectorName(seeker).c_str(), seeker); return true; } } @@ -414,8 +414,8 @@ bool Console::cmdSelector(int argc, const char **argv) { bool Console::cmdSelectors(int argc, const char **argv) { DebugPrintf("Selector names in numeric order:\n"); - for (uint seeker = 0; seeker < _vm->_gamestate->_kernel->getSelectorNamesSize(); seeker++) { - DebugPrintf("%03x: %20s | ", seeker, _vm->_gamestate->_kernel->getSelectorName(seeker).c_str()); + for (uint seeker = 0; seeker < _vm->getKernel()->getSelectorNamesSize(); seeker++) { + DebugPrintf("%03x: %20s | ", seeker, _vm->getKernel()->getSelectorName(seeker).c_str()); if ((seeker % 3) == 2) DebugPrintf("\n"); } @@ -427,8 +427,8 @@ bool Console::cmdSelectors(int argc, const char **argv) { bool Console::cmdKernelFunctions(int argc, const char **argv) { DebugPrintf("Kernel function names in numeric order:\n"); - for (uint seeker = 0; seeker < _vm->_gamestate->_kernel->getKernelNamesSize(); seeker++) { - DebugPrintf("%03x: %20s | ", seeker, _vm->_gamestate->_kernel->getKernelName(seeker).c_str()); + for (uint seeker = 0; seeker < _vm->getKernel()->getKernelNamesSize(); seeker++) { + DebugPrintf("%03x: %20s | ", seeker, _vm->getKernel()->getKernelName(seeker).c_str()); if ((seeker % 3) == 2) DebugPrintf("\n"); } @@ -439,13 +439,13 @@ bool Console::cmdKernelFunctions(int argc, const char **argv) { } bool Console::cmdSuffixes(int argc, const char **argv) { - _vm->_gamestate->_vocabulary->printSuffixes(); + _vm->getVocabulary()->printSuffixes(); return true; } bool Console::cmdParserWords(int argc, const char **argv) { - _vm->_gamestate->_vocabulary->printParserWords(); + _vm->getVocabulary()->printParserWords(); return true; } @@ -604,7 +604,7 @@ bool Console::cmdDissectScript(int argc, const char **argv) { return true; } - _vm->_gamestate->_kernel->dissectScript(atoi(argv[1]), _vm->_gamestate->_vocabulary); + _vm->getKernel()->dissectScript(atoi(argv[1]), _vm->getVocabulary()); return true; } @@ -894,10 +894,10 @@ bool Console::cmdClassTable(int argc, const char **argv) { bool Console::cmdSentenceFragments(int argc, const char **argv) { DebugPrintf("Sentence fragments (used to build Parse trees)\n"); - for (uint i = 0; i < _vm->_gamestate->_vocabulary->getParserBranchesSize(); i++) { + for (uint i = 0; i < _vm->getVocabulary()->getParserBranchesSize(); i++) { int j = 0; - const parse_tree_branch_t &branch = _vm->_gamestate->_vocabulary->getParseTreeBranch(i); + const parse_tree_branch_t &branch = _vm->getVocabulary()->getParseTreeBranch(i); DebugPrintf("R%02d: [%x] ->", i, branch.id); while ((j < 10) && branch.data[j]) { int dat = branch.data[j++]; @@ -929,7 +929,7 @@ bool Console::cmdSentenceFragments(int argc, const char **argv) { DebugPrintf("\n"); } - DebugPrintf("%d rules.\n", _vm->_gamestate->_vocabulary->getParserBranchesSize()); + DebugPrintf("%d rules.\n", _vm->getVocabulary()->getParserBranchesSize()); return true; } @@ -952,7 +952,7 @@ bool Console::cmdParse(int argc, const char **argv) { } DebugPrintf("Parsing '%s'\n", string); - bool res = _vm->_gamestate->_vocabulary->tokenizeString(words, string, &error); + bool res = _vm->getVocabulary()->tokenizeString(words, string, &error); if (res && !words.empty()) { int syntax_fail = 0; @@ -963,7 +963,7 @@ bool Console::cmdParse(int argc, const char **argv) { for (ResultWordList::const_iterator i = words.begin(); i != words.end(); ++i) DebugPrintf(" Type[%04x] Group[%04x]\n", i->_class, i->_group); - if (_vm->_gamestate->_vocabulary->parseGNF(_vm->_gamestate->parser_nodes, words, true)) + if (_vm->getVocabulary()->parseGNF(_vm->_gamestate->parser_nodes, words, true)) syntax_fail = 1; // Building a tree failed if (syntax_fail) @@ -1214,7 +1214,7 @@ bool Console::cmdPrintPort(int argc, const char **argv) { bool Console::cmdParseGrammar(int argc, const char **argv) { DebugPrintf("Parse grammar, in strict GNF:\n"); - _vm->_gamestate->_vocabulary->buildGNF(true); + _vm->getVocabulary()->buildGNF(true); return true; } @@ -2049,12 +2049,12 @@ bool Console::cmdBacktrace(int argc, const char **argv) { break; case EXEC_STACK_TYPE_KERNEL: // Kernel function - printf(" %x:[%x] k%s(", i, call.origin, _vm->_gamestate->_kernel->getKernelName(-(call.selector) - 42).c_str()); + printf(" %x:[%x] k%s(", i, call.origin, _vm->getKernel()->getKernelName(-(call.selector) - 42).c_str()); break; case EXEC_STACK_TYPE_VARSELECTOR: printf(" %x:[%x] vs%s %s::%s (", i, call.origin, (call.argc) ? "write" : "read", - objname, _vm->_gamestate->_kernel->getSelectorName(call.selector).c_str()); + objname, _vm->getKernel()->getSelectorName(call.selector).c_str()); break; } @@ -2139,8 +2139,8 @@ bool Console::cmdStepCallk(int argc, const char **argv) { callk_index = strtoul(argv[1], &endptr, 0); if (*endptr != '\0') { callk_index = -1; - for (uint i = 0; i < _vm->_gamestate->_kernel->getKernelNamesSize(); i++) - if (argv[1] == _vm->_gamestate->_kernel->getKernelName(i)) { + for (uint i = 0; i < _vm->getKernel()->getKernelNamesSize(); i++) + if (argv[1] == _vm->getKernel()->getKernelName(i)) { callk_index = i; break; } @@ -2176,7 +2176,7 @@ bool Console::cmdDissassemble(int argc, const char **argv) { } Object *obj = obj_get(_vm->_gamestate, objAddr); - int selector_id = _vm->_gamestate->_kernel->findSelector(argv[2]); + int selector_id = _vm->getKernel()->findSelector(argv[2]); reg_t addr; if (!obj) { @@ -2276,7 +2276,7 @@ bool Console::cmdSend(int argc, const char **argv) { Object *o; reg_t fptr; - selector_id = _vm->_gamestate->_kernel->findSelector(selector_name); + selector_id = _vm->getKernel()->findSelector(selector_name); if (selector_id < 0) { DebugPrintf("Unknown selector: \"%s\"\n", selector_name); @@ -3108,7 +3108,7 @@ static void viewobjinfo(EngineState *s, HeapPtr pos) { int have_rects = 0; Common::Rect nsrect, nsrect_clipped, brrect; - if (lookup_selector(s, pos, s->_kernel->_selectorMap.nsBottom, NULL) == kSelectorVariable) { + if (lookup_selector(s, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsBottom, NULL) == kSelectorVariable) { GETRECT(nsLeft, nsRight, nsBottom, nsTop); GETRECT(lsLeft, lsRight, lsBottom, lsTop); GETRECT(brLeft, brRight, brBottom, brTop); @@ -3122,7 +3122,7 @@ static void viewobjinfo(EngineState *s, HeapPtr pos) { x = GET_SELECTOR(pos, x); y = GET_SELECTOR(pos, y); priority = GET_SELECTOR(pos, priority); - if (s->_kernel->_selectorMap.z > 0) { + if (((SciEngine*)g_engine)->getKernel()->_selectorMap.z > 0) { z = GET_SELECTOR(pos, z); printf("(%d,%d,%d)\n", x, y, z); } else @@ -3186,10 +3186,10 @@ static int c_gfx_draw_viewobj(EngineState *s, const Common::Array & } - is_view = (lookup_selector(s, pos, s->_kernel->_selectorMap.x, NULL) == kSelectorVariable) && - (lookup_selector(s, pos, s->_kernel->_selectorMap.brLeft, NULL) == kSelectorVariable) && - (lookup_selector(s, pos, s->_kernel->_selectorMap.signal, NULL) == kSelectorVariable) && - (lookup_selector(s, pos, s->_kernel->_selectorMap.nsTop, NULL) == kSelectorVariable); + is_view = (lookup_selector(s, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.x, NULL) == kSelectorVariable) && + (lookup_selector(s, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.brLeft, NULL) == kSelectorVariable) && + (lookup_selector(s, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.signal, NULL) == kSelectorVariable) && + (lookup_selector(s, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsTop, NULL) == kSelectorVariable); if (!is_view) { printf("Not a dynamic View object.\n"); diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index 5b4c30f6b3..0a74ac32e4 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -87,7 +87,7 @@ int _reset_graphics_input(EngineState *s) { s->priority_first = 42; // Priority zone 0 ends here - if (s->_kernel->usesOldGfxFunctions()) + if (((SciEngine*)g_engine)->getKernel()->usesOldGfxFunctions()) s->priority_last = 200; else s->priority_last = 190; @@ -257,7 +257,7 @@ static int create_class_table_sci0(EngineState *s) { Resource *script = s->resmgr->findResource(ResourceId(kResourceTypeScript, scriptnr), 0); if (script) { - if (s->_kernel->hasOldScriptHeader()) + if (((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader()) magic_offset = seeker = 2; else magic_offset = seeker = 0; @@ -327,9 +327,6 @@ int script_init_engine(EngineState *s) { s->kernel_opt_flags = 0; - s->_kernel = new Kernel(s->resmgr); - s->_vocabulary = new Vocabulary(s->resmgr); - if (s->_version >= SCI_VERSION_1_1) result = create_class_table_sci11(s); else @@ -375,7 +372,7 @@ int script_init_engine(EngineState *s) { s->bp_list = NULL; // No breakpoints defined s->have_bp = 0; - if (s->_kernel->hasLofsAbsolute()) + if (((SciEngine*)g_engine)->getKernel()->hasLofsAbsolute()) s->seg_manager->setExportWidth(1); else s->seg_manager->setExportWidth(0); @@ -412,11 +409,6 @@ void script_free_engine(EngineState *s) { script_free_vm_memory(s); debug(2, "Freeing state-dependant data"); - - delete s->_vocabulary; - s->_vocabulary = 0; - delete s->_kernel; - s->_kernel = 0; } void script_free_breakpoints(EngineState *s) { diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index 17997e4a20..15f7c9fcf3 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -205,7 +205,7 @@ enum SelectorInvocation { kContinueOnInvalidSelector = 1 }; -#define GET_SEL32(_o_, _slc_) read_selector(s, _o_, s->_kernel->_selectorMap._slc_, __FILE__, __LINE__) +#define GET_SEL32(_o_, _slc_) read_selector(s, _o_, ((SciEngine*)g_engine)->getKernel()->_selectorMap._slc_, __FILE__, __LINE__) #define GET_SEL32V(_o_, _slc_) (GET_SEL32(_o_, _slc_).offset) #define GET_SEL32SV(_o_, _slc_) ((int16)(GET_SEL32(_o_, _slc_).offset)) /* Retrieves a selector from an object @@ -216,8 +216,8 @@ enum SelectorInvocation { ** selector_map_t and mapped in script.c. */ -#define PUT_SEL32(_o_, _slc_, _val_) write_selector(s, _o_, s->_kernel->_selectorMap._slc_, _val_, __FILE__, __LINE__) -#define PUT_SEL32V(_o_, _slc_, _val_) write_selector(s, _o_, s->_kernel->_selectorMap._slc_, make_reg(0, _val_), __FILE__, __LINE__) +#define PUT_SEL32(_o_, _slc_, _val_) write_selector(s, _o_, ((SciEngine*)g_engine)->getKernel()->_selectorMap._slc_, _val_, __FILE__, __LINE__) +#define PUT_SEL32V(_o_, _slc_, _val_) write_selector(s, _o_, ((SciEngine*)g_engine)->getKernel()->_selectorMap._slc_, make_reg(0, _val_), __FILE__, __LINE__) /* Writes a selector value to an object ** Parameters: (reg_t) object: The address of the object which the selector should be written to ** (selector_name) selector: The selector to read @@ -229,7 +229,7 @@ enum SelectorInvocation { #define INV_SEL(_object_, _selector_, _noinvalid_) \ - s, _object_, s->_kernel->_selectorMap._selector_, _noinvalid_, funct_nr, argv, argc, __FILE__, __LINE__ + s, _object_, ((SciEngine*)g_engine)->getKernel()->_selectorMap._selector_, _noinvalid_, funct_nr, argv, argc, __FILE__, __LINE__ /* Kludge for use with invoke_selector(). Used for compatibility with compilers that can't ** handle vararg macros. */ diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index d46ce3b938..c7086ddef7 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -164,7 +164,7 @@ int _find_view_priority(EngineState *s, int y) { return j; return 14; // Maximum } else { - if (!s->_kernel->usesOldGfxFunctions()) + if (!((SciEngine*)g_engine)->getKernel()->usesOldGfxFunctions()) return SCI0_VIEW_PRIORITY_14_ZONES(y); else return SCI0_VIEW_PRIORITY(y) == 15 ? 14 : SCI0_VIEW_PRIORITY(y); @@ -172,7 +172,7 @@ int _find_view_priority(EngineState *s, int y) { } int _find_priority_band(EngineState *s, int nr) { - if (!s->_kernel->usesOldGfxFunctions() && (nr < 0 || nr > 14)) { + if (!((SciEngine*)g_engine)->getKernel()->usesOldGfxFunctions() && (nr < 0 || nr > 14)) { if (nr == 15) return 0xffff; else { @@ -181,7 +181,7 @@ int _find_priority_band(EngineState *s, int nr) { return 0; } - if (s->_kernel->usesOldGfxFunctions() && (nr < 0 || nr > 15)) { + if (((SciEngine*)g_engine)->getKernel()->usesOldGfxFunctions() && (nr < 0 || nr > 15)) { warning("Attempt to get priority band %d", nr); return 0; } @@ -191,7 +191,7 @@ int _find_priority_band(EngineState *s, int nr) { else { int retval; - if (!s->_kernel->usesOldGfxFunctions()) + if (!((SciEngine*)g_engine)->getKernel()->usesOldGfxFunctions()) retval = SCI0_PRIORITY_BAND_FIRST_14_ZONES(nr); else retval = SCI0_PRIORITY_BAND_FIRST(nr); @@ -696,7 +696,7 @@ void _k_dirloop(reg_t obj, uint16 angle, EngineState *s, int funct_nr, int argc, angle %= 360; - if (!s->_kernel->hasOldScriptHeader()) { + if (!((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader()) { if (angle < 45) loop = 3; else if (angle < 136) @@ -1002,7 +1002,7 @@ reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) { gfx_color_t transparent = s->wm_port->_bgcolor; int picFlags = DRAWPIC01_FLAG_FILL_NORMALLY; - if (s->_kernel->usesOldGfxFunctions()) + if (((SciEngine*)g_engine)->getKernel()->usesOldGfxFunctions()) add_to_pic = (argc > 2) ? argv[2].toSint16() : false; dp.nr = argv[0].toSint16(); @@ -1056,7 +1056,7 @@ reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) { s->priority_first = 42; - if (s->_kernel->usesOldGfxFunctions()) + if (((SciEngine*)g_engine)->getKernel()->usesOldGfxFunctions()) s->priority_last = 200; else s->priority_last = 190; @@ -1079,7 +1079,7 @@ Common::Rect set_base(EngineState *s, reg_t object) { x = GET_SEL32SV(object, x); original_y = y = GET_SEL32SV(object, y); - if (s->_kernel->_selectorMap.z > -1) + if (((SciEngine*)g_engine)->getKernel()->_selectorMap.z > -1) z = GET_SEL32SV(object, z); else z = 0; @@ -1133,7 +1133,7 @@ Common::Rect set_base(EngineState *s, reg_t object) { void _k_base_setter(EngineState *s, reg_t object) { Common::Rect absrect = set_base(s, object); - if (lookup_selector(s, object, s->_kernel->_selectorMap.brLeft, NULL, NULL) != kSelectorVariable) + if (lookup_selector(s, object, ((SciEngine*)g_engine)->getKernel()->_selectorMap.brLeft, NULL, NULL) != kSelectorVariable) return; // non-fatal // Note: there was a check here for a very old version of SCI, which supposedly needed @@ -1214,7 +1214,7 @@ Common::Rect get_nsrect(EngineState *s, reg_t object, byte clip) { x = GET_SEL32SV(object, x); y = GET_SEL32SV(object, y); - if (s->_kernel->_selectorMap.z > -1) + if (((SciEngine*)g_engine)->getKernel()->_selectorMap.z > -1) z = GET_SEL32SV(object, z); else z = 0; @@ -1238,7 +1238,7 @@ Common::Rect get_nsrect(EngineState *s, reg_t object, byte clip) { static void _k_set_now_seen(EngineState *s, reg_t object) { Common::Rect absrect = get_nsrect(s, object, 0); - if (lookup_selector(s, object, s->_kernel->_selectorMap.nsTop, NULL, NULL) != kSelectorVariable) { + if (lookup_selector(s, object, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsTop, NULL, NULL) != kSelectorVariable) { return; } // This isn't fatal @@ -1724,7 +1724,7 @@ static void _k_view_list_do_postdraw(EngineState *s, GfxList *list) { * if ((widget->signal & (_K_VIEW_SIG_FLAG_PRIVATE | _K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_NO_UPDATE)) == _K_VIEW_SIG_FLAG_PRIVATE) { */ if ((widget->signal & (_K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_NO_UPDATE)) == 0) { - int has_nsrect = lookup_selector(s, obj, s->_kernel->_selectorMap.nsBottom, NULL, NULL) == kSelectorVariable; + int has_nsrect = lookup_selector(s, obj, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsBottom, NULL, NULL) == kSelectorVariable; if (has_nsrect) { int temp; @@ -1746,7 +1746,7 @@ static void _k_view_list_do_postdraw(EngineState *s, GfxList *list) { } #ifdef DEBUG_LSRECT else - fprintf(stderr, "Not lsRecting %04x:%04x because %d\n", PRINT_REG(obj), lookup_selector(s, obj, s->_kernel->_selectorMap.nsBottom, NULL, NULL)); + fprintf(stderr, "Not lsRecting %04x:%04x because %d\n", PRINT_REG(obj), lookup_selector(s, obj, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsBottom, NULL, NULL)); #endif if (widget->signal & _K_VIEW_SIG_FLAG_HIDDEN) @@ -1900,7 +1900,7 @@ static GfxDynView *_k_make_dynview_obj(EngineState *s, reg_t obj, int options, i loop = oldloop = sign_extend_byte(GET_SEL32V(obj, loop)); cel = oldcel = sign_extend_byte(GET_SEL32V(obj, cel)); - if (s->_kernel->_selectorMap.palette) + if (((SciEngine*)g_engine)->getKernel()->_selectorMap.palette) palette = GET_SEL32V(obj, palette); else palette = 0; @@ -1923,7 +1923,7 @@ static GfxDynView *_k_make_dynview_obj(EngineState *s, reg_t obj, int options, i } ObjVarRef under_bitsp; - if (lookup_selector(s, obj, s->_kernel->_selectorMap.underBits, &(under_bitsp), NULL) != kSelectorVariable) { + if (lookup_selector(s, obj, ((SciEngine*)g_engine)->getKernel()->_selectorMap.underBits, &(under_bitsp), NULL) != kSelectorVariable) { under_bitsp.obj = NULL_REG; under_bits = NULL_REG; debugC(2, kDebugLevelGraphics, "Object at %04x:%04x has no underBits\n", PRINT_REG(obj)); @@ -1931,7 +1931,7 @@ static GfxDynView *_k_make_dynview_obj(EngineState *s, reg_t obj, int options, i under_bits = *under_bitsp.getPointer(s); ObjVarRef signalp; - if (lookup_selector(s, obj, s->_kernel->_selectorMap.signal, &(signalp), NULL) != kSelectorVariable) { + if (lookup_selector(s, obj, ((SciEngine*)g_engine)->getKernel()->_selectorMap.signal, &(signalp), NULL) != kSelectorVariable) { signalp.obj = NULL_REG; signal = 0; debugC(2, kDebugLevelGraphics, "Object at %04x:%04x has no signal selector\n", PRINT_REG(obj)); @@ -2024,7 +2024,7 @@ static void _k_prepare_view_list(EngineState *s, GfxList *list, int options) { while (view) { reg_t obj = make_reg(view->_ID, view->_subID); int priority, _priority; - int has_nsrect = (view->_ID <= 0) ? 0 : lookup_selector(s, obj, s->_kernel->_selectorMap.nsBottom, NULL, NULL) == kSelectorVariable; + int has_nsrect = (view->_ID <= 0) ? 0 : lookup_selector(s, obj, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsBottom, NULL, NULL) == kSelectorVariable; int oldsignal = view->signal; _k_set_now_seen(s, obj); diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 7e0aca5b7a..c693009b35 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -240,7 +240,7 @@ reg_t kMemory(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t kStub(EngineState *s, int funct_nr, int argc, reg_t *argv) { char tmpbuf[200]; sprintf(tmpbuf, "Unimplemented syscall: %s[%x] (", - s->_kernel->getKernelName(funct_nr).c_str(), funct_nr); + ((SciEngine*)g_engine)->getKernel()->getKernelName(funct_nr).c_str(), funct_nr); for (int i = 0; i < argc; i++) { char tmpbuf2[20]; @@ -257,7 +257,7 @@ reg_t kStub(EngineState *s, int funct_nr, int argc, reg_t *argv) { } reg_t kNOP(EngineState *s, int funct_nr, int argc, reg_t *argv) { - warning("Kernel function 0x%02x (%s) invoked: unmapped", funct_nr, s->_kernel->_kernelFuncs[funct_nr].orig_name.c_str()); + warning("Kernel function 0x%02x (%s) invoked: unmapped", funct_nr, ((SciEngine*)g_engine)->getKernel()->_kernelFuncs[funct_nr].orig_name.c_str()); return NULL_REG; } diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp index 90db630bfa..8774224f60 100644 --- a/engines/sci/engine/kmovement.cpp +++ b/engines/sci/engine/kmovement.cpp @@ -267,7 +267,7 @@ static void bresenham_autodetect(EngineState *s) { return; } - if (lookup_selector(s, motion_class, s->_kernel->_selectorMap.doit, NULL, &fptr) != kSelectorMethod) { + if (lookup_selector(s, motion_class, ((SciEngine*)g_engine)->getKernel()->_selectorMap.doit, NULL, &fptr) != kSelectorMethod) { warning("bresenham_autodetect failed"); handle_movecnt = INCREMENT_MOVECNT; // Most games do this, so best guess return; @@ -362,7 +362,7 @@ reg_t kDoBresen(EngineState *s, int funct_nr, int argc, reg_t *argv) { debugC(2, kDebugLevelBresen, "New data: (x,y)=(%d,%d), di=%d\n", x, y, bdi); - if (s->_kernel->_selectorMap.cantBeHere != -1) + if (((SciEngine*)g_engine)->getKernel()->_selectorMap.cantBeHere != -1) invoke_selector(INV_SEL(client, cantBeHere, kStopOnInvalidSelector), 0); else invoke_selector(INV_SEL(client, canBeHere, kStopOnInvalidSelector), 0); diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp index d82f8ff132..df25e11729 100644 --- a/engines/sci/engine/kscripts.cpp +++ b/engines/sci/engine/kscripts.cpp @@ -43,7 +43,7 @@ reg_t read_selector(EngineState *s, reg_t object, Selector selector_id, const ch void write_selector(EngineState *s, reg_t object, Selector selector_id, reg_t value, const char *fname, int line) { ObjVarRef address; - if ((selector_id < 0) || (selector_id > (int)s->_kernel->getSelectorNamesSize())) { + if ((selector_id < 0) || (selector_id > (int)((SciEngine*)g_engine)->getKernel()->getSelectorNamesSize())) { warning("Attempt to write to invalid selector %d of" " object at %04x:%04x (%s L%d).", selector_id, PRINT_REG(object), fname, line); return; @@ -51,7 +51,7 @@ void write_selector(EngineState *s, reg_t object, Selector selector_id, reg_t va if (lookup_selector(s, object, selector_id, &address, NULL) != kSelectorVariable) warning("Selector '%s' of object at %04x:%04x could not be" - " written to (%s L%d)", s->_kernel->getSelectorName(selector_id).c_str(), PRINT_REG(object), fname, line); + " written to (%s L%d)", ((SciEngine*)g_engine)->getKernel()->getSelectorName(selector_id).c_str(), PRINT_REG(object), fname, line); else *address.getPointer(s) = value; } @@ -72,7 +72,7 @@ int invoke_selector(EngineState *s, reg_t object, int selector_id, SelectorInvoc if (slc_type == kSelectorNone) { warning("Selector '%s' of object at %04x:%04x could not be invoked (%s L%d)", - s->_kernel->getSelectorName(selector_id).c_str(), PRINT_REG(object), fname, line); + ((SciEngine*)g_engine)->getKernel()->getSelectorName(selector_id).c_str(), PRINT_REG(object), fname, line); if (noinvalid == kStopOnInvalidSelector) error("[Kernel] Not recoverable: VM was halted\n"); return 1; diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 95c2eaab1d..8c113d35a3 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -988,9 +988,9 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { * Used for synthesized music playback */ reg_t kDoSound(EngineState *s, int funct_nr, int argc, reg_t *argv) { - if (s->_kernel->usesSci1SoundFunctions()) + if (((SciEngine*)g_engine)->getKernel()->usesSci1SoundFunctions()) return kDoSound_SCI1(s, funct_nr, argc, argv); - else if (s->_kernel->usesSci01SoundFunctions()) + else if (((SciEngine*)g_engine)->getKernel()->usesSci01SoundFunctions()) return kDoSound_SCI01(s, funct_nr, argc, argv); else return kDoSound_SCI0(s, funct_nr, argc, argv); diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index c572906285..b6bb404d5b 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -95,7 +95,7 @@ reg_t kSaid(EngineState *s, int funct_nr, int argc, reg_t *argv) { #ifdef DEBUG_PARSER debugC(2, kDebugLevelParser, "Said block:", 0); - s->_vocabulary->decipherSaidBlock(said_block); + ((SciEngine*)g_engine)->getVocabulary()->decipherSaidBlock(said_block); #endif if (s->parser_event.isNull() || (GET_SEL32V(s->parser_event, claimed))) { @@ -190,10 +190,11 @@ reg_t kParse(EngineState *s, int funct_nr, int argc, reg_t *argv) { char *error; ResultWordList words; reg_t event = argv[1]; + Vocabulary *voc = ((SciEngine*)g_engine)->getVocabulary(); s->parser_event = event; - bool res = s->_vocabulary->tokenizeString(words, string, &error); + bool res = voc->tokenizeString(words, string, &error); s->parser_valid = 0; /* not valid */ if (res && !words.empty()) { @@ -211,7 +212,7 @@ reg_t kParse(EngineState *s, int funct_nr, int argc, reg_t *argv) { debugC(2, kDebugLevelParser, " Type[%04x] Group[%04x]\n", i->_class, i->_group); #endif - if (s->_vocabulary->parseGNF(s->parser_nodes, words)) + if (voc->parseGNF(s->parser_nodes, words)) syntax_fail = 1; /* Building a tree failed */ if (syntax_fail) { diff --git a/engines/sci/engine/said.cpp b/engines/sci/engine/said.cpp index 921fa4e599..b1d174b30f 100644 --- a/engines/sci/engine/said.cpp +++ b/engines/sci/engine/said.cpp @@ -2449,7 +2449,7 @@ int said(EngineState *s, byte *spec, int verbose) { if (s->parser_valid) { if (said_parse_spec(s, spec)) { printf("Offending spec was: "); - s->_vocabulary->decipherSaidBlock(spec); + ((SciEngine*)g_engine)->getVocabulary()->decipherSaidBlock(spec); return SAID_NO_MATCH; } diff --git a/engines/sci/engine/said.y b/engines/sci/engine/said.y index c1c8424cb5..e7c225b3e6 100644 --- a/engines/sci/engine/said.y +++ b/engines/sci/engine/said.y @@ -805,7 +805,7 @@ int said(EngineState *s, byte *spec, int verbose) { if (s->parser_valid) { if (said_parse_spec(s, spec)) { warning("Offending spec was: "); - s->_vocabulary->decypherSaidBlock(spec); + ((SciEngine*)g_engine)->getVocabulary()->decypherSaidBlock(spec); return SAID_NO_MATCH; } diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index e167e7eca8..d5f094b540 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -497,7 +497,7 @@ static SegmentId find_unique_seg_by_type(SegManager *self, int type) { } static byte *find_unique_script_block(EngineState *s, byte *buf, int type) { - if (s->_kernel->hasOldScriptHeader()) + if (((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader()) buf += 2; do { @@ -756,13 +756,6 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { // FIXME: Do in-place loading at some point, instead of creating a new EngineState instance from scratch. retval = new EngineState(s->resmgr, s->_version, s->_flags); - // static VM/Kernel information: - assert(0 == retval->_kernel); - retval->_kernel = s->_kernel; // needs to be initialized before _reset_graphics_input is called -// s->_kernel = 0; // FIXME: We should set s->_kernel to 0 here, -// else it could be freed when the old EngineState is freed. Luckily, this freeing currently -// never happens, so we don't need to. - // Copy some old data retval->gfx_state = s->gfx_state; retval->sound_mute = s->sound_mute; @@ -821,11 +814,6 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { retval->game_start_time = g_system->getMillis() - retval->game_time * 1000; // static parser information: - assert(0 == retval->_vocabulary); - retval->_vocabulary = s->_vocabulary; -// s->_vocabulary = 0; // FIXME: We should set s->_vocabulary to 0 here, -// else it could be freed when the old EngineState is freed. Luckily, this freeing currently -// never happens, so we don't need to. retval->parser_base = make_reg(s->sys_strings_segment, SYS_STRING_PARSER_BASE); diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index 7f5f201079..92cfe9daf3 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -148,7 +148,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod if (print_bw_tag) printf("[%c] ", opsize ? 'B' : 'W'); - printf("%s", s->_kernel->getOpcode(opcode).name.c_str()); + printf("%s", ((SciEngine*)g_engine)->getKernel()->getOpcode(opcode).name.c_str()); i = 0; while (g_opcode_formats[opcode][i]) { @@ -183,8 +183,8 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod } if (opcode == op_callk) - printf(" %s[%x]", (param_value < s->_kernel->_kernelFuncs.size()) ? - ((param_value < s->_kernel->getKernelNamesSize()) ? s->_kernel->getKernelName(param_value).c_str() : "[Unknown(postulated)]") + printf(" %s[%x]", (param_value < ((SciEngine*)g_engine)->getKernel()->_kernelFuncs.size()) ? + ((param_value < ((SciEngine*)g_engine)->getKernel()->getKernelNamesSize()) ? ((SciEngine*)g_engine)->getKernel()->getKernelName(param_value).c_str() : "[Unknown(postulated)]") : "", param_value); else printf(opsize ? " %02x" : " %04x", param_value); @@ -238,7 +238,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod int stackframe = (scr[pos.offset + 2] >> 1) + (scriptState.restAdjust); int argc = ((scriptState.xs->sp)[- stackframe - 1]).offset; - if (!s->_kernel->hasOldScriptHeader()) + if (!((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader()) argc += (scriptState.restAdjust); printf(" Kernel params: ("); @@ -273,7 +273,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod if (!name) name = ""; - printf(" %s::%s[", name, (selector > s->_kernel->getSelectorNamesSize()) ? "" : selector_name(s, selector)); + printf(" %s::%s[", name, (selector > ((SciEngine*)g_engine)->getKernel()->getSelectorNamesSize()) ? "" : selector_name(s, selector)); switch (lookup_selector(s, called_obj_addr, selector, 0, &fun_ref)) { case kSelectorMethod: diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index 74486ef015..6752ba3e56 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -138,7 +138,7 @@ void SegManager::setScriptSize(Script &scr, EngineState *s, int script_nr) { if (!script || (s->_version >= SCI_VERSION_1_1 && !heap)) { error("SegManager::setScriptSize: failed to load %s", !script ? "script" : "heap"); } - if (s->_kernel->hasOldScriptHeader()) { + if (((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader()) { scr.buf_size = script->size + READ_LE_UINT16(script->data) * 2; //locals_size = READ_LE_UINT16(script->data) * 2; } else if (s->_version < SCI_VERSION_1_1) { diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index c43fe9b6de..38320c29cc 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -113,9 +113,6 @@ EngineState::EngineState(ResourceManager *res, sci_version_t version, uint32 fla seg_manager = 0; gc_countdown = 0; - _vocabulary = 0; - _kernel = 0; - successor = 0; } diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index 1759b26dcb..b41e9e383a 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -257,9 +257,6 @@ public: MessageState _msgState; - Vocabulary *_vocabulary; - Kernel *_kernel; - EngineState *successor; /**< Successor of this state: Used for restoring */ private: @@ -283,7 +280,7 @@ PaletteEntry get_pic_color(EngineState *s, int color); // misleading. A different name (and a different place for declaring this) // would be highly welcome. static inline reg_t not_register(EngineState *s, reg_t r) { - if (s->_kernel->_selectorMap.cantBeHere != -1) + if (((SciEngine*)g_engine)->getKernel()->_selectorMap.cantBeHere != -1) return make_reg(0, !r.offset); else return r; diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index d220547c92..99b5a86e53 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -312,7 +312,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt Breakpoint *bp; char method_name [256]; - sprintf(method_name, "%s::%s", obj_get_name(s, send_obj), s->_kernel->getSelectorName(selector).c_str()); + sprintf(method_name, "%s::%s", obj_get_name(s, send_obj), ((SciEngine*)g_engine)->getKernel()->getSelectorName(selector).c_str()); bp = s->bp_list; while (bp) { @@ -952,26 +952,26 @@ void run_vm(EngineState *s, int restoring) { gc_countdown(s); scriptState.xs->sp -= (opparams[1] >> 1) + 1; - if (!s->_kernel->hasOldScriptHeader()) { + if (!((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader()) { scriptState.xs->sp -= scriptState.restAdjust; s->restAdjust = 0; // We just used up the scriptState.restAdjust, remember? } - if (opparams[0] >= (int)s->_kernel->_kernelFuncs.size()) { + if (opparams[0] >= (int)((SciEngine*)g_engine)->getKernel()->_kernelFuncs.size()) { error("Invalid kernel function 0x%x requested\n", opparams[0]); } else { int argc = ASSERT_ARITHMETIC(scriptState.xs->sp[0]); - if (!s->_kernel->hasOldScriptHeader()) + if (!((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader()) argc += scriptState.restAdjust; - if (s->_kernel->_kernelFuncs[opparams[0]].signature + if (((SciEngine*)g_engine)->getKernel()->_kernelFuncs[opparams[0]].signature && !kernel_matches_signature(s, - s->_kernel->_kernelFuncs[opparams[0]].signature, argc, + ((SciEngine*)g_engine)->getKernel()->_kernelFuncs[opparams[0]].signature, argc, scriptState.xs->sp + 1)) { error("[VM] Invalid arguments to kernel call %x\n", opparams[0]); } else { - s->r_acc = s->_kernel->_kernelFuncs[opparams[0]].fun(s, opparams[0], + s->r_acc = ((SciEngine*)g_engine)->getKernel()->_kernelFuncs[opparams[0]].fun(s, opparams[0], argc, scriptState.xs->sp + 1); } // Call kernel function @@ -982,7 +982,7 @@ void run_vm(EngineState *s, int restoring) { xs_new = &(s->_executionStack.back()); s->_executionStackPosChanged = true; - if (!s->_kernel->hasOldScriptHeader()) + if (!((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader()) scriptState.restAdjust = s->restAdjust; } @@ -1194,7 +1194,7 @@ void run_vm(EngineState *s, int restoring) { if (s->_version >= SCI_VERSION_1_1) { s->r_acc.offset = opparams[0] + local_script->script_size; } else { - if (s->_kernel->hasLofsAbsolute()) + if (((SciEngine*)g_engine)->getKernel()->hasLofsAbsolute()) s->r_acc.offset = opparams[0]; else s->r_acc.offset = scriptState.xs->addr.pc.offset + opparams[0]; @@ -1214,7 +1214,7 @@ void run_vm(EngineState *s, int restoring) { if (s->_version >= SCI_VERSION_1_1) { r_temp.offset = opparams[0] + local_script->script_size; } else { - if (s->_kernel->hasLofsAbsolute()) + if (((SciEngine*)g_engine)->getKernel()->hasLofsAbsolute()) r_temp.offset = opparams[0]; else r_temp.offset = scriptState.xs->addr.pc.offset + opparams[0]; @@ -1500,7 +1500,7 @@ SelectorType lookup_selector(EngineState *s, reg_t obj_location, Selector select // Early SCI versions used the LSB in the selector ID as a read/write // toggle, meaning that we must remove it for selector lookup. - if (s->_kernel->hasOldScriptHeader()) + if (((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader()) selector_id &= ~1; if (!obj) { @@ -1659,7 +1659,7 @@ int script_instantiate_sci0(EngineState *s, int script_nr) { Script *scr = s->seg_manager->getScript(seg_id); - if (s->_kernel->hasOldScriptHeader()) { + if (((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader()) { // int locals_nr = READ_LE_UINT16(script->data); @@ -1835,7 +1835,7 @@ int script_instantiate(EngineState *s, int script_nr) { } void script_uninstantiate_sci0(EngineState *s, int script_nr, SegmentId seg) { - reg_t reg = make_reg(seg, s->_kernel->hasOldScriptHeader() ? 2 : 0); + reg_t reg = make_reg(seg, ((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader() ? 2 : 0); int objtype, objlength; Script *scr = s->seg_manager->getScript(seg); @@ -1879,7 +1879,7 @@ void script_uninstantiate_sci0(EngineState *s, int script_nr, SegmentId seg) { } void script_uninstantiate(EngineState *s, int script_nr) { - reg_t reg = make_reg(0, s->_kernel->hasOldScriptHeader() ? 2 : 0); + reg_t reg = make_reg(0, ((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader() ? 2 : 0); reg.segment = s->seg_manager->segGet(script_nr); Script *scr = script_locate_by_segment(s, reg.segment); @@ -1938,7 +1938,7 @@ static EngineState *_game_run(EngineState *&s, int restoring) { script_init_engine(s); game_init(s); sfx_reset_player(); - _init_stack_base_with_selector(s, s->_kernel->_selectorMap.play); + _init_stack_base_with_selector(s, ((SciEngine*)g_engine)->getKernel()->_selectorMap.play); send_selector(s, s->game_obj, s->game_obj, s->stack_base, 2, s->stack_base); @@ -1957,7 +1957,7 @@ static EngineState *_game_run(EngineState *&s, int restoring) { debugC(2, kDebugLevelVM, "Restarting with replay()\n"); s->_executionStack.clear(); // Restart with replay - _init_stack_base_with_selector(s, s->_kernel->_selectorMap.replay); + _init_stack_base_with_selector(s, ((SciEngine*)g_engine)->getKernel()->_selectorMap.replay); send_selector(s, s->game_obj, s->game_obj, s->stack_base, 2, s->stack_base); } @@ -1976,7 +1976,7 @@ int game_run(EngineState **_s) { EngineState *s = *_s; debugC(2, kDebugLevelVM, "Calling %s::play()\n", s->_gameName.c_str()); - _init_stack_base_with_selector(s, s->_kernel->_selectorMap.play); // Call the play selector + _init_stack_base_with_selector(s, ((SciEngine*)g_engine)->getKernel()->_selectorMap.play); // Call the play selector // Now: Register the first element on the execution stack- if (!send_selector(s, s->game_obj, s->game_obj, s->stack_base, 2, s->stack_base)) { diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h index 1472fae97c..f711570d11 100644 --- a/engines/sci/engine/vm.h +++ b/engines/sci/engine/vm.h @@ -419,7 +419,7 @@ void script_debug(EngineState *s, bool bp); * @return 0 on success, 1 if vocab.996 (the class table) is missing * or corrupted */ -int script_init_engine(EngineState *s); +int script_init_engine(EngineState *); /** * Sets the gamestate's save_dir to the parameter path diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 9c94e2edde..504e38c7c1 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -100,7 +100,10 @@ SciEngine::~SciEngine() { // Remove all of our debug levels here Common::clearAllDebugChannels(); + delete _kernel; + delete _vocabulary; delete _console; + delete _resmgr; } Common::Error SciEngine::run() { @@ -137,6 +140,8 @@ Common::Error SciEngine::run() { return Common::kNoGameDataFoundError; } + _kernel = new Kernel(_resmgr); + _vocabulary = new Vocabulary(_resmgr); script_adjust_opcode_formats(_resmgr->_sciVersion); #if 0 @@ -229,8 +234,6 @@ Common::Error SciEngine::run() { delete _gamestate; - delete _resmgr; - gfxop_exit(&gfx_state); return Common::kNoError; diff --git a/engines/sci/sci.h b/engines/sci/sci.h index a2de5c3136..886a579799 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -35,6 +35,8 @@ namespace Sci { class Console; struct EngineState; +class Kernel; +class Vocabulary; // our engine debug levels enum kDebugLevels { @@ -107,7 +109,9 @@ public: Common::Language getLanguage() const; Common::Platform getPlatform() const; uint32 getFlags() const; - ResourceManager *getResMgr() { return _resmgr; } + ResourceManager *getResMgr() const { return _resmgr; } + Kernel *getKernel() const { return _kernel; } + Vocabulary *getVocabulary() const { return _vocabulary; } Common::String getSavegameName(int nr) const; Common::String getSavegamePattern() const; @@ -122,6 +126,8 @@ private: const SciGameDescription *_gameDescription; ResourceManager *_resmgr; EngineState *_gamestate; + Kernel *_kernel; + Vocabulary *_vocabulary; Console *_console; }; -- cgit v1.2.3 From 13a1dc0a58a33cdc974a877ccf6208890e9b4e9f Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Sun, 12 Jul 2009 05:34:46 +0000 Subject: Added a temporary work-around for PS2 backend in common/array.h cause its vintage compiler does not support "new T[newCapacity]()" but only "new T[newCapacity]", this will let it compile through. It's ifdef'd as __PLAYSTATION2__, so it won't make a difference for other backends with more modern tools. svn-id: r42402 --- common/array.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/common/array.h b/common/array.h index 7852cabf06..ac8a4b20d7 100644 --- a/common/array.h +++ b/common/array.h @@ -222,7 +222,13 @@ public: T *old_storage = _storage; _capacity = newCapacity; + // PS2 gcc 3.2.2 can't do "new T[newCapacity]()" but only + // "new T[newCapacity]" -> quick fix until we update tools. + #ifndef __PLAYSTATION2__ _storage = new T[newCapacity](); + #else + _storage = new T[newCapacity]; + #endif assert(_storage); if (old_storage) { @@ -273,7 +279,13 @@ protected: // If there is not enough space, allocate more and // copy old elements over. uint newCapacity = roundUpCapacity(_size + n); + // PS2 gcc 3.2.2 can't do "new T[newCapacity]()" but only + // "new T[newCapacity]" -> quick fix until we update tools. + #ifndef __PLAYSTATION2__ newStorage = new T[newCapacity](); + #else + newStorage = new T[newCapacity]; + #endif assert(newStorage); copy(_storage, _storage + idx, newStorage); pos = newStorage + idx; -- cgit v1.2.3 From 17b1c6d0aed188b400c87b2959ef7339d874b913 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Sun, 12 Jul 2009 05:35:56 +0000 Subject: I am re-commiting the FORCE_RTL as a temporary solution in trunk, so that trunk/1.0rc is au pair feature-wise with 0.13.x. svn-id: r42403 --- backends/events/default/default-events.h | 3 +++ base/main.cpp | 6 +++++- common/events.h | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/backends/events/default/default-events.h b/backends/events/default/default-events.h index 5841318fd4..9d47104608 100644 --- a/backends/events/default/default-events.h +++ b/backends/events/default/default-events.h @@ -143,6 +143,9 @@ public: virtual int shouldQuit() const { return _shouldQuit; } virtual int shouldRTL() const { return _shouldRTL; } virtual void resetRTL() { _shouldRTL = false; } +#ifdef FORCE_RTL + virtual void resetQuit() { _shouldQuit = false; } +#endif #ifdef ENABLE_KEYMAPPER virtual Common::Keymapper *getKeymapper() { return _keymapper; } diff --git a/base/main.cpp b/base/main.cpp index a091c5885a..2d4091c0d5 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -382,11 +382,15 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { } // Quit unless an error occurred, or Return to launcher was requested + #ifndef FORCE_RTL if (result == 0 && !g_system->getEventManager()->shouldRTL()) break; - + #endif // Reset RTL flag in case we want to load another engine g_system->getEventManager()->resetRTL(); + #ifdef FORCE_RTL + g_system->getEventManager()->resetQuit(); + #endif // Discard any command line options. It's unlikely that the user // wanted to apply them to *all* games ever launched. diff --git a/common/events.h b/common/events.h index e13d95cf47..82b85e60ea 100644 --- a/common/events.h +++ b/common/events.h @@ -195,7 +195,9 @@ public: * Used when we have returned to the launcher. */ virtual void resetRTL() = 0; - +#ifdef FORCE_RTL + virtual void resetQuit() = 0; +#endif // Optional: check whether a given key is currently pressed ???? //virtual bool isKeyPressed(int keycode) = 0; -- cgit v1.2.3 From 55cda3aa258e2c214e0442ad726d964bb787cd0e Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Sun, 12 Jul 2009 05:38:08 +0000 Subject: ScummVM/PS2 bugs fixed by this commit: - general file write corruption (eg. ScummVM.ini, etc.) - COMI specific save crash / corruption (added option in engines/scumm/saveload.cpp to disable thumbnails on PS2, as emergency fallback in case the fix should prove to be insufficient) - implemented _screenChange logic (fixes grabOverlay & COMI popup menu) - fixed higher pitch (chipmunk fx) - made NET IRXs optional to allow it to work on fat PS2 without net+hd - fixed cursor restore on RTL - added "." as R2 to skip single lines of dialog - added write cache svn-id: r42404 --- backends/platform/ps2/Gs2dScreen.cpp | 15 ++++- backends/platform/ps2/Gs2dScreen.h | 1 + backends/platform/ps2/Makefile.gdb | 94 +++++++++++++++++++++++++++++ backends/platform/ps2/Makefile.ps2 | 10 ++-- backends/platform/ps2/fileio.cpp | 109 ++++++++++++++++++++++++++-------- backends/platform/ps2/fileio.h | 2 +- backends/platform/ps2/irxboot.cpp | 9 +-- backends/platform/ps2/ps2input.cpp | 34 +++++------ backends/platform/ps2/savefilemgr.cpp | 6 +- backends/platform/ps2/systemps2.cpp | 44 +++++++++++--- backends/platform/ps2/systemps2.h | 15 ++--- engines/scumm/saveload.cpp | 2 +- 12 files changed, 268 insertions(+), 73 deletions(-) create mode 100644 backends/platform/ps2/Makefile.gdb diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp index e9a846f659..a9f1d7c51d 100644 --- a/backends/platform/ps2/Gs2dScreen.cpp +++ b/backends/platform/ps2/Gs2dScreen.cpp @@ -337,6 +337,7 @@ void Gs2dScreen::newScreenSize(uint16 width, uint16 height) { memset(_screenBuf, 0, _width * height); memset(_overlayBuf, 0, _width * height * 2); memset(_clut, 0, 256 * sizeof(uint32)); + _clut[1] = GS_RGBA(0xC0, 0xC0, 0xC0, 0); // clear video ram _dmaPipe->uploadTex(_clutPtrs[MOUSE], 64, 0, 0, GS_PSMCT32, _clut, 16, 16); @@ -345,7 +346,8 @@ void Gs2dScreen::newScreenSize(uint16 width, uint16 height) { _dmaPipe->flush(); _dmaPipe->waitForDma(); - _clutChanged = _screenChanged = _overlayChanged = false; + /*_clutChanged = */ _screenChanged = _overlayChanged = false; + _clutChanged = true; // reload palette on scr change _texCoords[1].u = SCALE(_width); _texCoords[1].v = SCALE(_height); @@ -396,6 +398,13 @@ void Gs2dScreen::clearScreen(void) { SignalSema(g_DmacSema); } +void Gs2dScreen::fillScreen(uint32 col) { + WaitSema(g_DmacSema); + memset(_screenBuf, col, _width * _height); + _screenChanged = true; + SignalSema(g_DmacSema); +} + Graphics::Surface *Gs2dScreen::lockScreen() { WaitSema(g_DmacSema); @@ -541,11 +550,11 @@ Graphics::PixelFormat Gs2dScreen::getOverlayFormat(void) { } int16 Gs2dScreen::getOverlayWidth(void) { - return _videoMode.overlayWidth; + return _width; // _videoMode.overlayWidth; } int16 Gs2dScreen::getOverlayHeight(void) { - return _videoMode.overlayHeight; + return _height; // _videoMode.overlayHeight; } void Gs2dScreen::setShakePos(int shake) { diff --git a/backends/platform/ps2/Gs2dScreen.h b/backends/platform/ps2/Gs2dScreen.h index 91dfc9d327..4657ab02d9 100644 --- a/backends/platform/ps2/Gs2dScreen.h +++ b/backends/platform/ps2/Gs2dScreen.h @@ -61,6 +61,7 @@ public: void copyPrintfOverlay(const uint8* buf); void clearPrintfOverlay(void); void clearScreen(void); + void fillScreen(uint32 col); Graphics::Surface *lockScreen(); void unlockScreen(); diff --git a/backends/platform/ps2/Makefile.gdb b/backends/platform/ps2/Makefile.gdb new file mode 100644 index 0000000000..7177275830 --- /dev/null +++ b/backends/platform/ps2/Makefile.gdb @@ -0,0 +1,94 @@ +# $Header: Exp $ + include $(PS2SDK)/Defs.make + +PS2_EXTRA = /media/disk/nw8240/extras/scummvm/ports +PS2_EXTRA_INCS = /zlib/include /libmad/ee/include /SjPcm/ee/src /tremor +PS2_EXTRA_LIBS = /zlib/lib /libmad/ee/lib /SjPcm/ee/lib /tremor/tremor + +ENABLED=STATIC_PLUGIN + +#control build +DISABLE_SCALERS = true +DISABLE_HQ_SCALERS = true + +ENABLE_SCUMM = $(ENABLED) +ENABLE_SCUMM_7_8 = $(ENABLED) +#ENABLE_HE = $(ENABLED) +#ENABLE_AGI = $(ENABLED) +#ENABLE_AGOS = $(ENABLED) +#ENABLE_CINE = $(ENABLED) +#ENABLE_CRUISE = $(ENABLED) +#ENABLE_DRASCULA = $(ENABLED) +#ENABLE_GOB = $(ENABLED) +#ENABLE_IGOR = $(ENABLED) +#ENABLE_KYRA = $(ENABLED) +#ENABLE_LURE = $(ENABLED) + # ENABLE_M4 = $(ENABLED) +#ENABLE_MADE = $(ENABLED) +#ENABLE_PARALLACTION = $(ENABLED) +#ENABLE_QUEEN = $(ENABLED) +#ENABLE_SAGA = $(ENABLED) +#ENABLE_SAGA2 = $(ENABLED) +#ENABLE_IHNM = $(ENABLED) +#ENABLE_SKY = $(ENABLED) +#ENABLE_SWORD1 = $(ENABLED) +#ENABLE_SWORD2 = $(ENABLED) + # ENABLE_TINSEL = $(ENABLED) +#ENABLE_TOUCHE = $(ENABLED) + +HAVE_GCC3 = true + +CC = ee-gcc +CXX = ee-g++ +AS = ee-gcc +LD = ee-gcc +AR = ee-ar cru +RANLIB = ee-ranlib +STRIP = ee-strip +MKDIR = mkdir -p +RM = rm -f + +srcdir = ../../.. +VPATH = $(srcdir) +INCDIR = ../../../ +# DEPDIR = .deps + +DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -D_EE -D__PLAYSTATION2__ -D__PS2_DEBUG__ -g -Wall -Wno-multichar + + +INCLUDES = $(addprefix -I$(PS2_EXTRA),$(PS2_EXTRA_INCS)) +INCLUDES += -I $(PS2GDB)/ee -I $(PS2SDK)/ee/include -I $(PS2SDK)/common/include -I ./common -I . -I $(srcdir) -I $(srcdir)/engines + +TARGET = elf/scummvm.elf + +OBJS := backends/platform/ps2/DmaPipe.o \ + backends/platform/ps2/Gs2dScreen.o \ + backends/platform/ps2/irxboot.o \ + backends/platform/ps2/ps2input.o \ + backends/platform/ps2/ps2pad.o \ + backends/platform/ps2/savefilemgr.o \ + backends/platform/ps2/fileio.o \ + backends/platform/ps2/asyncfio.o \ + backends/platform/ps2/icon.o \ + backends/platform/ps2/cd.o \ + backends/platform/ps2/eecodyvdfs.o \ + backends/platform/ps2/rpckbd.o \ + backends/platform/ps2/systemps2.o \ + backends/platform/ps2/ps2mutex.o \ + backends/platform/ps2/ps2time.o \ + backends/platform/ps2/ps2debug.o + +MODULE_DIRS += . + +include $(srcdir)/Makefile.common + +LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfile +LDFLAGS += -L $(PS2GDB)/lib -L $(PS2SDK)/ee/lib -L . +LDFLAGS += $(addprefix -L$(PS2_EXTRA),$(PS2_EXTRA_LIBS)) +LDFLAGS += -lmc -lpad -lmouse -lhdd -lpoweroff -lsjpcm -lmad -ltremor -lz -lm -lc -lfileXio -lps2gdbStub -lps2ip -ldebug -lkernel -lstdc++ + +all: $(TARGET) + +$(TARGET): $(OBJS) + $(LD) $^ $(LDFLAGS) -o $@ + diff --git a/backends/platform/ps2/Makefile.ps2 b/backends/platform/ps2/Makefile.ps2 index 812599d0c0..5abeae5fb5 100644 --- a/backends/platform/ps2/Makefile.ps2 +++ b/backends/platform/ps2/Makefile.ps2 @@ -1,7 +1,7 @@ # $Header: Exp $ include $(PS2SDK)/Defs.make -PS2_EXTRA = /media/disk-1/nw8240/extras/scummvm/ports +PS2_EXTRA = /media/disk/nw8240/extras/scummvm/ports PS2_EXTRA_INCS = /zlib/include /libmad/ee/include /SjPcm/ee/src /tremor PS2_EXTRA_LIBS = /zlib/lib /libmad/ee/lib /SjPcm/ee/lib /tremor/tremor @@ -45,15 +45,15 @@ LD = ee-gcc AR = ee-ar cru RANLIB = ee-ranlib STRIP = ee-strip -MKDIR = mkdir -p -RM = rm -f +MKDIR = mkdir -p +RM = rm -f srcdir = ../../.. VPATH = $(srcdir) INCDIR = ../../../ # DEPDIR = .deps -DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -D_EE -D__PLAYSTATION2__ -O2 -Wall -Wno-multichar +DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -D_EE -D__PLAYSTATION2__ -O2 -Wall -Wno-multichar INCLUDES = $(addprefix -I$(PS2_EXTRA),$(PS2_EXTRA_INCS)) @@ -86,7 +86,7 @@ LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfil LDFLAGS += -L $(PS2SDK)/ee/lib -L . LDFLAGS += $(addprefix -L$(PS2_EXTRA),$(PS2_EXTRA_LIBS)) LDFLAGS += -lmc -lpad -lmouse -lhdd -lpoweroff -lsjpcm -lmad -ltremor -lz -lm -lc -lfileXio -lkernel -lstdc++ -# LDFLAGS += -s +LDFLAGS += -s all: $(TARGET) diff --git a/backends/platform/ps2/fileio.cpp b/backends/platform/ps2/fileio.cpp index fc35306907..8e5dc1255f 100644 --- a/backends/platform/ps2/fileio.cpp +++ b/backends/platform/ps2/fileio.cpp @@ -61,7 +61,7 @@ Ps2File::Ps2File(void) { // _cache = (uint8 *)malloc(PS2_CACHE_MAX); - _cacheBuf = (uint8*)memalign(64, CACHE_SIZE); + _cacheBuf = (uint8*)memalign(64, CACHE_SIZE * 2); _cacheOpRunning = 0; _filePos = _physFilePos = _cachePos = 0; @@ -80,7 +80,16 @@ Ps2File::Ps2File(void) { } Ps2File::~Ps2File(void) { + uint32 w; if (_fd >= 0) { + + if (_mode != O_RDONLY) { + fio.seek(_fd, 0, SEEK_SET); + fio.write(_fd, _cacheBuf, _filePos); + w = fio.sync(_fd); + printf("flushed wbuf: %x of %x\n", w, _filePos); + } + fio.close(_fd); uint32 r = fio.sync(_fd); printf("close [%d] - sync'd = %d\n", _fd, r); @@ -95,24 +104,87 @@ Ps2File::~Ps2File(void) { } bool Ps2File::open(const char *name, int mode) { - assert(_fd < 0); - +#if 1 _fd = fio.open(name, mode); printf("open %s [%d]\n", name, _fd); if (_fd >= 0) { - _fileSize = fio.seek(_fd, 0, SEEK_END); - if (mode == O_RDONLY) - // if (!(mode & O_APPEND)) + _mode = mode; + _filePos = 0; + + if (_mode == O_RDONLY) { + _fileSize = fio.seek(_fd, 0, SEEK_END); fio.seek(_fd, 0, SEEK_SET); + } + else + _fileSize = 0; + printf(" _mode = %x\n", _mode); + printf(" _fileSize = %d\n", _fileSize); + // printf(" _filePos = %d\n", _filePos); + + return true; + } + + return false; +#else + uint32 r; + + // hack: FIO does not reports size for RW (?) + _fd = fio.open(name, O_RDONLY); + if (_fd >= 0) { + _fileSize = fio.seek(_fd, 0, SEEK_END); + fio.seek(_fd, 0, SEEK_SET); /* rewind ! */ + + if (_fileSize && mode != O_RDONLY) { + fio.read(_fd, _cacheBuf, _fileSize); + r = fio.sync(_fd); + printf(" sz=%d, read=%d\n", _fileSize, r); + assert(r == _fileSize); + } + + fio.close(_fd); + } + else + _fileSize = 0; /* new file */ + + _fd = fio.open(name, mode); + + printf("open %s [%d]\n", name, _fd); + + if (_fd >= 0) { + _mode = mode; + _filePos = 0; + + if (_fileSize) { /* existing data */ + if (mode == O_RDONLY) { + /* DANGER: for w* modes it will truncate your fine files */ + fio.seek(_fd, 0, SEEK_SET); + } + else if (_mode & O_APPEND) { + fio.seek(_fd, 0, _fileSize); + _filePos = _fileSize; + } + #if 0 /* file already trunc'd when opened as w* -> moved up */ + if (mode != O_RDONLY) { + fio.read(_fd, _cacheBuf, _fileSize); + r = fio.sync(_fd); + printf(" sz=%d, read=%d\n", _fileSize, r); + assert(r == _fileSize); + // _fileSize = fio.seek(_fd, 0, SEEK_END); + } + #endif + } + + printf(" _mode = %x\n", _mode); printf(" _fileSize = %d\n", _fileSize); printf(" _filePos = %d\n", _filePos); return true; } else return false; +#endif } int32 Ps2File::tell(void) { @@ -225,7 +297,7 @@ void Ps2File::cacheReadAhead(void) { _cachePos = cachePosEnd = _filePos & ~READ_ALIGN_MASK; assert(_filePos == _physFilePos); } else { - uint32 cacheDiff = _filePos - _cachePos; + uint32 cacheDiff = _filePos - _cachePos; assert(_bytesInCache >= cacheDiff); cacheDiff &= ~READ_ALIGN_MASK; _bytesInCache -= cacheDiff; @@ -344,32 +416,18 @@ uint32 Ps2File::read(void *dest, uint32 len) { } uint32 Ps2File::write(const void *src, uint32 len) { - uint32 w; #ifdef __PS2_FILE_SEMA__ WaitSema(_sema); #endif - _cacheSize = 0; - w = fio.sync(_fd); - assert(w==0); - - fio.seek(_fd, _filePos, SEEK_SET); - fio.write(_fd, src, len); - - w = fio.sync(_fd); + memcpy(&_cacheBuf[_filePos], src, len); + _filePos += len; #ifdef __PS2_FILE_SEMA__ SignalSema(_sema); #endif - if (w) { - _filePos += w; - if (w < len) - _eof = true; - return w; - } - - return 0; + return len; } FILE *ps2_fopen(const char *fname, const char *mode) { @@ -471,7 +529,8 @@ int ps2_ferror(FILE *stream) { if (err) printf("ferror -> %d\n", err); - return err; + return 0; // kyra temp + // return err; } void ps2_clearerr(FILE *stream) { diff --git a/backends/platform/ps2/fileio.h b/backends/platform/ps2/fileio.h index e793c29d4b..b481979388 100644 --- a/backends/platform/ps2/fileio.h +++ b/backends/platform/ps2/fileio.h @@ -62,12 +62,12 @@ private: void cacheReadSync(void); int _fd; + uint32 _mode; uint32 _fileSize; uint32 _filePos; uint32 _cacheSize; uint32 _cachePos; - // uint8 cache[2048]; uint8 *_cache; int _eof; diff --git a/backends/platform/ps2/irxboot.cpp b/backends/platform/ps2/irxboot.cpp index daa592522a..15cb816c31 100644 --- a/backends/platform/ps2/irxboot.cpp +++ b/backends/platform/ps2/irxboot.cpp @@ -55,15 +55,16 @@ IrxFile irxFiles[] = { { "USB_MASS.IRX", USB | OPTIONAL, MASS_DRIVER, NULL, 0 }, { "PS2MOUSE.IRX", USB | OPTIONAL, MOUSE_DRIVER, NULL, 0 }, { "RPCKBD.IRX", USB | OPTIONAL, KBD_DRIVER, NULL, 0 }, - +#ifndef NO_ADAPTOR { "POWEROFF.IRX", HDD | OPTIONAL | NOT_HOST | DEPENDANCY, HDD_DRIVER, NULL, 0 }, { "PS2DEV9.IRX", HDD | OPTIONAL | NOT_HOST | DEPENDANCY, HDD_DRIVER, NULL, 0 }, { "PS2ATAD.IRX", HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, NULL, 0 }, { "PS2HDD.IRX", HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, hddArg, sizeof(hddArg) }, { "PS2FS.IRX", HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, pfsArg, sizeof(pfsArg) }, - { "PS2IP.IRX", NET | NOT_HOST, NET_DRIVER, NULL, 0 }, - { "PS2SMAP.IRX", NET | NOT_HOST, NET_DRIVER, netArg, sizeof(netArg) }, - { "PS2HOST.IRX", NET | NOT_HOST, NET_DRIVER, NULL, 0 } + { "PS2IP.IRX", NET | OPTIONAL | NOT_HOST | DEPENDANCY, NET_DRIVER, NULL, 0 }, + { "PS2SMAP.IRX", NET | OPTIONAL | NOT_HOST | DEPENDANCY, NET_DRIVER, netArg, sizeof(netArg) }, + { "PS2HOST.IRX", NET | OPTIONAL | NOT_HOST | DEPENDANCY, NET_DRIVER, NULL, 0 } +#endif }; static const int numIrxFiles = sizeof(irxFiles) / sizeof(irxFiles[0]); diff --git a/backends/platform/ps2/ps2input.cpp b/backends/platform/ps2/ps2input.cpp index c320e79eed..964a773f7e 100644 --- a/backends/platform/ps2/ps2input.cpp +++ b/backends/platform/ps2/ps2input.cpp @@ -510,22 +510,22 @@ const Common::KeyCode Ps2Input::_usbToSdlk[0x100] = { }; const Common::KeyCode Ps2Input::_padCodes[16] = { - Common::KEYCODE_1, // Select - Common::KEYCODE_INVALID, // L3 - Common::KEYCODE_INVALID, // R3 - Common::KEYCODE_F5, // Start - Common::KEYCODE_INVALID, // Up - Common::KEYCODE_INVALID, // Right - Common::KEYCODE_INVALID, // Down - Common::KEYCODE_INVALID, // Left - Common::KEYCODE_KP0, // L2 - Common::KEYCODE_INVALID, // R2 - Common::KEYCODE_n, // L1 - Common::KEYCODE_y, // R1 - Common::KEYCODE_ESCAPE, // Triangle - Common::KEYCODE_INVALID, // Circle => Right mouse button - Common::KEYCODE_INVALID, // Cross => Left mouse button - Common::KEYCODE_RETURN // Square + Common::KEYCODE_1, // Select + Common::KEYCODE_INVALID, // L3 + Common::KEYCODE_INVALID, // R3 + Common::KEYCODE_F5, // Start + Common::KEYCODE_INVALID, // Up + Common::KEYCODE_INVALID, // Right + Common::KEYCODE_INVALID, // Down + Common::KEYCODE_INVALID, // Left + Common::KEYCODE_KP0, // L2 + Common::KEYCODE_PERIOD, // R2 + Common::KEYCODE_n, // L1 + Common::KEYCODE_y, // R1 + Common::KEYCODE_ESCAPE, // Triangle + Common::KEYCODE_INVALID, // Circle => Right mouse button + Common::KEYCODE_INVALID, // Cross => Left mouse button + Common::KEYCODE_RETURN // Square }; const Common::KeyCode Ps2Input::_padFlags[16] = { @@ -544,7 +544,7 @@ const Common::KeyCode Ps2Input::_padFlags[16] = { Common::KEYCODE_INVALID, // Triangle Common::KEYCODE_INVALID, // Circle Common::KEYCODE_INVALID, // Cross - Common::KEYCODE_INVALID // Square + Common::KEYCODE_INVALID // Square }; diff --git a/backends/platform/ps2/savefilemgr.cpp b/backends/platform/ps2/savefilemgr.cpp index 1271a43d42..1613863530 100644 --- a/backends/platform/ps2/savefilemgr.cpp +++ b/backends/platform/ps2/savefilemgr.cpp @@ -239,10 +239,10 @@ Common::StringList Ps2SaveFileManager::listSavefiles(const Common::String &patte if (!savePath.exists() || !savePath.isDirectory()) return Common::StringList(); - printf("listSavefiles = %s\n", pattern); + printf("listSavefiles = %s\n", pattern.c_str()); if (_mc) { - strcpy(temp, pattern); + strcpy(temp, pattern.c_str()); // mcSplit(temp, game, ext); game = strdup(strtok(temp, ".")); @@ -255,7 +255,7 @@ Common::StringList Ps2SaveFileManager::listSavefiles(const Common::String &patte } else { _dir = Common::String(savePath.getPath()); - search = Common::String(pattern); + search = pattern; } Common::FSDirectory dir(_dir); diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index f29caf2279..57a03f777d 100644 --- a/backends/platform/ps2/systemps2.cpp +++ b/backends/platform/ps2/systemps2.cpp @@ -66,6 +66,10 @@ #include "icon.h" #include "ps2temp.h" +#ifdef __PS2_DEBUG__ +#include +#endif + // asm("mfc0 %0, $9\n" : "=r"(tickStart)); extern void *_gp; @@ -95,6 +99,11 @@ PS2Device detectBootPath(const char *elfPath, char *bootPath); extern AsyncFio fio; +#ifdef __PS2_DEBUG__ +extern "C" int gdb_stub_main(int argc, char *argv[]); +extern "C" void breakpoint(void); +#endif + extern "C" int scummvm_main(int argc, char *argv[]); extern "C" int main(int argc, char *argv[]) { @@ -117,6 +126,10 @@ extern "C" int main(int argc, char *argv[]) { sioprintf("Result = %d\n", res); } +#ifdef __PS2_DEBUG__ + gdb_stub_main(argc, argv); +#endif + sioprintf("Creating system\n"); g_system = g_systemPs2 = new OSystem_PS2(argv[0]); @@ -241,6 +254,8 @@ OSystem_PS2::OSystem_PS2(const char *elfPath) { _printY = 0; _msgClearTime = 0; _systemQuit = false; + _modeChanged = false; + _screenChangeCount = 0; _screen = new Gs2dScreen(320, 200, TV_DONT_CARE); @@ -327,9 +342,8 @@ OSystem_PS2::OSystem_PS2(const char *elfPath) { void OSystem_PS2::init(void) { sioprintf("Timer...\n"); _scummTimerManager = new DefaultTimerManager(); - _scummEventManager = new DefaultEventManager(); _scummMixer = new Audio::MixerImpl(this); - _scummMixer->setOutputRate(44100); + _scummMixer->setOutputRate(48000); _scummMixer->setReady(true); initTimer(); @@ -520,6 +534,9 @@ void OSystem_PS2::initSize(uint width, uint height) { _oldMouseX = width / 2; _oldMouseY = height / 2; + + _modeChanged = true; + _screenChangeCount++; printf("done\n"); } @@ -574,11 +591,11 @@ void OSystem_PS2::delayMillis(uint msecs) { Common::TimerManager *OSystem_PS2::getTimerManager() { return _scummTimerManager; } - +/* Common::EventManager *OSystem_PS2::getEventManager() { - return _scummEventManager; + return getEventManager(); } - +*/ Audio::Mixer *OSystem_PS2::getMixer() { return _scummMixer; } @@ -661,7 +678,7 @@ int16 OSystem_PS2::getOverlayHeight(void) { return _screen->getOverlayHeight(); } -Graphics::Surface *OSystem_PS2::lockScreen() { +Graphics::Surface *OSystem_PS2::lockScreen(void) { return _screen->lockScreen(); } @@ -669,6 +686,10 @@ void OSystem_PS2::unlockScreen(void) { _screen->unlockScreen(); } +void OSystem_PS2::fillScreen(uint32 col) { + _screen->fillScreen(col); +} + const OSystem::GraphicsMode OSystem_PS2::_graphicsMode = { NULL, NULL, 0 }; const OSystem::GraphicsMode *OSystem_PS2::getSupportedGraphicsModes(void) const { @@ -688,7 +709,16 @@ int OSystem_PS2::getDefaultGraphicsMode(void) const { } bool OSystem_PS2::pollEvent(Common::Event &event) { - bool res = _input->pollEvent(&event); + bool res; + + if (_modeChanged) { + _modeChanged = false; + event.type = Common::EVENT_SCREEN_CHANGED; + return true; + } + + res = _input->pollEvent(&event); + if (res && (event.type == Common::EVENT_MOUSEMOVE)) _screen->setMouseXy(event.mouse.x, event.mouse.y); return res; diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h index ab27d93574..24cd94f503 100644 --- a/backends/platform/ps2/systemps2.h +++ b/backends/platform/ps2/systemps2.h @@ -27,9 +27,9 @@ #define SYSTEMPS2_H #include "common/system.h" +#include "backends/base-backend.h" class DefaultTimerManager; -class DefaultEventManager; class DefaultSaveFileManager; class Gs2dScreen; @@ -54,7 +54,7 @@ namespace Audio { class MixerImpl; }; -class OSystem_PS2 : public OSystem { +class OSystem_PS2 : public BaseBackend { public: OSystem_PS2(const char *elfPath); virtual ~OSystem_PS2(void); @@ -72,6 +72,7 @@ public: virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); virtual void updateScreen(); + virtual void fillScreen(uint32); /* TODO : check */ virtual void displayMessageOnOSD(const char *msg) { printf("displayMessageOnOSD: %s\n", msg); }; /* */ @@ -92,7 +93,7 @@ public: virtual uint32 getMillis(); virtual void delayMillis(uint msecs); virtual Common::TimerManager *getTimerManager(); - virtual Common::EventManager *getEventManager(); +// virtual Common::EventManager *getEventManager(); virtual bool pollEvent(Common::Event &event); virtual Audio::Mixer *getMixer(); @@ -112,14 +113,14 @@ public: virtual int getDefaultGraphicsMode() const; virtual bool setGraphicsMode(int mode); virtual int getGraphicsMode() const; + virtual int getScreenChangeID() const { return _screenChangeCount; } virtual void quit(); virtual Common::SeekableReadStream *createConfigReadStream(); virtual Common::WriteStream *createConfigWriteStream(); - virtual Graphics::PixelFormat getOverlayFormat() const; - + virtual Graphics::PixelFormat getOverlayFormat() const; virtual Common::SaveFileManager *getSavefileManager(); virtual FilesystemFactory *getFilesystemFactory(); @@ -149,7 +150,6 @@ private: void readRtcTime(void); DefaultTimerManager *_scummTimerManager; - DefaultEventManager *_scummEventManager; Audio::MixerImpl *_scummMixer; bool _mouseVisible; @@ -163,6 +163,8 @@ private: uint16 _oldMouseX, _oldMouseY; uint32 _msgClearTime; uint16 _printY; + bool _modeChanged; + int _screenChangeCount; int _mutexSema; Ps2Mutex _mutex[MAX_MUTEXES]; @@ -179,4 +181,3 @@ private: }; #endif // SYSTEMPS2_H - diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index cef13341b5..d474a43b05 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -137,7 +137,7 @@ bool ScummEngine::saveState(Common::OutSaveFile *out, bool writeHeader) { memcpy(hdr.name, _saveLoadName, sizeof(hdr.name)); saveSaveGameHeader(out, hdr); } -#if !defined(__DS__) +#if !defined(__DS__) /* && !defined(__PLAYSTATION2__) */ Graphics::saveThumbnail(*out); #endif saveInfos(out); -- cgit v1.2.3 From f278432144347c92027914530597df11bdd5a527 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Jul 2009 07:23:50 +0000 Subject: Added support for sub-relation message types - this fixes trying to attach the chain to the hook on the deck svn-id: r42405 --- engines/cruise/cruise_main.cpp | 77 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 70 insertions(+), 7 deletions(-) diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index faea3e1e3a..711f7bdf94 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -35,6 +35,8 @@ namespace Cruise { +enum RelationType {RT_REL = 30, RT_MSG = 50}; + static int playerDontAskQuit; unsigned int timer = 0; @@ -1024,8 +1026,8 @@ void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj) { } if ((obj2Ovl == nOvl) && (pHeader->obj2Number != -1) && (pHeader->obj2Number == nObj)) { -// int x = 60; -// int y = 60; + int x = 60; + int y = 60; objectParamsQuery params; memset(¶ms, 0, sizeof(objectParamsQuery)); // to remove warning @@ -1035,7 +1037,7 @@ void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj) { } if ((pHeader->obj2OldState == -1) || (params.state == pHeader->obj2OldState)) { - if (pHeader->type == 30) { // REL + if (pHeader->type == RT_REL) { // REL if (currentScriptPtr) { attacheNewScriptToTail(&relHead, ovlIdx, pHeader->id, 30, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_REL); } else { @@ -1073,8 +1075,69 @@ void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj) { changeScriptParamInList(ovlIdx, pHeader->id, &relHead, 0, 9998); } } - } else if (pHeader->type == 50) { - ASSERT(0); + } else if (pHeader->type == RT_MSG) { + + if (pHeader->obj2Number >= 0) { + if ((pHeader->trackX !=-1) && (pHeader->trackY !=-1) && + (pHeader->trackX != 9999) && (pHeader->trackY != 9999)) { + x = pHeader->trackX - 100; + y = pHeader->trackY - 150; + } else if (params.scale >= 0) { + x = params.X - 100; + y = params.Y - 40; + } + + if (pHeader->obj2NewState != -1) { + objInit(obj2Ovl, pHeader->obj2Number, pHeader->obj2NewState); + } + } + + if ((pHeader->obj1Number >= 0) && (pHeader->obj1NewState != -1)) { + int obj1Ovl = pHeader->obj1Overlay; + if (!obj1Ovl) obj1Ovl = ovlIdx; + objInit(obj1Ovl, pHeader->obj1Number, pHeader->obj1NewState); + } + + if (currentScriptPtr) { + createTextObject(&cellHead, ovlIdx, pHeader->id, x, y, 200, findHighColor(), masterScreen, currentScriptPtr->overlayNumber, currentScriptPtr->scriptNumber); + } else { + createTextObject(&cellHead, ovlIdx, pHeader->id, x, y, 200, findHighColor(), masterScreen, 0, 0); + } + + userWait = 1; + autoOvl = ovlIdx; + autoMsg = pHeader->id; + + if ((narratorOvl > 0) && (pHeader->trackX != -1) && (pHeader->trackY != -1)) { + actorStruct *pTrack = findActor(&actorHead, narratorOvl, narratorIdx, 0); + + if (pTrack) { + objectParamsQuery naratorParams; + animationStart = false; + + if (pHeader->trackDirection == 9999) { + getMultipleObjectParam(narratorOvl, narratorIdx, &naratorParams); + pTrack->x_dest = naratorParams.X; + pTrack->y_dest = naratorParams.Y; + pTrack->endDirection = direction(naratorParams.X, naratorParams.Y, pHeader->trackX,pHeader->trackY, 0, 0); + } else if ((pHeader->trackX == 9999) && (pHeader->trackY == 9999)) { + getMultipleObjectParam(narratorOvl, narratorIdx, &naratorParams); + pTrack->x_dest = naratorParams.X; + pTrack->y_dest = naratorParams.Y; + pTrack->endDirection = pHeader->trackDirection; + } else { + pTrack->x_dest = pHeader->trackX; + pTrack->y_dest = pHeader->trackY; + pTrack->endDirection = pHeader->trackDirection; + } + + pTrack->flag = 1; + autoTrack = true; + userWait = 0; + userEnabled = 0; + freezeCell(&cellHead, ovlIdx, pHeader->id, 5, -1, 0, 9998); + } + } } } } @@ -1112,7 +1175,7 @@ void callRelation(menuElementSubStruct *pMenuElement, int nObj2) { if (pHeader->obj2Number == nObj2) { // REL - if (pHeader->type == 30) { + if (pHeader->type == RT_REL) { if (currentScriptPtr) { attacheNewScriptToTail(&relHead, ovlIdx, pHeader->id, 30, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_REL); } else { @@ -1150,7 +1213,7 @@ void callRelation(menuElementSubStruct *pMenuElement, int nObj2) { changeScriptParamInList(ovlIdx, pHeader->id, &relHead, 0, 9998); } } - } else if (pHeader->type == 50) { // MSG + } else if (pHeader->type == RT_MSG) { // MSG int obj1Ovl = pHeader->obj1Overlay; if (!obj1Ovl) obj1Ovl = ovlIdx; -- cgit v1.2.3 From c3ce2087bb42ca43f28cdef332ee2772e6feb6c3 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 12 Jul 2009 08:51:57 +0000 Subject: Add missing quotation mark to error message. svn-id: r42406 --- engines/kyra/script.cpp | 2 +- engines/kyra/script_tim.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/kyra/script.cpp b/engines/kyra/script.cpp index 0473f03591..726c013b5a 100644 --- a/engines/kyra/script.cpp +++ b/engines/kyra/script.cpp @@ -125,7 +125,7 @@ bool EMCInterpreter::load(const char *filename, EMCData *scriptData, const Commo error("No DATA chunk found in file: '%s'", filename); if (stream->err()) - error("Read error while parsing file '%s", filename); + error("Read error while parsing file '%s'", filename); delete stream; diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp index 424a62aaf8..bc62e5bd6a 100644 --- a/engines/kyra/script_tim.cpp +++ b/engines/kyra/script_tim.cpp @@ -169,7 +169,7 @@ TIM *TIMInterpreter::load(const char *filename, const Common::Arrayerr()) - error("Read error while parsing file '%s", filename); + error("Read error while parsing file '%s'", filename); delete stream; -- cgit v1.2.3 From 32f1e47effadf6e361f3e6c658ca43a36f37852a Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 12 Jul 2009 14:29:59 +0000 Subject: Fix typo, which in fact fixes bug #2820353 "GUI: Search doesn't handle uppercase properly". svn-id: r42418 --- gui/ListWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index 07d22973ac..8661444cf3 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -564,7 +564,7 @@ void ListWidget::setFilter(const String &filter, bool redraw) { // Restrict the list to everything which contains all words in _filter // as substrings, ignoring case. - Common::StringTokenizer tok(filter); + Common::StringTokenizer tok(_filter); String tmp; int n = 0; -- cgit v1.2.3 From d6fb5bb9227aeaf5452af722d27bdde4c6805337 Mon Sep 17 00:00:00 2001 From: Kostas Nakos Date: Sun, 12 Jul 2009 15:59:27 +0000 Subject: Apply patch 2802544: WINCE: Implement OSystem::engineInit to remove hack svn-id: r42419 --- backends/platform/wince/wince-sdl.cpp | 7 +------ backends/platform/wince/wince-sdl.h | 3 +-- 2 files changed, 2 insertions(+), 8 deletions(-) mode change 100644 => 100755 backends/platform/wince/wince-sdl.cpp diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp old mode 100644 new mode 100755 index b8261d029e..9a4b312631 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -908,18 +908,13 @@ int OSystem_WINCE3::getOutputSampleRate() const { return _sampleRate; } -void OSystem_WINCE3::setWindowCaption(const char *caption) { +void OSystem_WINCE3::engineInit() { check_mappings(); // called here to initialize virtual keys handling //update_game_settings(); // finalize mixer init compute_sample_rate(); setupMixer(); - -FIXME: move check_mappings() etc. calls to engineInit() & engineDone() - - // handle the actual event - OSystem_SDL::setWindowCaption(caption); } bool OSystem_WINCE3::openCD(int drive) { diff --git a/backends/platform/wince/wince-sdl.h b/backends/platform/wince/wince-sdl.h index 13f20ecccf..cc2948f93d 100644 --- a/backends/platform/wince/wince-sdl.h +++ b/backends/platform/wince/wince-sdl.h @@ -84,7 +84,7 @@ public: // Overloaded from SDL backend (master volume and sample rate subtleties) void setupMixer(); // Overloaded from OSystem - //void engineInit(); + void engineInit(); void getTimeAndDate(struct tm &t) const; virtual Common::SeekableReadStream *createConfigReadStream(); virtual Common::WriteStream *createConfigWriteStream(); @@ -145,7 +145,6 @@ protected: //int getGraphicsMode() const; int getDefaultGraphicsMode() const; - void setWindowCaption(const char *caption); bool openCD(int drive); int getOutputSampleRate() const; -- cgit v1.2.3 From 810bbca93c54bed741dd6f4f626c4845e65ac0ba Mon Sep 17 00:00:00 2001 From: Kostas Nakos Date: Sun, 12 Jul 2009 15:59:56 +0000 Subject: fix build with arm-asm routines svn-id: r42420 --- engines/scumm/gfx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 engines/scumm/gfx.cpp diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp old mode 100644 new mode 100755 index 07640ca551..5961ec4013 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -36,7 +36,7 @@ #include "scumm/util.h" #ifdef USE_ARM_GFX_ASM -extern "C" void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst, +extern "C" void asmDrawStripToScreen(int height, int width, void const* text, void const* src, byte* dst, int vsPitch, int vmScreenWidth, int textSurfacePitch); extern "C" void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height); #endif /* USE_ARM_GFX_ASM */ -- cgit v1.2.3 From b0b12b60ed9c1d744ce2247b2de327c7c55bc07a Mon Sep 17 00:00:00 2001 From: Kostas Nakos Date: Sun, 12 Jul 2009 16:40:10 +0000 Subject: oops, fix props svn-id: r42421 --- backends/platform/wince/wince-sdl.cpp | 0 engines/scumm/gfx.cpp | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 backends/platform/wince/wince-sdl.cpp mode change 100755 => 100644 engines/scumm/gfx.cpp diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp old mode 100755 new mode 100644 diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp old mode 100755 new mode 100644 -- cgit v1.2.3 From bd91c1129d5b00a1cf76d02ffc31891b26829e16 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 12 Jul 2009 18:52:38 +0000 Subject: Patch #1936137: "Speech for Mac BS1 english" svn-id: r42423 --- engines/sword1/sound.cpp | 99 ++++++++++++++++++++++++++++++++++++++++++++--- engines/sword1/sound.h | 3 ++ engines/sword1/sword1.cpp | 4 ++ 3 files changed, 101 insertions(+), 5 deletions(-) diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp index 5577c66fc6..3e920c5018 100644 --- a/engines/sword1/sound.cpp +++ b/engines/sword1/sound.cpp @@ -51,6 +51,7 @@ Sound::Sound(const char *searchPath, Audio::Mixer *mixer, ResMan *pResMan) { strcpy(_filePath, searchPath); _mixer = mixer; _resMan = pResMan; + _bigEndianSpeech = false; _cowHeader = NULL; _endOfQueue = 0; _currentCowFile = 0; @@ -67,6 +68,83 @@ Sound::~Sound(void) { closeCowSystem(); } +void Sound::checkSpeechFileEndianness() { + // Some mac versions (not all of them) use big endian wav, although + // the wav header doesn't indicate it. + // Use heuristic to determine endianness of speech. + // The heuristic consist in computing the sum of the absolute difference for + // every two consecutive samples. This is done both with a big endian and a + // little endian assumption. The one with the smallest sum should be the + // correct one (the sound wave is supposed to be relatively smooth). + // It needs at least 1000 samples to get stable result (the code below is + // using the first 2000 samples of the wav sound. + + // Init speach file if not already done. + if (!_currentCowFile) { + // Open one of the speech file. It uses SwordEngine::_systemVars.currentCD + // to decide which file to open, therefore if it is currently set to zero + // we have to set it to either 1 or 2 (I decided to set it to 1 as this is + // more likely to be the first file that will be needed). + bool no_current_cd = false; + if (SwordEngine::_systemVars.currentCD == 0) { + SwordEngine::_systemVars.currentCD = 1; + no_current_cd = true; + } + initCowSystem(); + if (no_current_cd) { + // In case it fails with CD1 retyr with CD2 + if (!_currentCowFile) { + SwordEngine::_systemVars.currentCD = 2; + initCowSystem(); + } + // Reset curentCD flag + SwordEngine::_systemVars.currentCD = 0; + } + } + + // Testing for endianness makes sense only if using the nom compressed files. + if (_cowHeader == NULL || (_cowMode != CowWave && _cowMode != CowDemo)) + return; + + // I picked the sample to use randomly (I just made sure it is long enough so that there is + // a fair change of the heuristic to have a stable result and work for every languages). + int roomNo = _currentCowFile == 1 ? 1 : 129; + int localNo = _currentCowFile == 1 ? 2 : 933; + // Get the speech data and apply the heuristic + uint32 locIndex = _cowHeader[roomNo] >> 2; + uint32 sampleSize = _cowHeader[locIndex + (localNo * 2)]; + uint32 index = _cowHeader[locIndex + (localNo * 2) - 1]; + if (sampleSize) { + uint32 size; + double be_diff_sum = 0., le_diff_sum = 0.; + _bigEndianSpeech = false; + int16 *data = uncompressSpeech(index + _cowHeaderSize, sampleSize, &size); + // Compute average of differecen between two consecutive samples for both BE and LE + if (data) { + if (size > 4000) + size = 2000; + else + size /= 2; + int16 prev_be_value = (int16)SWAP_BYTES_16(*((uint16*)(data))); + for (uint32 i = 1 ; i < size ; ++i) { + le_diff_sum += fabs(data[i] - data[i-1]); + int16 be_value = (int16)SWAP_BYTES_16(*((uint16*)(data + i))); + be_diff_sum += fabs(be_value - prev_be_value); + prev_be_value = be_value; + } + delete [] data; + } + // Set the big endian flag + _bigEndianSpeech = (be_diff_sum < le_diff_sum); + if (_bigEndianSpeech) + debug(6, "Mac version: using big endian speech file"); + else + debug(6, "Mac version: using little endian speech file"); + debug(8, "Speech endianness heuristic: average = %f for BE and %f for LE, computed on %d samples)", be_diff_sum / (size - 1), le_diff_sum / (size - 1), size); + } +} + + int Sound::addToQueue(int32 fxNo) { bool alreadyInQueue = false; for (uint8 cnt = 0; (cnt < _endOfQueue) && (!alreadyInQueue); cnt++) @@ -386,21 +464,32 @@ int16 *Sound::uncompressSpeech(uint32 index, uint32 cSize, uint32 *size) { int16 *dstData = (int16*)malloc(resSize * 2); int32 samplesLeft = resSize; while (srcPos < cSize && samplesLeft > 0) { - length = (int16)READ_LE_UINT16(srcData + srcPos); + length = (int16)(_bigEndianSpeech ? READ_BE_UINT16(srcData + srcPos) : READ_LE_UINT16(srcData + srcPos)); srcPos++; if (length < 0) { length = -length; if (length > samplesLeft) length = samplesLeft; + int16 value; + if (_bigEndianSpeech) { + value = (int16)SWAP_BYTES_16(*((uint16*)(srcData + srcPos))); + } else { + value = srcData[srcPos]; + } for (uint16 cnt = 0; cnt < (uint16)length; cnt++) - dstData[dstPos++] = srcData[srcPos]; + dstData[dstPos++] = value; srcPos++; } else { if (length > samplesLeft) length = samplesLeft; - memcpy(dstData + dstPos, srcData + srcPos, length * 2); - dstPos += length; - srcPos += length; + if (_bigEndianSpeech) { + for (uint16 cnt = 0; cnt < (uint16)length; cnt++) + dstData[dstPos++] = (int16)SWAP_BYTES_16(*((uint16*)(srcData + (srcPos++)))); + } else { + memcpy(dstData + dstPos, srcData + srcPos, length * 2); + dstPos += length; + srcPos += length; + } } samplesLeft -= length; } diff --git a/engines/sword1/sound.h b/engines/sword1/sound.h index cdbdcdf6bb..c105d06b50 100644 --- a/engines/sword1/sound.h +++ b/engines/sword1/sound.h @@ -95,6 +95,8 @@ public: void engine(void); + void checkSpeechFileEndianness(); + private: uint8 _sfxVolL, _sfxVolR, _speechVolL, _speechVolR; void playSample(QueueElement *elem); @@ -116,6 +118,7 @@ private: uint8 _endOfQueue; Audio::Mixer *_mixer; ResMan *_resMan; + bool _bigEndianSpeech; char _filePath[100]; static const char _musicList[270]; static const uint16 _roomsFixedFx[TOTAL_ROOMS][TOTAL_FX_PER_ROOM]; diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp index 3796ceefd6..61ab835da6 100644 --- a/engines/sword1/sword1.cpp +++ b/engines/sword1/sword1.cpp @@ -145,6 +145,10 @@ Common::Error SwordEngine::init() { _systemVars.playSpeech = 1; _mouseState = 0; + + // Some Mac versions use big endian for the speech files but not all of them. + if (_systemVars.platform == Common::kPlatformMacintosh) + _sound->checkSpeechFileEndianness(); _logic->initialize(); _objectMan->initialize(); -- cgit v1.2.3 From a0c37549714a9f02351e85d3503ae129b0aae9b0 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Sun, 12 Jul 2009 21:58:00 +0000 Subject: Split _eof vs. _err. Latter defaults to false for now, there are hooks for possible future implementation. svn-id: r42428 --- backends/platform/ps2/fileio.cpp | 23 +++++++++++++++++------ backends/platform/ps2/fileio.h | 3 ++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/backends/platform/ps2/fileio.cpp b/backends/platform/ps2/fileio.cpp index 8e5dc1255f..864f840e8a 100644 --- a/backends/platform/ps2/fileio.cpp +++ b/backends/platform/ps2/fileio.cpp @@ -58,6 +58,7 @@ Ps2File::Ps2File(void) { _cacheSize = 0; _cachePos = 0; _eof = false; + _err = false; // _cache = (uint8 *)malloc(PS2_CACHE_MAX); @@ -224,10 +225,11 @@ bool Ps2File::eof(void) { } bool Ps2File::getErr(void) { - return _eof; + return _err; } void Ps2File::setErr(bool err) { + _err = err; _eof = err; } @@ -261,7 +263,9 @@ int Ps2File::seek(int32 offset, int origin) { _eof = false; res = 0; } - else _eof = true; + else { + _eof = true; + } // printf("seek [%d] %d %d\n", _fd, offset, origin); // printf(" res = %d\n", res); @@ -350,10 +354,17 @@ uint32 Ps2File::read(void *dest, uint32 len) { printf("read (1) : _cachePos = %d\n", _cachePos); #endif + if (len == 0) { +#ifdef __PS2_FILE_SEMA__ + SignalSema(_sema); +#endif + return 0; + } + if (_filePos >= _fileSize) { _eof = true; #ifdef __PS2_FILE_SEMA__ - SignalSema(_sema); + SignalSema(_sema); #endif return 0; } @@ -526,11 +537,11 @@ int ps2_fflush(FILE *stream) { int ps2_ferror(FILE *stream) { int err = ((Ps2File*)stream)->getErr(); - if (err) + if (err) { printf("ferror -> %d\n", err); + } - return 0; // kyra temp - // return err; + return err; } void ps2_clearerr(FILE *stream) { diff --git a/backends/platform/ps2/fileio.h b/backends/platform/ps2/fileio.h index b481979388..6838162e06 100644 --- a/backends/platform/ps2/fileio.h +++ b/backends/platform/ps2/fileio.h @@ -70,7 +70,8 @@ private: uint8 *_cache; - int _eof; + bool _eof; + bool _err; int _sema; -- cgit v1.2.3 From 973adc2772a3c84337ab8d8a871a2ddbfd6ee496 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Sun, 12 Jul 2009 22:00:47 +0000 Subject: On PS2 use "fprintf" (as in 0.13.x ) to print error messages to stderr, rather than "fputs", which is buggy in the PS2 implementation. svn-id: r42429 --- common/util.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/util.cpp b/common/util.cpp index e99bbeb12d..170e972c4f 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -477,7 +477,11 @@ void NORETURN error(const char *s, ...) { // Print the error message to stderr +#ifndef __PLAYSTATION2__ fputs(buf_output, stderr); +#else + fprintf(stderr, "%s\n", buf_output); +#endif // Unless this error -originated- within the debugger itself, we // now invoke the debugger, if available / supported. -- cgit v1.2.3 From 3427fb3100c84af0d63c8f8136615489fe0c7d47 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 12 Jul 2009 22:08:10 +0000 Subject: Remove double endline svn-id: r42430 --- common/util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/util.cpp b/common/util.cpp index 170e972c4f..5f5e31aa93 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -480,7 +480,7 @@ void NORETURN error(const char *s, ...) { #ifndef __PLAYSTATION2__ fputs(buf_output, stderr); #else - fprintf(stderr, "%s\n", buf_output); + fprintf(stderr, "%s", buf_output); #endif // Unless this error -originated- within the debugger itself, we -- cgit v1.2.3 From 93c91945045b738fb098403228d91bce40b469f7 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Mon, 13 Jul 2009 00:55:30 +0000 Subject: Reverted my previous change (fprintf vs fputs), and properly implemented fputs for stderr case on PS2 ;-) svn-id: r42433 --- backends/platform/ps2/fileio.cpp | 7 +++++++ common/util.cpp | 4 ---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/backends/platform/ps2/fileio.cpp b/backends/platform/ps2/fileio.cpp index 864f840e8a..017286dc45 100644 --- a/backends/platform/ps2/fileio.cpp +++ b/backends/platform/ps2/fileio.cpp @@ -507,6 +507,13 @@ int ps2_fputc(int c, FILE *stream) { int ps2_fputs(const char *s, FILE *stream) { int len = strlen(s); + + if (stream == stderr || stream == stdout) { + printf("%s", s); + sioprintf("%s", s); + return len; + } + if (ps2_fwrite(s, 1, len, stream) == (size_t)len) return len; else diff --git a/common/util.cpp b/common/util.cpp index 5f5e31aa93..e99bbeb12d 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -477,11 +477,7 @@ void NORETURN error(const char *s, ...) { // Print the error message to stderr -#ifndef __PLAYSTATION2__ fputs(buf_output, stderr); -#else - fprintf(stderr, "%s", buf_output); -#endif // Unless this error -originated- within the debugger itself, we // now invoke the debugger, if available / supported. -- cgit v1.2.3 From 01624bbb28a96376701c8afcfcb7fb651ac2d8bd Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Mon, 13 Jul 2009 07:55:11 +0000 Subject: Fix bug #2820472 - MAZE: Keyboard input fault. svn-id: r42434 --- engines/scumm/he/intern_he.h | 3 + engines/scumm/input.cpp | 272 ++++++++++++++++++++++++------------------- engines/scumm/scumm.cpp | 2 +- engines/scumm/scumm.h | 5 +- 4 files changed, 157 insertions(+), 125 deletions(-) diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h index c2079fa5fe..4c2da19cc5 100644 --- a/engines/scumm/he/intern_he.h +++ b/engines/scumm/he/intern_he.h @@ -359,6 +359,8 @@ protected: virtual void setupScummVars(); virtual void resetScummVars(); + virtual void parseEvent(Common::Event event); + virtual void initCharset(int charset); virtual void clearDrawQueues(); @@ -386,6 +388,7 @@ protected: byte VAR_PLATFORM; byte VAR_PLATFORM_VERSION; byte VAR_CURRENT_CHARSET; + byte VAR_KEY_STATE; byte VAR_COLOR_DEPTH; }; diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp index f378f2225e..42b48a3f3d 100644 --- a/engines/scumm/input.cpp +++ b/engines/scumm/input.cpp @@ -55,145 +55,173 @@ enum MouseButtonStatus { msClicked = 2 }; -void ScummEngine::parseEvents() { - Common::Event event; - - while (_eventMan->pollEvent(event)) { - - switch (event.type) { - case Common::EVENT_KEYDOWN: - if (event.kbd.keycode >= '0' && event.kbd.keycode <= '9' - && (event.kbd.flags == Common::KBD_ALT || - event.kbd.flags == Common::KBD_CTRL)) { - _saveLoadSlot = event.kbd.keycode - '0'; - - // don't overwrite autosave (slot 0) - if (_saveLoadSlot == 0) - _saveLoadSlot = 10; - - sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot); - _saveLoadFlag = (event.kbd.flags == Common::KBD_ALT) ? 1 : 2; - _saveTemporaryState = false; - } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'f') { - _fastMode ^= 1; - } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'g') { - _fastMode ^= 2; - } else if ((event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'd') || - event.kbd.ascii == '~' || event.kbd.ascii == '#') { - _debugger->attach(); - } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 's') { - _res->resourceStats(); - } else { - // Normal key press, pass on to the game. - _keyPressed = event.kbd; - } +#ifdef ENABLE_HE +void ScummEngine_v80he::parseEvent(Common::Event event) { + ScummEngine::parseEvent(event); - if (_game.heversion >= 80) { - // FIXME: Move this code & VAR_KEY_STATE to class ScummEngine_v80he + // Keyboard is controlled via variable + switch (event.type) { + case Common::EVENT_KEYDOWN: + if (event.kbd.keycode == Common::KEYCODE_LEFT) + VAR(VAR_KEY_STATE) |= 1; - // Keyboard is controlled via variable - int keyState = 0; + if (event.kbd.keycode == Common::KEYCODE_RIGHT) + VAR(VAR_KEY_STATE) |= 2; - if (event.kbd.keycode == Common::KEYCODE_LEFT) // Left - keyState = 1; + if (event.kbd.keycode == Common::KEYCODE_UP) + VAR(VAR_KEY_STATE) |= 4; - if (event.kbd.keycode == Common::KEYCODE_RIGHT) // Right - keyState |= 2; + if (event.kbd.keycode == Common::KEYCODE_DOWN) + VAR(VAR_KEY_STATE) |= 8; - if (event.kbd.keycode == Common::KEYCODE_UP) // Up - keyState |= 4; + if (event.kbd.keycode == Common::KEYCODE_LSHIFT || event.kbd.keycode == Common::KEYCODE_RSHIFT) + VAR(VAR_KEY_STATE) |= 16; - if (event.kbd.keycode == Common::KEYCODE_DOWN) // Down - keyState |= 8; + if (event.kbd.keycode == Common::KEYCODE_LCTRL || event.kbd.keycode == Common::KEYCODE_RCTRL) + VAR(VAR_KEY_STATE) |= 32; + break; - if (event.kbd.flags == Common::KBD_SHIFT) - keyState |= 16; + case Common::EVENT_KEYUP: + if (event.kbd.keycode == Common::KEYCODE_LEFT) + VAR(VAR_KEY_STATE) &= ~1; - if (event.kbd.flags == Common::KBD_CTRL) - keyState |= 32; + if (event.kbd.keycode == Common::KEYCODE_RIGHT) + VAR(VAR_KEY_STATE) &= ~2; - VAR(VAR_KEY_STATE) = keyState; - } + if (event.kbd.keycode == Common::KEYCODE_UP) + VAR(VAR_KEY_STATE) &= ~4; - // FIXME: We are using ASCII values to index the _keyDownMap here, - // yet later one code which checks _keyDownMap will use KEYCODEs - // to do so. That is, we are mixing ascii and keycode values here, - // which is bad. We probably should be only using keycodes, but at - // least INSANE checks for "Shift-V" by looking for the 'V' key - // being pressed. It would be easy to solve that by also storing - // the modifier flags. However, since getKeyState() is also called - // by scripts, we have to be careful with semantic changes. - if (_keyPressed.ascii >= 512) - debugC(DEBUG_GENERAL, "_keyPressed > 512 (%d)", _keyPressed.ascii); - else - _keyDownMap[_keyPressed.ascii] = true; - break; + if (event.kbd.keycode == Common::KEYCODE_DOWN) + VAR(VAR_KEY_STATE) &= ~8; - case Common::EVENT_KEYUP: - if (event.kbd.ascii >= 512) { - debugC(DEBUG_GENERAL, "keyPressed > 512 (%d)", event.kbd.ascii); - } else { - _keyDownMap[event.kbd.ascii] = false; - - // Due to some weird bug with capslock key pressed - // generated keydown event is for lower letter but - // keyup is for upper letter - // On most (all?) keyboards it is safe to assume that - // both upper and lower letters are unpressed on keyup event - // - // Fixes bug #1709430: "FT: CAPSLOCK + V enables cheating for all fights" - // - // Fingolfin remarks: This wouldn't be a problem if we used keycodes. - _keyDownMap[toupper(event.kbd.ascii)] = false; - } - break; + if (event.kbd.keycode == Common::KEYCODE_LSHIFT || event.kbd.keycode == Common::KEYCODE_RSHIFT) + VAR(VAR_KEY_STATE) &= ~16; + if (event.kbd.keycode == Common::KEYCODE_LCTRL || event.kbd.keycode == Common::KEYCODE_RCTRL) + VAR(VAR_KEY_STATE) &= ~32; + break; - // We update the mouse position whenever the mouse moves or a click occurs. - // The latter is done to accomodate systems with a touchpad / pen controller. - case Common::EVENT_LBUTTONDOWN: - case Common::EVENT_RBUTTONDOWN: - case Common::EVENT_MOUSEMOVE: - if (event.type == Common::EVENT_LBUTTONDOWN) - _leftBtnPressed |= msClicked|msDown; - else if (event.type == Common::EVENT_RBUTTONDOWN) - _rightBtnPressed |= msClicked|msDown; - _mouse.x = event.mouse.x; - _mouse.y = event.mouse.y; - - if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) { - _mouse.x -= (Common::kHercW - _screenWidth * 2) / 2; - _mouse.x >>= 1; - _mouse.y = _mouse.y * 4 / 7; - } else if (_useCJKMode && _textSurfaceMultiplier == 2) { - _mouse.x >>= 1; - _mouse.y >>= 1; - } - break; - case Common::EVENT_LBUTTONUP: - _leftBtnPressed &= ~msDown; - break; + default: + break; + } +} +#endif - case Common::EVENT_RBUTTONUP: - _rightBtnPressed &= ~msDown; - break; +void ScummEngine::parseEvent(Common::Event event) { + switch (event.type) { + case Common::EVENT_KEYDOWN: + if (event.kbd.keycode >= '0' && event.kbd.keycode <= '9' + && (event.kbd.flags == Common::KBD_ALT || + event.kbd.flags == Common::KBD_CTRL)) { + _saveLoadSlot = event.kbd.keycode - '0'; + + // don't overwrite autosave (slot 0) + if (_saveLoadSlot == 0) + _saveLoadSlot = 10; + + sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot); + _saveLoadFlag = (event.kbd.flags == Common::KBD_ALT) ? 1 : 2; + _saveTemporaryState = false; + } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'f') { + _fastMode ^= 1; + } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'g') { + _fastMode ^= 2; + } else if ((event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'd') || + event.kbd.ascii == '~' || event.kbd.ascii == '#') { + _debugger->attach(); + } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 's') { + _res->resourceStats(); + } else { + // Normal key press, pass on to the game. + _keyPressed = event.kbd; + } - // The following two cases enable dialog choices to be scrolled - // through in the SegaCD version of MI. Values are taken from script-14. - // See bug report #1193185 for details. - case Common::EVENT_WHEELDOWN: - if (_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD) - _keyPressed = Common::KeyState(Common::KEYCODE_7, 55); // '7' - break; + // FIXME: We are using ASCII values to index the _keyDownMap here, + // yet later one code which checks _keyDownMap will use KEYCODEs + // to do so. That is, we are mixing ascii and keycode values here, + // which is bad. We probably should be only using keycodes, but at + // least INSANE checks for "Shift-V" by looking for the 'V' key + // being pressed. It would be easy to solve that by also storing + // the modifier flags. However, since getKeyState() is also called + // by scripts, we have to be careful with semantic changes. + if (_keyPressed.ascii >= 512) + debugC(DEBUG_GENERAL, "_keyPressed > 512 (%d)", _keyPressed.ascii); + else + _keyDownMap[_keyPressed.ascii] = true; + break; + + case Common::EVENT_KEYUP: + if (event.kbd.ascii >= 512) { + debugC(DEBUG_GENERAL, "keyPressed > 512 (%d)", event.kbd.ascii); + } else { + _keyDownMap[event.kbd.ascii] = false; + + // Due to some weird bug with capslock key pressed + // generated keydown event is for lower letter but + // keyup is for upper letter + // On most (all?) keyboards it is safe to assume that + // both upper and lower letters are unpressed on keyup event + // + // Fixes bug #1709430: "FT: CAPSLOCK + V enables cheating for all fights" + // + // Fingolfin remarks: This wouldn't be a problem if we used keycodes. + _keyDownMap[toupper(event.kbd.ascii)] = false; + } + break; + + + // We update the mouse position whenever the mouse moves or a click occurs. + // The latter is done to accomodate systems with a touchpad / pen controller. + case Common::EVENT_LBUTTONDOWN: + case Common::EVENT_RBUTTONDOWN: + case Common::EVENT_MOUSEMOVE: + if (event.type == Common::EVENT_LBUTTONDOWN) + _leftBtnPressed |= msClicked|msDown; + else if (event.type == Common::EVENT_RBUTTONDOWN) + _rightBtnPressed |= msClicked|msDown; + _mouse.x = event.mouse.x; + _mouse.y = event.mouse.y; + + if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) { + _mouse.x -= (Common::kHercW - _screenWidth * 2) / 2; + _mouse.x >>= 1; + _mouse.y = _mouse.y * 4 / 7; + } else if (_useCJKMode && _textSurfaceMultiplier == 2) { + _mouse.x >>= 1; + _mouse.y >>= 1; + } + break; + case Common::EVENT_LBUTTONUP: + _leftBtnPressed &= ~msDown; + break; + + case Common::EVENT_RBUTTONUP: + _rightBtnPressed &= ~msDown; + break; + + // The following two cases enable dialog choices to be scrolled + // through in the SegaCD version of MI. Values are taken from script-14. + // See bug report #1193185 for details. + case Common::EVENT_WHEELDOWN: + if (_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD) + _keyPressed = Common::KeyState(Common::KEYCODE_7, 55); // '7' + break; + + case Common::EVENT_WHEELUP: + if (_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD) + _keyPressed = Common::KeyState(Common::KEYCODE_6, 54); // '6' + break; + + default: + break; + } +} - case Common::EVENT_WHEELUP: - if (_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD) - _keyPressed = Common::KeyState(Common::KEYCODE_6, 54); // '6' - break; +void ScummEngine::parseEvents() { + Common::Event event; - default: - break; - } + while (_eventMan->pollEvent(event)) { + parseEvent(event); } } diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index dcbf95ef4b..143c550180 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -442,7 +442,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) VAR_SCRIPT_CYCLE = 0xFF; VAR_NUM_GLOBAL_OBJS = 0xFF; - VAR_KEY_STATE = 0xFF; // Use g_scumm from error() ONLY g_scumm = this; @@ -784,6 +783,7 @@ ScummEngine_v80he::ScummEngine_v80he(OSystem *syst, const DetectorResult &dr) VAR_PLATFORM = 0xFF; VAR_PLATFORM_VERSION = 0xFF; VAR_CURRENT_CHARSET = 0xFF; + VAR_KEY_STATE = 0xFF; VAR_COLOR_DEPTH = 0xFF; } diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index e3be053810..3d16bea2b1 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -28,6 +28,7 @@ #include "engines/engine.h" #include "common/endian.h" +#include "common/events.h" #include "common/file.h" #include "common/savefile.h" #include "common/keyboard.h" @@ -498,6 +499,8 @@ protected: public: void parseEvents(); // Used by IMuseDigital::startSound protected: + virtual void parseEvent(Common::Event event); + void waitForTimer(int msec_delay); virtual void processInput(); virtual void processKeyboard(Common::KeyState lastKeyHit); @@ -1374,8 +1377,6 @@ public: byte VAR_SCRIPT_CYCLE; // Used in runScript()/runObjectScript() byte VAR_NUM_SCRIPT_CYCLES; // Used in runAllScripts() - byte VAR_KEY_STATE; // Used in parseEvents() - // Exists both in V7 and in V72HE: byte VAR_NUM_GLOBAL_OBJS; }; -- cgit v1.2.3 From 4ea74d7e04012abea7f2dd2c8f729ecdfbd163cf Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 13 Jul 2009 14:46:14 +0000 Subject: Add one more type of IQ-points filename (for bug #2820803) svn-id: r42436 --- engines/scumm/script_v5.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp index 00d01143d6..1ce38fd800 100644 --- a/engines/scumm/script_v5.cpp +++ b/engines/scumm/script_v5.cpp @@ -1750,7 +1750,7 @@ void ScummEngine_v5::o5_roomOps() { while ((chr = fetchScriptByte())) filename += chr; - if (filename.hasPrefix("iq-") || filename.hasPrefix("IQ-") || filename.hasSuffix("-iq")) { + if (filename.hasPrefix("iq-") || filename.hasPrefix("IQ-") || filename.hasSuffix("-iq") || filename.hasSuffix("-IQ")) { filename = _targetName + ".iq"; } else { error("SO_SAVE_STRING: Unsupported filename %s", filename.c_str()); -- cgit v1.2.3 From e5c2275e80fccf1481e1287cd773ad6887607e55 Mon Sep 17 00:00:00 2001 From: Kari Salminen Date: Mon, 13 Jul 2009 16:52:09 +0000 Subject: Fix for bug #2669415 (FW: half walking speed in a screen). svn-id: r42439 --- engines/cine/script_fw.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/engines/cine/script_fw.cpp b/engines/cine/script_fw.cpp index 0c92beb650..a9824674e6 100644 --- a/engines/cine/script_fw.cpp +++ b/engines/cine/script_fw.cpp @@ -1443,6 +1443,38 @@ int FWScript::o1_palRotate() { int FWScript::o1_break() { debugC(5, kCineDebugScript, "Line: %d: break", _line); + // WORKAROUND for bug #2669415 ("FW: half walking speed in a screen"). + // The problem was that in Amiga/Atari ST versions of Future Wars the + // walking speed has halved in a forest scene where a monk's robe hangs + // on a tree branch (Up and to the left from the medieval castle's front). + // + // Initialization script for the scene is PART02.PRC's 26th script (011_INIT) + // and the background used in the scene is L11.PI1. The difference between + // the PC version and the Amiga/Atari ST version of the script is that the + // PC version calls scripts 37 and 36 for handling movement of the character + // when Amiga/Atari ST version calls scripts 22 and 21 for the same purpose + // (Scripts 37 and 22 handle vertical movement, 36 and 21 the horizontal). + // + // The called scripts only differ functionally so that all BREAK opcodes have been + // doubled in the Amiga/Atari ST versions (i.e. one BREAK has become two BREAKs) + // and in script 21 after LABEL_25 there's an extra opcode that isn't in script 36: + // SET globalvars[251], 0. + // + // As a BREAK opcode stops the execution of a script it causes a pause and + // with the BREAKs doubled the pause is twice as long in the Amiga/Atari ST versions. + // Thus the longer pause is eliminated by running only one BREAK when several + // are designated (i.e. ignoring a BREAK if there's another BREAK after it). + // + // TODO: Check whether the speed is halved in any other scenes in Amiga/Atari ST versions under ScummVM + // TODO: Check whether the speed is halved when running the original executable under an emulator + if (g_cine->getGameType() == Cine::GType_FW && + (g_cine->getPlatform() == Common::kPlatformAmiga || g_cine->getPlatform() == Common::kPlatformAtariST) && + _pos < _script._size && _script.getByte(_pos) == (0x4F + 1) && // Is the next opcode a BREAK too? + scumm_stricmp(currentPrcName, "PART02.PRC") == 0 && + scumm_stricmp(renderer->getBgName(), "L11.PI1") == 0) { + return 0; + } + return 1; } -- cgit v1.2.3 From 242b7ef7087bdfa9aa2624a39fc316a619005ad0 Mon Sep 17 00:00:00 2001 From: Kari Salminen Date: Mon, 13 Jul 2009 17:09:40 +0000 Subject: Fix compilation under Windows (The fabs-calls were causing error C2668 about 'ambiguous call to overloaded function'). svn-id: r42440 --- engines/sword1/sound.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp index 3e920c5018..b3fa1aa0fd 100644 --- a/engines/sword1/sound.cpp +++ b/engines/sword1/sound.cpp @@ -127,9 +127,9 @@ void Sound::checkSpeechFileEndianness() { size /= 2; int16 prev_be_value = (int16)SWAP_BYTES_16(*((uint16*)(data))); for (uint32 i = 1 ; i < size ; ++i) { - le_diff_sum += fabs(data[i] - data[i-1]); + le_diff_sum += fabs((double)(data[i] - data[i-1])); int16 be_value = (int16)SWAP_BYTES_16(*((uint16*)(data + i))); - be_diff_sum += fabs(be_value - prev_be_value); + be_diff_sum += fabs((double)(be_value - prev_be_value)); prev_be_value = be_value; } delete [] data; -- cgit v1.2.3 From 6723a1acd204bf06666b1915c29dd7a8e22b7fb7 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 13 Jul 2009 17:28:49 +0000 Subject: Add Drascula engine to the credits svn-id: r42441 --- AUTHORS | 6 +++++- gui/credits.h | 4 ++++ tools/credits.pl | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 37ca46bc92..1c3c03fc2a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -57,7 +57,11 @@ ScummVM Team Cinematique evo 2: Vincent Hamm - original CruisE engine author - Paul Gilbert + Paul Gilbert + + Drascula: + Filippos Karapetis + Pawel Kolodziejski FOTAQ: Gregory Montoir diff --git a/gui/credits.h b/gui/credits.h index 869adec827..c154a08028 100644 --- a/gui/credits.h +++ b/gui/credits.h @@ -63,6 +63,10 @@ static const char *credits[] = { "C2""original CruisE engine author", "C0""Paul Gilbert", "", +"C1""Drascula", +"C0""Filippos Karapetis", +"C0""Pawel Kolodziejski", +"", "C1""FOTAQ", "C0""Gregory Montoir", "C0""Joost Peters", diff --git a/tools/credits.pl b/tools/credits.pl index cfc328f070..ee96017d4b 100755 --- a/tools/credits.pl +++ b/tools/credits.pl @@ -527,6 +527,11 @@ begin_credits("Credits"); add_person("Paul Gilbert", "dreammaster", ""); end_section(); + begin_section("Drascula"); + add_person("Filippos Karapetis", "[md5]", ""); + add_person("Paweł Kołodziejski", "aquadran", ""); + end_section(); + begin_section("FOTAQ"); # Flight of the Amazon Queen add_person("Gregory Montoir", "cyx", ""); add_person("Joost Peters", "joostp", ""); -- cgit v1.2.3 From 43c7f7530a3320311294c7087d652588b137a03e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 13 Jul 2009 17:48:13 +0000 Subject: Got rid of Screen_LoL::_paletteConvTable. svn-id: r42443 --- engines/kyra/screen_lol.cpp | 4 ++-- engines/kyra/screen_lol.h | 1 - engines/kyra/staticres.cpp | 36 ------------------------------------ 3 files changed, 2 insertions(+), 39 deletions(-) diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index 46b243a4cf..ce8a1bdaa4 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -912,7 +912,7 @@ void Screen_LoL::mergeOverlay(int x, int y, int w, int h) { void Screen_LoL::convertPC98Gfx(uint8 *data, int w, int h, int pitch) { while (h--) { for (int i = 0; i < w; ++i) { - *data = _paletteConvTable[*data]; + *data = (*data >> 4) & (*data & 0x0F); ++data; } @@ -927,7 +927,7 @@ void Screen_LoL::postProcessCursor(uint8 *data, int w, int h, int pitch) { while (h--) { for (int i = 0; i < w; ++i) { if (*data != _cursorColorKey) - *data = _paletteConvTable[*data]; + *data = (*data >> 4) & (*data & 0x0F); ++data; } diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h index f9cd7133de..4980a89694 100644 --- a/engines/kyra/screen_lol.h +++ b/engines/kyra/screen_lol.h @@ -109,7 +109,6 @@ private: uint8 *_levelOverlays[8]; - static const uint8 _paletteConvTable[256]; void mergeOverlay(int x, int y, int w, int h); void postProcessCursor(uint8 *data, int width, int height, int pitch); }; diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index e8597c8326..86680a7b76 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -3159,42 +3159,6 @@ const ScreenDim Screen_LoL::_screenDimTable16C[] = { const int Screen_LoL::_screenDimTableCount = ARRAYSIZE(Screen_LoL::_screenDimTable256C); -// 256 -> 16 color conversion table -const uint8 Screen_LoL::_paletteConvTable[256] = { - 0x0, 0x1, 0x0, 0x3, 0x0, 0x5, 0x0, 0x7, - 0x0, 0x9, 0x0, 0xB, 0x0, 0xD, 0x0, 0xF, - 0x1, 0x1, 0x1, 0x3, 0x1, 0x5, 0x1, 0x7, - 0x1, 0x9, 0x1, 0xB, 0x1, 0xD, 0x1, 0xF, - 0x2, 0x1, 0x2, 0x3, 0x2, 0x5, 0x2, 0x7, - 0x2, 0x9, 0x2, 0xB, 0x2, 0xD, 0x2, 0xF, - 0x3, 0x1, 0x3, 0x3, 0x3, 0x5, 0x3, 0x7, - 0x3, 0x9, 0x3, 0xB, 0x3, 0xD, 0x3, 0xF, - 0x4, 0x1, 0x4, 0x3, 0x4, 0x5, 0x4, 0x7, - 0x4, 0x9, 0x4, 0xB, 0x4, 0xD, 0x4, 0xF, - 0x5, 0x1, 0x5, 0x3, 0x5, 0x5, 0x5, 0x7, - 0x5, 0x9, 0x5, 0xB, 0x5, 0xD, 0x5, 0xF, - 0x6, 0x1, 0x6, 0x3, 0x6, 0x5, 0x6, 0x7, - 0x6, 0x9, 0x6, 0xB, 0x6, 0xD, 0x6, 0xF, - 0x7, 0x1, 0x7, 0x3, 0x7, 0x5, 0x7, 0x7, - 0x7, 0x9, 0x7, 0xB, 0x7, 0xD, 0x7, 0xF, - 0x8, 0x1, 0x8, 0x3, 0x8, 0x5, 0x8, 0x7, - 0x8, 0x9, 0x8, 0xB, 0x8, 0xD, 0x8, 0xF, - 0x9, 0x1, 0x9, 0x3, 0x9, 0x5, 0x9, 0x7, - 0x9, 0x9, 0x9, 0xB, 0x9, 0xD, 0x9, 0xF, - 0xA, 0x1, 0xA, 0x3, 0xA, 0x5, 0xA, 0x7, - 0xA, 0x9, 0xA, 0xB, 0xA, 0xD, 0xA, 0xF, - 0xB, 0x1, 0xB, 0x3, 0xB, 0x5, 0xB, 0x7, - 0xB, 0x9, 0xB, 0xB, 0xB, 0xD, 0xB, 0xF, - 0xC, 0x1, 0xC, 0x3, 0xC, 0x5, 0xC, 0x7, - 0xC, 0x9, 0xC, 0xB, 0xC, 0xD, 0xC, 0xF, - 0xD, 0x1, 0xD, 0x3, 0xD, 0x5, 0xD, 0x7, - 0xD, 0x9, 0xD, 0xB, 0xD, 0xD, 0xD, 0xF, - 0xE, 0x1, 0xE, 0x3, 0xE, 0x5, 0xE, 0x7, - 0xE, 0x9, 0xE, 0xB, 0xE, 0xD, 0xE, 0xF, - 0xF, 0x1, 0xF, 0x3, 0xF, 0x5, 0xF, 0x7, - 0xF, 0x9, 0xF, 0xB, 0xF, 0xD, 0xF, 0xF -}; - const char * const LoLEngine::_languageExt[] = { "ENG", "FRE", -- cgit v1.2.3 From 1871a2e68d377b45a3b065875faa2dd899e2d301 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 13 Jul 2009 18:31:42 +0000 Subject: Support transparent guioptions update on game launch for AdvancedMetaEngine. svn-id: r42444 --- engines/advancedDetector.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index c127faec28..d1395fbe04 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -291,15 +291,24 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) } } - if (agdDesc == 0) { + if (agdDesc == 0) return Common::kNoGameDataFoundError; + + // If the GUI options were updated, we catch this here and update them in the users config + // file transparently. + const uint32 guiOptions = agdDesc->guioptions | params.guioptions; + + if ((guiOptions && !ConfMan.hasKey("guioptions")) || + (ConfMan.hasKey("guioptions") && parseGameGUIOptions(ConfMan.get("guioptions")) != guiOptions)) { + ConfMan.set("guioptions", Common::getGameGUIOptionsDescription(guiOptions)); + ConfMan.flushToDisk(); } debug(2, "Running %s", toGameDescriptor(*agdDesc, params.list).description().c_str()); - if (!createInstance(syst, engine, agdDesc)) { + if (!createInstance(syst, engine, agdDesc)) return Common::kNoGameDataFoundError; - } - return Common::kNoError; + else + return Common::kNoError; } struct SizeMD5 { -- cgit v1.2.3 From 88e0fc2c43a9f8b1c729bf2f509815601b4d495d Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 13 Jul 2009 18:32:03 +0000 Subject: Add transparent GUI options update for SCUMM too. svn-id: r42445 --- engines/scumm/detection.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index cf88ded3b8..e1de825049 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -882,6 +882,16 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co if (res.game.platform == Common::kPlatformFMTowns && res.game.version == 3) res.game.midi = MDT_TOWNS; + // If the GUI options were updated, we catch this here and update them in the users config + // file transparently. + const uint32 guiOptions = res.game.guioptions; + + if ((guiOptions && !ConfMan.hasKey("guioptions")) || + (ConfMan.hasKey("guioptions") && parseGameGUIOptions(ConfMan.get("guioptions")) != guiOptions)) { + ConfMan.set("guioptions", Common::getGameGUIOptionsDescription(guiOptions)); + ConfMan.flushToDisk(); + } + // Finally, we have massaged the GameDescriptor to our satisfaction, and can // instantiate the appropriate game engine. Hooray! switch (res.game.version) { -- cgit v1.2.3 From 51a9bfc9e2881aa7c7ddaa9cc6b2709acab5e725 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 13 Jul 2009 18:47:32 +0000 Subject: Refactor GUI options update into a function in Common: updateGameGUIOptions. svn-id: r42446 --- common/util.cpp | 9 +++++++++ common/util.h | 7 +++++++ engines/advancedDetector.cpp | 8 +------- engines/scumm/detection.cpp | 8 +------- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/common/util.cpp b/common/util.cpp index e99bbeb12d..869cec4c48 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -24,6 +24,7 @@ #include "common/util.h" #include "common/system.h" +#include "common/config-manager.h" #include "gui/debugger.h" #include "engines/engine.h" @@ -420,6 +421,14 @@ String getGameGUIOptionsDescription(uint32 options) { return res; } +void updateGameGUIOptions(const uint32 options) { + if ((options && !ConfMan.hasKey("guioptions")) || + (ConfMan.hasKey("guioptions") && options != parseGameGUIOptions(ConfMan.get("guioptions")))) { + ConfMan.set("guioptions", getGameGUIOptionsDescription(options)); + ConfMan.flushToDisk(); + } +} + } // End of namespace Common diff --git a/common/util.h b/common/util.h index e50dcebff0..aeadcd1483 100644 --- a/common/util.h +++ b/common/util.h @@ -284,6 +284,13 @@ bool checkGameGUIOption(GameGUIOption option, const String &str); uint32 parseGameGUIOptions(const String &str); String getGameGUIOptionsDescription(uint32 options); +/** + * Updates the GUI options of the current config manager + * domain, when they differ to the ones passed as + * parameter. + */ +void updateGameGUIOptions(const uint32 options); + } // End of namespace Common diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index d1395fbe04..7d86f3ef32 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -296,13 +296,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) // If the GUI options were updated, we catch this here and update them in the users config // file transparently. - const uint32 guiOptions = agdDesc->guioptions | params.guioptions; - - if ((guiOptions && !ConfMan.hasKey("guioptions")) || - (ConfMan.hasKey("guioptions") && parseGameGUIOptions(ConfMan.get("guioptions")) != guiOptions)) { - ConfMan.set("guioptions", Common::getGameGUIOptionsDescription(guiOptions)); - ConfMan.flushToDisk(); - } + Common::updateGameGUIOptions(agdDesc->guioptions | params.guioptions); debug(2, "Running %s", toGameDescriptor(*agdDesc, params.list).description().c_str()); if (!createInstance(syst, engine, agdDesc)) diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index e1de825049..5fa74d22c3 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -884,13 +884,7 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co // If the GUI options were updated, we catch this here and update them in the users config // file transparently. - const uint32 guiOptions = res.game.guioptions; - - if ((guiOptions && !ConfMan.hasKey("guioptions")) || - (ConfMan.hasKey("guioptions") && parseGameGUIOptions(ConfMan.get("guioptions")) != guiOptions)) { - ConfMan.set("guioptions", Common::getGameGUIOptionsDescription(guiOptions)); - ConfMan.flushToDisk(); - } + Common::updateGameGUIOptions(res.game.guioptions); // Finally, we have massaged the GameDescriptor to our satisfaction, and can // instantiate the appropriate game engine. Hooray! -- cgit v1.2.3 From 3ed4f388d7c3a8f162be2463cc12c4c52db88214 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 13 Jul 2009 22:08:56 +0000 Subject: Unify PS2 and non-PS2 alloc code in Common::Array code (if this causes regressions somewhere, we better find a fix that also works on PS2) svn-id: r42455 --- common/array.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/common/array.h b/common/array.h index ac8a4b20d7..0b5a65e9bd 100644 --- a/common/array.h +++ b/common/array.h @@ -222,13 +222,7 @@ public: T *old_storage = _storage; _capacity = newCapacity; - // PS2 gcc 3.2.2 can't do "new T[newCapacity]()" but only - // "new T[newCapacity]" -> quick fix until we update tools. - #ifndef __PLAYSTATION2__ - _storage = new T[newCapacity](); - #else _storage = new T[newCapacity]; - #endif assert(_storage); if (old_storage) { @@ -279,13 +273,7 @@ protected: // If there is not enough space, allocate more and // copy old elements over. uint newCapacity = roundUpCapacity(_size + n); - // PS2 gcc 3.2.2 can't do "new T[newCapacity]()" but only - // "new T[newCapacity]" -> quick fix until we update tools. - #ifndef __PLAYSTATION2__ - newStorage = new T[newCapacity](); - #else newStorage = new T[newCapacity]; - #endif assert(newStorage); copy(_storage, _storage + idx, newStorage); pos = newStorage + idx; -- cgit v1.2.3 From b98fdb997da257732fcbf1098f10cc3faede73d4 Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Mon, 13 Jul 2009 22:11:54 +0000 Subject: tucker: fixed issues with dirty rects handling (tracker item #2597763) svn-id: r42456 --- engines/tucker/locations.cpp | 32 ++++++------ engines/tucker/resource.cpp | 2 +- engines/tucker/sequences.cpp | 17 ++++--- engines/tucker/tucker.cpp | 113 +++++++++++++++++++++++++------------------ engines/tucker/tucker.h | 4 +- 5 files changed, 93 insertions(+), 75 deletions(-) diff --git a/engines/tucker/locations.cpp b/engines/tucker/locations.cpp index 9faa2024a6..4117391cdf 100644 --- a/engines/tucker/locations.cpp +++ b/engines/tucker/locations.cpp @@ -195,8 +195,8 @@ void TuckerEngine::execData3PreUpdate_locationNum2() { for (int j = 0; j < 2; ++j) { const int offset = (_updateLocationYPosTable2[i] + j) * 640 + _updateLocationXPosTable2[i]; _locationBackgroundGfxBuf[offset] = 142 + j * 2; - addDirtyRect(offset % 640, offset / 640, 1, 1); } + addDirtyRect(_updateLocationXPosTable2[i], _updateLocationYPosTable2[i], 1, 2); _updateLocationYPosTable2[i] += 2; if (_updateLocationYPosTable2[i] > _updateLocationYMaxTable[i]) { _updateLocationYPosTable2[i] = 0; @@ -540,13 +540,14 @@ void TuckerEngine::execData3PreUpdate_locationNum6Helper1() { x2 = 15 - _flagsTable[27]; } for (int i = 0; i < x1; ++i) { - execData3PreUpdate_locationNum6Helper2(13125 + i * 8, _data3GfxBuf + _dataTable[238].sourceOffset); - execData3PreUpdate_locationNum6Helper2(13245 - i * 8, _data3GfxBuf + _dataTable[238].sourceOffset); + execData3PreUpdate_locationNum6Helper2(20 * 640 + 325 + i * 8, _data3GfxBuf + _dataTable[238].sourceOffset); + execData3PreUpdate_locationNum6Helper2(20 * 640 + 445 - i * 8, _data3GfxBuf + _dataTable[238].sourceOffset); } for (int i = 0; i < x2; ++i) { - execData3PreUpdate_locationNum6Helper3(13125 + x1 * 8 + i * 4, _data3GfxBuf + _dataTable[238].sourceOffset); - execData3PreUpdate_locationNum6Helper3(13249 - x1 * 8 - i * 4, _data3GfxBuf + _dataTable[238].sourceOffset); + execData3PreUpdate_locationNum6Helper3(20 * 640 + 325 + x1 * 8 + i * 4, _data3GfxBuf + _dataTable[238].sourceOffset); + execData3PreUpdate_locationNum6Helper3(20 * 640 + 449 - x1 * 8 - i * 4, _data3GfxBuf + _dataTable[238].sourceOffset); } + addDirtyRect(0, 20, 640, 51); } void TuckerEngine::execData3PreUpdate_locationNum6Helper2(int dstOffset, const uint8 *src) { @@ -562,7 +563,6 @@ void TuckerEngine::execData3PreUpdate_locationNum6Helper2(int dstOffset, const u } } } - addDirtyRect(dstOffset % 640, dstOffset / 640, 8, 51); } void TuckerEngine::execData3PreUpdate_locationNum6Helper3(int dstOffset, const uint8 *src) { @@ -575,7 +575,6 @@ void TuckerEngine::execData3PreUpdate_locationNum6Helper3(int dstOffset, const u } } } - addDirtyRect(dstOffset % 640, dstOffset / 640, 4, 51); } void TuckerEngine::execData3PostUpdate_locationNum6() { @@ -661,7 +660,7 @@ void TuckerEngine::execData3PostUpdate_locationNum8() { _locationBackgroundGfxBuf[offset + 640 * j + i] = colorsTable[(j - 1) * 3 + i + 1]; } } - addDirtyRect(_updateLocationXPosTable2[0] - 1, _updateLocationYPosTable2[0], 3, 4); + addDirtyRect(_updateLocationXPosTable2[0] - 1, _updateLocationYPosTable2[0] + 1, 3, 4); _updateLocationYPosTable2[0] += 2; if (_updateLocationYPosTable2[0] > 120) { _updateLocationYPosTable2[0] = 0; @@ -1013,9 +1012,10 @@ void TuckerEngine::execData3PreUpdate_locationNum14() { if (num > 0) { const int w = _dataTable[num].xSize; const int h = _dataTable[num].ySize; - const int dstOffset = (_updateLocationYPosTable2[i] / 16 - h / 2) * 640 + (_updateLocationXPosTable2[i] - w / 2); - Graphics::decodeRLE_248(_locationBackgroundGfxBuf + dstOffset, _data3GfxBuf + _dataTable[num].sourceOffset, w, h, 0, 0, false); - addDirtyRect(dstOffset % 640, dstOffset / 640, w, h); + const int x = _updateLocationXPosTable2[i] - w / 2; + const int y = _updateLocationYPosTable2[i] / 16 - h / 2; + Graphics::decodeRLE_248(_locationBackgroundGfxBuf + y * 640 + x, _data3GfxBuf + _dataTable[num].sourceOffset, w, h, 0, 0, false); + addDirtyRect(x, y, w, h); } } } @@ -3033,17 +3033,17 @@ void TuckerEngine::execData3PreUpdate_locationNum70() { _panelState = 1; setCursorType(2); int pos = getPositionForLine(22, _infoBarBuf); - int offset = (_flagsTable[143] == 0) ? 57688 : 46168; + int offset = (_flagsTable[143] == 0) ? 90 * 640 + 88 : 72 * 640 + 88; drawStringAlt(offset, color, &_infoBarBuf[pos]); - Graphics::drawStringChar(_locationBackgroundGfxBuf + offset + 5760, 62, 640, color, _charsetGfxBuf); + Graphics::drawStringChar(_locationBackgroundGfxBuf + offset + 9 * 640, 62, 640, color, _charsetGfxBuf); if (_flagsTable[143] != 0) { pos = getPositionForLine(_flagsTable[143] * 2 + 23, _infoBarBuf); - drawStringAlt(offset + 11520, color, &_infoBarBuf[pos]); + drawStringAlt(offset + 18 * 640, color, &_infoBarBuf[pos]); pos = getPositionForLine(_flagsTable[143] * 2 + 24, _infoBarBuf); - drawStringAlt(offset + 17280, color, &_infoBarBuf[pos]); + drawStringAlt(offset + 27 * 640, color, &_infoBarBuf[pos]); } execData3PreUpdate_locationNum70Helper(); - drawStringAlt(offset + 5768, color, _updateLocation70String, _updateLocation70StringLen); + drawStringAlt(offset + 9 * 640 + 8, color, _updateLocation70String, _updateLocation70StringLen); } void TuckerEngine::execData3PreUpdate_locationNum70Helper() { diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp index 11c1c78133..9b8304e9fd 100644 --- a/engines/tucker/resource.cpp +++ b/engines/tucker/resource.cpp @@ -467,7 +467,7 @@ void TuckerEngine::loadLoc() { copyLocBitmap(filename, 0, false); Graphics::copyRect(_quadBackgroundGfxBuf + 134400, 320, _locationBackgroundGfxBuf + 320, 640, 320, 140); } - _fullRedrawCounter = 2; + _fullRedraw = true; } void TuckerEngine::loadObj() { diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp index 11a535e54a..8041b95414 100644 --- a/engines/tucker/sequences.cpp +++ b/engines/tucker/sequences.cpp @@ -102,7 +102,7 @@ void TuckerEngine::handleCreditsSequence() { counter2 = 0; } } - _fullRedrawCounter = 2; + _fullRedraw = true; ++counter3; if (counter3 == 2) { counter3 = 0; @@ -172,7 +172,7 @@ void TuckerEngine::handleCongratulationsSequence() { stopSounds(); loadImage("congrat.pcx", _loadTempBuf, 1); Graphics::copyRect(_locationBackgroundGfxBuf, 640, _loadTempBuf, 320, 320, 200); - _fullRedrawCounter = 2; + _fullRedraw = true; redrawScreen(0); while (!_quitGame && _timerCounter2 < 450) { while (_fadePaletteCounter < 14) { @@ -242,7 +242,7 @@ void TuckerEngine::handleNewPartSequence() { ++_fadePaletteCounter; } Graphics::copyRect(_locationBackgroundGfxBuf, 640, _quadBackgroundGfxBuf, 320, 320, 200); - _fullRedrawCounter = 2; + _fullRedraw = true; updateSprites(); drawSprite(0); redrawScreen(0); @@ -259,7 +259,7 @@ void TuckerEngine::handleNewPartSequence() { --_fadePaletteCounter; } Graphics::copyRect(_locationBackgroundGfxBuf, 640, _quadBackgroundGfxBuf, 320, 320, 200); - _fullRedrawCounter = 2; + _fullRedraw = true; updateSprites(); drawSprite(0); redrawScreen(0); @@ -294,7 +294,7 @@ void TuckerEngine::handleMeanwhileSequence() { ++_fadePaletteCounter; } Graphics::copyRect(_locationBackgroundGfxBuf, 640, _quadBackgroundGfxBuf + 89600, 320, 320, 200); - _fullRedrawCounter = 2; + _fullRedraw = true; redrawScreen(0); waitForTimer(3); ++i; @@ -305,11 +305,12 @@ void TuckerEngine::handleMeanwhileSequence() { --_fadePaletteCounter; } Graphics::copyRect(_locationBackgroundGfxBuf, 640, _quadBackgroundGfxBuf + 89600, 320, 320, 200); - _fullRedrawCounter = 2; + _fullRedraw = true; redrawScreen(0); waitForTimer(3); } while (_fadePaletteCounter > 0); memcpy(_currentPalette, backupPalette, 256 * 3); + _fullRedraw = true; } void TuckerEngine::handleMapSequence() { @@ -337,7 +338,7 @@ void TuckerEngine::handleMapSequence() { waitForTimer(2); updateMouseState(); Graphics::copyRect(_locationBackgroundGfxBuf + _scrollOffset, 640, _quadBackgroundGfxBuf + 89600, 320, 320, 200); - _fullRedrawCounter = 2; + _fullRedraw = true; if (_flagsTable[7] > 0 && _mousePosX > 30 && _mousePosX < 86 && _mousePosY > 36 && _mousePosY < 86) { textNum = 13; _nextLocationNum = (_partNum == 1) ? 3 : 65; @@ -459,7 +460,7 @@ int TuckerEngine::handleSpecialObjectSelectionSequence() { waitForTimer(2); updateMouseState(); Graphics::copyRect(_locationBackgroundGfxBuf + _scrollOffset, 640, _quadBackgroundGfxBuf, 320, 320, 200); - _fullRedrawCounter = 2; + _fullRedraw = true; if (_fadePaletteCounter < 14) { fadeOutPalette(); ++_fadePaletteCounter; diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index 692335d5ef..90c758c0bf 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -305,7 +305,7 @@ void TuckerEngine::restart() { _currentGfxBackground = 0; _fadePaletteCounter = 0; memset(_currentPalette, 0, sizeof(_currentPalette)); - _fullRedrawCounter = 0; + _fullRedraw = false; _dirtyRectsPrevCount = _dirtyRectsCount = 0; _updateLocationFadePaletteCounter = 0; @@ -469,7 +469,7 @@ void TuckerEngine::mainLoop() { _mainSpritesBaseOffset = 1; } } - _fullRedrawCounter = 2; + _fullRedraw = true; } else { _currentGfxBackground = _quadBackgroundGfxBuf; } @@ -1460,7 +1460,7 @@ void TuckerEngine::updateScreenScrolling() { } } if (scrollPrevOffset != _scrollOffset) { - _fullRedrawCounter = 2; + _fullRedraw = true; } } @@ -1733,34 +1733,36 @@ void TuckerEngine::drawBackgroundSprites() { } else if (_xPosCurrent > 320 && _xPosCurrent < 640) { srcX += 320; } - int offset = _backgroundSprOffset + srcY * 640 + srcX; - Graphics::decodeRLE_248(_locationBackgroundGfxBuf + offset, _backgroundSpriteDataPtr + frameOffset + 12, srcW, srcH, 0, _locationHeightTable[_locationNum], false); - addDirtyRect(offset % 640, offset / 640, srcW, srcH); + srcX += _backgroundSprOffset; + Graphics::decodeRLE_248(_locationBackgroundGfxBuf + srcY * 640 + srcX, _backgroundSpriteDataPtr + frameOffset + 12, srcW, srcH, 0, _locationHeightTable[_locationNum], false); + addDirtyRect(srcX, srcY, srcW, srcH); } } void TuckerEngine::drawCurrentSprite() { SpriteFrame *chr = &_spriteFramesTable[_currentSpriteAnimationFrame]; - int offset = (_yPosCurrent + _mainSpritesBaseOffset - 54 + chr->yOffset) * 640 + _xPosCurrent; + int yPos = _yPosCurrent + _mainSpritesBaseOffset - 54 + chr->yOffset; + int xPos = _xPosCurrent; if (_mirroredDrawing == 0) { - offset += chr->xOffset - 14; + xPos += chr->xOffset - 14; } else { - offset -= chr->xSize + chr->xOffset - 14; + xPos -= chr->xSize + chr->xOffset - 14; } - Graphics::decodeRLE_248(_locationBackgroundGfxBuf + offset, _spritesGfxBuf + chr->sourceOffset, chr->xSize, chr->ySize, + Graphics::decodeRLE_248(_locationBackgroundGfxBuf + yPos * 640 + xPos, _spritesGfxBuf + chr->sourceOffset, chr->xSize, chr->ySize, chr->yOffset, _locationHeightTable[_locationNum], _mirroredDrawing != 0); - addDirtyRect(offset % 640, offset / 640, chr->xSize, chr->ySize); + addDirtyRect(xPos, yPos, chr->xSize, chr->ySize); if (_currentSpriteAnimationLength > 1) { SpriteFrame *chr2 = &_spriteFramesTable[_currentSpriteAnimationFrame2]; - offset = (_yPosCurrent + _mainSpritesBaseOffset - 54 + chr2->yOffset) * 640 + _xPosCurrent; + yPos = _yPosCurrent + _mainSpritesBaseOffset - 54 + chr2->yOffset; + xPos = _xPosCurrent; if (_mirroredDrawing == 0) { - offset += chr2->xOffset - 14; + xPos += chr2->xOffset - 14; } else { - offset -= chr2->xSize + chr2->xOffset - 14; + xPos -= chr2->xSize + chr2->xOffset - 14; } - Graphics::decodeRLE_248(_locationBackgroundGfxBuf + offset, _spritesGfxBuf + chr2->sourceOffset, chr2->xSize, chr2->ySize, + Graphics::decodeRLE_248(_locationBackgroundGfxBuf + yPos * 640 + xPos, _spritesGfxBuf + chr2->sourceOffset, chr2->xSize, chr2->ySize, chr2->yOffset, _locationHeightTable[_locationNum], _mirroredDrawing != 0); - addDirtyRect(offset % 640, offset / 640, chr2->xSize, chr2->ySize); + addDirtyRect(xPos, yPos, chr2->xSize, chr2->ySize); } } @@ -1891,13 +1893,13 @@ void TuckerEngine::drawSprite(int num) { int srcH = READ_LE_UINT16(p + frameOffset + 2); int srcX = READ_LE_UINT16(p + frameOffset + 8); int srcY = READ_LE_UINT16(p + frameOffset + 10); - int dstOffset = s->gfxBackgroundOffset + srcX; - if (dstOffset < 600 && (_scrollOffset + 320 < dstOffset || _scrollOffset - srcW > dstOffset)) { + int xPos = s->gfxBackgroundOffset + srcX; + if (xPos < 600 && (_scrollOffset + 320 < xPos || _scrollOffset - srcW > xPos)) { return; } s->xSource = srcX; s->gfxBackgroundOffset += s->backgroundOffset; - uint8 *dstPtr = _locationBackgroundGfxBuf + srcY * 640 + dstOffset; + uint8 *dstPtr = _locationBackgroundGfxBuf + srcY * 640 + xPos; const uint8 *srcPtr = p + frameOffset + 12; switch (s->colorType) { case 0: @@ -1910,7 +1912,7 @@ void TuckerEngine::drawSprite(int num) { Graphics::decodeRLE_248(dstPtr, srcPtr, srcW, srcH, 0, s->yMaxBackground, s->flipX != 0); break; } - addDirtyRect(dstOffset % 640, dstOffset / 640 + srcY, srcW, srcH); + addDirtyRect(xPos, srcY, srcW, srcH); } } @@ -2826,7 +2828,7 @@ void TuckerEngine::drawStringInteger(int num, int x, int y, int digits) { Graphics::drawStringChar(_locationBackgroundGfxBuf + offset, numStr[i], 640, 102, _charsetGfxBuf); offset += 8; } - addDirtyRect(x, y, Graphics::_charset.charW * 3, Graphics::_charset.charH); + addDirtyRect(_scrollOffset + x, y, Graphics::_charset.charW * 3, Graphics::_charset.charH); } void TuckerEngine::drawStringAlt(int offset, int color, const uint8 *str, int strLen) { @@ -3740,20 +3742,20 @@ void TuckerEngine::drawSpeechText(int xStart, int y, const uint8 *dataPtr, int n y = count * 10; } for (int i = 0; i < count; ++i) { - int dstOffset = xStart - lines[i].w / 2; - if (dstOffset < _scrollOffset) { - dstOffset = _scrollOffset; - } else if (dstOffset > _scrollOffset + 320 - lines[i].w) { - dstOffset = _scrollOffset + 320 - lines[i].w; + int yPos, xPos = xStart - lines[i].w / 2; + if (xPos < _scrollOffset) { + xPos = _scrollOffset; + } else if (xPos > _scrollOffset + 320 - lines[i].w) { + xPos = _scrollOffset + 320 - lines[i].w; } if (_conversationOptionsCount != 0) { - dstOffset = xStart + _scrollOffset; - dstOffset += (i * 10 + y) * 640; + xPos = xStart + _scrollOffset; + yPos = i * 10 + y; _panelItemWidth = count; } else { - dstOffset += (y - (count - i) * 10) * 640; + yPos = y - (count - i) * 10; } - drawSpeechTextLine(dataPtr, lines[i].offset, lines[i].count, dstOffset, color); + drawSpeechTextLine(dataPtr, lines[i].offset, lines[i].count, xPos, yPos, color); } } @@ -3780,23 +3782,24 @@ int TuckerEngine::splitSpeechTextLines(const uint8 *dataPtr, int pos, int x, int return ret; } -void TuckerEngine::drawSpeechTextLine(const uint8 *dataPtr, int pos, int count, int dstOffset, uint8 color) { - int startOffset = dstOffset; +void TuckerEngine::drawSpeechTextLine(const uint8 *dataPtr, int pos, int count, int x, int y, uint8 color) { + int xStart = x; int i = 0; for (; i < count && dataPtr[pos] != '\n'; ++i) { - Graphics::drawStringChar(_locationBackgroundGfxBuf + dstOffset, dataPtr[pos], 640, color, _charsetGfxBuf); - dstOffset += _charWidthTable[dataPtr[pos]]; + Graphics::drawStringChar(_locationBackgroundGfxBuf + y * 640 + x, dataPtr[pos], 640, color, _charsetGfxBuf); + x += _charWidthTable[dataPtr[pos]]; ++pos; } - addDirtyRect(startOffset % 640, startOffset / 640, Graphics::_charset.charW * i, Graphics::_charset.charH); + addDirtyRect(xStart, y, Graphics::_charset.charW * i, Graphics::_charset.charH); } void TuckerEngine::redrawScreen(int offset) { - debug(9, "redrawScreen() _fullRedrawCounter %d offset %d _dirtyRectsCount %d", _fullRedrawCounter, offset, _dirtyRectsCount); + debug(9, "redrawScreen() _fullRedraw %d offset %d _dirtyRectsCount %d", _fullRedraw, offset, _dirtyRectsCount); assert(offset <= kScreenWidth); - if (_fullRedrawCounter > 0) { - --_fullRedrawCounter; + if (_fullRedraw) { + _fullRedraw = false; _system->copyRectToScreen(_locationBackgroundGfxBuf + offset, kScreenPitch, 0, 0, kScreenWidth, kScreenHeight); + _dirtyRectsPrevCount = _dirtyRectsCount = 0; } else { const int xClip = offset % kScreenPitch; const int yClip = offset / kScreenPitch; @@ -3806,13 +3809,11 @@ void TuckerEngine::redrawScreen(int offset) { } for (int i = 0; i < _dirtyRectsCount; ++i) { redrawScreenRect(clipRect, _dirtyRectsTable[0][i]); - } - _dirtyRectsPrevCount = _dirtyRectsCount; - for (int i = 0; i < _dirtyRectsCount; ++i) { _dirtyRectsTable[1][i] = _dirtyRectsTable[0][i]; } + _dirtyRectsPrevCount = _dirtyRectsCount; + _dirtyRectsCount = 0; } - _dirtyRectsCount = 0; _system->updateScreen(); } @@ -3827,17 +3828,33 @@ void TuckerEngine::redrawScreenRect(const Common::Rect &clip, const Common::Rect if (w <= 0 || h <= 0) { return; } +#if 0 + static const uint8 outlineColor = 0; + memset(_locationBackgroundGfxBuf + r.top * 640 + r.left, outlineColor, w); + memset(_locationBackgroundGfxBuf + (r.top + h - 1) * 640 + r.left, outlineColor, w); + for (int y = r.top; y < r.top + h; ++y) { + _locationBackgroundGfxBuf[y * 640 + r.left] = outlineColor; + _locationBackgroundGfxBuf[y * 640 + r.left + w - 1] = outlineColor; + } +#endif _system->copyRectToScreen(src, 640, r.left, r.top, w, h); } } void TuckerEngine::addDirtyRect(int x, int y, int w, int h) { - if (_dirtyRectsCount >= kMaxDirtyRects) { - _fullRedrawCounter = 2; - _dirtyRectsCount = 0; - } else { - _dirtyRectsTable[0][_dirtyRectsCount] = Common::Rect(x, y, x + w, y + h); - ++_dirtyRectsCount; + if (!_fullRedraw) { + Common::Rect r(x, y, x + w, y + h); + for (int i = 0; i < _dirtyRectsCount; ++i) { + if (_dirtyRectsTable[0][i].contains(r)) { + return; + } + } + if (_dirtyRectsCount < kMaxDirtyRects) { + _dirtyRectsTable[0][_dirtyRectsCount] = r; + ++_dirtyRectsCount; + } else { + _fullRedraw = true; + } } } diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h index 6afccdc4da..21d2e2d49c 100644 --- a/engines/tucker/tucker.h +++ b/engines/tucker/tucker.h @@ -342,7 +342,7 @@ protected: void playSpeechForAction(int i); void drawSpeechText(int xStart, int y, const uint8 *dataPtr, int num, int color); int splitSpeechTextLines(const uint8 *dataPtr, int pos, int x, int &lineCharsCount, int &lineWidth); - void drawSpeechTextLine(const uint8 *dataPtr, int pos, int count, int dstOffset, uint8 color); + void drawSpeechTextLine(const uint8 *dataPtr, int pos, int count, int x, int y, uint8 color); void redrawScreen(int offset); void redrawScreenRect(const Common::Rect &clip, const Common::Rect &dirty); void addDirtyRect(int x, int y, int w, int h); @@ -801,7 +801,7 @@ protected: uint8 *_currentGfxBackground; int _fadePaletteCounter; uint8 _currentPalette[768]; - int _fullRedrawCounter; + bool _fullRedraw; int _dirtyRectsPrevCount, _dirtyRectsCount; Common::Rect _dirtyRectsTable[2][kMaxDirtyRects]; -- cgit v1.2.3 From 230bd03913296fdf50f95af38fcaf76543408748 Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Mon, 13 Jul 2009 22:19:10 +0000 Subject: tucker: added workaround for original game glitch (tracker item #2597763) svn-id: r42458 --- engines/tucker/tucker.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index 90c758c0bf..09e9a0d38a 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -1740,6 +1740,10 @@ void TuckerEngine::drawBackgroundSprites() { } void TuckerEngine::drawCurrentSprite() { + // Workaround original game glitch: skip first bud frame drawing when entering location (tracker item #2597763) + if ((_locationNum == 17 || _locationNum == 18) && _currentSpriteAnimationFrame == 16) { + return; + } SpriteFrame *chr = &_spriteFramesTable[_currentSpriteAnimationFrame]; int yPos = _yPosCurrent + _mainSpritesBaseOffset - 54 + chr->yOffset; int xPos = _xPosCurrent; -- cgit v1.2.3 From 581be82b8366bca93fc3ea1c70b7aec921ad56a2 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 13 Jul 2009 22:19:33 +0000 Subject: Completed name of the creator of our logo svn-id: r42459 --- AUTHORS | 2 +- gui/credits.h | 2 +- tools/credits.pl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index 1c3c03fc2a..afa8877bbc 100644 --- a/AUTHORS +++ b/AUTHORS @@ -328,7 +328,7 @@ Other contributions Dobo Balazs - Website design Yaroslav Fedevych - HTML/CSS for the website David Jensen - SVG logo conversion - Jean Marc - ScummVM logo + Jean Marc Gimenez - ScummVM logo Raina - ScummVM forum buttons Code contributions diff --git a/gui/credits.h b/gui/credits.h index c154a08028..172d44603d 100644 --- a/gui/credits.h +++ b/gui/credits.h @@ -381,7 +381,7 @@ static const char *credits[] = { "C2""HTML/CSS for the website", "C0""David Jensen", "C2""SVG logo conversion", -"C0""Jean Marc", +"C0""Jean Marc Gimenez", "C2""ScummVM logo", "C0""Raina", "C2""ScummVM forum buttons", diff --git a/tools/credits.pl b/tools/credits.pl index ee96017d4b..3b297e961b 100755 --- a/tools/credits.pl +++ b/tools/credits.pl @@ -837,7 +837,7 @@ begin_credits("Credits"); add_person("Dobó Balázs", "draven", "Website design"); add_person("Yaroslav Fedevych", "jafd", "HTML/CSS for the website"); add_person("David Jensen", "Tyst", "SVG logo conversion"); - add_person("Jean Marc", "", "ScummVM logo"); + add_person("Jean Marc Gimenez", "", "ScummVM logo"); add_person("", "Raina", "ScummVM forum buttons"); end_persons(); end_section(); -- cgit v1.2.3 From 5913895ecc32b630a9645eb985940bf57f10d0e7 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Mon, 13 Jul 2009 23:42:37 +0000 Subject: Allow resource loading from EXT even if the TOT has none again svn-id: r42463 --- engines/gob/resources.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/engines/gob/resources.cpp b/engines/gob/resources.cpp index 20427e547b..a16514fcbc 100644 --- a/engines/gob/resources.cpp +++ b/engines/gob/resources.cpp @@ -158,29 +158,29 @@ bool Resources::load(const Common::String &fileName) { _extFile = fileBase + ".ext"; - if (!loadTOTResourceTable()) { - unload(); - return false; - } + bool hasTOTRes = loadTOTResourceTable(); + bool hasEXTRes = loadEXTResourceTable(); - if (!loadEXTResourceTable()) { - unload(); + if (!hasTOTRes && !hasEXTRes) return false; - } - if (!loadTOTTextTable(fileBase)) { - unload(); - return false; - } + if (hasTOTRes) { + if (!loadTOTTextTable(fileBase)) { + unload(); + return false; + } - if (!loadIMFile()) { - unload(); - return false; + if (!loadIMFile()) { + unload(); + return false; + } } - if (!loadEXFile()) { - unload(); - return false; + if (hasEXTRes) { + if (!loadEXFile()) { + unload(); + return false; + } } return true; @@ -286,7 +286,7 @@ bool Resources::loadEXTResourceTable() { DataStream *stream = _vm->_dataIO->getDataStream(_extFile.c_str()); if (!stream) - return true; + return false; _extResourceTable->itemsCount = stream->readSint16LE(); _extResourceTable->unknown = stream->readByte(); -- cgit v1.2.3 From dbf968b49e44cc6e0ddf5b04ba2bf1396c42cb59 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 14 Jul 2009 08:36:06 +0000 Subject: TINSEL: Don't use ioFailed to check if a file was opened succesfuly svn-id: r42468 --- engines/tinsel/handle.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/engines/tinsel/handle.cpp b/engines/tinsel/handle.cpp index 9a0e1f37f8..5ef5bea702 100644 --- a/engines/tinsel/handle.cpp +++ b/engines/tinsel/handle.cpp @@ -207,9 +207,7 @@ void OpenCDGraphFile(void) { // As the theory goes, the right CD will be in there! - cdGraphStream.clearIOFailed(); - cdGraphStream.open(szCdPlayFile); - if (cdGraphStream.ioFailed()) + if (!cdGraphStream.open(szCdPlayFile)) error(CANNOT_FIND_FILE, szCdPlayFile); } -- cgit v1.2.3 From aac58c80cc6f21c3ee7dc402520a219c3098d688 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Tue, 14 Jul 2009 08:57:55 +0000 Subject: Removing ioFailed() usage and fixing a leak in case of error svn-id: r42469 --- graphics/video/coktelvideo/coktelvideo.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/graphics/video/coktelvideo/coktelvideo.cpp b/graphics/video/coktelvideo/coktelvideo.cpp index 995247acaa..39aa8c5d2d 100644 --- a/graphics/video/coktelvideo/coktelvideo.cpp +++ b/graphics/video/coktelvideo/coktelvideo.cpp @@ -1819,16 +1819,18 @@ Common::MemoryReadStream *Vmd::getExtraData(const char *fileName) { return 0; } - byte *data = (byte *) malloc(_extraData[i].realSize); - - _stream->seek(_extraData[i].offset); - if (_stream->ioFailed() || (((uint32) _stream->pos()) != _extraData[i].offset)) { - warning("Vmd::getExtraData(): Can't seek to offset %d to get extra data file \"%s\"", + if (!_stream->seek(_extraData[i].offset)) { + warning("Vmd::getExtraData(): Can't seek to offset %d to (file \"%s\")", _extraData[i].offset, fileName); return 0; } - _stream->read(data, _extraData[i].realSize); + byte *data = (byte *) malloc(_extraData[i].realSize); + if (_stream->read(data, _extraData[i].realSize) != _extraData[i].realSize) { + free(data); + warning("Vmd::getExtraData(): Couldn't read %d bytes (file \"%s\")", + _extraData[i].realSize, fileName); + } Common::MemoryReadStream *stream = new Common::MemoryReadStream(data, _extraData[i].realSize, true); -- cgit v1.2.3 From 72e2b9fe5aa5ed58ae742bec39257ca7532994f1 Mon Sep 17 00:00:00 2001 From: Joost Peters Date: Tue, 14 Jul 2009 09:44:56 +0000 Subject: commit peres' patch for #2813472: BASS: "showgrid" enabled triggers an assert svn-id: r42470 --- engines/sky/grid.cpp | 6 ++++-- engines/sky/sky.cpp | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/engines/sky/grid.cpp b/engines/sky/grid.cpp index d9b7a17351..7b473c7934 100644 --- a/engines/sky/grid.cpp +++ b/engines/sky/grid.cpp @@ -255,8 +255,10 @@ void Grid::removeGrid(uint32 x, uint32 y, uint32 width, Compact *cpt) { } uint8 *Grid::giveGrid(uint32 pScreen) { - assert((_gridConvertTable[pScreen] >= 0) && (_gridConvertTable[pScreen] < TOT_NO_GRIDS)); - return _gameGrids[_gridConvertTable[pScreen]]; + if ((_gridConvertTable[pScreen] >= 0) && (_gridConvertTable[pScreen] < TOT_NO_GRIDS)) { + return _gameGrids[_gridConvertTable[pScreen]]; + } + return 0; } } // End of namespace Sky diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp index 47cc65e96d..e85da6297a 100644 --- a/engines/sky/sky.cpp +++ b/engines/sky/sky.cpp @@ -208,8 +208,11 @@ Common::Error SkyEngine::go() { _skyScreen->recreate(); _skyScreen->spriteEngine(); if (_debugger->showGrid()) { - _skyScreen->showGrid(_skyLogic->_skyGrid->giveGrid(Logic::_scriptVariables[SCREEN])); - _skyScreen->forceRefresh(); + uint8 *grid = _skyLogic->_skyGrid->giveGrid(Logic::_scriptVariables[SCREEN]); + if (grid) { + _skyScreen->showGrid(grid); + _skyScreen->forceRefresh(); + } } _skyScreen->flip(); -- cgit v1.2.3 From fb631a7f38eb88cf46a702eda9fe11aa310111c2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 14 Jul 2009 10:26:56 +0000 Subject: Bugfix for player being able to walk through some objects against room walls svn-id: r42471 --- engines/cruise/actor.cpp | 2 +- engines/cruise/ctp.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/cruise/actor.cpp b/engines/cruise/actor.cpp index 969be96573..845867409e 100644 --- a/engines/cruise/actor.cpp +++ b/engines/cruise/actor.cpp @@ -528,7 +528,7 @@ void valide_noeud(int16 table[], int16 p, int *nclick, int16 solution0[20 + 3][2 return; } - /****** COUPE LE CHEMIN ******/ + /****** Trim down any un-necessary walk points ******/ i++; d = 0; diff --git a/engines/cruise/ctp.cpp b/engines/cruise/ctp.cpp index 11d5f582ed..aa2a6c7772 100644 --- a/engines/cruise/ctp.cpp +++ b/engines/cruise/ctp.cpp @@ -106,7 +106,7 @@ void renderCTPWalkBox(int16 *walkboxData, int hotPointX, int hotPointY, int X, i int16 *destination; int startX = X - ((upscaleValue(hotPointX, scale) + 0x8000) >> 16); -// int startY = Y - ((upscaleValue(hotPointY, scale) + 0x8000) >> 16); + int startY = Y - ((upscaleValue(hotPointY, scale) + 0x8000) >> 16); numPoints = *(walkboxData++); @@ -117,7 +117,7 @@ void renderCTPWalkBox(int16 *walkboxData, int hotPointX, int hotPointY, int X, i int pointY = *(walkboxData++); int scaledX = ((upscaleValue(pointX, scale) + 0x8000) >> 16) + startX; - int scaledY = ((upscaleValue(pointY, scale) + 0x8000) >> 16) + startX; + int scaledY = ((upscaleValue(pointY, scale) + 0x8000) >> 16) + startY; *(destination++) = scaledX; *(destination++) = scaledY; -- cgit v1.2.3 From 324ba3703b73f6b4f3ddf43c5670ceb48c3b5daf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 14 Jul 2009 10:55:51 +0000 Subject: Bugfix to cursor updates - it previously required that both X and Y positions had changed before a cursor change could occur svn-id: r42472 --- engines/cruise/cruise_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index 711f7bdf94..862cda592e 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -1906,7 +1906,7 @@ void CruiseEngine::mainLoop(void) { getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY); - if (mouseX != oldMouseX && mouseY != oldMouseY) { + if (mouseX != oldMouseX || mouseY != oldMouseY) { int objectType; int newCursor1; int newCursor2; -- cgit v1.2.3 From fb247af301a0b77bc55950303e9f962b6a515883 Mon Sep 17 00:00:00 2001 From: Joost Peters Date: Tue, 14 Jul 2009 11:15:21 +0000 Subject: add workaround for #2687172: BASS: Occasional loss of speech svn-id: r42473 --- engines/sky/logic.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engines/sky/logic.cpp b/engines/sky/logic.cpp index ccfbfbbd62..991fbe19d0 100644 --- a/engines/sky/logic.cpp +++ b/engines/sky/logic.cpp @@ -1702,6 +1702,15 @@ bool Logic::fnQuit(uint32 a, uint32 b, uint32 c) { } bool Logic::fnSpeakMe(uint32 targetId, uint32 mesgNum, uint32 animNum) { + /* WORKAROUND for #2687172: When Mrs. Piermont is talking + on the phone in her apartment, ignore her fnSpeakMe calls + on other screens, as the lack of speech files for these lines + will cause Foster's speech to be aborted if the timing is bad. + */ + if (targetId == 0x4039 && animNum == 0x9B && Logic::_scriptVariables[SCREEN] != 38) { + return false; + } + stdSpeak(_skyCompact->fetchCpt(targetId), mesgNum, animNum, 0); return false; //drop out of script } -- cgit v1.2.3 From e457a3f2513529930d16636155243dfc125035bd Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Tue, 14 Jul 2009 12:34:42 +0000 Subject: Add workaround for bug #1538873 - SIMON1 (French): Text wrongly displayed. svn-id: r42474 --- engines/agos/string.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/engines/agos/string.cpp b/engines/agos/string.cpp index a466be796f..23dc24cf33 100644 --- a/engines/agos/string.cpp +++ b/engines/agos/string.cpp @@ -136,6 +136,18 @@ const byte *AGOSEngine::getStringPtrByID(uint16 stringId, bool upperCase) { strcpy((char *)dst, (const char *)stringPtr); } + // WORKAROUND bug #1538873: The French version used excess spaces, + // at the end of many messages, so we strip off those excess spaces. + if (getGameType() == GType_SIMON1 && _language == Common::FR_FRA) { + uint16 len = strlen((const char *)dst) - 1; + + while (len && dst[len] == 32) { + dst[len] = 0; + len--; + } + + } + if (upperCase && *dst) { if (islower(*dst)) *dst = toupper(*dst); -- cgit v1.2.3 From 66c0c8300354da943690becea166c96cf2ba3539 Mon Sep 17 00:00:00 2001 From: Oystein Eftevaag Date: Tue, 14 Jul 2009 12:55:54 +0000 Subject: Updated xcode project svn-id: r42475 --- dists/iphone/scummvm.xcodeproj/project.pbxproj | 146 ++++++++++++++++--------- 1 file changed, 94 insertions(+), 52 deletions(-) diff --git a/dists/iphone/scummvm.xcodeproj/project.pbxproj b/dists/iphone/scummvm.xcodeproj/project.pbxproj index 9d8b74628a..e2ed137bb1 100755 --- a/dists/iphone/scummvm.xcodeproj/project.pbxproj +++ b/dists/iphone/scummvm.xcodeproj/project.pbxproj @@ -91,7 +91,6 @@ DF093EBC0F63CB26002D821E /* audiostream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477CD0D81F4E900B6D1FB /* audiostream.cpp */; }; DF093EBD0F63CB26002D821E /* flac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477CF0D81F4E900B6D1FB /* flac.cpp */; }; DF093EBE0F63CB26002D821E /* fmopl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477D10D81F4E900B6D1FB /* fmopl.cpp */; }; - DF093EBF0F63CB26002D821E /* iff.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477D30D81F4E900B6D1FB /* iff.cpp */; }; DF093EC00F63CB26002D821E /* mididrv.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477D50D81F4E900B6D1FB /* mididrv.cpp */; }; DF093EC10F63CB26002D821E /* midiparser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477D70D81F4E900B6D1FB /* midiparser.cpp */; }; DF093EC20F63CB26002D821E /* midiparser_smf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477D90D81F4E900B6D1FB /* midiparser_smf.cpp */; }; @@ -272,8 +271,6 @@ DF093F740F63CB26002D821E /* draw_v2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421220E7BA6A700F5680E /* draw_v2.cpp */; }; DF093F750F63CB26002D821E /* driver_vga.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421230E7BA6A700F5680E /* driver_vga.cpp */; }; DF093F760F63CB26002D821E /* game.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421250E7BA6A700F5680E /* game.cpp */; }; - DF093F770F63CB26002D821E /* game_v1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421270E7BA6A700F5680E /* game_v1.cpp */; }; - DF093F780F63CB26002D821E /* game_v2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421280E7BA6A700F5680E /* game_v2.cpp */; }; DF093F790F63CB26002D821E /* global.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421290E7BA6A700F5680E /* global.cpp */; }; DF093F7A0F63CB26002D821E /* gob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF84212B0E7BA6A700F5680E /* gob.cpp */; }; DF093F7B0F63CB26002D821E /* goblin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF84212D0E7BA6A700F5680E /* goblin.cpp */; }; @@ -301,7 +298,6 @@ DF093F910F63CB26002D821E /* mult_v1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421490E7BA6A700F5680E /* mult_v1.cpp */; }; DF093F920F63CB26002D821E /* mult_v2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF84214A0E7BA6A700F5680E /* mult_v2.cpp */; }; DF093F930F63CB26002D821E /* palanim.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF84214C0E7BA6A700F5680E /* palanim.cpp */; }; - DF093F940F63CB26002D821E /* parse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF84214E0E7BA6A700F5680E /* parse.cpp */; }; DF093F9B0F63CB26002D821E /* scenery.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421570E7BA6A700F5680E /* scenery.cpp */; }; DF093F9C0F63CB26002D821E /* scenery_v1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421590E7BA6A700F5680E /* scenery_v1.cpp */; }; DF093F9D0F63CB26002D821E /* scenery_v2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF84215A0E7BA6A700F5680E /* scenery_v2.cpp */; }; @@ -813,7 +809,6 @@ DF09419C0F63CB26002D821E /* sequences_lol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC320F48628A0006E566 /* sequences_lol.cpp */; }; DF09419D0F63CB26002D821E /* sound_midi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC330F48628A0006E566 /* sound_midi.cpp */; }; DF09419E0F63CB26002D821E /* util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC360F48628A0006E566 /* util.cpp */; }; - DF09419F0F63CB26002D821E /* game_v6.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC400F4862D90006E566 /* game_v6.cpp */; }; DF0941A20F63CB26002D821E /* scene_lol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC490F4863100006E566 /* scene_lol.cpp */; }; DF0941A30F63CB26002D821E /* advancedDetector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC4C0F4863560006E566 /* advancedDetector.cpp */; }; DF0941A40F63CB26002D821E /* base-backend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC5B0F4866E70006E566 /* base-backend.cpp */; }; @@ -923,13 +918,11 @@ DF09CC110FAC4E1900A5AFD7 /* demoplayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC090FAC4E1900A5AFD7 /* demoplayer.cpp */; }; DF09CC120FAC4E1900A5AFD7 /* scnplayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC0B0FAC4E1900A5AFD7 /* scnplayer.cpp */; }; DF09CC130FAC4E1900A5AFD7 /* draw_fascin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC0D0FAC4E1900A5AFD7 /* draw_fascin.cpp */; }; - DF09CC140FAC4E1900A5AFD7 /* game_fascin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC0E0FAC4E1900A5AFD7 /* game_fascin.cpp */; }; DF09CC150FAC4E1900A5AFD7 /* inter_fascin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC0F0FAC4E1900A5AFD7 /* inter_fascin.cpp */; }; DF09CC160FAC4E1900A5AFD7 /* batplayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC070FAC4E1900A5AFD7 /* batplayer.cpp */; }; DF09CC170FAC4E1900A5AFD7 /* demoplayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC090FAC4E1900A5AFD7 /* demoplayer.cpp */; }; DF09CC180FAC4E1900A5AFD7 /* scnplayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC0B0FAC4E1900A5AFD7 /* scnplayer.cpp */; }; DF09CC190FAC4E1900A5AFD7 /* draw_fascin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC0D0FAC4E1900A5AFD7 /* draw_fascin.cpp */; }; - DF09CC1A0FAC4E1900A5AFD7 /* game_fascin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC0E0FAC4E1900A5AFD7 /* game_fascin.cpp */; }; DF09CC1B0FAC4E1900A5AFD7 /* inter_fascin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC0F0FAC4E1900A5AFD7 /* inter_fascin.cpp */; }; DF09CC280FAC4EAB00A5AFD7 /* script_v3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC260FAC4EAB00A5AFD7 /* script_v3.cpp */; }; DF09CC290FAC4EAB00A5AFD7 /* script_v4.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC270FAC4EAB00A5AFD7 /* script_v4.cpp */; }; @@ -953,7 +946,6 @@ DF2FFC3B0F48628A0006E566 /* sequences_lol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC320F48628A0006E566 /* sequences_lol.cpp */; }; DF2FFC3C0F48628A0006E566 /* sound_midi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC330F48628A0006E566 /* sound_midi.cpp */; }; DF2FFC3E0F48628A0006E566 /* util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC360F48628A0006E566 /* util.cpp */; }; - DF2FFC450F4862D90006E566 /* game_v6.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC400F4862D90006E566 /* game_v6.cpp */; }; DF2FFC4A0F4863100006E566 /* scene_lol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC490F4863100006E566 /* scene_lol.cpp */; }; DF2FFC4E0F4863560006E566 /* advancedDetector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC4C0F4863560006E566 /* advancedDetector.cpp */; }; DF2FFC5D0F4866E70006E566 /* base-backend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC5B0F4866E70006E566 /* base-backend.cpp */; }; @@ -1117,6 +1109,36 @@ DF6118D10FE3AB560042AD3F /* mame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF6118CF0FE3AB560042AD3F /* mame.cpp */; }; DF6118D20FE3AB560042AD3F /* mame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF6118CF0FE3AB560042AD3F /* mame.cpp */; }; DF6118D30FE3AB560042AD3F /* mame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF6118CF0FE3AB560042AD3F /* mame.cpp */; }; + DF7585CE100CB66E00CC3324 /* expression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585C3100CB66E00CC3324 /* expression.cpp */; }; + DF7585CF100CB66E00CC3324 /* hotspots.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585C5100CB66E00CC3324 /* hotspots.cpp */; }; + DF7585D0100CB66E00CC3324 /* init_v6.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585C7100CB66E00CC3324 /* init_v6.cpp */; }; + DF7585D1100CB66E00CC3324 /* resources.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585C8100CB66E00CC3324 /* resources.cpp */; }; + DF7585D2100CB66E00CC3324 /* script.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585CA100CB66E00CC3324 /* script.cpp */; }; + DF7585D3100CB66E00CC3324 /* totfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585CC100CB66E00CC3324 /* totfile.cpp */; }; + DF7585D4100CB66E00CC3324 /* expression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585C3100CB66E00CC3324 /* expression.cpp */; }; + DF7585D5100CB66E00CC3324 /* hotspots.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585C5100CB66E00CC3324 /* hotspots.cpp */; }; + DF7585D6100CB66E00CC3324 /* init_v6.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585C7100CB66E00CC3324 /* init_v6.cpp */; }; + DF7585D7100CB66E00CC3324 /* resources.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585C8100CB66E00CC3324 /* resources.cpp */; }; + DF7585D8100CB66E00CC3324 /* script.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585CA100CB66E00CC3324 /* script.cpp */; }; + DF7585D9100CB66E00CC3324 /* totfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585CC100CB66E00CC3324 /* totfile.cpp */; }; + DF7585DA100CB66E00CC3324 /* expression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585C3100CB66E00CC3324 /* expression.cpp */; }; + DF7585DB100CB66E00CC3324 /* hotspots.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585C5100CB66E00CC3324 /* hotspots.cpp */; }; + DF7585DC100CB66E00CC3324 /* init_v6.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585C7100CB66E00CC3324 /* init_v6.cpp */; }; + DF7585DD100CB66E00CC3324 /* resources.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585C8100CB66E00CC3324 /* resources.cpp */; }; + DF7585DE100CB66E00CC3324 /* script.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585CA100CB66E00CC3324 /* script.cpp */; }; + DF7585DF100CB66E00CC3324 /* totfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585CC100CB66E00CC3324 /* totfile.cpp */; }; + DF7585E6100CB69F00CC3324 /* iff_sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585E4100CB69F00CC3324 /* iff_sound.cpp */; }; + DF7585E7100CB69F00CC3324 /* iff_sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585E4100CB69F00CC3324 /* iff_sound.cpp */; }; + DF7585E8100CB69F00CC3324 /* iff_sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585E4100CB69F00CC3324 /* iff_sound.cpp */; }; + DF7585EC100CB6EA00CC3324 /* sjis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585EA100CB6EA00CC3324 /* sjis.cpp */; }; + DF7585ED100CB6EA00CC3324 /* sjis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585EA100CB6EA00CC3324 /* sjis.cpp */; }; + DF7585EE100CB6EA00CC3324 /* sjis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585EA100CB6EA00CC3324 /* sjis.cpp */; }; + DF7585F1100CB70600CC3324 /* saveload_playtoons.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585F0100CB70600CC3324 /* saveload_playtoons.cpp */; }; + DF7585F2100CB70600CC3324 /* saveload_playtoons.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585F0100CB70600CC3324 /* saveload_playtoons.cpp */; }; + DF7585F3100CB70600CC3324 /* saveload_playtoons.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585F0100CB70600CC3324 /* saveload_playtoons.cpp */; }; + DF7585F7100CB75800CC3324 /* static_selectors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585F6100CB75800CC3324 /* static_selectors.cpp */; }; + DF7585F8100CB75800CC3324 /* static_selectors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585F6100CB75800CC3324 /* static_selectors.cpp */; }; + DF7585F9100CB75800CC3324 /* static_selectors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585F6100CB75800CC3324 /* static_selectors.cpp */; }; DF7A40330FB6E8960094E50F /* gfx_pixmap_scale.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7A40320FB6E8960094E50F /* gfx_pixmap_scale.cpp */; }; DF7A40340FB6E8960094E50F /* gfx_pixmap_scale.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7A40320FB6E8960094E50F /* gfx_pixmap_scale.cpp */; }; DF7A40350FB6E8960094E50F /* gfx_pixmap_scale.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7A40320FB6E8960094E50F /* gfx_pixmap_scale.cpp */; }; @@ -1281,8 +1303,6 @@ DF8425E20E7BA6AC00F5680E /* draw_v2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421220E7BA6A700F5680E /* draw_v2.cpp */; }; DF8425E30E7BA6AC00F5680E /* driver_vga.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421230E7BA6A700F5680E /* driver_vga.cpp */; }; DF8425E40E7BA6AC00F5680E /* game.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421250E7BA6A700F5680E /* game.cpp */; }; - DF8425E50E7BA6AC00F5680E /* game_v1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421270E7BA6A700F5680E /* game_v1.cpp */; }; - DF8425E60E7BA6AC00F5680E /* game_v2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421280E7BA6A700F5680E /* game_v2.cpp */; }; DF8425E70E7BA6AC00F5680E /* global.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421290E7BA6A700F5680E /* global.cpp */; }; DF8425E80E7BA6AC00F5680E /* gob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF84212B0E7BA6A700F5680E /* gob.cpp */; }; DF8425E90E7BA6AC00F5680E /* goblin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF84212D0E7BA6A700F5680E /* goblin.cpp */; }; @@ -1310,7 +1330,6 @@ DF8426000E7BA6AC00F5680E /* mult_v1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421490E7BA6A700F5680E /* mult_v1.cpp */; }; DF8426010E7BA6AC00F5680E /* mult_v2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF84214A0E7BA6A700F5680E /* mult_v2.cpp */; }; DF8426030E7BA6AC00F5680E /* palanim.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF84214C0E7BA6A700F5680E /* palanim.cpp */; }; - DF8426040E7BA6AC00F5680E /* parse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF84214E0E7BA6A700F5680E /* parse.cpp */; }; DF84260B0E7BA6AC00F5680E /* scenery.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421570E7BA6A700F5680E /* scenery.cpp */; }; DF84260C0E7BA6AC00F5680E /* scenery_v1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421590E7BA6A700F5680E /* scenery_v1.cpp */; }; DF84260D0E7BA6AC00F5680E /* scenery_v2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF84215A0E7BA6A700F5680E /* scenery_v2.cpp */; }; @@ -1918,7 +1937,6 @@ DFE47C3F0D81F4E900B6D1FB /* audiostream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477CD0D81F4E900B6D1FB /* audiostream.cpp */; }; DFE47C400D81F4E900B6D1FB /* flac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477CF0D81F4E900B6D1FB /* flac.cpp */; }; DFE47C410D81F4E900B6D1FB /* fmopl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477D10D81F4E900B6D1FB /* fmopl.cpp */; }; - DFE47C420D81F4E900B6D1FB /* iff.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477D30D81F4E900B6D1FB /* iff.cpp */; }; DFE47C430D81F4E900B6D1FB /* mididrv.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477D50D81F4E900B6D1FB /* mididrv.cpp */; }; DFE47C440D81F4E900B6D1FB /* midiparser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477D70D81F4E900B6D1FB /* midiparser.cpp */; }; DFE47C450D81F4E900B6D1FB /* midiparser_smf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477D90D81F4E900B6D1FB /* midiparser_smf.cpp */; }; @@ -2030,7 +2048,6 @@ DFF959520FB22D5700A3EC78 /* audiostream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477CD0D81F4E900B6D1FB /* audiostream.cpp */; }; DFF959530FB22D5700A3EC78 /* flac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477CF0D81F4E900B6D1FB /* flac.cpp */; }; DFF959540FB22D5700A3EC78 /* fmopl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477D10D81F4E900B6D1FB /* fmopl.cpp */; }; - DFF959550FB22D5700A3EC78 /* iff.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477D30D81F4E900B6D1FB /* iff.cpp */; }; DFF959560FB22D5700A3EC78 /* mididrv.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477D50D81F4E900B6D1FB /* mididrv.cpp */; }; DFF959570FB22D5700A3EC78 /* midiparser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477D70D81F4E900B6D1FB /* midiparser.cpp */; }; DFF959580FB22D5700A3EC78 /* midiparser_smf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE477D90D81F4E900B6D1FB /* midiparser_smf.cpp */; }; @@ -2213,8 +2230,6 @@ DFF95A0A0FB22D5700A3EC78 /* draw_v2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421220E7BA6A700F5680E /* draw_v2.cpp */; }; DFF95A0B0FB22D5700A3EC78 /* driver_vga.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421230E7BA6A700F5680E /* driver_vga.cpp */; }; DFF95A0C0FB22D5700A3EC78 /* game.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421250E7BA6A700F5680E /* game.cpp */; }; - DFF95A0D0FB22D5700A3EC78 /* game_v1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421270E7BA6A700F5680E /* game_v1.cpp */; }; - DFF95A0E0FB22D5700A3EC78 /* game_v2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421280E7BA6A700F5680E /* game_v2.cpp */; }; DFF95A0F0FB22D5700A3EC78 /* global.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421290E7BA6A700F5680E /* global.cpp */; }; DFF95A100FB22D5700A3EC78 /* gob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF84212B0E7BA6A700F5680E /* gob.cpp */; }; DFF95A110FB22D5700A3EC78 /* goblin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF84212D0E7BA6A700F5680E /* goblin.cpp */; }; @@ -2242,7 +2257,6 @@ DFF95A270FB22D5700A3EC78 /* mult_v1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421490E7BA6A700F5680E /* mult_v1.cpp */; }; DFF95A280FB22D5700A3EC78 /* mult_v2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF84214A0E7BA6A700F5680E /* mult_v2.cpp */; }; DFF95A290FB22D5700A3EC78 /* palanim.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF84214C0E7BA6A700F5680E /* palanim.cpp */; }; - DFF95A2A0FB22D5700A3EC78 /* parse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF84214E0E7BA6A700F5680E /* parse.cpp */; }; DFF95A310FB22D5700A3EC78 /* scenery.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421570E7BA6A700F5680E /* scenery.cpp */; }; DFF95A320FB22D5700A3EC78 /* scenery_v1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8421590E7BA6A700F5680E /* scenery_v1.cpp */; }; DFF95A330FB22D5700A3EC78 /* scenery_v2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF84215A0E7BA6A700F5680E /* scenery_v2.cpp */; }; @@ -2755,7 +2769,6 @@ DFF95C310FB22D5700A3EC78 /* sequences_lol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC320F48628A0006E566 /* sequences_lol.cpp */; }; DFF95C320FB22D5700A3EC78 /* sound_midi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC330F48628A0006E566 /* sound_midi.cpp */; }; DFF95C330FB22D5700A3EC78 /* util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC360F48628A0006E566 /* util.cpp */; }; - DFF95C340FB22D5700A3EC78 /* game_v6.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC400F4862D90006E566 /* game_v6.cpp */; }; DFF95C370FB22D5700A3EC78 /* scene_lol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC490F4863100006E566 /* scene_lol.cpp */; }; DFF95C380FB22D5700A3EC78 /* advancedDetector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC4C0F4863560006E566 /* advancedDetector.cpp */; }; DFF95C390FB22D5700A3EC78 /* base-backend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2FFC5B0F4866E70006E566 /* base-backend.cpp */; }; @@ -2859,7 +2872,6 @@ DFF95CAF0FB22D5700A3EC78 /* demoplayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC090FAC4E1900A5AFD7 /* demoplayer.cpp */; }; DFF95CB00FB22D5700A3EC78 /* scnplayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC0B0FAC4E1900A5AFD7 /* scnplayer.cpp */; }; DFF95CB10FB22D5700A3EC78 /* draw_fascin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC0D0FAC4E1900A5AFD7 /* draw_fascin.cpp */; }; - DFF95CB20FB22D5700A3EC78 /* game_fascin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC0E0FAC4E1900A5AFD7 /* game_fascin.cpp */; }; DFF95CB30FB22D5700A3EC78 /* inter_fascin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC0F0FAC4E1900A5AFD7 /* inter_fascin.cpp */; }; DFF95CB40FB22D5700A3EC78 /* script_v3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC260FAC4EAB00A5AFD7 /* script_v3.cpp */; }; DFF95CB50FB22D5700A3EC78 /* script_v4.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF09CC270FAC4EAB00A5AFD7 /* script_v4.cpp */; }; @@ -2959,7 +2971,6 @@ DF09CC0B0FAC4E1900A5AFD7 /* scnplayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = scnplayer.cpp; sourceTree = ""; }; DF09CC0C0FAC4E1900A5AFD7 /* scnplayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scnplayer.h; sourceTree = ""; }; DF09CC0D0FAC4E1900A5AFD7 /* draw_fascin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = draw_fascin.cpp; sourceTree = ""; }; - DF09CC0E0FAC4E1900A5AFD7 /* game_fascin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = game_fascin.cpp; sourceTree = ""; }; DF09CC0F0FAC4E1900A5AFD7 /* inter_fascin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = inter_fascin.cpp; sourceTree = ""; }; DF09CC1D0FAC4E6200A5AFD7 /* scumm_v0.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scumm_v0.h; sourceTree = ""; }; DF09CC1E0FAC4E6200A5AFD7 /* scumm_v2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scumm_v2.h; sourceTree = ""; }; @@ -3004,7 +3015,6 @@ DF2FFC330F48628A0006E566 /* sound_midi.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sound_midi.cpp; sourceTree = ""; }; DF2FFC360F48628A0006E566 /* util.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = util.cpp; sourceTree = ""; }; DF2FFC370F48628A0006E566 /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; }; - DF2FFC400F4862D90006E566 /* game_v6.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = game_v6.cpp; sourceTree = ""; }; DF2FFC490F4863100006E566 /* scene_lol.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = scene_lol.cpp; sourceTree = ""; }; DF2FFC4C0F4863560006E566 /* advancedDetector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = advancedDetector.cpp; sourceTree = ""; }; DF2FFC4D0F4863560006E566 /* advancedDetector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = advancedDetector.h; sourceTree = ""; }; @@ -3162,6 +3172,23 @@ DF6118CB0FE3AAFD0042AD3F /* hardwarekeys.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = hardwarekeys.cpp; sourceTree = ""; }; DF6118CF0FE3AB560042AD3F /* mame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mame.cpp; sourceTree = ""; }; DF6118D00FE3AB560042AD3F /* mame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mame.h; sourceTree = ""; }; + DF7585C3100CB66E00CC3324 /* expression.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = expression.cpp; sourceTree = ""; }; + DF7585C4100CB66E00CC3324 /* expression.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = expression.h; sourceTree = ""; }; + DF7585C5100CB66E00CC3324 /* hotspots.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = hotspots.cpp; sourceTree = ""; }; + DF7585C6100CB66E00CC3324 /* hotspots.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hotspots.h; sourceTree = ""; }; + DF7585C7100CB66E00CC3324 /* init_v6.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = init_v6.cpp; sourceTree = ""; }; + DF7585C8100CB66E00CC3324 /* resources.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = resources.cpp; sourceTree = ""; }; + DF7585C9100CB66E00CC3324 /* resources.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resources.h; sourceTree = ""; }; + DF7585CA100CB66E00CC3324 /* script.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = script.cpp; sourceTree = ""; }; + DF7585CB100CB66E00CC3324 /* script.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = script.h; sourceTree = ""; }; + DF7585CC100CB66E00CC3324 /* totfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = totfile.cpp; sourceTree = ""; }; + DF7585CD100CB66E00CC3324 /* totfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = totfile.h; sourceTree = ""; }; + DF7585E4100CB69F00CC3324 /* iff_sound.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = iff_sound.cpp; sourceTree = ""; }; + DF7585E5100CB69F00CC3324 /* iff_sound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iff_sound.h; sourceTree = ""; }; + DF7585EA100CB6EA00CC3324 /* sjis.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sjis.cpp; sourceTree = ""; }; + DF7585EB100CB6EA00CC3324 /* sjis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sjis.h; sourceTree = ""; }; + DF7585F0100CB70600CC3324 /* saveload_playtoons.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = saveload_playtoons.cpp; sourceTree = ""; }; + DF7585F6100CB75800CC3324 /* static_selectors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = static_selectors.cpp; sourceTree = ""; }; DF7A40320FB6E8960094E50F /* gfx_pixmap_scale.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gfx_pixmap_scale.cpp; sourceTree = ""; }; DF7E8BF00ED5FC77001CB19F /* saveload.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = saveload.cpp; sourceTree = ""; }; DF7E8BF10ED5FC77001CB19F /* saveload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = saveload.h; sourceTree = ""; }; @@ -3412,8 +3439,6 @@ DF8421240E7BA6A700F5680E /* driver_vga.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = driver_vga.h; sourceTree = ""; }; DF8421250E7BA6A700F5680E /* game.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = game.cpp; sourceTree = ""; }; DF8421260E7BA6A700F5680E /* game.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = game.h; sourceTree = ""; }; - DF8421270E7BA6A700F5680E /* game_v1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = game_v1.cpp; sourceTree = ""; }; - DF8421280E7BA6A700F5680E /* game_v2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = game_v2.cpp; sourceTree = ""; }; DF8421290E7BA6A700F5680E /* global.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = global.cpp; sourceTree = ""; }; DF84212A0E7BA6A700F5680E /* global.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = global.h; sourceTree = ""; }; DF84212B0E7BA6A700F5680E /* gob.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gob.cpp; sourceTree = ""; }; @@ -3449,8 +3474,6 @@ DF84214A0E7BA6A700F5680E /* mult_v2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mult_v2.cpp; sourceTree = ""; }; DF84214C0E7BA6A700F5680E /* palanim.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = palanim.cpp; sourceTree = ""; }; DF84214D0E7BA6A700F5680E /* palanim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = palanim.h; sourceTree = ""; }; - DF84214E0E7BA6A700F5680E /* parse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = parse.cpp; sourceTree = ""; }; - DF84214F0E7BA6A700F5680E /* parse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = parse.h; sourceTree = ""; }; DF8421570E7BA6A700F5680E /* scenery.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = scenery.cpp; sourceTree = ""; }; DF8421580E7BA6A700F5680E /* scenery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scenery.h; sourceTree = ""; }; DF8421590E7BA6A700F5680E /* scenery_v1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = scenery_v1.cpp; sourceTree = ""; }; @@ -4532,8 +4555,6 @@ DFE477D00D81F4E900B6D1FB /* flac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = flac.h; sourceTree = ""; }; DFE477D10D81F4E900B6D1FB /* fmopl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fmopl.cpp; sourceTree = ""; }; DFE477D20D81F4E900B6D1FB /* fmopl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fmopl.h; sourceTree = ""; }; - DFE477D30D81F4E900B6D1FB /* iff.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = iff.cpp; sourceTree = ""; }; - DFE477D40D81F4E900B6D1FB /* iff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iff.h; sourceTree = ""; }; DFE477D50D81F4E900B6D1FB /* mididrv.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mididrv.cpp; sourceTree = ""; }; DFE477D60D81F4E900B6D1FB /* mididrv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mididrv.h; sourceTree = ""; }; DFE477D70D81F4E900B6D1FB /* midiparser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = midiparser.cpp; sourceTree = ""; }; @@ -4852,6 +4873,7 @@ DF6118780FE3A9AA0042AD3F /* save */ = { isa = PBXGroup; children = ( + DF7585F0100CB70600CC3324 /* saveload_playtoons.cpp */, DF6118790FE3A9AA0042AD3F /* saveconverter.cpp */, DF61187A0FE3A9AA0042AD3F /* saveconverter.h */, DF61187B0FE3A9AA0042AD3F /* saveconverter_v2.cpp */, @@ -5171,13 +5193,22 @@ DF8421170E7BA6A700F5680E /* gob */ = { isa = PBXGroup; children = ( + DF7585C3100CB66E00CC3324 /* expression.cpp */, + DF7585C4100CB66E00CC3324 /* expression.h */, + DF7585C5100CB66E00CC3324 /* hotspots.cpp */, + DF7585C6100CB66E00CC3324 /* hotspots.h */, + DF7585C7100CB66E00CC3324 /* init_v6.cpp */, + DF7585C8100CB66E00CC3324 /* resources.cpp */, + DF7585C9100CB66E00CC3324 /* resources.h */, + DF7585CA100CB66E00CC3324 /* script.cpp */, + DF7585CB100CB66E00CC3324 /* script.h */, + DF7585CC100CB66E00CC3324 /* totfile.cpp */, + DF7585CD100CB66E00CC3324 /* totfile.h */, DF6118780FE3A9AA0042AD3F /* save */, DF6118590FE3A9020042AD3F /* helper.h */, DF09CC060FAC4E1900A5AFD7 /* demos */, DF09CC0D0FAC4E1900A5AFD7 /* draw_fascin.cpp */, - DF09CC0E0FAC4E1900A5AFD7 /* game_fascin.cpp */, DF09CC0F0FAC4E1900A5AFD7 /* inter_fascin.cpp */, - DF2FFC400F4862D90006E566 /* game_v6.cpp */, DF84211B0E7BA6A700F5680E /* dataio.cpp */, DF84211C0E7BA6A700F5680E /* dataio.h */, DF84211D0E7BA6A700F5680E /* detection.cpp */, @@ -5190,8 +5221,6 @@ DF8421240E7BA6A700F5680E /* driver_vga.h */, DF8421250E7BA6A700F5680E /* game.cpp */, DF8421260E7BA6A700F5680E /* game.h */, - DF8421270E7BA6A700F5680E /* game_v1.cpp */, - DF8421280E7BA6A700F5680E /* game_v2.cpp */, DF8421290E7BA6A700F5680E /* global.cpp */, DF84212A0E7BA6A700F5680E /* global.h */, DF84212B0E7BA6A700F5680E /* gob.cpp */, @@ -5227,8 +5256,6 @@ DF84214A0E7BA6A700F5680E /* mult_v2.cpp */, DF84214C0E7BA6A700F5680E /* palanim.cpp */, DF84214D0E7BA6A700F5680E /* palanim.h */, - DF84214E0E7BA6A700F5680E /* parse.cpp */, - DF84214F0E7BA6A700F5680E /* parse.h */, DF8421570E7BA6A700F5680E /* scenery.cpp */, DF8421580E7BA6A700F5680E /* scenery.h */, DF8421590E7BA6A700F5680E /* scenery_v1.cpp */, @@ -6317,6 +6344,7 @@ DFC8301B0F48AF18005EF03C /* engine */ = { isa = PBXGroup; children = ( + DF7585F6100CB75800CC3324 /* static_selectors.cpp */, DF6118380FE3A8080042AD3F /* kmisc.cpp */, DF6118390FE3A8080042AD3F /* memobj.cpp */, DF61183A0FE3A8080042AD3F /* memobj.h */, @@ -6709,6 +6737,8 @@ DFE477520D81F4E900B6D1FB /* graphics */ = { isa = PBXGroup; children = ( + DF7585EA100CB6EA00CC3324 /* sjis.cpp */, + DF7585EB100CB6EA00CC3324 /* sjis.h */, DF2FFB940F485D950006E566 /* video */, DF2FFB900F485D890006E566 /* dither.cpp */, DF2FFB910F485D890006E566 /* dither.h */, @@ -6830,6 +6860,8 @@ DFE477C60D81F4E900B6D1FB /* sound */ = { isa = PBXGroup; children = ( + DF7585E4100CB69F00CC3324 /* iff_sound.cpp */, + DF7585E5100CB69F00CC3324 /* iff_sound.h */, DF5CEB350F7553E000DEA624 /* vag.cpp */, DF5CEB360F7553E000DEA624 /* vag.h */, DF89C2B60F62D91000D756B6 /* shorten.cpp */, @@ -6850,8 +6882,6 @@ DFE477D00D81F4E900B6D1FB /* flac.h */, DFE477D10D81F4E900B6D1FB /* fmopl.cpp */, DFE477D20D81F4E900B6D1FB /* fmopl.h */, - DFE477D30D81F4E900B6D1FB /* iff.cpp */, - DFE477D40D81F4E900B6D1FB /* iff.h */, DFE477D50D81F4E900B6D1FB /* mididrv.cpp */, DFE477D60D81F4E900B6D1FB /* mididrv.h */, DFE477D70D81F4E900B6D1FB /* midiparser.cpp */, @@ -7142,7 +7172,6 @@ DFE47C3F0D81F4E900B6D1FB /* audiostream.cpp in Sources */, DFE47C400D81F4E900B6D1FB /* flac.cpp in Sources */, DFE47C410D81F4E900B6D1FB /* fmopl.cpp in Sources */, - DFE47C420D81F4E900B6D1FB /* iff.cpp in Sources */, DFE47C430D81F4E900B6D1FB /* mididrv.cpp in Sources */, DFE47C440D81F4E900B6D1FB /* midiparser.cpp in Sources */, DFE47C450D81F4E900B6D1FB /* midiparser_smf.cpp in Sources */, @@ -7325,8 +7354,6 @@ DF8425E20E7BA6AC00F5680E /* draw_v2.cpp in Sources */, DF8425E30E7BA6AC00F5680E /* driver_vga.cpp in Sources */, DF8425E40E7BA6AC00F5680E /* game.cpp in Sources */, - DF8425E50E7BA6AC00F5680E /* game_v1.cpp in Sources */, - DF8425E60E7BA6AC00F5680E /* game_v2.cpp in Sources */, DF8425E70E7BA6AC00F5680E /* global.cpp in Sources */, DF8425E80E7BA6AC00F5680E /* gob.cpp in Sources */, DF8425E90E7BA6AC00F5680E /* goblin.cpp in Sources */, @@ -7354,7 +7381,6 @@ DF8426000E7BA6AC00F5680E /* mult_v1.cpp in Sources */, DF8426010E7BA6AC00F5680E /* mult_v2.cpp in Sources */, DF8426030E7BA6AC00F5680E /* palanim.cpp in Sources */, - DF8426040E7BA6AC00F5680E /* parse.cpp in Sources */, DF84260B0E7BA6AC00F5680E /* scenery.cpp in Sources */, DF84260C0E7BA6AC00F5680E /* scenery_v1.cpp in Sources */, DF84260D0E7BA6AC00F5680E /* scenery_v2.cpp in Sources */, @@ -7867,7 +7893,6 @@ DF2FFC3B0F48628A0006E566 /* sequences_lol.cpp in Sources */, DF2FFC3C0F48628A0006E566 /* sound_midi.cpp in Sources */, DF2FFC3E0F48628A0006E566 /* util.cpp in Sources */, - DF2FFC450F4862D90006E566 /* game_v6.cpp in Sources */, DF2FFC4A0F4863100006E566 /* scene_lol.cpp in Sources */, DF2FFC4E0F4863560006E566 /* advancedDetector.cpp in Sources */, DF2FFC5D0F4866E70006E566 /* base-backend.cpp in Sources */, @@ -7971,7 +7996,6 @@ DF09CC170FAC4E1900A5AFD7 /* demoplayer.cpp in Sources */, DF09CC180FAC4E1900A5AFD7 /* scnplayer.cpp in Sources */, DF09CC190FAC4E1900A5AFD7 /* draw_fascin.cpp in Sources */, - DF09CC1A0FAC4E1900A5AFD7 /* game_fascin.cpp in Sources */, DF09CC1B0FAC4E1900A5AFD7 /* inter_fascin.cpp in Sources */, DF09CC2A0FAC4EAB00A5AFD7 /* script_v3.cpp in Sources */, DF09CC2B0FAC4EAB00A5AFD7 /* script_v4.cpp in Sources */, @@ -8011,6 +8035,16 @@ DF6118BF0FE3AA280042AD3F /* text_lol.cpp in Sources */, DF6118C80FE3AABD0042AD3F /* player_v2cms.cpp in Sources */, DF6118D30FE3AB560042AD3F /* mame.cpp in Sources */, + DF7585DA100CB66E00CC3324 /* expression.cpp in Sources */, + DF7585DB100CB66E00CC3324 /* hotspots.cpp in Sources */, + DF7585DC100CB66E00CC3324 /* init_v6.cpp in Sources */, + DF7585DD100CB66E00CC3324 /* resources.cpp in Sources */, + DF7585DE100CB66E00CC3324 /* script.cpp in Sources */, + DF7585DF100CB66E00CC3324 /* totfile.cpp in Sources */, + DF7585E8100CB69F00CC3324 /* iff_sound.cpp in Sources */, + DF7585EE100CB6EA00CC3324 /* sjis.cpp in Sources */, + DF7585F3100CB70600CC3324 /* saveload_playtoons.cpp in Sources */, + DF7585F9100CB75800CC3324 /* static_selectors.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -8078,7 +8112,6 @@ DF093EBC0F63CB26002D821E /* audiostream.cpp in Sources */, DF093EBD0F63CB26002D821E /* flac.cpp in Sources */, DF093EBE0F63CB26002D821E /* fmopl.cpp in Sources */, - DF093EBF0F63CB26002D821E /* iff.cpp in Sources */, DF093EC00F63CB26002D821E /* mididrv.cpp in Sources */, DF093EC10F63CB26002D821E /* midiparser.cpp in Sources */, DF093EC20F63CB26002D821E /* midiparser_smf.cpp in Sources */, @@ -8259,8 +8292,6 @@ DF093F740F63CB26002D821E /* draw_v2.cpp in Sources */, DF093F750F63CB26002D821E /* driver_vga.cpp in Sources */, DF093F760F63CB26002D821E /* game.cpp in Sources */, - DF093F770F63CB26002D821E /* game_v1.cpp in Sources */, - DF093F780F63CB26002D821E /* game_v2.cpp in Sources */, DF093F790F63CB26002D821E /* global.cpp in Sources */, DF093F7A0F63CB26002D821E /* gob.cpp in Sources */, DF093F7B0F63CB26002D821E /* goblin.cpp in Sources */, @@ -8288,7 +8319,6 @@ DF093F910F63CB26002D821E /* mult_v1.cpp in Sources */, DF093F920F63CB26002D821E /* mult_v2.cpp in Sources */, DF093F930F63CB26002D821E /* palanim.cpp in Sources */, - DF093F940F63CB26002D821E /* parse.cpp in Sources */, DF093F9B0F63CB26002D821E /* scenery.cpp in Sources */, DF093F9C0F63CB26002D821E /* scenery_v1.cpp in Sources */, DF093F9D0F63CB26002D821E /* scenery_v2.cpp in Sources */, @@ -8800,7 +8830,6 @@ DF09419C0F63CB26002D821E /* sequences_lol.cpp in Sources */, DF09419D0F63CB26002D821E /* sound_midi.cpp in Sources */, DF09419E0F63CB26002D821E /* util.cpp in Sources */, - DF09419F0F63CB26002D821E /* game_v6.cpp in Sources */, DF0941A20F63CB26002D821E /* scene_lol.cpp in Sources */, DF0941A30F63CB26002D821E /* advancedDetector.cpp in Sources */, DF0941A40F63CB26002D821E /* base-backend.cpp in Sources */, @@ -8911,7 +8940,6 @@ DF09CC110FAC4E1900A5AFD7 /* demoplayer.cpp in Sources */, DF09CC120FAC4E1900A5AFD7 /* scnplayer.cpp in Sources */, DF09CC130FAC4E1900A5AFD7 /* draw_fascin.cpp in Sources */, - DF09CC140FAC4E1900A5AFD7 /* game_fascin.cpp in Sources */, DF09CC150FAC4E1900A5AFD7 /* inter_fascin.cpp in Sources */, DF09CC280FAC4EAB00A5AFD7 /* script_v3.cpp in Sources */, DF09CC290FAC4EAB00A5AFD7 /* script_v4.cpp in Sources */, @@ -8952,6 +8980,16 @@ DF6118C70FE3AABD0042AD3F /* player_v2cms.cpp in Sources */, DF6118CC0FE3AAFD0042AD3F /* hardwarekeys.cpp in Sources */, DF6118D10FE3AB560042AD3F /* mame.cpp in Sources */, + DF7585CE100CB66E00CC3324 /* expression.cpp in Sources */, + DF7585CF100CB66E00CC3324 /* hotspots.cpp in Sources */, + DF7585D0100CB66E00CC3324 /* init_v6.cpp in Sources */, + DF7585D1100CB66E00CC3324 /* resources.cpp in Sources */, + DF7585D2100CB66E00CC3324 /* script.cpp in Sources */, + DF7585D3100CB66E00CC3324 /* totfile.cpp in Sources */, + DF7585E6100CB69F00CC3324 /* iff_sound.cpp in Sources */, + DF7585EC100CB6EA00CC3324 /* sjis.cpp in Sources */, + DF7585F1100CB70600CC3324 /* saveload_playtoons.cpp in Sources */, + DF7585F7100CB75800CC3324 /* static_selectors.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -9021,7 +9059,6 @@ DFF959520FB22D5700A3EC78 /* audiostream.cpp in Sources */, DFF959530FB22D5700A3EC78 /* flac.cpp in Sources */, DFF959540FB22D5700A3EC78 /* fmopl.cpp in Sources */, - DFF959550FB22D5700A3EC78 /* iff.cpp in Sources */, DFF959560FB22D5700A3EC78 /* mididrv.cpp in Sources */, DFF959570FB22D5700A3EC78 /* midiparser.cpp in Sources */, DFF959580FB22D5700A3EC78 /* midiparser_smf.cpp in Sources */, @@ -9204,8 +9241,6 @@ DFF95A0A0FB22D5700A3EC78 /* draw_v2.cpp in Sources */, DFF95A0B0FB22D5700A3EC78 /* driver_vga.cpp in Sources */, DFF95A0C0FB22D5700A3EC78 /* game.cpp in Sources */, - DFF95A0D0FB22D5700A3EC78 /* game_v1.cpp in Sources */, - DFF95A0E0FB22D5700A3EC78 /* game_v2.cpp in Sources */, DFF95A0F0FB22D5700A3EC78 /* global.cpp in Sources */, DFF95A100FB22D5700A3EC78 /* gob.cpp in Sources */, DFF95A110FB22D5700A3EC78 /* goblin.cpp in Sources */, @@ -9233,7 +9268,6 @@ DFF95A270FB22D5700A3EC78 /* mult_v1.cpp in Sources */, DFF95A280FB22D5700A3EC78 /* mult_v2.cpp in Sources */, DFF95A290FB22D5700A3EC78 /* palanim.cpp in Sources */, - DFF95A2A0FB22D5700A3EC78 /* parse.cpp in Sources */, DFF95A310FB22D5700A3EC78 /* scenery.cpp in Sources */, DFF95A320FB22D5700A3EC78 /* scenery_v1.cpp in Sources */, DFF95A330FB22D5700A3EC78 /* scenery_v2.cpp in Sources */, @@ -9746,7 +9780,6 @@ DFF95C310FB22D5700A3EC78 /* sequences_lol.cpp in Sources */, DFF95C320FB22D5700A3EC78 /* sound_midi.cpp in Sources */, DFF95C330FB22D5700A3EC78 /* util.cpp in Sources */, - DFF95C340FB22D5700A3EC78 /* game_v6.cpp in Sources */, DFF95C370FB22D5700A3EC78 /* scene_lol.cpp in Sources */, DFF95C380FB22D5700A3EC78 /* advancedDetector.cpp in Sources */, DFF95C390FB22D5700A3EC78 /* base-backend.cpp in Sources */, @@ -9850,7 +9883,6 @@ DFF95CAF0FB22D5700A3EC78 /* demoplayer.cpp in Sources */, DFF95CB00FB22D5700A3EC78 /* scnplayer.cpp in Sources */, DFF95CB10FB22D5700A3EC78 /* draw_fascin.cpp in Sources */, - DFF95CB20FB22D5700A3EC78 /* game_fascin.cpp in Sources */, DFF95CB30FB22D5700A3EC78 /* inter_fascin.cpp in Sources */, DFF95CB40FB22D5700A3EC78 /* script_v3.cpp in Sources */, DFF95CB50FB22D5700A3EC78 /* script_v4.cpp in Sources */, @@ -9890,6 +9922,16 @@ DF6118C30FE3AA280042AD3F /* text_lol.cpp in Sources */, DF6118C90FE3AABD0042AD3F /* player_v2cms.cpp in Sources */, DF6118D20FE3AB560042AD3F /* mame.cpp in Sources */, + DF7585D4100CB66E00CC3324 /* expression.cpp in Sources */, + DF7585D5100CB66E00CC3324 /* hotspots.cpp in Sources */, + DF7585D6100CB66E00CC3324 /* init_v6.cpp in Sources */, + DF7585D7100CB66E00CC3324 /* resources.cpp in Sources */, + DF7585D8100CB66E00CC3324 /* script.cpp in Sources */, + DF7585D9100CB66E00CC3324 /* totfile.cpp in Sources */, + DF7585E7100CB69F00CC3324 /* iff_sound.cpp in Sources */, + DF7585ED100CB6EA00CC3324 /* sjis.cpp in Sources */, + DF7585F2100CB70600CC3324 /* saveload_playtoons.cpp in Sources */, + DF7585F8100CB75800CC3324 /* static_selectors.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; -- cgit v1.2.3 From c4437fa013af3858f3dcc0f8fb85fbec107ce6ee Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Tue, 14 Jul 2009 13:25:38 +0000 Subject: Add detection for Playtoons CK 3 (FR) svn-id: r42476 --- engines/gob/detection.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/engines/gob/detection.cpp b/engines/gob/detection.cpp index 3827c3635c..e56bc418a2 100644 --- a/engines/gob/detection.cpp +++ b/engines/gob/detection.cpp @@ -68,6 +68,7 @@ static const PlainGameDescriptor gobGames[] = { {"playtoons5", "Playtoons 5 - The Stone of Wakan"}, {"playtnck1", "Playtoons Construction Kit 1 - Monsters"}, {"playtnck2", "Playtoons Construction Kit 2 - Knights"}, + {"playtnck3", "Playtoons Construction Kit 3 - Far West"}, {"bambou", "Playtoons Limited Edition - Bambou le sauveur de la jungle"}, {"fascination", "Fascination"}, {"geisha", "Geisha"}, @@ -3651,6 +3652,24 @@ static const GOBGameDescription gameDescriptions[] = { kFeatures640, "intro2.stk", 0, 0 }, + { + { + "playtnck3", + "", + { + {"playtoon.stk", 0, "5f9aae29265f1f105ad8ec195dff81de", 68382024}, + {"dan.itk", 0, "9a8f62809eca5a52f429b5b6a8e70f8f", 2861056}, + {0, 0, 0, 0} + }, + FR_FRA, + kPlatformPC, + ADGF_NO_FLAGS, + GUIO_NOSUBTITLES | GUIO_NOSPEECH + }, + kGameTypePlaytnCk, + kFeatures640, + "intro2.stk", 0, 0 + }, { { "magicstones", -- cgit v1.2.3 From 264e44d14ab5dd39584aa371c217b3c5caaa1d58 Mon Sep 17 00:00:00 2001 From: Kari Salminen Date: Tue, 14 Jul 2009 13:48:31 +0000 Subject: Fix some typos and grammar in sword1's Sound::checkSpeechFileEndianness-function's comments. svn-id: r42477 --- engines/sword1/sound.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp index b3fa1aa0fd..b23bf71445 100644 --- a/engines/sword1/sound.cpp +++ b/engines/sword1/sound.cpp @@ -77,11 +77,11 @@ void Sound::checkSpeechFileEndianness() { // little endian assumption. The one with the smallest sum should be the // correct one (the sound wave is supposed to be relatively smooth). // It needs at least 1000 samples to get stable result (the code below is - // using the first 2000 samples of the wav sound. + // using the first 2000 samples of the wav sound). - // Init speach file if not already done. + // Init speech file if not already done. if (!_currentCowFile) { - // Open one of the speech file. It uses SwordEngine::_systemVars.currentCD + // Open one of the speech files. It uses SwordEngine::_systemVars.currentCD // to decide which file to open, therefore if it is currently set to zero // we have to set it to either 1 or 2 (I decided to set it to 1 as this is // more likely to be the first file that will be needed). @@ -92,22 +92,22 @@ void Sound::checkSpeechFileEndianness() { } initCowSystem(); if (no_current_cd) { - // In case it fails with CD1 retyr with CD2 + // In case it fails with CD1 retry with CD2 if (!_currentCowFile) { SwordEngine::_systemVars.currentCD = 2; initCowSystem(); } - // Reset curentCD flag + // Reset currentCD flag SwordEngine::_systemVars.currentCD = 0; } } - // Testing for endianness makes sense only if using the nom compressed files. + // Testing for endianness makes sense only if using the uncompressed files. if (_cowHeader == NULL || (_cowMode != CowWave && _cowMode != CowDemo)) return; // I picked the sample to use randomly (I just made sure it is long enough so that there is - // a fair change of the heuristic to have a stable result and work for every languages). + // a fair change of the heuristic to have a stable result and work for every language). int roomNo = _currentCowFile == 1 ? 1 : 129; int localNo = _currentCowFile == 1 ? 2 : 933; // Get the speech data and apply the heuristic @@ -119,7 +119,7 @@ void Sound::checkSpeechFileEndianness() { double be_diff_sum = 0., le_diff_sum = 0.; _bigEndianSpeech = false; int16 *data = uncompressSpeech(index + _cowHeaderSize, sampleSize, &size); - // Compute average of differecen between two consecutive samples for both BE and LE + // Compute average of difference between two consecutive samples for both BE and LE if (data) { if (size > 4000) size = 2000; -- cgit v1.2.3 From e59c546187b2890b490caaa5c029e3e049340160 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Tue, 14 Jul 2009 13:50:17 +0000 Subject: Change key combination to dump all script, due to conflict. svn-id: r42478 --- engines/agos/event.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp index b9c16d3d86..cbb09e1ec7 100644 --- a/engines/agos/event.cpp +++ b/engines/agos/event.cpp @@ -484,7 +484,7 @@ void AGOSEngine::delay(uint amount) { _fastMode ^= 1; } else if (event.kbd.keycode == Common::KEYCODE_d) { _debugger->attach(); - } else if (event.kbd.keycode == Common::KEYCODE_u) { + } else if (event.kbd.keycode == Common::KEYCODE_s) { dumpAllSubroutines(); } else if (event.kbd.keycode == Common::KEYCODE_i) { dumpAllVgaImageFiles(); -- cgit v1.2.3 From 37c7cf951a482df8281b86be74313cba65fdd520 Mon Sep 17 00:00:00 2001 From: Oystein Eftevaag Date: Tue, 14 Jul 2009 13:52:11 +0000 Subject: Split the iPhone OSystem class up into several files svn-id: r42479 --- backends/platform/iphone/module.mk | 5 +- backends/platform/iphone/osys_events.cpp | 514 ++++++++++ backends/platform/iphone/osys_iphone.cpp | 1303 ------------------------ backends/platform/iphone/osys_iphone.h | 209 ---- backends/platform/iphone/osys_main.cpp | 296 ++++++ backends/platform/iphone/osys_main.h | 209 ++++ backends/platform/iphone/osys_sound.cpp | 111 ++ backends/platform/iphone/osys_video.cpp | 463 +++++++++ dists/iphone/scummvm.xcodeproj/project.pbxproj | 34 +- 9 files changed, 1623 insertions(+), 1521 deletions(-) create mode 100644 backends/platform/iphone/osys_events.cpp delete mode 100644 backends/platform/iphone/osys_iphone.cpp delete mode 100644 backends/platform/iphone/osys_iphone.h create mode 100644 backends/platform/iphone/osys_main.cpp create mode 100644 backends/platform/iphone/osys_main.h create mode 100644 backends/platform/iphone/osys_sound.cpp create mode 100644 backends/platform/iphone/osys_video.cpp diff --git a/backends/platform/iphone/module.mk b/backends/platform/iphone/module.mk index a3c9a012fe..28bc8d3ac7 100644 --- a/backends/platform/iphone/module.mk +++ b/backends/platform/iphone/module.mk @@ -1,7 +1,10 @@ MODULE := backends/platform/iphone MODULE_OBJS := \ - osys_iphone.o \ + osys_main.o \ + osys_events.o \ + osys_sound.o \ + osys_video.o \ iphone_main.o \ iphone_video.o \ iphone_keyboard.o \ diff --git a/backends/platform/iphone/osys_events.cpp b/backends/platform/iphone/osys_events.cpp new file mode 100644 index 0000000000..a190f68189 --- /dev/null +++ b/backends/platform/iphone/osys_events.cpp @@ -0,0 +1,514 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "gui/message.h" + +#include "osys_main.h" + + +bool OSystem_IPHONE::pollEvent(Common::Event &event) { + //printf("pollEvent()\n"); + + long curTime = getMillis(); + + if (_timerCallback && (curTime >= _timerCallbackNext)) { + _timerCallback(_timerCallbackTimer); + _timerCallbackNext = curTime + _timerCallbackTimer; + } + + if (_needEventRestPeriod) { + // Workaround: Some engines can't handle mouse-down and mouse-up events + // appearing right after each other, without a call returning no input in between. + _needEventRestPeriod = false; + return false; + } + + if (_queuedInputEvent.type != (Common::EventType)0) { + event = _queuedInputEvent; + _queuedInputEvent.type = (Common::EventType)0; + return true; + } + + int eventType; + float xUnit, yUnit; + + if (iPhone_fetchEvent(&eventType, &xUnit, &yUnit)) { + int x = 0; + int y = 0; + switch (_screenOrientation) { + case kScreenOrientationPortrait: + x = (int)(xUnit * _screenWidth); + y = (int)(yUnit * _screenHeight); + break; + case kScreenOrientationLandscape: + x = (int)(yUnit * _screenWidth); + y = (int)((1.0 - xUnit) * _screenHeight); + break; + case kScreenOrientationFlippedLandscape: + x = (int)((1.0 - yUnit) * _screenWidth); + y = (int)(xUnit * _screenHeight); + break; + } + + switch ((InputEvent)eventType) { + case kInputMouseDown: + if (!handleEvent_mouseDown(event, x, y)) + return false; + break; + + case kInputMouseUp: + if (!handleEvent_mouseUp(event, x, y)) + return false; + break; + + case kInputMouseDragged: + if (!handleEvent_mouseDragged(event, x, y)) + return false; + break; + case kInputMouseSecondDragged: + if (!handleEvent_mouseSecondDragged(event, x, y)) + return false; + break; + case kInputMouseSecondDown: + _secondaryTapped = true; + if (!handleEvent_secondMouseDown(event, x, y)) + return false; + break; + case kInputMouseSecondUp: + _secondaryTapped = false; + if (!handleEvent_secondMouseUp(event, x, y)) + return false; + break; + case kInputOrientationChanged: + handleEvent_orientationChanged((int)xUnit); + return false; + break; + + case kInputApplicationSuspended: + suspendLoop(); + return false; + break; + + case kInputKeyPressed: + handleEvent_keyPressed(event, (int)xUnit); + break; + + case kInputSwipe: + if (!handleEvent_swipe(event, (int)xUnit)) + return false; + break; + + default: + break; + } + + return true; + } + return false; +} + +bool OSystem_IPHONE::handleEvent_mouseDown(Common::Event &event, int x, int y) { + //printf("Mouse down at (%u, %u)\n", x, y); + + // Workaround: kInputMouseSecondToggled isn't always sent when the + // secondary finger is lifted. Need to make sure we get out of that mode. + _secondaryTapped = false; + + if (_touchpadModeEnabled) { + _lastPadX = x; + _lastPadY = y; + } else + warpMouse(x, y); + + if (_mouseClickAndDragEnabled) { + event.type = Common::EVENT_LBUTTONDOWN; + event.mouse.x = _mouseX; + event.mouse.y = _mouseY; + return true; + } else { + _lastMouseDown = getMillis(); + } + return false; +} + +bool OSystem_IPHONE::handleEvent_mouseUp(Common::Event &event, int x, int y) { + //printf("Mouse up at (%u, %u)\n", x, y); + + if (_secondaryTapped) { + _secondaryTapped = false; + if (!handleEvent_secondMouseUp(event, x, y)) + return false; + } + else if (_mouseClickAndDragEnabled) { + event.type = Common::EVENT_LBUTTONUP; + event.mouse.x = _mouseX; + event.mouse.y = _mouseY; + } else { + if (getMillis() - _lastMouseDown < 250) { + event.type = Common::EVENT_LBUTTONDOWN; + event.mouse.x = _mouseX; + event.mouse.y = _mouseY; + + _queuedInputEvent.type = Common::EVENT_LBUTTONUP; + _queuedInputEvent.mouse.x = _mouseX; + _queuedInputEvent.mouse.y = _mouseY; + _lastMouseTap = getMillis(); + _needEventRestPeriod = true; + } else + return false; + } + + return true; +} + +bool OSystem_IPHONE::handleEvent_secondMouseDown(Common::Event &event, int x, int y) { + _lastSecondaryDown = getMillis(); + _gestureStartX = x; + _gestureStartY = y; + + if (_mouseClickAndDragEnabled) { + event.type = Common::EVENT_LBUTTONUP; + event.mouse.x = _mouseX; + event.mouse.y = _mouseY; + + _queuedInputEvent.type = Common::EVENT_RBUTTONDOWN; + _queuedInputEvent.mouse.x = _mouseX; + _queuedInputEvent.mouse.y = _mouseY; + } + else + return false; + + return true; +} + +bool OSystem_IPHONE::handleEvent_secondMouseUp(Common::Event &event, int x, int y) { + int curTime = getMillis(); + + if (curTime - _lastSecondaryDown < 400 ) { + //printf("Right tap!\n"); + if (curTime - _lastSecondaryTap < 400 && !_overlayVisible) { + //printf("Right escape!\n"); + event.type = Common::EVENT_KEYDOWN; + _queuedInputEvent.type = Common::EVENT_KEYUP; + + event.kbd.flags = _queuedInputEvent.kbd.flags = 0; + event.kbd.keycode = _queuedInputEvent.kbd.keycode = Common::KEYCODE_ESCAPE; + event.kbd.ascii = _queuedInputEvent.kbd.ascii = Common::ASCII_ESCAPE; + _needEventRestPeriod = true; + _lastSecondaryTap = 0; + } else if (!_mouseClickAndDragEnabled) { + //printf("Rightclick!\n"); + event.type = Common::EVENT_RBUTTONDOWN; + event.mouse.x = _mouseX; + event.mouse.y = _mouseY; + _queuedInputEvent.type = Common::EVENT_RBUTTONUP; + _queuedInputEvent.mouse.x = _mouseX; + _queuedInputEvent.mouse.y = _mouseY; + _lastSecondaryTap = curTime; + _needEventRestPeriod = true; + } else { + //printf("Right nothing!\n"); + return false; + } + } + if (_mouseClickAndDragEnabled) { + event.type = Common::EVENT_RBUTTONUP; + event.mouse.x = _mouseX; + event.mouse.y = _mouseY; + } + + return true; +} + +bool OSystem_IPHONE::handleEvent_mouseDragged(Common::Event &event, int x, int y) { + if (_lastDragPosX == x && _lastDragPosY == y) + return false; + + _lastDragPosX = x; + _lastDragPosY = y; + + //printf("Mouse dragged at (%u, %u)\n", x, y); + int mouseNewPosX; + int mouseNewPosY; + if (_touchpadModeEnabled ) { + int deltaX = _lastPadX - x; + int deltaY = _lastPadY - y; + _lastPadX = x; + _lastPadY = y; + + mouseNewPosX = (int)(_mouseX - deltaX / 0.5f); + mouseNewPosY = (int)(_mouseY - deltaY / 0.5f); + + if (mouseNewPosX < 0) + mouseNewPosX = 0; + else if (mouseNewPosX > _screenWidth) + mouseNewPosX = _screenWidth; + + if (mouseNewPosY < 0) + mouseNewPosY = 0; + else if (mouseNewPosY > _screenHeight) + mouseNewPosY = _screenHeight; + + } else { + mouseNewPosX = x; + mouseNewPosY = y; + } + + event.type = Common::EVENT_MOUSEMOVE; + event.mouse.x = mouseNewPosX; + event.mouse.y = mouseNewPosY; + warpMouse(mouseNewPosX, mouseNewPosY); + + return true; +} + +bool OSystem_IPHONE::handleEvent_mouseSecondDragged(Common::Event &event, int x, int y) { + if (_gestureStartX == -1 || _gestureStartY == -1) { + return false; + } + + static const int kNeededLength = 100; + static const int kMaxDeviation = 20; + + int vecX = (x - _gestureStartX); + int vecY = (y - _gestureStartY); + + int absX = abs(vecX); + int absY = abs(vecY); + + //printf("(%d, %d)\n", vecX, vecY); + + if (absX >= kNeededLength || absY >= kNeededLength) { // Long enough gesture to react upon. + _gestureStartX = -1; + _gestureStartY = -1; + + if (absX < kMaxDeviation && vecY >= kNeededLength) { + // Swipe down + event.type = Common::EVENT_KEYDOWN; + _queuedInputEvent.type = Common::EVENT_KEYUP; + + event.kbd.flags = _queuedInputEvent.kbd.flags = 0; + event.kbd.keycode = _queuedInputEvent.kbd.keycode = Common::KEYCODE_F5; + event.kbd.ascii = _queuedInputEvent.kbd.ascii = Common::ASCII_F5; + _needEventRestPeriod = true; + return true; + } + + if (absX < kMaxDeviation && -vecY >= kNeededLength) { + // Swipe up + _mouseClickAndDragEnabled = !_mouseClickAndDragEnabled; + const char *dialogMsg; + if (_mouseClickAndDragEnabled) { + _touchpadModeEnabled = false; + dialogMsg = "Mouse-click-and-drag mode enabled."; + } else + dialogMsg = "Mouse-click-and-drag mode disabled."; + GUI::TimedMessageDialog dialog(dialogMsg, 1500); + dialog.runModal(); + return false; + } + + if (absY < kMaxDeviation && vecX >= kNeededLength) { + // Swipe right + _touchpadModeEnabled = !_touchpadModeEnabled; + const char *dialogMsg; + if (_touchpadModeEnabled) + dialogMsg = "Touchpad mode enabled."; + else + dialogMsg = "Touchpad mode disabled."; + GUI::TimedMessageDialog dialog(dialogMsg, 1500); + dialog.runModal(); + return false; + + } + + if (absY < kMaxDeviation && -vecX >= kNeededLength) { + // Swipe left + return false; + } + } + + return false; +} + +void OSystem_IPHONE::handleEvent_orientationChanged(int orientation) { + //printf("Orientation: %i\n", orientation); + + ScreenOrientation newOrientation; + switch (orientation) { + case 1: + newOrientation = kScreenOrientationPortrait; + break; + case 3: + newOrientation = kScreenOrientationLandscape; + break; + case 4: + newOrientation = kScreenOrientationFlippedLandscape; + break; + default: + return; + } + + + if (_screenOrientation != newOrientation) { + _screenOrientation = newOrientation; + iPhone_initSurface(_screenWidth, _screenHeight); + + dirtyFullScreen(); + if (_overlayVisible) + dirtyFullOverlayScreen(); + updateScreen(); + } +} + +void OSystem_IPHONE::handleEvent_keyPressed(Common::Event &event, int keyPressed) { + int ascii = keyPressed; + //printf("key: %i\n", keyPressed); + + // We remap some of the iPhone keyboard keys. + // The first ten here are the row of symbols below the numeric keys. + switch (keyPressed) { + case 45: + keyPressed = Common::KEYCODE_F1; + ascii = Common::ASCII_F1; + break; + case 47: + keyPressed = Common::KEYCODE_F2; + ascii = Common::ASCII_F2; + break; + case 58: + keyPressed = Common::KEYCODE_F3; + ascii = Common::ASCII_F3; + break; + case 59: + keyPressed = Common::KEYCODE_F4; + ascii = Common::ASCII_F4; + break; + case 40: + keyPressed = Common::KEYCODE_F5; + ascii = Common::ASCII_F5; + break; + case 41: + keyPressed = Common::KEYCODE_F6; + ascii = Common::ASCII_F6; + break; + case 36: + keyPressed = Common::KEYCODE_F7; + ascii = Common::ASCII_F7; + break; + case 38: + keyPressed = Common::KEYCODE_F8; + ascii = Common::ASCII_F8; + break; + case 64: + keyPressed = Common::KEYCODE_F9; + ascii = Common::ASCII_F9; + break; + case 34: + keyPressed = Common::KEYCODE_F10; + ascii = Common::ASCII_F10; + break; + case 10: + keyPressed = Common::KEYCODE_RETURN; + ascii = Common::ASCII_RETURN; + break; + } + event.type = Common::EVENT_KEYDOWN; + _queuedInputEvent.type = Common::EVENT_KEYUP; + + event.kbd.flags = _queuedInputEvent.kbd.flags = 0; + event.kbd.keycode = _queuedInputEvent.kbd.keycode = (Common::KeyCode)keyPressed; + event.kbd.ascii = _queuedInputEvent.kbd.ascii = ascii; + _needEventRestPeriod = true; +} + +bool OSystem_IPHONE::handleEvent_swipe(Common::Event &event, int direction) { + Common::KeyCode keycode = Common::KEYCODE_INVALID; + switch (_screenOrientation) { + case kScreenOrientationPortrait: + switch ((UIViewSwipeDirection)direction) { + case kUIViewSwipeUp: + keycode = Common::KEYCODE_UP; + break; + case kUIViewSwipeDown: + keycode = Common::KEYCODE_DOWN; + break; + case kUIViewSwipeLeft: + keycode = Common::KEYCODE_LEFT; + break; + case kUIViewSwipeRight: + keycode = Common::KEYCODE_RIGHT; + break; + default: + return false; + } + break; + case kScreenOrientationLandscape: + switch ((UIViewSwipeDirection)direction) { + case kUIViewSwipeUp: + keycode = Common::KEYCODE_LEFT; + break; + case kUIViewSwipeDown: + keycode = Common::KEYCODE_RIGHT; + break; + case kUIViewSwipeLeft: + keycode = Common::KEYCODE_DOWN; + break; + case kUIViewSwipeRight: + keycode = Common::KEYCODE_UP; + break; + default: + return false; + } + break; + case kScreenOrientationFlippedLandscape: + switch ((UIViewSwipeDirection)direction) { + case kUIViewSwipeUp: + keycode = Common::KEYCODE_RIGHT; + break; + case kUIViewSwipeDown: + keycode = Common::KEYCODE_LEFT; + break; + case kUIViewSwipeLeft: + keycode = Common::KEYCODE_UP; + break; + case kUIViewSwipeRight: + keycode = Common::KEYCODE_DOWN; + break; + default: + return false; + } + break; + } + + event.kbd.keycode = _queuedInputEvent.kbd.keycode = keycode; + event.kbd.ascii = _queuedInputEvent.kbd.ascii = 0; + event.type = Common::EVENT_KEYDOWN; + _queuedInputEvent.type = Common::EVENT_KEYUP; + event.kbd.flags = _queuedInputEvent.kbd.flags = 0; + _needEventRestPeriod = true; + + return true; +} diff --git a/backends/platform/iphone/osys_iphone.cpp b/backends/platform/iphone/osys_iphone.cpp deleted file mode 100644 index 7f30c0caaf..0000000000 --- a/backends/platform/iphone/osys_iphone.cpp +++ /dev/null @@ -1,1303 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#include -#include - -#include - -#include "common/scummsys.h" -#include "common/util.h" -#include "common/rect.h" -#include "common/file.h" -#include "common/fs.h" - -#include "base/main.h" - -#include "backends/saves/default/default-saves.h" -#include "backends/timer/default/default-timer.h" -#include "sound/mixer.h" -#include "sound/mixer_intern.h" -#include "gui/message.h" - -#include "osys_iphone.h" - - -const OSystem::GraphicsMode OSystem_IPHONE::s_supportedGraphicsModes[] = { - {0, 0, 0} -}; - -AQCallbackStruct OSystem_IPHONE::s_AudioQueue; -SoundProc OSystem_IPHONE::s_soundCallback = NULL; -void *OSystem_IPHONE::s_soundParam = NULL; - -OSystem_IPHONE::OSystem_IPHONE() : - _savefile(NULL), _mixer(NULL), _timer(NULL), _offscreen(NULL), - _overlayVisible(false), _overlayBuffer(NULL), _fullscreen(NULL), - _mouseHeight(0), _mouseWidth(0), _mouseBuf(NULL), _lastMouseTap(0), - _secondaryTapped(false), _lastSecondaryTap(0), _screenOrientation(kScreenOrientationFlippedLandscape), - _needEventRestPeriod(false), _mouseClickAndDragEnabled(false), _touchpadModeEnabled(true), - _gestureStartX(-1), _gestureStartY(-1), _fullScreenIsDirty(false), _fullScreenOverlayIsDirty(false), - _mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1), _screenChangeCount(0) - -{ - _queuedInputEvent.type = (Common::EventType)0; - _lastDrawnMouseRect = Common::Rect(0, 0, 0, 0); - - _fsFactory = new POSIXFilesystemFactory(); -} - -OSystem_IPHONE::~OSystem_IPHONE() { - AudioQueueDispose(s_AudioQueue.queue, true); - - delete _fsFactory; - delete _savefile; - delete _mixer; - delete _timer; - delete _offscreen; - delete _fullscreen; -} - -int OSystem_IPHONE::timerHandler(int t) { - DefaultTimerManager *tm = (DefaultTimerManager *)g_system->getTimerManager(); - tm->handler(); - return t; -} - -void OSystem_IPHONE::initBackend() { -#ifdef IPHONE_OFFICIAL - _savefile = new DefaultSaveFileManager(iPhone_getDocumentsDir()); -#else - _savefile = new DefaultSaveFileManager(SCUMMVM_SAVE_PATH); -#endif - - _timer = new DefaultTimerManager(); - - gettimeofday(&_startTime, NULL); - - setupMixer(); - - setTimerCallback(&OSystem_IPHONE::timerHandler, 10); - - OSystem::initBackend(); -} - -bool OSystem_IPHONE::hasFeature(Feature f) { - return false; -} - -void OSystem_IPHONE::setFeatureState(Feature f, bool enable) { -} - -bool OSystem_IPHONE::getFeatureState(Feature f) { - return false; -} - -const OSystem::GraphicsMode* OSystem_IPHONE::getSupportedGraphicsModes() const { - return s_supportedGraphicsModes; -} - - -int OSystem_IPHONE::getDefaultGraphicsMode() const { - return -1; -} - -bool OSystem_IPHONE::setGraphicsMode(const char *mode) { - return true; -} - -bool OSystem_IPHONE::setGraphicsMode(int mode) { - return true; -} - -int OSystem_IPHONE::getGraphicsMode() const { - return -1; -} - -void OSystem_IPHONE::initSize(uint width, uint height) { - //printf("initSize(%i, %i)\n", width, height); - - _screenWidth = width; - _screenHeight = height; - - free(_offscreen); - - _offscreen = (byte *)malloc(width * height); - bzero(_offscreen, width * height); - - free(_overlayBuffer); - - int fullSize = _screenWidth * _screenHeight * sizeof(OverlayColor); - _overlayBuffer = (OverlayColor *)malloc(fullSize); - clearOverlay(); - - free(_fullscreen); - - _fullscreen = (uint16 *)malloc(fullSize); - bzero(_fullscreen, fullSize); - - iPhone_initSurface(width, height); - - _fullScreenIsDirty = false; - dirtyFullScreen(); - _mouseVisible = false; - _screenChangeCount++; - updateScreen(); -} - -int16 OSystem_IPHONE::getHeight() { - return _screenHeight; -} - -int16 OSystem_IPHONE::getWidth() { - return _screenWidth; -} - -void OSystem_IPHONE::setPalette(const byte *colors, uint start, uint num) { - //printf("setPalette()\n"); - const byte *b = colors; - - for (uint i = start; i < start + num; ++i) { - _palette[i] = Graphics::RGBToColor >(b[0], b[1], b[2]); - b += 4; - } - - dirtyFullScreen(); -} - -void OSystem_IPHONE::grabPalette(byte *colors, uint start, uint num) { - //printf("grabPalette()\n"); -} - -void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { - //printf("copyRectToScreen(%i, %i, %i, %i)\n", x, y, w, h); - //Clip the coordinates - if (x < 0) { - w += x; - buf -= x; - x = 0; - } - - if (y < 0) { - h += y; - buf -= y * pitch; - y = 0; - } - - if (w > _screenWidth - x) { - w = _screenWidth - x; - } - - if (h > _screenHeight - y) { - h = _screenHeight - y; - } - - if (w <= 0 || h <= 0) - return; - - if (!_fullScreenIsDirty) { - _dirtyRects.push_back(Common::Rect(x, y, x + w, y + h)); - } - - - byte *dst = _offscreen + y * _screenWidth + x; - if (_screenWidth == pitch && pitch == w) - memcpy(dst, buf, h * w); - else { - do { - memcpy(dst, buf, w); - buf += pitch; - dst += _screenWidth; - } while (--h); - } -} - -void OSystem_IPHONE::clipRectToScreen(int16 &x, int16 &y, int16 &w, int16 &h) { - if (x < 0) { - w += x; - x = 0; - } - - if (y < 0) { - h += y; - y = 0; - } - - if (w > _screenWidth - x) - w = _screenWidth - x; - - if (h > _screenHeight - y) - h = _screenHeight - y; - - if (w < 0) { - w = 0; - } - - if (h < 0) { - h = 0; - } -} - -void OSystem_IPHONE::updateScreen() { - //printf("updateScreen(): %i dirty rects.\n", _dirtyRects.size()); - - if (_dirtyRects.size() == 0 && _dirtyOverlayRects.size() == 0 && !_mouseDirty) - return; - - internUpdateScreen(); - _fullScreenIsDirty = false; - _fullScreenOverlayIsDirty = false; - - iPhone_updateScreen(); -} - -void OSystem_IPHONE::internUpdateScreen() { - int16 mouseX = _mouseX - _mouseHotspotX; - int16 mouseY = _mouseY - _mouseHotspotY; - int16 mouseWidth = _mouseWidth; - int16 mouseHeight = _mouseHeight; - - clipRectToScreen(mouseX, mouseY, mouseWidth, mouseHeight); - - Common::Rect mouseRect(mouseX, mouseY, mouseX + mouseWidth, mouseY + mouseHeight); - - if (_mouseDirty) { - if (!_fullScreenIsDirty) { - _dirtyRects.push_back(_lastDrawnMouseRect); - _dirtyRects.push_back(mouseRect); - } - if (!_fullScreenOverlayIsDirty && _overlayVisible) { - _dirtyOverlayRects.push_back(_lastDrawnMouseRect); - _dirtyOverlayRects.push_back(mouseRect); - } - _mouseDirty = false; - _lastDrawnMouseRect = mouseRect; - } - - while (_dirtyRects.size()) { - Common::Rect dirtyRect = _dirtyRects.remove_at(_dirtyRects.size() - 1); - - //printf("Drawing: (%i, %i) -> (%i, %i)\n", dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom); - - drawDirtyRect(dirtyRect); - - if (_overlayVisible) - drawDirtyOverlayRect(dirtyRect); - - drawMouseCursorOnRectUpdate(dirtyRect, mouseRect); - updateHardwareSurfaceForRect(dirtyRect); - } - - if (_overlayVisible) { - while (_dirtyOverlayRects.size()) { - Common::Rect dirtyRect = _dirtyOverlayRects.remove_at(_dirtyOverlayRects.size() - 1); - - //printf("Drawing: (%i, %i) -> (%i, %i)\n", dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom); - - drawDirtyOverlayRect(dirtyRect); - drawMouseCursorOnRectUpdate(dirtyRect, mouseRect); - updateHardwareSurfaceForRect(dirtyRect); - } - } -} - -void OSystem_IPHONE::drawDirtyRect(const Common::Rect& dirtyRect) { - int h = dirtyRect.bottom - dirtyRect.top; - int w = dirtyRect.right - dirtyRect.left; - - byte *src = &_offscreen[dirtyRect.top * _screenWidth + dirtyRect.left]; - uint16 *dst = &_fullscreen[dirtyRect.top * _screenWidth + dirtyRect.left]; - for (int y = h; y > 0; y--) { - for (int x = w; x > 0; x--) - *dst++ = _palette[*src++]; - - dst += _screenWidth - w; - src += _screenWidth - w; - } -} - -void OSystem_IPHONE::drawDirtyOverlayRect(const Common::Rect& dirtyRect) { - int h = dirtyRect.bottom - dirtyRect.top; - - uint16 *src = (uint16 *)&_overlayBuffer[dirtyRect.top * _screenWidth + dirtyRect.left]; - uint16 *dst = &_fullscreen[dirtyRect.top * _screenWidth + dirtyRect.left]; - int x = (dirtyRect.right - dirtyRect.left) * 2; - for (int y = h; y > 0; y--) { - memcpy(dst, src, x); - src += _screenWidth; - dst += _screenWidth; - } -} - -void OSystem_IPHONE::drawMouseCursorOnRectUpdate(const Common::Rect& updatedRect, const Common::Rect& mouseRect) { - //draw mouse on top - if (_mouseVisible && (updatedRect.intersects(mouseRect))) { - int srcX = 0; - int srcY = 0; - int left = _mouseX - _mouseHotspotX; - if (left < 0) { - srcX -= left; - left = 0; - } - int top = _mouseY - _mouseHotspotY; - if (top < 0) { - srcY -= top; - top = 0; - } - //int right = left + _mouseWidth; - int bottom = top + _mouseHeight; - if (bottom > _screenWidth) - bottom = _screenWidth; - int displayWidth = _mouseWidth; - if (_mouseWidth + left > _screenWidth) - displayWidth = _screenWidth - left; - int displayHeight = _mouseHeight; - if (_mouseHeight + top > _screenHeight) - displayHeight = _screenHeight - top; - byte *src = &_mouseBuf[srcY * _mouseWidth + srcX]; - uint16 *dst = &_fullscreen[top * _screenWidth + left]; - for (int y = displayHeight; y > srcY; y--) { - for (int x = displayWidth; x > srcX; x--) { - if (*src != _mouseKeyColour) - *dst = _palette[*src]; - dst++; - src++; - } - dst += _screenWidth - displayWidth + srcX; - src += _mouseWidth - displayWidth + srcX; - } - } -} - -void OSystem_IPHONE::updateHardwareSurfaceForRect(const Common::Rect& updatedRect) { - iPhone_updateScreenRect(_fullscreen, updatedRect.left, updatedRect.top, updatedRect.right, updatedRect.bottom ); -} - -Graphics::Surface *OSystem_IPHONE::lockScreen() { - //printf("lockScreen()\n"); - - _framebuffer.pixels = _offscreen; - _framebuffer.w = _screenWidth; - _framebuffer.h = _screenHeight; - _framebuffer.pitch = _screenWidth; - _framebuffer.bytesPerPixel = 1; - - return &_framebuffer; -} - -void OSystem_IPHONE::unlockScreen() { - //printf("unlockScreen()\n"); - dirtyFullScreen(); -} - -void OSystem_IPHONE::setShakePos(int shakeOffset) { - //printf("setShakePos(%i)\n", shakeOffset); -} - -void OSystem_IPHONE::showOverlay() { - //printf("showOverlay()\n"); - _overlayVisible = true; - dirtyFullOverlayScreen(); -} - -void OSystem_IPHONE::hideOverlay() { - //printf("hideOverlay()\n"); - _overlayVisible = false; - _dirtyOverlayRects.clear(); - dirtyFullScreen(); -} - -void OSystem_IPHONE::clearOverlay() { - //printf("clearOverlay()\n"); - bzero(_overlayBuffer, _screenWidth * _screenHeight * sizeof(OverlayColor)); - dirtyFullOverlayScreen(); -} - -void OSystem_IPHONE::grabOverlay(OverlayColor *buf, int pitch) { - //printf("grabOverlay()\n"); - int h = _screenHeight; - OverlayColor *src = _overlayBuffer; - - do { - memcpy(buf, src, _screenWidth * sizeof(OverlayColor)); - src += _screenWidth; - buf += pitch; - } while (--h); -} - -void OSystem_IPHONE::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { - //printf("copyRectToOverlay(buf, pitch=%i, x=%i, y=%i, w=%i, h=%i)\n", pitch, x, y, w, h); - - //Clip the coordinates - if (x < 0) { - w += x; - buf -= x; - x = 0; - } - - if (y < 0) { - h += y; - buf -= y * pitch; - y = 0; - } - - if (w > _screenWidth - x) - w = _screenWidth - x; - - if (h > _screenHeight - y) - h = _screenHeight - y; - - if (w <= 0 || h <= 0) - return; - - if (!_fullScreenOverlayIsDirty) { - _dirtyOverlayRects.push_back(Common::Rect(x, y, x + w, y + h)); - } - - OverlayColor *dst = _overlayBuffer + (y * _screenWidth + x); - if (_screenWidth == pitch && pitch == w) - memcpy(dst, buf, h * w * sizeof(OverlayColor)); - else { - do { - memcpy(dst, buf, w * sizeof(OverlayColor)); - buf += pitch; - dst += _screenWidth; - } while (--h); - } -} - -int16 OSystem_IPHONE::getOverlayHeight() { - return _screenHeight; -} - -int16 OSystem_IPHONE::getOverlayWidth() { - return _screenWidth; -} - -bool OSystem_IPHONE::showMouse(bool visible) { - bool last = _mouseVisible; - _mouseVisible = visible; - _mouseDirty = true; - - return last; -} - -void OSystem_IPHONE::warpMouse(int x, int y) { - //printf("warpMouse()\n"); - - _mouseX = x; - _mouseY = y; - _mouseDirty = true; -} - -void OSystem_IPHONE::dirtyFullScreen() { - if (!_fullScreenIsDirty) { - _dirtyRects.clear(); - _dirtyRects.push_back(Common::Rect(0, 0, _screenWidth, _screenHeight)); - _fullScreenIsDirty = true; - } -} - -void OSystem_IPHONE::dirtyFullOverlayScreen() { - if (!_fullScreenOverlayIsDirty) { - _dirtyOverlayRects.clear(); - _dirtyOverlayRects.push_back(Common::Rect(0, 0, _screenWidth, _screenHeight)); - _fullScreenOverlayIsDirty = true; - } -} - -void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int cursorTargetScale) { - //printf("setMouseCursor(%i, %i)\n", hotspotX, hotspotY); - - if (_mouseBuf != NULL && (_mouseWidth != w || _mouseHeight != h)) { - free(_mouseBuf); - _mouseBuf = NULL; - } - - if (_mouseBuf == NULL) - _mouseBuf = (byte *)malloc(w * h); - - _mouseWidth = w; - _mouseHeight = h; - - _mouseHotspotX = hotspotX; - _mouseHotspotY = hotspotY; - - _mouseKeyColour = keycolor; - - memcpy(_mouseBuf, buf, w * h); - - _mouseDirty = true; -} - -bool OSystem_IPHONE::pollEvent(Common::Event &event) { - //printf("pollEvent()\n"); - - long curTime = getMillis(); - - if (_timerCallback && (curTime >= _timerCallbackNext)) { - _timerCallback(_timerCallbackTimer); - _timerCallbackNext = curTime + _timerCallbackTimer; - } - - if (_needEventRestPeriod) { - // Workaround: Some engines can't handle mouse-down and mouse-up events - // appearing right after each other, without a call returning no input in between. - _needEventRestPeriod = false; - return false; - } - - if (_queuedInputEvent.type != (Common::EventType)0) { - event = _queuedInputEvent; - _queuedInputEvent.type = (Common::EventType)0; - return true; - } - - int eventType; - float xUnit, yUnit; - - if (iPhone_fetchEvent(&eventType, &xUnit, &yUnit)) { - int x = 0; - int y = 0; - switch (_screenOrientation) { - case kScreenOrientationPortrait: - x = (int)(xUnit * _screenWidth); - y = (int)(yUnit * _screenHeight); - break; - case kScreenOrientationLandscape: - x = (int)(yUnit * _screenWidth); - y = (int)((1.0 - xUnit) * _screenHeight); - break; - case kScreenOrientationFlippedLandscape: - x = (int)((1.0 - yUnit) * _screenWidth); - y = (int)(xUnit * _screenHeight); - break; - } - - switch ((InputEvent)eventType) { - case kInputMouseDown: - if (!handleEvent_mouseDown(event, x, y)) - return false; - break; - - case kInputMouseUp: - if (!handleEvent_mouseUp(event, x, y)) - return false; - break; - - case kInputMouseDragged: - if (!handleEvent_mouseDragged(event, x, y)) - return false; - break; - case kInputMouseSecondDragged: - if (!handleEvent_mouseSecondDragged(event, x, y)) - return false; - break; - case kInputMouseSecondDown: - _secondaryTapped = true; - if (!handleEvent_secondMouseDown(event, x, y)) - return false; - break; - case kInputMouseSecondUp: - _secondaryTapped = false; - if (!handleEvent_secondMouseUp(event, x, y)) - return false; - break; - case kInputOrientationChanged: - handleEvent_orientationChanged((int)xUnit); - return false; - break; - - case kInputApplicationSuspended: - suspendLoop(); - return false; - break; - - case kInputKeyPressed: - handleEvent_keyPressed(event, (int)xUnit); - break; - - case kInputSwipe: - if (!handleEvent_swipe(event, (int)xUnit)) - return false; - break; - - default: - break; - } - - return true; - } - return false; -} - -bool OSystem_IPHONE::handleEvent_mouseDown(Common::Event &event, int x, int y) { - //printf("Mouse down at (%u, %u)\n", x, y); - - // Workaround: kInputMouseSecondToggled isn't always sent when the - // secondary finger is lifted. Need to make sure we get out of that mode. - _secondaryTapped = false; - - if (_touchpadModeEnabled) { - _lastPadX = x; - _lastPadY = y; - } else - warpMouse(x, y); - - if (_mouseClickAndDragEnabled) { - event.type = Common::EVENT_LBUTTONDOWN; - event.mouse.x = _mouseX; - event.mouse.y = _mouseY; - return true; - } else { - _lastMouseDown = getMillis(); - } - return false; -} - -bool OSystem_IPHONE::handleEvent_mouseUp(Common::Event &event, int x, int y) { - //printf("Mouse up at (%u, %u)\n", x, y); - - if (_secondaryTapped) { - _secondaryTapped = false; - if (!handleEvent_secondMouseUp(event, x, y)) - return false; - } - else if (_mouseClickAndDragEnabled) { - event.type = Common::EVENT_LBUTTONUP; - event.mouse.x = _mouseX; - event.mouse.y = _mouseY; - } else { - if (getMillis() - _lastMouseDown < 250) { - event.type = Common::EVENT_LBUTTONDOWN; - event.mouse.x = _mouseX; - event.mouse.y = _mouseY; - - _queuedInputEvent.type = Common::EVENT_LBUTTONUP; - _queuedInputEvent.mouse.x = _mouseX; - _queuedInputEvent.mouse.y = _mouseY; - _lastMouseTap = getMillis(); - _needEventRestPeriod = true; - } else - return false; - } - - return true; -} - -bool OSystem_IPHONE::handleEvent_secondMouseDown(Common::Event &event, int x, int y) { - _lastSecondaryDown = getMillis(); - _gestureStartX = x; - _gestureStartY = y; - - if (_mouseClickAndDragEnabled) { - event.type = Common::EVENT_LBUTTONUP; - event.mouse.x = _mouseX; - event.mouse.y = _mouseY; - - _queuedInputEvent.type = Common::EVENT_RBUTTONDOWN; - _queuedInputEvent.mouse.x = _mouseX; - _queuedInputEvent.mouse.y = _mouseY; - } - else - return false; - - return true; -} - -bool OSystem_IPHONE::handleEvent_secondMouseUp(Common::Event &event, int x, int y) { - int curTime = getMillis(); - - if (curTime - _lastSecondaryDown < 400 ) { - //printf("Right tap!\n"); - if (curTime - _lastSecondaryTap < 400 && !_overlayVisible) { - //printf("Right escape!\n"); - event.type = Common::EVENT_KEYDOWN; - _queuedInputEvent.type = Common::EVENT_KEYUP; - - event.kbd.flags = _queuedInputEvent.kbd.flags = 0; - event.kbd.keycode = _queuedInputEvent.kbd.keycode = Common::KEYCODE_ESCAPE; - event.kbd.ascii = _queuedInputEvent.kbd.ascii = Common::ASCII_ESCAPE; - _needEventRestPeriod = true; - _lastSecondaryTap = 0; - } else if (!_mouseClickAndDragEnabled) { - //printf("Rightclick!\n"); - event.type = Common::EVENT_RBUTTONDOWN; - event.mouse.x = _mouseX; - event.mouse.y = _mouseY; - _queuedInputEvent.type = Common::EVENT_RBUTTONUP; - _queuedInputEvent.mouse.x = _mouseX; - _queuedInputEvent.mouse.y = _mouseY; - _lastSecondaryTap = curTime; - _needEventRestPeriod = true; - } else { - //printf("Right nothing!\n"); - return false; - } - } - if (_mouseClickAndDragEnabled) { - event.type = Common::EVENT_RBUTTONUP; - event.mouse.x = _mouseX; - event.mouse.y = _mouseY; - } - - return true; -} - -bool OSystem_IPHONE::handleEvent_mouseDragged(Common::Event &event, int x, int y) { - if (_lastDragPosX == x && _lastDragPosY == y) - return false; - - _lastDragPosX = x; - _lastDragPosY = y; - - //printf("Mouse dragged at (%u, %u)\n", x, y); - int mouseNewPosX; - int mouseNewPosY; - if (_touchpadModeEnabled ) { - int deltaX = _lastPadX - x; - int deltaY = _lastPadY - y; - _lastPadX = x; - _lastPadY = y; - - mouseNewPosX = (int)(_mouseX - deltaX / 0.5f); - mouseNewPosY = (int)(_mouseY - deltaY / 0.5f); - - if (mouseNewPosX < 0) - mouseNewPosX = 0; - else if (mouseNewPosX > _screenWidth) - mouseNewPosX = _screenWidth; - - if (mouseNewPosY < 0) - mouseNewPosY = 0; - else if (mouseNewPosY > _screenHeight) - mouseNewPosY = _screenHeight; - - } else { - mouseNewPosX = x; - mouseNewPosY = y; - } - - event.type = Common::EVENT_MOUSEMOVE; - event.mouse.x = mouseNewPosX; - event.mouse.y = mouseNewPosY; - warpMouse(mouseNewPosX, mouseNewPosY); - - return true; -} - -bool OSystem_IPHONE::handleEvent_mouseSecondDragged(Common::Event &event, int x, int y) { - if (_gestureStartX == -1 || _gestureStartY == -1) { - return false; - } - - static const int kNeededLength = 100; - static const int kMaxDeviation = 20; - - int vecX = (x - _gestureStartX); - int vecY = (y - _gestureStartY); - - int absX = abs(vecX); - int absY = abs(vecY); - - //printf("(%d, %d)\n", vecX, vecY); - - if (absX >= kNeededLength || absY >= kNeededLength) { // Long enough gesture to react upon. - _gestureStartX = -1; - _gestureStartY = -1; - - if (absX < kMaxDeviation && vecY >= kNeededLength) { - // Swipe down - event.type = Common::EVENT_KEYDOWN; - _queuedInputEvent.type = Common::EVENT_KEYUP; - - event.kbd.flags = _queuedInputEvent.kbd.flags = 0; - event.kbd.keycode = _queuedInputEvent.kbd.keycode = Common::KEYCODE_F5; - event.kbd.ascii = _queuedInputEvent.kbd.ascii = Common::ASCII_F5; - _needEventRestPeriod = true; - return true; - } - - if (absX < kMaxDeviation && -vecY >= kNeededLength) { - // Swipe up - _mouseClickAndDragEnabled = !_mouseClickAndDragEnabled; - const char *dialogMsg; - if (_mouseClickAndDragEnabled) { - _touchpadModeEnabled = false; - dialogMsg = "Mouse-click-and-drag mode enabled."; - } else - dialogMsg = "Mouse-click-and-drag mode disabled."; - GUI::TimedMessageDialog dialog(dialogMsg, 1500); - dialog.runModal(); - return false; - } - - if (absY < kMaxDeviation && vecX >= kNeededLength) { - // Swipe right - _touchpadModeEnabled = !_touchpadModeEnabled; - const char *dialogMsg; - if (_touchpadModeEnabled) - dialogMsg = "Touchpad mode enabled."; - else - dialogMsg = "Touchpad mode disabled."; - GUI::TimedMessageDialog dialog(dialogMsg, 1500); - dialog.runModal(); - return false; - - } - - if (absY < kMaxDeviation && -vecX >= kNeededLength) { - // Swipe left - return false; - } - } - - return false; -} - -void OSystem_IPHONE::handleEvent_orientationChanged(int orientation) { - //printf("Orientation: %i\n", orientation); - - ScreenOrientation newOrientation; - switch (orientation) { - case 1: - newOrientation = kScreenOrientationPortrait; - break; - case 3: - newOrientation = kScreenOrientationLandscape; - break; - case 4: - newOrientation = kScreenOrientationFlippedLandscape; - break; - default: - return; - } - - - if (_screenOrientation != newOrientation) { - _screenOrientation = newOrientation; - iPhone_initSurface(_screenWidth, _screenHeight); - - dirtyFullScreen(); - if (_overlayVisible) - dirtyFullOverlayScreen(); - updateScreen(); - } -} - -void OSystem_IPHONE::handleEvent_keyPressed(Common::Event &event, int keyPressed) { - int ascii = keyPressed; - //printf("key: %i\n", keyPressed); - - // We remap some of the iPhone keyboard keys. - // The first ten here are the row of symbols below the numeric keys. - switch (keyPressed) { - case 45: - keyPressed = Common::KEYCODE_F1; - ascii = Common::ASCII_F1; - break; - case 47: - keyPressed = Common::KEYCODE_F2; - ascii = Common::ASCII_F2; - break; - case 58: - keyPressed = Common::KEYCODE_F3; - ascii = Common::ASCII_F3; - break; - case 59: - keyPressed = Common::KEYCODE_F4; - ascii = Common::ASCII_F4; - break; - case 40: - keyPressed = Common::KEYCODE_F5; - ascii = Common::ASCII_F5; - break; - case 41: - keyPressed = Common::KEYCODE_F6; - ascii = Common::ASCII_F6; - break; - case 36: - keyPressed = Common::KEYCODE_F7; - ascii = Common::ASCII_F7; - break; - case 38: - keyPressed = Common::KEYCODE_F8; - ascii = Common::ASCII_F8; - break; - case 64: - keyPressed = Common::KEYCODE_F9; - ascii = Common::ASCII_F9; - break; - case 34: - keyPressed = Common::KEYCODE_F10; - ascii = Common::ASCII_F10; - break; - case 10: - keyPressed = Common::KEYCODE_RETURN; - ascii = Common::ASCII_RETURN; - break; - } - event.type = Common::EVENT_KEYDOWN; - _queuedInputEvent.type = Common::EVENT_KEYUP; - - event.kbd.flags = _queuedInputEvent.kbd.flags = 0; - event.kbd.keycode = _queuedInputEvent.kbd.keycode = (Common::KeyCode)keyPressed; - event.kbd.ascii = _queuedInputEvent.kbd.ascii = ascii; - _needEventRestPeriod = true; -} - -bool OSystem_IPHONE::handleEvent_swipe(Common::Event &event, int direction) { - Common::KeyCode keycode = Common::KEYCODE_INVALID; - switch (_screenOrientation) { - case kScreenOrientationPortrait: - switch ((UIViewSwipeDirection)direction) { - case kUIViewSwipeUp: - keycode = Common::KEYCODE_UP; - break; - case kUIViewSwipeDown: - keycode = Common::KEYCODE_DOWN; - break; - case kUIViewSwipeLeft: - keycode = Common::KEYCODE_LEFT; - break; - case kUIViewSwipeRight: - keycode = Common::KEYCODE_RIGHT; - break; - default: - return false; - } - break; - case kScreenOrientationLandscape: - switch ((UIViewSwipeDirection)direction) { - case kUIViewSwipeUp: - keycode = Common::KEYCODE_LEFT; - break; - case kUIViewSwipeDown: - keycode = Common::KEYCODE_RIGHT; - break; - case kUIViewSwipeLeft: - keycode = Common::KEYCODE_DOWN; - break; - case kUIViewSwipeRight: - keycode = Common::KEYCODE_UP; - break; - default: - return false; - } - break; - case kScreenOrientationFlippedLandscape: - switch ((UIViewSwipeDirection)direction) { - case kUIViewSwipeUp: - keycode = Common::KEYCODE_RIGHT; - break; - case kUIViewSwipeDown: - keycode = Common::KEYCODE_LEFT; - break; - case kUIViewSwipeLeft: - keycode = Common::KEYCODE_UP; - break; - case kUIViewSwipeRight: - keycode = Common::KEYCODE_DOWN; - break; - default: - return false; - } - break; - } - - event.kbd.keycode = _queuedInputEvent.kbd.keycode = keycode; - event.kbd.ascii = _queuedInputEvent.kbd.ascii = 0; - event.type = Common::EVENT_KEYDOWN; - _queuedInputEvent.type = Common::EVENT_KEYUP; - event.kbd.flags = _queuedInputEvent.kbd.flags = 0; - _needEventRestPeriod = true; - - return true; -} - -void OSystem_IPHONE::suspendLoop() { - bool done = false; - int eventType; - float xUnit, yUnit; - uint32 startTime = getMillis(); - - stopSoundsystem(); - - while (!done) { - if (iPhone_fetchEvent(&eventType, &xUnit, &yUnit)) - if ((InputEvent)eventType == kInputApplicationResumed) - done = true; - usleep(100000); - } - - startSoundsystem(); - - _timeSuspended += getMillis() - startTime; -} - -uint32 OSystem_IPHONE::getMillis() { - //printf("getMillis()\n"); - - struct timeval currentTime; - gettimeofday(¤tTime, NULL); - return (uint32)(((currentTime.tv_sec - _startTime.tv_sec) * 1000) + - ((currentTime.tv_usec - _startTime.tv_usec) / 1000)) - _timeSuspended; -} - -void OSystem_IPHONE::delayMillis(uint msecs) { - //printf("delayMillis(%d)\n", msecs); - usleep(msecs * 1000); -} - -OSystem::MutexRef OSystem_IPHONE::createMutex(void) { - pthread_mutexattr_t attr; - pthread_mutexattr_init(&attr); - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); - - pthread_mutex_t *mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t)); - if (pthread_mutex_init(mutex, &attr) != 0) { - printf("pthread_mutex_init() failed!\n"); - free(mutex); - return NULL; - } - - return (MutexRef)mutex; -} - -void OSystem_IPHONE::lockMutex(MutexRef mutex) { - if (pthread_mutex_lock((pthread_mutex_t *) mutex) != 0) { - printf("pthread_mutex_lock() failed!\n"); - } -} - -void OSystem_IPHONE::unlockMutex(MutexRef mutex) { - if (pthread_mutex_unlock((pthread_mutex_t *) mutex) != 0) { - printf("pthread_mutex_unlock() failed!\n"); - } -} - -void OSystem_IPHONE::deleteMutex(MutexRef mutex) { - if (pthread_mutex_destroy((pthread_mutex_t *) mutex) != 0) { - printf("pthread_mutex_destroy() failed!\n"); - } else { - free(mutex); - } -} - -void OSystem_IPHONE::AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBufferRef outQB) { - //printf("AQBufferCallback()\n"); - if (s_AudioQueue.frameCount > 0 && s_soundCallback != NULL) { - outQB->mAudioDataByteSize = 4 * s_AudioQueue.frameCount; - s_soundCallback(s_soundParam, (byte *)outQB->mAudioData, outQB->mAudioDataByteSize); - AudioQueueEnqueueBuffer(inQ, outQB, 0, NULL); - } else { - AudioQueueStop(s_AudioQueue.queue, false); - } -} - -void OSystem_IPHONE::mixCallback(void *sys, byte *samples, int len) { - OSystem_IPHONE *this_ = (OSystem_IPHONE *)sys; - assert(this_); - - if (this_->_mixer) { - this_->_mixer->mixCallback(samples, len); - } -} - -void OSystem_IPHONE::setupMixer() { - //printf("setSoundCallback()\n"); - _mixer = new Audio::MixerImpl(this); - - s_soundCallback = mixCallback; - s_soundParam = this; - - startSoundsystem(); -} - -void OSystem_IPHONE::startSoundsystem() { - s_AudioQueue.dataFormat.mSampleRate = AUDIO_SAMPLE_RATE; - s_AudioQueue.dataFormat.mFormatID = kAudioFormatLinearPCM; - s_AudioQueue.dataFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked; - s_AudioQueue.dataFormat.mBytesPerPacket = 4; - s_AudioQueue.dataFormat.mFramesPerPacket = 1; - s_AudioQueue.dataFormat.mBytesPerFrame = 4; - s_AudioQueue.dataFormat.mChannelsPerFrame = 2; - s_AudioQueue.dataFormat.mBitsPerChannel = 16; - s_AudioQueue.frameCount = WAVE_BUFFER_SIZE; - - if (AudioQueueNewOutput(&s_AudioQueue.dataFormat, AQBufferCallback, &s_AudioQueue, 0, kCFRunLoopCommonModes, 0, &s_AudioQueue.queue)) { - printf("Couldn't set the AudioQueue callback!\n"); - _mixer->setReady(false); - return; - } - - uint32 bufferBytes = s_AudioQueue.frameCount * s_AudioQueue.dataFormat.mBytesPerFrame; - - for (int i = 0; i < AUDIO_BUFFERS; i++) { - if (AudioQueueAllocateBuffer(s_AudioQueue.queue, bufferBytes, &s_AudioQueue.buffers[i])) { - printf("Error allocating AudioQueue buffer!\n"); - _mixer->setReady(false); - return; - } - - AQBufferCallback(&s_AudioQueue, s_AudioQueue.queue, s_AudioQueue.buffers[i]); - } - - AudioQueueSetParameter(s_AudioQueue.queue, kAudioQueueParam_Volume, 1.0); - if (AudioQueueStart(s_AudioQueue.queue, NULL)) { - printf("Error starting the AudioQueue!\n"); - _mixer->setReady(false); - return; - } - - _mixer->setOutputRate(AUDIO_SAMPLE_RATE); - _mixer->setReady(true); -} - -void OSystem_IPHONE::stopSoundsystem() { - AudioQueueStop(s_AudioQueue.queue, true); - - for (int i = 0; i < AUDIO_BUFFERS; i++) { - AudioQueueFreeBuffer(s_AudioQueue.queue, s_AudioQueue.buffers[i]); - } - - AudioQueueDispose(s_AudioQueue.queue, true); - _mixer->setReady(false); -} - -int OSystem_IPHONE::getOutputSampleRate() const { - return AUDIO_SAMPLE_RATE; -} - -void OSystem_IPHONE::setTimerCallback(TimerProc callback, int interval) { - //printf("setTimerCallback()\n"); - - if (callback != NULL) { - _timerCallbackTimer = interval; - _timerCallbackNext = getMillis() + interval; - _timerCallback = callback; - } else - _timerCallback = NULL; -} - -void OSystem_IPHONE::quit() { -} - -void OSystem_IPHONE::getTimeAndDate(struct tm &t) const { - time_t curTime = time(0); - t = *localtime(&curTime); -} - -Common::SaveFileManager *OSystem_IPHONE::getSavefileManager() { - assert(_savefile); - return _savefile; -} - -Audio::Mixer *OSystem_IPHONE::getMixer() { - assert(_mixer); - return _mixer; -} - -Common::TimerManager *OSystem_IPHONE::getTimerManager() { - assert(_timer); - return _timer; -} - -OSystem *OSystem_IPHONE_create() { - return new OSystem_IPHONE(); -} - -Common::SeekableReadStream *OSystem_IPHONE::createConfigReadStream() { -#ifdef IPHONE_OFFICIAL - char buf[256]; - strncpy(buf, iPhone_getDocumentsDir(), 256); - strncat(buf, "/Preferences", 256 - strlen(buf) ); - Common::FSNode file(buf); -#else - Common::FSNode file(SCUMMVM_PREFS_PATH); -#endif - return file.createReadStream(); -} - -Common::WriteStream *OSystem_IPHONE::createConfigWriteStream() { -#ifdef IPHONE_OFFICIAL - char buf[256]; - strncpy(buf, iPhone_getDocumentsDir(), 256); - strncat(buf, "/Preferences", 256 - strlen(buf) ); - Common::FSNode file(buf); -#else - Common::FSNode file(SCUMMVM_PREFS_PATH); -#endif - return file.createWriteStream(); -} - -void OSystem_IPHONE::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) { - // Get URL of the Resource directory of the .app bundle - CFURLRef fileUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle()); - if (fileUrl) { - // Try to convert the URL to an absolute path - UInt8 buf[MAXPATHLEN]; - if (CFURLGetFileSystemRepresentation(fileUrl, true, buf, sizeof(buf))) { - // Success: Add it to the search path - Common::String bundlePath((const char *)buf); - s.add("__OSX_BUNDLE__", new Common::FSDirectory(bundlePath), priority); - } - CFRelease(fileUrl); - } -} - -void iphone_main(int argc, char *argv[]) { - - //OSystem_IPHONE::migrateApp(); - - FILE *newfp = fopen("/var/mobile/.scummvm.log", "a"); - if (newfp != NULL) { - fclose(stdout); - fclose(stderr); - *stdout = *newfp; - *stderr = *newfp; - setbuf(stdout, NULL); - setbuf(stderr, NULL); - - //extern int gDebugLevel; - //gDebugLevel = 10; - } - -#ifdef IPHONE_OFFICIAL - chdir( iPhone_getDocumentsDir() ); -#else - system("mkdir " SCUMMVM_ROOT_PATH); - system("mkdir " SCUMMVM_SAVE_PATH); - - chdir("/var/mobile/"); -#endif - - g_system = OSystem_IPHONE_create(); - assert(g_system); - - // Invoke the actual ScummVM main entry point: - scummvm_main(argc, argv); - g_system->quit(); // TODO: Consider removing / replacing this! -} diff --git a/backends/platform/iphone/osys_iphone.h b/backends/platform/iphone/osys_iphone.h deleted file mode 100644 index 705f89319a..0000000000 --- a/backends/platform/iphone/osys_iphone.h +++ /dev/null @@ -1,209 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#include "graphics/surface.h" -#include "iphone_common.h" -#include "backends/base-backend.h" -#include "common/events.h" -#include "sound/mixer_intern.h" -#include "backends/fs/posix/posix-fs-factory.h" -#include "graphics/colormasks.h" - -#include - -#define AUDIO_BUFFERS 3 -#define WAVE_BUFFER_SIZE 2048 -#define AUDIO_SAMPLE_RATE 44100 - -#define SCUMMVM_ROOT_PATH "/var/mobile/Library/ScummVM" -#define SCUMMVM_SAVE_PATH SCUMMVM_ROOT_PATH "/Savegames" -#define SCUMMVM_PREFS_PATH SCUMMVM_ROOT_PATH "/Preferences" - -typedef void (*SoundProc)(void *param, byte *buf, int len); -typedef int (*TimerProc)(int interval); - -typedef struct AQCallbackStruct { - AudioQueueRef queue; - uint32 frameCount; - AudioQueueBufferRef buffers[AUDIO_BUFFERS]; - AudioStreamBasicDescription dataFormat; -} AQCallbackStruct; - -class OSystem_IPHONE : public BaseBackend { -protected: - - static const OSystem::GraphicsMode s_supportedGraphicsModes[]; - static AQCallbackStruct s_AudioQueue; - static SoundProc s_soundCallback; - static void *s_soundParam; - - Common::SaveFileManager *_savefile; - Audio::MixerImpl *_mixer; - Common::TimerManager *_timer; - - Graphics::Surface _framebuffer; - byte *_offscreen; - OverlayColor *_overlayBuffer; - uint16 *_fullscreen; - - uint16 _palette[256]; - bool _overlayVisible; - uint16 _screenWidth; - uint16 _screenHeight; - - struct timeval _startTime; - uint32 _timeSuspended; - - bool _mouseVisible; - byte *_mouseBuf; - byte _mouseKeyColour; - uint _mouseWidth, _mouseHeight; - uint _mouseX, _mouseY; - int _mouseHotspotX, _mouseHotspotY; - bool _mouseDirty; - long _lastMouseDown; - long _lastMouseTap; - Common::Rect _lastDrawnMouseRect; - Common::Event _queuedInputEvent; - bool _needEventRestPeriod; - bool _secondaryTapped; - long _lastSecondaryDown; - long _lastSecondaryTap; - int _gestureStartX, _gestureStartY; - bool _mouseClickAndDragEnabled; - bool _touchpadModeEnabled; - int _lastPadX; - int _lastPadY; - int _lastDragPosX; - int _lastDragPosY; - - int _timerCallbackNext; - int _timerCallbackTimer; - TimerProc _timerCallback; - - Common::Array _dirtyRects; - Common::Array _dirtyOverlayRects; - ScreenOrientation _screenOrientation; - bool _fullScreenIsDirty; - bool _fullScreenOverlayIsDirty; - int _screenChangeCount; - FilesystemFactory *_fsFactory; - -public: - - OSystem_IPHONE(); - virtual ~OSystem_IPHONE(); - - virtual void initBackend(); - - virtual bool hasFeature(Feature f); - virtual void setFeatureState(Feature f, bool enable); - virtual bool getFeatureState(Feature f); - virtual const GraphicsMode *getSupportedGraphicsModes() const; - virtual int getDefaultGraphicsMode() const; - bool setGraphicsMode(const char *name); - virtual bool setGraphicsMode(int mode); - virtual int getGraphicsMode() const; - virtual void initSize(uint width, uint height); - virtual int16 getHeight(); - virtual int16 getWidth(); - virtual void setPalette(const byte *colors, uint start, uint num); - virtual void grabPalette(byte *colors, uint start, uint num); - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); - virtual void updateScreen(); - virtual Graphics::Surface *lockScreen(); - virtual void unlockScreen(); - virtual void setShakePos(int shakeOffset); - - virtual void showOverlay(); - virtual void hideOverlay(); - virtual void clearOverlay(); - virtual void grabOverlay(OverlayColor *buf, int pitch); - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); - virtual int16 getOverlayHeight(); - virtual int16 getOverlayWidth(); - virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<565>(); } - - virtual bool showMouse(bool visible); - - virtual void warpMouse(int x, int y); - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int cursorTargetScale = 1); - - virtual bool pollEvent(Common::Event &event); - virtual uint32 getMillis(); - virtual void delayMillis(uint msecs); - - virtual MutexRef createMutex(void); - virtual void lockMutex(MutexRef mutex); - virtual void unlockMutex(MutexRef mutex); - virtual void deleteMutex(MutexRef mutex); - - static void mixCallback(void *sys, byte *samples, int len); - virtual void setupMixer(void); - virtual int getOutputSampleRate() const; - virtual void setTimerCallback(TimerProc callback, int interval); - virtual int getScreenChangeID() const { return _screenChangeCount; } - virtual void quit(); - - FilesystemFactory *getFilesystemFactory() { return _fsFactory; } - virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0); - virtual void getTimeAndDate(struct tm &t) const; - - virtual Common::SaveFileManager *getSavefileManager(); - virtual Audio::Mixer *getMixer(); - virtual Common::TimerManager *getTimerManager(); - - void startSoundsystem(); - void stopSoundsystem(); - - virtual Common::SeekableReadStream *createConfigReadStream(); - virtual Common::WriteStream *createConfigWriteStream(); - -protected: - void internUpdateScreen(); - void dirtyFullScreen(); - void dirtyFullOverlayScreen(); - void clipRectToScreen(int16 &x, int16 &y, int16 &w, int16 &h); - void suspendLoop(); - void drawDirtyRect(const Common::Rect& dirtyRect); - void drawDirtyOverlayRect(const Common::Rect& dirtyRect); - void drawMouseCursorOnRectUpdate(const Common::Rect& updatedRect, const Common::Rect& mouseRect); - void updateHardwareSurfaceForRect(const Common::Rect& updatedRect); - static void AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBufferRef outQB); - static int timerHandler(int t); - - bool handleEvent_swipe(Common::Event &event, int direction); - void handleEvent_keyPressed(Common::Event &event, int keyPressed); - void handleEvent_orientationChanged(int orientation); - - bool handleEvent_mouseDown(Common::Event &event, int x, int y); - bool handleEvent_mouseUp(Common::Event &event, int x, int y); - - bool handleEvent_secondMouseDown(Common::Event &event, int x, int y); - bool handleEvent_secondMouseUp(Common::Event &event, int x, int y); - - bool handleEvent_mouseDragged(Common::Event &event, int x, int y); - bool handleEvent_mouseSecondDragged(Common::Event &event, int x, int y); -}; diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp new file mode 100644 index 0000000000..eb2ecf8769 --- /dev/null +++ b/backends/platform/iphone/osys_main.cpp @@ -0,0 +1,296 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include +#include + +#include + +#include "common/scummsys.h" +#include "common/util.h" +#include "common/rect.h" +#include "common/file.h" +#include "common/fs.h" + +#include "base/main.h" + +#include "backends/saves/default/default-saves.h" +#include "backends/timer/default/default-timer.h" +#include "sound/mixer.h" +#include "sound/mixer_intern.h" + +#include "osys_main.h" + + +const OSystem::GraphicsMode OSystem_IPHONE::s_supportedGraphicsModes[] = { + {0, 0, 0} +}; + +AQCallbackStruct OSystem_IPHONE::s_AudioQueue; +SoundProc OSystem_IPHONE::s_soundCallback = NULL; +void *OSystem_IPHONE::s_soundParam = NULL; + +OSystem_IPHONE::OSystem_IPHONE() : + _savefile(NULL), _mixer(NULL), _timer(NULL), _offscreen(NULL), + _overlayVisible(false), _overlayBuffer(NULL), _fullscreen(NULL), + _mouseHeight(0), _mouseWidth(0), _mouseBuf(NULL), _lastMouseTap(0), + _secondaryTapped(false), _lastSecondaryTap(0), _screenOrientation(kScreenOrientationFlippedLandscape), + _needEventRestPeriod(false), _mouseClickAndDragEnabled(false), _touchpadModeEnabled(true), + _gestureStartX(-1), _gestureStartY(-1), _fullScreenIsDirty(false), _fullScreenOverlayIsDirty(false), + _mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1), _screenChangeCount(0) + +{ + _queuedInputEvent.type = (Common::EventType)0; + _lastDrawnMouseRect = Common::Rect(0, 0, 0, 0); + + _fsFactory = new POSIXFilesystemFactory(); +} + +OSystem_IPHONE::~OSystem_IPHONE() { + AudioQueueDispose(s_AudioQueue.queue, true); + + delete _fsFactory; + delete _savefile; + delete _mixer; + delete _timer; + delete _offscreen; + delete _fullscreen; +} + +int OSystem_IPHONE::timerHandler(int t) { + DefaultTimerManager *tm = (DefaultTimerManager *)g_system->getTimerManager(); + tm->handler(); + return t; +} + +void OSystem_IPHONE::initBackend() { +#ifdef IPHONE_OFFICIAL + _savefile = new DefaultSaveFileManager(iPhone_getDocumentsDir()); +#else + _savefile = new DefaultSaveFileManager(SCUMMVM_SAVE_PATH); +#endif + + _timer = new DefaultTimerManager(); + + gettimeofday(&_startTime, NULL); + + setupMixer(); + + setTimerCallback(&OSystem_IPHONE::timerHandler, 10); + + OSystem::initBackend(); +} + +bool OSystem_IPHONE::hasFeature(Feature f) { + return false; +} + +void OSystem_IPHONE::setFeatureState(Feature f, bool enable) { +} + +bool OSystem_IPHONE::getFeatureState(Feature f) { + return false; +} + +void OSystem_IPHONE::suspendLoop() { + bool done = false; + int eventType; + float xUnit, yUnit; + uint32 startTime = getMillis(); + + stopSoundsystem(); + + while (!done) { + if (iPhone_fetchEvent(&eventType, &xUnit, &yUnit)) + if ((InputEvent)eventType == kInputApplicationResumed) + done = true; + usleep(100000); + } + + startSoundsystem(); + + _timeSuspended += getMillis() - startTime; +} + +uint32 OSystem_IPHONE::getMillis() { + //printf("getMillis()\n"); + + struct timeval currentTime; + gettimeofday(¤tTime, NULL); + return (uint32)(((currentTime.tv_sec - _startTime.tv_sec) * 1000) + + ((currentTime.tv_usec - _startTime.tv_usec) / 1000)) - _timeSuspended; +} + +void OSystem_IPHONE::delayMillis(uint msecs) { + //printf("delayMillis(%d)\n", msecs); + usleep(msecs * 1000); +} + +OSystem::MutexRef OSystem_IPHONE::createMutex(void) { + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + + pthread_mutex_t *mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t)); + if (pthread_mutex_init(mutex, &attr) != 0) { + printf("pthread_mutex_init() failed!\n"); + free(mutex); + return NULL; + } + + return (MutexRef)mutex; +} + +void OSystem_IPHONE::lockMutex(MutexRef mutex) { + if (pthread_mutex_lock((pthread_mutex_t *) mutex) != 0) { + printf("pthread_mutex_lock() failed!\n"); + } +} + +void OSystem_IPHONE::unlockMutex(MutexRef mutex) { + if (pthread_mutex_unlock((pthread_mutex_t *) mutex) != 0) { + printf("pthread_mutex_unlock() failed!\n"); + } +} + +void OSystem_IPHONE::deleteMutex(MutexRef mutex) { + if (pthread_mutex_destroy((pthread_mutex_t *) mutex) != 0) { + printf("pthread_mutex_destroy() failed!\n"); + } else { + free(mutex); + } +} + + +void OSystem_IPHONE::setTimerCallback(TimerProc callback, int interval) { + //printf("setTimerCallback()\n"); + + if (callback != NULL) { + _timerCallbackTimer = interval; + _timerCallbackNext = getMillis() + interval; + _timerCallback = callback; + } else + _timerCallback = NULL; +} + +void OSystem_IPHONE::quit() { +} + +void OSystem_IPHONE::getTimeAndDate(struct tm &t) const { + time_t curTime = time(0); + t = *localtime(&curTime); +} + +Common::SaveFileManager *OSystem_IPHONE::getSavefileManager() { + assert(_savefile); + return _savefile; +} + +Audio::Mixer *OSystem_IPHONE::getMixer() { + assert(_mixer); + return _mixer; +} + +Common::TimerManager *OSystem_IPHONE::getTimerManager() { + assert(_timer); + return _timer; +} + +OSystem *OSystem_IPHONE_create() { + return new OSystem_IPHONE(); +} + +Common::SeekableReadStream *OSystem_IPHONE::createConfigReadStream() { +#ifdef IPHONE_OFFICIAL + char buf[256]; + strncpy(buf, iPhone_getDocumentsDir(), 256); + strncat(buf, "/Preferences", 256 - strlen(buf) ); + Common::FSNode file(buf); +#else + Common::FSNode file(SCUMMVM_PREFS_PATH); +#endif + return file.createReadStream(); +} + +Common::WriteStream *OSystem_IPHONE::createConfigWriteStream() { +#ifdef IPHONE_OFFICIAL + char buf[256]; + strncpy(buf, iPhone_getDocumentsDir(), 256); + strncat(buf, "/Preferences", 256 - strlen(buf) ); + Common::FSNode file(buf); +#else + Common::FSNode file(SCUMMVM_PREFS_PATH); +#endif + return file.createWriteStream(); +} + +void OSystem_IPHONE::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) { + // Get URL of the Resource directory of the .app bundle + CFURLRef fileUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle()); + if (fileUrl) { + // Try to convert the URL to an absolute path + UInt8 buf[MAXPATHLEN]; + if (CFURLGetFileSystemRepresentation(fileUrl, true, buf, sizeof(buf))) { + // Success: Add it to the search path + Common::String bundlePath((const char *)buf); + s.add("__OSX_BUNDLE__", new Common::FSDirectory(bundlePath), priority); + } + CFRelease(fileUrl); + } +} + +void iphone_main(int argc, char *argv[]) { + + //OSystem_IPHONE::migrateApp(); + + FILE *newfp = fopen("/var/mobile/.scummvm.log", "a"); + if (newfp != NULL) { + fclose(stdout); + fclose(stderr); + *stdout = *newfp; + *stderr = *newfp; + setbuf(stdout, NULL); + setbuf(stderr, NULL); + + //extern int gDebugLevel; + //gDebugLevel = 10; + } + +#ifdef IPHONE_OFFICIAL + chdir( iPhone_getDocumentsDir() ); +#else + system("mkdir " SCUMMVM_ROOT_PATH); + system("mkdir " SCUMMVM_SAVE_PATH); + + chdir("/var/mobile/"); +#endif + + g_system = OSystem_IPHONE_create(); + assert(g_system); + + // Invoke the actual ScummVM main entry point: + scummvm_main(argc, argv); + g_system->quit(); // TODO: Consider removing / replacing this! +} diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h new file mode 100644 index 0000000000..705f89319a --- /dev/null +++ b/backends/platform/iphone/osys_main.h @@ -0,0 +1,209 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "graphics/surface.h" +#include "iphone_common.h" +#include "backends/base-backend.h" +#include "common/events.h" +#include "sound/mixer_intern.h" +#include "backends/fs/posix/posix-fs-factory.h" +#include "graphics/colormasks.h" + +#include + +#define AUDIO_BUFFERS 3 +#define WAVE_BUFFER_SIZE 2048 +#define AUDIO_SAMPLE_RATE 44100 + +#define SCUMMVM_ROOT_PATH "/var/mobile/Library/ScummVM" +#define SCUMMVM_SAVE_PATH SCUMMVM_ROOT_PATH "/Savegames" +#define SCUMMVM_PREFS_PATH SCUMMVM_ROOT_PATH "/Preferences" + +typedef void (*SoundProc)(void *param, byte *buf, int len); +typedef int (*TimerProc)(int interval); + +typedef struct AQCallbackStruct { + AudioQueueRef queue; + uint32 frameCount; + AudioQueueBufferRef buffers[AUDIO_BUFFERS]; + AudioStreamBasicDescription dataFormat; +} AQCallbackStruct; + +class OSystem_IPHONE : public BaseBackend { +protected: + + static const OSystem::GraphicsMode s_supportedGraphicsModes[]; + static AQCallbackStruct s_AudioQueue; + static SoundProc s_soundCallback; + static void *s_soundParam; + + Common::SaveFileManager *_savefile; + Audio::MixerImpl *_mixer; + Common::TimerManager *_timer; + + Graphics::Surface _framebuffer; + byte *_offscreen; + OverlayColor *_overlayBuffer; + uint16 *_fullscreen; + + uint16 _palette[256]; + bool _overlayVisible; + uint16 _screenWidth; + uint16 _screenHeight; + + struct timeval _startTime; + uint32 _timeSuspended; + + bool _mouseVisible; + byte *_mouseBuf; + byte _mouseKeyColour; + uint _mouseWidth, _mouseHeight; + uint _mouseX, _mouseY; + int _mouseHotspotX, _mouseHotspotY; + bool _mouseDirty; + long _lastMouseDown; + long _lastMouseTap; + Common::Rect _lastDrawnMouseRect; + Common::Event _queuedInputEvent; + bool _needEventRestPeriod; + bool _secondaryTapped; + long _lastSecondaryDown; + long _lastSecondaryTap; + int _gestureStartX, _gestureStartY; + bool _mouseClickAndDragEnabled; + bool _touchpadModeEnabled; + int _lastPadX; + int _lastPadY; + int _lastDragPosX; + int _lastDragPosY; + + int _timerCallbackNext; + int _timerCallbackTimer; + TimerProc _timerCallback; + + Common::Array _dirtyRects; + Common::Array _dirtyOverlayRects; + ScreenOrientation _screenOrientation; + bool _fullScreenIsDirty; + bool _fullScreenOverlayIsDirty; + int _screenChangeCount; + FilesystemFactory *_fsFactory; + +public: + + OSystem_IPHONE(); + virtual ~OSystem_IPHONE(); + + virtual void initBackend(); + + virtual bool hasFeature(Feature f); + virtual void setFeatureState(Feature f, bool enable); + virtual bool getFeatureState(Feature f); + virtual const GraphicsMode *getSupportedGraphicsModes() const; + virtual int getDefaultGraphicsMode() const; + bool setGraphicsMode(const char *name); + virtual bool setGraphicsMode(int mode); + virtual int getGraphicsMode() const; + virtual void initSize(uint width, uint height); + virtual int16 getHeight(); + virtual int16 getWidth(); + virtual void setPalette(const byte *colors, uint start, uint num); + virtual void grabPalette(byte *colors, uint start, uint num); + virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); + virtual void updateScreen(); + virtual Graphics::Surface *lockScreen(); + virtual void unlockScreen(); + virtual void setShakePos(int shakeOffset); + + virtual void showOverlay(); + virtual void hideOverlay(); + virtual void clearOverlay(); + virtual void grabOverlay(OverlayColor *buf, int pitch); + virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + virtual int16 getOverlayHeight(); + virtual int16 getOverlayWidth(); + virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<565>(); } + + virtual bool showMouse(bool visible); + + virtual void warpMouse(int x, int y); + virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int cursorTargetScale = 1); + + virtual bool pollEvent(Common::Event &event); + virtual uint32 getMillis(); + virtual void delayMillis(uint msecs); + + virtual MutexRef createMutex(void); + virtual void lockMutex(MutexRef mutex); + virtual void unlockMutex(MutexRef mutex); + virtual void deleteMutex(MutexRef mutex); + + static void mixCallback(void *sys, byte *samples, int len); + virtual void setupMixer(void); + virtual int getOutputSampleRate() const; + virtual void setTimerCallback(TimerProc callback, int interval); + virtual int getScreenChangeID() const { return _screenChangeCount; } + virtual void quit(); + + FilesystemFactory *getFilesystemFactory() { return _fsFactory; } + virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0); + virtual void getTimeAndDate(struct tm &t) const; + + virtual Common::SaveFileManager *getSavefileManager(); + virtual Audio::Mixer *getMixer(); + virtual Common::TimerManager *getTimerManager(); + + void startSoundsystem(); + void stopSoundsystem(); + + virtual Common::SeekableReadStream *createConfigReadStream(); + virtual Common::WriteStream *createConfigWriteStream(); + +protected: + void internUpdateScreen(); + void dirtyFullScreen(); + void dirtyFullOverlayScreen(); + void clipRectToScreen(int16 &x, int16 &y, int16 &w, int16 &h); + void suspendLoop(); + void drawDirtyRect(const Common::Rect& dirtyRect); + void drawDirtyOverlayRect(const Common::Rect& dirtyRect); + void drawMouseCursorOnRectUpdate(const Common::Rect& updatedRect, const Common::Rect& mouseRect); + void updateHardwareSurfaceForRect(const Common::Rect& updatedRect); + static void AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBufferRef outQB); + static int timerHandler(int t); + + bool handleEvent_swipe(Common::Event &event, int direction); + void handleEvent_keyPressed(Common::Event &event, int keyPressed); + void handleEvent_orientationChanged(int orientation); + + bool handleEvent_mouseDown(Common::Event &event, int x, int y); + bool handleEvent_mouseUp(Common::Event &event, int x, int y); + + bool handleEvent_secondMouseDown(Common::Event &event, int x, int y); + bool handleEvent_secondMouseUp(Common::Event &event, int x, int y); + + bool handleEvent_mouseDragged(Common::Event &event, int x, int y); + bool handleEvent_mouseSecondDragged(Common::Event &event, int x, int y); +}; diff --git a/backends/platform/iphone/osys_sound.cpp b/backends/platform/iphone/osys_sound.cpp new file mode 100644 index 0000000000..60b8d04a9b --- /dev/null +++ b/backends/platform/iphone/osys_sound.cpp @@ -0,0 +1,111 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "osys_main.h" + +void OSystem_IPHONE::AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBufferRef outQB) { + //printf("AQBufferCallback()\n"); + if (s_AudioQueue.frameCount > 0 && s_soundCallback != NULL) { + outQB->mAudioDataByteSize = 4 * s_AudioQueue.frameCount; + s_soundCallback(s_soundParam, (byte *)outQB->mAudioData, outQB->mAudioDataByteSize); + AudioQueueEnqueueBuffer(inQ, outQB, 0, NULL); + } else { + AudioQueueStop(s_AudioQueue.queue, false); + } +} + +void OSystem_IPHONE::mixCallback(void *sys, byte *samples, int len) { + OSystem_IPHONE *this_ = (OSystem_IPHONE *)sys; + assert(this_); + + if (this_->_mixer) { + this_->_mixer->mixCallback(samples, len); + } +} + +void OSystem_IPHONE::setupMixer() { + //printf("setSoundCallback()\n"); + _mixer = new Audio::MixerImpl(this); + + s_soundCallback = mixCallback; + s_soundParam = this; + + startSoundsystem(); +} + +void OSystem_IPHONE::startSoundsystem() { + s_AudioQueue.dataFormat.mSampleRate = AUDIO_SAMPLE_RATE; + s_AudioQueue.dataFormat.mFormatID = kAudioFormatLinearPCM; + s_AudioQueue.dataFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked; + s_AudioQueue.dataFormat.mBytesPerPacket = 4; + s_AudioQueue.dataFormat.mFramesPerPacket = 1; + s_AudioQueue.dataFormat.mBytesPerFrame = 4; + s_AudioQueue.dataFormat.mChannelsPerFrame = 2; + s_AudioQueue.dataFormat.mBitsPerChannel = 16; + s_AudioQueue.frameCount = WAVE_BUFFER_SIZE; + + if (AudioQueueNewOutput(&s_AudioQueue.dataFormat, AQBufferCallback, &s_AudioQueue, 0, kCFRunLoopCommonModes, 0, &s_AudioQueue.queue)) { + printf("Couldn't set the AudioQueue callback!\n"); + _mixer->setReady(false); + return; + } + + uint32 bufferBytes = s_AudioQueue.frameCount * s_AudioQueue.dataFormat.mBytesPerFrame; + + for (int i = 0; i < AUDIO_BUFFERS; i++) { + if (AudioQueueAllocateBuffer(s_AudioQueue.queue, bufferBytes, &s_AudioQueue.buffers[i])) { + printf("Error allocating AudioQueue buffer!\n"); + _mixer->setReady(false); + return; + } + + AQBufferCallback(&s_AudioQueue, s_AudioQueue.queue, s_AudioQueue.buffers[i]); + } + + AudioQueueSetParameter(s_AudioQueue.queue, kAudioQueueParam_Volume, 1.0); + if (AudioQueueStart(s_AudioQueue.queue, NULL)) { + printf("Error starting the AudioQueue!\n"); + _mixer->setReady(false); + return; + } + + _mixer->setOutputRate(AUDIO_SAMPLE_RATE); + _mixer->setReady(true); +} + +void OSystem_IPHONE::stopSoundsystem() { + AudioQueueStop(s_AudioQueue.queue, true); + + for (int i = 0; i < AUDIO_BUFFERS; i++) { + AudioQueueFreeBuffer(s_AudioQueue.queue, s_AudioQueue.buffers[i]); + } + + AudioQueueDispose(s_AudioQueue.queue, true); + _mixer->setReady(false); +} + +int OSystem_IPHONE::getOutputSampleRate() const { + return AUDIO_SAMPLE_RATE; +} diff --git a/backends/platform/iphone/osys_video.cpp b/backends/platform/iphone/osys_video.cpp new file mode 100644 index 0000000000..641c341f50 --- /dev/null +++ b/backends/platform/iphone/osys_video.cpp @@ -0,0 +1,463 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "osys_main.h" + +const OSystem::GraphicsMode* OSystem_IPHONE::getSupportedGraphicsModes() const { + return s_supportedGraphicsModes; +} + + +int OSystem_IPHONE::getDefaultGraphicsMode() const { + return -1; +} + +bool OSystem_IPHONE::setGraphicsMode(const char *mode) { + return true; +} + +bool OSystem_IPHONE::setGraphicsMode(int mode) { + return true; +} + +int OSystem_IPHONE::getGraphicsMode() const { + return -1; +} + +void OSystem_IPHONE::initSize(uint width, uint height) { + //printf("initSize(%i, %i)\n", width, height); + + _screenWidth = width; + _screenHeight = height; + + free(_offscreen); + + _offscreen = (byte *)malloc(width * height); + bzero(_offscreen, width * height); + + free(_overlayBuffer); + + int fullSize = _screenWidth * _screenHeight * sizeof(OverlayColor); + _overlayBuffer = (OverlayColor *)malloc(fullSize); + clearOverlay(); + + free(_fullscreen); + + _fullscreen = (uint16 *)malloc(fullSize); + bzero(_fullscreen, fullSize); + + iPhone_initSurface(width, height); + + _fullScreenIsDirty = false; + dirtyFullScreen(); + _mouseVisible = false; + _screenChangeCount++; + updateScreen(); +} + +int16 OSystem_IPHONE::getHeight() { + return _screenHeight; +} + +int16 OSystem_IPHONE::getWidth() { + return _screenWidth; +} + +void OSystem_IPHONE::setPalette(const byte *colors, uint start, uint num) { + //printf("setPalette()\n"); + const byte *b = colors; + + for (uint i = start; i < start + num; ++i) { + _palette[i] = Graphics::RGBToColor >(b[0], b[1], b[2]); + b += 4; + } + + dirtyFullScreen(); +} + +void OSystem_IPHONE::grabPalette(byte *colors, uint start, uint num) { + //printf("grabPalette()\n"); +} + +void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { + //printf("copyRectToScreen(%i, %i, %i, %i)\n", x, y, w, h); + //Clip the coordinates + if (x < 0) { + w += x; + buf -= x; + x = 0; + } + + if (y < 0) { + h += y; + buf -= y * pitch; + y = 0; + } + + if (w > _screenWidth - x) { + w = _screenWidth - x; + } + + if (h > _screenHeight - y) { + h = _screenHeight - y; + } + + if (w <= 0 || h <= 0) + return; + + if (!_fullScreenIsDirty) { + _dirtyRects.push_back(Common::Rect(x, y, x + w, y + h)); + } + + + byte *dst = _offscreen + y * _screenWidth + x; + if (_screenWidth == pitch && pitch == w) + memcpy(dst, buf, h * w); + else { + do { + memcpy(dst, buf, w); + buf += pitch; + dst += _screenWidth; + } while (--h); + } +} + +void OSystem_IPHONE::clipRectToScreen(int16 &x, int16 &y, int16 &w, int16 &h) { + if (x < 0) { + w += x; + x = 0; + } + + if (y < 0) { + h += y; + y = 0; + } + + if (w > _screenWidth - x) + w = _screenWidth - x; + + if (h > _screenHeight - y) + h = _screenHeight - y; + + if (w < 0) { + w = 0; + } + + if (h < 0) { + h = 0; + } +} + +void OSystem_IPHONE::updateScreen() { + //printf("updateScreen(): %i dirty rects.\n", _dirtyRects.size()); + + if (_dirtyRects.size() == 0 && _dirtyOverlayRects.size() == 0 && !_mouseDirty) + return; + + internUpdateScreen(); + _fullScreenIsDirty = false; + _fullScreenOverlayIsDirty = false; + + iPhone_updateScreen(); +} + +void OSystem_IPHONE::internUpdateScreen() { + int16 mouseX = _mouseX - _mouseHotspotX; + int16 mouseY = _mouseY - _mouseHotspotY; + int16 mouseWidth = _mouseWidth; + int16 mouseHeight = _mouseHeight; + + clipRectToScreen(mouseX, mouseY, mouseWidth, mouseHeight); + + Common::Rect mouseRect(mouseX, mouseY, mouseX + mouseWidth, mouseY + mouseHeight); + + if (_mouseDirty) { + if (!_fullScreenIsDirty) { + _dirtyRects.push_back(_lastDrawnMouseRect); + _dirtyRects.push_back(mouseRect); + } + if (!_fullScreenOverlayIsDirty && _overlayVisible) { + _dirtyOverlayRects.push_back(_lastDrawnMouseRect); + _dirtyOverlayRects.push_back(mouseRect); + } + _mouseDirty = false; + _lastDrawnMouseRect = mouseRect; + } + + while (_dirtyRects.size()) { + Common::Rect dirtyRect = _dirtyRects.remove_at(_dirtyRects.size() - 1); + + //printf("Drawing: (%i, %i) -> (%i, %i)\n", dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom); + + drawDirtyRect(dirtyRect); + + if (_overlayVisible) + drawDirtyOverlayRect(dirtyRect); + + drawMouseCursorOnRectUpdate(dirtyRect, mouseRect); + updateHardwareSurfaceForRect(dirtyRect); + } + + if (_overlayVisible) { + while (_dirtyOverlayRects.size()) { + Common::Rect dirtyRect = _dirtyOverlayRects.remove_at(_dirtyOverlayRects.size() - 1); + + //printf("Drawing: (%i, %i) -> (%i, %i)\n", dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom); + + drawDirtyOverlayRect(dirtyRect); + drawMouseCursorOnRectUpdate(dirtyRect, mouseRect); + updateHardwareSurfaceForRect(dirtyRect); + } + } +} + +void OSystem_IPHONE::drawDirtyRect(const Common::Rect& dirtyRect) { + int h = dirtyRect.bottom - dirtyRect.top; + int w = dirtyRect.right - dirtyRect.left; + + byte *src = &_offscreen[dirtyRect.top * _screenWidth + dirtyRect.left]; + uint16 *dst = &_fullscreen[dirtyRect.top * _screenWidth + dirtyRect.left]; + for (int y = h; y > 0; y--) { + for (int x = w; x > 0; x--) + *dst++ = _palette[*src++]; + + dst += _screenWidth - w; + src += _screenWidth - w; + } +} + +void OSystem_IPHONE::drawDirtyOverlayRect(const Common::Rect& dirtyRect) { + int h = dirtyRect.bottom - dirtyRect.top; + + uint16 *src = (uint16 *)&_overlayBuffer[dirtyRect.top * _screenWidth + dirtyRect.left]; + uint16 *dst = &_fullscreen[dirtyRect.top * _screenWidth + dirtyRect.left]; + int x = (dirtyRect.right - dirtyRect.left) * 2; + for (int y = h; y > 0; y--) { + memcpy(dst, src, x); + src += _screenWidth; + dst += _screenWidth; + } +} + +void OSystem_IPHONE::drawMouseCursorOnRectUpdate(const Common::Rect& updatedRect, const Common::Rect& mouseRect) { + //draw mouse on top + if (_mouseVisible && (updatedRect.intersects(mouseRect))) { + int srcX = 0; + int srcY = 0; + int left = _mouseX - _mouseHotspotX; + if (left < 0) { + srcX -= left; + left = 0; + } + int top = _mouseY - _mouseHotspotY; + if (top < 0) { + srcY -= top; + top = 0; + } + //int right = left + _mouseWidth; + int bottom = top + _mouseHeight; + if (bottom > _screenWidth) + bottom = _screenWidth; + int displayWidth = _mouseWidth; + if (_mouseWidth + left > _screenWidth) + displayWidth = _screenWidth - left; + int displayHeight = _mouseHeight; + if (_mouseHeight + top > _screenHeight) + displayHeight = _screenHeight - top; + byte *src = &_mouseBuf[srcY * _mouseWidth + srcX]; + uint16 *dst = &_fullscreen[top * _screenWidth + left]; + for (int y = displayHeight; y > srcY; y--) { + for (int x = displayWidth; x > srcX; x--) { + if (*src != _mouseKeyColour) + *dst = _palette[*src]; + dst++; + src++; + } + dst += _screenWidth - displayWidth + srcX; + src += _mouseWidth - displayWidth + srcX; + } + } +} + +void OSystem_IPHONE::updateHardwareSurfaceForRect(const Common::Rect& updatedRect) { + iPhone_updateScreenRect(_fullscreen, updatedRect.left, updatedRect.top, updatedRect.right, updatedRect.bottom ); +} + +Graphics::Surface *OSystem_IPHONE::lockScreen() { + //printf("lockScreen()\n"); + + _framebuffer.pixels = _offscreen; + _framebuffer.w = _screenWidth; + _framebuffer.h = _screenHeight; + _framebuffer.pitch = _screenWidth; + _framebuffer.bytesPerPixel = 1; + + return &_framebuffer; +} + +void OSystem_IPHONE::unlockScreen() { + //printf("unlockScreen()\n"); + dirtyFullScreen(); +} + +void OSystem_IPHONE::setShakePos(int shakeOffset) { + //printf("setShakePos(%i)\n", shakeOffset); +} + +void OSystem_IPHONE::showOverlay() { + //printf("showOverlay()\n"); + _overlayVisible = true; + dirtyFullOverlayScreen(); +} + +void OSystem_IPHONE::hideOverlay() { + //printf("hideOverlay()\n"); + _overlayVisible = false; + _dirtyOverlayRects.clear(); + dirtyFullScreen(); +} + +void OSystem_IPHONE::clearOverlay() { + //printf("clearOverlay()\n"); + bzero(_overlayBuffer, _screenWidth * _screenHeight * sizeof(OverlayColor)); + dirtyFullOverlayScreen(); +} + +void OSystem_IPHONE::grabOverlay(OverlayColor *buf, int pitch) { + //printf("grabOverlay()\n"); + int h = _screenHeight; + OverlayColor *src = _overlayBuffer; + + do { + memcpy(buf, src, _screenWidth * sizeof(OverlayColor)); + src += _screenWidth; + buf += pitch; + } while (--h); +} + +void OSystem_IPHONE::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { + //printf("copyRectToOverlay(buf, pitch=%i, x=%i, y=%i, w=%i, h=%i)\n", pitch, x, y, w, h); + + //Clip the coordinates + if (x < 0) { + w += x; + buf -= x; + x = 0; + } + + if (y < 0) { + h += y; + buf -= y * pitch; + y = 0; + } + + if (w > _screenWidth - x) + w = _screenWidth - x; + + if (h > _screenHeight - y) + h = _screenHeight - y; + + if (w <= 0 || h <= 0) + return; + + if (!_fullScreenOverlayIsDirty) { + _dirtyOverlayRects.push_back(Common::Rect(x, y, x + w, y + h)); + } + + OverlayColor *dst = _overlayBuffer + (y * _screenWidth + x); + if (_screenWidth == pitch && pitch == w) + memcpy(dst, buf, h * w * sizeof(OverlayColor)); + else { + do { + memcpy(dst, buf, w * sizeof(OverlayColor)); + buf += pitch; + dst += _screenWidth; + } while (--h); + } +} + +int16 OSystem_IPHONE::getOverlayHeight() { + return _screenHeight; +} + +int16 OSystem_IPHONE::getOverlayWidth() { + return _screenWidth; +} + +bool OSystem_IPHONE::showMouse(bool visible) { + bool last = _mouseVisible; + _mouseVisible = visible; + _mouseDirty = true; + + return last; +} + +void OSystem_IPHONE::warpMouse(int x, int y) { + //printf("warpMouse()\n"); + + _mouseX = x; + _mouseY = y; + _mouseDirty = true; +} + +void OSystem_IPHONE::dirtyFullScreen() { + if (!_fullScreenIsDirty) { + _dirtyRects.clear(); + _dirtyRects.push_back(Common::Rect(0, 0, _screenWidth, _screenHeight)); + _fullScreenIsDirty = true; + } +} + +void OSystem_IPHONE::dirtyFullOverlayScreen() { + if (!_fullScreenOverlayIsDirty) { + _dirtyOverlayRects.clear(); + _dirtyOverlayRects.push_back(Common::Rect(0, 0, _screenWidth, _screenHeight)); + _fullScreenOverlayIsDirty = true; + } +} + +void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int cursorTargetScale) { + //printf("setMouseCursor(%i, %i)\n", hotspotX, hotspotY); + + if (_mouseBuf != NULL && (_mouseWidth != w || _mouseHeight != h)) { + free(_mouseBuf); + _mouseBuf = NULL; + } + + if (_mouseBuf == NULL) + _mouseBuf = (byte *)malloc(w * h); + + _mouseWidth = w; + _mouseHeight = h; + + _mouseHotspotX = hotspotX; + _mouseHotspotY = hotspotY; + + _mouseKeyColour = keycolor; + + memcpy(_mouseBuf, buf, w * h); + + _mouseDirty = true; +} diff --git a/dists/iphone/scummvm.xcodeproj/project.pbxproj b/dists/iphone/scummvm.xcodeproj/project.pbxproj index e2ed137bb1..96c8aa2431 100755 --- a/dists/iphone/scummvm.xcodeproj/project.pbxproj +++ b/dists/iphone/scummvm.xcodeproj/project.pbxproj @@ -1139,6 +1139,14 @@ DF7585F7100CB75800CC3324 /* static_selectors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585F6100CB75800CC3324 /* static_selectors.cpp */; }; DF7585F8100CB75800CC3324 /* static_selectors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585F6100CB75800CC3324 /* static_selectors.cpp */; }; DF7585F9100CB75800CC3324 /* static_selectors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7585F6100CB75800CC3324 /* static_selectors.cpp */; }; + DF758619100CBA0200CC3324 /* osys_events.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF758614100CBA0200CC3324 /* osys_events.cpp */; }; + DF75861A100CBA0200CC3324 /* osys_main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF758615100CBA0200CC3324 /* osys_main.cpp */; }; + DF75861B100CBA0200CC3324 /* osys_sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF758617100CBA0200CC3324 /* osys_sound.cpp */; }; + DF75861C100CBA0200CC3324 /* osys_video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF758618100CBA0200CC3324 /* osys_video.cpp */; }; + DF75861D100CBA0200CC3324 /* osys_events.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF758614100CBA0200CC3324 /* osys_events.cpp */; }; + DF75861E100CBA0200CC3324 /* osys_main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF758615100CBA0200CC3324 /* osys_main.cpp */; }; + DF75861F100CBA0200CC3324 /* osys_sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF758617100CBA0200CC3324 /* osys_sound.cpp */; }; + DF758620100CBA0200CC3324 /* osys_video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF758618100CBA0200CC3324 /* osys_video.cpp */; }; DF7A40330FB6E8960094E50F /* gfx_pixmap_scale.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7A40320FB6E8960094E50F /* gfx_pixmap_scale.cpp */; }; DF7A40340FB6E8960094E50F /* gfx_pixmap_scale.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7A40320FB6E8960094E50F /* gfx_pixmap_scale.cpp */; }; DF7A40350FB6E8960094E50F /* gfx_pixmap_scale.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7A40320FB6E8960094E50F /* gfx_pixmap_scale.cpp */; }; @@ -1882,7 +1890,6 @@ DFE4782B0D81F4E900B6D1FB /* default-events.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE470D80D81F4E700B6D1FB /* default-events.cpp */; }; DFE478380D81F4E900B6D1FB /* posix-fs-factory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE470F60D81F4E700B6D1FB /* posix-fs-factory.cpp */; }; DFE478C50D81F4E900B6D1FB /* iphone_main.m in Sources */ = {isa = PBXBuildFile; fileRef = DFE471E10D81F4E700B6D1FB /* iphone_main.m */; }; - DFE478C90D81F4E900B6D1FB /* osys_iphone.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE471E60D81F4E700B6D1FB /* osys_iphone.cpp */; }; DFE479B60D81F4E900B6D1FB /* posix-provider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE473810D81F4E800B6D1FB /* posix-provider.cpp */; }; DFE479BA0D81F4E900B6D1FB /* default-saves.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE4738E0D81F4E800B6D1FB /* default-saves.cpp */; }; DFE479BB0D81F4E900B6D1FB /* savefile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE473900D81F4E800B6D1FB /* savefile.cpp */; }; @@ -1993,7 +2000,6 @@ DFF9591B0FB22D5700A3EC78 /* default-events.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE470D80D81F4E700B6D1FB /* default-events.cpp */; }; DFF9591C0FB22D5700A3EC78 /* posix-fs-factory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE470F60D81F4E700B6D1FB /* posix-fs-factory.cpp */; }; DFF9591D0FB22D5700A3EC78 /* iphone_main.m in Sources */ = {isa = PBXBuildFile; fileRef = DFE471E10D81F4E700B6D1FB /* iphone_main.m */; }; - DFF9591E0FB22D5700A3EC78 /* osys_iphone.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE471E60D81F4E700B6D1FB /* osys_iphone.cpp */; }; DFF9591F0FB22D5700A3EC78 /* posix-provider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE473810D81F4E800B6D1FB /* posix-provider.cpp */; }; DFF959200FB22D5700A3EC78 /* default-saves.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE4738E0D81F4E800B6D1FB /* default-saves.cpp */; }; DFF959210FB22D5700A3EC78 /* savefile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFE473900D81F4E800B6D1FB /* savefile.cpp */; }; @@ -3189,6 +3195,11 @@ DF7585EB100CB6EA00CC3324 /* sjis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sjis.h; sourceTree = ""; }; DF7585F0100CB70600CC3324 /* saveload_playtoons.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = saveload_playtoons.cpp; sourceTree = ""; }; DF7585F6100CB75800CC3324 /* static_selectors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = static_selectors.cpp; sourceTree = ""; }; + DF758614100CBA0200CC3324 /* osys_events.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = osys_events.cpp; sourceTree = ""; }; + DF758615100CBA0200CC3324 /* osys_main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = osys_main.cpp; sourceTree = ""; }; + DF758616100CBA0200CC3324 /* osys_main.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = osys_main.h; sourceTree = ""; }; + DF758617100CBA0200CC3324 /* osys_sound.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = osys_sound.cpp; sourceTree = ""; }; + DF758618100CBA0200CC3324 /* osys_video.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = osys_video.cpp; sourceTree = ""; }; DF7A40320FB6E8960094E50F /* gfx_pixmap_scale.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gfx_pixmap_scale.cpp; sourceTree = ""; }; DF7E8BF00ED5FC77001CB19F /* saveload.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = saveload.cpp; sourceTree = ""; }; DF7E8BF10ED5FC77001CB19F /* saveload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = saveload.h; sourceTree = ""; }; @@ -4425,8 +4436,6 @@ DFE471DE0D81F4E700B6D1FB /* iphone_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iphone_common.h; sourceTree = ""; }; DFE471DF0D81F4E700B6D1FB /* iphone_keyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iphone_keyboard.h; sourceTree = ""; }; DFE471E10D81F4E700B6D1FB /* iphone_main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iphone_main.m; sourceTree = ""; }; - DFE471E60D81F4E700B6D1FB /* osys_iphone.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = osys_iphone.cpp; sourceTree = ""; }; - DFE471E70D81F4E700B6D1FB /* osys_iphone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = osys_iphone.h; sourceTree = ""; }; DFE4737F0D81F4E800B6D1FB /* dynamic-plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "dynamic-plugin.h"; sourceTree = ""; }; DFE473810D81F4E800B6D1FB /* posix-provider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "posix-provider.cpp"; sourceTree = ""; }; DFE473820D81F4E800B6D1FB /* posix-provider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "posix-provider.h"; sourceTree = ""; }; @@ -6600,6 +6609,11 @@ DFE471D70D81F4E700B6D1FB /* iphone */ = { isa = PBXGroup; children = ( + DF758614100CBA0200CC3324 /* osys_events.cpp */, + DF758615100CBA0200CC3324 /* osys_main.cpp */, + DF758616100CBA0200CC3324 /* osys_main.h */, + DF758617100CBA0200CC3324 /* osys_sound.cpp */, + DF758618100CBA0200CC3324 /* osys_video.cpp */, DF8428960E7BAAAB00F5680E /* blit.cpp */, DF841FD90E7BA61800F5680E /* iphone_keyboard.m */, DF841FDA0E7BA61800F5680E /* iphone_video.h */, @@ -6608,8 +6622,6 @@ DFE471DE0D81F4E700B6D1FB /* iphone_common.h */, DFE471DF0D81F4E700B6D1FB /* iphone_keyboard.h */, DFE471E10D81F4E700B6D1FB /* iphone_main.m */, - DFE471E60D81F4E700B6D1FB /* osys_iphone.cpp */, - DFE471E70D81F4E700B6D1FB /* osys_iphone.h */, ); path = iphone; sourceTree = ""; @@ -7117,7 +7129,6 @@ DFE4782B0D81F4E900B6D1FB /* default-events.cpp in Sources */, DFE478380D81F4E900B6D1FB /* posix-fs-factory.cpp in Sources */, DFE478C50D81F4E900B6D1FB /* iphone_main.m in Sources */, - DFE478C90D81F4E900B6D1FB /* osys_iphone.cpp in Sources */, DFE479B60D81F4E900B6D1FB /* posix-provider.cpp in Sources */, DFE479BA0D81F4E900B6D1FB /* default-saves.cpp in Sources */, DFE479BB0D81F4E900B6D1FB /* savefile.cpp in Sources */, @@ -8045,6 +8056,10 @@ DF7585EE100CB6EA00CC3324 /* sjis.cpp in Sources */, DF7585F3100CB70600CC3324 /* saveload_playtoons.cpp in Sources */, DF7585F9100CB75800CC3324 /* static_selectors.cpp in Sources */, + DF75861D100CBA0200CC3324 /* osys_events.cpp in Sources */, + DF75861E100CBA0200CC3324 /* osys_main.cpp in Sources */, + DF75861F100CBA0200CC3324 /* osys_sound.cpp in Sources */, + DF758620100CBA0200CC3324 /* osys_video.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -9004,7 +9019,6 @@ DFF9591B0FB22D5700A3EC78 /* default-events.cpp in Sources */, DFF9591C0FB22D5700A3EC78 /* posix-fs-factory.cpp in Sources */, DFF9591D0FB22D5700A3EC78 /* iphone_main.m in Sources */, - DFF9591E0FB22D5700A3EC78 /* osys_iphone.cpp in Sources */, DFF9591F0FB22D5700A3EC78 /* posix-provider.cpp in Sources */, DFF959200FB22D5700A3EC78 /* default-saves.cpp in Sources */, DFF959210FB22D5700A3EC78 /* savefile.cpp in Sources */, @@ -9932,6 +9946,10 @@ DF7585ED100CB6EA00CC3324 /* sjis.cpp in Sources */, DF7585F2100CB70600CC3324 /* saveload_playtoons.cpp in Sources */, DF7585F8100CB75800CC3324 /* static_selectors.cpp in Sources */, + DF758619100CBA0200CC3324 /* osys_events.cpp in Sources */, + DF75861A100CBA0200CC3324 /* osys_main.cpp in Sources */, + DF75861B100CBA0200CC3324 /* osys_sound.cpp in Sources */, + DF75861C100CBA0200CC3324 /* osys_video.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; -- cgit v1.2.3 From cc4fb1277fdcfed48f4ac90b67b48cdaead03469 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Tue, 14 Jul 2009 13:53:54 +0000 Subject: Update workaround for bug #1538873, which effects the Polish version of Simon the Sorcerer 2 too. svn-id: r42480 --- engines/agos/string.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/engines/agos/string.cpp b/engines/agos/string.cpp index 23dc24cf33..3773b1fa10 100644 --- a/engines/agos/string.cpp +++ b/engines/agos/string.cpp @@ -136,9 +136,11 @@ const byte *AGOSEngine::getStringPtrByID(uint16 stringId, bool upperCase) { strcpy((char *)dst, (const char *)stringPtr); } - // WORKAROUND bug #1538873: The French version used excess spaces, - // at the end of many messages, so we strip off those excess spaces. - if (getGameType() == GType_SIMON1 && _language == Common::FR_FRA) { + // WORKAROUND bug #1538873: The French version of Simon 1 and the + // Polish version of Simon 2 used excess spaces, at the end of many + // messages, so we strip off those excess spaces. + if ((getGameType() == GType_SIMON1 && _language == Common::FR_FRA) || + (getGameType() == GType_SIMON2 && _language == Common::PL_POL)) { uint16 len = strlen((const char *)dst) - 1; while (len && dst[len] == 32) { -- cgit v1.2.3 From 845106c3b94f8b530a8e6029525fc1a0a98bba0f Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Tue, 14 Jul 2009 13:55:10 +0000 Subject: Remove last ioFailed() usage in AGOS game engine. svn-id: r42481 --- engines/agos/res_snd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp index 810f953bd7..e85440d8e1 100644 --- a/engines/agos/res_snd.cpp +++ b/engines/agos/res_snd.cpp @@ -332,7 +332,7 @@ void AGOSEngine::playSting(uint16 soundId) { mus_file.seek(soundId * 2, SEEK_SET); mus_offset = mus_file.readUint16LE(); - if (mus_file.ioFailed()) + if (mus_file.err()) error("playSting: Can't read sting %d offset", soundId); mus_file.seek(mus_offset, SEEK_SET); -- cgit v1.2.3 From 9a2785bc3b3829688ffceccfc6563ed4c69cdc49 Mon Sep 17 00:00:00 2001 From: Kari Salminen Date: Tue, 14 Jul 2009 15:02:17 +0000 Subject: Partially fix automatic restarting of AGI games (Addresses bug #2798797 ('AGI: larry 1 doesn't restart after dying') but doesn't fully fix it. There seems to be more to the problem still. Automatic restarting after dying of an STD doesn't take away the STD-condition and Larry continues to die in a loop). svn-id: r42482 --- engines/agi/op_cmd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp index 97255097bc..7012174c20 100644 --- a/engines/agi/op_cmd.cpp +++ b/engines/agi/op_cmd.cpp @@ -1256,7 +1256,7 @@ cmd(restart_game) { int sel; g_sound->stopSound(); - sel = g_agi->getflag(fAutoRestart) ? 1 : + sel = g_agi->getflag(fAutoRestart) ? 0 : g_agi->selectionBox(" Restart game, or continue? \n\n\n", buttons); if (sel == 0) { -- cgit v1.2.3 From 810961e685d54ed4758de770918d459e01519320 Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Tue, 14 Jul 2009 15:48:05 +0000 Subject: Add detection for Playtoons 4 EN_ANY as supplied by goodoldgeorg in bug #2820006 svn-id: r42483 --- engines/gob/detection.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/engines/gob/detection.cpp b/engines/gob/detection.cpp index e56bc418a2..61c17b16f8 100644 --- a/engines/gob/detection.cpp +++ b/engines/gob/detection.cpp @@ -3561,7 +3561,6 @@ static const GOBGameDescription gameDescriptions[] = { kFeatures640, "intro2.stk", 0, 0 }, - { { "playtoons4", @@ -3580,6 +3579,24 @@ static const GOBGameDescription gameDescriptions[] = { kFeatures640, "intro2.stk", 0, 0 }, + { //Supplied by goodoldgeorg in bug report #2820006 + { + "playtoons4", + "", + { + {"playtoon.stk", 0, "9e513e993a5b0e2496add3f50c08764b", 30448506}, + {"manda.stk", 0, "69a79c9f61b2618e482726f2ff68078d", 6499208}, + {0, 0, 0, 0} + }, + EN_ANY, + kPlatformPC, + ADGF_NO_FLAGS, + GUIO_NOSUBTITLES | GUIO_NOSPEECH + }, + kGameTypePlaytoon, + kFeatures640, + "intro2.stk", 0, 0 + }, { { "playtoons5", -- cgit v1.2.3 From aa50dd61e9e698e4106ac0d0ad49cf05ec9b5e19 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Tue, 14 Jul 2009 16:45:18 +0000 Subject: Got rid of ioFailed(). I haven't actually tested it, but we don't use the MPEG decoder at the moment, and it was only used in the BACKEND_8BIT case anyway. svn-id: r42484 --- graphics/video/mpeg_player.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/graphics/video/mpeg_player.cpp b/graphics/video/mpeg_player.cpp index 1910babce4..5b7b3eb607 100644 --- a/graphics/video/mpeg_player.cpp +++ b/graphics/video/mpeg_player.cpp @@ -86,13 +86,10 @@ bool BaseAnimationState::init(const char *name) { } p = 0; - while (1) { + while (!f.eos()) { _palettes[p].end = f.readUint16LE(); _palettes[p].cnt = f.readUint16LE(); - if (f.ioFailed()) - break; - for (i = 0; i < _palettes[p].cnt; i++) { _palettes[p].pal[4 * i] = f.readByte(); _palettes[p].pal[4 * i + 1] = f.readByte(); -- cgit v1.2.3 From 3f1563c8196da151f46f110d8a4ed1b7bffb36f0 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 14 Jul 2009 18:14:20 +0000 Subject: Got rid of ioFailed in font code, also added another check for err() when loading bdf fonts from text files. svn-id: r42486 --- graphics/font.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/graphics/font.cpp b/graphics/font.cpp index 1c958f3c3c..e0c9fdecf4 100644 --- a/graphics/font.cpp +++ b/graphics/font.cpp @@ -572,8 +572,10 @@ bitmap_t bdf_hexval(unsigned char *buf) { NewFont *NewFont::loadFont(Common::SeekableReadStream &stream) { NewFontData *data = bdf_read_font(stream); - if (!data) + if (!data || stream.err()) { + free_font(data); return 0; + } FontDesc desc; desc.name = data->name; @@ -673,7 +675,7 @@ NewFont *NewFont::loadFromCache(Common::SeekableReadStream &stream) { data->defaultchar = stream.readUint16BE(); data->bits_size = stream.readUint32BE(); - data->bits = (bitmap_t*)malloc(sizeof(bitmap_t)*data->bits_size); + data->bits = (bitmap_t *)malloc(sizeof(bitmap_t) * data->bits_size); if (!data->bits) { free(data); return 0; @@ -685,7 +687,7 @@ NewFont *NewFont::loadFromCache(Common::SeekableReadStream &stream) { bool hasOffsetTable = (stream.readByte() != 0); if (hasOffsetTable) { - data->offset = (unsigned long*)malloc(sizeof(unsigned long)*data->size); + data->offset = (unsigned long *)malloc(sizeof(unsigned long) * data->size); if (!data->offset) { free(data->bits); free(data); @@ -699,7 +701,7 @@ NewFont *NewFont::loadFromCache(Common::SeekableReadStream &stream) { bool hasWidthTable = (stream.readByte() != 0); if (hasWidthTable) { - data->width = (unsigned char*)malloc(sizeof(unsigned char)*data->size); + data->width = (unsigned char *)malloc(sizeof(unsigned char) * data->size); if (!data->width) { free(data->bits); free(data->offset); @@ -714,7 +716,7 @@ NewFont *NewFont::loadFromCache(Common::SeekableReadStream &stream) { bool hasBBXTable = (stream.readByte() != 0); if (hasBBXTable) { - data->bbx = (BBX *)malloc(sizeof(BBX)*data->size); + data->bbx = (BBX *)malloc(sizeof(BBX) * data->size); if (!data->bbx) { free(data->bits); free(data->offset); @@ -750,7 +752,7 @@ NewFont *NewFont::loadFromCache(Common::SeekableReadStream &stream) { desc.bits_size = data->bits_size; font = new NewFont(desc, data); - if (!font || stream.ioFailed()) { + if (!font || stream.err()) { free(data->bits); free(data->offset); free(data->width); -- cgit v1.2.3 From 96abaaea6d06dae9bc1a48dc3b3afc936a92468b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 14 Jul 2009 18:15:07 +0000 Subject: Fix possible memory leak. svn-id: r42487 --- graphics/font.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/graphics/font.cpp b/graphics/font.cpp index e0c9fdecf4..bfc6dea0c1 100644 --- a/graphics/font.cpp +++ b/graphics/font.cpp @@ -753,6 +753,7 @@ NewFont *NewFont::loadFromCache(Common::SeekableReadStream &stream) { font = new NewFont(desc, data); if (!font || stream.err()) { + delete font; free(data->bits); free(data->offset); free(data->width); -- cgit v1.2.3 From 6b98c4c4e7a23089a6cccba573a1c3afd909f52d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 14 Jul 2009 18:24:20 +0000 Subject: Got rid of some more ioFailed uses (also fixed a potential leak in graphics/font.cpp, and handle eos correctly in the FLAC code) svn-id: r42488 --- engines/kyra/saveload.cpp | 2 +- engines/touche/saveload.cpp | 6 +++--- engines/tucker/saveload.cpp | 2 +- graphics/font.cpp | 11 +++++++++-- sound/flac.cpp | 10 ++++++---- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp index a1aaf77d51..83230d6e3b 100644 --- a/engines/kyra/saveload.cpp +++ b/engines/kyra/saveload.cpp @@ -126,7 +126,7 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::Seekab } } - return (in->ioFailed() ? kRSHEIoError : kRSHENoError); + return ((in->err() || in->eos()) ? kRSHEIoError : kRSHENoError); } Common::SeekableReadStream *KyraEngine_v1::openSaveForReading(const char *filename, SaveHeader &header) { diff --git a/engines/touche/saveload.cpp b/engines/touche/saveload.cpp index 69b8f9ba43..73817a5a1a 100644 --- a/engines/touche/saveload.cpp +++ b/engines/touche/saveload.cpp @@ -355,10 +355,10 @@ Common::Error ToucheEngine::loadGameState(int num) { } else { f->skip(2 + kGameStateDescriptionLen); loadGameStateData(f); - if (!f->ioFailed()) { - loadOk = true; - } else { + if (f->err() || f->eos()) { warning("Can't read file '%s'", gameStateFileName.c_str()); + } else { + loadOk = true; } } delete f; diff --git a/engines/tucker/saveload.cpp b/engines/tucker/saveload.cpp index cf7f985416..83533a90c3 100644 --- a/engines/tucker/saveload.cpp +++ b/engines/tucker/saveload.cpp @@ -88,7 +88,7 @@ Common::Error TuckerEngine::loadGameState(int num) { } else { f->skip(2); saveOrLoadGameStateData(*f); - if (f->ioFailed()) { + if (f->err() || f->eos()) { warning("Can't read file '%s'", gameStateFileName.c_str()); ret = Common::kReadingFailed; } else { diff --git a/graphics/font.cpp b/graphics/font.cpp index bfc6dea0c1..4d322be081 100644 --- a/graphics/font.cpp +++ b/graphics/font.cpp @@ -733,6 +733,14 @@ NewFont *NewFont::loadFromCache(Common::SeekableReadStream &stream) { } } + if (stream.err() || stream.eos()) { + free(data->bits); + free(data->offset); + free(data->width); + free(data); + return 0; + } + FontDesc desc; desc.name = data->name; desc.maxwidth = data->maxwidth; @@ -752,8 +760,7 @@ NewFont *NewFont::loadFromCache(Common::SeekableReadStream &stream) { desc.bits_size = data->bits_size; font = new NewFont(desc, data); - if (!font || stream.err()) { - delete font; + if (!font) { free(data->bits); free(data->offset); free(data->width); diff --git a/sound/flac.cpp b/sound/flac.cpp index 5b6a04b726..bb633b8352 100644 --- a/sound/flac.cpp +++ b/sound/flac.cpp @@ -402,21 +402,23 @@ int FlacInputStream::readBuffer(int16 *buffer, const int numSamples) { } inline ::FLAC__SeekableStreamDecoderReadStatus FlacInputStream::callbackRead(FLAC__byte buffer[], FLAC_size_t *bytes) { - if (*bytes == 0) + if (*bytes == 0) { #ifdef LEGACY_FLAC return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; /* abort to avoid a deadlock */ #else return FLAC__STREAM_DECODER_READ_STATUS_ABORT; /* abort to avoid a deadlock */ #endif + } const uint32 bytesRead = _inStream->read(buffer, *bytes); - if (bytesRead == 0 && _inStream->ioFailed()) + if (bytesRead == 0) { #ifdef LEGACY_FLAC - return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; + return _inStream->eos() ? FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK : FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; #else - return FLAC__STREAM_DECODER_READ_STATUS_ABORT; + return _inStream->eos() ? FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM : FLAC__STREAM_DECODER_READ_STATUS_ABORT; #endif + } *bytes = static_cast(bytesRead); #ifdef LEGACY_FLAC -- cgit v1.2.3 From 464ee013f0ab22616221f4f9b812ccc8932b3f2c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 14 Jul 2009 19:32:25 +0000 Subject: Replaced char usage by int8, since char is unsigned on Linux/PPC by default. svn-id: r42490 --- engines/scumm/player_v2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/scumm/player_v2.h b/engines/scumm/player_v2.h index f0e14cdde3..5b375fb1e5 100644 --- a/engines/scumm/player_v2.h +++ b/engines/scumm/player_v2.h @@ -242,8 +242,8 @@ protected: Voice2 _cmsVoices[8]; MusicChip _cmsChips[2]; - char _tempo; - char _tempoSum; + int8 _tempo; + int8 _tempoSum; byte _looping; byte _octaveMask; int16 _midiDelay; -- cgit v1.2.3 From ebe3e42fba660204c67fb3254a0c3335ecd612ea Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 14 Jul 2009 21:46:23 +0000 Subject: AGOS: Cleanup PN code a bit, trying to make sense out of it svn-id: r42491 --- engines/agos/agos.h | 29 +++---- engines/agos/script_pn.cpp | 192 +++++++++++++++++++++++---------------------- 2 files changed, 112 insertions(+), 109 deletions(-) diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 093f7bb039..263811b78a 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -1265,8 +1265,8 @@ protected: #ifdef ENABLE_PN class AGOSEngine_PN : public AGOSEngine { - struct stackframe { - struct stackframe *nextframe; + struct StackFrame { + StackFrame *nextframe; int16 flag[6]; int16 param[8]; int16 classnum; @@ -1276,7 +1276,7 @@ class AGOSEngine_PN : public AGOSEngine { int16 linenum; int16 process; jmp_buf *savearea; - stackframe() { memset(this, 0, sizeof(*this)); } + StackFrame() { memset(this, 0, sizeof(*this)); } }; @@ -1284,6 +1284,7 @@ class AGOSEngine_PN : public AGOSEngine { void demoSeq(); void introSeq(); void setupBoxes(); + int readfromline(); public: AGOSEngine_PN(OSystem *system); ~AGOSEngine_PN(); @@ -1297,10 +1298,10 @@ public: int actCallD(int n); void opn_opcode00(); - void opn_opcode01(); - void opn_opcode02(); - void opn_opcode03(); - void opn_opcode04(); + void opn_add(); + void opn_sub(); + void opn_mul(); + void opn_div(); void opn_opcode05(); void opn_opcode06(); void opn_opcode07(); @@ -1313,10 +1314,10 @@ public: void opn_opcode14(); void opn_opcode15(); void opn_opcode16(); - void opn_opcode17(); - void opn_opcode18(); - void opn_opcode19(); - void opn_opcode20(); + void opn_lt(); + void opn_gt(); + void opn_eq(); + void opn_neq(); void opn_opcode21(); void opn_opcode22(); void opn_opcode23(); @@ -1357,14 +1358,14 @@ public: void opn_opcode62(); void opn_opcode63(); - stackframe *_stackbase; + StackFrame *_stackbase; byte *_dataBase, *_textBase; uint32 _dataBaseSize, _textBaseSize; HitArea _invHitAreas[45]; - char _buffer[80]; + char _buffer[80]; char _inputline[61]; char _saveFile[20]; char _sb[80]; @@ -1390,7 +1391,7 @@ public: uint16 _objects; int16 _objectCountS; - int16 _bp; + int16 _bp; int16 _xofs; int16 _havinit; uint16 _seed; diff --git a/engines/agos/script_pn.cpp b/engines/agos/script_pn.cpp index 62ca94e387..8c16765765 100644 --- a/engines/agos/script_pn.cpp +++ b/engines/agos/script_pn.cpp @@ -36,11 +36,11 @@ void AGOSEngine_PN::setupOpcodes() { static const OpcodeEntryPN opcodes[] = { /* 00 */ OPCODE(opn_opcode00), - OPCODE(opn_opcode01), - OPCODE(opn_opcode02), - OPCODE(opn_opcode03), + OPCODE(opn_add), + OPCODE(opn_sub), + OPCODE(opn_mul), /* 04 */ - OPCODE(opn_opcode04), + OPCODE(opn_div), OPCODE(opn_opcode05), OPCODE(opn_opcode06), OPCODE(opn_opcode07), @@ -56,11 +56,11 @@ void AGOSEngine_PN::setupOpcodes() { OPCODE(opn_opcode15), /* 16 */ OPCODE(opn_opcode16), - OPCODE(opn_opcode17), - OPCODE(opn_opcode18), - OPCODE(opn_opcode19), + OPCODE(opn_lt), + OPCODE(opn_gt), + OPCODE(opn_eq), /* 20 */ - OPCODE(opn_opcode20), + OPCODE(opn_neq), OPCODE(opn_opcode21), OPCODE(opn_opcode22), OPCODE(opn_opcode23), @@ -125,10 +125,11 @@ void AGOSEngine_PN::executeOpcode(int opcode) { (this->*op) (); } -#define readfromline() (_linct-- ? (int)*_workptr++ : readoverr()) - -int readoverr() { - error("readfromline: Internal Error - Line Over-run"); +int AGOSEngine_PN::readfromline() { + if (!_linct) + error("readfromline: Internal Error - Line Over-run"); + _linct--; + return *_workptr++; } // ----------------------------------------------------------------------- @@ -142,30 +143,30 @@ void AGOSEngine_PN::opn_opcode00() { setScriptReturn(true); } -void AGOSEngine_PN::opn_opcode01() { +void AGOSEngine_PN::opn_add() { uint8 *str = _workptr; int32 sp = varval() + varval(); _variableArray[12] = sp % 65536; _variableArray[13] = sp / 65536; if (sp > 65535) - sp=65535; + sp = 65535; writeval(str, (int)sp); setScriptReturn(true); } -void AGOSEngine_PN::opn_opcode02() { +void AGOSEngine_PN::opn_sub() { uint8 *str = _workptr; int32 sp = varval(); sp -= varval(); _variableArray[12] = sp % 65536; _variableArray[13] = sp / 65536; - if(sp < 0) + if (sp < 0) sp = 0; writeval(str, (int)sp); setScriptReturn(true); } -void AGOSEngine_PN::opn_opcode03() { +void AGOSEngine_PN::opn_mul() { uint8 *str = _workptr; int32 sp = varval() * varval(); _variableArray[12] = sp % 65536; @@ -176,12 +177,12 @@ void AGOSEngine_PN::opn_opcode03() { setScriptReturn(true); } -void AGOSEngine_PN::opn_opcode04() { +void AGOSEngine_PN::opn_div() { uint8 *str = _workptr; int32 sp = varval(); int32 sp2 = varval(); if (sp2 == 0) - error("Division by 0"); + error("opn_div: Division by 0"); sp = sp / sp2; _variableArray[12] = sp % 65536; _variableArray[13] = sp / 65536; @@ -234,7 +235,7 @@ void AGOSEngine_PN::opn_opcode12() { char bf[8]; int a = 0; sprintf(bf,"%d", varval()); - while(bf[a]) + while (bf[a]) pcf(bf[a++]); setScriptReturn(true); } @@ -243,7 +244,7 @@ void AGOSEngine_PN::opn_opcode13() { char bf[8]; int a = 0; sprintf(bf,"%d", varval()); - while(bf[a]) + while (bf[a]) pcf(bf[a++]); pcf((uint8)'\n'); setScriptReturn(true); @@ -271,25 +272,25 @@ void AGOSEngine_PN::opn_opcode16() { setScriptReturn((sp >= 0 && sp <= 4)); } -void AGOSEngine_PN::opn_opcode17() { +void AGOSEngine_PN::opn_lt() { int16 v1 = varval(); int16 v2 = varval(); setScriptReturn(v1 < v2); } -void AGOSEngine_PN::opn_opcode18() { +void AGOSEngine_PN::opn_gt() { int16 v1 = varval(); int16 v2 = varval(); setScriptReturn(v1 > v2); } -void AGOSEngine_PN::opn_opcode19() { +void AGOSEngine_PN::opn_eq() { int16 v1 = varval(); int16 v2 = varval(); setScriptReturn(v1 == v2); } -void AGOSEngine_PN::opn_opcode20() { +void AGOSEngine_PN::opn_neq() { int16 v1 = varval(); int16 v2 = varval(); setScriptReturn(v1 != v2); @@ -395,7 +396,8 @@ void AGOSEngine_PN::opn_opcode32() { char bf[60]; int a, slot; - if ((a = varval()) > 2) { + a = varval(); + if (a > 2) { setScriptReturn(true); return; } @@ -451,10 +453,8 @@ void AGOSEngine_PN::opn_opcode35() { } void AGOSEngine_PN::opn_opcode36() { - int ct = 0; - while (ct < _dataBase[57] + 1) - _wordcp[ct++] = 0; - ct = 1; + for (int i = 0; i < _dataBase[57] + 1; ++i) + _wordcp[i] = 0; if (isspace(*_inpp)) while ((*_inpp) && (isspace(*_inpp))) _inpp++; @@ -468,6 +468,8 @@ void AGOSEngine_PN::opn_opcode36() { setScriptReturn(true); return; } + + int ct = 1; while ((*_inpp != '.') && (*_inpp != ',') && (!isspace(*_inpp)) && (*_inpp != '\0') && (*_inpp!='"')) { if (ct < _dataBase[57]) @@ -734,37 +736,38 @@ int AGOSEngine_PN::varval() { int a; int b; - if ((a = readfromline()) < 247) { + a = readfromline(); + if (a < 247) { return a; } switch (a) { case 249: b = readfromline(); - return((int)(b + 256 * readfromline())); + return (int)(b + 256 * readfromline()); break; case 250: - return(readfromline()); + return readfromline(); case 251: - return((int)_variableArray[varval()]); + return (int)_variableArray[varval()]; case 252: b = varval(); - return((int)_dataBase[_quickptr[0] + b * _quickshort[0] + varval()]); + return (int)_dataBase[_quickptr[0] + b * _quickshort[0] + varval()]; case 254: b = varval(); - return((int)_dataBase[_quickptr[3] + b * _quickshort[2] + varval()]); + return (int)_dataBase[_quickptr[3] + b * _quickshort[2] + varval()]; case 247: b = varval(); - return((int)getptr(_quickptr[11] + (b * _quickshort[4]) + (2 * varval()))); + return (int)getptr(_quickptr[11] + (b * _quickshort[4]) + (2 * varval())); case 248: b = varval(); - return((int)getptr(_quickptr[12] + (b * _quickshort[5]) + (2 * varval()))); + return (int)getptr(_quickptr[12] + (b * _quickshort[5]) + (2 * varval())); case 253: b = varval(); - return(bitextract((int32)_quickptr[1] + b * _quickshort[1], varval())); + return bitextract((int32)_quickptr[1] + b * _quickshort[1], varval()); case 255: b = varval(); - return(bitextract((int32)_quickptr[4] + b * _quickshort[3], varval())); + return bitextract((int32)_quickptr[4] + b * _quickshort[3], varval()); default: error("VARVAL : Illegal code %d encountered", a); } @@ -837,7 +840,7 @@ int AGOSEngine_PN::actCallD(int n) { addstack(-1); funccpy(pf); setposition(n, 0); - return(doline(1)); + return doline(1); } int AGOSEngine_PN::doaction() { @@ -866,7 +869,10 @@ int AGOSEngine_PN::doline(int needsave) { if (mybuf == NULL) error("doline: Out of memory - stack overflow"); - if ((x = setjmp(*mybuf)) > 0) { + x = setjmp(*mybuf); + // Looking at the longjmp calls below, x can be -1, 1 or 2 + // (and of course 0 when it returns directly, as always). + if (x > 0) { dumpstack(); _cjmpbuff = ljmpbuff; free((char *)mybuf); @@ -882,24 +888,24 @@ int AGOSEngine_PN::doline(int needsave) { if (needsave) _stackbase->savearea = mybuf; -nln: _linct = ((*_linebase) & 127) - 1; - _workptr = _linebase + 1; - if (*_linebase > 127) { - x = varval(); - if (x != (int)_variableArray[1]) - goto skipln; - } - -carryon: do { - x = doaction(); - } while (x && !shouldQuit()); + _linct = ((*_linebase) & 127) - 1; + _workptr = _linebase + 1; + if (*_linebase > 127) { + x = varval(); + if (x != (int)_variableArray[1]) + goto skipln; + } -skipln: _linebase += 127 & *_linebase; - _linembr++; +carryon: + do { + x = doaction(); + } while (x && !shouldQuit()); - if (!shouldQuit()) - goto nln; +skipln: + _linebase += 127 & *_linebase; + _linembr++; + } while (!shouldQuit()); return 0; } @@ -951,12 +957,8 @@ int AGOSEngine_PN::findset() { } void AGOSEngine_PN::funccpy(int *store) { - int a = 0; - int b = 24; - - while (a < 8) { - _variableArray[b++] = *store++; - a++; + for (int i = 24; i < 32; ++i) { + _variableArray[i] = *store++; } } @@ -990,23 +992,28 @@ int AGOSEngine_PN::gvwrd(uint8 *wptr, int mask) { int AGOSEngine_PN::setposition(int process, int line) { uint8 *ourptr; int np; - int ct = 0; - ourptr = _dataBase + getlong(_quickptr[6] + 3L * process); + int ct; + + ourptr = _dataBase + getlong(_quickptr[6] + 3 * process); np = *ourptr++; - while (ct < line) { + for (ct = 0; ct < line; ++ct) { ourptr += (127 & *ourptr); - ct++; } -x1: _linebase = ourptr; - _linct = (127 & (*ourptr)) - 1; - if (*ourptr++ > 127) { + + while (true) { + _linebase = ourptr; + _linct = (127 & *ourptr) - 1; + if (*ourptr++ <= 127) + break; + ct = varval(); - if (ct != (int)_variableArray[1]) { - ourptr += _linct - 1; - line++; - goto x1; - } + if (ct == (int)_variableArray[1]) + break; + + ourptr += _linct - 1; + line++; } + _linembr = line; _procnum = process; _variableArray[0] = process; @@ -1035,22 +1042,20 @@ int AGOSEngine_PN::wrdmatch(uint8 *word1, int mask1, uint8 *word2, int mask2) { // ----------------------------------------------------------------------- void AGOSEngine_PN::addstack(int type) { - struct stackframe *a; - int pt, ct = 0; + StackFrame *a; + int i; - a = (struct stackframe *)malloc(sizeof(struct stackframe)); + a = (StackFrame *)malloc(sizeof(StackFrame)); if (a == NULL) error("addstack: Out of memory - stack overflow"); a->nextframe = _stackbase; _stackbase = a; - pt = 0; - while (ct < 6) - a->flag[ct++] = _variableArray[pt++]; - ct = 0; - pt = 24; - while (ct < 8) - a->param[ct++] = _variableArray[pt++]; + + for (i = 0; i < 6; ++i) + a->flag[i] = _variableArray[i]; + for (i = 0; i < 8; ++i) + a->param[i] = _variableArray[24 + i]; a->classnum = type; a->ll = _linct; a->linenum = _linembr; @@ -1060,7 +1065,7 @@ void AGOSEngine_PN::addstack(int type) { } void AGOSEngine_PN::dumpstack() { - struct stackframe *a; + StackFrame *a; if (_stackbase == NULL) error("dumpstack: Stack underflow or unknown longjmp"); @@ -1071,7 +1076,7 @@ void AGOSEngine_PN::dumpstack() { } void AGOSEngine_PN::junkstack() { - struct stackframe *a; + StackFrame *a; if (_stackbase == NULL) error("junkstack: Stack underflow or unknown longjmp"); @@ -1084,7 +1089,7 @@ void AGOSEngine_PN::junkstack() { } void AGOSEngine_PN::popstack(int type) { - int a = 0, b; + int i; while ((_stackbase != NULL) && (_stackbase->classnum != type)) junkstack(); @@ -1097,13 +1102,10 @@ void AGOSEngine_PN::popstack(int type) { _workptr = _stackbase->linpos; _procnum = _stackbase->process; _linembr = _stackbase->linenum; - b = 0; - while (a < 6) - _variableArray[b++] = _stackbase->flag[a++]; - b = 24; - a = 0; - while (a < 8) - _variableArray[b++] = _stackbase->param[a++]; + for (i = 0; i < 6; ++i) + _variableArray[i] = _stackbase->flag[i]; + for (i = 0; i < 8; ++i) + _variableArray[24 + i] = _stackbase->param[i]; } } // End of namespace AGOS -- cgit v1.2.3 From cc60b13597b27f6c04c3c6e0ce82faa294b3c3a1 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 14 Jul 2009 21:50:22 +0000 Subject: AGOS: Fixed potential OOBA crash in AGOSEngine_PN::opn_opcode26 svn-id: r42492 --- engines/agos/script_pn.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/agos/script_pn.cpp b/engines/agos/script_pn.cpp index 8c16765765..9fe05f7f6a 100644 --- a/engines/agos/script_pn.cpp +++ b/engines/agos/script_pn.cpp @@ -328,7 +328,7 @@ void AGOSEngine_PN::opn_opcode25() { } void AGOSEngine_PN::opn_opcode26() { - while ((_stackbase->classnum != -1) && (_stackbase != NULL)) + while ((_stackbase != NULL) && (_stackbase->classnum != -1)) junkstack(); dumpstack(); setScriptReturn(true); -- cgit v1.2.3 From 59b35ff5fbb00b47b473c8d0c5ff670bd500e347 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 14 Jul 2009 22:47:33 +0000 Subject: Fix graphics glitch in LoL PC98 intro. svn-id: r42493 --- engines/kyra/script_lol.cpp | 4 ++-- engines/kyra/script_tim.cpp | 10 ++++++++-- engines/kyra/sequences_lol.cpp | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index 611ad8f9ef..e4b77f6a07 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -2345,8 +2345,8 @@ int LoLEngine::tlol_processWsaFrame(const TIM *tim, const uint16 *param) { int h2 = (h1 * factor) / 100; anim->wsa->displayFrame(frame, 2, x1, y1, anim->wsaCopyParams & 0xF0FF, 0, 0); - _screen->wsaFrameAnimationStep(x1, y1, x2, y2, w1, h1, w2, h2, 2, _flags.isDemo ? 0 : 8, 0); - if (!_flags.isDemo) + _screen->wsaFrameAnimationStep(x1, y1, x2, y2, w1, h1, w2, h2, 2, _flags.isDemo && _flags.platform != Common::kPlatformPC98 ? 0 : 8, 0); + if (!_flags.isDemo && _flags.platform != Common::kPlatformPC98) _screen->checkedPageUpdate(8, 4); _screen->updateScreen(); diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp index bc62e5bd6a..731b8d206f 100644 --- a/engines/kyra/script_tim.cpp +++ b/engines/kyra/script_tim.cpp @@ -98,7 +98,10 @@ TIMInterpreter::TIMInterpreter(KyraEngine_v1 *engine, Screen_v2 *screen_v2, OSys _textDisplayed = false; _textAreaBuffer = new uint8[320*40]; assert(_textAreaBuffer); - _drawPage2 = (_vm->gameFlags().isDemo && _vm->gameFlags().gameID == GI_LOL) ? 0 : 8; + if ((_vm->gameFlags().platform == Common::kPlatformPC98 || _vm->gameFlags().isDemo) && _vm->gameFlags().gameID == GI_LOL) + _drawPage2 = 0; + else + _drawPage2 = 8; _palDelayInc = _palDiff = _palDelayAcc = 0; _abortFlag = 0; @@ -461,7 +464,10 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char anim->wsaCopyParams = wsaFlags; const bool isLoLDemo = _vm->gameFlags().isDemo && _vm->gameFlags().gameID == GI_LOL; - _drawPage2 = (isLoLDemo || _currentTim->isLoLOutro) ? 0 : 8; + if (isLoLDemo || _vm->gameFlags().platform == Common::kPlatformPC98 || _currentTim->isLoLOutro) + _drawPage2 = 0; + else + _drawPage2 = 8; uint16 wsaOpenFlags = 0; if (isLoLDemo) { diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp index beea129f66..5826b2b09e 100644 --- a/engines/kyra/sequences_lol.cpp +++ b/engines/kyra/sequences_lol.cpp @@ -224,7 +224,7 @@ void LoLEngine::showIntro() { while (!_tim->finished() && !shouldQuit() && !skipFlag()) { updateInput(); _tim->exec(intro, false); - if (!_flags.isDemo) + if (!_flags.isDemo && _flags.platform != Common::kPlatformPC98) _screen->checkedPageUpdate(8, 4); if (_tim->_palDiff) { -- cgit v1.2.3 From 99fc508609e0def31b9e5c7b59e28fada54c0e1e Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 14 Jul 2009 23:03:25 +0000 Subject: AGOS: Some more cleanup and added some comments to the PN code svn-id: r42494 --- engines/agos/pn.cpp | 10 ++++----- engines/agos/script_pn.cpp | 56 ++++++++++++++++++++++++++++++---------------- 2 files changed, 42 insertions(+), 24 deletions(-) diff --git a/engines/agos/pn.cpp b/engines/agos/pn.cpp index fd88d63ec3..d92efa9077 100644 --- a/engines/agos/pn.cpp +++ b/engines/agos/pn.cpp @@ -269,16 +269,16 @@ void AGOSEngine_PN::processor() { _variableArray[16] = _quickshort[6]; _variableArray[17] = _quickshort[7]; _variableArray[19] = getptr(55L); + + // q indicates the process to run and is 0 the first time, + // but 1 later on (i.e., when we are "called" from badload()). setposition(q, 0); doline(0); } void AGOSEngine_PN::setqptrs() { - int a = 0; - - while (a < 11) { - _quickptr[a] = getlong(3L * a); - a++; + for (int i = 0; i < 11; ++i) { + _quickptr[i] = getlong(3 * i); } _quickptr[11] = getlong(58L); _quickptr[12] = getlong(61L); diff --git a/engines/agos/script_pn.cpp b/engines/agos/script_pn.cpp index 9fe05f7f6a..4f9aab2965 100644 --- a/engines/agos/script_pn.cpp +++ b/engines/agos/script_pn.cpp @@ -30,6 +30,10 @@ namespace AGOS { +enum { + kJmpClassNum = -1 +}; + #define OPCODE(x) _OPCODE(AGOSEngine_PN, x) void AGOSEngine_PN::setupOpcodes() { @@ -122,7 +126,7 @@ void AGOSEngine_PN::setupOpcodes() { void AGOSEngine_PN::executeOpcode(int opcode) { OpcodeProcPN op = _opcodesPN[opcode].proc; - (this->*op) (); + (this->*op)(); } int AGOSEngine_PN::readfromline() { @@ -303,11 +307,10 @@ void AGOSEngine_PN::opn_opcode21() { void AGOSEngine_PN::opn_opcode22() { int pf[8]; - int a; - a = varval(); - funcentry(pf, a); + int n = varval(); + funcentry(pf, n); funccpy(pf); - setposition(a, 0); + setposition(n, 0); setScriptReturn(true); } @@ -316,19 +319,27 @@ void AGOSEngine_PN::opn_opcode23() { } void AGOSEngine_PN::opn_opcode24() { - popstack(-1); + popstack(kJmpClassNum); + // Jump back to the last doline, which will return 2-1=1. + // That value then is returned to actCallD, which once again + // returns it. In the end, this amounts to a setScriptReturn(true) + // (but possibly in a different level than the current one). longjmp(*(_stackbase->savearea), 2); setScriptReturn(false); } void AGOSEngine_PN::opn_opcode25() { - popstack(-1); + popstack(kJmpClassNum); + // Jump back to the last doline, which will return 1-1=0. + // That value then is returned to actCallD, which once again + // returns it. In the end, this amounts to a setScriptReturn(false) + // (but possibly in a different level than the current one). longjmp(*(_stackbase->savearea), 1); setScriptReturn(false); } void AGOSEngine_PN::opn_opcode26() { - while ((_stackbase != NULL) && (_stackbase->classnum != -1)) + while ((_stackbase != NULL) && (_stackbase->classnum != kJmpClassNum)) junkstack(); dumpstack(); setScriptReturn(true); @@ -348,6 +359,8 @@ void AGOSEngine_PN::opn_opcode28() { void AGOSEngine_PN::opn_opcode29() { popstack(varval()); + // Jump back to the last doline indicated by the top stackfram. + // The -1 tells it to simply go on with its business. longjmp(*(_stackbase->savearea), -1); setScriptReturn(false); } @@ -837,7 +850,7 @@ void AGOSEngine_PN::setbitf(uint32 ptr, int offs, int val) { int AGOSEngine_PN::actCallD(int n) { int pf[8]; funcentry(pf, n); - addstack(-1); + addstack(kJmpClassNum); funccpy(pf); setposition(n, 0); return doline(1); @@ -862,7 +875,7 @@ int AGOSEngine_PN::doaction() { int AGOSEngine_PN::doline(int needsave) { int x; - jmp_buf *ljmpbuff = NULL; + jmp_buf *old_jmpbuf = NULL; jmp_buf *mybuf; mybuf = (jmp_buf *)malloc(sizeof(jmp_buf)); @@ -874,16 +887,25 @@ int AGOSEngine_PN::doline(int needsave) { // (and of course 0 when it returns directly, as always). if (x > 0) { dumpstack(); - _cjmpbuff = ljmpbuff; + // Restore the active jmpbuf to its previous value, + // then return the longjmp value (will be 2-1=1 or 1-1=0). + _cjmpbuff = old_jmpbuf; free((char *)mybuf); return (x - 1); } if (x == -1) { + // Make this doline instance the active one (again). + // This is used to "return" over possibly multiple + // layers of nested script invocations. + // Kind of like throwing an exception. _cjmpbuff = mybuf; goto carryon; } - ljmpbuff = _cjmpbuff; + + // Remember the previous active jmpbuf (gets restored + // above when a longjmp with a positive param occurs). + old_jmpbuf = _cjmpbuff; _cjmpbuff = mybuf; if (needsave) _stackbase->savearea = mybuf; @@ -963,13 +985,9 @@ void AGOSEngine_PN::funccpy(int *store) { } void AGOSEngine_PN::funcentry(int *store, int procn) { - int ct = 0; - int nprm; - - nprm = _dataBase[getlong(_quickptr[6] + 3L * procn)]; - while (ct < nprm) { + int numParams = _dataBase[getlong(_quickptr[6] + 3 * procn)]; + for (int i = 0; i < numParams; ++i) { *store++ = varval(); - ct++; } } @@ -1082,7 +1100,7 @@ void AGOSEngine_PN::junkstack() { error("junkstack: Stack underflow or unknown longjmp"); a = _stackbase->nextframe; - if (_stackbase->classnum == -1) + if (_stackbase->classnum == kJmpClassNum) free((char *)_stackbase->savearea); free((char *)_stackbase); _stackbase = a; -- cgit v1.2.3 From 3a3b71622ae653588ca3f1673e5674a789c6d46b Mon Sep 17 00:00:00 2001 From: Kari Salminen Date: Tue, 14 Jul 2009 23:03:40 +0000 Subject: Remove ioFailed() usage from AGI engine. svn-id: r42495 --- engines/agi/graphics.cpp | 2 +- engines/agi/sound.cpp | 8 ++++---- engines/agi/wagparser.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp index ad2c264184..3461bb473e 100644 --- a/engines/agi/graphics.cpp +++ b/engines/agi/graphics.cpp @@ -846,7 +846,7 @@ void GfxMgr::setAGIPal(int p0) { //Chunks4-7 are duplicates of chunks0-3 - if (agipal.ioFailed()) { + if (agipal.eos() || agipal.err()) { warning("Couldn't read AGIPAL palette from '%s'. Not changing palette", filename); return; } diff --git a/engines/agi/sound.cpp b/engines/agi/sound.cpp index fb73c6b71f..5a39b663a5 100644 --- a/engines/agi/sound.cpp +++ b/engines/agi/sound.cpp @@ -133,7 +133,7 @@ bool IIgsEnvelope::read(Common::SeekableReadStream &stream) { seg[segNum].inc = stream.readUint16LE(); } - return !stream.ioFailed(); + return !(stream.eos() || stream.err()); } /** Reads an Apple IIGS wave information structure from the given stream. */ @@ -154,7 +154,7 @@ bool IIgsWaveInfo::read(Common::SeekableReadStream &stream, bool ignoreAddr) { if (ignoreAddr) addr = 0; - return !stream.ioFailed(); + return !(stream.eos() || stream.err()); } bool IIgsWaveInfo::finalize(Common::SeekableReadStream &uint8Wave) { @@ -219,7 +219,7 @@ bool IIgsInstrumentHeader::read(Common::SeekableReadStream &stream, bool ignoreA byte wac = stream.readByte(); // Read A wave count byte wbc = stream.readByte(); // Read B wave count oscList.read(stream, wac, ignoreAddr); // Read the oscillators - return (wac == wbc) && !stream.ioFailed(); // A and B wave counts must match + return (wac == wbc) && !(stream.eos() || stream.err()); // A and B wave counts must match } bool IIgsInstrumentHeader::finalize(Common::SeekableReadStream &uint8Wave) { @@ -1158,7 +1158,7 @@ bool SoundMgr::convertWave(Common::SeekableReadStream &source, int8 *dest, uint // Convert the wave from 8-bit unsigned to 8-bit signed format for (uint i = 0; i < length; i++) dest[i] = (int8) ((int) source.readByte() - 128); - return !source.ioFailed(); + return !(source.eos() || source.err()); } bool IIgsSoundMgr::loadWaveFile(const Common::FSNode &wavePath, const IIgsExeInfo &exeInfo) { diff --git a/engines/agi/wagparser.cpp b/engines/agi/wagparser.cpp index e6ed5345e0..d243439dff 100644 --- a/engines/agi/wagparser.cpp +++ b/engines/agi/wagparser.cpp @@ -70,7 +70,7 @@ bool WagProperty::read(Common::SeekableReadStream &stream) { _propNum = stream.readByte(); _propSize = stream.readUint16LE(); - if (stream.ioFailed()) { // Check that we got the whole header + if (stream.eos() || stream.err()) { // Check that we got the whole header _readOk = false; return _readOk; } -- cgit v1.2.3 From b159517dc3f55f3589bf9b7727607e7d216fde52 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 15 Jul 2009 02:06:26 +0000 Subject: Fix bug #2821215 - DIG: Skipping planetarium animation disables F5 menu. svn-id: r42498 --- engines/scumm/input.cpp | 17 +++++++++++++++-- engines/scumm/script_v6.cpp | 5 +++-- engines/scumm/scumm.cpp | 1 + engines/scumm/scumm_v6.h | 1 + engines/scumm/scumm_v7.h | 1 + 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp index 42b48a3f3d..61b714a3e2 100644 --- a/engines/scumm/input.cpp +++ b/engines/scumm/input.cpp @@ -258,6 +258,18 @@ void ScummEngine_v0::processInput() { ScummEngine::processInput(); } +#ifdef ENABLE_SCUMM_7_8 +void ScummEngine_v7::processInput() { + ScummEngine::processInput(); + + if (_skipVideo && !_smushActive) { + abortCutscene(); + _mouseAndKeyboardStat = Common::ASCII_ESCAPE; + _skipVideo = false; + } +} +#endif + void ScummEngine::processInput() { Common::KeyState lastKeyHit = _keyPressed; _keyPressed.reset(); @@ -392,9 +404,10 @@ void ScummEngine_v7::processKeyboard(Common::KeyState lastKeyHit) { _insane->escapeKeyHandler(); else _smushVideoShouldFinish = true; - } - if (!_smushActive || _smushVideoShouldFinish) + _skipVideo = true; + } else { abortCutscene(); + } _mouseAndKeyboardStat = Common::ASCII_ESCAPE; diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp index c23a64be5b..dcd60352c7 100644 --- a/engines/scumm/script_v6.cpp +++ b/engines/scumm/script_v6.cpp @@ -1396,6 +1396,7 @@ void ScummEngine_v6::o6_getVerbFromXY() { void ScummEngine_v6::o6_beginOverride() { beginOverride(); + _skipVideo = 0; } void ScummEngine_v6::o6_endOverride() { @@ -2457,7 +2458,7 @@ void ScummEngine_v7::o6_kernelSetFunctions() { break; case 6: { // SMUSH movie playback - if (args[1] == 0) { + if (args[1] == 0 && !_skipVideo) { const char *videoname = (const char *)getStringAddressVar(VAR_VIDEONAME); assert(videoname); @@ -2474,7 +2475,7 @@ void ScummEngine_v7::o6_kernelSetFunctions() { if (_game.id == GID_DIG) { _disableFadeInEffect = true; } - } else if (_game.id == GID_FT) { + } else if (_game.id == GID_FT && !_skipVideo) { const int insaneVarNum = ((_game.features & GF_DEMO) && (_game.platform == Common::kPlatformPC)) ? 232 : 233; diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 143c550180..42fbb590b3 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -682,6 +682,7 @@ ScummEngine_v6::ScummEngine_v6(OSystem *syst, const DetectorResult &dr) _curVerbSlot = 0; _forcedWaitForMessage = false; + _skipVideo = false; VAR_VIDEONAME = 0xFF; VAR_RANDOM_NR = 0xFF; diff --git a/engines/scumm/scumm_v6.h b/engines/scumm/scumm_v6.h index d4768a7e92..eb55b83596 100644 --- a/engines/scumm/scumm_v6.h +++ b/engines/scumm/scumm_v6.h @@ -93,6 +93,7 @@ protected: int _curVerbSlot; bool _forcedWaitForMessage; + bool _skipVideo; public: ScummEngine_v6(OSystem *syst, const DetectorResult &dr); diff --git a/engines/scumm/scumm_v7.h b/engines/scumm/scumm_v7.h index fdc1d6de9c..fcadadb04d 100644 --- a/engines/scumm/scumm_v7.h +++ b/engines/scumm/scumm_v7.h @@ -103,6 +103,7 @@ protected: virtual void scummLoop_handleSound(); virtual void scummLoop_handleDrawing(); + virtual void processInput(); virtual void processKeyboard(Common::KeyState lastKeyHit); virtual void setupScumm(); -- cgit v1.2.3 From 9c06549d318be73de69e7e42ccbe49f99bbdc7cd Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 15 Jul 2009 05:00:59 +0000 Subject: Hack is no longer required, due to revision 42498. svn-id: r42499 --- engines/scumm/script.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp index 78f7fb0453..4d9447bee5 100644 --- a/engines/scumm/script.cpp +++ b/engines/scumm/script.cpp @@ -1367,17 +1367,6 @@ void ScummEngine::abortCutscene() { VAR(VAR_OVERRIDE) = 1; vm.cutScenePtr[idx] = 0; - - // HACK to fix issues with SMUSH and the way it does keyboard handling. - // In particular, normally abortCutscene() is being called while no - // scripts are active. But SMUSH runs from *inside* the script engine. - // And it calls abortCutscene() if ESC is pressed... not good. - // Proper fix might be to let SMUSH/INSANE run from outside the script - // engine but that would require lots of changes and may actually have - // negative effects, too. So we cheat here, to fix bug #751670. - if (_game.version == 7) - getScriptEntryPoint(); - } } -- cgit v1.2.3 From 544bf83f33d41499b14e891a8eb395e556673b97 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 15 Jul 2009 08:55:12 +0000 Subject: Created a system for inserting arbitrary code fragments into game scripts, and added an initial fragment to fix the bug of being stuck in the past in the DW1 SCN version svn-id: r42500 --- engines/tinsel/pcode.cpp | 125 +++++++++++++++++++++++++++++++++++++---------- engines/tinsel/pcode.h | 14 ++++++ 2 files changed, 112 insertions(+), 27 deletions(-) diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp index a9c6f43d85..ac7bf9970f 100644 --- a/engines/tinsel/pcode.cpp +++ b/engines/tinsel/pcode.cpp @@ -112,6 +112,21 @@ static INT_CONTEXT *icList = 0; static uint32 hMasterScript; +//----------------- SCRIPT BUGS WORKAROUNDS -------------- + +const byte fragment1[] = {(byte)OP_ZERO, (byte) OP_GSTORE | OPSIZE16, 206, 0}; +const int fragment1_size = 4; + +const WorkaroundEntry workaroundList[] = { + // Global 206 in DW1-SCN is whether Rincewind is trying to take the book back to the present. + // In the GRA version, it was global 373, and was reset when he is returned to the past, but + // was forgotten in the SCN version, so this ensures the flag is properly reset + {TINSEL_V1, true, 427942095, 1, fragment1_size, fragment1}, + {TINSEL_V0, false, 0, 0, 0, NULL} +}; + +//----------------- LOCAL GLOBAL DATA -------------------- + /** * Keeps the code array pointer up to date. */ @@ -398,30 +413,67 @@ void SaveInterpretContexts(INT_CONTEXT *sICInfo) { } /** - * Fetch (and sign extend, if necessary) a 8/16/32 bit value from the code - * stream and advance the instruction pointer accordingly. + * Fetches up to 4 bytes from the code script */ -static int32 Fetch(byte opcode, byte *code, int &ip) { - int32 tmp; - if (TinselV0) { - // Fetch a 32 bit value. - tmp = (int32)READ_LE_UINT32(code + ip++ * 4); - } else if (opcode & OPSIZE8) { +static int32 GetBytes(const byte *scriptCode, const WorkaroundEntry* &wkEntry, int &ip, uint numBytes) { + assert(numBytes <= 4 && numBytes != 3); + const byte *code = scriptCode; + + if (wkEntry != NULL) { + if (ip >= wkEntry->numBytes) { + // Finished the workaround + ip = wkEntry->ip; + wkEntry = NULL; + } else { + code = wkEntry->script; + } + } + + uint32 tmp; + switch (numBytes) { + case 0: + // Instruction byte + tmp = code[ip++ * (TinselV0 ? 4 : 1)]; + break; + case 1: // Fetch and sign extend a 8 bit value to 32 bits. - tmp = *(int8 *)(code + ip); - ip += 1; - } else if (opcode & OPSIZE16) { + tmp = (int8)code[ip++]; + break; + case 2: // Fetch and sign extend a 16 bit value to 32 bits. tmp = (int16)READ_LE_UINT16(code + ip); ip += 2; - } else { - // Fetch a 32 bit value. - tmp = (int32)READ_LE_UINT32(code + ip); - ip += 4; + break; + default: + if (TinselV0) + tmp = (int32)READ_LE_UINT32(code + ip++ * 4); + else { + tmp = (int32)READ_LE_UINT32(code + ip); + ip += 4; + } + break; } + return tmp; } +/** + * Fetch (and sign extend, if necessary) a 8/16/32 bit value from the code + * stream and advance the instruction pointer accordingly. + */ +static int32 Fetch(byte opcode, const byte *code, const WorkaroundEntry* &wkEntry, int &ip) { + if (TinselV0) + // Fetch a 32 bit value. + return GetBytes(code, wkEntry, ip, 4); + else if (opcode & OPSIZE8) + // Fetch and sign extend a 8 bit value to 32 bits. + return GetBytes(code, wkEntry, ip, 1); + else if (opcode & OPSIZE16) + return GetBytes(code, wkEntry, ip, 2); + + return GetBytes(code, wkEntry, ip, 4); +} + /** * Interprets the PCODE instructions in the code array. */ @@ -429,7 +481,25 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) { do { int tmp, tmp2; int ip = ic->ip; - byte opcode = ic->code[ip++ * (TinselV0 ? 4 : 1)]; + const WorkaroundEntry *wkEntry = ic->fragmentPtr; + + if (wkEntry == NULL) { + // Check to see if a workaround fragment needs to be executed + for (wkEntry = workaroundList; wkEntry->script != NULL; ++wkEntry) { + if ((wkEntry->version == TinselVersion) && + (wkEntry->hCode == ic->hCode) && + (wkEntry->ip == ip) && + (!TinselV1 || (wkEntry->scnFlag == ((_vm->getFeatures() & GF_SCNFILES) != 0)))) { + // Point to start of workaround fragment + ip = 0; + break; + } + } + if (wkEntry->script == NULL) + wkEntry = NULL; + } + + byte opcode = (byte)GetBytes(ic->code, wkEntry, ip, 0); if (TinselV0 && ((opcode & OPMASK) > OP_IMM)) opcode += 3; @@ -447,7 +517,7 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) { case OP_FONT: // loads font handle onto stack case OP_PAL: // loads palette handle onto stack - ic->stack[++ic->sp] = Fetch(opcode, ic->code, ip); + ic->stack[++ic->sp] = Fetch(opcode, ic->code, wkEntry, ip); break; case OP_ZERO: // loads zero onto stack @@ -464,31 +534,31 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) { case OP_LOAD: // loads local variable onto stack - ic->stack[++ic->sp] = ic->stack[ic->bp + Fetch(opcode, ic->code, ip)]; + ic->stack[++ic->sp] = ic->stack[ic->bp + Fetch(opcode, ic->code, wkEntry, ip)]; break; case OP_GLOAD: // loads global variable onto stack - tmp = Fetch(opcode, ic->code, ip); + tmp = Fetch(opcode, ic->code, wkEntry, ip); assert(0 <= tmp && tmp < numGlobals); ic->stack[++ic->sp] = pGlobals[tmp]; break; case OP_STORE: // pops stack and stores in local variable - ic->stack[ic->bp + Fetch(opcode, ic->code, ip)] = ic->stack[ic->sp--]; + ic->stack[ic->bp + Fetch(opcode, ic->code, wkEntry, ip)] = ic->stack[ic->sp--]; break; case OP_GSTORE: // pops stack and stores in global variable - tmp = Fetch(opcode, ic->code, ip); + tmp = Fetch(opcode, ic->code, wkEntry, ip); assert(0 <= tmp && tmp < numGlobals); pGlobals[tmp] = ic->stack[ic->sp--]; break; case OP_CALL: // procedure call - tmp = Fetch(opcode, ic->code, ip); + tmp = Fetch(opcode, ic->code, wkEntry, ip); //assert(0 <= tmp && tmp < codeSize); // TODO: Verify jumps are not out of bounds ic->stack[ic->sp + 1] = 0; // static link ic->stack[ic->sp + 2] = ic->bp; // dynamic link @@ -499,7 +569,7 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) { case OP_LIBCALL: // library procedure or function call - tmp = Fetch(opcode, ic->code, ip); + tmp = Fetch(opcode, ic->code, wkEntry, ip); // NOTE: Interpret() itself is not using the coroutine facilities, // but still accepts a CORO_PARAM, so from the outside it looks // like a coroutine. In fact it may still acts as a kind of "proxy" @@ -538,17 +608,17 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) { case OP_ALLOC: // allocate storage on stack - ic->sp += (int32)Fetch(opcode, ic->code, ip); + ic->sp += (int32)Fetch(opcode, ic->code, wkEntry, ip); break; case OP_JUMP: // unconditional jump - ip = Fetch(opcode, ic->code, ip); + ip = Fetch(opcode, ic->code, wkEntry, ip); break; case OP_JMPFALSE: // conditional jump - tmp = Fetch(opcode, ic->code, ip); + tmp = Fetch(opcode, ic->code, wkEntry, ip); if (ic->stack[ic->sp--] == 0) { // condition satisfied - do the jump ip = tmp; @@ -557,7 +627,7 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) { case OP_JMPTRUE: // conditional jump - tmp = Fetch(opcode, ic->code, ip); + tmp = Fetch(opcode, ic->code, wkEntry, ip); if (ic->stack[ic->sp--] != 0) { // condition satisfied - do the jump ip = tmp; @@ -660,6 +730,7 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) { // check for stack under-overflow assert(ic->sp >= 0 && ic->sp < PCODE_STACK_SIZE); ic->ip = ip; + ic->fragmentPtr = wkEntry; } while (!ic->bHalt); // make sure stack is unwound diff --git a/engines/tinsel/pcode.h b/engines/tinsel/pcode.h index 4bdfcf5626..fad50cdb9d 100644 --- a/engines/tinsel/pcode.h +++ b/engines/tinsel/pcode.h @@ -54,6 +54,17 @@ enum GSORT { enum RESCODE {RES_WAITING, RES_FINISHED, RES_CUTSHORT}; +// The following structure is used to introduce bug fixes into the scripts used by the games + +struct WorkaroundEntry { + TinselEngineVersion version; + bool scnFlag; // Only applicable for Tinsel 1 (DW 1) + SCNHANDLE hCode; // Script to apply fragment to + int ip; // Script offset to run this fragment before + int numBytes; // Number of bytes in the script + const byte *script; // Instruction(s) to execute +}; + struct INT_CONTEXT { // Elements for interpret context management @@ -82,6 +93,9 @@ struct INT_CONTEXT { RESCODE resumeCode; RESUME_STATE resumeState; + // Used to store execution state within a script workaround fragment + const WorkaroundEntry *fragmentPtr; + void syncWithSerializer(Common::Serializer &s); }; typedef INT_CONTEXT *PINT_CONTEXT; -- cgit v1.2.3 From baabc623f6e328718f94e907ce15112ec3078305 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 15 Jul 2009 10:04:50 +0000 Subject: Got rid of two more ioFailed uses svn-id: r42501 --- engines/groovie/resource.cpp | 2 +- sound/aiff.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/groovie/resource.cpp b/engines/groovie/resource.cpp index eda3f0bec0..148fa9c451 100644 --- a/engines/groovie/resource.cpp +++ b/engines/groovie/resource.cpp @@ -98,7 +98,7 @@ uint16 ResMan_t7g::getRef(Common::String name, Common::String scriptname) { uint16 resNum; bool found = false; - for (resNum = 0; !found && !rlFile.ioFailed(); resNum++) { + for (resNum = 0; !found && !rlFile.err() && !rlFile.eos(); resNum++) { // Read the resource name char readname[12]; rlFile.read(readname, 12); diff --git a/sound/aiff.cpp b/sound/aiff.cpp index 884becb212..3c8a7f02a4 100644 --- a/sound/aiff.cpp +++ b/sound/aiff.cpp @@ -94,7 +94,7 @@ bool loadAIFFFromStream(Common::SeekableReadStream &stream, int &size, int &rate uint16 numChannels = 0, bitsPerSample = 0; uint32 numSampleFrames = 0, offset = 0, blockSize = 0, soundOffset = 0; - while ((!foundCOMM || !foundSSND) && !stream.ioFailed()) { + while (!(foundCOMM && foundSSND) && !stream.err() && !stream.eos()) { uint32 length, pos; stream.read(buf, 4); -- cgit v1.2.3 From 7751cea790b962467b67d775bbbd6a6f68f2082a Mon Sep 17 00:00:00 2001 From: Kari Salminen Date: Wed, 15 Jul 2009 13:04:17 +0000 Subject: Remove ioFailed() usage from Cine engine. svn-id: r42502 --- engines/cine/saveload.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/engines/cine/saveload.cpp b/engines/cine/saveload.cpp index ea0ff0079b..be1e19b229 100644 --- a/engines/cine/saveload.cpp +++ b/engines/cine/saveload.cpp @@ -49,7 +49,7 @@ bool loadChunkHeader(Common::SeekableReadStream &in, ChunkHeader &header) { header.id = in.readUint32BE(); header.version = in.readUint32BE(); header.size = in.readUint32BE(); - return !in.ioFailed(); + return !(in.eos() || in.err()); } /*! \brief Savegame format detector @@ -240,21 +240,21 @@ bool loadObjectTable(Common::SeekableReadStream &in) { in.read(objectTable[i].name, 20); objectTable[i].part = in.readUint16BE(); } - return !in.ioFailed(); + return !(in.eos() || in.err()); } bool loadZoneData(Common::SeekableReadStream &in) { for (int i = 0; i < 16; i++) { zoneData[i] = in.readUint16BE(); } - return !in.ioFailed(); + return !(in.eos() || in.err()); } bool loadCommandVariables(Common::SeekableReadStream &in) { for (int i = 0; i < 4; i++) { commandVar3[i] = in.readUint16BE(); } - return !in.ioFailed(); + return !(in.eos() || in.err()); } bool loadScreenParams(Common::SeekableReadStream &in) { @@ -265,7 +265,7 @@ bool loadScreenParams(Common::SeekableReadStream &in) { in.readUint16BE(); in.readUint16BE(); in.readUint16BE(); - return !in.ioFailed(); + return !(in.eos() || in.err()); } bool loadGlobalScripts(Common::SeekableReadStream &in) { @@ -273,7 +273,7 @@ bool loadGlobalScripts(Common::SeekableReadStream &in) { for (int i = 0; i < size; i++) { loadScriptFromSave(in, true); } - return !in.ioFailed(); + return !(in.eos() || in.err()); } bool loadObjectScripts(Common::SeekableReadStream &in) { @@ -281,7 +281,7 @@ bool loadObjectScripts(Common::SeekableReadStream &in) { for (int i = 0; i < size; i++) { loadScriptFromSave(in, false); } - return !in.ioFailed(); + return !(in.eos() || in.err()); } bool loadOverlayList(Common::SeekableReadStream &in) { @@ -289,7 +289,7 @@ bool loadOverlayList(Common::SeekableReadStream &in) { for (int i = 0; i < size; i++) { loadOverlayFromSave(in); } - return !in.ioFailed(); + return !(in.eos() || in.err()); } bool loadSeqList(Common::SeekableReadStream &in) { @@ -312,14 +312,14 @@ bool loadSeqList(Common::SeekableReadStream &in) { tmp.var1E = in.readSint16BE(); seqList.push_back(tmp); } - return !in.ioFailed(); + return !(in.eos() || in.err()); } bool loadZoneQuery(Common::SeekableReadStream &in) { for (int i = 0; i < 16; i++) { zoneQuery[i] = in.readUint16BE(); } - return !in.ioFailed(); + return !(in.eos() || in.err()); } void saveObjectTable(Common::OutSaveFile &out) { @@ -632,7 +632,7 @@ bool CineEngine::loadTempSaveOS(Common::SeekableReadStream &in) { warning("loadTempSaveOS: Loaded the savefile but didn't exhaust it completely. Something was left over"); } - return !in.ioFailed(); + return !(in.eos() || in.err()); } bool CineEngine::loadPlainSaveFW(Common::SeekableReadStream &in, CineSaveGameFormat saveGameFormat) { @@ -755,7 +755,7 @@ bool CineEngine::loadPlainSaveFW(Common::SeekableReadStream &in, CineSaveGameFor } } - return !in.ioFailed(); + return !(in.eos() || in.err()); } bool CineEngine::makeLoad(char *saveName) { -- cgit v1.2.3 From 11e6c92bd8e9b82a634ca300922d809e07809782 Mon Sep 17 00:00:00 2001 From: Kari Salminen Date: Wed, 15 Jul 2009 13:10:29 +0000 Subject: Fix some typos in TransactionError-enumeration's comments. svn-id: r42503 --- common/system.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/system.h b/common/system.h index 5b3c208661..5c91296ab1 100644 --- a/common/system.h +++ b/common/system.h @@ -408,10 +408,10 @@ public: */ enum TransactionError { kTransactionSuccess = 0, /**< Everything fine (use EQUAL check for this one!) */ - kTransactionAspectRatioFailed = (1 << 0), /**< Failed switchting aspect ratio correction mode */ - kTransactionFullscreenFailed = (1 << 1), /**< Failed switchting fullscreen mode */ - kTransactionModeSwitchFailed = (1 << 2), /**< Failed switchting the GFX graphics mode (setGraphicsMode) */ - kTransactionSizeChangeFailed = (1 << 3) /**< Failed switchting the screen dimensions (initSize) */ + kTransactionAspectRatioFailed = (1 << 0), /**< Failed switching aspect ratio correction mode */ + kTransactionFullscreenFailed = (1 << 1), /**< Failed switching fullscreen mode */ + kTransactionModeSwitchFailed = (1 << 2), /**< Failed switching the GFX graphics mode (setGraphicsMode) */ + kTransactionSizeChangeFailed = (1 << 3) /**< Failed switching the screen dimensions (initSize) */ }; /** -- cgit v1.2.3 From a0d05a93f8cdd5e0481f9b9e1c75d861c0399064 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 15 Jul 2009 13:19:49 +0000 Subject: Fix recent PN regression in vc32_saveScreen(). svn-id: r42504 --- engines/agos/vga.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp index d2e620d86e..d37681508e 100644 --- a/engines/agos/vga.cpp +++ b/engines/agos/vga.cpp @@ -1186,7 +1186,8 @@ void AGOSEngine::vc32_saveScreen() { byte *src = (byte *)screen->pixels; for (int i = 0; i < _screenHeight; i++) { memcpy(dst, src, _screenWidth); - dst += screen->pitch; + dst += _backGroundBuf->pitch; + src += screen->pitch; } _system->unlockScreen(); } else { -- cgit v1.2.3 From 62d54ae6a65bc6985bc3233d940d0ad9c9ed6371 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 15 Jul 2009 13:53:18 +0000 Subject: Add Discworld 1/2. svn-id: r42505 --- README | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README b/README index 874137eb3d..324115698f 100644 --- a/README +++ b/README @@ -234,6 +234,8 @@ Other Games: Beneath a Steel Sky [sky] Broken Sword 1: The Shadow of the Templars [sword1] Broken Sword 2: The Smoking Mirror [sword2] + Discworld [dw] + Discworld 2: Missing Presumed ...!? [dw2] Drascula: The Vampire Strikes Back [drascula] Flight of the Amazon Queen [queen] Future Wars [fw] @@ -297,6 +299,7 @@ and view the compatibility chart. Backyard Baseball [baseball] Backyard Soccer [soccer] Blue's Birthday Adventure [BluesBirthday] + Blue's Treasure Hunt [BluesTreasureHunt] SPY Fox 3: Operation Ozone [spyozon] The following games are based on the SCUMM engine, but NOT supported -- cgit v1.2.3 From a9a5e20834756b071d2a3c562929e217d9339da4 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 15 Jul 2009 13:58:23 +0000 Subject: Add Cruise for a Corpse and games from MADE engine. svn-id: r42506 --- README | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README b/README index 324115698f..3f008bd707 100644 --- a/README +++ b/README @@ -230,10 +230,17 @@ GOB Games by Coktel Vision: and the Schnibble [woodruff] Ween: The Prophecy [ween] +MADE Games by Activision: + Leather Goddesses of Phobos 2 [lgop2] + Return to Zork [rtz] + Rodney's Funscreen [rodney] + The Manhole [manhole] + Other Games: Beneath a Steel Sky [sky] Broken Sword 1: The Shadow of the Templars [sword1] Broken Sword 2: The Smoking Mirror [sword2] + Cruise for a Corpse [cruise] Discworld [dw] Discworld 2: Missing Presumed ...!? [dw2] Drascula: The Vampire Strikes Back [drascula] -- cgit v1.2.3 From 6b3c3a8a12d9ef7caa316f63d62f92c0ed606881 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 15 Jul 2009 15:51:47 +0000 Subject: Bugfix: Disallow GMM Save/Load while in kyragem scene. svn-id: r42507 --- engines/kyra/kyra_lok.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp index e5ca52abcc..a3a249de18 100644 --- a/engines/kyra/kyra_lok.cpp +++ b/engines/kyra/kyra_lok.cpp @@ -434,7 +434,7 @@ void KyraEngine_LoK::mainLoop() { // FIXME: Why is this here? _screen->showMouse(); - int inputFlag = checkInput(_buttonList, true); + int inputFlag = checkInput(_buttonList, _currentCharacter->sceneId != 210); removeInputTop(); updateMousePointer(); -- cgit v1.2.3 From 7b55b5f5e2dbfd59a5936cb4671060d7b3b6ff81 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 15 Jul 2009 17:07:45 +0000 Subject: Fix "search" filter being settings lost in launcher, when using the "Edit Game..." menu for example. svn-id: r42510 --- gui/ListWidget.cpp | 18 ++++++++++++++++++ gui/launcher.cpp | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index 8661444cf3..78372fcba8 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -105,6 +105,22 @@ Widget *ListWidget::findWidget(int x, int y) { } void ListWidget::setSelected(int item) { + // HACK/FIXME: If our _listIndex has a non zero size, + // we will need to look up, whether the user selected + // item is present in that list + if (_listIndex.size()) { + int filteredItem = -1; + + for (uint i = 0; i < _listIndex.size(); ++i) { + if (_listIndex[i] == item) { + filteredItem = i; + break; + } + } + + item = filteredItem; + } + assert(item >= -1 && item < (int)_list.size()); // We only have to do something if the widget is enabled and the selection actually changes @@ -131,6 +147,7 @@ void ListWidget::setList(const StringList &list) { _dataList = list; _list = list; _filter.clear(); + _listIndex.clear(); int size = list.size(); if (_currentPos >= size) @@ -560,6 +577,7 @@ void ListWidget::setFilter(const String &filter, bool redraw) { if (_filter.empty()) { // No filter -> display everything _list = _dataList; + _listIndex.clear(); } else { // Restrict the list to everything which contains all words in _filter // as substrings, ignoring case. diff --git a/gui/launcher.cpp b/gui/launcher.cpp index da49c1ccfd..1ab4728072 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -641,6 +641,10 @@ void LauncherDialog::updateListing() { // Select the last entry if the list has been reduced _list->setSelected(_list->getList().size() - 1); updateButtons(); + + // Update the filter settings, those are lost when "setList" + // is called. + _list->setFilter(_searchWidget->getEditString()); } void LauncherDialog::addGame() { -- cgit v1.2.3 From 6a15e14d3ff0804efb08020c86c60c6c818aa1b4 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 15 Jul 2009 17:23:27 +0000 Subject: Fix bug, which caused the ListWidget to draw a widget background around the selected item, when the ListWidget had no focus. svn-id: r42511 --- gui/ListWidget.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index 78372fcba8..fe6ec5383f 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -407,13 +407,8 @@ void ListWidget::drawWidget() { bool inverted = false; // Draw the selected item inverted, on a highlighted background. - if (_selectedItem == pos) { - if (_hasFocus) - inverted = true; - else - g_gui.theme()->drawWidgetBackground(Common::Rect(_x, y - 1, _x + _w - 1, y + fontHeight - 1), - 0, ThemeEngine::kWidgetBackgroundBorderSmall); - } + if (_selectedItem == pos) + inverted = true; Common::Rect r(getEditRect()); int pad = _leftPadding; -- cgit v1.2.3 From 6a26f1b56f0317af4099c978a5cd1511d7fbcb7c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 15 Jul 2009 18:05:37 +0000 Subject: For a smoother user experience, use different colors for inverted text of the ListWidget, depending on whether the widget has focus or not. svn-id: r42512 --- gui/EditTextWidget.cpp | 2 +- gui/ListWidget.cpp | 10 +- gui/PopUpWidget.cpp | 2 +- gui/ThemeEngine.cpp | 14 +- gui/ThemeEngine.h | 10 +- gui/about.cpp | 2 +- gui/themes/default.inc | 1096 ++++++++++++++-------------- gui/themes/scummclassic.zip | Bin 53146 -> 52802 bytes gui/themes/scummclassic/classic_gfx.stx | 7 + gui/themes/scummmodern.zip | Bin 157823 -> 157460 bytes gui/themes/scummmodern/scummmodern_gfx.stx | 7 + 11 files changed, 596 insertions(+), 554 deletions(-) diff --git a/gui/EditTextWidget.cpp b/gui/EditTextWidget.cpp index f38f9f5b94..658ac21117 100644 --- a/gui/EditTextWidget.cpp +++ b/gui/EditTextWidget.cpp @@ -84,7 +84,7 @@ void EditTextWidget::drawWidget() { // Draw the text adjustOffset(); - g_gui.theme()->drawText(Common::Rect(_x+2+ _leftPadding,_y+2, _x+_leftPadding+getEditRect().width()+2, _y+_h-2), _editString, _state, Graphics::kTextAlignLeft, false, -_editScrollOffset, false, _font); + g_gui.theme()->drawText(Common::Rect(_x+2+ _leftPadding,_y+2, _x+_leftPadding+getEditRect().width()+2, _y+_h-2), _editString, _state, Graphics::kTextAlignLeft, ThemeEngine::kTextInversionNone, -_editScrollOffset, false, _font); } Common::Rect EditTextWidget::getEditRect() const { diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index fe6ec5383f..3d4c10859f 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -404,11 +404,15 @@ void ListWidget::drawWidget() { for (i = 0, pos = _currentPos; i < _entriesPerPage && pos < len; i++, pos++) { const int y = _y + _topPadding + kLineHeight * i; const int fontHeight = kLineHeight; - bool inverted = false; + ThemeEngine::TextInversionState inverted = ThemeEngine::kTextInversionNone; // Draw the selected item inverted, on a highlighted background. - if (_selectedItem == pos) - inverted = true; + if (_selectedItem == pos) { + if (_hasFocus) + inverted = ThemeEngine::kTextInversionFocus; + else + inverted = ThemeEngine::kTextInversion; + } Common::Rect r(getEditRect()); int pad = _leftPadding; diff --git a/gui/PopUpWidget.cpp b/gui/PopUpWidget.cpp index cc756a96b6..35cfaf6d4a 100644 --- a/gui/PopUpWidget.cpp +++ b/gui/PopUpWidget.cpp @@ -345,7 +345,7 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite) { g_gui.theme()->drawLineSeparator(Common::Rect(x, y, x+w, y+kLineHeight)); } else { g_gui.theme()->drawText(Common::Rect(x+1, y+2, x+w, y+2+kLineHeight), name, hilite ? ThemeEngine::kStateHighlight : ThemeEngine::kStateEnabled, - Graphics::kTextAlignLeft, false, _leftPadding); + Graphics::kTextAlignLeft, ThemeEngine::kTextInversionNone, _leftPadding); } } diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 166b11afe3..d1516d0f86 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -167,6 +167,7 @@ static const DrawDataInfo kDrawDataDefaults[] = { {kDDPlainColorBackground, "plain_bg", true, kDDNone}, {kDDDefaultBackground, "default_bg", true, kDDNone}, {kDDTextSelectionBackground, "text_selection", false, kDDNone}, + {kDDTextSelectionFocusBackground, "text_selection_focus", false, kDDNone}, {kDDWidgetBackgroundDefault, "widget_default", true, kDDNone}, {kDDWidgetBackgroundSmall, "widget_small", true, kDDNone}, @@ -1018,14 +1019,23 @@ void ThemeEngine::drawTab(const Common::Rect &r, int tabHeight, int tabWidth, co } } -void ThemeEngine::drawText(const Common::Rect &r, const Common::String &str, WidgetStateInfo state, Graphics::TextAlign align, bool inverted, int deltax, bool useEllipsis, FontStyle font) { +void ThemeEngine::drawText(const Common::Rect &r, const Common::String &str, WidgetStateInfo state, Graphics::TextAlign align, TextInversionState inverted, int deltax, bool useEllipsis, FontStyle font) { if (!ready()) return; - if (inverted) { + switch (inverted) { + case kTextInversion: queueDD(kDDTextSelectionBackground, r); queueDDText(kTextDataInverted, r, str, false, useEllipsis, align, kTextAlignVCenter, deltax); return; + + case kTextInversionFocus: + queueDD(kDDTextSelectionFocusBackground, r); + queueDDText(kTextDataInverted, r, str, false, useEllipsis, align, kTextAlignVCenter, deltax); + return; + + default: + break; } switch (font) { diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index fd2d9c65fd..75f42618a6 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -62,6 +62,7 @@ enum DrawData { kDDPlainColorBackground, kDDDefaultBackground, kDDTextSelectionBackground, + kDDTextSelectionFocusBackground, kDDWidgetBackgroundDefault, kDDWidgetBackgroundSmall, @@ -156,6 +157,13 @@ public: typedef State WidgetStateInfo; + //! Text inversion state of the text to be draw + enum TextInversionState { + kTextInversionNone, //!< Indicates that the text should not be drawn inverted + kTextInversion, //!< Indicates that the text should be drawn inverted, but not focused + kTextInversionFocus //!< Indicates thte the test should be drawn inverted, and focused + }; + enum ScrollbarState { kScrollbarStateNo, kScrollbarStateUp, @@ -302,7 +310,7 @@ public: void drawDialogBackground(const Common::Rect &r, DialogBackground type, WidgetStateInfo state = kStateEnabled); - void drawText(const Common::Rect &r, const Common::String &str, WidgetStateInfo state = kStateEnabled, Graphics::TextAlign align = Graphics::kTextAlignCenter, bool inverted = false, int deltax = 0, bool useEllipsis = true, FontStyle font = kFontStyleBold); + void drawText(const Common::Rect &r, const Common::String &str, WidgetStateInfo state = kStateEnabled, Graphics::TextAlign align = Graphics::kTextAlignCenter, TextInversionState inverted = kTextInversionNone, int deltax = 0, bool useEllipsis = true, FontStyle font = kFontStyleBold); void drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, WidgetStateInfo state = kStateEnabled); diff --git a/gui/about.cpp b/gui/about.cpp index fb30f5f296..03927e6a40 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -247,7 +247,7 @@ void AboutDialog::drawDialog() { str++; if (*str && y > _y && y + g_gui.theme()->getFontHeight() < _y + _h) - g_gui.theme()->drawText(Common::Rect(_x + _xOff, y, _x + _w - _xOff, y + g_gui.theme()->getFontHeight()), str, state, align, false, 0, false); + g_gui.theme()->drawText(Common::Rect(_x + _xOff, y, _x + _w - _xOff, y + g_gui.theme()->getFontHeight()), str, state, align, ThemeEngine::kTextInversionNone, 0, false); y += _lineHeight; } } diff --git a/gui/themes/default.inc b/gui/themes/default.inc index d2fe7dade5..b3f0a171e6 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -1,612 +1,287 @@ "" -" " -" " -" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " +" " +" " +" " -" " -" " -" " +" " -" " -" " -" " -" " -" " -" " -" " -" " -" " +" " +" " +" " +" " -" " -" " -" " -" " -" " -" " -" " -" " +" " +" " +" " -" " -" " -" " -" " -" " -" " -" " -" " +" " +" " +" " +" " +" " -" " -" " -" " -" " -" " -" " -" " -" " +" " +" " -" " -" " -" " +" " -" " -" " -" " -" " -" " -" " +" " +" " +" " +" " +" " +" " +" " +" " -" " -" " -" " -" " +" " +" " +" " +" " +" " +" " -" " -" " -" " -" " +" " +" " -" " -" " +" " -" " -" " -" " -" " +" " +" " +" " +" " +" " -" " -" " -" " -" " +" " +" " -" " -" " -" " -" " -" " -" " +" " +" " -" " -" " -" " -" " -" " -" " +" " +" " -" " -" " -" " -" " +" " +" " -" " -" " -" " -" " -" " +" " +" " +" " +" " +" " +" " +" " -" " -" " -" " -" " -" " -" " -" " +" " +" " -" " -" " -" " -" " -" " +" " +" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " +" " +" " +" " -" " +" " +" " +" " +" " +" " +" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " +" " " " " " " " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip index cd686aaf1e..a3d35084e8 100644 Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ diff --git a/gui/themes/scummclassic/classic_gfx.stx b/gui/themes/scummclassic/classic_gfx.stx index 911ef585aa..f6c06e2c80 100644 --- a/gui/themes/scummclassic/classic_gfx.stx +++ b/gui/themes/scummclassic/classic_gfx.stx @@ -76,6 +76,13 @@ + + + + + + + + readByte()) == 0) { + parserError("Unexpected end of file."); + break; + } - if ((_char = _stream->readByte()) == 0) { - parserError("Unexpected end of file."); + if (_state == kParserNeedHeader) { + if (_char != '?') { + parserError("Expecting XML header."); break; } - if (_state == kParserNeedHeader) { - if (_char != '?') { - parserError("Expecting XML header."); - break; - } + _char = _stream->readByte(); + activeHeader = true; + } else if (_char == '/') { + _char = _stream->readByte(); + activeClosure = true; + } else if (_char == '?') { + parserError("Unexpected header. There may only be one XML header per file."); + break; + } - _char = _stream->readByte(); - activeHeader = true; - } else if (_char == '/') { - _char = _stream->readByte(); - activeClosure = true; - } else if (_char == '?') { - parserError("Unexpected header. There may only be one XML header per file."); - break; - } + _state = kParserNeedKeyName; + break; - _state = kParserNeedKeyName; + case kParserNeedKeyName: + if (!parseToken()) { + parserError("Invalid key name."); break; + } - case kParserNeedKeyName: - if (!parseToken()) { - parserError("Invalid key name."); + if (activeClosure) { + if (_activeKey.empty() || _token != _activeKey.top()->name) { + parserError("Unexpected closure."); break; } - - if (activeClosure) { - if (_activeKey.empty() || _token != _activeKey.top()->name) { - parserError("Unexpected closure."); - break; - } - } else { - ParserNode *node = allocNode(); //new ParserNode; - node->name = _token; - node->ignore = false; - node->header = activeHeader; - node->depth = _activeKey.size(); - node->layout = 0; - _activeKey.push(node); + } else { + ParserNode *node = allocNode(); //new ParserNode; + node->name = _token; + node->ignore = false; + node->header = activeHeader; + node->depth = _activeKey.size(); + node->layout = 0; + _activeKey.push(node); + } + + _state = kParserNeedPropertyName; + break; + + case kParserNeedPropertyName: + if (activeClosure) { + if (!closeKey()) { + parserError("Missing data when closing key '%s'.", _activeKey.top()->name.c_str()); + break; } - _state = kParserNeedPropertyName; - break; - - case kParserNeedPropertyName: - if (activeClosure) { - if (!closeKey()) { - parserError("Missing data when closing key '%s'.", _activeKey.top()->name.c_str()); - break; - } + activeClosure = false; - activeClosure = false; + if (_char != '>') + parserError("Invalid syntax in key closure."); + else + _state = kParserNeedKey; - if (_char != '>') - parserError("Invalid syntax in key closure."); - else - _state = kParserNeedKey; + _char = _stream->readByte(); + break; + } - _char = _stream->readByte(); - break; - } + selfClosure = false; - selfClosure = false; + if (_char == '/' || (_char == '?' && activeHeader)) { + selfClosure = true; + _char = _stream->readByte(); + } - if (_char == '/' || (_char == '?' && activeHeader)) { - selfClosure = true; + if (_char == '>') { + if (activeHeader && !selfClosure) { + parserError("XML Header must be self-closed."); + } else if (parseActiveKey(selfClosure)) { _char = _stream->readByte(); + _state = kParserNeedKey; } - if (_char == '>') { - if (activeHeader && !selfClosure) { - parserError("XML Header must be self-closed."); - } else if (parseActiveKey(selfClosure)) { - _char = _stream->readByte(); - _state = kParserNeedKey; - } + activeHeader = false; + break; + } - activeHeader = false; - break; - } + if (selfClosure) + parserError("Expecting key closure after '/' symbol."); + else if (!parseToken()) + parserError("Error when parsing key value."); + else + _state = kParserNeedPropertyOperator; - if (selfClosure) - parserError("Expecting key closure after '/' symbol."); - else if (!parseToken()) - parserError("Error when parsing key value."); - else - _state = kParserNeedPropertyOperator; + break; - break; + case kParserNeedPropertyOperator: + if (_char != '=') + parserError("Syntax error after key name."); + else + _state = kParserNeedPropertyValue; - case kParserNeedPropertyOperator: - if (_char != '=') - parserError("Syntax error after key name."); - else - _state = kParserNeedPropertyValue; - - _char = _stream->readByte(); - break; + _char = _stream->readByte(); + break; - case kParserNeedPropertyValue: - if (!parseKeyValue(_token)) - parserError("Invalid key value."); - else - _state = kParserNeedPropertyName; + case kParserNeedPropertyValue: + if (!parseKeyValue(_token)) + parserError("Invalid key value."); + else + _state = kParserNeedPropertyName; - break; + break; - default: - break; + default: + break; } } diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index d1516d0f86..49ea2e19f3 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -912,21 +912,21 @@ void ThemeEngine::drawDialogBackground(const Common::Rect &r, DialogBackground b return; switch (bgtype) { - case kDialogBackgroundMain: - queueDD(kDDMainDialogBackground, r); - break; + case kDialogBackgroundMain: + queueDD(kDDMainDialogBackground, r); + break; - case kDialogBackgroundSpecial: - queueDD(kDDSpecialColorBackground, r); - break; + case kDialogBackgroundSpecial: + queueDD(kDDSpecialColorBackground, r); + break; - case kDialogBackgroundPlain: - queueDD(kDDPlainColorBackground, r); - break; + case kDialogBackgroundPlain: + queueDD(kDDPlainColorBackground, r); + break; - case kDialogBackgroundDefault: - queueDD(kDDDefaultBackground, r); - break; + case kDialogBackgroundDefault: + queueDD(kDDDefaultBackground, r); + break; } } @@ -1039,26 +1039,26 @@ void ThemeEngine::drawText(const Common::Rect &r, const Common::String &str, Wid } switch (font) { - case kFontStyleNormal: - queueDDText(kTextDataNormalFont, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax); - return; + case kFontStyleNormal: + queueDDText(kTextDataNormalFont, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax); + return; - default: - break; + default: + break; } switch (state) { - case kStateDisabled: - queueDDText(kTextDataDisabled, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax); - return; + case kStateDisabled: + queueDDText(kTextDataDisabled, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax); + return; - case kStateHighlight: - queueDDText(kTextDataHover, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax); - return; + case kStateHighlight: + queueDDText(kTextDataHover, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax); + return; - case kStateEnabled: - queueDDText(kTextDataDefault, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax); - return; + case kStateEnabled: + queueDDText(kTextDataDefault, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax); + return; } } -- cgit v1.2.3 From caae53a25a15983e98936f9b6f182b49d3062ccf Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Wed, 15 Jul 2009 20:51:31 +0000 Subject: New ARM code blending Smartphone landscale scaler for WinCE port. Seems to work in my mockup - I don't have a smartphone resolution device to test it. svn-id: r42516 --- backends/platform/wince/CEScaler.cpp | 25 ++++- backends/platform/wince/Makefile | 1 + backends/platform/wince/smartLandScale.s | 187 +++++++++++++++++++++++++++++++ backends/platform/wince/wince-sdl.cpp | 5 + 4 files changed, 216 insertions(+), 2 deletions(-) create mode 100755 backends/platform/wince/smartLandScale.s diff --git a/backends/platform/wince/CEScaler.cpp b/backends/platform/wince/CEScaler.cpp index 4cc675e006..bfdb74319d 100644 --- a/backends/platform/wince/CEScaler.cpp +++ b/backends/platform/wince/CEScaler.cpp @@ -53,6 +53,15 @@ void PocketPCPortraitTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPt } MAKE_WRAPPER(PocketPCPortrait) +void PocketPCRawPortrait(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) { + + while (height--) { + memcpy(dstPtr, srcPtr, width*sizeof(uint16_t)); + srcPtr += srcPitch; + dstPtr += dstPitch; + } +} + // Our version of an aspect scaler. Main difference is the out-of-place // operation, omitting a straight blit step the sdl backend does. Also, // tests show unaligned access errors with the stock aspect scaler. @@ -117,6 +126,7 @@ void PocketPCLandscapeAspect(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr #ifdef ARM extern "C" { void PocketPCHalfARM(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height, int mask, int round); + void SmartphoneLandscapeARM(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height, int mask); // Rounding constants and masks used for different pixel formats int roundingconstants[] = { 0x00200802, 0x00201002 }; int redbluegreenMasks[] = { 0x03E07C1F, 0x07E0F81F }; @@ -156,7 +166,7 @@ void PocketPCHalf(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 ds if (gBitFormat == 565) PocketPCHalfTemplate<565>(srcPtr, srcPitch, dstPtr, dstPitch, width, height); else - PocketPCHalfTemplate<565>(srcPtr, srcPitch, dstPtr, dstPitch, width, height); + PocketPCHalfTemplate<555>(srcPtr, srcPitch, dstPtr, dstPitch, width, height); #endif } @@ -217,4 +227,15 @@ void SmartphoneLandscapeTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *ds } } } -MAKE_WRAPPER(SmartphoneLandscape) + +void SmartphoneLandscape(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) { +#ifdef ARM + int maskUsed = (gBitFormat == 565); + SmartphoneLandscapeARM(srcPtr, srcPitch, dstPtr, dstPitch, width, height, redbluegreenMasks[maskUsed]); +#else + if (gBitFormat == 565) + SmartphoneLandscape<565>(srcPtr, srcPitch, dstPtr, dstPitch, width, height); + else + SmartphoneLandscape<555>(srcPtr, srcPitch, dstPtr, dstPitch, width, height); +#endif +} diff --git a/backends/platform/wince/Makefile b/backends/platform/wince/Makefile index 532bc69ef4..1846029469 100644 --- a/backends/platform/wince/Makefile +++ b/backends/platform/wince/Makefile @@ -186,6 +186,7 @@ OBJS += $(srcdir)/gui/Actions.o $(srcdir)/gui/Key.o $(srcdir)/gui/KeysDialog.o OBJS += ../sdl/sdl.o ../sdl/graphics.o ../sdl/events.o ../sdl/hardwarekeys.o OBJS += missing/missing.o OBJS += ARMscaler.o +OBJS += smartLandScale.o ifndef DYNAMIC_MODULES OBJS += PocketSCUMM.o endif diff --git a/backends/platform/wince/smartLandScale.s b/backends/platform/wince/smartLandScale.s new file mode 100755 index 0000000000..deeb093329 --- /dev/null +++ b/backends/platform/wince/smartLandScale.s @@ -0,0 +1,187 @@ +@ ScummVM Scumm Interpreter +@ Copyright (C) 2009 The ScummVM project +@ +@ This program is free software; you can redistribute it and/or +@ modify it under the terms of the GNU General Public License +@ as published by the Free Software Foundation; either version 2 +@ of the License, or (at your option) any later version. +@ +@ This program is distributed in the hope that it will be useful, +@ but WITHOUT ANY WARRANTY; without even the implied warranty of +@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +@ GNU General Public License for more details. +@ +@ You should have received a copy of the GNU General Public License +@ along with this program; if not, write to the Free Software +@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +@ +@ $URL$ +@ $Id$ +@ +@ @author Robin Watts (robin@wss.co.uk) + + @ For 16 source pixels 0123456789ABCDEF, we want to produce 11 output + @ pixels. + + @0000000000011111111111222222222223333333333344444444444555555555 + @<------||------><------||------><------||------><------||------> + + @5566666666666777777777778888888888899999999999AAAAAAAAAAABBBBBBB + @<------||------><------||------><------||------><------||------> + + @BBBBCCCCCCCCCCCDDDDDDDDDDDEEEEEEEEEEEFFFFFFFFFFF + @<------||------><------||------><------||------> + + @ So, use the following weights (approximately right) + + @ d0 = (3*s0 + 1*s1)>>2 Every source pixel constitutes + @ d1 = (2*s1 + 2*s2)>>2 3/4 of a destination pixel, + @ d2 = (1*s2 + 3*s3)>>2 except for s4,s5,sA and sB which + @ d3 = (2*s4 + 2*s5)>>2 constitute 1/2 each. + @ d4 = (3*s6 + 1*s7)>>2 + @ d5 = (2*s7 + 2*s8)>>2 + @ d6 = (1*s8 + 3*s9)>>2 + @ d7 = (2*sA + 2*sB)>>2 + @ d8 = (3*sC + 1*sD)>>2 + @ d9 = (2*sD + 2*sE)>>2 + @ dA = (1*sE + 3*sF)>>2 + + .text + + .global SmartphoneLandscapeARM + + @ scales a width x height block of 16bpp pixels from srcPtr to dstPtr, + @ scaling each scanline down by 11/16ths. Every 8th scanline is dropped + @ srcPitch and dstPitch identify how to reach subsequent lines. + @ mask allows for one routine to do both 565 and 565 formats. + +SmartphoneLandscapeARM: + @ r0 = srcPtr + @ r1 = srcSpan + @ r2 = dstPtr + @ r3 = dstSpan + @ <> = width + @ <> = height + @ <> = mask + MOV r12,r13 + STMFD r13!,{r4-r11,r14} + LDMFD r12,{r4,r5,r11} @ r4 = width + @ r5 = height + @ r11= mask + MOV r7, #7 @ r7 = line + SUB r8, r1, r4, LSL #1 @ r8 = srcSpan - width*2 +y_loop: + MOV r6, r4 @ r6 = i + MOV r9, r2 @ r9 = dstPtr +x_loop: + LDRH r14,[r0],#2 @ r14 = s0 + LDRH r12,[r0],#2 @ r12 = s1 + LDRH r10,[r0],#2 @ r10 = s2 + ORR r14,r14,r14,LSL #16 @ r14 = s0s0 + ORR r12,r12,r12,LSL #16 @ r12 = s1s1 + AND r14,r14,r11 @ r14 = s0 as g_b_r + AND r12,r12,r11 @ r12 = s1 as g_b_r + ADD r14,r14,r14,LSL #1 @ r14 = s0*3 as g_b_r + ORR r10,r10,r10,LSL #16 @ r10 = s2s2 + ADD r14,r14,r12 @ r14 = (s0*3 + s1) as g_b_r + AND r10,r10,r11 @ r10 = s2 as g_b_r + AND r14,r11,r14,LSR #2 @ r14 = d0 as g_b_r + ORR r14,r14,r14,LSR #16 @ r14 = d0 + STRH r14,[r9],#2 @ store d0 + ADD r12,r12,r10 @ r12 = (s1 + s2) as g_b_r + LDRH r14,[r0],#2 @ r14 = s3 + AND r12,r11,r12,LSR #1 @ r12 = d1 as g_b_r + ORR r12,r12,r12,LSR #16 @ r12 = d1 + STRH r12,[r9],#2 @ store d1 + ORR r14,r14,r14,LSL #16 @ r14 = s3s3 + AND r14,r14,r11 @ r14 = s3 as g_b_r + ADD r10,r10,r14 @ r10 = (s2 + s3) as g_b_r + ADD r10,r10,r14,LSL #1 @ r10 = (s2 + s3*3) as g_b_r + LDRH r14,[r0],#2 @ r14 = s4 + LDRH r12,[r0],#2 @ r12 = s5 + AND r10,r11,r10,LSR #2 @ r10 = d2 as g_b_r + ORR r10,r10,r10,LSR #16 @ r10 = d2 + STRH r10,[r9],#2 @ store d2 + ORR r14,r14,r14,LSL #16 @ r14 = s4s4 + ORR r12,r12,r12,LSL #16 @ r12 = s5s5 + AND r14,r14,r11 @ r14 = s4 as g_b_r + AND r12,r12,r11 @ r12 = s5 as g_b_r + ADD r14,r14,r12 @ r14 = (s4 + s5) as g_b_r + LDRH r12,[r0],#2 @ r12 = s6 + LDRH r10,[r0],#2 @ r10 = s7 + AND r14,r11,r14,LSR #1 @ r14 = d3 as g_b_r + ORR r14,r14,r14,LSR #16 @ r14 = d3 + STRH r14,[r9],#2 @ store d3 + ORR r12,r12,r12,LSL #16 @ r12 = s6s6 + ORR r10,r10,r10,LSL #16 @ r10 = s7s7 + LDRH r14,[r0],#2 @ r14 = s8 + AND r12,r12,r11 @ r12 = s6 as g_b_r + AND r10,r10,r11 @ r10 = s7 as g_b_r + ORR r14,r14,r14,LSL #16 @ r14 = s8s8 + ADD r12,r12,r12,LSL #1 @ r12 = 3*s6 as g_b_r + AND r14,r14,r11 @ r14 = s8 as g_b_r + ADD r12,r12,r10 @ r12 = (3*s6+s7) as g_b_r + AND r12,r11,r12,LSR #2 @ r12 = d4 as g_b_r + ORR r12,r12,r12,LSR #16 @ r12 = d4 + STRH r12,[r9],#2 @ store d4 + ADD r10,r10,r14 @ r10 = (s7+s8) as g_b_r + AND r10,r11,r10,LSR #1 @ r10 = d5 as g_b_r + LDRH r12,[r0],#2 @ r12 = s9 + ORR r10,r10,r10,LSR #16 @ r10 = d5 + STRH r10,[r9],#2 @ store d5 + ORR r12,r12,r12,LSL #16 @ r12 = s9s9 + AND r12,r12,r11 @ r12 = s9 as g_b_r + ADD r12,r12,r12,LSL #1 @ r12 = s9*3 as g_b_r + ADD r12,r12,r14 @ r12 = (s8+s9*3) as g_b_r + AND r12,r11,r12,LSR #2 @ r12 = d6 as g_b_r + LDRH r14,[r0],#2 @ r14 = sA + LDRH r10,[r0],#2 @ r10 = sB + ORR r12,r12,r12,LSR #16 @ r12 = d6 + STRH r12,[r9],#2 @ store d6 + ORR r14,r14,r14,LSL #16 @ r14 = sAsA + ORR r10,r10,r10,LSL #16 @ r10 = sBsB + LDRH r12,[r0],#2 @ r12 = sC + AND r14,r14,r11 @ r14 = sA as g_b_r + AND r10,r10,r11 @ r10 = sB as g_b_r + ORR r12,r12,r12,LSL #16 @ r12 = sCsC + ADD r14,r14,r10 @ r14 = (sA + sB) as g_b_r + LDRH r10,[r0],#2 @ r10 = sD + AND r14,r11,r14,LSR #1 @ r14 = d7 as g_b_r + AND r12,r12,r11 @ r12 = sC as g_b_r + ORR r14,r14,r14,LSR #16 @ r14 = d7 + ORR r10,r10,r10,LSL #16 @ r10 = sDsD + STRH r14,[r9],#2 @ store d7 + AND r10,r10,r11 @ r10 = sD as g_b_r + ADD r12,r12,r12,LSL #1 @ r12 = 3*sC as g_b_r + LDRH r14,[r0],#2 @ r14 = sE + ADD r12,r12,r10 @ r12 = (3*sC+sD) as g_b_r + AND r12,r11,r12,LSR #2 @ r12 = d8 as g_b_r + ORR r14,r14,r14,LSL #16 @ r14 = sEsE + ORR r12,r12,r12,LSR #16 @ r12 = d8 + AND r14,r14,r11 @ r14 = sE as g_b_r + STRH r12,[r9],#2 @ store d8 + ADD r10,r10,r14 @ r10 = (sD+sE) as g_b_r + LDRH r12,[r0],#2 @ r12 = sF + AND r10,r11,r10,LSR #1 @ r10 = d9 as g_b_r + ORR r10,r10,r10,LSR #16 @ r10 = d9 + STRH r10,[r9],#2 @ store d9 + ORR r12,r12,r12,LSL #16 @ r12 = sFsF + AND r12,r12,r11 @ r12 = sF as g_b_r + ADD r12,r12,r12,LSL #1 @ r12 = 3*sF as g_b_r + ADD r12,r12,r14 @ r12 = (sE+3*sF) as g_b_r + AND r12,r11,r12,LSR #2 @ r12 = dA as g_b_r + ORR r12,r12,r12,LSR #16 @ r12 = dA + SUBS r6,r6,#16 @ width -= 16 + STRH r12,[r9],#2 @ store dA + BGT x_loop + + ADD r0, r0, r8 @ srcPtr += srcSpan + ADD r2, r2, r3 @ dstPtr += dstSpan + SUBS r7, r7, #1 + ADDEQ r0, r0, r1 + MOVEQ r7, #7 + SUBEQ r5, r5, #1 + SUBS r5, r5, #1 + BGT y_loop + + LDMFD r13!,{r4-r11,PC} diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index 9a4b312631..8b2e0848f8 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -1209,8 +1209,13 @@ bool OSystem_WINCE3::update_scalers() { if (CEDevice::hasSmartphoneResolution()) { if (_videoMode.screenWidth > 320) error("Game resolution not supported on Smartphone"); +#ifdef ARM + _scaleFactorXm = 11; + _scaleFactorXd = 16; +#else _scaleFactorXm = 2; _scaleFactorXd = 3; +#endif _scaleFactorYm = 7; _scaleFactorYd = 8; _scalerProc = SmartphoneLandscape; -- cgit v1.2.3 From 5e38ecbdcbbb4fc0de90137b63fe3979d5d5fcd6 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 15 Jul 2009 22:19:16 +0000 Subject: Fix ugly spacing between tabs in classic theme (as reported by sunmax on -devel). svn-id: r42517 --- gui/ThemeEngine.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 49ea2e19f3..3cf64809fc 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -996,23 +996,20 @@ void ThemeEngine::drawTab(const Common::Rect &r, int tabHeight, int tabWidth, co if (!ready()) return; - const int tabOffset = 2; - tabWidth -= tabOffset; - queueDD(kDDTabBackground, Common::Rect(r.left, r.top, r.right, r.top + tabHeight)); for (int i = 0; i < (int)tabs.size(); ++i) { if (i == active) continue; - Common::Rect tabRect(r.left + i * (tabWidth + tabOffset), r.top, r.left + i * (tabWidth + tabOffset) + tabWidth, r.top + tabHeight); + Common::Rect tabRect(r.left + i * tabWidth, r.top, r.left + (i + 1) * tabWidth, r.top + tabHeight); queueDD(kDDTabInactive, tabRect); queueDDText(getTextData(kDDTabInactive), tabRect, tabs[i], false, false, _widgets[kDDTabInactive]->_textAlignH, _widgets[kDDTabInactive]->_textAlignV); } if (active >= 0) { - Common::Rect tabRect(r.left + active * (tabWidth + tabOffset), r.top, r.left + active * (tabWidth + tabOffset) + tabWidth, r.top + tabHeight); - const uint16 tabLeft = active * (tabWidth + tabOffset); + Common::Rect tabRect(r.left + active * tabWidth, r.top, r.left + (active + 1) * tabWidth, r.top + tabHeight); + const uint16 tabLeft = active * tabWidth; const uint16 tabRight = MAX(r.right - tabRect.right, 0); queueDD(kDDTabActive, tabRect, (tabLeft << 16) | (tabRight & 0xFFFF)); queueDDText(getTextData(kDDTabActive), tabRect, tabs[active], false, false, _widgets[kDDTabActive]->_textAlignH, _widgets[kDDTabActive]->_textAlignV); -- cgit v1.2.3 From c9ebf96d65fb983141c7c544d8cafc346dd2310c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 15 Jul 2009 22:19:31 +0000 Subject: Slightly brighten up the active tab color in the modern theme. svn-id: r42518 --- gui/themes/scummmodern.zip | Bin 157460 -> 157460 bytes gui/themes/scummmodern/scummmodern_gfx.stx | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip index b5a5529f6b..71e8bef3d5 100644 Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ diff --git a/gui/themes/scummmodern/scummmodern_gfx.stx b/gui/themes/scummmodern/scummmodern_gfx.stx index a2d9c038b1..f74d0f0d2f 100644 --- a/gui/themes/scummmodern/scummmodern_gfx.stx +++ b/gui/themes/scummmodern/scummmodern_gfx.stx @@ -271,7 +271,7 @@ radius = '4' stroke = '0' fill = 'background' - bg_color = '248, 228, 152' + bg_color = '248, 232, 168' shadow = '3' /> -- cgit v1.2.3 From aeb2aa6630b49a89992e4f317610b3275ee80ed6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 16 Jul 2009 02:27:26 +0000 Subject: Game script fix for bug #2525010 - in the GRA version, the luggage blocked Rincewind's exit from the Inn, leaving him in a non-walkable area svn-id: r42521 --- engines/tinsel/pcode.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp index ac7bf9970f..581c999848 100644 --- a/engines/tinsel/pcode.cpp +++ b/engines/tinsel/pcode.cpp @@ -116,12 +116,21 @@ static uint32 hMasterScript; const byte fragment1[] = {(byte)OP_ZERO, (byte) OP_GSTORE | OPSIZE16, 206, 0}; const int fragment1_size = 4; +const byte fragment2[] = {OP_LIBCALL | OPSIZE8, 110}; +const int fragment2_size = 2; + const WorkaroundEntry workaroundList[] = { // Global 206 in DW1-SCN is whether Rincewind is trying to take the book back to the present. // In the GRA version, it was global 373, and was reset when he is returned to the past, but // was forgotten in the SCN version, so this ensures the flag is properly reset {TINSEL_V1, true, 427942095, 1, fragment1_size, fragment1}, + + // In DW1-GRA, Rincewind exiting the Inn is blocked by the luggage. Whilst you can then move + // into walkable areas, saving and restoring the game, it will error if you try to move. + // This fragment turns off NPC blocking for the Outside Inn room so that the luggage won't block + {TINSEL_V1, false, 444622076, 0, fragment2_size, fragment2}, + {TINSEL_V0, false, 0, 0, 0, NULL} }; -- cgit v1.2.3 From b04e3e79406031001cd80b40fb21b8f2ca0c5af8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 16 Jul 2009 04:06:35 +0000 Subject: Added no blocking fix for Present Outside Inn scene as well svn-id: r42522 --- engines/tinsel/pcode.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp index 581c999848..8f905916ad 100644 --- a/engines/tinsel/pcode.cpp +++ b/engines/tinsel/pcode.cpp @@ -128,8 +128,11 @@ const WorkaroundEntry workaroundList[] = { // In DW1-GRA, Rincewind exiting the Inn is blocked by the luggage. Whilst you can then move // into walkable areas, saving and restoring the game, it will error if you try to move. - // This fragment turns off NPC blocking for the Outside Inn room so that the luggage won't block + // This fragment turns off NPC blocking for the Outside Inn rooms so that the luggage won't block + // Past Outside Inn {TINSEL_V1, false, 444622076, 0, fragment2_size, fragment2}, + // Present Outside Inn + {TINSEL_V1, false, 352600876, 0, fragment2_size, fragment2}, {TINSEL_V0, false, 0, 0, 0, NULL} }; -- cgit v1.2.3 From 00dbbedbad2c3d58f972733a4f0d46935c32887a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 16 Jul 2009 08:13:08 +0000 Subject: Added a detection entry for Pepper's Adventures in Time, and fixed an issue with _gfxop_set_pic(), which was causing crashes in that game svn-id: r42523 --- engines/sci/detection.cpp | 9 +++++++++ engines/sci/gfx/gfx_resmgr.cpp | 2 +- engines/sci/gfx/gfx_resmgr.h | 8 ++++++-- engines/sci/gfx/gfx_system.h | 2 +- engines/sci/gfx/operations.cpp | 7 +++++-- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index 566d82405a..ad62181458 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -2203,6 +2203,15 @@ static const struct SciGameDescription SciGameDescriptions[] = { }, #endif // ENABLE_SCI32 + {{"pepper", "", { + {"resource.map", 0, "72726dc81c1b4c1110c486be77369bc8", 5179}, + {"resource.000", 0, "670d0c53622429f4b11275caf7f8d292", 5459574}, + {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH}, + 0, + SCI_VERSION_AUTODETECT, + SCI_VERSION_1_1 + }, + // Pepper - English DOS Non-Interactive Demo // Executable scanning reports "1.001.060", VERSION file reports "1.000" {{"pepper", "Demo", { diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index 4a3c79feef..bf1c88b4d6 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -340,7 +340,7 @@ gfxr_pic_t *GfxResManager::getPic(int num, int maps, int flags, int default_pale res = resMap.contains(num) ? resMap[num] : NULL; if (!res || res->mode != hash) { - gfxr_pic_t *pic; + gfxr_pic_t *pic = NULL; gfxr_pic_t *unscaled_pic = NULL; #ifdef CUSTOM_GRAPHICS_OPTIONS diff --git a/engines/sci/gfx/gfx_resmgr.h b/engines/sci/gfx/gfx_resmgr.h index fc4e0b3d6f..5cd5d018cc 100644 --- a/engines/sci/gfx/gfx_resmgr.h +++ b/engines/sci/gfx/gfx_resmgr.h @@ -270,8 +270,7 @@ public: /** * Retrieves a color from the static palette */ - const PaletteEntry &getColor(int color) - { + const PaletteEntry &getColor(int color) { return _staticPalette->getColor(color); } @@ -313,6 +312,11 @@ public: return _staticPalette ? _staticPalette->size() : 0; } + /** + * Returns the resource version that the resource manager is using + */ + int getVersion() { return _version; } + private: int _version; gfx_options_t *_options; diff --git a/engines/sci/gfx/gfx_system.h b/engines/sci/gfx/gfx_system.h index 855f9b196e..20c92efa2d 100644 --- a/engines/sci/gfx/gfx_system.h +++ b/engines/sci/gfx/gfx_system.h @@ -189,7 +189,7 @@ struct gfx_pixmap_t { * As a special exception, 256 colors are allowed for background pictures * (which do not use transparency) */ - int colors_nr() const { return palette ? palette->size() : 0; } + int colors_nr() const { return palette ? MIN(palette->size(), 256) : 0; } uint32 flags; /* @} */ diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index 2c536912b3..9b2c3dc7f5 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -1712,8 +1712,11 @@ static int _gfxop_set_pic(GfxState *state) { // FIXME: The _gfxop_install_pixmap call below updates the OSystem palette. // This is too soon, since it causes brief palette corruption until the // screen is updated too. (Possibly related: EngineState::pic_not_valid .) - state->pic->visual_map->palette->forceInto(state->driver->getMode()->palette); - _gfxop_install_pixmap(state->driver, state->pic->visual_map); + // SCI1.1 games don't use per-picture palettes + if (state->gfxResMan->getVersion() < SCI_VERSION_1_1) { + state->pic->visual_map->palette->forceInto(state->driver->getMode()->palette); + _gfxop_install_pixmap(state->driver, state->pic->visual_map); + } #ifdef CUSTOM_GRAPHICS_OPTIONS if (state->options->pic0_unscaled) -- cgit v1.2.3 From efc5f80f5141f42b0d3d1144134d4b883d387522 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 16 Jul 2009 08:17:38 +0000 Subject: Added the French version of KQ5 floppy (bug report #2812611) svn-id: r42524 --- engines/sci/detection.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index ad62181458..1e8c317bf9 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -1149,6 +1149,25 @@ static const struct SciGameDescription SciGameDescriptions[] = { SCI_VERSION_1 }, + // King's Quest 5 - French DOS Floppy (from the King's Quest Collector's Edition 1994) + // Supplied by aroenai in bug report #2812611 + // VERSION file reports "1.000", SCI interpreter version 1.000.784 + {{"kq5", "", { + {"resource.map", 0, "eb7853832f3bb10900b13b421a0bbe7f", 8283}, + {"resource.000", 0, "f063775b279208c14a83eda47073be90", 332806}, + {"resource.001", 0, "3e6add38564250fd1a5bb10593007530", 1136827}, + {"resource.002", 0, "d9a97a9cf6c79bbe8f19378f6dea45d5", 1343738}, + {"resource.003", 0, "bef90d755076c110e67ee3e635503f82", 1324811}, + {"resource.004", 0, "c14dbafcfbe00855ac6b2f2701058047", 1332216}, + {"resource.005", 0, "f4b31cafc5defac75125c5f7b7f9a31a", 1268334}, + {"resource.006", 0, "f7dc85307632ef657ceb1651204f6f51", 1210081}, + {"resource.007", 0, "7db4d0a1d8d547c0019cb7d2a6acbdd4", 1338473}, + {NULL, 0, NULL, 0}}, Common::FR_FRA, Common::kPlatformPC, 0, GUIO_NOSPEECH}, + 0, + SCI_VERSION_AUTODETECT, + SCI_VERSION_1 + }, + // King's Quest 5 - Italian DOS Floppy (from glorifindel) // SCI interpreter version 1.000.060 {{"kq5", "", { -- cgit v1.2.3 From 52ed2fe04ce0d4fe21a9ba7af458fe4b33a859e5 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 16 Jul 2009 08:21:06 +0000 Subject: Added missing information for the newly-added version of Pepper svn-id: r42525 --- engines/sci/detection.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index 1e8c317bf9..7118eb682d 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -2222,6 +2222,8 @@ static const struct SciGameDescription SciGameDescriptions[] = { }, #endif // ENABLE_SCI32 + // Pepper's Adventure In Time 1.000 English + // Executable scanning reports "1.001.072", VERSION file reports "1.000" {{"pepper", "", { {"resource.map", 0, "72726dc81c1b4c1110c486be77369bc8", 5179}, {"resource.000", 0, "670d0c53622429f4b11275caf7f8d292", 5459574}, -- cgit v1.2.3 From f01bd0e9a3277909f85a55b88379348c7bbbebbc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 16 Jul 2009 09:31:31 +0000 Subject: Added game script fix for bug #2680397 - game hang when using the brochure on the Beekeeper svn-id: r42527 --- engines/tinsel/pcode.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp index 8f905916ad..69d64e86fd 100644 --- a/engines/tinsel/pcode.cpp +++ b/engines/tinsel/pcode.cpp @@ -114,19 +114,20 @@ static uint32 hMasterScript; //----------------- SCRIPT BUGS WORKAROUNDS -------------- -const byte fragment1[] = {(byte)OP_ZERO, (byte) OP_GSTORE | OPSIZE16, 206, 0}; +const byte fragment1[] = {OP_ZERO, OP_GSTORE | OPSIZE16, 206, 0}; const int fragment1_size = 4; const byte fragment2[] = {OP_LIBCALL | OPSIZE8, 110}; const int fragment2_size = 2; - +const byte fragment3[] = {OP_ZERO, OP_GSTORE | OPSIZE16, 490 % 256, 490 / 256}; +const int fragment3_size = 4; const WorkaroundEntry workaroundList[] = { - // Global 206 in DW1-SCN is whether Rincewind is trying to take the book back to the present. + // DW1-SCN: Global 206 is whether Rincewind is trying to take the book back to the present. // In the GRA version, it was global 373, and was reset when he is returned to the past, but // was forgotten in the SCN version, so this ensures the flag is properly reset {TINSEL_V1, true, 427942095, 1, fragment1_size, fragment1}, - // In DW1-GRA, Rincewind exiting the Inn is blocked by the luggage. Whilst you can then move + // DW1-GRA: Rincewind exiting the Inn is blocked by the luggage. Whilst you can then move // into walkable areas, saving and restoring the game, it will error if you try to move. // This fragment turns off NPC blocking for the Outside Inn rooms so that the luggage won't block // Past Outside Inn @@ -134,6 +135,13 @@ const WorkaroundEntry workaroundList[] = { // Present Outside Inn {TINSEL_V1, false, 352600876, 0, fragment2_size, fragment2}, + // DW2: In the garden, global #490 is set when the bees begin their 'out of hive' animation, and reset when done. + // But if the game is saved/restored during it, the animation sequence is reset without the global being + // cleared. If the brochure is then used on the beekeeper before the bees do the sequence again, their sequence + // is prevented, and the game goes into an infinite loop waiting for a non-playing animation to finish. + // This fix ensures that the global is reset when the Garden scene is loaded (both entering and restoring a game) + {TINSEL_V2, true, 2888147476, 0, fragment3_size, fragment3}, + {TINSEL_V0, false, 0, 0, 0, NULL} }; -- cgit v1.2.3 From 19e8b39249df45c99bf1a42782664a2a0588c1db Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 16 Jul 2009 09:53:19 +0000 Subject: Prior script fix also fixes bug #2820788, with stealing wizard's mallets svn-id: r42528 --- engines/tinsel/pcode.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp index 69d64e86fd..72004b4ae9 100644 --- a/engines/tinsel/pcode.cpp +++ b/engines/tinsel/pcode.cpp @@ -136,9 +136,11 @@ const WorkaroundEntry workaroundList[] = { {TINSEL_V1, false, 352600876, 0, fragment2_size, fragment2}, // DW2: In the garden, global #490 is set when the bees begin their 'out of hive' animation, and reset when done. - // But if the game is saved/restored during it, the animation sequence is reset without the global being - // cleared. If the brochure is then used on the beekeeper before the bees do the sequence again, their sequence - // is prevented, and the game goes into an infinite loop waiting for a non-playing animation to finish. + // But if the game is saved/restored during it, the animation sequence is reset without the global being cleared. + // This causes bugs in several actions which try to disable the bees animation, since they wait indefinitely for + // the global to be cleared, incorrectly believing the animation is currently playing. This includes + // * Giving the brochure to the beekeeper + // * Stealing the mallets from the wizards // This fix ensures that the global is reset when the Garden scene is loaded (both entering and restoring a game) {TINSEL_V2, true, 2888147476, 0, fragment3_size, fragment3}, -- cgit v1.2.3 From 40d8209bca78b548e41f5895da7febe61152b92c Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Thu, 16 Jul 2009 11:37:36 +0000 Subject: Fixed issue with beveled shapes being drawn outside their shapes. Possible regressions. svn-id: r42529 --- graphics/VectorRendererSpec.cpp | 15 +++++++++++---- gui/themes/scummclassic/classic_layout.stx | 18 +++++++++--------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 49dc2c0ef0..f99e20ec26 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -596,12 +596,15 @@ drawSquare(int x, int y, int w, int h) { template void VectorRendererSpec:: drawRoundedSquare(int x, int y, int r, int w, int h) { + + x++; y++; w--; h--; + if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h || w <= 0 || h <= 0 || x < 0 || y < 0 || r <= 0) return; - if ((r << 1) > w || (r << 1) > h) - r = MIN(w >> 1, h >> 1); + if ((r * 2) > w || (r * 2) > h) + r = MIN(w /2, h / 2); if (Base::_fillMode != kFillDisabled && Base::_shadowOffset && x + w + Base::_shadowOffset < Base::_activeSurface->w @@ -919,10 +922,14 @@ drawBevelSquareAlg(int x, int y, int w, int h, int bevel, PixelType top_color, P } int i, j; + +#if 0 x = MAX(x - bevel, 0); y = MAX(y - bevel, 0); - h += bevel << 1; - w += bevel << 1; + + w = w + (bevel * 2); + h = h + (bevel * 2); +#endif PixelType *ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y); diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index 0256fc7dd6..a55f322ce4 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -54,7 +54,7 @@ /> -- cgit v1.2.3 From 16c949d24ae9674158b782c483408be6953cc750 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 16 Jul 2009 11:41:45 +0000 Subject: Formatting. svn-id: r42530 --- graphics/VectorRendererSpec.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index f99e20ec26..4a7a301faf 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -596,8 +596,7 @@ drawSquare(int x, int y, int w, int h) { template void VectorRendererSpec:: drawRoundedSquare(int x, int y, int r, int w, int h) { - - x++; y++; w--; h--; + x++; y++; w--; h--; if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h || w <= 0 || h <= 0 || x < 0 || y < 0 || r <= 0) @@ -927,8 +926,8 @@ drawBevelSquareAlg(int x, int y, int w, int h, int bevel, PixelType top_color, P x = MAX(x - bevel, 0); y = MAX(y - bevel, 0); - w = w + (bevel * 2); - h = h + (bevel * 2); + w = w + (bevel * 2); + h = h + (bevel * 2); #endif PixelType *ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y); -- cgit v1.2.3 From a6c41a375fd1ae3395b9662207993739388a5ea0 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 16 Jul 2009 11:42:07 +0000 Subject: Update classic and builtin theme after r42529. svn-id: r42531 --- gui/themes/default.inc | 1908 +++++++++++++++++++++---------------------- gui/themes/scummclassic.zip | Bin 52802 -> 52802 bytes 2 files changed, 954 insertions(+), 954 deletions(-) diff --git a/gui/themes/default.inc b/gui/themes/default.inc index b3f0a171e6..b7db2a6b62 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -1,41 +1,38 @@ "" -" " +" " " " -" " -" " -" " -" " +" " +" " +" " +" " " " " " " " -" " -" " -" " -" " +" " +" " +" " +" " +" " +" " " " " " -" " -" " -" " " " " " " " " " " " " " " " " " " " -" " +" " " " " " " " @@ -82,37 +79,36 @@ " " " " " " " " " " " " " " -" " " " " " " " " " " " " " " " " " -" " -" " +" " +" " " " @@ -120,7 +116,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -134,10 +130,10 @@ " " " " " " -" " +" " " " " " -" " +" " " " " " " " " " -" " +" " " " @@ -158,7 +154,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -176,7 +172,7 @@ " " " " " " -" " +" " " " @@ -184,7 +180,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -192,7 +188,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -200,16 +196,16 @@ "type='PopUp' " "/> " " " -" " +" " " " " " " " -" " +" " " " @@ -223,9 +219,8 @@ " " " " " " -" " -" " -" " +" " +" " " " @@ -236,7 +231,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -247,7 +242,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -258,8 +253,8 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " @@ -268,7 +263,7 @@ " " " " " " -" " +" " " " @@ -289,7 +284,7 @@ " " -" " +" " " " @@ -305,7 +300,7 @@ " " " " " " -" " +" " " " @@ -313,7 +308,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -321,7 +316,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -341,7 +336,7 @@ " " " " " " -" " +" " " " @@ -349,17 +344,21 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " " " " " -" " +" " " " " " " " " " -" " +" " " " " " -" " +" " " " " " " " " " -" " +" " " " " " " " -" " +" " " " " " " " -" " +" " +" " " " " " " " -" " +" " " " " " " " " " -" " +" " " " @@ -486,7 +494,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -494,7 +502,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -505,81 +513,86 @@ " " " " " " -" " +" " " " " " -" " -" " +" " " " " " -" " +" " " " " " +" " +" " -" " " " " " " " " " " " " " " " -" " +" " " " " " -" " +" " " " " " " " -" " +" " " " " " " " " " " " -" " -" " -" " +" " " " @@ -590,7 +603,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -601,7 +614,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -612,25 +625,24 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " " " -" " -" " -" " +" " +" " " " " " " " -" " +" " " " @@ -641,8 +653,8 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " @@ -657,23 +669,15 @@ " " " " " " -" " -" " -" " +" " +" " " " -" " -" " -" " +" " " " " " -" " +" " " " @@ -683,16 +687,16 @@ " " " " " " -" " -" " +" " +" " " " " " -" " +" " " " @@ -707,20 +711,20 @@ " " " " " " -" " +" " " " " " " " -" " +" " " " @@ -731,20 +735,20 @@ " " " " " " -" " +" " " " " " " " " " " " " " " " " " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " +" " +" " -" " -" " -" " -" " -" " +" " +" " -" " -" " -" " -" " -" " -" " -" " +" " +" " +" " -" " -" " -" " -" " +" " +" " -" " -" " +" " +" " -" " +" " +" " -" " +" " +" " -" " -" " -" " -" " -" " +" " +" " -" " +" " +" " -" " +" " +" " -" " +" " +" " -" " -" " -" " -" " +" " +" " -" " -" " +" " +" " -" " -" " -" " -" " -" " -" " -" " +" " +" " -" " -" " -" " -" " -" " +" " +" " +" " +" " -" " +" " +" " -" " -" " -" " -" " -" " -" " -" " -" " -" " +" " +" " -" " +" " +" " -" " -" " -" " -" " -" " -" " -" " +" " +" " -" " +" " +" " -" " -" " -" " -" " -" " -" " +" " +" " -" " -" " -" " -" " -" " -" " -" " -" " +" " +" " -" " -" " -" " -" " -" " -" " -" " +" " +" " -" " +" " +" " -" " -" " -" " +" " +" " -" " +" " +" " -" " -" " -" " +" " +" " -" " -" " +" " +" " -" " -" " -" " -" " -" " -" " -" " -" " +" " +" " -" " -" " -" " -" " +" " +" " -" " -" " +" " +" " -" " -" " -" " -" " -" " +" " +" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " +" " +" " -" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " +" " +" " +" " +" " +" " +" " +" " +" " -" " -" " -" " -" " +" " -" " -" " -" " -" " +" " " " -" " -" " +" " +" " -" " -" " -" " -" " -" " -" " -" " -" " -" " " " -" " -" " +" " +" " -" " -" " -" " -" " -" " " " -" " " " " " -" " -" " -" " +" " +" " -" " -" " -" " -" " -" " +" " +" " " " " " -" " " " " " " " -" " -" " +" " +" " " " -" " +" " " " " " " " " " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " +" " " " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " +" " -" " " " -" " -" " -" " +" " -" " " " -" " -" " -" " " " -" " " " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " +" " +" " +" " -" " " " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " +" " -" " " " -" " -" " -" " -" " +" " -" " -" " -" " +" " +" " -" " -" " -" " +" " +" " -" " -" " -" " " " +" " " " -" " -" " -" " +" " +" " +" " +" " " " @@ -1356,7 +1324,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -1367,7 +1335,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -1378,465 +1346,497 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " " " -" " -" " -" " +" " +" " +" " +" " +" " -" " +" " " " -" " -" " +" " +" " +" " +" " -" " -" " " " -" " -" " -" " +" " +" " +" " +" " +" " -" " -" " -" " +" " +" " +" " " " -" " -" " -" " -" " -" " -" " -" " -" " -" " +" " -" " -" " -" " +" " +" " +" " " " " " " " -" " -" " -" " +" " +" " +" " +" " -" " +" " +" " -" " -" " -" " +" " +" " -" " -" " " " +" " " " " " -" " -" " -" " +" " +" " -" " +" " -" " +" " +" " +" " +" " -" " " " +" " +" " +" " +" " +" " +" " +" " +" " " " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " " " -" " -" " -" " -" " " " -" " -" " " " -" " +" " -" " " " +" " " " -" " -" " -" " -" " -" " +" " +" " +" " -" " -" " +" " +" " -" " -" " -" " -" " +" " +" " -" " -" " +" " +" " +" " +" " +" " -" " -" " -" " +" " -" " -" " -" " -" " -" " +" " -" " -" " -" " -" " -" " -" " +" " -" " -" " -" " -" " -" " -" " +" " +" " +" " +" " -" " -" " -" " +" " -" " -" " -" " -" " -" " -" " +" " -" " -" " -" " -" " -" " -" " -" " +" " -" " +" " +" " +" " +" " +" " +" " +" " -" " -" " -" " -" " -" " -" " -" " +" " +" " -" " -" " -" " -" " -" " -" " -" " -" " -" " +" " +" " -" " -" " -" " -" " -" " -" " -" " -" " -" " +" " +" " +" " -" " -" " -" " +" " +" " +" " +" " -" " -" " +" " +" " -" " -" " -" " -" " -" " +" " +" " +" " -" " -" " -" " +" " -" " -" " +" " +" " +" " +" " +" " -" " -" " -" " +" " +" " -" " -" " -" " +" " +" " +" " -" " -" " -" " +" " -" " -" " -" " -" " -" " -" " +" " +" " +" " +" " +" " -" " -" " -" " -" " +" " -" " -" " -" " -" " +" " -" " +" " +" " +" " +" " +" " -" " -" " -" " -" " -" " -" " -" " +" " -" " -" " +" " +" " +" " +" " +" " +" " -" " -" " -" " -" " +" " -" " -" " -" " -" " -" " +" " +" " +" " diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip index a3d35084e8..7c21b78a3f 100644 Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ -- cgit v1.2.3 From 645e6baa07e71d10b76f3f0fd0950c2e0513a23c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 16 Jul 2009 12:43:42 +0000 Subject: Added a proper fix for Pepper (the previous one caused regressions in KQ6) svn-id: r42533 --- engines/sci/gfx/operations.cpp | 3 +-- engines/sci/gfx/res_pal.cpp | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index 9b2c3dc7f5..6b15cdc516 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -1712,8 +1712,7 @@ static int _gfxop_set_pic(GfxState *state) { // FIXME: The _gfxop_install_pixmap call below updates the OSystem palette. // This is too soon, since it causes brief palette corruption until the // screen is updated too. (Possibly related: EngineState::pic_not_valid .) - // SCI1.1 games don't use per-picture palettes - if (state->gfxResMan->getVersion() < SCI_VERSION_1_1) { + if (state->pic->visual_map->palette && state->driver->getMode()->palette) { state->pic->visual_map->palette->forceInto(state->driver->getMode()->palette); _gfxop_install_pixmap(state->driver, state->pic->visual_map); } diff --git a/engines/sci/gfx/res_pal.cpp b/engines/sci/gfx/res_pal.cpp index 97e7297d43..d686220453 100644 --- a/engines/sci/gfx/res_pal.cpp +++ b/engines/sci/gfx/res_pal.cpp @@ -44,6 +44,11 @@ Palette *gfxr_read_pal11(int id, byte *resource, int size) { int entry_size = (format == SCI_PAL_FORMAT_VARIABLE_FLAGS) ? 4 : 3; byte *pal_data = resource + 37; int _colors_nr = READ_LE_UINT16(resource + 29); + + // Happens at the beginning of Pepper + if (_colors_nr > 256) + return NULL; + Palette *retval = new Palette(_colors_nr + start_color); int i; -- cgit v1.2.3 From ff75d68f1ca292733b601b33ab3cfe4aab670174 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Thu, 16 Jul 2009 17:26:44 +0000 Subject: Fixed GCC warning. svn-id: r42536 --- engines/tinsel/pcode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp index 72004b4ae9..1d73411e13 100644 --- a/engines/tinsel/pcode.cpp +++ b/engines/tinsel/pcode.cpp @@ -142,7 +142,7 @@ const WorkaroundEntry workaroundList[] = { // * Giving the brochure to the beekeeper // * Stealing the mallets from the wizards // This fix ensures that the global is reset when the Garden scene is loaded (both entering and restoring a game) - {TINSEL_V2, true, 2888147476, 0, fragment3_size, fragment3}, + {TINSEL_V2, true, 2888147476U, 0, fragment3_size, fragment3}, {TINSEL_V0, false, 0, 0, 0, NULL} }; -- cgit v1.2.3 From af289bdb03d7f0a5e8f01c03e462f230835e0077 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Thu, 16 Jul 2009 17:29:31 +0000 Subject: Fixed bug 2820514 ("Help dialog causes crash") svn-id: r42537 --- engines/scumm/dialogs.cpp | 16 +- engines/scumm/dialogs.h | 1 + graphics/VectorRendererSpec.cpp | 12 +- gui/themes/default.inc | 632 ++++++++++----------- gui/themes/scummclassic.zip | Bin 52802 -> 53307 bytes gui/themes/scummclassic/classic_layout.stx | 20 +- gui/themes/scummclassic/classic_layout_lowres.stx | 2 +- gui/themes/scummmodern.zip | Bin 157460 -> 157995 bytes .../scummmodern/scummmodern_layout_lowres.stx | 6 +- 9 files changed, 347 insertions(+), 342 deletions(-) diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index 9fb107f9fc..54ade5b7ca 100644 --- a/engines/scumm/dialogs.cpp +++ b/engines/scumm/dialogs.cpp @@ -641,6 +641,8 @@ HelpDialog::HelpDialog(const GameSettings &game) new GUI::ButtonWidget(this, "ScummHelp.Close", "Close", kCloseCmd, 'C'); _prevButton->clearFlags(WIDGET_ENABLED); + _numLines = HELP_NUM_LINES; + // Dummy entries for (int i = 0; i < HELP_NUM_LINES; i++) { _key[i] = new StaticTextWidget(this, 0, 0, 10, 10, "", Graphics::kTextAlignRight); @@ -658,15 +660,20 @@ void HelpDialog::reflowLayout() { g_gui.xmlEval()->getWidgetData("ScummHelp.HelpText", x, y, w, h); + /* Make sure than we don't have more lines than what we can fit + * on the space that the layout reserves for text */ + _numLines = MIN(HELP_NUM_LINES, (int)(h / lineHeight)); + + int keyW = w * 20 / 100; int dscX = x + keyW + 32; int dscW = w * 80 / 100; int xoff = (_w >> 1) - (w >> 1); - for (int i = 0; i < HELP_NUM_LINES; i++) { - _key[i]->resize(xoff + x, y + lineHeight * i, keyW, lineHeight + 2); - _dsc[i]->resize(xoff + dscX, y + lineHeight * i, dscW, lineHeight + 2); + for (int i = 0; i < _numLines; i++) { + _key[i]->resize(xoff + x, y + lineHeight * i, keyW, lineHeight); + _dsc[i]->resize(xoff + dscX, y + lineHeight * i, dscW, lineHeight); } displayKeyBindings(); @@ -675,6 +682,7 @@ void HelpDialog::reflowLayout() { void HelpDialog::displayKeyBindings() { String titleStr, *keyStr, *dscStr; + int i; #ifndef __DS__ ScummHelp::updateStrings(_game.id, _game.version, _game.platform, _page, titleStr, keyStr, dscStr); @@ -684,7 +692,7 @@ void HelpDialog::displayKeyBindings() { #endif _title->setLabel(titleStr); - for (int i = 0; i < HELP_NUM_LINES; i++) { + for (i = 0; i < _numLines; i++) { _key[i]->setLabel(keyStr[i]); _dsc[i]->setLabel(dscStr[i]); } diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h index 290b3450dc..996ff0e7a7 100644 --- a/engines/scumm/dialogs.h +++ b/engines/scumm/dialogs.h @@ -124,6 +124,7 @@ protected: int _page; int _numPages; + int _numLines; const GameSettings _game; diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 4a7a301faf..b68f4822d8 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -596,8 +596,6 @@ drawSquare(int x, int y, int w, int h) { template void VectorRendererSpec:: drawRoundedSquare(int x, int y, int r, int w, int h) { - x++; y++; w--; h--; - if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h || w <= 0 || h <= 0 || x < 0 || y < 0 || r <= 0) return; @@ -606,8 +604,8 @@ drawRoundedSquare(int x, int y, int r, int w, int h) { r = MIN(w /2, h / 2); if (Base::_fillMode != kFillDisabled && Base::_shadowOffset - && x + w + Base::_shadowOffset < Base::_activeSurface->w - && y + h + Base::_shadowOffset < Base::_activeSurface->h) { + && x + w + Base::_shadowOffset + 1 < Base::_activeSurface->w + && y + h + Base::_shadowOffset + 1 < Base::_activeSurface->h) { drawRoundedSquareShadow(x, y, r, w, h, Base::_shadowOffset); } @@ -922,13 +920,11 @@ drawBevelSquareAlg(int x, int y, int w, int h, int bevel, PixelType top_color, P int i, j; -#if 0 x = MAX(x - bevel, 0); y = MAX(y - bevel, 0); - w = w + (bevel * 2); - h = h + (bevel * 2); -#endif + w = MIN(w + (bevel * 2), (int)_activeSurface->w); + h = MIN(h + (bevel * 2), (int)_activeSurface->h); PixelType *ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y); diff --git a/gui/themes/default.inc b/gui/themes/default.inc index b7db2a6b62..0331c90fbb 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -1,38 +1,41 @@ "" -" " +" " " " -" " -" " -" " -" " +" " +" " +" " +" " " " " " " " -" " -" " -" " -" " -" " -" " +" " +" " +" " +" " " " " " +" " +" " +" " " " " " " " " " " " " " " " " " " " -" " +" " " " " " " " @@ -79,36 +82,37 @@ " " " " " " " " " " " " " " +" " " " " " " " " " " " " " " " " " -" " -" " +" " +" " " " @@ -116,7 +120,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -130,10 +134,10 @@ " " " " " " -" " +" " " " " " -" " +" " " " " " " " " " -" " +" " " " @@ -154,7 +158,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -172,7 +176,7 @@ " " " " " " -" " +" " " " @@ -180,7 +184,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -188,7 +192,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -196,16 +200,16 @@ "type='PopUp' " "/> " " " -" " +" " " " " " " " -" " +" " " " @@ -219,8 +223,9 @@ " " " " " " -" " -" " +" " +" " +" " " " @@ -231,7 +236,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -242,7 +247,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -253,8 +258,8 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " @@ -263,7 +268,7 @@ " " " " " " -" " +" " " " @@ -284,7 +289,7 @@ " " -" " +" " " " @@ -300,7 +305,7 @@ " " " " " " -" " +" " " " @@ -308,7 +313,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -316,7 +321,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -336,7 +341,7 @@ " " " " " " -" " +" " " " @@ -344,21 +349,17 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " " " " " -" " +" " " " " " " " " " -" " +" " " " " " -" " +" " " " " " " " " " -" " +" " " " " " " " -" " +" " " " " " " " -" " -" " +" " " " " " " " -" " +" " " " " " " " " " -" " +" " " " @@ -494,7 +486,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -502,7 +494,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -513,86 +505,81 @@ " " " " " " -" " +" " " " " " -" " +" " +" " " " " " -" " +" " " " " " -" " -" " +" " " " " " " " " " " " " " " " -" " +" " " " " " -" " +" " " " " " " " -" " +" " " " " " " " " " " " -" " +" " +" " +" " " " @@ -603,7 +590,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -614,7 +601,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -625,24 +612,25 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " " " -" " -" " +" " +" " +" " " " " " " " -" " +" " " " @@ -653,8 +641,8 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " @@ -669,15 +657,23 @@ " " " " " " -" " -" " +" " +" " +" " " " -" " +" " +" " +" " " " " " -" " +" " " " @@ -687,16 +683,16 @@ " " " " " " -" " -" " +" " +" " " " " " -" " +" " " " @@ -711,20 +707,20 @@ " " " " " " -" " +" " " " " " " " -" " +" " " " @@ -735,20 +731,20 @@ " " " " " " -" " +" " " " " " " " " " " " " " " " " " -" " +" " " " -" " -" " -" " -" " +" " +" " +" " +" " " " " " " " -" " -" " -" " -" " +" " +" " +" " +" " +" " +" " " " " " -" " -" " -" " " " " " " " " " " " " " " " " " " " -" " +" " " " " " " " @@ -1170,37 +1163,36 @@ " " " " " " " " " " " " " " -" " " " " " " " " " " " " " " " " " -" " -" " +" " +" " " " @@ -1208,7 +1200,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -1222,10 +1214,10 @@ " " " " " " -" " +" " " " " " -" " +" " " " " " " " " " -" " +" " " " @@ -1246,7 +1238,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -1264,7 +1256,7 @@ " " " " " " -" " +" " " " @@ -1272,7 +1264,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -1280,7 +1272,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -1288,16 +1280,16 @@ "type='PopUp' " "/> " " " -" " +" " " " " " " " -" " +" " " " @@ -1311,9 +1303,8 @@ " " " " " " -" " -" " -" " +" " +" " " " @@ -1324,7 +1315,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -1335,7 +1326,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -1346,8 +1337,8 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " @@ -1356,7 +1347,7 @@ " " " " " " -" " +" " " " @@ -1377,7 +1368,7 @@ " " -" " +" " " " @@ -1393,7 +1384,7 @@ " " " " " " -" " +" " " " @@ -1401,7 +1392,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -1409,7 +1400,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -1429,7 +1420,7 @@ " " " " " " -" " +" " " " @@ -1437,17 +1428,21 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " " " " " -" " +" " " " " " " " " " -" " +" " " " " " -" " +" " " " " " " " " " -" " +" " " " " " " " -" " +" " " " " " " " -" " +" " +" " " " " " " " -" " +" " " " " " " " " " -" " +" " " " @@ -1574,7 +1578,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -1582,7 +1586,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -1593,81 +1597,86 @@ " " " " " " -" " +" " " " " " -" " -" " +" " " " " " -" " +" " " " " " +" " +" " -" " " " " " " " " " " " " " " " -" " +" " " " " " -" " +" " " " " " " " -" " +" " " " " " " " " " " " -" " -" " -" " +" " " " @@ -1678,7 +1687,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -1689,7 +1698,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -1700,25 +1709,24 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " " " -" " -" " -" " +" " +" " " " " " " " -" " +" " " " @@ -1729,8 +1737,8 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " @@ -1745,23 +1753,15 @@ " " " " " " -" " -" " -" " +" " +" " " " -" " -" " -" " +" " " " " " -" " +" " " " @@ -1771,16 +1771,16 @@ " " " " " " -" " -" " +" " +" " " " " " -" " +" " " " @@ -1795,20 +1795,20 @@ " " " " " " -" " +" " " " " " " " -" " +" " " " @@ -1819,20 +1819,20 @@ " " " " " " -" " +" " " " " " " " " " " " " @@ -745,7 +745,7 @@ height = 'Globals.Line.Height' /> - + - - + + getWidgetData("ScummHelp.HelpText", x, y, w, h); - /* Make sure than we don't have more lines than what we can fit - * on the space that the layout reserves for text */ + // Make sure than we don't have more lines than what we can fit + // on the space that the layout reserves for text _numLines = MIN(HELP_NUM_LINES, (int)(h / lineHeight)); - int keyW = w * 20 / 100; int dscX = x + keyW + 32; int dscW = w * 80 / 100; @@ -680,9 +679,7 @@ void HelpDialog::reflowLayout() { } void HelpDialog::displayKeyBindings() { - String titleStr, *keyStr, *dscStr; - int i; #ifndef __DS__ ScummHelp::updateStrings(_game.id, _game.version, _game.platform, _page, titleStr, keyStr, dscStr); @@ -692,7 +689,7 @@ void HelpDialog::displayKeyBindings() { #endif _title->setLabel(titleStr); - for (i = 0; i < _numLines; i++) { + for (int i = 0; i < _numLines; i++) { _key[i]->setLabel(keyStr[i]); _dsc[i]->setLabel(dscStr[i]); } diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h index 996ff0e7a7..af844272fa 100644 --- a/engines/scumm/dialogs.h +++ b/engines/scumm/dialogs.h @@ -124,7 +124,7 @@ protected: int _page; int _numPages; - int _numLines; + int _numLines; const GameSettings _game; -- cgit v1.2.3 From 1e3beb40c04ef323f5354e4258659764735fdb0c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 16 Jul 2009 17:44:05 +0000 Subject: This commit is just for DrMcCoy. (forgot to fix two usages of whitespaces instead of tabs for indentation -.-) svn-id: r42539 --- engines/scumm/dialogs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index 9d3ba527c4..880fab04a5 100644 --- a/engines/scumm/dialogs.cpp +++ b/engines/scumm/dialogs.cpp @@ -641,7 +641,7 @@ HelpDialog::HelpDialog(const GameSettings &game) new GUI::ButtonWidget(this, "ScummHelp.Close", "Close", kCloseCmd, 'C'); _prevButton->clearFlags(WIDGET_ENABLED); - _numLines = HELP_NUM_LINES; + _numLines = HELP_NUM_LINES; // Dummy entries for (int i = 0; i < HELP_NUM_LINES; i++) { @@ -662,7 +662,7 @@ void HelpDialog::reflowLayout() { // Make sure than we don't have more lines than what we can fit // on the space that the layout reserves for text - _numLines = MIN(HELP_NUM_LINES, (int)(h / lineHeight)); + _numLines = MIN(HELP_NUM_LINES, (int)(h / lineHeight)); int keyW = w * 20 / 100; int dscX = x + keyW + 32; -- cgit v1.2.3 From 62de2d9edc7eb51240d944e7a3bfcf894519f5d4 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Thu, 16 Jul 2009 17:51:12 +0000 Subject: Fixed bug: In-game console doesn't stay centered when switching resolutions on the fly. svn-id: r42540 --- gui/console.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gui/console.cpp b/gui/console.cpp index e33aa9d9fe..498d1767a6 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -112,6 +112,7 @@ void ConsoleDialog::init() { _w = _w - _w / 20; _h = _h * kConsoleLineHeight + 2; + _x = _w / 40; // Set scrollbar dimensions int scrollBarWidth = g_gui.xmlEval()->getVar("Globals.Scrollbar.Width", 0); @@ -149,8 +150,8 @@ void ConsoleDialog::open() { if (_w != w || _h != h) init(); - _x = _w / 40; _y = -_h; + _slideTime = g_system->getMillis(); _slideMode = kDownSlideMode; -- cgit v1.2.3 From 572b0e6c03ba17f91cb2e0d257939ecf7cbc0eaf Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 16 Jul 2009 21:47:57 +0000 Subject: Fix bug in "KyraEngine_v2::runSceneScript6", fixes text line Zanthia says, when picking up the spellbook page in the town. svn-id: r42543 --- engines/kyra/scene_v2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/kyra/scene_v2.cpp b/engines/kyra/scene_v2.cpp index 9ffaf5515d..3def71a076 100644 --- a/engines/kyra/scene_v2.cpp +++ b/engines/kyra/scene_v2.cpp @@ -73,7 +73,7 @@ void KyraEngine_v2::runSceneScript6() { _sceneScriptState.regs[0] = _mainCharacter.sceneId; _sceneScriptState.regs[1] = _mouseX; _sceneScriptState.regs[2] = _mouseY; - _sceneScriptState.regs[3] = _itemInHand; + _sceneScriptState.regs[4] = _itemInHand; _emc->start(&_sceneScriptState, 6); while (_emc->isValid(&_sceneScriptState)) -- cgit v1.2.3 From c0965b2a2aceab1468bccf5368b3c46f7a97efa1 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Fri, 17 Jul 2009 00:10:10 +0000 Subject: Fix using subtitles only setting in The Dig. svn-id: r42545 --- engines/scumm/string.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp index d40bbb9aaa..f00f4ff33b 100644 --- a/engines/scumm/string.cpp +++ b/engines/scumm/string.cpp @@ -1415,6 +1415,9 @@ void ScummEngine_v7::loadLanguageBundle() { } void ScummEngine_v7::playSpeech(const byte *ptr) { + if (_game.id == GID_DIG && (ConfMan.getBool("speech_mute") || VAR(VAR_VOICE_MODE) == 2)) + return; + if ((_game.id == GID_DIG || _game.id == GID_CMI) && ptr[0]) { char pointer[20]; strcpy(pointer, (const char *)ptr); -- cgit v1.2.3 From cff307e55db7cfe088885214bfc75b545223f9bd Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Fri, 17 Jul 2009 00:25:27 +0000 Subject: Fix bug #2821986 - COMI: setting to 'subtitles only' does not disable speech. svn-id: r42548 --- engines/scumm/imuse_digi/dimuse_track.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engines/scumm/imuse_digi/dimuse_track.cpp b/engines/scumm/imuse_digi/dimuse_track.cpp index 6ded6d23b2..a389c0e7e7 100644 --- a/engines/scumm/imuse_digi/dimuse_track.cpp +++ b/engines/scumm/imuse_digi/dimuse_track.cpp @@ -22,6 +22,7 @@ * $Id$ */ +#include "common/config-manager.h" #include "common/timer.h" #include "scumm/actor.h" @@ -136,6 +137,11 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, track->pan = a->_talkPan; track->vol = a->_talkVolume * 1000; } + + // The volume is set to zero, when using subtitles only setting in COMI + if (ConfMan.getBool("speech_mute") || _vm->VAR(_vm->VAR_VOICE_MODE) == 2) { + track->vol = 0; + } } assert(bits == 8 || bits == 12 || bits == 16); -- cgit v1.2.3 From 922f721108b2a77c47add7055ff4fb5119f1c745 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Fri, 17 Jul 2009 00:55:42 +0000 Subject: Added some more debug warnings when resources can't be loaded svn-id: r42551 --- engines/gob/resources.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/engines/gob/resources.cpp b/engines/gob/resources.cpp index a16514fcbc..eeb880485f 100644 --- a/engines/gob/resources.cpp +++ b/engines/gob/resources.cpp @@ -588,15 +588,22 @@ Resource *Resources::getTOTResource(uint16 id) const { if (totItem.type == kResourceTOT) data = getTOTData(totItem); - if (!data) + if (!data) { + warning("Failed to load TOT resource (%s, %d/%d, %d)", + _totFile.c_str(), id, _totResourceTable->itemsCount - 1, totItem.type); return 0; + } return new Resource(data, totItem.size, false, totItem.width, totItem.height); } Resource *Resources::getEXTResource(uint16 id) const { - if (!_extResourceTable || (id > _extResourceTable->itemsCount)) + if (!_extResourceTable || (id > _extResourceTable->itemsCount)) { + warning("Trying to load non-existent EXT resource (%s, %d/%d)", + _totFile.c_str(), id, + _extResourceTable ? (_extResourceTable->itemsCount - 1) : -1); return 0; + } EXTResourceItem &extItem = _extResourceTable->items[id]; @@ -617,8 +624,11 @@ Resource *Resources::getEXTResource(uint16 id) const { if (extItem.type == kResourceEX) data = getEXData(extItem, size); - if (!data) + if (!data) { + warning("Failed to load EXT resource (%s, %d/%d, %d)", + _totFile.c_str(), id, _extResourceTable->itemsCount - 1, extItem.type); return 0; + } if (extItem.packed) { byte *packedData = data; -- cgit v1.2.3 From 6c4e87a1d889ffdb6c97393d6d31db3138c291c8 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Fri, 17 Jul 2009 00:55:56 +0000 Subject: Making TOTResourceItem::size unsigned, fixing a graphics bug that crept in svn-id: r42552 --- engines/gob/resources.cpp | 6 +++--- engines/gob/resources.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/gob/resources.cpp b/engines/gob/resources.cpp index eeb880485f..c52b65f0d7 100644 --- a/engines/gob/resources.cpp +++ b/engines/gob/resources.cpp @@ -255,7 +255,7 @@ bool Resources::loadTOTResourceTable() { TOTResourceItem &item = _totResourceTable->items[i]; item.offset = stream->readSint32LE(); - item.size = stream->readSint16LE(); + item.size = stream->readUint16LE(); item.width = stream->readSint16LE(); item.height = stream->readSint16LE(); @@ -645,7 +645,7 @@ Resource *Resources::getEXTResource(uint16 id) const { } byte *Resources::getTOTData(TOTResourceItem &totItem) const { - if (totItem.size < 0) + if (totItem.size == 0) return 0; int32 offset = _totResourceTable->dataOffset + totItem.offset - _totResStart; @@ -657,7 +657,7 @@ byte *Resources::getTOTData(TOTResourceItem &totItem) const { } byte *Resources::getIMData(TOTResourceItem &totItem) const { - if (totItem.size < 0) + if (totItem.size == 0) return 0; int32 indexOffset = totItem.index * 4; diff --git a/engines/gob/resources.h b/engines/gob/resources.h index 80acef645c..d316be83e5 100644 --- a/engines/gob/resources.h +++ b/engines/gob/resources.h @@ -109,7 +109,7 @@ private: struct TOTResourceItem { ResourceType type; - int16 size; + uint16 size; int16 width; int16 height; union { -- cgit v1.2.3 From db81b0a1853fa8212bedda90429d180f0fe34297 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 17 Jul 2009 05:10:24 +0000 Subject: Added an explicit break out of the event processing loop for mouse buttons and/or key-presses - this should allow stylus-based systems to properly process 'mouse down' events before the 'mouse up' is processed svn-id: r42558 --- engines/cruise/cruise_main.cpp | 91 ++++++------------------------------------ engines/cruise/menu.cpp | 2 +- 2 files changed, 14 insertions(+), 79 deletions(-) diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index 862cda592e..e5864ebb31 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -1626,11 +1626,14 @@ int currentMouseButton = 0; bool bFastMode = false; -void manageEvents() { +bool manageEvents() { Common::Event event; + bool result = false; Common::EventManager * eventMan = g_system->getEventManager(); - while (eventMan->pollEvent(event)) { + while (eventMan->pollEvent(event) && !result) { + result = true; + switch (event.type) { case Common::EVENT_LBUTTONDOWN: currentMouseButton |= MB_LEFT; @@ -1647,11 +1650,12 @@ void manageEvents() { case Common::EVENT_MOUSEMOVE: currentMouseX = event.mouse.x; currentMouseY = event.mouse.y; + result = false; break; case Common::EVENT_QUIT: case Common::EVENT_RTL: playerDontAskQuit = 1; - return; + break; case Common::EVENT_KEYUP: switch (event.kbd.keycode) { case Common::KEYCODE_ESCAPE: @@ -1671,72 +1675,6 @@ void manageEvents() { break; } - /* - * switch (event.kbd.keycode) { - * case '\n': - * case '\r': - * case 261: // Keypad 5 - * if (allowPlayerInput) { - * mouseLeft = 1; - * } - * break; - * case 27: // ESC - * if (allowPlayerInput) { - * mouseRight = 1; - * } - * break; - * case 282: // F1 - * if (allowPlayerInput) { - * playerCommand = 0; // EXAMINE - * makeCommandLine(); - * } - * break; - * case 283: // F2 - * if (allowPlayerInput) { - * playerCommand = 1; // TAKE - * makeCommandLine(); - * } - * break; - * case 284: // F3 - * if (allowPlayerInput) { - * playerCommand = 2; // INVENTORY - * makeCommandLine(); - * } - * break; - * case 285: // F4 - * if (allowPlayerInput) { - * playerCommand = 3; // USE - * makeCommandLine(); - * } - * break; - * case 286: // F5 - * if (allowPlayerInput) { - * playerCommand = 4; // ACTIVATE - * makeCommandLine(); - * } - * break; - * case 287: // F6 - * if (allowPlayerInput) { - * playerCommand = 5; // SPEAK - * makeCommandLine(); - * } - * break; - * case 290: // F9 - * if (allowPlayerInput && !inMenu) { - * makeActionMenu(); - * makeCommandLine(); - * } - * break; - * case 291: // F10 - * if (!disableSystemMenu && !inMenu) { - * g_cine->makeSystemMenu(); - * } - * break; - * default: - * //lastKeyStroke = event.kbd.keycode; - * break; - * } - * break; */ if (event.kbd.flags == Common::KBD_CTRL) { if (event.kbd.keycode == Common::KEYCODE_d) { // Start the debugger @@ -1753,17 +1691,10 @@ void manageEvents() { } } - /*if (count) { - * mouseData.left = mouseLeft; - * mouseData.right = mouseRight; - * mouseLeft = 0; - * mouseRight = 0; - * } - */ + return result; } void getMouseStatus(int16 *pMouseVar, int16 *pMouseX, int16 *pMouseButton, int16 *pMouseY) { - manageEvents(); *pMouseX = currentMouseX; *pMouseY = currentMouseY; *pMouseButton = currentMouseButton; @@ -1806,11 +1737,15 @@ void CruiseEngine::mainLoop(void) { if (!bFastMode) { // Delay for the specified amount of time, but still respond to events + bool skipEvents = false; + while (currentTick < lastTick + _gameSpeed) { g_system->delayMillis(10); currentTick = g_system->getMillis(); - manageEvents(); + if (!skipEvents) + skipEvents = manageEvents(); + if (playerDontAskQuit) break; if (_vm->getDebugger()->isAttached()) diff --git a/engines/cruise/menu.cpp b/engines/cruise/menu.cpp index 0e9ab55c82..54f686f32a 100644 --- a/engines/cruise/menu.cpp +++ b/engines/cruise/menu.cpp @@ -146,7 +146,7 @@ void updateMenuMouse(int mouseX, int mouseY, menuStruct *pMenu) { } } -void manageEvents(); +bool manageEvents(); int processMenu(menuStruct *pMenu) { int16 mouseX; -- cgit v1.2.3 From d329232f5c084193ab8eac3711ae141df54a9793 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Fri, 17 Jul 2009 06:26:37 +0000 Subject: Fix input glitch regression, after pausing in PN. svn-id: r42559 --- engines/agos/vga_pn.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/agos/vga_pn.cpp b/engines/agos/vga_pn.cpp index 32c6e15f00..12846b08f1 100644 --- a/engines/agos/vga_pn.cpp +++ b/engines/agos/vga_pn.cpp @@ -129,7 +129,6 @@ void AGOSEngine::vc36_pause() { _keyPressed.reset(); windowPutChar(_windowArray[2], 13); - windowPutChar(_windowArray[2], 128); _wiped = oldWiped; _videoLockOut &= ~8; -- cgit v1.2.3 From 74178f090cf5ac8e692c9c6345b436e33f629104 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Fri, 17 Jul 2009 09:56:03 +0000 Subject: Fix bug #2822956 - ELVIRA2: Crash at the beginning (regression). svn-id: r42560 --- engines/agos/vga_e2.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/engines/agos/vga_e2.cpp b/engines/agos/vga_e2.cpp index 7f02398e13..f6e6630d43 100644 --- a/engines/agos/vga_e2.cpp +++ b/engines/agos/vga_e2.cpp @@ -207,6 +207,7 @@ void AGOSEngine::vc53_dissolveIn() { uint16 speed = vcReadNextWord() + 1; byte *src, *dst, *srcOffs, *srcOffs2, *dstOffs, *dstOffs2; + int16 xoffs, yoffs; uint8 color = 0; // Only uses Video Window 4 @@ -218,15 +219,13 @@ void AGOSEngine::vc53_dissolveIn() { uint16 dissolveDelay = dissolveCheck * 2 / speed; uint16 dissolveCount = dissolveCheck * 2 / speed; - Graphics::Surface *screen = _system->lockScreen(); - - int16 xoffs = _videoWindows[num * 4 + 0] * 16; - int16 yoffs = _videoWindows[num * 4 + 1]; - int16 offs = xoffs + yoffs * screen->pitch; + int16 x = _videoWindows[num * 4 + 0] * 16; + int16 y = _videoWindows[num * 4 + 1]; uint16 count = dissolveCheck * 2; while (count--) { - byte *dstPtr = (byte *)screen->pixels + offs; + Graphics::Surface *screen = _system->lockScreen(); + byte *dstPtr = (byte *)screen->pixels + x + y * screen->pitch; yoffs = _rnd.getRandomNumber(dissolveY); dst = dstPtr + yoffs * screen->pitch; @@ -285,6 +284,7 @@ void AGOSEngine::vc54_dissolveOut() { uint16 speed = vcReadNextWord() + 1; byte *dst, *dstOffs; + int16 xoffs, yoffs; uint16 dissolveX = _videoWindows[num * 4 + 2] * 8; uint16 dissolveY = (_videoWindows[num * 4 + 3] + 1) / 2; @@ -292,15 +292,13 @@ void AGOSEngine::vc54_dissolveOut() { uint16 dissolveDelay = dissolveCheck * 2 / speed; uint16 dissolveCount = dissolveCheck * 2 / speed; - Graphics::Surface *screen = _system->lockScreen(); - - int16 xoffs = _videoWindows[num * 4 + 0] * 16; - int16 yoffs = _videoWindows[num * 4 + 1]; - int16 offs = xoffs + yoffs * screen->pitch; + int16 x = _videoWindows[num * 4 + 0] * 16; + int16 y = _videoWindows[num * 4 + 1]; uint16 count = dissolveCheck * 2; while (count--) { - byte *dstPtr = (byte *)screen->pixels + offs; + Graphics::Surface *screen = _system->lockScreen(); + byte *dstPtr = (byte *)screen->pixels + x + y * screen->pitch; color |= dstPtr[0] & 0xF0; yoffs = _rnd.getRandomNumber(dissolveY); -- cgit v1.2.3 From 9f2f04120058c9a712088430c558c1ce6766af6a Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Fri, 17 Jul 2009 10:48:30 +0000 Subject: Correct error in saveBackGround. svn-id: r42561 --- engines/agos/draw.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/agos/draw.cpp b/engines/agos/draw.cpp index d09f02c76d..45443aa335 100644 --- a/engines/agos/draw.cpp +++ b/engines/agos/draw.cpp @@ -503,7 +503,7 @@ void AGOSEngine::saveBackGround(VgaSprite *vsp) { animTable->y = y; animTable->width = READ_BE_UINT16(ptr + 6) / 16; - if (vsp->flags & 40) { + if (vsp->flags & 0x40) { animTable->width++; } -- cgit v1.2.3 From 799af694f0945cce3cebd729dd10e12f2a9c4510 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 17 Jul 2009 13:35:56 +0000 Subject: Replace LGPL header by GPL header. svn-id: r42563 --- engines/kyra/sound_pcspk.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/engines/kyra/sound_pcspk.cpp b/engines/kyra/sound_pcspk.cpp index 22c24bf56c..2afed22a80 100644 --- a/engines/kyra/sound_pcspk.cpp +++ b/engines/kyra/sound_pcspk.cpp @@ -1,25 +1,22 @@ -/* - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +/* ScummVM - Graphic Adventure Engine * - * LGPL License + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. - * This library is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * $URL$ * $Id$ -- cgit v1.2.3 From c353e5389b98cc3d7753aa7bcb5b07d7efc4de0b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 17 Jul 2009 13:50:59 +0000 Subject: - Moved SoundAdlibPC definition to new header file sound_adlib.h - Made the future versions of sound.h GPL only - sound_adlib.h is dual licensed under GPL and LGPL (so AdPlug can still benefit from future changes) svn-id: r42564 --- engines/kyra/sound.h | 20 +------- engines/kyra/sound_adlib.h | 113 ++++++++++++++++++++++++++++++++++++++++++++ engines/kyra/sound_intern.h | 65 ++----------------------- 3 files changed, 118 insertions(+), 80 deletions(-) create mode 100644 engines/kyra/sound_adlib.h diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index f393ae15ba..263cd586f7 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -8,32 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * LGPL License - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * * $URL$ * $Id$ * diff --git a/engines/kyra/sound_adlib.h b/engines/kyra/sound_adlib.h new file mode 100644 index 0000000000..f384113af7 --- /dev/null +++ b/engines/kyra/sound_adlib.h @@ -0,0 +1,113 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * LGPL License + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * $URL$ + * $Id$ + * + */ + +#ifndef KYRA_SOUND_ADLIB_H +#define KYRA_SOUND_ADLIB_H + +#include "kyra/sound.h" + +#include "common/mutex.h" + +namespace Kyra { +class AdlibDriver; + +/** + * AdLib implementation of the sound output device. + * + * It uses a special sound file format special to + * Dune II, Kyrandia 1 and 2. While Dune II and + * Kyrandia 1 are using exact the same format, the + * one of Kyrandia 2 slightly differs. + * + * See AdlibDriver for more information. + * @see AdlibDriver + */ +class SoundAdlibPC : public Sound { +public: + SoundAdlibPC(KyraEngine_v1 *vm, Audio::Mixer *mixer); + ~SoundAdlibPC(); + + kType getMusicType() const { return kAdlib; } + + bool init(); + void process(); + + void loadSoundFile(uint file); + void loadSoundFile(Common::String file); + + void playTrack(uint8 track); + void haltTrack(); + bool isPlaying(); + + void playSoundEffect(uint8 track); + + void beginFadeOut(); +private: + void internalLoadFile(Common::String file); + + void play(uint8 track); + + void unk1(); + void unk2(); + + AdlibDriver *_driver; + + bool _v2; + uint8 _trackEntries[500]; + uint8 *_soundDataPtr; + int _sfxPlayingSound; + + Common::String _soundFileLoaded; + + uint8 _sfxPriority; + uint8 _sfxFourthByteOfSong; + + int _numSoundTriggers; + const int *_soundTriggers; + + static const int _kyra1NumSoundTriggers; + static const int _kyra1SoundTriggers[]; +}; + +} // end of namespace Kyra + +#endif + diff --git a/engines/kyra/sound_intern.h b/engines/kyra/sound_intern.h index 8792c14815..975672b76a 100644 --- a/engines/kyra/sound_intern.h +++ b/engines/kyra/sound_intern.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -27,6 +27,7 @@ #define KYRA_SOUND_INTERN_H #include "kyra/sound.h" +#include "kyra/sound_adlib.h" #include "common/mutex.h" @@ -39,66 +40,6 @@ class PCSpeaker; } // end of namespace Audio namespace Kyra { -class AdlibDriver; - -/** - * AdLib implementation of the sound output device. - * - * It uses a special sound file format special to - * Dune II, Kyrandia 1 and 2. While Dune II and - * Kyrandia 1 are using exact the same format, the - * one of Kyrandia 2 slightly differs. - * - * See AdlibDriver for more information. - * @see AdlibDriver - */ -class SoundAdlibPC : public Sound { -public: - SoundAdlibPC(KyraEngine_v1 *vm, Audio::Mixer *mixer); - ~SoundAdlibPC(); - - kType getMusicType() const { return kAdlib; } - - bool init(); - void process(); - - void loadSoundFile(uint file); - void loadSoundFile(Common::String file); - - void playTrack(uint8 track); - void haltTrack(); - bool isPlaying(); - - void playSoundEffect(uint8 track); - - void beginFadeOut(); -private: - void internalLoadFile(Common::String file); - - void play(uint8 track); - - void unk1(); - void unk2(); - - AdlibDriver *_driver; - - bool _v2; - uint8 _trackEntries[500]; - uint8 *_soundDataPtr; - int _sfxPlayingSound; - - Common::String _soundFileLoaded; - - uint8 _sfxPriority; - uint8 _sfxFourthByteOfSong; - - int _numSoundTriggers; - const int *_soundTriggers; - - static const int _kyra1NumSoundTriggers; - static const int _kyra1SoundTriggers[]; -}; - class MidiOutput; /** -- cgit v1.2.3 From 53756ef1d022a959b24c041e18f55eef34e60dd3 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 17 Jul 2009 14:05:22 +0000 Subject: Cleanup. svn-id: r42565 --- engines/kyra/kyra_v1.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index 80872877d5..258d0c402f 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -115,7 +115,6 @@ Common::Error KyraEngine_v1::init() { _sound = new SoundTownsPC98_v2(this, _mixer); } else if (midiDriver == MD_ADLIB) { _sound = new SoundAdlibPC(this, _mixer); - assert(_sound); } else { Sound::kType type; @@ -126,7 +125,6 @@ Common::Error KyraEngine_v1::init() { else type = Sound::kMidiGM; - MidiDriver *driver = 0; if (midiDriver == MD_PCSPK) { @@ -151,9 +149,10 @@ Common::Error KyraEngine_v1::init() { assert(adlib); _sound = new MixedSoundDriver(this, _mixer, soundMidiPc, adlib); - assert(_sound); } } + + assert(_sound); } if (_sound) -- cgit v1.2.3