DM: Add colour to mouse

This commit is contained in:
Bendegúz Nagy 2016-08-14 21:24:36 +02:00
parent 7f11c2551f
commit f866d4a1ca
2 changed files with 28 additions and 12 deletions

View file

@ -1,14 +1,14 @@
Bugs: Bugs:
Display: Display:
Broken colour palette for dungeon and cursor Broken palette for cursor
Gui is messed up by drawn spell area line on startup No food and water bar graphs
Spellcasting tabs are displayed inproperly, switching between them is possible tho Spellcasting tabs are displayed inproperly, switching between them is possible tho
When reordering a champions, the icons in the top right corner ar drawn twice under the cursor When reordering a champions, the icons in the top right corner ar drawn twice under the cursor
Logic: Logic:
Items thrown on the right side end up on the left side Items thrown on the right side end up on the left side
I'm not sure, but the cooldown between champion actions when fighting monsters seems too muh I'm not sure, but the cooldown between champion actions when fighting monsters seems too muh
Clicking with a scroll in hand on the eye in the inventory makes userinput glitchy Clicking wit ha scroll in hand on the eye in the inventory makes userinput glitchy
Possible bugs: Possible bugs:

View file

@ -379,6 +379,14 @@ void EventManager::initMouse() {
_gK104_mousePointerType = k0_pointerArrow; _gK104_mousePointerType = k0_pointerArrow;
_gK105_previousMousePointerType = k1_pointerHand; _gK105_previousMousePointerType = k1_pointerHand;
byte mousePalette[16 * 3];
for (int i = 0; i < 16; ++i) {
mousePalette[i * 3] = (gK150_PalMousePointer[i] >> 8) * (256 / 16);
mousePalette[i * 3 + 1] = (gK150_PalMousePointer[i] >> 4) * (256 / 16);
mousePalette[i * 3 + 2] = gK150_PalMousePointer[i] * (256 / 16);
}
CursorMan.pushCursorPalette(mousePalette, 0, 16);
_mousePos = Common::Point(0, 0); _mousePos = Common::Point(0, 0);
f73_buildpointerScreenArea(_mousePos.x, _mousePos.y); f73_buildpointerScreenArea(_mousePos.x, _mousePos.y);
CursorMan.showMouse(false); CursorMan.showMouse(false);
@ -411,17 +419,18 @@ void EventManager::f68_setPointerToObject(byte* bitmap) {
byte *L0051_puc_Bitmap = _g615_mousePointerOriginalColorsObject; byte *L0051_puc_Bitmap = _g615_mousePointerOriginalColorsObject;
memset(L0051_puc_Bitmap, 0, 32 * 18); memset(L0051_puc_Bitmap, 0, 32 * 18);
/*
_vm->_displayMan->f129_blitToBitmapShrinkWithPalChange(bitmap, _gK190_mousePointerTempBuffer, 16, 16, 16, 16, palChangesMousepointerOjbectIconShadow); _vm->_displayMan->f129_blitToBitmapShrinkWithPalChange(bitmap, _gK190_mousePointerTempBuffer, 16, 16, 16, 16, palChangesMousepointerOjbectIconShadow);
_vm->_displayMan->f132_blitToBitmap(_gK190_mousePointerTempBuffer, L0051_puc_Bitmap, boxMousePointerObjectShadow, 0, 0, 8, 16, kM1_ColorNoTransparency, 16, 18); _vm->_displayMan->f132_blitToBitmap(_gK190_mousePointerTempBuffer, L0051_puc_Bitmap, boxMousePointerObjectShadow, 0, 0, 8, 16, kM1_ColorNoTransparency, 16, 18);
_vm->_displayMan->f129_blitToBitmapShrinkWithPalChange(bitmap, _gK190_mousePointerTempBuffer, 16, 16, 16, 16, palChangesMousePointerIcon); _vm->_displayMan->f129_blitToBitmapShrinkWithPalChange(bitmap, _gK190_mousePointerTempBuffer, 16, 16, 16, 16, palChangesMousePointerIcon);
_vm->_displayMan->f132_blitToBitmap(_gK190_mousePointerTempBuffer, L0051_puc_Bitmap, boxMousePointerObject, 0, 0, 8, 16, k0_ColorBlack, 16, 18); _vm->_displayMan->f132_blitToBitmap(_gK190_mousePointerTempBuffer, L0051_puc_Bitmap, boxMousePointerObject, 0, 0, 8, 16, k0_ColorBlack, 16, 18);
*/
/*
warning(false, "TODO - Call f129_blitToBitmapShrinkWithPalChange"); warning(false, "TODO - Call f129_blitToBitmapShrinkWithPalChange");
// dummy code // dummy code
_vm->_displayMan->f132_blitToBitmap(bitmap, L0051_puc_Bitmap, boxMousePointerObjectShadow, 0, 0, 8, 16, kM1_ColorNoTransparency, 16, 18); _vm->_displayMan->f132_blitToBitmap(bitmap, L0051_puc_Bitmap, boxMousePointerObjectShadow, 0, 0, 8, 16, kM1_ColorNoTransparency, 16, 18);
_vm->_displayMan->f132_blitToBitmap(bitmap, L0051_puc_Bitmap, boxMousePointerObject, 0, 0, 8, 16, k0_ColorBlack, 16, 18); _vm->_displayMan->f132_blitToBitmap(bitmap, L0051_puc_Bitmap, boxMousePointerObject, 0, 0, 8, 16, k0_ColorBlack, 16, 18);
*/
_gK100_preventBuildPointerScreenArea = false; _gK100_preventBuildPointerScreenArea = false;
f73_buildpointerScreenArea(_mousePos.x, _mousePos.y); f73_buildpointerScreenArea(_mousePos.x, _mousePos.y);
@ -506,12 +515,12 @@ void EventManager::f69_setMousePointer() {
} }
void EventManager::f78_showMouse() { void EventManager::f78_showMouse() {
if(_g587_hideMousePointerRequestCount++ == 0) if (_g587_hideMousePointerRequestCount++ == 0)
CursorMan.showMouse(true); CursorMan.showMouse(true);
} }
void EventManager::f77_hideMouse() { void EventManager::f77_hideMouse() {
if(_g587_hideMousePointerRequestCount-- == 1) if (_g587_hideMousePointerRequestCount-- == 1)
CursorMan.showMouse(false); CursorMan.showMouse(false);
} }
@ -980,13 +989,20 @@ bool EventManager::f375_processType80_clickDungeonView_isLeaderHandObjThrown(int
void EventManager::setMousePointerFromSpriteData(byte* mouseSprite) { void EventManager::setMousePointerFromSpriteData(byte* mouseSprite) {
byte bitmap[16 * 18]; byte bitmap[16 * 18];
for (int16 imgPart = 0; imgPart < 4; ++imgPart) { memset(bitmap, 0, sizeof(bitmap));
for (byte *line = mouseSprite + 72 * imgPart, *pixel = bitmap; line < mouseSprite + 72 * (imgPart + 1); line += 4) { for (int16 imgPart = 1; imgPart < 3; ++imgPart) {
for (byte *line = mouseSprite + 72 * imgPart, *pixel = bitmap;
line < mouseSprite + 72 * (imgPart + 1);
line += 4) {
uint16 words[2]; uint16 words[2];
words[0] = READ_BE_UINT16(line); words[0] = READ_BE_UINT16(line);
words[1] = READ_BE_UINT16(line + 2); words[1] = READ_BE_UINT16(line + 2);
for (int16 i = 15; i >= 0; --i) for (int16 i = 15; i >= 0; --i, ++pixel) {
*pixel++ = ((words[0] >> i) & 1) | (((words[1] >> i) & 1) << 1); uint16 val = (((words[0] >> i) & 1) | (((words[1] >> i) & 1) << 1)) << (imgPart & 0x2);
if (val)
*pixel = val + 8;
}
} }
} }
@ -1028,7 +1044,7 @@ void EventManager::f372_commandProcessType80ClickInDungeonViewTouchFrontWall() {
uint16 mapY = _vm->_dungeonMan->_g307_partyMapY + _vm->_dirIntoStepCountNorth[_vm->_dungeonMan->_g308_partyDir]; uint16 mapY = _vm->_dungeonMan->_g307_partyMapY + _vm->_dirIntoStepCountNorth[_vm->_dungeonMan->_g308_partyDir];
if ((mapX >= 0) && (mapX < _vm->_dungeonMan->_g273_currMapWidth) if ((mapX >= 0) && (mapX < _vm->_dungeonMan->_g273_currMapWidth)
&& (mapY >= 0) && (mapY < _vm->_dungeonMan->_g274_currMapHeight)) && (mapY >= 0) && (mapY < _vm->_dungeonMan->_g274_currMapHeight))
_vm->_g321_stopWaitingForPlayerInput = _vm->_moveSens->f275_sensorIsTriggeredByClickOnWall(mapX, mapY, returnOppositeDir(_vm->_dungeonMan->_g308_partyDir)); _vm->_g321_stopWaitingForPlayerInput = _vm->_moveSens->f275_sensorIsTriggeredByClickOnWall(mapX, mapY, returnOppositeDir(_vm->_dungeonMan->_g308_partyDir));
} }