diff options
author | Max Horn | 2005-04-28 22:34:56 +0000 |
---|---|---|
committer | Max Horn | 2005-04-28 22:34:56 +0000 |
commit | d03b09265902a5a8c915fb515e1fef259c9fb618 (patch) | |
tree | af96136d0693c4a7ebcc90294555c3b52d9bcc7a | |
parent | c5127d3c05ec1dccb8ead61d38727e3e98dce6d1 (diff) | |
download | scummvm-rg350-d03b09265902a5a8c915fb515e1fef259c9fb618.tar.gz scummvm-rg350-d03b09265902a5a8c915fb515e1fef259c9fb618.tar.bz2 scummvm-rg350-d03b09265902a5a8c915fb515e1fef259c9fb618.zip |
Moved blast text/object code to ScummEngine_v6
svn-id: r17856
-rw-r--r-- | scumm/gfx.cpp | 23 | ||||
-rw-r--r-- | scumm/gfx.h | 9 | ||||
-rw-r--r-- | scumm/intern.h | 44 | ||||
-rw-r--r-- | scumm/object.cpp | 37 | ||||
-rw-r--r-- | scumm/room.cpp | 10 | ||||
-rw-r--r-- | scumm/scumm.cpp | 38 | ||||
-rw-r--r-- | scumm/scumm.h | 31 | ||||
-rw-r--r-- | scumm/string.cpp | 6 |
8 files changed, 114 insertions, 84 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index 7be3e3bbd1..46e94b626d 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -444,6 +444,29 @@ void ScummEngine::drawDirtyScreenParts() { } } +void ScummEngine_v6::drawDirtyScreenParts() { + // For the Full Throttle credits to work properly, the blast + // texts have to be drawn before the blast objects. Unless + // someone can think of a better way to achieve this effect. + + if (_version >= 7 && VAR(VAR_BLAST_ABOVE_TEXT) == 1) { + drawBlastTexts(); + drawBlastObjects(); + } else { + drawBlastObjects(); + drawBlastTexts(); + } + if (_version == 8) + processUpperActors(); + + // Call the original method. + ScummEngine::drawDirtyScreenParts(); + + // Remove all blasted objects/text again. + removeBlastTexts(); + removeBlastObjects(); +} + /** * Blit the dirty data from the given VirtScreen to the display. If the camera moved, * a full blit is done, otherwise only the visible dirty areas are updated. diff --git a/scumm/gfx.h b/scumm/gfx.h index fc90953697..627791f02f 100644 --- a/scumm/gfx.h +++ b/scumm/gfx.h @@ -173,15 +173,6 @@ struct ColorCycle { byte end; }; -/** BlastObjects to draw */ -struct BlastObject { - uint16 number; - Common::Rect rect; - uint16 scaleX, scaleY; - uint16 image; - uint16 mode; -}; - /** Bomp graphics data, used as parameter to ScummEngine::drawBomp. */ struct BompDrawData { Graphics::Surface dst; diff --git a/scumm/intern.h b/scumm/intern.h index 72e722aa31..c55661793f 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -414,6 +414,31 @@ protected: int _smushFrameRate; + /** BlastObjects to draw */ + struct BlastObject { + uint16 number; + Common::Rect rect; + uint16 scaleX, scaleY; + uint16 image; + uint16 mode; + }; + + int _blastObjectQueuePos; + BlastObject _blastObjectQueue[128]; + + struct BlastText { + int16 xpos, ypos; + Common::Rect rect; + byte color; + byte charset; + bool center; + byte text[256]; + }; + + int _blastTextQueuePos; + BlastText _blastTextQueue[50]; + + public: ScummEngine_v6(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]); @@ -432,6 +457,7 @@ protected: virtual void readMAXS(int blockSize); virtual void palManipulateInit(int resID, int start, int end, int time); + virtual void drawDirtyScreenParts(); int getStackList(int *args, uint maxnum); int popRoomAndObj(int *room); @@ -452,6 +478,20 @@ protected: void useBompCursor(const byte *im, int w, int h); void grabCursor(int x, int y, int w, int h); + void enqueueText(const byte *text, int x, int y, byte color, byte charset, bool center); + void drawBlastTexts(); + void removeBlastTexts(); + + void enqueueObject(int objectNumber, int objectX, int objectY, int objectWidth, + int objectHeight, int scaleX, int scaleY, int image, int mode); + void drawBlastObjects(); + void drawBlastObject(BlastObject *eo); + void removeBlastObjects(); + void removeBlastObject(BlastObject *eo); + + virtual void clearDrawQueues(); + + /* Version 6 script opcodes */ void o6_setBlastObjectWindow(); void o6_pushByte(); @@ -730,6 +770,8 @@ protected: virtual void setCursorFromImg(uint img, uint room, uint imgindex); + virtual void clearDrawQueues(); + /* HE version 70 script opcodes */ void o70_startSound(); void o70_pickupObject(); @@ -929,6 +971,8 @@ protected: virtual void initScummVars(); + virtual void clearDrawQueues(); + void loadImgSpot(int resId, int state, int16 &x, int16 &y); void loadWizCursor(int resId); void unknownE0(int x1, int y1, int x, int unk1, int unk2, int type, int id); diff --git a/scumm/object.cpp b/scumm/object.cpp index a3ba541004..d04d161d46 100644 --- a/scumm/object.cpp +++ b/scumm/object.cpp @@ -855,6 +855,30 @@ void ScummEngine::clearDrawObjectQueue() { _drawObjectQueNr = 0; } +void ScummEngine::clearDrawQueues() { + clearDrawObjectQueue(); +} + +void ScummEngine_v6::clearDrawQueues() { + ScummEngine::clearDrawQueues(); + + _blastObjectQueuePos = 0; +} + +void ScummEngine_v70he::clearDrawQueues() { + ScummEngine_v6::clearDrawQueues(); + + if (_heversion >= 71) + _wiz.polygonClear(); +} + +void ScummEngine_v80he::clearDrawQueues() { + ScummEngine_v70he::clearDrawQueues(); + + _wiz.imageNumClear(); +} + + void ScummEngine::clearOwnerOf(int obj) { int i, j; uint16 *a; @@ -1444,7 +1468,7 @@ void ScummEngine::nukeFlObjects(int min, int max) { } } -void ScummEngine::enqueueObject(int objectNumber, int objectX, int objectY, int objectWidth, +void ScummEngine_v6::enqueueObject(int objectNumber, int objectX, int objectY, int objectWidth, int objectHeight, int scaleX, int scaleY, int image, int mode) { BlastObject *eo; @@ -1478,7 +1502,7 @@ void ScummEngine::enqueueObject(int objectNumber, int objectX, int objectY, int eo->mode = mode; } -void ScummEngine::drawBlastObjects() { +void ScummEngine_v6::drawBlastObjects() { BlastObject *eo; int i; @@ -1488,7 +1512,7 @@ void ScummEngine::drawBlastObjects() { } } -void ScummEngine::drawBlastObject(BlastObject *eo) { +void ScummEngine_v6::drawBlastObject(BlastObject *eo) { VirtScreen *vs; const byte *bomp, *ptr; int objnum; @@ -1552,7 +1576,7 @@ void ScummEngine::drawBlastObject(BlastObject *eo) { markRectAsDirty(vs->number, bdd.x, bdd.x + bdd.srcwidth, bdd.y, bdd.y + bdd.srcheight); } -void ScummEngine::removeBlastObjects() { +void ScummEngine_v6::removeBlastObjects() { BlastObject *eo; int i; @@ -1560,11 +1584,10 @@ void ScummEngine::removeBlastObjects() { for (i = 0; i < _blastObjectQueuePos; i++, eo++) { removeBlastObject(eo); } - - clearEnqueue(); + _blastObjectQueuePos = 0; } -void ScummEngine::removeBlastObject(BlastObject *eo) { +void ScummEngine_v6::removeBlastObject(BlastObject *eo) { VirtScreen *vs = &virtscr[0]; Common::Rect r; diff --git a/scumm/room.cpp b/scumm/room.cpp index c432289784..721d0e750c 100644 --- a/scumm/room.cpp +++ b/scumm/room.cpp @@ -74,15 +74,11 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { runExitScript(); killScriptsAndResources(); - clearEnqueue(); if (_version >= 4 && _heversion <= 61) stopCycle(0); _sound->processSoundQues(); - - if (_heversion >= 71) - ((ScummEngine_v70he *)this)->_wiz.polygonClear(); - if (_heversion >= 80) - ((ScummEngine_v72he *)this)->_wiz.imageNumClear(); + + clearDrawQueues(); // For HE80+ games for (i = 0; i < _numRoomVariables; i++) @@ -108,8 +104,6 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { setDirtyColors(0, 255); } - clearDrawObjectQueue(); - VAR(VAR_ROOM) = room; _fullRedraw = true; diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 7de23d0d3e..c43584d88f 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -863,10 +863,6 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS _screenStartStrip = 0; _screenEndStrip = 0; _screenTop = 0; - _blastObjectQueuePos = 0; - memset(_blastObjectQueue, 0, sizeof(_blastObjectQueue)); - _blastTextQueuePos = 0; - memset(_blastTextQueue, 0, sizeof(_blastTextQueue)); _drawObjectQueNr = 0; memset(_drawObjectQue, 0, sizeof(_drawObjectQue)); _palManipStart = 0; @@ -1236,6 +1232,13 @@ ScummEngine_v2::ScummEngine_v2(GameDetector *detector, OSystem *syst, const Scum ScummEngine_v6::ScummEngine_v6(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]) : ScummEngine(detector, syst, gs, md5sum) { + _blastObjectQueuePos = 0; + memset(_blastObjectQueue, 0, sizeof(_blastObjectQueue)); + _blastTextQueuePos = 0; + memset(_blastTextQueue, 0, sizeof(_blastTextQueue)); + + _smushFrameRate = 0; + VAR_VIDEONAME = 0xFF; VAR_RANDOM_NR = 0xFF; VAR_STRING2DRAW = 0xFF; @@ -1246,8 +1249,6 @@ ScummEngine_v6::ScummEngine_v6(GameDetector *detector, OSystem *syst, const Scum VAR_TIMEDATE_HOUR = 0xFF; VAR_TIMEDATE_MINUTE = 0xFF; VAR_TIMEDATE_SECOND = 0xFF; - - _smushFrameRate = 0; } ScummEngine_v70he::ScummEngine_v70he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]) @@ -2137,32 +2138,11 @@ load_game: clearClickedStatus(); } + // Handle mouse over effects (for verbs). handleMouseOver(oldEgo != VAR(VAR_EGO)); - // - // TODO: The whole blast object/text code is V6-8 specific. So it - // would be nice to move it to ScummEngine_v6. One way to make that - // possible would be to replace their invocation with two new virtual - // methods preDrawScreenHook() and postDrawScreenHook(). - // - - // For the Full Throttle credits to work properly, the blast - // texts have to be drawn before the blast objects. Unless - // someone can think of a better way to achieve this effect. - - if (_version >= 7 && VAR(VAR_BLAST_ABOVE_TEXT) == 1) { - drawBlastTexts(); - drawBlastObjects(); - } else { - drawBlastObjects(); - drawBlastTexts(); - } - - if (_version == 8) - processUpperActors(); + // Render everything to the screen. drawDirtyScreenParts(); - removeBlastTexts(); - removeBlastObjects(); if (_version <= 5) playActorSounds(); diff --git a/scumm/scumm.h b/scumm/scumm.h index 9929badfbb..b9123b59d5 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -165,15 +165,6 @@ struct MemBlkHeader { struct VerbSlot; struct ObjectData; -struct BlastText { - int16 xpos, ypos; - Common::Rect rect; - byte color; - byte charset; - bool center; - byte text[256]; -}; - struct V2MouseoverBox { Common::Rect rect; byte color; @@ -780,6 +771,8 @@ protected: void clearDrawObjectQueue(); void processDrawQue(); + virtual void clearDrawQueues(); + uint32 getOBCDOffs(int object) const; byte *getOBCDFromObject(int obj); const byte *getOBIMFromObject(const ObjectData &od); @@ -990,7 +983,7 @@ protected: // Screen rendering byte *_compositeBuf; byte *_herculesBuf; - void drawDirtyScreenParts(); + virtual void drawDirtyScreenParts(); void updateDirtyScreen(VirtScreenNumber slot); void drawStripToScreen(VirtScreen *vs, int x, int w, int t, int b); void ditherCGA(byte *dst, int dstPitch, int x, int y, int width, int height) const; @@ -1022,24 +1015,6 @@ protected: uint _shakeFrame; void setShake(int mode); - int _blastObjectQueuePos; - BlastObject _blastObjectQueue[128]; - - int _blastTextQueuePos; - BlastText _blastTextQueue[50]; - - void enqueueText(const byte *text, int x, int y, byte color, byte charset, bool center); - void drawBlastTexts(); - void removeBlastTexts(); - - void enqueueObject(int objectNumber, int objectX, int objectY, int objectWidth, - int objectHeight, int scaleX, int scaleY, int image, int mode); - void clearEnqueue() { _blastObjectQueuePos = 0; } - void drawBlastObjects(); - void drawBlastObject(BlastObject *eo); - void removeBlastObjects(); - void removeBlastObject(BlastObject *eo); - int _drawObjectQueNr; byte _drawObjectQue[200]; diff --git a/scumm/string.cpp b/scumm/string.cpp index e4cc689169..74f56709dd 100644 --- a/scumm/string.cpp +++ b/scumm/string.cpp @@ -755,7 +755,7 @@ void ScummEngine::initCharset(int charsetno) { _charsetColorMap[i] = _charsetData[charsetno][i]; } -void ScummEngine::enqueueText(const byte *text, int x, int y, byte color, byte charset, bool center) { +void ScummEngine_v6::enqueueText(const byte *text, int x, int y, byte color, byte charset, bool center) { BlastText &bt = _blastTextQueue[_blastTextQueuePos++]; assert(_blastTextQueuePos <= ARRAYSIZE(_blastTextQueue)); @@ -767,7 +767,7 @@ void ScummEngine::enqueueText(const byte *text, int x, int y, byte color, byte c bt.center = center; } -void ScummEngine::drawBlastTexts() { +void ScummEngine_v6::drawBlastTexts() { byte *buf; int c; int i; @@ -811,7 +811,7 @@ void ScummEngine::drawBlastTexts() { _charset->_ignoreCharsetMask = false; } -void ScummEngine::removeBlastTexts() { +void ScummEngine_v6::removeBlastTexts() { int i; for (i = 0; i < _blastTextQueuePos; i++) { |