Implemented text drawing and cleanup.
svn-id: r31756
This commit is contained in:
parent
6d3a7e4f6b
commit
fc6fe46951
5 changed files with 266 additions and 64 deletions
|
@ -165,23 +165,22 @@ void ScriptFunctionsRtz::setupExternalsTable() {
|
|||
#undef External
|
||||
|
||||
int16 ScriptFunctionsRtz::o1_SYSTEM(int16 argc, int16 *argv) {
|
||||
warning("Unimplemented opcode: o1_SYSTEM");
|
||||
// This opcode is empty.
|
||||
return 0;
|
||||
}
|
||||
|
||||
int16 ScriptFunctionsRtz::o1_INITGRAF(int16 argc, int16 *argv) {
|
||||
warning("Unimplemented opcode: o1_INITGRAF");
|
||||
// This opcode is empty.
|
||||
return 0;
|
||||
}
|
||||
|
||||
int16 ScriptFunctionsRtz::o1_RESTOREGRAF(int16 argc, int16 *argv) {
|
||||
warning("Unimplemented opcode: o1_RESTOREGRAF");
|
||||
// This opcode is empty.
|
||||
return 0;
|
||||
}
|
||||
|
||||
int16 ScriptFunctionsRtz::o1_DRAWPIC(int16 argc, int16 *argv) {
|
||||
int16 channel = _vm->_screen->drawPic(argv[4], argv[3], argv[2], argv[1], argv[0]);
|
||||
return channel;
|
||||
return _vm->_screen->drawPic(argv[4], argv[3], argv[2], argv[1], argv[0]);
|
||||
}
|
||||
|
||||
int16 ScriptFunctionsRtz::o1_CLS(int16 argc, int16 *argv) {
|
||||
|
@ -252,7 +251,6 @@ int16 ScriptFunctionsRtz::o1_EVENT(int16 argc, int16 *argv) {
|
|||
}
|
||||
|
||||
_vm->_system->updateScreen();
|
||||
//g_system->delayMillis(10);
|
||||
|
||||
return eventNum;
|
||||
}
|
||||
|
@ -275,18 +273,18 @@ int16 ScriptFunctionsRtz::o1_VISUALFX(int16 argc, int16 *argv) {
|
|||
}
|
||||
|
||||
int16 ScriptFunctionsRtz::o1_PLAYSND(int16 argc, int16 *argv) {
|
||||
int soundId = argv[0];
|
||||
int soundNum = argv[0];
|
||||
bool loop = false;
|
||||
|
||||
if (argc > 1) {
|
||||
soundId = argv[1];
|
||||
soundNum = argv[1];
|
||||
loop = (argv[0] == 1);
|
||||
}
|
||||
|
||||
if (soundId > 0) {
|
||||
if (soundNum > 0) {
|
||||
if (!_vm->_mixer->isSoundHandleActive(_audioStreamHandle)) {
|
||||
_vm->_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle,
|
||||
_vm->_res->getSound(soundId)->getAudioStream(_vm->_soundRate, loop));
|
||||
_vm->_res->getSound(soundNum)->getAudioStream(_vm->_soundRate, loop));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -294,9 +292,9 @@ int16 ScriptFunctionsRtz::o1_PLAYSND(int16 argc, int16 *argv) {
|
|||
}
|
||||
|
||||
int16 ScriptFunctionsRtz::o1_PLAYMUS(int16 argc, int16 *argv) {
|
||||
int16 musicId = argv[0];
|
||||
if (musicId > 0) {
|
||||
XmidiResource *xmidi = _vm->_res->getXmidi(musicId);
|
||||
int16 musicNum = argv[0];
|
||||
if (musicNum > 0) {
|
||||
XmidiResource *xmidi = _vm->_res->getXmidi(musicNum);
|
||||
_vm->_music->play(xmidi);
|
||||
_vm->_res->freeResource(xmidi);
|
||||
}
|
||||
|
@ -317,6 +315,8 @@ int16 ScriptFunctionsRtz::o1_ISMUS(int16 argc, int16 *argv) {
|
|||
|
||||
int16 ScriptFunctionsRtz::o1_TEXTPOS(int16 argc, int16 *argv) {
|
||||
warning("Unimplemented opcode: o1_TEXTPOS");
|
||||
// This seems to be some kind of low-level opcode.
|
||||
// The original engine calls int 10h to set the VGA cursor position.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -421,16 +421,14 @@ int16 ScriptFunctionsRtz::o1_PALETTELOCK(int16 argc, int16 *argv) {
|
|||
}
|
||||
|
||||
int16 ScriptFunctionsRtz::o1_FONT(int16 argc, int16 *argv) {
|
||||
warning("Unimplemented opcode: o1_FONT");
|
||||
|
||||
uint16 fontID = argv[0];
|
||||
printf("Set font to %i\n", fontID);
|
||||
_vm->_screen->setFont(fontID);
|
||||
_vm->_screen->setFont(argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int16 ScriptFunctionsRtz::o1_DRAWTEXT(int16 argc, int16 *argv) {
|
||||
warning("Unimplemented opcode: o1_DRAWTEXT");
|
||||
Object *obj = _vm->_dat->getObject(argv[argc - 1]);
|
||||
warning("argc = %d; drawText = %s", argc, obj->getString());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -441,26 +439,20 @@ int16 ScriptFunctionsRtz::o1_HOMETEXT(int16 argc, int16 *argv) {
|
|||
|
||||
int16 ScriptFunctionsRtz::o1_TEXTRECT(int16 argc, int16 *argv) {
|
||||
warning("Unimplemented opcode: o1_TEXTRECT");
|
||||
|
||||
int16 x1 = CLIP<int16>(argv[0], 1, 318);
|
||||
int16 y1 = CLIP<int16>(argv[1], 1, 198);
|
||||
int16 x1 = CLIP<int16>(argv[4], 1, 318);
|
||||
int16 y1 = CLIP<int16>(argv[3], 1, 198);
|
||||
int16 x2 = CLIP<int16>(argv[2], 1, 318);
|
||||
int16 y2 = CLIP<int16>(argv[3], 1, 198);
|
||||
int16 textValue = argv[4];
|
||||
|
||||
printf("Text rect: %i, %i, %i, %i - text value: %i\n", x1, y1, x2, y2, textValue);
|
||||
// TODO: set text rect
|
||||
|
||||
int16 y2 = CLIP<int16>(argv[1], 1, 198);
|
||||
int16 textValue = argv[0];
|
||||
// TODO: textValue
|
||||
_vm->_screen->setTextRect(Common::Rect(x1, y1, x2, y2));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int16 ScriptFunctionsRtz::o1_TEXTXY(int16 argc, int16 *argv) {
|
||||
warning("Unimplemented opcode: o1_TEXTXY");
|
||||
|
||||
int16 x = CLIP<int16>(argv[0], 1, 318);
|
||||
int16 y = CLIP<int16>(argv[1], 1, 198);
|
||||
|
||||
printf("Text: x = %i, y = %i\n", x, y);
|
||||
int16 x = CLIP<int16>(argv[1], 1, 318);
|
||||
int16 y = CLIP<int16>(argv[0], 1, 198);
|
||||
_vm->_screen->setTextXY(x, y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -574,6 +566,7 @@ int16 ScriptFunctionsRtz::o1_MONOCLS(int16 argc, int16 *argv) {
|
|||
int16 ScriptFunctionsRtz::o1_SNDENERGY(int16 argc, int16 *argv) {
|
||||
// This is called while in-game voices are played
|
||||
// Not sure what it's used for
|
||||
// -> It's used to animate mouths when NPCs are talking
|
||||
// Commented out to reduce spam
|
||||
//warning("Unimplemented opcode: o1_SNDENERGY");
|
||||
return 0;
|
||||
|
@ -590,11 +583,13 @@ int16 ScriptFunctionsRtz::o1_ANIMTEXT(int16 argc, int16 *argv) {
|
|||
}
|
||||
|
||||
int16 ScriptFunctionsRtz::o1_TEXTWIDTH(int16 argc, int16 *argv) {
|
||||
Object *obj = _vm->_dat->getObject(argv[1]);
|
||||
const char *text = obj->getString();
|
||||
debug(4, "text = %s\n", text);
|
||||
// TODO
|
||||
return 0;
|
||||
int16 width = 0;
|
||||
if (argv[1] > 0) {
|
||||
Object *obj = _vm->_dat->getObject(argv[1]);
|
||||
const char *text = obj->getString();
|
||||
width = _vm->_screen->getTextWidth(argv[0], text);
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
int16 ScriptFunctionsRtz::o1_PLAYMOVIE(int16 argc, int16 *argv) {
|
||||
|
@ -645,10 +640,7 @@ int16 ScriptFunctionsRtz::o1_PLACESPRITE(int16 argc, int16 *argv) {
|
|||
}
|
||||
|
||||
int16 ScriptFunctionsRtz::o1_PLACETEXT(int16 argc, int16 *argv) {
|
||||
Object *obj = _vm->_dat->getObject(argv[5]);
|
||||
const char *text = obj->getString();
|
||||
debug(4, "text = %s\n", text); fflush(stdout);
|
||||
return 0;
|
||||
return _vm->_screen->placeText(argv[6], argv[5], argv[4], argv[3], argv[2], argv[1], argv[0]);
|
||||
}
|
||||
|
||||
int16 ScriptFunctionsRtz::o1_DELETECHANNEL(int16 argc, int16 *argv) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue