From 78cf0030e3545eabe254a9643c1c9570d5e1068d Mon Sep 17 00:00:00 2001 From: Bendegúz Nagy Date: Thu, 14 Jul 2016 15:53:07 +0200 Subject: DM: Fix missing messages at the bottom of the screen --- engines/dm/TODOs/todo.txt | 5 ++--- engines/dm/dm.cpp | 2 +- engines/dm/text.cpp | 30 ++++++++++++++++++++++++++---- engines/dm/text.h | 4 ++-- 4 files changed, 31 insertions(+), 10 deletions(-) (limited to 'engines/dm') diff --git a/engines/dm/TODOs/todo.txt b/engines/dm/TODOs/todo.txt index d8821e6015..70c000870e 100644 --- a/engines/dm/TODOs/todo.txt +++ b/engines/dm/TODOs/todo.txt @@ -7,6 +7,8 @@ Bugs: Logic: When object are put on the right side of the current square, they disappear Drawing door ornaments segfaults when going back to the start + Stepping onto the plate next doesn't open the grated gate on the 0th level + Walking into walls corrupts memory Possible bugs: @@ -26,7 +28,4 @@ Todo: Finish stuff: f380_processCommandQueue Missing main loop methods - F0577_VBLANK_Handler, if enought time passes, takes the player's chance to act - - TODO: implement it - - NOTE: _g318_waitForInputMaxVerticalBlankCount is already included in the engine diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index 2bd4a2e753..b3018bafe5 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -384,7 +384,7 @@ T0002002: if (_g311_projectileDisableMovementTicks) _g311_projectileDisableMovementTicks--; - // F0044_TEXT_MESSAGEAREA_ClearExpiredRows(); + _textMan->f44_messageAreaClearExpiredRows(); _g321_stopWaitingForPlayerInput = false; uint16 vblankCounter = 0; do { diff --git a/engines/dm/text.cpp b/engines/dm/text.cpp index eff2447343..993cc8e27f 100644 --- a/engines/dm/text.cpp +++ b/engines/dm/text.cpp @@ -45,10 +45,12 @@ TextMan::~TextMan() { #define k5_LetterWidth 5 #define k6_LetterHeight 6 -void TextMan::f40_printTextToBitmap(byte* destBitmap, uint16 destByteWidth, uint16 destX, uint16 destY, +void TextMan::f40_printTextToBitmap(byte* destBitmap, uint16 destByteWidth, int16 destX, int16 destY, Color textColor, Color bgColor, const char* text, uint16 destHeight) { - destX -= 1; // fixes missalignment, to be checked - destY -= 4; // fixes missalignment, to be checked + if ((destX -= 1) < 0) // fixes missalignment, to be checked + destX = 0; + if ((destY -= 4) < 0) // fixes missalignment, to be checked + destY = 0; uint16 destPixelWidth = destByteWidth * 2; @@ -155,7 +157,7 @@ void TextMan::f46_messageAreaPrintString(Color color, const char* string) { L0030_i_StringLength = strlen(string); warning(false, "MISSING CODE: F0561_SCROLLER_IsTextScrolling"); if (true) { // there is a test here with F0561_SCROLLER_IsTextScrolling - _vm->_textMan->f53_printToLogicalScreen(_g359_messageAreaCursorColumn * 6, (_g358_messageAreaCursorRow * 7) + 177, color, k0_ColorBlack, string); + _vm->_textMan->f53_printToLogicalScreen(_g359_messageAreaCursorColumn * 6, (_g358_messageAreaCursorRow * 7 - 6) + 177, color, k0_ColorBlack, string); } else { f40_printTextToBitmap(_g356_bitmapMessageAreaNewRow, k160_byteWidthScreen, _g359_messageAreaCursorColumn * 6, 5, color, k0_ColorBlack, string, 7); warning(false, "MISSING CODE: F0561_SCROLLER_IsTextScrolling"); @@ -163,6 +165,7 @@ void TextMan::f46_messageAreaPrintString(Color color, const char* string) { } _g359_messageAreaCursorColumn += L0030_i_StringLength; _g360_messageAreaRowExpirationTime[_g358_messageAreaCursorRow] = _vm->_g313_gameTime + 200; + } void TextMan::f54_textInitialize() { @@ -189,4 +192,23 @@ void TextMan::f42_messageAreaMoveCursor(int16 column, int16 row) { } _g358_messageAreaCursorRow = row; } + +void TextMan::f44_messageAreaClearExpiredRows() { + uint16 L0026_ui_RowIndex; + int32 L0027_l_ExpirationTime; + Box L0028_s_Box; + + _vm->_displayMan->_g578_useByteBoxCoordinates = false; + L0028_s_Box._x1 = 0; + L0028_s_Box._x2 = 319; + for (L0026_ui_RowIndex = 0; L0026_ui_RowIndex < 4; L0026_ui_RowIndex++) { + L0027_l_ExpirationTime = _g360_messageAreaRowExpirationTime[L0026_ui_RowIndex]; + if ((L0027_l_ExpirationTime == -1) || (L0027_l_ExpirationTime > _vm->_g313_gameTime)) + continue; + L0028_s_Box._y2 = (L0028_s_Box._y1 = 172 + (L0026_ui_RowIndex * 7)) + 6; + warning(false, "MISSING CODE:F0561_SCROLLER_IsTextScrolling(&K0060_s_TextScroller, true);"); + _vm->_displayMan->f135_fillBoxBitmap(_vm->_displayMan->_g348_bitmapScreen, L0028_s_Box, k0_ColorBlack, k160_byteWidthScreen, k200_heightScreen); + _g360_messageAreaRowExpirationTime[L0026_ui_RowIndex] = -1; + } +} } diff --git a/engines/dm/text.h b/engines/dm/text.h index ce38c55cbf..c07b8f2491 100644 --- a/engines/dm/text.h +++ b/engines/dm/text.h @@ -42,7 +42,7 @@ class TextMan { public: explicit TextMan(DMEngine *vm); ~TextMan(); - void f40_printTextToBitmap(byte *destBitmap, uint16 destByteWidth, uint16 destX, uint16 destY, + void f40_printTextToBitmap(byte *destBitmap, uint16 destByteWidth, int16 destX, int16 destY, Color textColor, Color bgColor, const char *text, uint16 destHeight); // @ F0040_TEXT_Print void f53_printToLogicalScreen(uint16 destX, uint16 destY, Color textColor, Color bgColor, const char *text); // @ F0053_TEXT_PrintToLogicalScreen void f52_printToViewport(int16 posX, int16 posY, Color textColor, const char *text, Color bgColor = k12_ColorDarkestGray); // @ F0052_TEXT_PrintToViewport @@ -54,7 +54,7 @@ public: void f46_messageAreaPrintString(Color color, const char* string);// @ F0046_TEXT_MESSAGEAREA_PrintString void f54_textInitialize(); // @ F0054_TEXT_Initialize void f42_messageAreaMoveCursor(int16 column, int16 row); // @ F0042_TEXT_MESSAGEAREA_MoveCursor - + void f44_messageAreaClearExpiredRows(); // @ F0044_TEXT_MESSAGEAREA_ClearExpiredRows }; -- cgit v1.2.3