aboutsummaryrefslogtreecommitdiff
path: root/engines/illusions/bbdou
diff options
context:
space:
mode:
authorjohndoe1232018-05-24 06:26:27 +1000
committerEugene Sandulenko2018-07-20 06:43:33 +0000
commit1f6aee019c85771cabddc0e807a4c2cad503cca0 (patch)
tree7dc3f09c4c49e766968c7b49915c8f05893be2a7 /engines/illusions/bbdou
parent8ca26ea2a0ed82bac3193a3a72564c7d4a820084 (diff)
downloadscummvm-rg350-1f6aee019c85771cabddc0e807a4c2cad503cca0.tar.gz
scummvm-rg350-1f6aee019c85771cabddc0e807a4c2cad503cca0.tar.bz2
scummvm-rg350-1f6aee019c85771cabddc0e807a4c2cad503cca0.zip
ILLUSIONS: BBDOU: Rename variables (bubble and special code)
(cherry picked from commit 93255ca)
Diffstat (limited to 'engines/illusions/bbdou')
-rw-r--r--engines/illusions/bbdou/bbdou_bubble.cpp209
-rw-r--r--engines/illusions/bbdou/bbdou_bubble.h43
-rw-r--r--engines/illusions/bbdou/bbdou_specialcode.cpp32
3 files changed, 141 insertions, 143 deletions
diff --git a/engines/illusions/bbdou/bbdou_bubble.cpp b/engines/illusions/bbdou/bbdou_bubble.cpp
index cba0dcc4a4..fd2585f653 100644
--- a/engines/illusions/bbdou/bbdou_bubble.cpp
+++ b/engines/illusions/bbdou/bbdou_bubble.cpp
@@ -38,7 +38,7 @@ BbdouBubble::~BbdouBubble() {
void BbdouBubble::init() {
- static const uint32 kObjectIds3[] = {
+ static const uint32 kTrailObjectIds[] = {
0x0004003B, 0x0004003C, 0x0004003D, 0x0004003E,
0x0004003F, 0x00040040, 0x00040041, 0x00040042,
0x00040043, 0x00040044, 0x00040045, 0x00040046,
@@ -49,7 +49,7 @@ void BbdouBubble::init() {
0x00040057, 0x00040058, 0x00040059, 0x0004005A
};
- static const uint32 kObjectIds2[] = {
+ static const uint32 kIconObjectIds[] = {
0x0004001B, 0x0004001C, 0x0004001D, 0x0004001E,
0x0004001F, 0x00040020, 0x00040021, 0x00040022,
0x00040023, 0x00040024, 0x00040025, 0x00040026,
@@ -60,136 +60,136 @@ void BbdouBubble::init() {
0x00040037, 0x00040038, 0x00040039, 0x0004003A
};
- _objectId1414 = 0x4005B;
- _objectId1418 = 0x4005C;
+ _bubbleObjectId1 = 0x4005B;
+ _bubbleObjectId2 = 0x4005C;
for (uint i = 0; i < 32; ++i) {
- _objectIds[i] = kObjectIds3[i];
+ _trailObjectIds[i] = kTrailObjectIds[i];
}
for (uint i = 0; i < 32; ++i) {
- _items[i]._objectId = kObjectIds2[i];
- _items[i]._enabled = 0;
- _items[i]._position.x = 0;
- _items[i]._position.y = 0;
- _items[i]._sequenceId = 0;
+ _icons[i]._objectId = kIconObjectIds[i];
+ _icons[i]._enabled = false;
+ _icons[i]._position.x = 0;
+ _icons[i]._position.y = 0;
+ _icons[i]._sequenceId = 0;
}
- _currItem0 = 0;
- _prevItem0 = 0;
- _someItem0 = 0;
- _pt1.x = 0;
- _pt1.y = 0;
- _pt2.x = 0;
- _pt2.y = 0;
+ _currBubbleStyle = 0;
+ _showingBubbleStyle = 0;
+ _hidingBubbleStyle = 0;
+ _sourcePt.x = 0;
+ _sourcePt.y = 0;
+ _destPt.x = 0;
+ _destPt.y = 0;
}
-void BbdouBubble::addItem0(uint32 sequenceId1, uint32 sequenceId2, uint32 progResKeywordId,
+void BbdouBubble::addBubbleStyle(uint32 showSequenceId, uint32 hideSequenceId, uint32 progResKeywordId,
uint32 namedPointId, int16 count, uint32 *namedPointIds) {
- Item0 item0;
- item0._sequenceId1 = sequenceId1;
- item0._sequenceId2 = sequenceId2;
- item0._progResKeywordId = progResKeywordId;
- item0._baseNamedPointId = namedPointId;
- item0._count = count;
+ BubbleStyle style;
+ style._showSequenceId = showSequenceId;
+ style._hideSequenceId = hideSequenceId;
+ style._progResKeywordId = progResKeywordId;
+ style._baseNamedPointId = namedPointId;
+ style._count = count;
for (int16 i = 0; i < count; ++i) {
- item0._namedPointIds[i] = FROM_LE_32(namedPointIds[i]);
+ style._namedPointIds[i] = FROM_LE_32(namedPointIds[i]);
}
- item0._objectId = 0;
- item0._pt.x = 0;
- item0._pt.y = 0;
- _item0s.push_back(item0);
+ style._objectId = 0;
+ style._position.x = 0;
+ style._position.y = 0;
+ _bubbleStyles.push_back(style);
}
void BbdouBubble::show() {
-
- if (_prevItem0) {
+
+ if (_showingBubbleStyle) {
hide();
}
- _prevItem0 = _currItem0;
- _currItem0 = 0;
+ _showingBubbleStyle = _currBubbleStyle;
+ _currBubbleStyle = 0;
- calcBubbles(_pt1, _pt2);
+ calcBubbleTrail(_sourcePt, _destPt);
- Control *control = _vm->_dict->getObjectControl(_prevItem0->_objectId);
- control->setActorPosition(_pt2);
- control->startSequenceActor(0x60057, 2, 0);
- control->startSequenceActor(_prevItem0->_sequenceId1, 2, 0);
- control->appearActor();
- control->deactivateObject();
+ Control *bubbleControl = _vm->_dict->getObjectControl(_showingBubbleStyle->_objectId);
+ bubbleControl->setActorPosition(_destPt);
+ bubbleControl->startSequenceActor(0x60057, 2, 0);
+ bubbleControl->startSequenceActor(_showingBubbleStyle->_showSequenceId, 2, 0);
+ bubbleControl->appearActor();
+ bubbleControl->deactivateObject();
for (uint i = 0; i < 32; ++i) {
- if (_items[i]._enabled == 1) {
- Control *subControl = _vm->_dict->getObjectControl(_items[i]._objectId);
- subControl->setActorPosition(_items[i]._position);
- subControl->startSequenceActor(_items[i]._sequenceId, 2, 0);
+ if (_icons[i]._enabled) {
+ Control *iconControl = _vm->_dict->getObjectControl(_icons[i]._objectId);
+ iconControl->setActorPosition(_icons[i]._position);
+ iconControl->startSequenceActor(_icons[i]._sequenceId, 2, 0);
}
}
}
void BbdouBubble::hide() {
- _someItem0 = _prevItem0;
- _prevItem0 = 0;
- if (_someItem0) {
- Control *control = _vm->_dict->getObjectControl(_someItem0->_objectId);
- control->startSequenceActor(_someItem0->_sequenceId2, 2, 0);
+ _hidingBubbleStyle = _showingBubbleStyle;
+ _showingBubbleStyle = 0;
+ if (_hidingBubbleStyle) {
+ Control *bubbleControl = _vm->_dict->getObjectControl(_hidingBubbleStyle->_objectId);
+ bubbleControl->startSequenceActor(_hidingBubbleStyle->_hideSequenceId, 2, 0);
for (uint i = 0; i < 32; ++i) {
- Control *subControl = _vm->_dict->getObjectControl(_objectIds[i]);
- subControl->stopActor();
- subControl->disappearActor();
+ Control *trailControl = _vm->_dict->getObjectControl(_trailObjectIds[i]);
+ trailControl->stopActor();
+ trailControl->disappearActor();
}
for (uint i = 0; i < 32; ++i) {
- Control *subControl = _vm->_dict->getObjectControl(_items[i]._objectId);
- subControl->stopActor();
- subControl->disappearActor();
+ Control *iconControl = _vm->_dict->getObjectControl(_icons[i]._objectId);
+ iconControl->stopActor();
+ iconControl->disappearActor();
}
}
}
-void BbdouBubble::setup(int16 minCount, Common::Point pt1, Common::Point pt2, uint32 progResKeywordId) {
+void BbdouBubble::selectBubbleStyle(int16 minCount, Common::Point sourcePt, Common::Point destPt, uint32 progResKeywordId) {
for (uint i = 0; i < 32; ++i) {
- _items[i]._enabled = 0;
+ _icons[i]._enabled = false;
}
int16 maxCount = 32;
- for (uint i = 0; i < _item0s.size(); ++i) {
- Item0 *item0 = &_item0s[i];
- if (item0->_count < maxCount && item0->_count >= minCount &&
- (!progResKeywordId || item0->_progResKeywordId == progResKeywordId)) {
- maxCount = item0->_count;
- _currItem0 = item0;
+ for (uint i = 0; i < _bubbleStyles.size(); ++i) {
+ BubbleStyle *style = &_bubbleStyles[i];
+ if (style->_count < maxCount && style->_count >= minCount &&
+ (progResKeywordId == 0 || progResKeywordId == style->_progResKeywordId)) {
+ maxCount = style->_count;
+ _currBubbleStyle = style;
}
}
- _pt1 = pt1;
- _pt2 = pt2;
- _currItem0->_pt = pt2;
- _currItem0->_objectId = _objectId1414;
- if (_prevItem0 && _prevItem0->_objectId == _currItem0->_objectId)
- _currItem0->_objectId = _objectId1418;
+ _sourcePt = sourcePt;
+ _destPt = destPt;
+ _currBubbleStyle->_position = destPt;
+ _currBubbleStyle->_objectId = _bubbleObjectId1;
+ if (_showingBubbleStyle && _showingBubbleStyle->_objectId == _currBubbleStyle->_objectId)
+ _currBubbleStyle->_objectId = _bubbleObjectId2;
}
-uint32 BbdouBubble::addItem(uint positionIndex, uint32 sequenceId) {
+uint32 BbdouBubble::addBubbleIcon(uint positionIndex, uint32 sequenceId) {
for (uint i = 0; i < 32; ++i) {
- Item141C *item = &_items[i];
- if (!item->_enabled) {
- Common::Point itemPos = _vm->getNamedPointPosition(_currItem0->_namedPointIds[positionIndex]);
- Common::Point basePos = _vm->getNamedPointPosition(_currItem0->_baseNamedPointId);
- item->_enabled = 1;
- item->_sequenceId = sequenceId;
- item->_position.x = itemPos.x + _currItem0->_pt.x - basePos.x;
- item->_position.y = itemPos.y + _currItem0->_pt.y - basePos.y;
- return item->_objectId;
+ BubbleIcon *icon = &_icons[i];
+ if (!icon->_enabled) {
+ Common::Point itemPos = _vm->getNamedPointPosition(_currBubbleStyle->_namedPointIds[positionIndex]);
+ Common::Point basePos = _vm->getNamedPointPosition(_currBubbleStyle->_baseNamedPointId);
+ icon->_enabled = true;
+ icon->_sequenceId = sequenceId;
+ icon->_position.x = itemPos.x + _currBubbleStyle->_position.x - basePos.x;
+ icon->_position.y = itemPos.y + _currBubbleStyle->_position.y - basePos.y;
+ return icon->_objectId;
}
}
return 0;
}
-void BbdouBubble::calcBubbles(Common::Point &pt1, Common::Point &pt2) {
+void BbdouBubble::calcBubbleTrail(Common::Point &sourcePt, Common::Point &destPt) {
const int kSequenceIdsCount = 10;
const float kDistanceBetweenPoints = 30.0;
- static const uint32 kSequenceIds[] = {
+ static const uint32 kBubbleTrailSequenceIds[] = {
0x00060042, 0x00060043, 0x00060044, 0x00060045, 0x00060046,
0x00060047, 0x00060048, 0x00060049, 0x0006004A, 0x0006004B
};
@@ -201,7 +201,7 @@ void BbdouBubble::calcBubbles(Common::Point &pt1, Common::Point &pt2) {
float currentAngle, radius;
for (int i = 0; i < 32; ++i) {
- Control *control = _vm->_dict->getObjectControl(_objectIds[i]);
+ Control *control = _vm->_dict->getObjectControl(_trailObjectIds[i]);
control->startSequenceActor(0x00060056, 2, 0);
}
@@ -209,27 +209,27 @@ void BbdouBubble::calcBubbles(Common::Point &pt1, Common::Point &pt2) {
sequenceCounters[i] = 0;
}
- if (pt2.y >= pt1.y) {
+ if (destPt.y >= sourcePt.y) {
swapY = true;
- if (pt1.x == pt2.x)
- pt2.x = pt2.x + 20;
+ if (sourcePt.x == destPt.x)
+ destPt.x = destPt.x + 20;
} else {
swapY = false;
- if (pt1.y == pt2.y)
- pt2.y = pt2.y + 20;
+ if (sourcePt.y == destPt.y)
+ destPt.y = destPt.y + 20;
}
if (swapY) {
- centerX = (pt2.x * pt2.x - (pt2.y - pt1.y) * (pt2.y - pt1.y) - pt1.x * pt1.x) / (2 * (pt2.x - pt1.x));
- centerY = pt2.y;
- radius = ABS(pt2.x - centerX);
+ centerX = (destPt.x * destPt.x - (destPt.y - sourcePt.y) * (destPt.y - sourcePt.y) - sourcePt.x * sourcePt.x) / (2 * (destPt.x - sourcePt.x));
+ centerY = destPt.y;
+ radius = ABS(destPt.x - centerX);
} else {
- centerX = pt2.x;
- centerY = (pt2.y * pt2.y - (pt2.x - pt1.x) * (pt2.x - pt1.x) - pt1.y * pt1.y) / (2 * (pt2.y - pt1.y));
- radius = ABS(pt2.y - centerY);
+ centerX = destPt.x;
+ centerY = (destPt.y * destPt.y - (destPt.x - sourcePt.x) * (destPt.x - sourcePt.x) - sourcePt.y * sourcePt.y) / (2 * (destPt.y - sourcePt.y));
+ radius = ABS(destPt.y - centerY);
}
- const float fullDistance = sqrt((pt2.y - pt1.y) * (pt2.y - pt1.y) + (pt2.x - pt1.x) * (pt2.x - pt1.x));
+ const float fullDistance = sqrt((destPt.y - sourcePt.y) * (destPt.y - sourcePt.y) + (destPt.x - sourcePt.x) * (destPt.x - sourcePt.x));
const float arcAngle = 2 * asin(CLIP(0.5 * fullDistance / radius, -1.0, 1.0));
const float arcLength = arcAngle * radius;
int pointsCount = (int)(arcLength / kDistanceBetweenPoints);
@@ -240,26 +240,25 @@ void BbdouBubble::calcBubbles(Common::Point &pt1, Common::Point &pt2) {
}
if (!swapY) {
- if (pt2.y < pt1.y) {
+ if (destPt.y < sourcePt.y) {
currentAngle = M_PI * 0.5;
} else {
currentAngle = M_PI * 1.5;
partAngle = -partAngle;
}
- if (pt2.x < pt1.x)
+ if (destPt.x < sourcePt.x)
partAngle = -partAngle;
} else {
- if (pt2.x <= pt1.x) {
+ if (destPt.x <= sourcePt.x) {
currentAngle = M_PI;
} else {
currentAngle = 0.0;
partAngle = -partAngle;
}
- if (pt2.y > pt1.y)
+ if (destPt.y > sourcePt.y)
partAngle = -partAngle;
}
- int index = kSequenceIdsCount - 1;
float angleStep = partAngle / (float)pointsCount * 0.5;
float angleIncr = (float)(pointsCount / 2) * angleStep + partAngle;
@@ -275,15 +274,15 @@ void BbdouBubble::calcBubbles(Common::Point &pt1, Common::Point &pt2) {
centerX + _vm->getRandom(8) - 2 + (int)(cos(currentAngle) * radius),
centerY + _vm->getRandom(8) - 2 - (int)(sin(currentAngle) * radius));
- Control *control = _vm->_dict->getObjectControl(_objectIds[i]);
+ Control *trailControl = _vm->_dict->getObjectControl(_trailObjectIds[i]);
- for (; index >= 0; --index) {
+ for (int index = kSequenceIdsCount - 1; index >= 0; --index) {
if (sequenceCounters[index] > 0) {
--sequenceCounters[index];
- control->setActorPosition(newPoint);
- control->startSequenceActor(kSequenceIds[index], 2, 0);
- control->appearActor();
- control->deactivateObject();
+ trailControl->setActorPosition(newPoint);
+ trailControl->startSequenceActor(kBubbleTrailSequenceIds[index], 2, 0);
+ trailControl->appearActor();
+ trailControl->deactivateObject();
break;
}
}
diff --git a/engines/illusions/bbdou/bbdou_bubble.h b/engines/illusions/bbdou/bbdou_bubble.h
index f42ff6ea9d..fbfe726b7d 100644
--- a/engines/illusions/bbdou/bbdou_bubble.h
+++ b/engines/illusions/bbdou/bbdou_bubble.h
@@ -32,23 +32,22 @@ class IllusionsEngine_BBDOU;
class BbdouSpecialCode;
class Control;
-struct Item0 {
- uint32 _sequenceId1;
- uint32 _sequenceId2;
+struct BubbleStyle {
+ uint32 _showSequenceId;
+ uint32 _hideSequenceId;
int16 _count;
uint32 _progResKeywordId;
uint32 _baseNamedPointId;
uint32 _namedPointIds[32];
uint32 _objectId;
- Common::Point _pt;
- Item0() : _count(0) {}
+ Common::Point _position;
+ BubbleStyle() : _count(0) {}
};
-struct Item141C {
+struct BubbleIcon {
uint32 _objectId;
- int16 _enabled;
+ bool _enabled;
Common::Point _position;
- int16 _fieldA;
uint32 _sequenceId;
};
@@ -57,26 +56,26 @@ public:
BbdouBubble(IllusionsEngine_BBDOU *vm, BbdouSpecialCode *bbdou);
~BbdouBubble();
void init();
- void addItem0(uint32 sequenceId1, uint32 sequenceId2, uint32 progResKeywordId,
+ void addBubbleStyle(uint32 showSequenceId, uint32 hideSequenceId, uint32 progResKeywordId,
uint32 namedPointId, int16 count, uint32 *namedPointIds);
void show();
void hide();
- void setup(int16 minCount, Common::Point pt1, Common::Point pt2, uint32 progResKeywordId);
- uint32 addItem(uint positionIndex, uint32 sequenceId);
- void calcBubbles(Common::Point &pt1, Common::Point &pt2);
+ void selectBubbleStyle(int16 minCount, Common::Point sourcePt, Common::Point destPt, uint32 progResKeywordId);
+ uint32 addBubbleIcon(uint positionIndex, uint32 sequenceId);
+ void calcBubbleTrail(Common::Point &sourcePt, Common::Point &destPt);
protected:
IllusionsEngine_BBDOU *_vm;
BbdouSpecialCode *_bbdou;
- Common::Array<Item0> _item0s;
- Item0 *_currItem0;
- Item0 *_prevItem0;
- Item0 *_someItem0;
- uint32 _objectIds[32];
- Common::Point _pt1;
- Common::Point _pt2;
- int _objectId1414;
- int _objectId1418;
- Item141C _items[32];
+ Common::Array<BubbleStyle> _bubbleStyles;
+ BubbleStyle *_currBubbleStyle;
+ BubbleStyle *_showingBubbleStyle;
+ BubbleStyle *_hidingBubbleStyle;
+ uint32 _trailObjectIds[32];
+ Common::Point _sourcePt;
+ Common::Point _destPt;
+ int _bubbleObjectId1;
+ int _bubbleObjectId2;
+ BubbleIcon _icons[32];
};
} // End of namespace Illusions
diff --git a/engines/illusions/bbdou/bbdou_specialcode.cpp b/engines/illusions/bbdou/bbdou_specialcode.cpp
index 8614fb68a9..9bdab0c875 100644
--- a/engines/illusions/bbdou/bbdou_specialcode.cpp
+++ b/engines/illusions/bbdou/bbdou_specialcode.cpp
@@ -38,13 +38,13 @@
namespace Illusions {
-static const Struct10 kStruct10s[] = {
+static const Struct10 kVerbIconSequenceIds[] = {
{0x1B0000, 0, 0, 0},
- {0x1B0001, 0x6001A, 0x6001B, 0x6001C},
- {0x1B0002, 0x6001D, 0x6001E, 0x6001F},
- {0x1B0003, 0x60020, 0x60021, 0x60022},
- {0x1B0004, 0x60023, 0x60024, 0x60025},
- {0x1B0005, 0x60026, 0x60027, 0x60028},
+ {0x1B0001, 0x6001A, 0x6001B, 0x6001C}, // TALK, LOOK
+ {0x1B0002, 0x6001D, 0x6001E, 0x6001F}, // USE, LOOK
+ {0x1B0003, 0x60020, 0x60021, 0x60022}, // USE
+ {0x1B0004, 0x60023, 0x60024, 0x60025}, // USE, LOOK
+ {0x1B0005, 0x60026, 0x60027, 0x60028}, // TALK, LOOK
{0x1B0006, 0, 0, 0},
{0x1B0007, 0, 0, 0},
{0x1B0008, 0, 0, 0},
@@ -296,7 +296,7 @@ void BbdouSpecialCode::spcSetupBubble(OpCall &opCall) {
ARG_UINT32(progResKeywordId);
ARG_UINT32(namedPointId);
ARG_INT16(count);
- _bubble->addItem0(sequenceId1, sequenceId2, progResKeywordId, namedPointId,
+ _bubble->addBubbleStyle(sequenceId1, sequenceId2, progResKeywordId, namedPointId,
count, (uint32*)opCall._code);
_vm->notifyThreadId(opCall._threadId);
}
@@ -552,7 +552,7 @@ void BbdouSpecialCode::showBubble(uint32 objectId, uint32 overlappedObjectId, ui
VerbState *verbState, uint32 progResKeywordId) {
Common::Rect collisionRect;
- Control *overlappedControl, *control2, *control3;
+ Control *overlappedControl, *control2;
Common::Point bubbleSourcePt(320, 240), bubbleDestPt, currPan;
overlappedControl = _vm->_dict->getObjectControl(overlappedObjectId);
@@ -574,10 +574,10 @@ void BbdouSpecialCode::showBubble(uint32 objectId, uint32 overlappedObjectId, ui
bubbleSourcePt.y += 80;
}
- _bubble->setup(1, bubbleSourcePt, bubbleDestPt, progResKeywordId);
+ _bubble->selectBubbleStyle(1, bubbleSourcePt, bubbleDestPt, progResKeywordId);
- verbState->_objectIds[0] = _bubble->addItem(0, 0x6005A);
- verbState->_objectIds[1] = _bubble->addItem(0, 0x6005A);
+ verbState->_objectIds[0] = _bubble->addBubbleIcon(0, 0x6005A);
+ verbState->_objectIds[1] = _bubble->addBubbleIcon(0, 0x6005A);
verbState->_index = 0;
int value = _objectInteractModeMap.getObjectInteractMode(overlappedControl->_objectId);
@@ -591,13 +591,13 @@ void BbdouSpecialCode::showBubble(uint32 objectId, uint32 overlappedObjectId, ui
verbState->_verbId = 0x1B0002;
}
- uint32 sequenceId = kStruct10s[verbState->_verbId & 0xFFFF]._sequenceId2;
_bubble->show();
- control3 = _vm->_dict->getObjectControl(verbState->_objectIds[0]);
- control3->startSequenceActor(sequenceId, 2, 0);
- control3->appearActor();
- control3->deactivateObject();
+ Control *verbIconControl = _vm->_dict->getObjectControl(verbState->_objectIds[0]);
+ uint32 sequenceId = kVerbIconSequenceIds[verbState->_verbId & 0xFFFF]._sequenceId2;
+ verbIconControl->startSequenceActor(sequenceId, 2, 0);
+ verbIconControl->appearActor();
+ verbIconControl->deactivateObject();
verbState->_isBubbleVisible = true;
_vm->_input->discardAllEvents();