aboutsummaryrefslogtreecommitdiff
path: root/engines/illusions
diff options
context:
space:
mode:
authorjohndoe1232018-05-26 06:45:15 +1000
committerEugene Sandulenko2018-07-20 06:43:33 +0000
commit565de60234af381862200aef7c57ae3de94bf489 (patch)
tree223ccc5b0183e0ceffab1fc9768033a23a9abdf0 /engines/illusions
parent617e9439cfa51cdb7221a388762e0661ccd5f5ad (diff)
downloadscummvm-rg350-565de60234af381862200aef7c57ae3de94bf489.tar.gz
scummvm-rg350-565de60234af381862200aef7c57ae3de94bf489.tar.bz2
scummvm-rg350-565de60234af381862200aef7c57ae3de94bf489.zip
ILLUSIONS: Clean up/fix some TODOs
(cherry picked from commit 66094e4)
Diffstat (limited to 'engines/illusions')
-rw-r--r--engines/illusions/actor.cpp73
-rw-r--r--engines/illusions/actor.h6
-rw-r--r--engines/illusions/bbdou/bbdou_cursor.cpp5
-rw-r--r--engines/illusions/bbdou/bbdou_inventory.cpp1
-rw-r--r--engines/illusions/bbdou/bbdou_specialcode.cpp10
-rw-r--r--engines/illusions/bbdou/illusions_bbdou.cpp2
-rw-r--r--engines/illusions/cursor.cpp19
-rw-r--r--engines/illusions/cursor.h2
-rw-r--r--engines/illusions/duckman/illusions_duckman.h1
-rw-r--r--engines/illusions/duckman/scriptopcodes_duckman.cpp3
-rw-r--r--engines/illusions/resourcesystem.h1
-rw-r--r--engines/illusions/screen.cpp7
-rw-r--r--engines/illusions/sound.cpp1
-rw-r--r--engines/illusions/textdrawer.cpp7
14 files changed, 73 insertions, 65 deletions
diff --git a/engines/illusions/actor.cpp b/engines/illusions/actor.cpp
index 8c9b28ed88..b4ea72e626 100644
--- a/engines/illusions/actor.cpp
+++ b/engines/illusions/actor.cpp
@@ -89,7 +89,6 @@ Actor::Actor(IllusionsEngine *vm)
}
_notifyThreadId1 = 0;
_notifyThreadId2 = 0;
- _surfaceTextFlag = 0;
_entryTblPtr = 0;
_seqCodeIp = 0;
_sequenceId = 0;
@@ -131,13 +130,11 @@ void Actor::unpause() {
void Actor::createSurface(SurfInfo &surfInfo) {
_surface = _vm->_screen->allocSurface(surfInfo);
- if (_frameIndex) {
- if (_surfaceTextFlag) {
- /* TODO
- Font *font = _vm->findFont(_fontId);
- _surface->fillRect(Common::Rect(surfInfo._dimensions._width, surfInfo._dimensions._height), 0);
- gfx_sub_40CA70(_surface, font, _field18C, _surfInfo._dimensions, _field198);
- */
+ if (_vm->getGameId() == kGameIdDuckman) {
+ if (_flags & Illusions::ACTOR_FLAG_IS_VISIBLE) {
+ if (_frameIndex) {
+ _flags |= Illusions::ACTOR_FLAG_2000;
+ }
_flags |= Illusions::ACTOR_FLAG_4000;
}
else {
@@ -194,10 +191,10 @@ Control::Control(IllusionsEngine *vm)
_pauseCtr = 0;
_priority = 0;
_objectId = 0;
- _unkPt.x = 0;
- _unkPt.y = 0;
- _pt.x = 0;
- _pt.y = 0;
+ _bounds._topLeft.x = 0;
+ _bounds._topLeft.y = 0;
+ _bounds._bottomRight.x = 0;
+ _bounds._bottomRight.y = 0;
_feetPt.x = 0;
_feetPt.y = 0;
_position.x = 0;
@@ -212,10 +209,11 @@ Control::~Control() {
void Control::pause() {
- _vm->_dict->setObjectControl(_objectId, 0);
-
- if (_objectId == Illusions::CURSOR_OBJECT_ID)
- _vm->setCursorControl(0);
+ if (_vm->getGameId() == kGameIdBBDOU || !(_flags & Illusions::ACTOR_FLAG_SCALED)) {
+ _vm->_dict->setObjectControl(_objectId, 0);
+ if (_objectId == Illusions::CURSOR_OBJECT_ID)
+ _vm->setCursorControl(0);
+ }
if (_actor && !(_actor->_flags & Illusions::ACTOR_FLAG_200))
_actor->destroySurface();
@@ -223,11 +221,13 @@ void Control::pause() {
}
void Control::unpause() {
- _vm->_dict->setObjectControl(_objectId, this);
-
- if (_objectId == Illusions::CURSOR_OBJECT_ID)
- _vm->setCursorControl(this);
+ if (_vm->getGameId() == kGameIdBBDOU || !(_flags & Illusions::ACTOR_FLAG_SCALED)) {
+ _vm->_dict->setObjectControl(_objectId, this);
+ if (_objectId == Illusions::CURSOR_OBJECT_ID)
+ _vm->setCursorControl(this);
+ }
+
if (_actor && !(_actor->_flags & Illusions::ACTOR_FLAG_200)) {
SurfInfo surfInfo;
ActorType *actorType = _vm->_dict->findActorType(_actorTypeId);
@@ -318,11 +318,11 @@ void Control::deactivateObject() {
}
void Control::readPointsConfig(byte *pointsConfig) {
- _unkPt.x = READ_LE_UINT16(pointsConfig + 0);
- _unkPt.y = READ_LE_UINT16(pointsConfig + 2);
+ _bounds._topLeft.x = READ_LE_UINT16(pointsConfig + 0);
+ _bounds._topLeft.y = READ_LE_UINT16(pointsConfig + 2);
pointsConfig += 4;
- _pt.x = READ_LE_UINT16(pointsConfig + 0);
- _pt.y = READ_LE_UINT16(pointsConfig + 2);
+ _bounds._bottomRight.x = READ_LE_UINT16(pointsConfig + 0);
+ _bounds._bottomRight.y = READ_LE_UINT16(pointsConfig + 2);
pointsConfig += 4;
_feetPt.x = READ_LE_UINT16(pointsConfig + 0);
_feetPt.y = READ_LE_UINT16(pointsConfig + 2);
@@ -493,7 +493,7 @@ void Control::getCollisionRectAccurate(Common::Rect &collisionRect) {
-_position.x + _actor->_surfInfo._dimensions._width - 1,
-_position.y + _actor->_surfInfo._dimensions._height - 1);
} else {
- collisionRect = Common::Rect(_unkPt.x, _unkPt.y, _pt.x, _pt.y);
+ collisionRect = Common::Rect(_bounds._topLeft.x, _bounds._topLeft.y, _bounds._bottomRight.x, _bounds._bottomRight.y);
}
if (_actor) {
@@ -514,7 +514,7 @@ void Control::getCollisionRectAccurate(Common::Rect &collisionRect) {
}
void Control::getCollisionRect(Common::Rect &collisionRect) {
- collisionRect = Common::Rect(_unkPt.x, _unkPt.y, _pt.x, _pt.y);
+ collisionRect = Common::Rect(_bounds._topLeft.x, _bounds._topLeft.y, _bounds._bottomRight.x, _bounds._bottomRight.y);
if (_actor) {
if (_actor->_scale != 100) {
collisionRect.left = collisionRect.left * _actor->_scale / 100;
@@ -769,7 +769,6 @@ PointArray *Control::createPath(Common::Point destPt) {
void Control::updateActorMovement(uint32 deltaTime) {
// TODO This needs some cleanup
- // TODO Move while loop to caller
static const int16 kAngleTbl[] = {60, 0, 120, 0, 60, 0, 120, 0};
bool fastWalked = false;
@@ -1102,10 +1101,10 @@ void Controls::placeSequenceLessActor(uint32 objectId, Common::Point placePt, Wi
control->_flags = 0;
control->_priority = priority;
control->_objectId = objectId;
- control->_unkPt.x = 0;
- control->_unkPt.y = 0;
- control->_pt.y = dimensions._height - 1;
- control->_pt.x = dimensions._width - 1;
+ control->_bounds._topLeft.x = 0;
+ control->_bounds._topLeft.y = 0;
+ control->_bounds._bottomRight.x = dimensions._width - 1;
+ control->_bounds._bottomRight.y = dimensions._height - 1;
control->_feetPt.x = dimensions._width / 2;
control->_feetPt.y = dimensions._height / 2;
control->_position.x = 0;
@@ -1131,11 +1130,11 @@ void Controls::placeSequenceLessActor(uint32 objectId, Common::Point placePt, Wi
void Controls::placeActorLessObject(uint32 objectId, Common::Point feetPt, Common::Point pt, int16 priority, uint flags) {
Control *control = newControl();
control->_flags = flags;
- control->_unkPt = feetPt;
control->_feetPt = feetPt;
control->_priority = priority;
control->_objectId = objectId;
- control->_pt = pt;
+ control->_bounds._topLeft = feetPt;
+ control->_bounds._bottomRight = pt;
control->_position.x = 0;
control->_position.y = 0;
control->_actorTypeId = 0;
@@ -1466,10 +1465,10 @@ uint32 Controls::newTempObjectId() {
void Controls::destroyControlInternal(Control *control) {
- if (!(control->_flags & 4) && control->_pauseCtr <= 0)
+ if ((_vm->getGameId() == kGameIdBBDOU || !(control->_flags & 4)) && control->_pauseCtr <= 0)
_vm->_dict->setObjectControl(control->_objectId, 0);
- if (!(control->_flags & 4) && control->_objectId == Illusions::CURSOR_OBJECT_ID && control->_pauseCtr <= 0)
+ if ((_vm->getGameId() == kGameIdBBDOU || !(control->_flags & 4)) && control->_objectId == Illusions::CURSOR_OBJECT_ID && control->_pauseCtr <= 0)
_vm->setCursorControl(0);
if (control->_actor) {
@@ -1477,10 +1476,6 @@ void Controls::destroyControlInternal(Control *control) {
delete control->_actor->_pathNode;
if (!(control->_actor->_flags & Illusions::ACTOR_FLAG_200))
control->_actor->destroySurface();
- /* TODO
- if (control->_actor->_field2)
- largeObj_sub_4061E0();
- */
delete control->_actor;
control->_actor = 0;
}
diff --git a/engines/illusions/actor.h b/engines/illusions/actor.h
index 358ecbdb1e..b52c4a68d8 100644
--- a/engines/illusions/actor.h
+++ b/engines/illusions/actor.h
@@ -153,8 +153,6 @@ public:
uint32 _notifyThreadId2;
byte *_entryTblPtr;
- int _surfaceTextFlag;
-
ActorControlRoutine *_controlRoutine;
uint32 _sequenceId;
@@ -237,9 +235,7 @@ public:
uint32 _sceneId;
uint32 _objectId;
uint32 _actorTypeId;
- // TODO Move points into own struct
- Common::Point _unkPt;
- Common::Point _pt;
+ WRect _bounds;
Common::Point _feetPt;
Common::Point _position;
Common::Point _subobjectsPos[kSubObjectsCount];
diff --git a/engines/illusions/bbdou/bbdou_cursor.cpp b/engines/illusions/bbdou/bbdou_cursor.cpp
index 2d546def04..e9046c3e90 100644
--- a/engines/illusions/bbdou/bbdou_cursor.cpp
+++ b/engines/illusions/bbdou/bbdou_cursor.cpp
@@ -48,7 +48,6 @@ void BbdouCursor::init(uint32 objectId, uint32 progResKeywordId) {
_vm->_controls->placeActor(0x50001, pos, 0x6000C, objectId, 0);
Control *control = _vm->_dict->getObjectControl(objectId);
- // TODO? control->_actor->setControlRoutine(new Common::Functor2Mem<Control*, uint32, void, BbdouCursor>(this, &BbdouCursor::actorControlRoutine1));
control->_flags |= 8;
_data._mode = 1;
@@ -100,7 +99,6 @@ void BbdouCursor::disable(uint32 objectId) {
void BbdouCursor::reset(uint32 objectId) {
Control *control = _vm->_dict->getObjectControl(objectId);
-
_data._verbState._cursorState = 1;
_data._mode = 1;
_data._mode2 = 0;
@@ -125,10 +123,7 @@ void BbdouCursor::reset(uint32 objectId) {
resetActiveVerbs();
control->setActorIndexTo1();
control->startSequenceActor(0x60029, 2, 0);
-
_bbdou->hideVerbBubble(control->_objectId, &_data._verbState);
- // TODO? control->_actor->setControlRoutine(new Common::Functor2Mem<Control*, uint32, void, BbdouCursor>(this, &BbdouCursor::cursorInteractControlRoutine));
-
}
void BbdouCursor::addCursorSequenceId(uint32 objectId, uint32 sequenceId) {
diff --git a/engines/illusions/bbdou/bbdou_inventory.cpp b/engines/illusions/bbdou/bbdou_inventory.cpp
index 14c2d769dd..88184b9807 100644
--- a/engines/illusions/bbdou/bbdou_inventory.cpp
+++ b/engines/illusions/bbdou/bbdou_inventory.cpp
@@ -298,7 +298,6 @@ void BbdouInventory::clear() {
}
void BbdouInventory::cause0x1B0001(TriggerFunction *triggerFunction, uint32 callingThreadId) {
- // TODO
uint32 foundSceneId, foundVerbId, foundObjectId2, foundObjectId;
bool found = false;
InventoryBag *inventoryBag = getInventoryBag(_activeInventorySceneId);
diff --git a/engines/illusions/bbdou/bbdou_specialcode.cpp b/engines/illusions/bbdou/bbdou_specialcode.cpp
index 9bdab0c875..542b3d8aa3 100644
--- a/engines/illusions/bbdou/bbdou_specialcode.cpp
+++ b/engines/illusions/bbdou/bbdou_specialcode.cpp
@@ -220,8 +220,9 @@ void BbdouSpecialCode::resetBeforeResumeSavegame() {
_vm->_threads->terminateThreads(0);
_vm->reset();
_vm->_input->activateButton(0xFFFF);
- // TODO _vm->stopMusic();
- // TODO _vm->_gameStates->clear();
+ _vm->_soundMan->stopMusic();
+ _vm->_scriptResource->_blockCounters.clear();
+ _vm->_scriptResource->_properties.clear();
_cursor->reset(0x0004001A);
setCursorControlRoutine(0x0004001A, 0);
_cursor->enable(0x0004001A);
@@ -934,9 +935,8 @@ void BbdouSpecialCode::cursorCrosshairControlRoutine(Control *cursorControl, uin
}
} else if (_vm->_input->pollEvent(kEventRightClick) && cursorData._verbState._isBubbleVisible && !cursorData._verbState._flag56) {
- // TODO I don't think this is used; _isBubbleVisible seems to be always 0 here
- debug("Cursor_sub_10004DD0 TODO");
- // TODO Cursor_sub_10004DD0(controla->objectId, cursorData->currOverlappedObjectId, cursorData->holdingObjectId, &cursorData->verbState);
+ // I don't think this is used; _isBubbleVisible seems to be always 0 here
+ warning("Cursor function not implemented");
}
} else if (_vm->_input->pollEvent(kEventLeftClick)) {
diff --git a/engines/illusions/bbdou/illusions_bbdou.cpp b/engines/illusions/bbdou/illusions_bbdou.cpp
index 7e443e2361..30726ea48e 100644
--- a/engines/illusions/bbdou/illusions_bbdou.cpp
+++ b/engines/illusions/bbdou/illusions_bbdou.cpp
@@ -659,7 +659,7 @@ bool IllusionsEngine_BBDOU::findTriggerCause(uint32 sceneId, uint32 verbId, uint
void IllusionsEngine_BBDOU::reset() {
_scriptResource->_blockCounters.clear();
_scriptResource->_properties.clear();
- // TODO script_sub_417FF0(1, 0);
+ setTextDuration(1, 0);
}
void IllusionsEngine_BBDOU::loadSavegameFromScript(int16 slotNum, uint32 callingThreadId) {
diff --git a/engines/illusions/cursor.cpp b/engines/illusions/cursor.cpp
index da8a83b71e..0ae21beae9 100644
--- a/engines/illusions/cursor.cpp
+++ b/engines/illusions/cursor.cpp
@@ -50,8 +50,23 @@ void Cursor::place(Control *control, uint32 sequenceId) {
_vm->_input->setCursorPosition(_control->_actor->_position);
}
-void Cursor::setActorIndex(int a2, int a3, int a4) {
- _control->_actor->_actorIndex = 1;// TODO?!? *((_BYTE *)&stru_42C040[30].y + 2 * ((always0 != 0) + 2 * a2) + a3 + 1);
+void Cursor::setActorIndex(int actorIndex, int a, int b) {
+ static int kCursorMap[13][2][2] = {
+ {{ 1, 2}, { 0, 0}},
+ {{ 3, 4}, { 0, 0}},
+ {{ 5, 6}, {13, 14}},
+ {{ 7, 8}, { 0, 0}},
+ {{ 9, 10}, { 0, 0}},
+ {{11, 12}, { 0, 0}},
+ {{ 1, 2}, { 0, 0}},
+ {{ 0, 0}, { 0, 0}},
+ {{ 0, 0}, { 0, 0}},
+ {{15, 16}, { 0, 0}},
+ {{17, 18}, { 0, 0}},
+ {{19, 20}, { 0, 0}},
+ {{21, 22}, { 0, 0}}
+ };
+ _control->_actor->_actorIndex = kCursorMap[actorIndex - 1][b][a - 1];
}
void Cursor::setControl(Control *control) {
diff --git a/engines/illusions/cursor.h b/engines/illusions/cursor.h
index e528f09708..2271bebdd2 100644
--- a/engines/illusions/cursor.h
+++ b/engines/illusions/cursor.h
@@ -32,7 +32,7 @@ class Cursor {
public:
Cursor(IllusionsEngine *vm);
void place(Control *control, uint32 sequenceId);
- void setActorIndex(int a2, int a3, int a4);
+ void setActorIndex(int actorIndex, int a, int b);
void setControl(Control *control);
void show();
void hide();
diff --git a/engines/illusions/duckman/illusions_duckman.h b/engines/illusions/duckman/illusions_duckman.h
index d4583bccef..0dfdf3a10f 100644
--- a/engines/illusions/duckman/illusions_duckman.h
+++ b/engines/illusions/duckman/illusions_duckman.h
@@ -84,7 +84,6 @@ protected:
virtual bool hasFeature(EngineFeature f) const;
public:
- // TODO ActiveScenes _activeScenes;
uint32 _prevSceneId;
uint32 _theSceneId;
uint32 _theThreadId;
diff --git a/engines/illusions/duckman/scriptopcodes_duckman.cpp b/engines/illusions/duckman/scriptopcodes_duckman.cpp
index ee4979a11a..24e69db404 100644
--- a/engines/illusions/duckman/scriptopcodes_duckman.cpp
+++ b/engines/illusions/duckman/scriptopcodes_duckman.cpp
@@ -323,6 +323,7 @@ void ScriptOpcodes_Duckman::opStartModalScene(ScriptThread *scriptThread, OpCall
void ScriptOpcodes_Duckman::opExitModalScene(ScriptThread *scriptThread, OpCall &opCall) {
_vm->_input->discardAllEvents();
if (_vm->_scriptResource->_properties.get(0x000E0027)) {
+ // NOTE This would switch to the debug menu which is not currently supported
_vm->startScriptThread2(0x10002, 0x20001, 0);
opCall._result = kTSTerminate;
} else {
@@ -584,7 +585,7 @@ void ScriptOpcodes_Duckman::opStartCursorHoldingObject(ScriptThread *scriptThrea
void ScriptOpcodes_Duckman::opPlayVideo(ScriptThread *scriptThread, OpCall &opCall) {
ARG_SKIP(2);
ARG_UINT32(videoId);
-#if 1 // TODO DEBUG Set to 0 to skip videos
+#if 1 // NOTE DEBUG Set to 0 to skip videos
_vm->playVideo(videoId, opCall._threadId);
#else
//DEBUG Resume calling thread, later done by the video player
diff --git a/engines/illusions/resourcesystem.h b/engines/illusions/resourcesystem.h
index 6f61ee6080..2cdf04fef0 100644
--- a/engines/illusions/resourcesystem.h
+++ b/engines/illusions/resourcesystem.h
@@ -90,7 +90,6 @@ public:
void addResourceLoader(uint32 resTypeId, BaseResourceLoader *resourceLoader);
- // TODO Handle threadId in caller as well as pausing of timer
void loadResource(uint32 resId, uint32 sceneId, uint32 threadId);
void unloadResourceById(uint32 resId);
void unloadResourcesBySceneId(uint32 sceneId);
diff --git a/engines/illusions/screen.cpp b/engines/illusions/screen.cpp
index b6cbd2dba4..8d870699c4 100644
--- a/engines/illusions/screen.cpp
+++ b/engines/illusions/screen.cpp
@@ -405,7 +405,12 @@ bool Screen::isDisplayOn() {
void Screen::setDisplayOn(bool isOn) {
_displayOn = isOn;
- // TODO Clear screen when off
+ if (!_displayOn) {
+ // Clear screen when off
+ _backSurface->fillRect(Common::Rect(_backSurface->w, _backSurface->h), 0);
+ g_system->copyRectToScreen((byte*)_backSurface->getBasePtr(0, 0), _backSurface->pitch, 0, 0, _backSurface->w, _backSurface->h);
+ g_system->updateScreen();
+ }
}
void Screen::setScreenOffset(Common::Point offsPt) {
diff --git a/engines/illusions/sound.cpp b/engines/illusions/sound.cpp
index 6a62ee52c6..bd39469d76 100644
--- a/engines/illusions/sound.cpp
+++ b/engines/illusions/sound.cpp
@@ -360,7 +360,6 @@ SoundMan::~SoundMan() {
void SoundMan::update() {
updateMidi();
- // TODO voc_testCued();
if (_musicNotifyThreadId && !_musicPlayer->isPlaying())
_vm->notifyThreadId(_musicNotifyThreadId);
}
diff --git a/engines/illusions/textdrawer.cpp b/engines/illusions/textdrawer.cpp
index 31839e04fb..f626316066 100644
--- a/engines/illusions/textdrawer.cpp
+++ b/engines/illusions/textdrawer.cpp
@@ -195,7 +195,12 @@ bool TextDrawer::wrapTextIntern(int16 x, int16 y, int16 maxWidth, int16 maxHeigh
}
bool TextDrawer::textHasChar(uint16 c) {
- // TODO
+ uint16 *textp = _text;
+ while (*textp != 0) {
+ if (*textp == c)
+ return true;
+ ++textp;
+ }
return false;
}