Rename structures and correct array sizes
svn-id: r21641
This commit is contained in:
parent
87de34a8d5
commit
dc73f361e1
8 changed files with 194 additions and 169 deletions
|
@ -434,7 +434,7 @@ void SimonEngine::setArrowHitAreas(WindowBlock *window, uint num) {
|
|||
ha->y = 279;
|
||||
ha->width = 30;
|
||||
ha->height = 45;
|
||||
ha->flags = 0x24;
|
||||
ha->flags = kBFBoxInUse | kBFNoTouchName;
|
||||
ha->id = 0x7FFB;
|
||||
ha->priority = 100;
|
||||
ha->window = window;
|
||||
|
@ -444,7 +444,7 @@ void SimonEngine::setArrowHitAreas(WindowBlock *window, uint num) {
|
|||
ha->y = 158;
|
||||
ha->width = 12;
|
||||
ha->height = 26;
|
||||
ha->flags = 36;
|
||||
ha->flags = kBFBoxInUse | kBFNoTouchName;
|
||||
ha->id = 0x7FFB;
|
||||
ha->priority = 100;
|
||||
ha->window = window;
|
||||
|
@ -454,7 +454,7 @@ void SimonEngine::setArrowHitAreas(WindowBlock *window, uint num) {
|
|||
ha->y = 149;
|
||||
ha->width = 12;
|
||||
ha->height = 17;
|
||||
ha->flags = 0x24;
|
||||
ha->flags = kBFBoxInUse | kBFNoTouchName;
|
||||
ha->id = 0x7FFB;
|
||||
ha->priority = 100;
|
||||
ha->window = window;
|
||||
|
@ -469,7 +469,7 @@ void SimonEngine::setArrowHitAreas(WindowBlock *window, uint num) {
|
|||
ha->y = 324;
|
||||
ha->width = 30;
|
||||
ha->height = 44;
|
||||
ha->flags = 0x24;
|
||||
ha->flags = kBFBoxInUse | kBFNoTouchName;
|
||||
ha->id = 0x7FFC;
|
||||
ha->priority = 100;
|
||||
ha->window = window;
|
||||
|
@ -479,7 +479,7 @@ void SimonEngine::setArrowHitAreas(WindowBlock *window, uint num) {
|
|||
ha->y = 162;
|
||||
ha->width = 12;
|
||||
ha->height = 26;
|
||||
ha->flags = 36;
|
||||
ha->flags = kBFBoxInUse | kBFNoTouchName;
|
||||
ha->id = 0x7FFC;
|
||||
ha->priority = 100;
|
||||
ha->window = window;
|
||||
|
@ -489,7 +489,7 @@ void SimonEngine::setArrowHitAreas(WindowBlock *window, uint num) {
|
|||
ha->y = 176;
|
||||
ha->width = 12;
|
||||
ha->height = 17;
|
||||
ha->flags = 0x24;
|
||||
ha->flags = kBFBoxInUse | kBFNoTouchName;
|
||||
ha->id = 0x7FFC;
|
||||
ha->priority = 100;
|
||||
ha->window = window;
|
||||
|
@ -511,7 +511,7 @@ uint SimonEngine::setupIconHitArea(WindowBlock *window, uint num, uint x, uint y
|
|||
ha->item_ptr = item_ptr;
|
||||
ha->width = 45;
|
||||
ha->height = 44;
|
||||
ha->flags = 0xA0;
|
||||
ha->flags = kBFBoxInUse | kBFBoxItem;
|
||||
ha->id = num;
|
||||
ha->priority = 100;
|
||||
ha->verb = 208;
|
||||
|
@ -521,7 +521,7 @@ uint SimonEngine::setupIconHitArea(WindowBlock *window, uint num, uint x, uint y
|
|||
ha->item_ptr = item_ptr;
|
||||
ha->width = 20;
|
||||
ha->height = 20;
|
||||
ha->flags = 0xB0;
|
||||
ha->flags = kBFDragBox | kBFBoxInUse | kBFBoxItem;
|
||||
ha->id = 0x7FFD;
|
||||
ha->priority = 100;
|
||||
ha->verb = 208;
|
||||
|
@ -531,7 +531,7 @@ uint SimonEngine::setupIconHitArea(WindowBlock *window, uint num, uint x, uint y
|
|||
ha->item_ptr = item_ptr;
|
||||
ha->width = 24;
|
||||
ha->height = 24;
|
||||
ha->flags = 0xB0;
|
||||
ha->flags = kBFDragBox | kBFBoxInUse | kBFBoxItem;
|
||||
ha->id = 0x7FFD;
|
||||
ha->priority = 100;
|
||||
ha->verb = 208;
|
||||
|
|
|
@ -30,25 +30,25 @@ struct Child {
|
|||
uint16 type;
|
||||
};
|
||||
|
||||
struct Child1 : Child {
|
||||
struct SubRoom : Child {
|
||||
uint16 subroutine_id;
|
||||
uint16 fr2;
|
||||
uint16 array[1];
|
||||
uint16 roomExitStates;
|
||||
uint16 roomExit[6];
|
||||
};
|
||||
|
||||
struct Child2 : Child {
|
||||
uint16 string_id;
|
||||
uint32 avail_props;
|
||||
int16 array[1];
|
||||
struct SubObject : Child {
|
||||
uint16 objectName;
|
||||
uint32 objectFlags;
|
||||
int16 objectFlagValue[16];
|
||||
};
|
||||
|
||||
struct Child9 : Child {
|
||||
uint16 array[4];
|
||||
struct SubUserFlag : Child {
|
||||
uint16 userFlags[4];
|
||||
};
|
||||
|
||||
enum {
|
||||
CHILD1_SIZE = sizeof(Child1) - sizeof(uint16),
|
||||
CHILD2_SIZE = sizeof(Child2) - sizeof(int16)
|
||||
SubRoom_SIZE = sizeof(SubRoom) - sizeof(uint16),
|
||||
SubObject_SIZE = sizeof(SubObject) - sizeof(int16)
|
||||
};
|
||||
|
||||
struct Item {
|
||||
|
@ -100,6 +100,31 @@ struct WindowBlock {
|
|||
// the actual y-coordinate is: textRow * 8
|
||||
|
||||
|
||||
enum BoxFlags {
|
||||
kBFTextBox = 0x1,
|
||||
kBFBoxSelected = 0x2,
|
||||
kBFNoTouchName = 0x4,
|
||||
kBFInvertTouch = 0x8,
|
||||
kBFDragBox = 0x10, // Simon 1/2
|
||||
kBFHyperBox = 0x10, // Feeble Files
|
||||
kBFBoxInUse = 0x20,
|
||||
kBFBoxDead = 0x40,
|
||||
kBFBoxItem = 0x80
|
||||
};
|
||||
|
||||
enum SubObjectFlags {
|
||||
kOFText = 0x1,
|
||||
kOFSize = 0x2,
|
||||
kOFWeight = 0x4,
|
||||
kOFVolume = 0x8,
|
||||
kOFIcon = 0x10,
|
||||
kOFKeyColor1 = 0x20,
|
||||
kOFKeyColor2 = 0x40,
|
||||
kOFMenu = 0x80,
|
||||
kOFNumber = 0x100,
|
||||
kOFVoice = 0x200
|
||||
};
|
||||
|
||||
enum {
|
||||
SUBROUTINE_LINE_SMALL_SIZE = 2,
|
||||
SUBROUTINE_LINE_BIG_SIZE = 8
|
||||
|
|
|
@ -167,9 +167,9 @@ int SimonEngine::runScript() {
|
|||
break;
|
||||
|
||||
case 28:{ /* item has prop */
|
||||
Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
|
||||
SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
|
||||
byte num = getVarOrByte();
|
||||
condition = child != NULL && (child->avail_props & (1 << num)) != 0;
|
||||
condition = subObject != NULL && (subObject->objectFlags & (1 << num)) != 0;
|
||||
} break;
|
||||
|
||||
case 31:{ /* set no parent */
|
||||
|
@ -300,18 +300,18 @@ int SimonEngine::runScript() {
|
|||
break;
|
||||
|
||||
case 56:{ /* set child2 fr bit */
|
||||
Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
|
||||
SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
|
||||
int value = getVarOrByte();
|
||||
if (child != NULL && value >= 0x10)
|
||||
child->avail_props |= 1 << value;
|
||||
if (subObject != NULL && value >= 0x10)
|
||||
subObject->objectFlags |= 1 << value;
|
||||
}
|
||||
break;
|
||||
|
||||
case 57:{ /* clear child2 fr bit */
|
||||
Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
|
||||
SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
|
||||
int value = getVarOrByte();
|
||||
if (child != NULL && value >= 0x10)
|
||||
child->avail_props &= ~(1 << value);
|
||||
if (subObject != NULL && value >= 0x10)
|
||||
subObject->objectFlags &= ~(1 << value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -375,24 +375,24 @@ int SimonEngine::runScript() {
|
|||
|
||||
case 66:{ /* set item name */
|
||||
uint var = getVarOrByte();
|
||||
uint string_id = getNextStringID();
|
||||
uint stringId = getNextStringID();
|
||||
if (var < 20)
|
||||
_stringIdArray2[var] = string_id;
|
||||
_stringIdArray2[var] = stringId;
|
||||
}
|
||||
break;
|
||||
|
||||
case 67:{ /* set item description */
|
||||
uint var = getVarOrByte();
|
||||
uint string_id = getNextStringID();
|
||||
uint stringId = getNextStringID();
|
||||
if (getFeatures() & GF_TALKIE) {
|
||||
uint speechId = getNextWord();
|
||||
if (var < 20) {
|
||||
_stringIdArray3[var] = string_id;
|
||||
_stringIdArray3[var] = stringId;
|
||||
_speechIdArray4[var] = speechId;
|
||||
}
|
||||
} else {
|
||||
if (var < 20) {
|
||||
_stringIdArray3[var] = string_id;
|
||||
_stringIdArray3[var] = stringId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -442,9 +442,9 @@ int SimonEngine::runScript() {
|
|||
break;
|
||||
|
||||
case 79:{ /* childstruct fr2 is */
|
||||
Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
|
||||
uint string_id = getNextStringID();
|
||||
condition = (child != NULL) && child->string_id == string_id;
|
||||
SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
|
||||
uint stringId = getNextStringID();
|
||||
condition = (subObject != NULL) && subObject->objectName == stringId;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -862,9 +862,9 @@ int SimonEngine::runScript() {
|
|||
break;
|
||||
|
||||
case 143:{ /* start item sub */
|
||||
Child1 *child = (Child1 *)findChildOfType(getNextItemPtr(), 1);
|
||||
if (child != NULL) {
|
||||
Subroutine *sub = getSubroutineByID(child->subroutine_id);
|
||||
SubRoom *subRoom = (SubRoom *)findChildOfType(getNextItemPtr(), 1);
|
||||
if (subRoom != NULL) {
|
||||
Subroutine *sub = getSubroutineByID(subRoom->subroutine_id);
|
||||
if (sub)
|
||||
startSubroutine(sub);
|
||||
}
|
||||
|
@ -915,12 +915,12 @@ int SimonEngine::runScript() {
|
|||
|
||||
case 157:{ /* get item int prop */
|
||||
Item *item = getNextItemPtr();
|
||||
Child2 *child = (Child2 *)findChildOfType(item, 2);
|
||||
SubObject *subObject = (SubObject *)findChildOfType(item, 2);
|
||||
uint prop = getVarOrByte();
|
||||
|
||||
if (child != NULL && child->avail_props & (1 << prop) && prop < 16) {
|
||||
uint offs = getOffsetOfChild2Param(child, 1 << prop);
|
||||
writeNextVarContents(child->array[offs]);
|
||||
if (subObject != NULL && subObject->objectFlags & (1 << prop) && prop < 16) {
|
||||
uint offs = getOffsetOfChild2Param(subObject, 1 << prop);
|
||||
writeNextVarContents(subObject->objectFlagValue[offs]);
|
||||
} else {
|
||||
writeNextVarContents(0);
|
||||
}
|
||||
|
@ -929,13 +929,13 @@ int SimonEngine::runScript() {
|
|||
|
||||
case 158:{ /* set item prop */
|
||||
Item *item = getNextItemPtr();
|
||||
Child2 *child = (Child2 *)findChildOfType(item, 2);
|
||||
SubObject *subObject = (SubObject *)findChildOfType(item, 2);
|
||||
uint prop = getVarOrByte();
|
||||
int value = getVarOrWord();
|
||||
|
||||
if (child != NULL && child->avail_props & (1 << prop) && prop < 16) {
|
||||
uint offs = getOffsetOfChild2Param(child, 1 << prop);
|
||||
child->array[offs] = value;
|
||||
if (subObject != NULL && subObject->objectFlags & (1 << prop) && prop < 16) {
|
||||
uint offs = getOffsetOfChild2Param(subObject, 1 << prop);
|
||||
subObject->objectFlagValue[offs] = value;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1048,13 +1048,13 @@ int SimonEngine::runScript() {
|
|||
case 179:{ /* conversation responses */
|
||||
uint vgaSpriteId = getVarOrByte(); /* and room descriptions */
|
||||
uint color = getVarOrByte();
|
||||
uint string_id = getVarOrByte();
|
||||
uint stringId = getVarOrByte();
|
||||
uint speechId = 0;
|
||||
|
||||
const char *string_ptr = (const char *)getStringPtrByID(_stringIdArray3[string_id]);
|
||||
const char *string_ptr = (const char *)getStringPtrByID(_stringIdArray3[stringId]);
|
||||
TextLocation *tl = getTextLocation(vgaSpriteId);
|
||||
if (getFeatures() & GF_TALKIE)
|
||||
speechId = _speechIdArray4[string_id];
|
||||
speechId = _speechIdArray4[stringId];
|
||||
|
||||
if (_speech && speechId != 0)
|
||||
playSpeech(speechId, vgaSpriteId);
|
||||
|
@ -1377,18 +1377,18 @@ void SimonEngine::o_inventory_descriptions() {
|
|||
TextLocation *tl = NULL;
|
||||
char buf[256];
|
||||
|
||||
Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
|
||||
if (child != NULL && child->avail_props & 1) {
|
||||
string_ptr = (const char *)getStringPtrByID(child->array[0]);
|
||||
SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
|
||||
if (subObject != NULL && subObject->objectFlags & kOFText) {
|
||||
string_ptr = (const char *)getStringPtrByID(subObject->objectFlagValue[0]);
|
||||
tl = getTextLocation(vgaSpriteId);
|
||||
}
|
||||
|
||||
if ((getGameType() == GType_SIMON2) && (getFeatures() & GF_TALKIE)) {
|
||||
if (child != NULL && child->avail_props & 0x200) {
|
||||
uint speechId = child->array[getOffsetOfChild2Param(child, 0x200)];
|
||||
if (subObject != NULL && subObject->objectFlags & kOFVoice) {
|
||||
uint speechId = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFVoice)];
|
||||
|
||||
if (child->avail_props & 0x100) {
|
||||
uint speechIdOffs = child->array[getOffsetOfChild2Param(child, 0x100)];
|
||||
if (subObject->objectFlags & kOFNumber) {
|
||||
uint speechIdOffs = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)];
|
||||
|
||||
if (speechId == 116)
|
||||
speechId = speechIdOffs + 115;
|
||||
|
@ -1436,18 +1436,18 @@ void SimonEngine::o_inventory_descriptions() {
|
|||
}
|
||||
|
||||
} else if (getFeatures() & GF_TALKIE) {
|
||||
if (child != NULL && child->avail_props & 0x200) {
|
||||
uint offs = getOffsetOfChild2Param(child, 0x200);
|
||||
playSpeech(child->array[offs], vgaSpriteId);
|
||||
} else if (child != NULL && child->avail_props & 0x100) {
|
||||
uint offs = getOffsetOfChild2Param(child, 0x100);
|
||||
playSpeech(child->array[offs] + 3550, vgaSpriteId);
|
||||
if (subObject != NULL && subObject->objectFlags & kOFVoice) {
|
||||
uint offs = getOffsetOfChild2Param(subObject, kOFVoice);
|
||||
playSpeech(subObject->objectFlagValue[offs], vgaSpriteId);
|
||||
} else if (subObject != NULL && subObject->objectFlags & kOFNumber) {
|
||||
uint offs = getOffsetOfChild2Param(subObject, kOFNumber);
|
||||
playSpeech(subObject->objectFlagValue[offs] + 3550, vgaSpriteId);
|
||||
}
|
||||
}
|
||||
|
||||
if (child != NULL && (child->avail_props & 1) && _subtitles) {
|
||||
if (child->avail_props & 0x100) {
|
||||
sprintf(buf, "%d%s", child->array[getOffsetOfChild2Param(child, 0x100)], string_ptr);
|
||||
if (subObject != NULL && (subObject->objectFlags & kOFText) && _subtitles) {
|
||||
if (subObject->objectFlags & kOFNumber) {
|
||||
sprintf(buf, "%d%s", subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)], string_ptr);
|
||||
string_ptr = buf;
|
||||
}
|
||||
if (string_ptr != NULL)
|
||||
|
|
|
@ -167,7 +167,7 @@ void SimonEngine::loadGamePcFile(const char *filename) {
|
|||
|
||||
num_inited_objects = allocGamePcVars(&in);
|
||||
|
||||
loginPlayer();
|
||||
createPlayer();
|
||||
readGamePcText(&in);
|
||||
|
||||
for (i = 2; i < num_inited_objects; i++) {
|
||||
|
@ -259,42 +259,42 @@ void SimonEngine::readItemChildren(Common::File *in, Item *item, uint type) {
|
|||
uint fr2 = in->readUint16BE();
|
||||
uint i, size;
|
||||
uint j, k;
|
||||
Child1 *child;
|
||||
SubRoom *subRoom;
|
||||
|
||||
size = CHILD1_SIZE;
|
||||
size = SubRoom_SIZE;
|
||||
for (i = 0, j = fr2; i != 6; i++, j >>= 2)
|
||||
if (j & 3)
|
||||
size += sizeof(child->array[0]);
|
||||
size += sizeof(subRoom->roomExit[0]);
|
||||
|
||||
child = (Child1 *)allocateChildBlock(item, 1, size);
|
||||
child->subroutine_id = fr1;
|
||||
child->fr2 = fr2;
|
||||
subRoom = (SubRoom *)allocateChildBlock(item, 1, size);
|
||||
subRoom->subroutine_id = fr1;
|
||||
subRoom->roomExitStates = fr2;
|
||||
|
||||
for (i = k = 0, j = fr2; i != 6; i++, j >>= 2)
|
||||
if (j & 3)
|
||||
child->array[k++] = (uint16)fileReadItemID(in);
|
||||
subRoom->roomExit[k++] = (uint16)fileReadItemID(in);
|
||||
} else if (type == 2) {
|
||||
uint32 fr = in->readUint32BE();
|
||||
uint i, k, size;
|
||||
Child2 *child;
|
||||
SubObject *subObject;
|
||||
|
||||
size = CHILD2_SIZE;
|
||||
size = SubObject_SIZE;
|
||||
for (i = 0; i != 16; i++)
|
||||
if (fr & (1 << i))
|
||||
size += sizeof(child->array[0]);
|
||||
size += sizeof(subObject->objectFlagValue[0]);
|
||||
|
||||
child = (Child2 *)allocateChildBlock(item, 2, size);
|
||||
child->avail_props = fr;
|
||||
subObject = (SubObject *)allocateChildBlock(item, 2, size);
|
||||
subObject->objectFlags = fr;
|
||||
|
||||
k = 0;
|
||||
if (fr & 1) {
|
||||
child->array[k++] = (uint16)in->readUint32BE();
|
||||
subObject->objectFlagValue[k++] = (uint16)in->readUint32BE();
|
||||
}
|
||||
for (i = 1; i != 16; i++)
|
||||
if (fr & (1 << i))
|
||||
child->array[k++] = in->readUint16BE();
|
||||
subObject->objectFlagValue[k++] = in->readUint16BE();
|
||||
|
||||
child->string_id = (uint16)in->readUint32BE();
|
||||
subObject->objectName = (uint16)in->readUint32BE();
|
||||
} else {
|
||||
error("readItemChildren: invalid type %d", type);
|
||||
}
|
||||
|
|
|
@ -530,27 +530,27 @@ bool SimonEngine::saveGame(uint slot, char *caption) {
|
|||
f->writeUint16BE(item->state);
|
||||
f->writeUint16BE(item->classFlags);
|
||||
|
||||
Child1 *child1 = (Child1 *)findChildOfType(item, 1);
|
||||
if (child1) {
|
||||
f->writeUint16BE(child1->fr2);
|
||||
SubRoom *subRoom = (SubRoom *)findChildOfType(item, 1);
|
||||
if (subRoom) {
|
||||
f->writeUint16BE(subRoom->roomExitStates);
|
||||
}
|
||||
|
||||
Child2 *child2 = (Child2 *)findChildOfType(item, 2);
|
||||
if (child2) {
|
||||
f->writeUint32BE(child2->avail_props);
|
||||
i = child2->avail_props & 1;
|
||||
SubObject *subObject = (SubObject *)findChildOfType(item, 2);
|
||||
if (subObject) {
|
||||
f->writeUint32BE(subObject->objectFlags);
|
||||
i = subObject->objectFlags & 1;
|
||||
|
||||
for (j = 1; j < 16; j++) {
|
||||
if ((1 << j) & child2->avail_props) {
|
||||
f->writeUint16BE(child2->array[i++]);
|
||||
if ((1 << j) & subObject->objectFlags) {
|
||||
f->writeUint16BE(subObject->objectFlagValue[i++]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Child9 *child9 = (Child9 *)findChildOfType(item, 9);
|
||||
if (child9) {
|
||||
SubUserFlag *subUserFlag = (SubUserFlag *)findChildOfType(item, 9);
|
||||
if (subUserFlag) {
|
||||
for (i = 0; i != 4; i++) {
|
||||
f->writeUint16BE(child9->array[i]);
|
||||
f->writeUint16BE(subUserFlag->userFlags[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -659,27 +659,27 @@ bool SimonEngine::loadGame(uint slot) {
|
|||
item->state = f->readUint16BE();
|
||||
item->classFlags = f->readUint16BE();
|
||||
|
||||
Child1 *child1 = (Child1 *)findChildOfType(item, 1);
|
||||
if (child1 != NULL) {
|
||||
child1->fr2 = f->readUint16BE();
|
||||
SubRoom *subRoom = (SubRoom *)findChildOfType(item, 1);
|
||||
if (subRoom != NULL) {
|
||||
subRoom->roomExitStates = f->readUint16BE();
|
||||
}
|
||||
|
||||
Child2 *child2 = (Child2 *)findChildOfType(item, 2);
|
||||
if (child2 != NULL) {
|
||||
child2->avail_props = f->readUint32BE();
|
||||
i = child2->avail_props & 1;
|
||||
SubObject *subObject = (SubObject *)findChildOfType(item, 2);
|
||||
if (subObject != NULL) {
|
||||
subObject->objectFlags = f->readUint32BE();
|
||||
i = subObject->objectFlags & 1;
|
||||
|
||||
for (j = 1; j < 16; j++) {
|
||||
if ((1 << j) & child2->avail_props) {
|
||||
child2->array[i++] = f->readUint16BE();
|
||||
if ((1 << j) & subObject->objectFlags) {
|
||||
subObject->objectFlagValue[i++] = f->readUint16BE();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Child9 *child9 = (Child9 *) findChildOfType(item, 9);
|
||||
if (child9) {
|
||||
SubUserFlag *subUserFlag = (SubUserFlag *) findChildOfType(item, 9);
|
||||
if (subUserFlag) {
|
||||
for (i = 0; i != 4; i++) {
|
||||
child9->array[i] = f->readUint16BE();
|
||||
subUserFlag->userFlags[i] = f->readUint16BE();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -770,19 +770,19 @@ int SimonEngine::allocGamePcVars(File *in) {
|
|||
return item_array_inited;
|
||||
}
|
||||
|
||||
void SimonEngine::loginPlayerHelper(Item *item, int a, int b) {
|
||||
Child9 *child;
|
||||
void SimonEngine::setUserFlag(Item *item, int a, int b) {
|
||||
SubUserFlag *subUserFlag;
|
||||
|
||||
child = (Child9 *) findChildOfType(item, 9);
|
||||
if (child == NULL) {
|
||||
child = (Child9 *) allocateChildBlock(item, 9, sizeof(Child9));
|
||||
subUserFlag = (SubUserFlag *) findChildOfType(item, 9);
|
||||
if (subUserFlag == NULL) {
|
||||
subUserFlag = (SubUserFlag *) allocateChildBlock(item, 9, sizeof(SubUserFlag));
|
||||
}
|
||||
|
||||
if (a >= 0 && a <= 3)
|
||||
child->array[a] = b;
|
||||
subUserFlag->userFlags[a] = b;
|
||||
}
|
||||
|
||||
void SimonEngine::loginPlayer() {
|
||||
void SimonEngine::createPlayer() {
|
||||
Child *child;
|
||||
|
||||
_item1 = _itemArrayPtr[1];
|
||||
|
@ -793,7 +793,7 @@ void SimonEngine::loginPlayer() {
|
|||
if (child == NULL)
|
||||
error("player create failure");
|
||||
|
||||
loginPlayerHelper(_item1, 0, 0);
|
||||
setUserFlag(_item1, 0, 0);
|
||||
}
|
||||
|
||||
void SimonEngine::allocateStringTable(int num) {
|
||||
|
@ -923,11 +923,11 @@ bool SimonEngine::isObject(Item *item) {
|
|||
return findChildOfType(item, 2) != NULL;
|
||||
}
|
||||
|
||||
uint SimonEngine::getOffsetOfChild2Param(Child2 *child, uint prop) {
|
||||
uint SimonEngine::getOffsetOfChild2Param(SubObject *child, uint prop) {
|
||||
uint m = 1;
|
||||
uint offset = 0;
|
||||
while (m != prop) {
|
||||
if (child->avail_props & m)
|
||||
if (child->objectFlags & m)
|
||||
offset++;
|
||||
m *= 2;
|
||||
}
|
||||
|
@ -1167,16 +1167,16 @@ void SimonEngine::linkItem(Item *item, Item *parent) {
|
|||
}
|
||||
}
|
||||
|
||||
const byte *SimonEngine::getStringPtrByID(uint string_id) {
|
||||
const byte *SimonEngine::getStringPtrByID(uint stringId) {
|
||||
const byte *string_ptr;
|
||||
byte *dst;
|
||||
|
||||
_freeStringSlot ^= 1;
|
||||
|
||||
if (string_id < 0x8000) {
|
||||
string_ptr = _stringTabPtr[string_id];
|
||||
if (stringId < 0x8000) {
|
||||
string_ptr = _stringTabPtr[stringId];
|
||||
} else {
|
||||
string_ptr = getLocalStringByID(string_id);
|
||||
string_ptr = getLocalStringByID(stringId);
|
||||
}
|
||||
|
||||
dst = _stringReturnBuffer[_freeStringSlot];
|
||||
|
@ -1184,14 +1184,14 @@ const byte *SimonEngine::getStringPtrByID(uint string_id) {
|
|||
return dst;
|
||||
}
|
||||
|
||||
const byte *SimonEngine::getLocalStringByID(uint string_id) {
|
||||
if (string_id < _stringIdLocalMin || string_id >= _stringIdLocalMax) {
|
||||
loadTextIntoMem(string_id);
|
||||
const byte *SimonEngine::getLocalStringByID(uint stringId) {
|
||||
if (stringId < _stringIdLocalMin || stringId >= _stringIdLocalMax) {
|
||||
loadTextIntoMem(stringId);
|
||||
}
|
||||
return _localStringtable[string_id - _stringIdLocalMin];
|
||||
return _localStringtable[stringId - _stringIdLocalMin];
|
||||
}
|
||||
|
||||
void SimonEngine::loadTextIntoMem(uint string_id) {
|
||||
void SimonEngine::loadTextIntoMem(uint stringId) {
|
||||
byte *p;
|
||||
char filename[30];
|
||||
int i;
|
||||
|
@ -1212,7 +1212,7 @@ void SimonEngine::loadTextIntoMem(uint string_id) {
|
|||
base_max = (p[0] * 256) | p[1];
|
||||
p += 2;
|
||||
|
||||
if (string_id < base_max) {
|
||||
if (stringId < base_max) {
|
||||
_stringIdLocalMin = base_min;
|
||||
_stringIdLocalMax = base_max;
|
||||
|
||||
|
@ -1238,7 +1238,7 @@ void SimonEngine::loadTextIntoMem(uint string_id) {
|
|||
base_min = base_max;
|
||||
}
|
||||
|
||||
error("loadTextIntoMem: didn't find %d", string_id);
|
||||
error("loadTextIntoMem: didn't find %d", stringId);
|
||||
}
|
||||
|
||||
void SimonEngine::loadTablesIntoMem(uint subr_id) {
|
||||
|
@ -1785,19 +1785,19 @@ get_out:
|
|||
}
|
||||
|
||||
bool SimonEngine::has_item_childflag_0x10(Item *item) {
|
||||
Child2 *child = (Child2 *)findChildOfType(item, 2);
|
||||
return child && (child->avail_props & 0x10) != 0;
|
||||
SubObject *child = (SubObject *)findChildOfType(item, 2);
|
||||
return child && (child->objectFlags & 0x10) != 0;
|
||||
}
|
||||
|
||||
uint SimonEngine::itemGetIconNumber(Item *item) {
|
||||
Child2 *child = (Child2 *)findChildOfType(item, 2);
|
||||
SubObject *child = (SubObject *)findChildOfType(item, 2);
|
||||
uint offs;
|
||||
|
||||
if (child == NULL || !(child->avail_props & 0x10))
|
||||
if (child == NULL || !(child->objectFlags & 0x10))
|
||||
return 0;
|
||||
|
||||
offs = getOffsetOfChild2Param(child, 0x10);
|
||||
return child->array[offs];
|
||||
return child->objectFlagValue[offs];
|
||||
}
|
||||
|
||||
void SimonEngine::displayBoxStars() {
|
||||
|
@ -1823,10 +1823,10 @@ void SimonEngine::displayBoxStars() {
|
|||
timer_vga_sprites();
|
||||
|
||||
do {
|
||||
if (ha->id != 0 && ha->flags & 0x20 && !(ha->flags & 0x40)) {
|
||||
if (ha->id != 0 && ha->flags & kBFBoxInUse && !(ha->flags & kBFBoxDead)) {
|
||||
|
||||
dha = _hitAreas;
|
||||
if (ha->flags & 1) {
|
||||
if (ha->flags & kBFTextBox) {
|
||||
while (dha != ha && dha->flags != ha->flags)
|
||||
++dha;
|
||||
if (dha != ha && dha->flags == ha->flags)
|
||||
|
@ -1939,12 +1939,12 @@ startOver:
|
|||
setVerb(ha);
|
||||
_defaultVerb = 0;
|
||||
} else {
|
||||
if ((_verbHitArea != 0 || _hitAreaSubjectItem != ha->item_ptr && ha->flags & 0x80) &&
|
||||
if ((_verbHitArea != 0 || _hitAreaSubjectItem != ha->item_ptr && ha->flags & kBFBoxItem) &&
|
||||
ha->item_ptr) {
|
||||
if_1:;
|
||||
_hitAreaSubjectItem = ha->item_ptr;
|
||||
id = 0xFFFF;
|
||||
if (ha->flags & 1)
|
||||
if (ha->flags & kBFTextBox)
|
||||
id = ha->flags / 256;
|
||||
_variableArray[60] = id;
|
||||
displayName(ha);
|
||||
|
@ -2127,13 +2127,13 @@ TextLocation *SimonEngine::getTextLocation(uint a) {
|
|||
void SimonEngine::o_printStr() {
|
||||
uint vgaSpriteId = getVarOrByte();
|
||||
uint color = getVarOrByte();
|
||||
uint string_id = getNextStringID();
|
||||
uint stringId = getNextStringID();
|
||||
const byte *string_ptr = NULL;
|
||||
uint speech_id = 0;
|
||||
TextLocation *tl;
|
||||
|
||||
if (string_id != 0xFFFF)
|
||||
string_ptr = getStringPtrByID(string_id);
|
||||
if (stringId != 0xFFFF)
|
||||
string_ptr = getStringPtrByID(stringId);
|
||||
|
||||
if (getFeatures() & GF_TALKIE)
|
||||
speech_id = (uint16)getNextWord();
|
||||
|
|
|
@ -49,7 +49,7 @@ uint fileReadItemID(Common::File *in);
|
|||
#define NUM_PALETTE_FADEOUT 32
|
||||
|
||||
struct Child;
|
||||
struct Child2;
|
||||
struct SubObject;
|
||||
|
||||
struct Item;
|
||||
struct WindowBlock;
|
||||
|
@ -457,8 +457,8 @@ protected:
|
|||
uint16 readUint16Wrapper(const void *src);
|
||||
|
||||
int allocGamePcVars(Common::File *in);
|
||||
void loginPlayerHelper(Item *item, int a, int b);
|
||||
void loginPlayer();
|
||||
void setUserFlag(Item *item, int a, int b);
|
||||
void createPlayer();
|
||||
void allocateStringTable(int num);
|
||||
void setupStringTable(byte *mem, int num);
|
||||
void setupLocalStringTable(byte *mem, int num);
|
||||
|
@ -526,8 +526,8 @@ protected:
|
|||
void setItemState(Item *item, int value);
|
||||
|
||||
void showMessageFormat(const char *s, ...);
|
||||
const byte *getStringPtrByID(uint string_id);
|
||||
const byte *getLocalStringByID(uint string_id);
|
||||
const byte *getStringPtrByID(uint stringId);
|
||||
const byte *getLocalStringByID(uint stringId);
|
||||
uint getNextStringID();
|
||||
|
||||
void addTimeEvent(uint timeout, uint subroutine_id);
|
||||
|
@ -572,7 +572,7 @@ protected:
|
|||
void o_freezeBottom();
|
||||
void killAllTimers();
|
||||
|
||||
uint getOffsetOfChild2Param(Child2 *child, uint prop);
|
||||
uint getOffsetOfChild2Param(SubObject *child, uint prop);
|
||||
void o_setTextColor(uint color);
|
||||
void o_playSFX(uint a);
|
||||
void o_lockZone();
|
||||
|
@ -616,7 +616,7 @@ protected:
|
|||
void drawIconArray_FF(uint i, Item *item_ptr, int line, int classMask);
|
||||
void drawIconArray_Simon(uint i, Item *item_ptr, int line, int classMask);
|
||||
|
||||
void loadTextIntoMem(uint string_id);
|
||||
void loadTextIntoMem(uint stringId);
|
||||
void loadTablesIntoMem(uint subr_id);
|
||||
|
||||
uint loadTextFile(const char *filename, byte *dst);
|
||||
|
|
|
@ -216,7 +216,7 @@ void SimonEngine::clearName() {
|
|||
resetNameWindow();
|
||||
_lastVerbOn = last;
|
||||
|
||||
if (last != NULL && (ha = findHitAreaByID(200)) && (ha->flags & 0x40) && !(last->flags & 0x40))
|
||||
if (last != NULL && (ha = findHitAreaByID(200)) && (ha->flags & kBFBoxDead) && !(last->flags & kBFBoxDead))
|
||||
printVerbOf(last->id);
|
||||
}
|
||||
|
||||
|
@ -343,14 +343,14 @@ HitArea *SimonEngine::findEmptyHitArea() {
|
|||
void SimonEngine::clear_hitarea_bit_0x40(uint hitarea) {
|
||||
HitArea *ha = findHitAreaByID(hitarea);
|
||||
if (ha != NULL)
|
||||
ha->flags &= ~0x40;
|
||||
ha->flags &= ~kBFBoxDead;
|
||||
}
|
||||
|
||||
void SimonEngine::set_hitarea_bit_0x40(uint hitarea) {
|
||||
HitArea *ha = findHitAreaByID(hitarea);
|
||||
if (ha != NULL) {
|
||||
ha->flags |= 0x40;
|
||||
ha->flags &= ~2;
|
||||
ha->flags |= kBFBoxDead;
|
||||
ha->flags &= ~kBFBoxSelected;
|
||||
if (hitarea == 102)
|
||||
resetVerbs();
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ bool SimonEngine::is_hitarea_0x40_clear(uint hitarea) {
|
|||
HitArea *ha = findHitAreaByID(hitarea);
|
||||
if (ha == NULL)
|
||||
return false;
|
||||
return (ha->flags & 0x40) == 0;
|
||||
return (ha->flags & kBFBoxDead) == 0;
|
||||
}
|
||||
|
||||
void SimonEngine::addNewHitArea(int id, int x, int y, int width, int height, int flags, int verb, Item *item_ptr) {
|
||||
|
@ -390,7 +390,7 @@ void SimonEngine::addNewHitArea(int id, int x, int y, int width, int height, int
|
|||
ha->y = y;
|
||||
ha->width = width;
|
||||
ha->height = height;
|
||||
ha->flags = flags | 0x20;
|
||||
ha->flags = flags | kBFBoxInUse;
|
||||
ha->id = ha->priority = id;
|
||||
ha->verb = verb;
|
||||
ha->item_ptr = item_ptr;
|
||||
|
@ -441,7 +441,7 @@ void SimonEngine::resetVerbs() {
|
|||
if (ha == NULL)
|
||||
return;
|
||||
|
||||
if (ha->flags & 0x40) {
|
||||
if (ha->flags & kBFBoxDead) {
|
||||
_defaultVerb = 999;
|
||||
_currentVerbBox = NULL;
|
||||
} else {
|
||||
|
@ -485,16 +485,16 @@ void SimonEngine::setVerb(HitArea *ha) {
|
|||
|
||||
if (getGameType() == GType_SIMON1) {
|
||||
if (tmp != NULL) {
|
||||
tmp->flags |= 8;
|
||||
tmp->flags |= kBFInvertTouch;
|
||||
video_toggle_colors(tmp, 0xd5, 0xd0, 0xd5, 0xA);
|
||||
}
|
||||
|
||||
if (ha->flags & 2)
|
||||
if (ha->flags & kBFBoxSelected)
|
||||
video_toggle_colors(ha, 0xda, 0xd5, 0xd5, 5);
|
||||
else
|
||||
video_toggle_colors(ha, 0xdf, 0xda, 0xda, 0xA);
|
||||
|
||||
ha->flags &= ~(2 + 8);
|
||||
ha->flags &= ~(kBFBoxSelected + kBFInvertTouch);
|
||||
} else {
|
||||
if (ha->id < 101)
|
||||
return;
|
||||
|
@ -643,20 +643,20 @@ void SimonEngine::setup_hitarea_from_pos(uint x, uint y, uint mode) {
|
|||
best_ha = NULL;
|
||||
|
||||
do {
|
||||
if (ha->flags & 0x20) {
|
||||
if (!(ha->flags & 0x40)) {
|
||||
if (ha->flags & kBFBoxInUse) {
|
||||
if (!(ha->flags & kBFBoxDead)) {
|
||||
if (x_ >= ha->x && y_ >= ha->y &&
|
||||
x_ - ha->x < ha->width && y_ - ha->y < ha->height && priority <= ha->priority) {
|
||||
priority = ha->priority;
|
||||
best_ha = ha;
|
||||
} else {
|
||||
if (ha->flags & 2) {
|
||||
if (ha->flags & kBFBoxSelected) {
|
||||
hitarea_leave(ha);
|
||||
ha->flags &= ~2;
|
||||
ha->flags &= ~kBFBoxSelected;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ha->flags &= ~2;
|
||||
ha->flags &= ~kBFBoxSelected;
|
||||
}
|
||||
}
|
||||
} while (ha++, --count);
|
||||
|
@ -676,15 +676,15 @@ void SimonEngine::setup_hitarea_from_pos(uint x, uint y, uint mode) {
|
|||
_variableArray[2] = y;
|
||||
}
|
||||
|
||||
if (best_ha->flags & 4) {
|
||||
if (best_ha->flags & kBFNoTouchName) {
|
||||
clearName();
|
||||
} else if (best_ha != _lastNameOn) {
|
||||
displayName(best_ha);
|
||||
}
|
||||
|
||||
if (best_ha->flags & 8 && !(best_ha->flags & 2)) {
|
||||
if (best_ha->flags & kBFInvertTouch && !(best_ha->flags & kBFBoxSelected)) {
|
||||
hitarea_leave(best_ha);
|
||||
best_ha->flags |= 2;
|
||||
best_ha->flags |= kBFBoxSelected;
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -694,8 +694,8 @@ void SimonEngine::displayName(HitArea *ha) {
|
|||
bool result;
|
||||
|
||||
resetNameWindow();
|
||||
if (ha->flags & 1) {
|
||||
result = printTextOf(ha->flags >> 8);
|
||||
if (ha->flags & kBFTextBox) {
|
||||
result = printTextOf(ha->flags / 256);
|
||||
} else {
|
||||
result = printNameOf(ha->item_ptr);
|
||||
}
|
||||
|
@ -725,16 +725,16 @@ bool SimonEngine::printTextOf(uint a) {
|
|||
}
|
||||
|
||||
bool SimonEngine::printNameOf(Item *item) {
|
||||
Child2 *child2;
|
||||
SubObject *child2;
|
||||
|
||||
if (item == 0 || item == _dummyItem2 || item == _dummyItem3)
|
||||
return false;
|
||||
|
||||
child2 = (Child2 *)findChildOfType(item, 2);
|
||||
child2 = (SubObject *)findChildOfType(item, 2);
|
||||
if (child2 == NULL)
|
||||
return false;
|
||||
|
||||
showActionString(getStringPtrByID(child2->string_id));
|
||||
showActionString(getStringPtrByID(child2->objectName));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue