aboutsummaryrefslogtreecommitdiff
path: root/engines/illusions/bbdou
diff options
context:
space:
mode:
authorjohndoe1232014-04-07 12:58:26 +0200
committerEugene Sandulenko2018-07-20 06:43:33 +0000
commit3f15233f78a264e45ce74ecd2db9ed3119b1b654 (patch)
tree821bda821f8b1d0813e271d682c5c42b59103c59 /engines/illusions/bbdou
parent6ba5570de52344da602cf02fb83725b468e3d8c5 (diff)
downloadscummvm-rg350-3f15233f78a264e45ce74ecd2db9ed3119b1b654.tar.gz
scummvm-rg350-3f15233f78a264e45ce74ecd2db9ed3119b1b654.tar.bz2
scummvm-rg350-3f15233f78a264e45ce74ecd2db9ed3119b1b654.zip
ILLUSIONS: Refactor code in preparation for the Duckman engine
Diffstat (limited to 'engines/illusions/bbdou')
-rw-r--r--engines/illusions/bbdou/bbdou_bubble.cpp4
-rw-r--r--engines/illusions/bbdou/bbdou_bubble.h6
-rw-r--r--engines/illusions/bbdou/bbdou_cursor.cpp4
-rw-r--r--engines/illusions/bbdou/bbdou_cursor.h6
-rw-r--r--engines/illusions/bbdou/bbdou_inventory.cpp6
-rw-r--r--engines/illusions/bbdou/bbdou_inventory.h10
-rw-r--r--engines/illusions/bbdou/bbdou_specialcode.cpp23
-rw-r--r--engines/illusions/bbdou/bbdou_specialcode.h7
8 files changed, 31 insertions, 35 deletions
diff --git a/engines/illusions/bbdou/bbdou_bubble.cpp b/engines/illusions/bbdou/bbdou_bubble.cpp
index cc6019c835..7ccd0ea52c 100644
--- a/engines/illusions/bbdou/bbdou_bubble.cpp
+++ b/engines/illusions/bbdou/bbdou_bubble.cpp
@@ -20,7 +20,7 @@
*
*/
-#include "illusions/illusions.h"
+#include "illusions/illusions_bbdou.h"
#include "illusions/bbdou/bbdou_bubble.h"
#include "illusions/actor.h"
#include "illusions/camera.h"
@@ -29,7 +29,7 @@
namespace Illusions {
-BbdouBubble::BbdouBubble(IllusionsEngine *vm, BbdouSpecialCode *bbdou)
+BbdouBubble::BbdouBubble(IllusionsEngine_BBDOU *vm, BbdouSpecialCode *bbdou)
: _vm(vm), _bbdou(bbdou) {
}
diff --git a/engines/illusions/bbdou/bbdou_bubble.h b/engines/illusions/bbdou/bbdou_bubble.h
index 2426c9e1b8..fcf5f51512 100644
--- a/engines/illusions/bbdou/bbdou_bubble.h
+++ b/engines/illusions/bbdou/bbdou_bubble.h
@@ -28,7 +28,7 @@
namespace Illusions {
-class IllusionsEngine;
+class IllusionsEngine_BBDOU;
class BbdouSpecialCode;
class Control;
@@ -54,7 +54,7 @@ struct Item141C {
class BbdouBubble {
public:
- BbdouBubble(IllusionsEngine *vm, BbdouSpecialCode *bbdou);
+ BbdouBubble(IllusionsEngine_BBDOU *vm, BbdouSpecialCode *bbdou);
~BbdouBubble();
void init();
void addItem0(uint32 sequenceId1, uint32 sequenceId2, uint32 progResKeywordId,
@@ -64,7 +64,7 @@ public:
void setup(int16 minCount, Common::Point pt1, Common::Point pt2, uint32 progResKeywordId);
uint32 addItem(uint positionIndex, uint32 sequenceId);
protected:
- IllusionsEngine *_vm;
+ IllusionsEngine_BBDOU *_vm;
BbdouSpecialCode *_bbdou;
Common::Array<Item0> _item0s;
Item0 *_currItem0;
diff --git a/engines/illusions/bbdou/bbdou_cursor.cpp b/engines/illusions/bbdou/bbdou_cursor.cpp
index 4aca265f6d..c158472f0c 100644
--- a/engines/illusions/bbdou/bbdou_cursor.cpp
+++ b/engines/illusions/bbdou/bbdou_cursor.cpp
@@ -20,7 +20,7 @@
*
*/
-#include "illusions/illusions.h"
+#include "illusions/illusions_bbdou.h"
#include "illusions/bbdou/bbdou_cursor.h"
#include "illusions/bbdou/bbdou_specialcode.h"
#include "illusions/actor.h"
@@ -33,7 +33,7 @@ namespace Illusions {
// NOTE It's assumed there's only one game cursor object
// The original stores the _data inside the actor, here it's inside the Cursor class.
-BbdouCursor::BbdouCursor(IllusionsEngine *vm, BbdouSpecialCode *bbdou)
+BbdouCursor::BbdouCursor(IllusionsEngine_BBDOU *vm, BbdouSpecialCode *bbdou)
: _vm(vm), _bbdou(bbdou) {
}
diff --git a/engines/illusions/bbdou/bbdou_cursor.h b/engines/illusions/bbdou/bbdou_cursor.h
index 43918e88a8..7b42e4f307 100644
--- a/engines/illusions/bbdou/bbdou_cursor.h
+++ b/engines/illusions/bbdou/bbdou_cursor.h
@@ -27,7 +27,7 @@
namespace Illusions {
-class IllusionsEngine;
+class IllusionsEngine_BBDOU;
class BbdouSpecialCode;
class Control;
struct Item10;
@@ -85,7 +85,7 @@ const uint kMaxCursorSequences = 100;
class BbdouCursor {
public:
- BbdouCursor(IllusionsEngine *vm, BbdouSpecialCode *bbdou);
+ BbdouCursor(IllusionsEngine_BBDOU *vm, BbdouSpecialCode *bbdou);
~BbdouCursor();
void init(uint32 objectId, uint32 progResKeywordId);
void enable(uint32 objectId);
@@ -104,7 +104,7 @@ public:
uint calcTrackingCursorIndex(uint trackingFlags);
bool getTrackingCursorSequenceId(Control *control, uint32 &outSequenceId);
public:
- IllusionsEngine *_vm;
+ IllusionsEngine_BBDOU *_vm;
BbdouSpecialCode *_bbdou;
Control *_control;
CursorData _data;
diff --git a/engines/illusions/bbdou/bbdou_inventory.cpp b/engines/illusions/bbdou/bbdou_inventory.cpp
index 26265a706d..c2ffd99e3e 100644
--- a/engines/illusions/bbdou/bbdou_inventory.cpp
+++ b/engines/illusions/bbdou/bbdou_inventory.cpp
@@ -20,7 +20,7 @@
*
*/
-#include "illusions/illusions.h"
+#include "illusions/illusions_bbdou.h"
#include "illusions/bbdou/bbdou_inventory.h"
#include "illusions/bbdou/bbdou_cursor.h"
#include "illusions/bbdou/bbdou_specialcode.h"
@@ -49,7 +49,7 @@ InventorySlot::InventorySlot(uint32 namedPointId)
// InventoryBag
-InventoryBag::InventoryBag(IllusionsEngine *vm, uint32 sceneId)
+InventoryBag::InventoryBag(IllusionsEngine_BBDOU *vm, uint32 sceneId)
: _vm(vm), _sceneId(sceneId), _isActive(false), _fieldA(0) {
}
@@ -116,7 +116,7 @@ InventorySlot *InventoryBag::findClosestSlot(Common::Point putPos, int index) {
// BbdouInventory
-BbdouInventory::BbdouInventory(IllusionsEngine *vm, BbdouSpecialCode *bbdou)
+BbdouInventory::BbdouInventory(IllusionsEngine_BBDOU *vm, BbdouSpecialCode *bbdou)
: _vm(vm), _bbdou(bbdou) {
}
diff --git a/engines/illusions/bbdou/bbdou_inventory.h b/engines/illusions/bbdou/bbdou_inventory.h
index e4ee28fc08..27843478e9 100644
--- a/engines/illusions/bbdou/bbdou_inventory.h
+++ b/engines/illusions/bbdou/bbdou_inventory.h
@@ -29,7 +29,7 @@
namespace Illusions {
-class IllusionsEngine;
+class IllusionsEngine_BBDOU;
class BbdouSpecialCode;
class Control;
class TriggerFunction;
@@ -53,7 +53,7 @@ struct InventorySlot {
class InventoryBag {
public:
- InventoryBag(IllusionsEngine *vm, uint32 sceneId);
+ InventoryBag(IllusionsEngine_BBDOU *vm, uint32 sceneId);
void registerInventorySlot(uint32 namedPointId);
bool addInventoryItem(InventoryItem *inventoryItem, InventorySlot *inventorySlot);
void removeInventoryItem(InventoryItem *inventoryItem);
@@ -64,7 +64,7 @@ protected:
public:
typedef Common::Array<InventorySlot*> InventorySlots;
typedef InventorySlots::iterator InventorySlotsIterator;
- IllusionsEngine *_vm;
+ IllusionsEngine_BBDOU *_vm;
uint32 _sceneId;
InventorySlots _inventorySlots;
bool _isActive;
@@ -73,7 +73,7 @@ public:
class BbdouInventory {
public:
- BbdouInventory(IllusionsEngine *vm, BbdouSpecialCode *bbdou);
+ BbdouInventory(IllusionsEngine_BBDOU *vm, BbdouSpecialCode *bbdou);
void registerInventoryBag(uint32 sceneId);
void registerInventoryItem(uint32 objectId, uint32 sequenceId);
void registerInventorySlot(uint32 namedPointId);
@@ -92,7 +92,7 @@ public:
protected:
typedef Common::Array<InventoryItem*> InventoryItems;
typedef InventoryItems::iterator InventoryItemsIterator;
- IllusionsEngine *_vm;
+ IllusionsEngine_BBDOU *_vm;
BbdouSpecialCode *_bbdou;
Common::Array<InventoryBag*> _inventoryBags;
InventoryItems _inventoryItems;
diff --git a/engines/illusions/bbdou/bbdou_specialcode.cpp b/engines/illusions/bbdou/bbdou_specialcode.cpp
index f4c23bb97a..8011b3eb5d 100644
--- a/engines/illusions/bbdou/bbdou_specialcode.cpp
+++ b/engines/illusions/bbdou/bbdou_specialcode.cpp
@@ -20,7 +20,7 @@
*
*/
-#include "illusions/illusions.h"
+#include "illusions/illusions_bbdou.h"
#include "illusions/bbdou/bbdou_specialcode.h"
#include "illusions/bbdou/bbdou_bubble.h"
#include "illusions/bbdou/bbdou_inventory.h"
@@ -50,7 +50,7 @@ static const Struct10 kStruct10s[] = {
{0x1B000C, 0, 0, 0},
};
-CauseThread::CauseThread(IllusionsEngine *vm, uint32 threadId, uint32 callingThreadId,
+CauseThread::CauseThread(IllusionsEngine_BBDOU *vm, uint32 threadId, uint32 callingThreadId,
BbdouSpecialCode *bbdou, uint32 cursorObjectId, uint32 sceneId, uint32 verbId,
uint32 objectId2, uint32 objectId)
: Thread(vm, threadId, callingThreadId, 0), _bbdou(bbdou), _cursorObjectId(cursorObjectId),
@@ -70,8 +70,8 @@ void CauseThread::onTerminated() {
// BbdouSpecialCode
-BbdouSpecialCode::BbdouSpecialCode(IllusionsEngine *vm)
- : SpecialCode(vm) {
+BbdouSpecialCode::BbdouSpecialCode(IllusionsEngine_BBDOU *vm)
+ : _vm(vm) {
_bubble = new BbdouBubble(_vm, this);
_cursor = new BbdouCursor(_vm, this);
_inventory = new BbdouInventory(_vm, this);
@@ -121,11 +121,6 @@ void BbdouSpecialCode::run(uint32 specialCodeId, OpCall &opCall) {
// Special codes
-// Convenience macros
-#define ARG_SKIP(x) opCall.skip(x);
-#define ARG_INT16(name) int16 name = opCall.readSint16(); debug(1, "ARG_INT16(" #name " = %d)", name);
-#define ARG_UINT32(name) uint32 name = opCall.readUint32(); debug(1, "ARG_UINT32(" #name " = %08X)", name);
-
void BbdouSpecialCode::spcInitCursor(OpCall &opCall) {
ARG_UINT32(objectId);
ARG_UINT32(progResKeywordId);
@@ -226,7 +221,7 @@ void BbdouSpecialCode::spcRemoveInventoryItem(OpCall &opCall) {
void BbdouSpecialCode::spcHasInventoryItem(OpCall &opCall) {
ARG_UINT32(objectId);
- _vm->_scriptMan->_stack.push(_inventory->hasInventoryItem(objectId) ? 1 : 0);
+ _vm->_stack->push(_inventory->hasInventoryItem(objectId) ? 1 : 0);
debug("_inventory->hasInventoryItem(%08X) = %d", objectId, _inventory->hasInventoryItem(objectId));
}
@@ -237,7 +232,7 @@ void BbdouSpecialCode::spcCloseInventory(OpCall &opCall) {
void BbdouSpecialCode::spcIsCursorHoldingObjectId(OpCall &opCall) {
ARG_UINT32(cursorObjectId);
ARG_UINT32(objectId);
- _vm->_scriptMan->_stack.push(isHoldingObjectId(objectId) ? 1 : 0);
+ _vm->_stack->push(isHoldingObjectId(objectId) ? 1 : 0);
_vm->notifyThreadId(opCall._threadId);
}
@@ -613,7 +608,7 @@ bool BbdouSpecialCode::runCause(Control *cursorControl, CursorData &cursorData,
uint32 threadId = startCauseThread(cursorControl->_objectId, _vm->getCurrentScene(), outVerbId, outObjectId2, outObjectId);
if (cursorData._field90) {
- _vm->_scriptMan->_threads->killThread(cursorData._causeThreadId2);
+ _vm->_threads->killThread(cursorData._causeThreadId2);
cursorData._field90 = 0;
}
@@ -627,11 +622,11 @@ bool BbdouSpecialCode::runCause(Control *cursorControl, CursorData &cursorData,
}
uint32 BbdouSpecialCode::startCauseThread(uint32 cursorObjectId, uint32 sceneId, uint32 verbId, uint32 objectId2, uint32 objectId) {
- uint32 tempThreadId = _vm->_scriptMan->newTempThreadId();
+ uint32 tempThreadId = _vm->newTempThreadId();
debug(3, "Starting cause thread %08X...", tempThreadId);
CauseThread *causeThread = new CauseThread(_vm, tempThreadId, 0, this,
cursorObjectId, sceneId, verbId, objectId2, objectId);
- _vm->_scriptMan->_threads->startThread(causeThread);
+ _vm->_threads->startThread(causeThread);
causeThread->suspend();
return tempThreadId;
}
diff --git a/engines/illusions/bbdou/bbdou_specialcode.h b/engines/illusions/bbdou/bbdou_specialcode.h
index f272193bd7..b9080c9810 100644
--- a/engines/illusions/bbdou/bbdou_specialcode.h
+++ b/engines/illusions/bbdou/bbdou_specialcode.h
@@ -29,7 +29,7 @@
namespace Illusions {
-class IllusionsEngine;
+class IllusionsEngine_BBDOU;
class BbdouBubble;
class BbdouCursor;
class BbdouInventory;
@@ -49,7 +49,7 @@ struct Struct10 {
class CauseThread : public Thread {
public:
- CauseThread(IllusionsEngine *vm, uint32 threadId, uint32 callingThreadId,
+ CauseThread(IllusionsEngine_BBDOU *vm, uint32 threadId, uint32 callingThreadId,
BbdouSpecialCode *bbdou, uint32 cursorObjectId, uint32 sceneId,
uint32 verbId, uint32 objectId2, uint32 objectId);
virtual void onNotify();
@@ -65,13 +65,14 @@ public:
class BbdouSpecialCode : public SpecialCode {
public:
- BbdouSpecialCode(IllusionsEngine *vm);
+ BbdouSpecialCode(IllusionsEngine_BBDOU *vm);
virtual ~BbdouSpecialCode();
virtual void init();
virtual void run(uint32 specialCodeId, OpCall &opCall);
public:
typedef Common::HashMap<uint32, SpecialCodeFunction*> Map;
typedef Map::iterator MapIterator;
+ IllusionsEngine_BBDOU *_vm;
Map _map;
BbdouCursor *_cursor;
BbdouBubble *_bubble;