Implemented drawing of Brynns note.

svn-id: r19774
This commit is contained in:
Johannes Schickel 2005-12-10 19:02:56 +00:00
parent d6e9396166
commit 38c3df4393
3 changed files with 66 additions and 8 deletions

View File

@ -363,6 +363,8 @@ int KyraEngine::init(GameDetector &detector) {
_scenePhasingFlag = 0;
_lastProcessedItem = 0;
_lastProcessedItemHeight = 16;
_hidPage = _screenPage = 0;
return 0;
}
@ -401,7 +403,8 @@ KyraEngine::~KyraEngine() {
for (int i = 0; i < ARRAYSIZE(_sceneAnimTable); ++i) {
free(_sceneAnimTable[i]);
}
free(_unkPtr1);
free(_unkPtr2);
}
void KyraEngine::errorString(const char *buf1, char *buf2) {
@ -574,6 +577,37 @@ void KyraEngine::delay(uint32 amount) {
} while (!_fastMode && _system->getMillis() < start + amount);
}
void KyraEngine::waitForEvent() {
bool finished = false;
OSystem::Event event;
while (!finished) {
while (_system->pollEvent(event)) {
switch (event.type) {
case OSystem::EVENT_KEYDOWN:
finished = true;
break;
case OSystem::EVENT_MOUSEMOVE:
_mouseX = event.mouse.x;
_mouseY = event.mouse.y;
break;
case OSystem::EVENT_QUIT:
quitGame();
break;
case OSystem::EVENT_LBUTTONDOWN:
finished = true;
break;
default:
break;
}
}
if (_debugger->isAttached())
_debugger->onFrame();
_system->delayMillis(10);
}
}
void KyraEngine::mainLoop() {
debug(9, "KyraEngine::mainLoop()");

View File

@ -514,7 +514,6 @@ protected:
void snd_startTrack();
void snd_haltTrack();
void snd_setSoundEffectFile(int file);
static OpcodeProc _opcodeTable[];
static const int _opcodeTableSize;
@ -532,6 +531,7 @@ protected:
void res_loadRoomTable(const byte *src, Room **loadTo, int *size);
void res_loadShapeTable(const byte *src, Shape **loadTo, int *size);
void waitForEvent();
void delay(uint32 millis);
void loadPalette(const char *filename, uint8 *palData);
void loadMouseShapes();
@ -568,6 +568,7 @@ protected:
bool _talkMessagePrinted;
uint8 _flagsTable[53];
uint8 *_unkPtr1, *_unkPtr2;
uint8 *_hidPage, *_screenPage;
uint8 *_shapes[377];
uint16 _gameSpeed;
uint16 _tickLength;

View File

@ -473,8 +473,8 @@ int KyraEngine::cmd_sceneAnimOff(ScriptState *script) {
}
int KyraEngine::cmd_getElapsedSeconds(ScriptState *script) {
warning("STUB: cmd_getElapsedSeconds");
return 0;
debug(3, "cmd_getElapsedSeconds(0x%X) ()");
return _system->getMillis() / 1000;
}
int KyraEngine::cmd_mouseIsPointer(ScriptState *script) {
@ -850,7 +850,9 @@ int KyraEngine::cmd_copyWSARegion(ScriptState *script) {
}
int KyraEngine::cmd_printText(ScriptState *script) {
warning("STUB: cmd_printText");
debug(3, "cmd_printText(0x%X) ('%s', %d, %d, 0x%X, 0x%X)", script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4));
_screen->printText(stackPosString(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4));
_screen->updateScreen();
return 0;
}
@ -1011,7 +1013,8 @@ int KyraEngine::cmd_placeCharacterInOtherScene(ScriptState *script) {
}
int KyraEngine::cmd_getKey(ScriptState *script) {
warning("STUB: cmd_getKey");
debug(3, "cmd_getKey(0x%X) ()");
waitForEvent();
return 0;
}
@ -1145,12 +1148,32 @@ int KyraEngine::cmd_walkCharacterToPoint(ScriptState *script) {
}
int KyraEngine::cmd_specialEventDisplayBrynnsNote(ScriptState *script) {
warning("STUB: cmd_specialEventDisplayBrynnsNote");
debug(3, "cmd_specialEventDisplayBrynnsNote(0x%X) ()", script);
_hidPage = (uint8*)malloc(320*200);
_screenPage = (uint8*)malloc(320*200);
assert(_hidPage && _screenPage);
_screen->hideMouse();
_screen->copyRegionToBuffer(0, 0, 0, 320, 200, _screenPage);
_screen->copyRegionToBuffer(2, 0, 0, 320, 200, _hidPage);
loadBitmap("NOTE.CPS", 3, 3, 0);
_screen->copyRegion(63, 8, 63, 8, 194, 128, 2, 0);
_screen->updateScreen();
_screen->showMouse();
_screen->setFont(Screen::FID_6_FNT);
return 0;
}
int KyraEngine::cmd_specialEventRemoveBrynnsNote(ScriptState *script) {
warning("STUB: cmd_specialEventRemoveBrynnsNote");
debug(3, "cmd_specialEventRemoveBrynnsNote(0x%X) ()", script);
_screen->hideMouse();
assert(_hidPage && _screenPage);
_screen->copyBlockToPage(0, 0, 0, 320, 200, _screenPage);
_screen->copyBlockToPage(2, 0, 0, 320, 200, _hidPage);
free(_screenPage);
free(_hidPage);
_screen->updateScreen();
_screen->showMouse();
_screen->setFont(Screen::FID_8_FNT);
return 0;
}