diff options
author | Vicent Marti | 2008-09-29 19:23:36 +0000 |
---|---|---|
committer | Vicent Marti | 2008-09-29 19:23:36 +0000 |
commit | 60ad4bd0d94321cdd78bcf79a507981f17d6ee43 (patch) | |
tree | 041ac12b1682b2d75beef7c90345a019b80a10f0 /engines/scumm | |
parent | c8f42a39737dbd50cbdc4cad7c6a6c89ca0efe69 (diff) | |
parent | 1776c75566603d4ecba657e4d4cd67a769ddb43d (diff) | |
download | scummvm-rg350-60ad4bd0d94321cdd78bcf79a507981f17d6ee43.tar.gz scummvm-rg350-60ad4bd0d94321cdd78bcf79a507981f17d6ee43.tar.bz2 scummvm-rg350-60ad4bd0d94321cdd78bcf79a507981f17d6ee43.zip |
- Merged 75 revisions from trunk.
- Fixed new conflicts.
- Changed Theme loading to use the new ZipArchive class.
- Implemented ZipArchive::getAllNames()
Original log message from SVNMerge.py
================================
Merged revisions 34605,34613-34615,34617,34619-34624,34627-34628,34630-34639,34642-34649,34656-34661,34663-34664,34671-34672,34674-34676,34678-34685 via svnmerge from
https://tanoku@scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk
........
r34605 | Tanoku | 2008-09-20 12:32:59 +0200 (Sat, 20 Sep 2008) | 1 line
Fixed "empty control statement" warning in FSDirectory::matchPattern().
........
r34613 | lordhoto | 2008-09-20 16:53:31 +0200 (Sat, 20 Sep 2008) | 2 lines
Updated theme file version, to reflect latest addition of new required entries/files.
........
r34614 | wjpalenstijn | 2008-09-20 17:03:37 +0200 (Sat, 20 Sep 2008) | 1 line
fix drawing order in saveload choosers (draw container before contents)
........
r34615 | fingolfin | 2008-09-20 17:53:17 +0200 (Sat, 20 Sep 2008) | 1 line
Little readability tweak
........
r34617 | fingolfin | 2008-09-20 18:10:29 +0200 (Sat, 20 Sep 2008) | 1 line
Fix for bug #2120602: 5ALL: Starting the launcher with -f triggers assertion
........
r34619 | eriktorbjorn | 2008-09-20 18:21:27 +0200 (Sat, 20 Sep 2008) | 4 lines
I think this is the correct fix for bug #2081347 ("MM: Charset out of
bounds!"). If I understand correctly, version <= 2 games only have one (hard-
coded) font, so when that's initialised we can set _curId to 0.
........
r34620 | marcus_c | 2008-09-20 18:38:50 +0200 (Sat, 20 Sep 2008) | 1 line
game.h is now in engines, not base.
........
r34621 | marcus_c | 2008-09-20 18:47:31 +0200 (Sat, 20 Sep 2008) | 5 lines
In the CD filesystem, nothing can be opened for writing, so just
short-circuit any call to openForWriting(). Also, directories and
non-existing files can't be opened for reading either, so just
return 0 for those.
........
r34622 | sev | 2008-09-21 12:23:22 +0200 (Sun, 21 Sep 2008) | 2 lines
Patch #2054467: CRUISE: 64bits fixes
........
r34623 | sev | 2008-09-21 13:17:22 +0200 (Sun, 21 Sep 2008) | 2 lines
Add recent patch contributors. Reflect current ScummVM team in the credits
........
r34624 | sev | 2008-09-21 13:18:16 +0200 (Sun, 21 Sep 2008) | 2 lines
Reflect current team
........
r34627 | lordhoto | 2008-09-22 19:33:30 +0200 (Mon, 22 Sep 2008) | 1 line
Fixed full screen toggling via alt+enter.
........
r34628 | fingolfin | 2008-09-22 22:55:27 +0200 (Mon, 22 Sep 2008) | 1 line
Fix comments for random() funcs (thanks to salty-horse for pointing this out)
........
r34630 | fingolfin | 2008-09-23 11:39:37 +0200 (Tue, 23 Sep 2008) | 1 line
Moved ZipArchive implementation into unzip.cpp, added new ZipArchive::isOpen method
........
r34631 | fingolfin | 2008-09-23 11:42:38 +0200 (Tue, 23 Sep 2008) | 1 line
ImageManager: renamed remArchive() to removeArchive(); switched to using a SearchSet + ZipArchive to access ZIP files (code is much simpler now yet more flexible, yay)
........
r34632 | fingolfin | 2008-09-23 11:50:03 +0200 (Tue, 23 Sep 2008) | 1 line
Moved ZipArchive to namespace Common; moved unzip internals from unzip.h to unzip.cpp (to be cleaned up)
........
r34633 | fingolfin | 2008-09-23 12:08:45 +0200 (Tue, 23 Sep 2008) | 1 line
cleanup
........
r34634 | fingolfin | 2008-09-23 12:10:29 +0200 (Tue, 23 Sep 2008) | 1 line
Perform error checking when reading from a ZIP file
........
r34635 | fingolfin | 2008-09-23 13:43:57 +0200 (Tue, 23 Sep 2008) | 1 line
Fix for bug #1917981: Game crash when finishing Indy3 demo. At the same time, added a new paranoia check
........
r34636 | Kirben | 2008-09-23 14:34:02 +0200 (Tue, 23 Sep 2008) | 1 line
Add another French Windows version of Putt-Putt Enters the Race.
........
r34637 | lordhoto | 2008-09-23 18:40:41 +0200 (Tue, 23 Sep 2008) | 2 lines
Fix for bug #2120780 "GUI: gui-theme command-line option ignored", '-f' and '-g' command line switch behavior.
........
r34638 | john_doe | 2008-09-24 01:16:47 +0200 (Wed, 24 Sep 2008) | 1 line
Improved updateScreenAndWait; the mouse cursor is less jerky now in some scenes in Manhole:N&E
........
r34639 | thebluegr | 2008-09-24 09:26:45 +0200 (Wed, 24 Sep 2008) | 1 line
Readded missing special case for the storm animation in ITE. Fixes bug #2125675 - "ITE: Game locks up in storm clouds scene"
........
r34642 | fingolfin | 2008-09-24 22:29:29 +0200 (Wed, 24 Sep 2008) | 1 line
Changed Common::String to use a MemoryPool for its refcounts
........
r34643 | fingolfin | 2008-09-24 22:31:14 +0200 (Wed, 24 Sep 2008) | 1 line
cleanup
........
r34644 | fingolfin | 2008-09-24 22:35:31 +0200 (Wed, 24 Sep 2008) | 1 line
Changed builtin Common::String capacity to 24 (on 32 bit systems), to make sizeof(String) 32; reduces overall memory req by 200k on my system; overall # of mallocs after this + the refcount memory pool change is almost unchanged
........
r34645 | sev | 2008-09-25 00:44:01 +0200 (Thu, 25 Sep 2008) | 2 lines
Fix bugs #1981081: "ITE: No blinking disk icon" and #1971729: "IHNM: No Animation of Disk Icon"
........
r34646 | fingolfin | 2008-09-25 10:06:18 +0200 (Thu, 25 Sep 2008) | 1 line
SCUMM: Added a new ActorHE class, as well as a virtual Actor::prepareDrawActorCostume() method
........
r34647 | fingolfin | 2008-09-25 10:19:51 +0200 (Thu, 25 Sep 2008) | 1 line
SCUMM: Moved Actor::drawActorToBackBuf to class ActorHE
........
r34648 | fingolfin | 2008-09-25 12:11:06 +0200 (Thu, 25 Sep 2008) | 1 line
SCUMM: Moved more stuf from class Actor to ActorHE
........
r34649 | fingolfin | 2008-09-25 12:14:50 +0200 (Thu, 25 Sep 2008) | 1 line
cleanup
........
r34656 | eriktorbjorn | 2008-09-27 19:25:40 +0200 (Sat, 27 Sep 2008) | 2 lines
Fixed typos.
........
r34657 | eriktorbjorn | 2008-09-27 19:47:22 +0200 (Sat, 27 Sep 2008) | 2 lines
Allow quitting or returning to the launcher while cutscenes are playing.
........
r34658 | eriktorbjorn | 2008-09-27 19:51:22 +0200 (Sat, 27 Sep 2008) | 2 lines
Slight simplification of last commit.
........
r34659 | fingolfin | 2008-09-27 20:32:01 +0200 (Sat, 27 Sep 2008) | 1 line
Modified Common::SearchSet to take signed integer priorities, for convenience (so that one can add archives with less-than-default priority)
........
r34660 | fingolfin | 2008-09-27 20:34:24 +0200 (Sat, 27 Sep 2008) | 1 line
Fixed a nasty bug in SearchManager::addDirectory; made the 'char' constructor of Common::String explicit, to avoid such bugs in the future
........
r34661 | drmccoy | 2008-09-27 22:04:04 +0200 (Sat, 27 Sep 2008) | 2 lines
Added a spanish floppy version of Lost in Time, as supplied by goodoldgeorg in bug report #2105220
........
r34663 | fingolfin | 2008-09-28 01:00:46 +0200 (Sun, 28 Sep 2008) | 1 line
Changed Common::File to use SearchMan
........
r34664 | fingolfin | 2008-09-28 01:27:01 +0200 (Sun, 28 Sep 2008) | 1 line
SCUMM: Use FilesystemNode::openForReading instead of Common::File::open(FilesystemNode) in the detector
........
r34671 | john_doe | 2008-09-28 22:02:01 +0200 (Sun, 28 Sep 2008) | 1 line
Return 32000 in sfGetCdTime instead of 0; this fixes the Manhole intro/credits (until the function is actually implemented)
........
r34672 | sev | 2008-09-28 23:07:41 +0200 (Sun, 28 Sep 2008) | 2 lines
Add Italian C64 Zak
........
r34674 | sev | 2008-09-28 23:53:14 +0200 (Sun, 28 Sep 2008) | 2 lines
Fix bug #2043489: DRASCULA: Cannot disable speech
........
r34675 | sev | 2008-09-29 00:07:16 +0200 (Mon, 29 Sep 2008) | 3 lines
- Renamed withVoices to _subtitlesDisabled as it reflect the true meaning.
- Allowed to disable subtitles from options dialogs including RTL.
........
r34676 | sev | 2008-09-29 00:19:11 +0200 (Mon, 29 Sep 2008) | 2 lines
Use better "silence" without clicks when speech is disabled.
........
r34678 | fingolfin | 2008-09-29 12:29:01 +0200 (Mon, 29 Sep 2008) | 1 line
Added FIXME to GP2x port
........
r34679 | fingolfin | 2008-09-29 12:30:31 +0200 (Mon, 29 Sep 2008) | 1 line
Add priority parameter to the SearchMan API
........
r34680 | fingolfin | 2008-09-29 12:32:06 +0200 (Mon, 29 Sep 2008) | 1 line
File::open no longer falls back to searching the current dir (if this causes any regressions, please report them; don't work around them, don't revert this change, without discussing it first)
........
r34681 | fingolfin | 2008-09-29 12:49:36 +0200 (Mon, 29 Sep 2008) | 1 line
Don't subclass ArjFile from Common::File (there seems to be no good reason for it). BTW, this code is an abomination and should be replaced by an Archive/SearchSet approach
........
r34682 | fingolfin | 2008-09-29 13:01:25 +0200 (Mon, 29 Sep 2008) | 1 line
Added const qualifiers
........
r34683 | fingolfin | 2008-09-29 13:02:11 +0200 (Mon, 29 Sep 2008) | 1 line
SCUMM HE: Fixed leak in Win32ResExtractor::extractResource_, use _filename instead of File::name
........
r34684 | fingolfin | 2008-09-29 13:03:10 +0200 (Mon, 29 Sep 2008) | 1 line
Added const qualifiers
........
r34685 | fingolfin | 2008-09-29 13:07:39 +0200 (Mon, 29 Sep 2008) | 1 line
Don't use File::name() needlessly (i.e. if you still know which file you just opened :)
........
svn-id: r34687
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/actor.cpp | 208 | ||||
-rw-r--r-- | engines/scumm/actor.h | 69 | ||||
-rw-r--r-- | engines/scumm/akos.cpp | 28 | ||||
-rw-r--r-- | engines/scumm/charset-fontdata.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/detection.cpp | 19 | ||||
-rw-r--r-- | engines/scumm/detection_tables.h | 1 | ||||
-rw-r--r-- | engines/scumm/dialogs.cpp | 8 | ||||
-rw-r--r-- | engines/scumm/file.cpp | 6 | ||||
-rw-r--r-- | engines/scumm/file.h | 18 | ||||
-rw-r--r-- | engines/scumm/file_nes.h | 6 | ||||
-rw-r--r-- | engines/scumm/gfx.cpp | 13 | ||||
-rw-r--r-- | engines/scumm/he/intern_he.h | 3 | ||||
-rw-r--r-- | engines/scumm/he/resource_he.cpp | 25 | ||||
-rw-r--r-- | engines/scumm/he/resource_he.h | 4 | ||||
-rw-r--r-- | engines/scumm/he/script_v100he.cpp | 6 | ||||
-rw-r--r-- | engines/scumm/he/script_v60he.cpp | 5 | ||||
-rw-r--r-- | engines/scumm/he/script_v70he.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/he/script_v71he.cpp | 12 | ||||
-rw-r--r-- | engines/scumm/he/script_v72he.cpp | 6 | ||||
-rw-r--r-- | engines/scumm/he/script_v80he.cpp | 6 | ||||
-rw-r--r-- | engines/scumm/he/script_v90he.cpp | 12 | ||||
-rw-r--r-- | engines/scumm/object.cpp | 7 | ||||
-rw-r--r-- | engines/scumm/scumm-md5.h | 8 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 2 |
25 files changed, 270 insertions, 207 deletions
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index df6660523a..b2bb8be9c9 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -50,9 +50,11 @@ Actor::Actor(ScummEngine *scumm, int id) : assert(_vm != 0); } -void Actor::initActor(int mode) { - // begin HE specific +void ActorHE::initActor(int mode) { + Actor::initActor(mode); + if (mode == -1) { + _heOffsX = _heOffsY = 0; _heSkipLimbs = false; memset(_heTalkQueue, 0, sizeof(_heTalkQueue)); } @@ -70,11 +72,18 @@ void Actor::initActor(int mode) { _hePaletteNum = 0; _heFlags = 0; _heTalking = false; - // end HE specific + if (_vm->_game.heversion >= 61) + _flip = 0; + + _clipOverride = _vm->_actorClipOverride; + + _auxBlock.reset(); +} + +void Actor::initActor(int mode) { if (mode == -1) { - _offsX = _offsY = 0; _top = _bottom = 0; _needRedraw = false; _needBgReset = false; @@ -132,9 +141,6 @@ void Actor::initActor(int mode) { _forceClip = (_vm->_game.version >= 7) ? 100 : 0; _ignoreTurns = false; - if (_vm->_game.heversion >= 61) - _flip = 0; - _talkFrequency = 256; _talkPan = 64; _talkVolume = 127; @@ -148,10 +154,6 @@ void Actor::initActor(int mode) { _walkScript = 0; _talkScript = 0; - _clipOverride = _vm->_actorClipOverride; - - _auxBlock.reset(); - _vm->_classData[_number] = (_vm->_game.version >= 7) ? _vm->_classData[0] : 0; } @@ -879,9 +881,9 @@ void Actor::putActor(int dstX, int dstY, int newRoom) { _vm->stopTalk(); } - // WORKAROUND: The green transparency of the tank in the Hall of Oddities is - // is positioned one pixel too far to the left. This appears to be a - // bug in the original game as well. + // WORKAROUND: The green transparency of the tank in the Hall of Oddities + // is positioned one pixel too far to the left. This appears to be a bug + // in the original game as well. if (_vm->_game.id == GID_SAMNMAX && newRoom == 16 && _number == 5 && dstX == 235 && dstY == 236) dstX++; @@ -904,7 +906,7 @@ void Actor::putActor(int dstX, int dstY, int newRoom) { } else { #ifdef ENABLE_HE if (_vm->_game.heversion >= 71) - ((ScummEngine_v71he *)_vm)->queueAuxBlock(this); + ((ScummEngine_v71he *)_vm)->queueAuxBlock((ActorHE *)this); #endif hideActor(); } @@ -1208,6 +1210,10 @@ void Actor::hideActor() { _cost.soundCounter = 0; _needRedraw = false; _needBgReset = true; +} + +void ActorHE::hideActor() { + Actor::hideActor(); _auxBlock.reset(); } @@ -1434,39 +1440,28 @@ void Actor::drawActorCostume(bool hitTestMode) { } setupActorScale(); + + BaseCostumeRenderer *bcr = _vm->_costumeRenderer; + prepareDrawActorCostume(bcr); - BaseCostumeRenderer* bcr = _vm->_costumeRenderer; - - bcr->_actorID = _number; - - bcr->_actorX = _pos.x + _offsX; - bcr->_actorY = _pos.y + _offsY - _elevation; - - if (_vm->_game.version <= 2) { - bcr->_actorX *= V12_X_MULTIPLIER; - bcr->_actorY *= V12_Y_MULTIPLIER; + // If the actor is partially hidden, redraw it next frame. + if (bcr->drawCostume(_vm->_virtscr[kMainVirtScreen], _vm->_gdi->_numStrips, this, _drawToBackBuf) & 1) { + _needRedraw = (_vm->_game.version <= 6); } - bcr->_actorX -= _vm->_virtscr[kMainVirtScreen].xstart; - if (_vm->_game.platform == Common::kPlatformNES) { - // In the NES version, when the actor is facing right, - // we need to shift it 8 pixels to the left - if (_facing == 90) - bcr->_actorX -= 8; - } else if (_vm->_game.version <= 2) { - // HACK: We have to adjust the x position by one strip (8 pixels) in - // V2 games. However, it is not quite clear to me why. And to fully - // match the original, it seems we have to offset by 2 strips if the - // actor is facing left (270 degree). - // V1 games are once again slightly different, here we only have - // to adjust the 270 degree case... - if (_facing == 270) - bcr->_actorX += 16; - else if (_vm->_game.version == 2) - bcr->_actorX += 8; + if (!hitTestMode) { + // Record the vertical extent of the drawn actor + _top = bcr->_draw_top; + _bottom = bcr->_draw_bottom; } +} - bcr->_clipOverride = _clipOverride; + +void Actor::prepareDrawActorCostume(BaseCostumeRenderer *bcr) { + + bcr->_actorID = _number; + bcr->_actorX = _pos.x - _vm->_virtscr[kMainVirtScreen].xstart; + bcr->_actorY = _pos.y - _elevation; if (_vm->_game.version == 4 && (_boxscale & 0x8000)) { bcr->_scaleX = bcr->_scaleY = _vm->getScaleFromSlot((_boxscale & 0x7fff) + 1, _pos.x, _pos.y); @@ -1478,8 +1473,6 @@ void Actor::drawActorCostume(bool hitTestMode) { bcr->_shadow_mode = _shadowMode; if (_vm->_game.version >= 5 && _vm->_game.heversion == 0) { bcr->_shadow_table = _vm->_shadowPalette; - } else if (_vm->_game.heversion == 70) { - bcr->_shadow_table = _vm->_HEV7ActorPalette; } bcr->setCostume(_costume, _heXmapNum); @@ -1510,6 +1503,19 @@ void Actor::drawActorCostume(bool hitTestMode) { bcr->_draw_top = 0x7fffffff; bcr->_draw_bottom = 0; +} + +void ActorHE::prepareDrawActorCostume(BaseCostumeRenderer *bcr) { + Actor::prepareDrawActorCostume(bcr); + + bcr->_actorX += _heOffsX; + bcr->_actorY += _heOffsY; + + bcr->_clipOverride = _clipOverride; + + if (_vm->_game.heversion == 70) { + bcr->_shadow_table = _vm->_HEV7ActorPalette; + } bcr->_skipLimbs = (_heSkipLimbs != 0); bcr->_paletteNum = _hePaletteNum; @@ -1530,16 +1536,36 @@ void Actor::drawActorCostume(bool hitTestMode) { } } _heNoTalkAnimation = 0; +} - // If the actor is partially hidden, redraw it next frame. - if (bcr->drawCostume(_vm->_virtscr[kMainVirtScreen], _vm->_gdi->_numStrips, this, _drawToBackBuf) & 1) { - _needRedraw = (_vm->_game.version <= 6); +void Actor_v2::prepareDrawActorCostume(BaseCostumeRenderer *bcr) { + Actor::prepareDrawActorCostume(bcr); + + bcr->_actorX = _pos.x; + bcr->_actorY = _pos.y - _elevation; + + if (_vm->_game.version <= 2) { + bcr->_actorX *= V12_X_MULTIPLIER; + bcr->_actorY *= V12_Y_MULTIPLIER; } + bcr->_actorX -= _vm->_virtscr[kMainVirtScreen].xstart; - if (!hitTestMode) { - // Record the vertical extent of the drawn actor - _top = bcr->_draw_top; - _bottom = bcr->_draw_bottom; + if (_vm->_game.platform == Common::kPlatformNES) { + // In the NES version, when the actor is facing right, + // we need to shift it 8 pixels to the left + if (_facing == 90) + bcr->_actorX -= 8; + } else if (_vm->_game.version <= 2) { + // HACK: We have to adjust the x position by one strip (8 pixels) in + // V2 games. However, it is not quite clear to me why. And to fully + // match the original, it seems we have to offset by 2 strips if the + // actor is facing left (270 degree). + // V1 games are once again slightly different, here we only have + // to adjust the 270 degree case... + if (_facing == 270) + bcr->_actorX += 16; + else if (_vm->_game.version == 2) + bcr->_actorX += 8; } } @@ -1611,13 +1637,15 @@ void Actor::startAnimActor(int f) { if (isInCurrentRoom() && _costume != 0) { _animProgress = 0; - _cost.animCounter = 0; _needRedraw = true; + _cost.animCounter = 0; // V1 - V2 games don't seem to need a _cost.reset() at this point. // Causes Zak to lose his body in several scenes, see bug #771508 if (_vm->_game.version >= 3 && f == _initFrame) { _cost.reset(); - _auxBlock.reset(); + if (_vm->_game.heversion != 0) { + ((ActorHE *)this)->_auxBlock.reset(); + } } _vm->_costumeLoader->costumeDecodeData(this, f, (uint) - 1); _frame = f; @@ -1758,7 +1786,7 @@ void ScummEngine::resetActorBgs() { clearGfxUsageBit(strip, USAGE_BIT_DIRTY); clearGfxUsageBit(strip, USAGE_BIT_RESTORED); for (j = 1; j < _numActors; j++) { - if (_actors[j]->_heFlags & 1) + if (_game.heversion != 0 && ((ActorHE *)_actors[j])->_heFlags & 1) continue; if (testGfxUsageBit(strip, j) && @@ -1776,7 +1804,7 @@ void ScummEngine::resetActorBgs() { } // HE specific -void Actor::drawActorToBackBuf(int x, int y) { +void ActorHE::drawActorToBackBuf(int x, int y) { int curTop = _top; int curBottom = _bottom; @@ -1936,7 +1964,8 @@ void ScummEngine::actorTalk(const byte *msg) { stopTalk(); } setTalkingActor(a->_number); - a->_heTalking = true; + if (_game.heversion != 0) + ((ActorHE *)a)->_heTalking = true; if (!_string[0].no_talk_anim) { a->runActorTalkScript(a->_talkStartFrame); _useTalkAnims = true; @@ -2009,7 +2038,8 @@ void ScummEngine::stopTalk() { } if (_game.version <= 7 && _game.heversion == 0) setTalkingActor(0xFF); - a->_heTalking = false; + if (_game.heversion != 0) + ((ActorHE *)a)->_heTalking = false; } if (_game.id == GID_DIG || _game.id == GID_CMI) { @@ -2035,9 +2065,7 @@ void ScummEngine::stopTalk() { #pragma mark - -void Actor::setActorCostume(int c) { - int i; - +void ActorHE::setActorCostume(int c) { if (_vm->_game.heversion >= 61 && (c == -1 || c == -2)) { _heSkipLimbs = (c == -1); _needRedraw = true; @@ -2049,27 +2077,43 @@ void Actor::setActorCostume(int c) { if (_vm->_game.heversion == 61) c &= 0xff; - _costumeNeedsInit = true; - if (_vm->_game.features & GF_NEW_COSTUMES) { - memset(_animVariable, 0, sizeof(_animVariable)); - #ifdef ENABLE_HE if (_vm->_game.heversion >= 71) ((ScummEngine_v71he *)_vm)->queueAuxBlock(this); #endif + _auxBlock.reset(); + if (_visible) { + if (_vm->_game.heversion >= 60) + _needRedraw = true; + } + } + + Actor::setActorCostume(c); + + if (_vm->_game.heversion >= 71 && _vm->getTalkingActor() == _number) { + if (_vm->_game.heversion <= 95 || (_vm->_game.heversion >= 98 && _vm->VAR(_vm->VAR_SKIP_RESET_TALK_ACTOR) == 0)) { + _vm->setTalkingActor(0); + } + } +} + +void Actor::setActorCostume(int c) { + int i; + + _costumeNeedsInit = true; + + if (_vm->_game.features & GF_NEW_COSTUMES) { + memset(_animVariable, 0, sizeof(_animVariable)); _costume = c; _cost.reset(); - _auxBlock.reset(); if (_visible) { if (_costume) { _vm->ensureResourceLoaded(rtCostume, _costume); } startAnimActor(_initFrame); - if (_vm->_game.heversion >= 60) - _needRedraw = true; } } else { if (_visible) { @@ -2104,12 +2148,6 @@ void Actor::setActorCostume(int c) { for (i = 0; i < 32; i++) _palette[i] = 0xFF; } - - if (_vm->_game.heversion >= 71 && _vm->getTalkingActor() == _number) { - if (_vm->_game.heversion <= 95 || (_vm->_game.heversion >= 98 && _vm->VAR(_vm->VAR_SKIP_RESET_TALK_ACTOR) == 0)) { - _vm->setTalkingActor(0); - } - } } static const char* v0ActorNames[7] = { @@ -2245,7 +2283,7 @@ bool Actor_v2::isPlayer() { return _vm->VAR(42) <= _number && _number <= _vm->VAR(43); } -void Actor::setHEFlag(int bit, int set) { +void ActorHE::setHEFlag(int bit, int set) { // Note that condition is inverted if (!set) { _heFlags |= bit; @@ -2254,7 +2292,7 @@ void Actor::setHEFlag(int bit, int set) { } } -void Actor::setUserCondition(int slot, int set) { +void ActorHE::setUserCondition(int slot, int set) { const int condMaskCode = (_vm->_game.heversion >= 85) ? 0x1FFF : 0x3FF; assertRange(1, slot, 32, "setUserCondition: Condition"); if (set == 0) { @@ -2269,12 +2307,12 @@ void Actor::setUserCondition(int slot, int set) { } } -bool Actor::isUserConditionSet(int slot) const { +bool ActorHE::isUserConditionSet(int slot) const { assertRange(1, slot, 32, "isUserConditionSet: Condition"); return (_heCondMask & (1 << (slot + 0xF))) != 0; } -void Actor::setTalkCondition(int slot) { +void ActorHE::setTalkCondition(int slot) { const int condMaskCode = (_vm->_game.heversion >= 85) ? 0x1FFF : 0x3FF; assertRange(1, slot, 32, "setTalkCondition: Condition"); _heCondMask = (_heCondMask & ~condMaskCode) | 1; @@ -2288,7 +2326,7 @@ void Actor::setTalkCondition(int slot) { } } -bool Actor::isTalkConditionSet(int slot) const { +bool ActorHE::isTalkConditionSet(int slot) const { assertRange(1, slot, 32, "isTalkConditionSet: Condition"); return (_heCondMask & (1 << (slot - 1))) != 0; } @@ -2311,10 +2349,10 @@ void ScummEngine_v71he::postProcessAuxQueue() { for (int i = 0; i < _auxEntriesNum; ++i) { AuxEntry *ae = &_auxEntries[i]; if (ae->actorNum != -1) { - Actor *a = derefActor(ae->actorNum, "postProcessAuxQueue"); + ActorHE *a = (ActorHE *)derefActor(ae->actorNum, "postProcessAuxQueue"); const uint8 *cost = getResourceAddress(rtCostume, a->_costume); - int dy = a->_offsY + a->getPos().y; - int dx = a->_offsX + a->getPos().x; + int dy = a->_heOffsY + a->getPos().y; + int dx = a->_heOffsX + a->getPos().x; if (_game.heversion >= 72) dy -= a->getElevation(); @@ -2378,7 +2416,7 @@ void ScummEngine_v71he::postProcessAuxQueue() { _auxEntriesNum = 0; } -void ScummEngine_v71he::queueAuxBlock(Actor *a) { +void ScummEngine_v71he::queueAuxBlock(ActorHE *a) { if (!a->_auxBlock.visible) return; @@ -2401,8 +2439,8 @@ void Actor::saveLoadWithSerializer(Serializer *ser) { static const SaveLoadEntry actorEntries[] = { MKLINE(Actor, _pos.x, sleInt16, VER(8)), MKLINE(Actor, _pos.y, sleInt16, VER(8)), - MKLINE(Actor, _offsX, sleInt16, VER(32)), - MKLINE(Actor, _offsY, sleInt16, VER(32)), + MKLINE(Actor, _heOffsX, sleInt16, VER(32)), + MKLINE(Actor, _heOffsY, sleInt16, VER(32)), MKLINE(Actor, _top, sleInt16, VER(8)), MKLINE(Actor, _bottom, sleInt16, VER(8)), MKLINE(Actor, _elevation, sleInt16, VER(8)), diff --git a/engines/scumm/actor.h b/engines/scumm/actor.h index 30dc7789d6..3e8fe6626b 100644 --- a/engines/scumm/actor.h +++ b/engines/scumm/actor.h @@ -61,6 +61,7 @@ struct CostumeData { uint16 end[16]; uint16 frame[16]; + /* HE specific */ uint16 heJumpOffsetTable[16]; uint16 heJumpCountTable[16]; uint32 heCondMaskTable[16]; @@ -95,10 +96,6 @@ protected: Common::Point _pos; public: - /** HE specific: This rect is used to clip actor drawing. */ - Common::Rect _clipOverride; - - int _offsX, _offsY; int _top, _bottom; uint _width; byte _number; @@ -137,22 +134,11 @@ public: CostumeData _cost; /* HE specific */ - bool _heNoTalkAnimation; + int _heOffsX, _heOffsY; bool _heSkipLimbs; - bool _heTalking; uint32 _heCondMask; uint32 _hePaletteNum; uint32 _heXmapNum; - byte _heFlags; - - AuxBlock _auxBlock; - - struct { - int16 posX; - int16 posY; - int16 color; - byte sentence[128]; - } _heTalkQueue[16]; protected: struct ActorWalkData { @@ -187,7 +173,7 @@ public: virtual ~Actor() {} //protected: - void hideActor(); + virtual void hideActor(); void showActor(); virtual void initActor(int mode); @@ -223,10 +209,10 @@ public: void faceToObject(int obj); void turnToDirection(int newdir); virtual void walkActor(); - void drawActorToBackBuf(int x, int y); void drawActorCostume(bool hitTestMode = false); + virtual void prepareDrawActorCostume(BaseCostumeRenderer *bcr); void animateCostume(); - void setActorCostume(int c); + virtual void setActorCostume(int c); void animateLimb(int limb, int f); @@ -317,6 +303,27 @@ public: void classChanged(int cls, bool value); + // Used by the save/load system: + void saveLoadWithSerializer(Serializer *ser); + +protected: + bool isInClass(int cls); + + virtual bool isPlayer(); + + bool findPathTowards(byte box, byte box2, byte box3, Common::Point &foundPath); +}; + +class ActorHE : public Actor { +public: + ActorHE(ScummEngine *scumm, int id) : Actor(scumm, id) {} + + virtual void initActor(int mode); + + virtual void hideActor(); + + void drawActorToBackBuf(int x, int y); + void setHEFlag(int bit, int set); void setUserCondition(int slot, int set); @@ -325,15 +332,26 @@ public: void setTalkCondition(int slot); bool isTalkConditionSet(int slot) const; - // Used by the save/load system: - void saveLoadWithSerializer(Serializer *ser); +public: + /** This rect is used to clip actor drawing. */ + Common::Rect _clipOverride; -protected: - bool isInClass(int cls); + bool _heNoTalkAnimation; + bool _heTalking; + byte _heFlags; - virtual bool isPlayer(); + AuxBlock _auxBlock; - bool findPathTowards(byte box, byte box2, byte box3, Common::Point &foundPath); + struct { + int16 posX; + int16 posY; + int16 color; + byte sentence[128]; + } _heTalkQueue[16]; + + + virtual void prepareDrawActorCostume(BaseCostumeRenderer *bcr); + virtual void setActorCostume(int c); }; class Actor_v3 : public Actor { @@ -357,6 +375,7 @@ public: protected: virtual bool isPlayer(); + virtual void prepareDrawActorCostume(BaseCostumeRenderer *bcr); }; class ActorC64 : public Actor_v2 { diff --git a/engines/scumm/akos.cpp b/engines/scumm/akos.cpp index 8e8fff938d..19c7c3320b 100644 --- a/engines/scumm/akos.cpp +++ b/engines/scumm/akos.cpp @@ -1664,28 +1664,28 @@ bool ScummEngine_v6::akos_increaseAnim(Actor *a, int chan, const byte *aksq, con akos_queCommand(9, a, a->_sound[a->getAnimVar(GB(2))], 0); continue; case AKC_C045: - a->setUserCondition(GB(3), a->getAnimVar(GB(4))); + ((ActorHE *)a)->setUserCondition(GB(3), a->getAnimVar(GB(4))); continue; case AKC_C046: - a->setAnimVar(GB(4), a->isUserConditionSet(GB(3))); + a->setAnimVar(GB(4), ((ActorHE *)a)->isUserConditionSet(GB(3))); continue; case AKC_C047: - a->setTalkCondition(GB(3)); + ((ActorHE *)a)->setTalkCondition(GB(3)); continue; case AKC_C048: - a->setAnimVar(GB(4), a->isTalkConditionSet(GB(3))); + a->setAnimVar(GB(4), ((ActorHE *)a)->isTalkConditionSet(GB(3))); continue; case AKC_C0A0: akos_queCommand(8, a, GB(2), 0); continue; case AKC_C0A1: - if (a->_heTalking != 0) { + if (((ActorHE *)a)->_heTalking != 0) { curpos = GUW(2); break; } continue; case AKC_C0A2: - if (a->_heTalking == 0) { + if (((ActorHE *)a)->_heTalking == 0) { curpos = GUW(2); break; } @@ -1763,8 +1763,8 @@ void ScummEngine_v6::akos_processQueue() { a->_forceClip = param_1; break; case 6: - a->_offsX = param_1; - a->_offsY = param_2; + a->_heOffsX = param_1; + a->_heOffsY = param_2; break; case 7: #ifdef ENABLE_HE @@ -1775,13 +1775,13 @@ void ScummEngine_v6::akos_processQueue() { case 8: _actorToPrintStrFor = a->_number; - a->_talkPosX = a->_heTalkQueue[param_1].posX; - a->_talkPosY = a->_heTalkQueue[param_1].posY; - a->_talkColor = a->_heTalkQueue[param_1].color; + a->_talkPosX = ((ActorHE *)a)->_heTalkQueue[param_1].posX; + a->_talkPosY = ((ActorHE *)a)->_heTalkQueue[param_1].posY; + a->_talkColor = ((ActorHE *)a)->_heTalkQueue[param_1].color; _string[0].loadDefault(); _string[0].color = a->_talkColor; - actorTalk(a->_heTalkQueue[param_1].sentence); + actorTalk(((ActorHE *)a)->_heTalkQueue[param_1].sentence); break; case 9: @@ -1825,8 +1825,8 @@ void ScummEngine_v7::akos_processQueue() { a->_forceClip = param_1; break; case 6: - a->_offsX = param_1; - a->_offsY = param_2; + a->_heOffsX = param_1; + a->_heOffsY = param_2; break; case 7: if (param_1 != 0) { diff --git a/engines/scumm/charset-fontdata.cpp b/engines/scumm/charset-fontdata.cpp index 6a45d53139..e9a496f6ed 100644 --- a/engines/scumm/charset-fontdata.cpp +++ b/engines/scumm/charset-fontdata.cpp @@ -1070,6 +1070,7 @@ CharsetRendererV2::CharsetRendererV2(ScummEngine *vm, Common::Language language) : CharsetRendererV3(vm) { _fontHeight = 8; + _curId = 0; switch (language) { case Common::DE_DEU: diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index d3397fe208..b14f51cb14 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -25,6 +25,7 @@ #include "base/plugins.h" +#include "common/archive.h" #include "common/config-manager.h" #include "common/fs.h" #include "common/list.h" @@ -211,9 +212,11 @@ static Common::Language detectLanguage(const Common::FSList &fslist, byte id) { // ever determine that this is insufficient, we can still // switch to MD5 based detection). const char *filename = (id == GID_CMI) ? "LANGUAGE.TAB" : "LANGUAGE.BND"; - Common::File tmp; + Common::FilePtr tmp; Common::FilesystemNode langFile; - if (!searchFSNode(fslist, filename, langFile) || !tmp.open(langFile)) { + if (searchFSNode(fslist, filename, langFile)) + tmp = Common::FilePtr(langFile.openForReading()); + if (!tmp) { // try loading in RESOURCE sub dir... Common::FilesystemNode resDir; Common::FSList tmpList; @@ -221,11 +224,11 @@ static Common::Language detectLanguage(const Common::FSList &fslist, byte id) { && resDir.isDirectory() && resDir.getChildren(tmpList, Common::FilesystemNode::kListFilesOnly) && searchFSNode(tmpList, filename, langFile)) { - tmp.open(langFile); + tmp = Common::FilePtr(langFile.openForReading()); } } - if (tmp.isOpen()) { - uint size = tmp.size(); + if (tmp) { + uint size = tmp->size(); if (id == GID_CMI) { switch (size) { case 439080: // 2daf3db71d23d99d19fc9a544fcf6431 @@ -450,8 +453,8 @@ static bool testGame(const GameSettings *g, const DescMap &fileMD5Map, const Com // To do this, we take a close look at the detection file and // try to filter out some cases. - Common::File tmp; - if (!tmp.open(d.node)) { + Common::FilePtr tmp(d.node.openForReading()); + if (!tmp) { warning("SCUMM testGame: failed to open '%s' for read access", d.node.getPath().c_str()); return false; } @@ -465,7 +468,7 @@ static bool testGame(const GameSettings *g, const DescMap &fileMD5Map, const Com // Read a few bytes to narrow down the game. byte buf[6]; - tmp.read(buf, 6); + tmp->read(buf, 6); if (buf[0] == 0xbc && buf[1] == 0xb9) { // The NES version of MM diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h index d281364a77..8d70afecf2 100644 --- a/engines/scumm/detection_tables.h +++ b/engines/scumm/detection_tables.h @@ -713,6 +713,7 @@ static const GameFilenamePattern gameFilenamesTable[] = { { "puttrace", "racedemo", kGenHEPC, UNK_LANG, UNK, 0 }, { "puttrace", "RaceDemo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 }, { "puttrace", "Rennen", kGenHEPC, Common::DE_DEU, UNK, 0 }, + { "puttrace", "PouceCourse", kGenHEPC, Common::FR_FRA, UNK, 0 }, { "puttrace", "Putt500", kGenHEPC, Common::NL_NLD, UNK, 0 }, { "puttrace", "Putt500", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 }, { "puttrace", "Putt500 demo", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 }, diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index ee1c0abf1c..382a0a9338 100644 --- a/engines/scumm/dialogs.cpp +++ b/engines/scumm/dialogs.cpp @@ -244,7 +244,10 @@ SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel, _list->setEditable(saveMode); _list->setNumberingMode(saveMode ? GUI::kListNumberingOne : GUI::kListNumberingZero); - _container = new GUI::ContainerWidget(this, 0, 0, 10, 10); +// Tanoku: SVNMerge removed this. Unconvinient. /////////////// +// _container = new GUI::ContainerWidget(this, 0, 0, 10, 10); +/////////////////////////////////////////////////////////////// + _gfxWidget = new GUI::GraphicsWidget(this, 0, 0, 10, 10); _date = new StaticTextWidget(this, 0, 0, 10, 10, "No date saved", kTextAlignCenter); @@ -255,6 +258,9 @@ SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel, new GUI::ButtonWidget(this, "ScummSaveLoad.Cancel", "Cancel", kCloseCmd, 0); _chooseButton = new GUI::ButtonWidget(this, "ScummSaveLoad.Choose", buttonLabel, kChooseCmd, 0); _chooseButton->setEnabled(false); + + _container = new GUI::ContainerWidget(this, 0, 0, 10, 10); +// _container->setHints(GUI::THEME_HINT_USE_SHADOW); } SaveLoadChooser::~SaveLoadChooser() { diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp index f258ddd420..38c7a1a180 100644 --- a/engines/scumm/file.cpp +++ b/engines/scumm/file.cpp @@ -125,15 +125,15 @@ bool ScummFile::openSubFile(const Common::String &filename) { } -bool ScummFile::eos() { +bool ScummFile::eos() const { return _subFileLen ? (pos() >= _subFileLen) : File::eos(); // FIXME } -int32 ScummFile::pos() { +int32 ScummFile::pos() const { return File::pos() - _subFileStart; } -int32 ScummFile::size() { +int32 ScummFile::size() const { return _subFileLen ? _subFileLen : File::size(); } diff --git a/engines/scumm/file.h b/engines/scumm/file.h index 336f3cde12..e0ba7badff 100644 --- a/engines/scumm/file.h +++ b/engines/scumm/file.h @@ -39,9 +39,9 @@ public: virtual bool open(const Common::String &filename) = 0; virtual bool openSubFile(const Common::String &filename) = 0; - virtual bool eos() = 0; - virtual int32 pos() = 0; - virtual int32 size() = 0; + virtual bool eos() const = 0; + virtual int32 pos() const = 0; + virtual int32 size() const = 0; virtual bool seek(int32 offs, int whence = SEEK_SET) = 0; virtual uint32 read(void *dataPtr, uint32 dataSize) = 0; }; @@ -66,9 +66,9 @@ public: bool ioFailed() const { return _myIoFailed || BaseScummFile::ioFailed(); } void clearIOFailed() { _myIoFailed = false; BaseScummFile::clearIOFailed(); } - bool eos(); - int32 pos(); - int32 size(); + bool eos() const; + int32 pos() const; + int32 size() const; bool seek(int32 offs, int whence = SEEK_SET); uint32 read(void *dataPtr, uint32 dataSize); }; @@ -111,9 +111,9 @@ public: bool openSubFile(const Common::String &filename); void close(); - bool eos() { return _stream->eos(); } - int32 pos() { return _stream->pos(); } - int32 size() { return _stream->size(); } + bool eos() const { return _stream->eos(); } + int32 pos() const { return _stream->pos(); } + int32 size() const { return _stream->size(); } bool seek(int32 offs, int whence = SEEK_SET) { return _stream->seek(offs, whence); } uint32 read(void *dataPtr, uint32 dataSize) { return _stream->read(dataPtr, dataSize); } }; diff --git a/engines/scumm/file_nes.h b/engines/scumm/file_nes.h index f1a07f8085..0a26ed9027 100644 --- a/engines/scumm/file_nes.h +++ b/engines/scumm/file_nes.h @@ -68,9 +68,9 @@ public: bool openSubFile(const Common::String &filename); void close(); - bool eos() { return _stream->eos(); } - int32 pos() { return _stream->pos(); } - int32 size() { return _stream->size(); } + bool eos() const { return _stream->eos(); } + int32 pos() const { return _stream->pos(); } + int32 size() const { return _stream->size(); } bool seek(int32 offs, int whence = SEEK_SET) { return _stream->seek(offs, whence); } uint32 read(void *dataPtr, uint32 dataSize) { return _stream->read(dataPtr, dataSize); } }; diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 45b078b6f9..4e8c22479d 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -22,7 +22,6 @@ * */ - #include "common/system.h" #include "scumm/scumm.h" #include "scumm/actor.h" @@ -577,15 +576,12 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i const byte *src = vs->getPixels(x, top); int m = _textSurfaceMultiplier; - byte *dst; int vsPitch; int pitch = vs->pitch; if (_useCJKMode && _textSurfaceMultiplier == 2) { - dst = _fmtownsBuf; - - scale2x(dst, _screenWidth * m, src, vs->pitch, width, height); - src = dst; + scale2x(_fmtownsBuf, _screenWidth * m, src, vs->pitch, width, height); + src = _fmtownsBuf; vsPitch = _screenWidth * m - width * m; @@ -593,7 +589,6 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i vsPitch = vs->pitch - width; } - dst = _compositeBuf; if (_game.version < 7) { // For The Dig, FT and COMI, we just blit everything to the screen at once. @@ -613,12 +608,12 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i // Compose the text over the game graphics #ifdef USE_ARM_GFX_ASM - asmDrawStripToScreen(height, width, text, src, dst, vs->pitch, width, _textSurface.pitch); + asmDrawStripToScreen(height, width, text, src, _compositeBuf, vs->pitch, width, _textSurface.pitch); #else // We blit four pixels at a time, for improved performance. const uint32 *src32 = (const uint32 *)src; const uint32 *text32 = (const uint32 *)text; - uint32 *dst32 = (uint32 *)dst; + uint32 *dst32 = (uint32 *)_compositeBuf; vsPitch >>= 2; const int textPitch = (_textSurface.pitch - width * m) >> 2; diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h index 72ba7edb85..8fd9122503 100644 --- a/engines/scumm/he/intern_he.h +++ b/engines/scumm/he/intern_he.h @@ -39,6 +39,7 @@ class WriteStream; namespace Scumm { +class ActorHE; class ResExtractor; #ifdef ENABLE_HE class LogicHE; @@ -243,7 +244,7 @@ public: AuxEntry _auxEntries[16]; uint16 _auxEntriesNum; - void queueAuxBlock(Actor *a); + void queueAuxBlock(ActorHE *a); void queueAuxEntry(int actorNum, int subIndex); void remapHEPalette(const uint8 *src, uint8 *dst); diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index f8fb1efca2..4f74a74b89 100644 --- a/engines/scumm/he/resource_he.cpp +++ b/engines/scumm/he/resource_he.cpp @@ -165,7 +165,6 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte _fileName = _vm->generateFilename(-3); } - /* get file size */ fi.file->open(_fileName); if (!fi.file->isOpen()) { @@ -174,18 +173,18 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte fi.total_size = fi.file->size(); if (fi.total_size == -1) { - error("Cannot get size of file %s", fi.file->name()); + error("Cannot get size of file %s", _fileName.c_str()); goto cleanup; } if (fi.total_size == 0) { - error("%s: file has a size of 0", fi.file->name()); + error("%s: file has a size of 0", _fileName.c_str()); goto cleanup; } /* read all of file */ fi.memory = (byte *)malloc(fi.total_size); if (fi.file->read(fi.memory, fi.total_size) == 0) { - error("Cannot read from file %s", fi.file->name()); + error("Cannot read from file %s", _fileName.c_str()); goto cleanup; } @@ -200,8 +199,10 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte /* free stuff and close file */ cleanup: - if (fi.file != NULL) + if (fi.file != NULL) { fi.file->close(); + delete fi.file; + } if (fi.memory != NULL) free(fi.memory); @@ -371,19 +372,19 @@ byte *Win32ResExtractor::extract_group_icon_cursor_resource(WinLibrary *fi, WinR fwr = find_resource(fi, (is_icon ? "-3" : "-1"), name, lang, &level); if (fwr == NULL) { error("%s: could not find `%s' in `%s' resource.", - fi->file->name(), &name[1], (is_icon ? "group_icon" : "group_cursor")); + _fileName.c_str(), &name[1], (is_icon ? "group_icon" : "group_cursor")); return NULL; } if (get_resource_entry(fi, fwr, &iconsize) != NULL) { if (iconsize == 0) { - debugC(DEBUG_RESOURCE, "%s: icon resource `%s' is empty, skipping", fi->file->name(), name); + debugC(DEBUG_RESOURCE, "%s: icon resource `%s' is empty, skipping", _fileName.c_str(), name); skipped++; continue; } if ((uint32)iconsize != FROM_LE_32(icondir->entries[c].bytes_in_res)) { debugC(DEBUG_RESOURCE, "%s: mismatch of size in icon resource `%s' and group (%d != %d)", - fi->file->name(), name, iconsize, FROM_LE_32(icondir->entries[c].bytes_in_res)); + _fileName.c_str(), name, iconsize, FROM_LE_32(icondir->entries[c].bytes_in_res)); } size += iconsize; /* size += FROM_LE_32(icondir->entries[c].bytes_in_res); */ @@ -419,7 +420,7 @@ byte *Win32ResExtractor::extract_group_icon_cursor_resource(WinLibrary *fi, WinR fwr = find_resource(fi, (is_icon ? "-3" : "-1"), name, lang, &level); if (fwr == NULL) { error("%s: could not find `%s' in `%s' resource.", - fi->file->name(), &name[1], (is_icon ? "group_icon" : "group_cursor")); + _fileName.c_str(), &name[1], (is_icon ? "group_icon" : "group_cursor")); return NULL; } @@ -675,7 +676,7 @@ bool Win32ResExtractor::read_library(WinLibrary *fi) { LE32(mz_header->lfanew); if (mz_header->lfanew < sizeof(DOSImageHeader)) { - error("%s: not a Windows library", fi->file->name()); + error("%s: not a Windows library", _fileName.c_str()); return false; } } @@ -724,7 +725,7 @@ bool Win32ResExtractor::read_library(WinLibrary *fi) { RETURN_IF_BAD_POINTER(false, pe_header->optional_header.data_directory[IMAGE_DIRECTORY_ENTRY_RESOURCE]); Win32ImageDataDirectory *dir = pe_header->optional_header.data_directory + IMAGE_DIRECTORY_ENTRY_RESOURCE; if (dir->size == 0) { - error("%s: file contains no resources", fi->file->name()); + error("%s: file contains no resources", _fileName.c_str()); return false; } @@ -735,7 +736,7 @@ bool Win32ResExtractor::read_library(WinLibrary *fi) { } /* other (unknown) header signature was found */ - error("%s: not a Windows library", fi->file->name()); + error("%s: not a Windows library", _fileName.c_str()); return false; } diff --git a/engines/scumm/he/resource_he.h b/engines/scumm/he/resource_he.h index a3237e7b3b..9f4b423d3d 100644 --- a/engines/scumm/he/resource_he.h +++ b/engines/scumm/he/resource_he.h @@ -102,10 +102,10 @@ namespace Scumm { #endif #define RETURN_IF_BAD_POINTER(r, x) \ - if (!check_offset(fi->memory, fi->total_size, fi->file->name(), &(x), sizeof(x))) \ + if (!check_offset(fi->memory, fi->total_size, _fileName.c_str(), &(x), sizeof(x))) \ return (r); #define RETURN_IF_BAD_OFFSET(r, x, s) \ - if (!check_offset(fi->memory, fi->total_size, fi->file->name(), x, s)) \ + if (!check_offset(fi->memory, fi->total_size, _fileName.c_str(), x, s)) \ return (r); class ScummEngine_v70he; diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp index 5717d77640..f1a202e22c 100644 --- a/engines/scumm/he/script_v100he.cpp +++ b/engines/scumm/he/script_v100he.cpp @@ -23,8 +23,6 @@ * */ - - #include "common/system.h" #include "scumm/actor.h" @@ -381,7 +379,7 @@ const char *ScummEngine_v100he::getOpcodeDesc(byte i) { } void ScummEngine_v100he::o100_actorOps() { - Actor *a; + ActorHE *a; int i, j, k; int args[32]; byte string[256]; @@ -392,7 +390,7 @@ void ScummEngine_v100he::o100_actorOps() { return; } - a = derefActorSafe(_curActor, "o100_actorOps"); + a = (ActorHE *)derefActorSafe(_curActor, "o100_actorOps"); if (!a) return; diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp index 9429f8d086..7f36d53791 100644 --- a/engines/scumm/he/script_v60he.cpp +++ b/engines/scumm/he/script_v60he.cpp @@ -23,7 +23,6 @@ * */ - #include "common/savefile.h" #include "scumm/actor.h" @@ -623,7 +622,7 @@ void ScummEngine_v60he::swapObjects(int object1, int object2) { } void ScummEngine_v60he::o60_actorOps() { - Actor *a; + ActorHE *a; int i, j, k; int args[8]; @@ -633,7 +632,7 @@ void ScummEngine_v60he::o60_actorOps() { return; } - a = derefActorSafe(_curActor, "o60_actorOps"); + a = (ActorHE *)derefActorSafe(_curActor, "o60_actorOps"); if (!a) return; diff --git a/engines/scumm/he/script_v70he.cpp b/engines/scumm/he/script_v70he.cpp index 8fcb8b6fe8..577e7c3d99 100644 --- a/engines/scumm/he/script_v70he.cpp +++ b/engines/scumm/he/script_v70he.cpp @@ -23,8 +23,6 @@ * */ - - #include "common/config-manager.h" #include "common/system.h" diff --git a/engines/scumm/he/script_v71he.cpp b/engines/scumm/he/script_v71he.cpp index 8b2823aa8c..1338ab3db8 100644 --- a/engines/scumm/he/script_v71he.cpp +++ b/engines/scumm/he/script_v71he.cpp @@ -23,8 +23,6 @@ * */ - - #include "scumm/actor.h" #include "scumm/he/intern_he.h" #include "scumm/scumm.h" @@ -500,7 +498,7 @@ void ScummEngine_v71he::adjustRect(Common::Rect &rect) { void ScummEngine_v71he::o71_kernelSetFunctions() { int args[29]; int num; - Actor *a; + ActorHE *a; num = getStackList(args, ARRAYSIZE(args)); @@ -511,8 +509,8 @@ void ScummEngine_v71he::o71_kernelSetFunctions() { virtScreenLoad(args[1], args[2], args[3], args[4], args[5]); break; case 20: // HE72+ - a = derefActor(args[1], "o71_kernelSetFunctions: 20"); - ((ScummEngine_v71he *)this)->queueAuxBlock(a); + a = (ActorHE *)derefActor(args[1], "o71_kernelSetFunctions: 20"); + queueAuxBlock(a); break; case 21: _skipDrawObject = 1; @@ -533,14 +531,14 @@ void ScummEngine_v71he::o71_kernelSetFunctions() { redrawAllActors(); break; case 26: - a = derefActor(args[1], "o71_kernelSetFunctions: 26"); + a = (ActorHE *)derefActor(args[1], "o71_kernelSetFunctions: 26"); a->_auxBlock.r.left = 0; a->_auxBlock.r.right = -1; a->_auxBlock.r.top = 0; a->_auxBlock.r.bottom = -2; break; case 30: - a = derefActor(args[1], "o71_kernelSetFunctions: 30"); + a = (ActorHE *)derefActor(args[1], "o71_kernelSetFunctions: 30"); a->_clipOverride.bottom = args[2]; break; case 42: diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp index 7e31383f4e..2fecc58bff 100644 --- a/engines/scumm/he/script_v72he.cpp +++ b/engines/scumm/he/script_v72he.cpp @@ -23,8 +23,6 @@ * */ - - #include "common/config-manager.h" #include "common/savefile.h" #include "common/system.h" @@ -1021,7 +1019,7 @@ void ScummEngine_v72he::o72_roomOps() { } void ScummEngine_v72he::o72_actorOps() { - Actor *a; + ActorHE *a; int i, j, k; int args[32]; byte string[256]; @@ -1032,7 +1030,7 @@ void ScummEngine_v72he::o72_actorOps() { return; } - a = derefActorSafe(_curActor, "o72_actorOps"); + a = (ActorHE *)derefActorSafe(_curActor, "o72_actorOps"); if (!a) return; diff --git a/engines/scumm/he/script_v80he.cpp b/engines/scumm/he/script_v80he.cpp index 39ec715d94..46449d1683 100644 --- a/engines/scumm/he/script_v80he.cpp +++ b/engines/scumm/he/script_v80he.cpp @@ -23,8 +23,6 @@ * */ - - #include "common/config-file.h" #include "common/config-manager.h" #include "common/savefile.h" @@ -646,7 +644,7 @@ void ScummEngine_v80he::drawLine(int x1, int y1, int x, int y, int step, int typ if (type == 2) { - Actor *a = derefActor(id, "drawLine"); + ActorHE *a = (ActorHE *)derefActor(id, "drawLine"); a->drawActorToBackBuf(x, y); } else if (type == 3) { WizImage wi; @@ -697,7 +695,7 @@ void ScummEngine_v80he::drawLine(int x1, int y1, int x, int y, int step, int typ continue; if (type == 2) { - Actor *a = derefActor(id, "drawLine"); + ActorHE *a = (ActorHE *)derefActor(id, "drawLine"); a->drawActorToBackBuf(x, y); } else if (type == 3) { WizImage wi; diff --git a/engines/scumm/he/script_v90he.cpp b/engines/scumm/he/script_v90he.cpp index 6d15303378..9829d0ecb5 100644 --- a/engines/scumm/he/script_v90he.cpp +++ b/engines/scumm/he/script_v90he.cpp @@ -23,8 +23,6 @@ * */ - - #include "scumm/actor.h" #include "scumm/charset.h" #include "scumm/he/animation_he.h" @@ -1617,13 +1615,13 @@ void ScummEngine_v90he::o90_getWizData() { } void ScummEngine_v90he::o90_getActorData() { - Actor *a; + ActorHE *a; int subOp = pop(); int val = pop(); int act = pop(); - a = derefActor(act, "o90_getActorData"); + a = (ActorHE *)derefActor(act, "o90_getActorData"); switch (subOp) { case 1: @@ -2570,13 +2568,13 @@ void ScummEngine_v90he::o90_kernelGetFunctions() { void ScummEngine_v90he::o90_kernelSetFunctions() { int args[29]; int num, tmp; - Actor *a; + ActorHE *a; num = getStackList(args, ARRAYSIZE(args)); switch (args[0]) { case 20: - a = derefActor(args[1], "o90_kernelSetFunctions: 20"); + a = (ActorHE *)derefActor(args[1], "o90_kernelSetFunctions: 20"); queueAuxBlock(a); break; case 21: @@ -2618,7 +2616,7 @@ void ScummEngine_v90he::o90_kernelSetFunctions() { // Remote start script function break; case 1969: - a = derefActor(args[1], "o90_kernelSetFunctions: 1969"); + a = (ActorHE *)derefActor(args[1], "o90_kernelSetFunctions: 1969"); tmp = a->_heCondMask; tmp ^= args[2]; tmp &= 0x7FFF0000; diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp index 8bcd92fd3b..eaffbd04bb 100644 --- a/engines/scumm/object.cpp +++ b/engines/scumm/object.cpp @@ -109,6 +109,13 @@ void ScummEngine::setOwnerOf(int obj, int owner) { int arg = (_game.version >= 6) ? obj : 0; + // WORKAROUND for bug #1917981: Game crash when finishing Indy3 demo. + // Script 94 tries to empty the inventory but does so in a bogus way. + // This causes it to try to remove object 0 from the inventory. + if (_game.id == GID_PASS && obj == 0 && vm.slot[_currentScript].number == 94) + return; + assert(obj > 0); + if (owner == 0) { clearOwnerOf(obj); diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h index 9c076ddfc8..ce40d808b1 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 Sat Sep 06 07:02:46 2008 + This file was generated by the md5table tool on Mon Sep 29 00:06:57 2008 DO NOT EDIT MANUALLY! */ @@ -187,7 +187,7 @@ static const MD5Table md5table[] = { { "47e75b1bdcb44c78cb94883d1731ccf8", "fbear", "HE 61", "Demo", 6203, Common::EN_ANY, Common::kPlatformPC }, { "48b9f04b348bc5013327753f0d12a144", "loom", "EGA", "EGA", -1, Common::ES_ESP, Common::kPlatformAmiga }, { "49210e124e4c2b30f1290a9ef6306301", "monkey", "EGA", "EGA", 8357, Common::EN_ANY, Common::kPlatformPC }, - { "4973bbc3899e3826dbf316e1d7271ec7", "zak", "V1", "", -1, Common::DE_DEU, Common::kPlatformC64 }, + { "4973bbc3899e3826dbf316e1d7271ec7", "zak", "V1", "", 196608, Common::DE_DEU, Common::kPlatformC64 }, { "499c958affc394f2a3868f1eb568c3ee", "freddi4", "HE 99", "Demo", -1, Common::NL_NLD, Common::kPlatformWindows }, { "49a1739981a89066b1121fac04b710f4", "spyfox2", "HE CUP", "Preview", 5756234, Common::UNK_LANG, Common::kPlatformUnknown }, { "4aa93cb30e485b728504ba3a693f12bf", "pajama", "HE 100", "", -1, Common::RU_RUS, Common::kPlatformWindows }, @@ -223,9 +223,10 @@ static const MD5Table md5table[] = { { "53e94115b55dd51d4b8ff0871aa1df1e", "spyfox", "", "Demo", 20103, Common::EN_ANY, Common::kPlatformUnknown }, { "54a936ad06161ff7bfefcb96200f7bff", "monkey", "VGA", "VGA Demo", -1, Common::EN_ANY, Common::kPlatformAmiga }, { "55518cd73cf9c6d23ea29c51ee06bdfe", "ft", "", "", -1, Common::IT_ITA, Common::kPlatformUnknown }, - { "55d3987641bf229c83bc729210173383", "zak", "V1", "", -1, Common::EN_ANY, Common::kPlatformC64 }, + { "55d3987641bf229c83bc729210173383", "zak", "V1", "", 174848, Common::EN_ANY, Common::kPlatformC64 }, { "55e4cc866ff9046824e1c638ba2b8c7f", "ft", "", "", -1, Common::RU_RUS, Common::kPlatformUnknown }, { "566165a7338fa11029e7c14d94fa70d0", "freddi", "HE 73", "Demo", 9800, Common::EN_ANY, Common::kPlatformWindows }, + { "5719fc8a13b4638b78d9d8d12f091f94", "puttrace", "HE 98.5", "", -1, Common::FR_FRA, Common::kPlatformWindows }, { "5798972220cd458be2626d54c80f71d7", "atlantis", "", "Floppy", -1, Common::IT_ITA, Common::kPlatformAmiga }, { "57a17febe2183f521250e55d55b83e60", "PuttTime", "HE 99", "", -1, Common::FR_FRA, Common::kPlatformWindows }, { "57a5cfec9ef231a007043cc1917e8988", "freddi", "HE 100", "", -1, Common::EN_ANY, Common::kPlatformWii }, @@ -320,6 +321,7 @@ static const MD5Table md5table[] = { { "78bd5f036ea35a878b74e4f47941f784", "freddi4", "HE 99", "", -1, Common::RU_RUS, Common::kPlatformWindows }, { "78c07ca088526d8d4446a4c2cb501203", "freddi3", "HE 99", "", -1, Common::FR_FRA, Common::kPlatformUnknown }, { "7974365d3dc0f43a2748c975f91ff042", "monkey2", "", "", -1, Common::ES_ESP, Common::kPlatformPC }, + { "7b60620558b8d6b7d7313b8ac7bb5a98", "zak", "V1", "", 174848, Common::IT_ITA, Common::kPlatformC64 }, { "7bad72e332a59f9fcc1d437f4edad32a", "puttcircus", "", "", -1, Common::RU_RUS, Common::kPlatformUnknown }, { "7c2e76087027eeee9c8f8985f93a1cc5", "freddi4", "", "Demo", 13584, Common::EN_ANY, Common::kPlatformUnknown }, { "7c8100e360e8ef05f88069d4cfa0afd1", "puttrace", "HE 99", "Demo", 13108, Common::EN_GRB, Common::kPlatformWindows }, diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index f87adfd9ac..a10af41145 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1307,6 +1307,8 @@ void ScummEngine::resetScumm() { _actors[i] = new Actor_v2(this, i); else if (_game.version == 3) _actors[i] = new Actor_v3(this, i); + else if (_game.heversion != 0) + _actors[i] = new ActorHE(this, i); else _actors[i] = new Actor(this, i); _actors[i]->initActor(-1); diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 27c8943fee..ec733d32f4 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -918,7 +918,7 @@ public: // Generic costume code bool isCostumeInUse(int i) const; - Common::Rect _actorClipOverride; + Common::Rect _actorClipOverride; // HE specific protected: /* Should be in Graphics class? */ |