Correct dummyItems in FF and cleanup

svn-id: r22035
This commit is contained in:
Travis Howell 2006-04-19 11:54:38 +00:00
parent e97476621d
commit 18d0afaafd
5 changed files with 35 additions and 33 deletions

View File

@ -379,12 +379,12 @@ int SimonEngine::getScriptReturn() {
void SimonEngine::o_at() {
// 1: ptrA parent is
setScriptCondition(getItem1Ptr()->parent == getNextItemID());
setScriptCondition(me()->parent == getNextItemID());
}
void SimonEngine::o_notAt() {
// 2: ptrA parent is not
setScriptCondition(getItem1Ptr()->parent != getNextItemID());
setScriptCondition(me()->parent != getNextItemID());
}
void SimonEngine::o_carried() {
@ -633,7 +633,7 @@ void SimonEngine::o_random() {
void SimonEngine::o_goto() {
// 55: set itemA parent
setItemParent(getItem1Ptr(), getNextItemPtr());
setItemParent(me(), getNextItemPtr());
}
void SimonEngine::o_oset() {
@ -1030,7 +1030,7 @@ void SimonEngine::o_defObj() {
void SimonEngine::o_here() {
// 125: item is sibling with item 1
Item *item = getNextItemPtr();
setScriptCondition(getItem1Ptr()->parent == item->parent);
setScriptCondition(me()->parent == item->parent);
}
void SimonEngine::o_doClassIcons() {
@ -1340,10 +1340,10 @@ void SimonEngine::o_getDollar2() {
_objectItem = _hitAreaObjectItem;
if (_objectItem == _dummyItem2)
_objectItem = getItem1Ptr();
_objectItem = me();
if (_objectItem == _dummyItem3)
_objectItem = derefItem(getItem1Ptr()->parent);
_objectItem = derefItem(me()->parent);
if (_objectItem != NULL) {
_scriptNoun2 = _objectItem->noun;
@ -1811,7 +1811,7 @@ void SimonEngine::o3_addTextBox() {
h = getVarOrWord();
num = getVarOrByte();
if (num < _numTextBoxes)
defineBox(id, x, y, w, h, flags + (num << 8), 208, _dummyItem1);
defineBox(id, x, y, w, h, flags + (num << 8), 208, _dummyItem2);
}
void SimonEngine::o3_printLongText() {

View File

@ -34,7 +34,7 @@ void SimonEngine::checkLinkBox() { // Check for boxes spilling over to next row
if (_hyperLink != 0) {
_variableArray[52] = _textWindow->x + _textWindow->textColumn - _variableArray[50];
if (_variableArray[52] != 0) {
defineBox(_variableArray[53], _variableArray[50], _variableArray[51], _variableArray[52], 15, 145, 208, _dummyItem1);
defineBox(_variableArray[53], _variableArray[50], _variableArray[51], _variableArray[52], 15, 145, 208, _dummyItem2);
_variableArray[53]++;
}
_variableArray[50] = _textWindow->x;
@ -57,7 +57,7 @@ void SimonEngine::hyperLinkOff() {
return;
_variableArray[52] = _textWindow->x + _textWindow->textColumn - _variableArray[50];
defineBox(_variableArray[53], _variableArray[50], _variableArray[51], _variableArray[52], 15, 145, 208, _dummyItem1);
defineBox(_variableArray[53], _variableArray[50], _variableArray[51], _variableArray[52], 15, 145, 208, _dummyItem2);
_variableArray[53]++;
_hyperLink = 0;
}

View File

@ -116,7 +116,7 @@ void SimonEngine::quickLoadOrSave() {
} else {
// Redraw Inventory
mouseOff();
drawIconArray(2, getItem1Ptr(), 0, 0);
drawIconArray(2, me(), 0, 0);
mouseOn();
// Reset engine?
setBitFlag(97, true);

View File

@ -280,7 +280,7 @@ SimonEngine::SimonEngine(OSystem *syst)
_subjectItem = 0;
_objectItem = 0;
_item1 = 0;
_currentPlayer = 0;
_currentBoxNumber = 0;
_iOverflow = 0;
@ -804,15 +804,15 @@ void SimonEngine::setUserFlag(Item *item, int a, int b) {
void SimonEngine::createPlayer() {
Child *child;
_item1 = _itemArrayPtr[1];
_item1->adjective = -1;
_item1->noun = 10000;
_currentPlayer = _itemArrayPtr[1];
_currentPlayer->adjective = -1;
_currentPlayer->noun = 10000;
child = (Child *)allocateChildBlock(_item1, 3, sizeof(Child));
child = (Child *)allocateChildBlock(_currentPlayer, 3, sizeof(Child));
if (child == NULL)
error("player create failure");
setUserFlag(_item1, 0, 0);
setUserFlag(_currentPlayer, 0, 0);
}
void SimonEngine::allocateStringTable(int num) {
@ -1011,11 +1011,11 @@ Item *SimonEngine::getNextItemPtr() {
case -3:
return _objectItem;
case -5:
return getItem1Ptr();
return me();
case -7:
return getItemPtrB();
return actor();
case -9:
return derefItem(getItem1Ptr()->parent);
return derefItem(me()->parent);
default:
return derefItem(a);
}
@ -1051,20 +1051,22 @@ uint SimonEngine::getNextItemID() {
case -7:
return 0;
case -9:
return getItem1Ptr()->parent;
return me()->parent;
default:
return a;
}
}
Item *SimonEngine::getItem1Ptr() {
if (_item1)
return _item1;
Item *SimonEngine::me() {
if (_currentPlayer)
return _currentPlayer;
return _dummyItem1;
}
Item *SimonEngine::getItemPtrB() {
error("getItemPtrB: is this code ever used?");
Item *SimonEngine::actor() {
error("actor: is this code ever used?");
//if (_actorPlayer)
// return _actorPlayer;
return _dummyItem1;
}
@ -2080,18 +2082,18 @@ void SimonEngine::handleVerbClicked(uint verb) {
_objectItem = _hitAreaObjectItem;
if (_objectItem == _dummyItem2) {
_objectItem = getItem1Ptr();
_objectItem = me();
}
if (_objectItem == _dummyItem3) {
_objectItem = derefItem(getItem1Ptr()->parent);
_objectItem = derefItem(me()->parent);
}
_subjectItem = _hitAreaSubjectItem;
if (_subjectItem == _dummyItem2) {
_subjectItem = getItem1Ptr();
_subjectItem = me();
}
if (_subjectItem == _dummyItem3) {
_subjectItem = derefItem(getItem1Ptr()->parent);
_subjectItem = derefItem(me()->parent);
}
if (_subjectItem) {
@ -2817,7 +2819,7 @@ bool SimonEngine::itemIsSiblingOf(uint16 a) {
if (item == NULL)
return true;
return getItem1Ptr()->parent == item->parent;
return me()->parent == item->parent;
}
bool SimonEngine::itemIsParentOf(uint16 a, uint16 b) {

View File

@ -279,7 +279,7 @@ protected:
WindowBlock *_textWindow;
Item *_subjectItem, *_objectItem;
Item *_item1;
Item *_currentPlayer;
Item *_hitAreaObjectItem;
HitArea *_lastHitArea;
@ -522,8 +522,8 @@ protected:
Item *getNextItemPtr();
uint getNextItemID();
uint getItem1ID() {return 1;}
Item *getItem1Ptr();
Item *getItemPtrB();
Item *me();
Item *actor();
byte getByte();
int getNextWord();