svn-id: r18929
This commit is contained in:
Travis Howell 2005-10-03 14:08:07 +00:00
parent ff6814f19b
commit efa1c13064
6 changed files with 38 additions and 39 deletions

View file

@ -54,11 +54,10 @@ struct Item {
uint16 parent;
uint16 child;
uint16 sibling;
int16 unk1;
int16 unk2;
int16 unk3; /* signed int */
uint16 unk4;
uint16 xxx_1; /* unused? */
int16 noun;
int16 adjective;
int16 state; /* signed int */
uint16 classFlags;
Child *children;
Item() { memset(this, 0, sizeof(*this)); }

View file

@ -159,9 +159,9 @@ int SimonEngine::runScript() {
}
break;
case 27:{ /* item unk3 is */
case 27:{ /* item state is */
Item *item = getNextItemPtr();
condition = ((uint) item->unk3 == getVarOrWord());
condition = ((uint) item->state == getVarOrWord());
}
break;
@ -311,28 +311,28 @@ int SimonEngine::runScript() {
}
break;
case 59:{ /* item inc unk3 */
case 59:{ /* item inc state */
Item *item = getNextItemPtr();
if (item->unk3 <= 30000)
setItemUnk3(item, item->unk3 + 1);
if (item->state <= 30000)
setItemState(item, item->state + 1);
}
break;
case 60:{ /* item dec unk3 */
case 60:{ /* item dec state */
Item *item = getNextItemPtr();
if (item->unk3 >= 0)
setItemUnk3(item, item->unk3 - 1);
if (item->state >= 0)
setItemState(item, item->state - 1);
}
break;
case 61:{ /* item set unk3 */
case 61:{ /* item set state */
Item *item = getNextItemPtr();
int value = getVarOrWord();
if (value < 0)
value = 0;
if (value > 30000)
value = 30000;
setItemUnk3(item, value);
setItemState(item, value);
}
break;
@ -653,19 +653,19 @@ int SimonEngine::runScript() {
case 115:{ /* item has flag */
Item *item = getNextItemPtr();
condition = (item->unk4 & (1 << getVarOrByte())) != 0;
condition = (item->classFlags & (1 << getVarOrByte())) != 0;
}
break;
case 116:{ /* item set flag */
Item *item = getNextItemPtr();
item->unk4 |= (1 << getVarOrByte());
item->classFlags |= (1 << getVarOrByte());
}
break;
case 117:{ /* item clear flag */
Item *item = getNextItemPtr();
item->unk4 &= ~(1 << getVarOrByte());
item->classFlags &= ~(1 << getVarOrByte());
}
break;
@ -761,7 +761,7 @@ int SimonEngine::runScript() {
case 136:{ /* set var to item unk3 */
Item *item = getNextItemPtr();
writeNextVarContents(item->unk3);
writeNextVarContents(item->state);
}
break;
@ -918,7 +918,7 @@ int SimonEngine::runScript() {
case 165:{ /* item unk1 unk2 is */
Item *item = getNextItemPtr();
int16 a = getNextWord(), b = getNextWord();
condition = (item->unk2 == a && item->unk1 == b);
condition = (item->adjective == a && item->noun == b);
} break;
case 166:{ /* set bit2 */

View file

@ -181,14 +181,14 @@ void SimonEngine::readGamePcText(Common::File *in) {
void SimonEngine::readItemFromGamePc(Common::File *in, Item *item) {
uint32 type;
item->unk2 = in->readUint16BE();
item->unk1 = in->readUint16BE();
item->unk3 = in->readUint16BE();
item->adjective = in->readUint16BE();
item->noun = in->readUint16BE();
item->state = in->readUint16BE();
item->sibling = (uint16)fileReadItemID(in);
item->child = (uint16)fileReadItemID(in);
item->parent = (uint16)fileReadItemID(in);
in->readUint16BE();
item->unk4 = in->readUint16BE();
item->classFlags = in->readUint16BE();
item->children = NULL;
type = in->readUint32BE();

View file

@ -435,8 +435,8 @@ bool SimonEngine::save_game(uint slot, char *caption) {
f->writeUint16BE(item->parent);
f->writeUint16BE(item->sibling);
f->writeUint16BE(item->unk3);
f->writeUint16BE(item->unk4);
f->writeUint16BE(item->state);
f->writeUint16BE(item->classFlags);
Child1 *child1 = (Child1 *)findChildOfType(item, 1);
if (child1) {
@ -547,8 +547,8 @@ bool SimonEngine::load_game(uint slot) {
item->sibling = sibling;
}
item->unk3 = f->readUint16BE();
item->unk4 = f->readUint16BE();
item->state = f->readUint16BE();
item->classFlags = f->readUint16BE();
Child1 *child1 = (Child1 *)findChildOfType(item, 1);
if (child1 != NULL) {

View file

@ -882,8 +882,8 @@ void SimonEngine::loginPlayer() {
Child *child;
_item1 = _itemArrayPtr[1];
_item1->unk2 = -1;
_item1->unk1 = 10000;
_item1->adjective = -1;
_item1->noun = 10000;
child = (Child *)allocateChildBlock(_item1, 3, sizeof(Child));
if (child == NULL)
@ -1050,8 +1050,8 @@ void SimonEngine::allocTablesHeap() {
_tablesHeapPtr = (byte *)calloc(TABLES_MEM_SIZE, 1);
}
void SimonEngine::setItemUnk3(Item *item, int value) {
item->unk3 = value;
void SimonEngine::setItemState(Item *item, int value) {
item->state = value;
}
int SimonEngine::getNextWord() {
@ -1625,7 +1625,7 @@ void SimonEngine::o_setup_cond_c() {
_objectItem = derefItem(getItem1Ptr()->parent);
if (_objectItem != NULL) {
_scriptCondC = _objectItem->unk1;
_scriptCondC = _objectItem->noun;
} else {
_scriptCondC = -1;
}
@ -1829,7 +1829,7 @@ void SimonEngine::fcs_unk_proc_1(uint fcs_index, Item *item_ptr, int unk1, int u
while (item_ptr && unk1-- != 0) {
num_sibs_with_flag = 0;
while (item_ptr && width_div_3 > num_sibs_with_flag) {
if ((unk2 == 0 || item_ptr->unk4 & unk2) && has_item_childflag_0x10(item_ptr))
if ((unk2 == 0 || item_ptr->classFlags & unk2) && has_item_childflag_0x10(item_ptr))
if (!(_game & GF_SIMON2)) {
num_sibs_with_flag++;
} else {
@ -1851,7 +1851,7 @@ void SimonEngine::fcs_unk_proc_1(uint fcs_index, Item *item_ptr, int unk1, int u
j = 0;
while (item_ptr) {
if ((unk2 == 0 || item_ptr->unk4 & unk2) && has_item_childflag_0x10(item_ptr)) {
if ((unk2 == 0 || item_ptr->classFlags & unk2) && has_item_childflag_0x10(item_ptr)) {
if (item_again == false) {
fcs_ptr->fcs_data->e[k].item = item_ptr;
if (!(_game & GF_SIMON2)) {
@ -2240,13 +2240,13 @@ void SimonEngine::handle_verb_clicked(uint verb) {
}
if (_subjectItem) {
_scriptCondB = _subjectItem->unk1;
_scriptCondB = _subjectItem->noun;
} else {
_scriptCondB = -1;
}
if (_objectItem) {
_scriptCondC = _objectItem->unk1;
_scriptCondC = _objectItem->noun;
} else {
_scriptCondC = -1;
}
@ -2981,7 +2981,7 @@ bool SimonEngine::vc_maybe_skip_proc_1(uint16 a, int16 b) {
item = _vcItemArray[a];
if (item == NULL)
return true;
return item->unk3 == b;
return item->state == b;
}
// OK

View file

@ -442,7 +442,7 @@ protected:
uint itemPtrToID(Item *id);
Item *derefItem(uint item);
void setItemUnk3(Item *item, int value);
void setItemState(Item *item, int value);
void showMessageFormat(const char *s, ...);
const byte *getStringPtrByID(uint string_id);