Split screenTextPObj script opcode into game specific versions

svn-id: r21991
This commit is contained in:
Travis Howell 2006-04-17 22:47:12 +00:00
parent 5244d481e6
commit c17350958d
2 changed files with 116 additions and 56 deletions

View File

@ -255,7 +255,7 @@ void SimonEngine::setupOpcodes() {
// 175 - 179
&SimonEngine::o_lockZones,
&SimonEngine::o_unlockZones,
&SimonEngine::o_screenTextPObj,
NULL,
&SimonEngine::o_getPathPosn,
&SimonEngine::o_scnTxtLongText,
// 180 - 184
@ -294,6 +294,7 @@ void SimonEngine::setupOpcodes() {
opcode_table[98] = &SimonEngine::o1_animate;
opcode_table[99] = &SimonEngine::o1_stopAnimate;
opcode_table[127] = &SimonEngine::o1_playTune;
opcode_table[177] = &SimonEngine::o1_screenTextPObj;
opcode_table[181] = &SimonEngine::o1_mouseOff;
opcode_table[182] = &SimonEngine::o1_loadBeard;
opcode_table[183] = &SimonEngine::o1_unloadBeard;
@ -306,6 +307,7 @@ void SimonEngine::setupOpcodes() {
opcode_table[98] = &SimonEngine::o2_animate;
opcode_table[99] = &SimonEngine::o2_stopAnimate;
opcode_table[127] = &SimonEngine::o2_playTune;
opcode_table[177] = &SimonEngine::o2_screenTextPObj;
opcode_table[181] = &SimonEngine::o2_mouseOff;
opcode_table[188] = &SimonEngine::o2_isShortText;
opcode_table[189] = &SimonEngine::o2_clearMarks;
@ -332,6 +334,7 @@ void SimonEngine::setupOpcodes() {
opcode_table[171] = &SimonEngine::o3_hyperLinkOn;
opcode_table[172] = &SimonEngine::o3_hyperLinkOff;
opcode_table[173] = &SimonEngine::o3_checkPaths;
opcode_table[177] = &SimonEngine::o3_screenTextPObj;
opcode_table[181] = &SimonEngine::o3_mouseOff;
opcode_table[182] = &SimonEngine::o3_loadVideo;
opcode_table[183] = &SimonEngine::o3_playVideo;
@ -1391,7 +1394,7 @@ void SimonEngine::o_unlockZones() {
_vgaBufStart = _vgaFileBufOrg;
}
void SimonEngine::o_screenTextPObj() {
void SimonEngine::o1_screenTextPObj() {
// 177: inventory descriptions
uint vgaSpriteId = getVarOrByte();
uint color = getVarOrByte();
@ -1405,59 +1408,7 @@ void SimonEngine::o_screenTextPObj() {
tl = getTextLocation(vgaSpriteId);
}
if ((getGameType() == GType_SIMON2) && (getFeatures() & GF_TALKIE)) {
if (subObject != NULL && subObject->objectFlags & kOFVoice) {
uint speechId = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFVoice)];
if (subObject->objectFlags & kOFNumber) {
uint speechIdOffs = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)];
if (speechId == 116)
speechId = speechIdOffs + 115;
if (speechId == 92)
speechId = speechIdOffs + 98;
if (speechId == 99)
speechId = 9;
if (speechId == 97) {
switch (speechIdOffs) {
case 12:
speechId = 109;
break;
case 14:
speechId = 108;
break;
case 18:
speechId = 107;
break;
case 20:
speechId = 106;
break;
case 22:
speechId = 105;
break;
case 28:
speechId = 104;
break;
case 90:
speechId = 103;
break;
case 92:
speechId = 102;
break;
case 100:
speechId = 51;
break;
default:
error("o_177: invalid case %d", speechIdOffs);
}
}
}
if (_speech)
playSpeech(speechId, vgaSpriteId);
}
} else if (getFeatures() & GF_TALKIE) {
if (getFeatures() & GF_TALKIE) {
if (subObject != NULL && subObject->objectFlags & kOFVoice) {
uint offs = getOffsetOfChild2Param(subObject, kOFVoice);
playSpeech(subObject->objectFlagValue[offs], vgaSpriteId);
@ -1728,6 +1679,84 @@ void SimonEngine::o2_playTune() {
midi.startTrack(track);
}
void SimonEngine::o2_screenTextPObj() {
// 177: inventory descriptions
uint vgaSpriteId = getVarOrByte();
uint color = getVarOrByte();
const char *string_ptr = NULL;
TextLocation *tl = NULL;
char buf[256];
SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
if (subObject != NULL && subObject->objectFlags & kOFText) {
string_ptr = (const char *)getStringPtrByID(subObject->objectFlagValue[0]);
tl = getTextLocation(vgaSpriteId);
}
if (getFeatures() & GF_TALKIE) {
if (subObject != NULL && subObject->objectFlags & kOFVoice) {
uint speechId = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFVoice)];
if (subObject->objectFlags & kOFNumber) {
uint speechIdOffs = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)];
if (speechId == 116)
speechId = speechIdOffs + 115;
if (speechId == 92)
speechId = speechIdOffs + 98;
if (speechId == 99)
speechId = 9;
if (speechId == 97) {
switch (speechIdOffs) {
case 12:
speechId = 109;
break;
case 14:
speechId = 108;
break;
case 18:
speechId = 107;
break;
case 20:
speechId = 106;
break;
case 22:
speechId = 105;
break;
case 28:
speechId = 104;
break;
case 90:
speechId = 103;
break;
case 92:
speechId = 102;
break;
case 100:
speechId = 51;
break;
default:
error("o2_screenTextPObj: invalid case %d", speechIdOffs);
}
}
}
if (_speech)
playSpeech(speechId, vgaSpriteId);
}
}
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)
printScreenText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width);
}
}
void SimonEngine::o2_mouseOff() {
// 181: force mouseOff
scriptMouseOff();
@ -1948,6 +1977,35 @@ void SimonEngine::o3_checkPaths() {
_variableArray2[57] = result;
}
void SimonEngine::o3_screenTextPObj() {
// 177: inventory descriptions
uint vgaSpriteId = getVarOrByte();
uint color = getVarOrByte();
const char *string_ptr = NULL;
TextLocation *tl = NULL;
char buf[256];
SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
if (subObject != NULL && subObject->objectFlags & kOFText) {
string_ptr = (const char *)getStringPtrByID(subObject->objectFlagValue[0]);
tl = getTextLocation(vgaSpriteId);
}
if (subObject != NULL && subObject->objectFlags & kOFVoice) {
uint offs = getOffsetOfChild2Param(subObject, kOFVoice);
playSpeech(subObject->objectFlagValue[offs], vgaSpriteId);
}
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)
printScreenText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width);
}
}
void SimonEngine::o3_mouseOff() {
// 181: force mouseOff
scriptMouseOff();

View File

@ -932,7 +932,6 @@ public:
void o_b2NotZero();
void o_lockZones();
void o_unlockZones();
void o_screenTextPObj();
void o_getPathPosn();
void o_scnTxtLongText();
void o_mouseOn();
@ -945,6 +944,7 @@ public:
void o1_animate();
void o1_stopAnimate();
void o1_playTune();
void o1_screenTextPObj();
void o1_mouseOff();
void o1_loadBeard();
void o1_unloadBeard();
@ -957,6 +957,7 @@ public:
void o2_animate();
void o2_stopAnimate();
void o2_playTune();
void o2_screenTextPObj();
void o2_mouseOff();
void o2_isShortText();
void o2_clearMarks();
@ -980,6 +981,7 @@ public:
void o3_hyperLinkOn();
void o3_hyperLinkOff();
void o3_checkPaths();
void o3_screenTextPObj();
void o3_mouseOff();
void o3_loadVideo();
void o3_playVideo();