diff options
-rw-r--r-- | engines/dm/eventman.cpp | 12 | ||||
-rw-r--r-- | engines/dm/eventman.h | 23 | ||||
-rw-r--r-- | engines/dm/gfx.cpp | 78 | ||||
-rw-r--r-- | engines/dm/gfx.h | 94 | ||||
-rw-r--r-- | engines/dm/menus.cpp | 4 |
5 files changed, 105 insertions, 106 deletions
diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index e182b78d96..6d76ddb960 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -340,8 +340,8 @@ CommandType EventManager::getCommandTypeFromMouseInput(MouseInput *input, Common return kCommandNone; CommandType commandType = kCommandNone; - while ((commandType = input->commandTypeToIssue) != kCommandNone) { - if (input->hitbox.isPointInside(mousePos) && input->button == button) + while ((commandType = input->_commandTypeToIssue) != kCommandNone) { + if (input->_hitbox.isPointInside(mousePos) && input->_button == button) break; input++; } @@ -364,13 +364,13 @@ void EventManager::processCommandQueue() { _isCommandQueueLocked = false; processPendingClick(); - if ((cmd.type == kCommandTurnRight) || (cmd.type == kCommandTurnLeft)) { - commandTurnParty(cmd.type); + if ((cmd._type == kCommandTurnRight) || (cmd._type == kCommandTurnLeft)) { + commandTurnParty(cmd._type); return; } - if ((cmd.type >= kCommandMoveForward) && (cmd.type <= kCommandMoveLeft)) { - commandMoveParty(cmd.type); + if ((cmd._type >= kCommandMoveForward) && (cmd._type <= kCommandMoveLeft)) { + commandMoveParty(cmd._type); return; } diff --git a/engines/dm/eventman.h b/engines/dm/eventman.h index 8984b02f27..cdf0f06291 100644 --- a/engines/dm/eventman.h +++ b/engines/dm/eventman.h @@ -130,21 +130,21 @@ enum CommandType { class Command { public: - Common::Point pos; - CommandType type; + Common::Point _pos; + CommandType _type; - Command(Common::Point position, CommandType commandType): pos(position), type(commandType) {} + Command(Common::Point position, CommandType commandType): _pos(position), _type(commandType) {} }; // @ COMMAND class MouseInput { public: - CommandType commandTypeToIssue; - Box hitbox; - MouseButton button; + CommandType _commandTypeToIssue; + Box _hitbox; + MouseButton _button; MouseInput(CommandType type, uint16 x1, uint16 x2, uint16 y1, uint16 y2, MouseButton mouseButton) - : commandTypeToIssue(type), hitbox(x1, x2 + 1, y1, y2 + 1), button(mouseButton) {} + : _commandTypeToIssue(type), _hitbox(x1, x2 + 1, y1, y2 + 1), _button(mouseButton) {} }; // @ MOUSE_INPUT extern MouseInput gPrimaryMouseInput_Entrance[4]; // @ G0445_as_Graphic561_PrimaryMouseInput_Entrance[4] @@ -172,11 +172,11 @@ extern MouseInput* gPrimaryMouseInput_DialogSets[2][4]; // @ G0480_aaps_PrimaryM class KeyboardInput { public: - Command commandToIssue; - Common::KeyCode key; - byte modifiers; + Command _commandToIssue; + Common::KeyCode _key; + byte _modifiers; - KeyboardInput(Command command, Common::KeyCode keycode, byte modifierFlags) : commandToIssue(command), key(keycode), modifiers(modifierFlags) {} + KeyboardInput(Command command, Common::KeyCode keycode, byte modifierFlags) : _commandToIssue(command), _key(keycode), _modifiers(modifierFlags) {} }; // @ KEYBOARD_INPUT class DMEngine; @@ -216,5 +216,4 @@ public: } - #endif diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index ae9ef62414..790c055784 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -682,9 +682,9 @@ void DisplayMan::loadGraphics() { void DisplayMan::unpackGraphics() { uint32 unpackedBitmapsSize = 0; for (uint16 i = 0; i <= 20; ++i) - unpackedBitmapsSize += width(i) * height(i); + unpackedBitmapsSize += getWidth(i) * getHeight(i); for (uint16 i = 22; i <= 532; ++i) - unpackedBitmapsSize += width(i) * height(i); + unpackedBitmapsSize += getWidth(i) * getHeight(i); // graphics items go from 0-20 and 22-532 inclusive, _unpackedItemPos 21 and 22 are there for indexing convenience if (_bitmaps) { delete[] _bitmaps[0]; @@ -694,12 +694,12 @@ void DisplayMan::unpackGraphics() { _bitmaps[0] = new byte[unpackedBitmapsSize]; loadIntoBitmap(0, _bitmaps[0]); for (uint16 i = 1; i <= 20; ++i) { - _bitmaps[i] = _bitmaps[i - 1] + width(i - 1) * height(i - 1); + _bitmaps[i] = _bitmaps[i - 1] + getWidth(i - 1) * getHeight(i - 1); loadIntoBitmap(i, _bitmaps[i]); } - _bitmaps[22] = _bitmaps[20] + width(20) * height(20); + _bitmaps[22] = _bitmaps[20] + getWidth(20) * getHeight(20); for (uint16 i = 23; i < 533; ++i) { - _bitmaps[i] = _bitmaps[i - 1] + width(i - 1) * height(i - 1); + _bitmaps[i] = _bitmaps[i - 1] + getWidth(i - 1) * getHeight(i - 1); loadIntoBitmap(i, _bitmaps[i]); } } @@ -771,7 +771,7 @@ void DisplayMan::blitToBitmap(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uin for (uint16 x = 0; x < destToX - destFromX; ++x) { byte srcPixel = srcBitmap[srcWidth * (y + srcY) + srcX + x]; if (srcPixel != transparent) - destBitmap[destWidth * (y + destFromY + destViewport.posY) + destFromX + x + destViewport.posX] = srcPixel; + destBitmap[destWidth * (y + destFromY + destViewport._posY) + destFromX + x + destViewport._posX] = srcPixel; } } @@ -820,25 +820,25 @@ byte *DisplayMan::getCurrentVgaBuffer() { return _vgaBuffer; } -uint16 DisplayMan::width(uint16 index) { +uint16 DisplayMan::getWidth(uint16 index) { byte *data = _packedBitmaps + _packedItemPos[index]; return READ_BE_UINT16(data); } -uint16 DisplayMan::height(uint16 index) { +uint16 DisplayMan::getHeight(uint16 index) { uint8 *data = _packedBitmaps + _packedItemPos[index]; return READ_BE_UINT16(data + 2); } void DisplayMan::drawWallSetBitmapWithoutTransparency(byte *bitmap, Frame &f) { - if (f.srcWidth) - blitToScreen(bitmap, f.srcWidth, f.srcX, f.srcY, f.destFromX, f.destToX, f.destFromY, f.destToY, kColorNoTransparency, gDungeonViewport); + if (f._srcWidth) + blitToScreen(bitmap, f._srcWidth, f._srcX, f._srcY, f._destFromX, f._destToX, f._destFromY, f._destToY, kColorNoTransparency, gDungeonViewport); } void DisplayMan::drawWallSetBitmap(byte *bitmap, Frame &f) { - if (f.srcWidth) - blitToScreen(bitmap, f.srcWidth, f.srcX, f.srcY, f.destFromX, f.destToX, f.destFromY, f.destToY, kColorFlesh, gDungeonViewport); + if (f._srcWidth) + blitToScreen(bitmap, f._srcWidth, f._srcX, f._srcY, f._destFromX, f._destToX, f._destFromY, f._destToY, kColorFlesh, gDungeonViewport); } void DisplayMan::drawSquareD3L(direction dir, int16 posX, int16 posY) { @@ -1085,7 +1085,7 @@ void DisplayMan::drawDungeon(direction dir, int16 posX, int16 posY) { } if (flippedFloorCeiling) { - uint16 w = gFloorFrame.srcWidth, h = gFloorFrame.srcHeight; + uint16 w = gFloorFrame._srcWidth, h = gFloorFrame._srcHeight; blitToBitmap(_floorBitmap, w, h, tmpBitmap, w); flipBitmapHorizontal(tmpBitmap, w, h); drawWallSetBitmap(tmpBitmap, gFloorFrame); @@ -1094,7 +1094,7 @@ void DisplayMan::drawDungeon(direction dir, int16 posX, int16 posY) { for (uint16 i = 0; i <= kWall_D3LCR - kWall_D0R; ++i) _wallSetBitMaps[i + kWall_D0R] = _wallSetBitMaps[i + kWall_D0R_Flipped]; } else { - uint16 w = gCeilingFrame.srcWidth, h = gCeilingFrame.srcHeight; + uint16 w = gCeilingFrame._srcWidth, h = gCeilingFrame._srcHeight; blitToBitmap(_ceilingBitmap, w, h, tmpBitmap, w); flipBitmapHorizontal(tmpBitmap, w, h); drawWallSetBitmap(tmpBitmap, gCeilingFrame); @@ -1187,7 +1187,7 @@ void DisplayMan::loadWallSet(WallSet set) { for (uint16 i = 0; i < 7; ++i) { uint16 srcGraphicIndice = firstIndice + srcIndex[i]; - uint16 w = width(srcGraphicIndice), h = height(srcGraphicIndice); + uint16 w = getWidth(srcGraphicIndice), h = getHeight(srcGraphicIndice); delete[] _wallSetBitMaps[destIndex[i]]; _wallSetBitMaps[destIndex[i]] = new byte[w * h]; blitToBitmap(_wallSetBitMaps[srcIndex[i]], w, h, _wallSetBitMaps[destIndex[i]], w); @@ -1290,23 +1290,23 @@ void DisplayMan::loadCurrentMapGraphics() { void DisplayMan::applyCreatureReplColors(int replacedColor, int replacementColor) { for (int16 i = 0; i < 6; ++i) - gPalDungeonView[i][replacedColor] = gCreatureReplColorSets[replacementColor].RGBColor[i]; + gPalDungeonView[i][replacedColor] = gCreatureReplColorSets[replacementColor]._RGBColor[i]; - gPalChangesCreature_D2[replacedColor] = gCreatureReplColorSets[replacementColor].D2ReplacementColor; - gPalChangesCreature_D3[replacedColor] = gCreatureReplColorSets[replacementColor].D3ReplacementColor; + gPalChangesCreature_D2[replacedColor] = gCreatureReplColorSets[replacementColor]._D2ReplacementColor; + gPalChangesCreature_D3[replacedColor] = gCreatureReplColorSets[replacementColor]._D3ReplacementColor; } void DisplayMan::drawFloorPitOrStairsBitmap(StairIndex relIndex, Frame &f) { - if (f.srcWidth) { - blitToScreen(_bitmaps[_stairIndices[relIndex]], f.srcWidth, f.srcX, f.srcY, f.destFromX, f.destToX, f.destFromY, f.destToY, kColorFlesh, gDungeonViewport); + if (f._srcWidth) { + blitToScreen(_bitmaps[_stairIndices[relIndex]], f._srcWidth, f._srcX, f._srcY, f._destFromX, f._destToX, f._destFromY, f._destToY, kColorFlesh, gDungeonViewport); } } void DisplayMan::drawFloorPitOrStairsBitmapFlippedHorizontally(StairIndex relIndex, Frame &f) { - if (f.srcWidth) { - blitToBitmap(_bitmaps[_stairIndices[relIndex]], f.srcWidth, f.srcHeight, _tmpBitmap, f.srcWidth); - flipBitmapHorizontal(_tmpBitmap, f.srcWidth, f.srcHeight); - blitToScreen(_tmpBitmap, f.srcWidth, f.srcX, f.srcY, f.destFromX, f.destToX, f.destFromY, f.destToY, kColorFlesh, gDungeonViewport); + if (f._srcWidth) { + blitToBitmap(_bitmaps[_stairIndices[relIndex]], f._srcWidth, f._srcHeight, _tmpBitmap, f._srcWidth); + flipBitmapHorizontal(_tmpBitmap, f._srcWidth, f._srcHeight); + blitToScreen(_tmpBitmap, f._srcWidth, f._srcX, f._srcY, f._destFromX, f._destToX, f._destFromY, f._destToY, kColorFlesh, gDungeonViewport); } } @@ -1370,8 +1370,8 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex if (viewWallIndex == kViewWall_D1C_FRONT) { if (isInscription) { Frame &D1CFrame = gFrameWalls[kViewSquare_D1C]; - blitToScreen(_wallSetBitMaps[kWall_D1LCR], D1CFrame.srcWidth, 94, 28, gBoxWallPatchBehindInscription.X1, gBoxWallPatchBehindInscription.X2, - gBoxWallPatchBehindInscription.Y1, gBoxWallPatchBehindInscription.Y2, kColorNoTransparency, gDungeonViewport); + blitToScreen(_wallSetBitMaps[kWall_D1LCR], D1CFrame._srcWidth, 94, 28, gBoxWallPatchBehindInscription._x1, gBoxWallPatchBehindInscription._x2, + gBoxWallPatchBehindInscription._y1, gBoxWallPatchBehindInscription._y2, kColorNoTransparency, gDungeonViewport); unsigned char *string = inscriptionString; bitmapRed = _bitmaps[kInscriptionFontIndice]; @@ -1382,12 +1382,12 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex while (*character++ < 0x80) { characterCount++; } - frame.destToX = (frame.destFromX = 112 - (characterCount * 4)) + 7; - frame.destFromY = (frame.destToY = gInscriptionLineY[textLineIndex++]) - 7; + frame._destToX = (frame._destFromX = 112 - (characterCount * 4)) + 7; + frame._destFromY = (frame._destToY = gInscriptionLineY[textLineIndex++]) - 7; while (characterCount--) { - blitToScreen(bitmapRed, 288, (*string++) * 8, 0, frame.destFromX, frame.destToX, frame.destFromY, frame.destToY, kColorFlesh, gDungeonViewport); - frame.destFromX += 8; - frame.destToX += 8; + blitToScreen(bitmapRed, 288, (*string++) * 8, 0, frame._destFromX, frame._destToX, frame._destFromY, frame._destToY, kColorFlesh, gDungeonViewport); + frame._destFromX += 8; + frame._destToX += 8; } } while (*string++ != 0x81); return isAlcove; @@ -1457,14 +1457,14 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex } while (*string++ != 0x81); if (unreadableTextLineCount < 4) { - frame.destFromX = coordinateSetA[0]; - frame.destToX = coordinateSetA[1]; - frame.destFromY = coordinateSetA[2]; - frame.destToY = coordinateSetA[3]; - frame.srcWidth = coordinateSetA[4]; - frame.srcHeight = coordinateSetA[5]; + frame._destFromX = coordinateSetA[0]; + frame._destToX = coordinateSetA[1]; + frame._destFromY = coordinateSetA[2]; + frame._destToY = coordinateSetA[3]; + frame._srcWidth = coordinateSetA[4]; + frame._srcHeight = coordinateSetA[5]; - coordinateSetA = &frame.destFromX; + coordinateSetA = &frame._destFromX; coordinateSetA[3] = gUnreadableInscriptionBoxY2[gWallOrnDerivedBitmapIndexIncrement[viewWallIndex] * 3 + unreadableTextLineCount - 1]; } @@ -1473,7 +1473,7 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex if ((viewWallIndex == kViewWall_D1C_FRONT) && _championPortraitOrdinal--) { Box &box = gBoxChampionPortraitOnWall; - blitToScreen(_bitmaps[kChampionPortraitsIndice], 256, (_championPortraitOrdinal & 0x7) << 5, (_championPortraitOrdinal >> 3) * 29, box.X1, box.X2, box.Y1, box.Y2, + blitToScreen(_bitmaps[kChampionPortraitsIndice], 256, (_championPortraitOrdinal & 0x7) << 5, (_championPortraitOrdinal >> 3) * 29, box._x1, box._x2, box._y1, box._y2, kColorDarkGary, gDungeonViewport); } return isAlcove; diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index 241d45bfda..3283175086 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -31,14 +31,14 @@ extern uint16 gPalDungeonView[6][16]; class Box { public: - uint16 X1; - uint16 X2; - uint16 Y1; - uint16 Y2; + uint16 _x1; + uint16 _x2; + uint16 _y1; + uint16 _y2; - Box(uint16 x1, uint16 x2, uint16 y1, uint16 y2): X1(x1), X2(x2 + 1), Y1(y1), Y2(y2 + 1) {} + Box(uint16 x1, uint16 x2, uint16 y1, uint16 y2): _x1(x1), _x2(x2 + 1), _y1(y1), _y2(y2 + 1) {} bool isPointInside(Common::Point point) { - return (X1 <= point.x) && (point.x < X2) && (Y1 <= point.y) && (point.y < Y2); + return (_x1 <= point.x) && (point.x < _x2) && (_y1 <= point.y) && (point.y < _y2); } }; // @ BOX_BYTE, BOX_WORD @@ -46,15 +46,15 @@ extern Box gBoxMovementArrows; // G0002_s_Graphic562_Box_MovementArrows // The frames in the original sources contain inclusive boundaries and byte widths, not pixel widths struct Frame { - uint16 destFromX, destToX, destFromY, destToY; - uint16 srcWidth, srcHeight; - uint16 srcX, srcY; + uint16 _destFromX, _destToX, _destFromY, _destToY; + uint16 _srcWidth, _srcHeight; + uint16 _srcX, _srcY; Frame() {} Frame(uint16 destFromX, uint16 destToX, uint16 destFromY, uint16 destToY, uint16 srcWidth, uint16 srcHeight, uint16 srcX, uint16 srcY) : - destFromX(destFromX), destToX(destToX + 1), destFromY(destFromY), destToY(destToY + 1), - srcWidth(srcWidth * 2), srcHeight(srcHeight), srcX(srcX), srcY(srcY) {} + _destFromX(destFromX), _destToX(destToX + 1), _destFromY(destFromY), _destToY(destToY + 1), + _srcWidth(srcWidth * 2), _srcHeight(srcHeight), _srcX(srcX), _srcY(srcY) {} }; enum WallSet { @@ -124,55 +124,55 @@ enum Color { struct Viewport { // TODO: should probably add width and height, seems redundant right meow - uint16 posX, posY; + uint16 _posX, _posY; }; struct CreatureAspect { - uint16 firstNativeBitmapRelativeIndex; - uint16 firstDerivedBitmapIndex; - byte byteWidthFront; - byte heightFront; - byte byteWidthSide; - byte heightSide; - byte byteWidthAttack; - byte heightAttack; - byte coordinateSet_TransparentColor; - byte replacementColorSetIndices; - - byte getCoordSet() { return (coordinateSet_TransparentColor >> 4) & 0xF; } // @ M71_COORDINATE_SET - byte getTranspColour() { return coordinateSet_TransparentColor & 0xF; } // @ M72_TRANSPARENT_COLOR - byte getReplColour10() { return (replacementColorSetIndices >> 4) & 0xF; } // @ M74_COLOR_10_REPLACEMENT_COLOR_SET - byte getReplColour9() { return replacementColorSetIndices & 0xF; } // @ M73_COLOR_09_REPLACEMENT_COLOR_SET + uint16 _firstNativeBitmapRelativeIndex; + uint16 _firstDerivedBitmapIndex; + byte _byteWidthFront; + byte _heightFront; + byte _byteWidthSide; + byte _heightSide; + byte _byteWidthAttack; + byte _heightAttack; + byte _coordinateSet_TransparentColor; + byte _replacementColorSetIndices; + + byte getCoordSet() { return (_coordinateSet_TransparentColor >> 4) & 0xF; } // @ M71_COORDINATE_SET + byte getTranspColour() { return _coordinateSet_TransparentColor & 0xF; } // @ M72_TRANSPARENT_COLOR + byte getReplColour10() { return (_replacementColorSetIndices >> 4) & 0xF; } // @ M74_COLOR_10_REPLACEMENT_COLOR_SET + byte getReplColour9() { return _replacementColorSetIndices & 0xF; } // @ M73_COLOR_09_REPLACEMENT_COLOR_SET }; // @ CREATURE_ASPECT struct ObjectAspect { - byte firstNativeBitmapRelativeIndex; - byte firstDerivedBitmapRelativeIndex; - byte width; - byte height; - byte graphicInfo; /* Bits 7-5 and 3-1 Unreferenced */ - byte coordinateSet; + byte _firstNativeBitmapRelativeIndex; + byte _firstDerivedBitmapRelativeIndex; + byte _width; + byte _height; + byte _graphicInfo; /* Bits 7-5 and 3-1 Unreferenced */ + byte _coordinateSet; ObjectAspect(byte firstN, byte firstD, byte byteWidth, byte h, byte grap, byte coord) : - firstNativeBitmapRelativeIndex(firstN), firstDerivedBitmapRelativeIndex(firstD), - width(byteWidth * 2), height(h), graphicInfo(grap), coordinateSet(coord) {} + _firstNativeBitmapRelativeIndex(firstN), _firstDerivedBitmapRelativeIndex(firstD), + _width(byteWidth * 2), _height(h), _graphicInfo(grap), _coordinateSet(coord) {} }; // @ OBJECT_ASPECT struct ProjectileAspect { - byte firstNativeBitmapRelativeIndex; - byte firstDerivedBitmapRelativeIndex; - byte width; - byte height; - uint16 graphicInfo; /* Bits 15-9, 7-5 and 3-2 Unreferenced */ + byte _firstNativeBitmapRelativeIndex; + byte _firstDerivedBitmapRelativeIndex; + byte _width; + byte _height; + uint16 _graphicInfo; /* Bits 15-9, 7-5 and 3-2 Unreferenced */ ProjectileAspect(byte firstN, byte firstD, byte byteWidth, byte h, uint16 grap) : - firstNativeBitmapRelativeIndex(firstN), firstDerivedBitmapRelativeIndex(firstD), - width(byteWidth * 2), height(h), graphicInfo(grap) {} + _firstNativeBitmapRelativeIndex(firstN), _firstDerivedBitmapRelativeIndex(firstD), + _width(byteWidth * 2), _height(h), _graphicInfo(grap) {} }; // @ PROJECTIL_ASPECT struct CreatureReplColorSet { - uint16 RGBColor[6]; - byte D2ReplacementColor; - byte D3ReplacementColor; + uint16 _RGBColor[6]; + byte _D2ReplacementColor; + byte _D3ReplacementColor; }; // @ CREATURE_REPLACEMENT_COLOR_SET extern Viewport gDefultViewPort; @@ -265,9 +265,9 @@ public: void loadPalette(uint16 *palette); /// Gives the width of an IMG0 type item - uint16 width(uint16 index); + uint16 getWidth(uint16 index); /// Gives the height of an IMG1 type item - uint16 height(uint16 index); + uint16 getHeight(uint16 index); void blitToBitmap(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY, byte *destBitmap, uint16 destWidth, diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index 1b4c68dafe..4e079e4263 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -10,9 +10,9 @@ void MenuMan::drawMovementArrows() { DisplayMan &disp = *_vm->_displayMan; byte *arrowsBitmap = disp.getBitmap(kMovementArrowsIndice); Box &dest = gBoxMovementArrows; - uint16 w = disp.width(kMovementArrowsIndice); + uint16 w = disp.getWidth(kMovementArrowsIndice); - disp.blitToScreen(arrowsBitmap, w, 0, 0, dest.X1, dest.X2, dest.Y1, dest.Y2, kColorNoTransparency); + disp.blitToScreen(arrowsBitmap, w, 0, 0, dest._x1, dest._x2, dest._y1, dest._y2, kColorNoTransparency); } }
\ No newline at end of file |