From 641ef973b01a76bfd1377e19c3fc9beb458166ab Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 15 Aug 2016 07:58:04 +0200 Subject: DM: More work on globals in gfx.cpp --- engines/dm/dm.cpp | 20 ++++--- engines/dm/eventman.cpp | 2 + engines/dm/gfx.cpp | 152 +++++++++++++++++++++++------------------------- engines/dm/gfx.h | 14 ++--- 4 files changed, 92 insertions(+), 96 deletions(-) diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index 2912b3198d..cf0202e1a0 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -278,11 +278,13 @@ void DMEngine::f463_initializeGame() { } void DMEngine::f448_initMemoryManager() { + static uint16 palSwoosh[16] = {0x000, 0xFFF, 0xFFF, 0xFFF, 0xFFF, 0xFFF, 0xFFF, 0xFFF, 0x000, 0xFFF, 0xAAA, 0xFFF, 0xAAA, 0x444, 0xFF0, 0xFF0}; // @ K0057_aui_Palette_Swoosh + warning(false, "STUB METHOD: f448_initMemoryManager"); - _displayMan->f508_buildPaletteChangeCopperList(gK57_PalSwoosh, gK57_PalSwoosh); + _displayMan->f508_buildPaletteChangeCopperList(palSwoosh, palSwoosh); for (uint16 i = 0; i < 16; ++i) { - _displayMan->_g347_paletteTopAndBottomScreen[i] = g21_PalDungeonView[0][i]; - _displayMan->_g346_paletteMiddleScreen[i] = g21_PalDungeonView[0][i]; + _displayMan->_g347_paletteTopAndBottomScreen[i] = _displayMan->_palDungeonView[0][i]; + _displayMan->_g346_paletteMiddleScreen[i] = _displayMan->_palDungeonView[0][i]; } } @@ -323,7 +325,7 @@ void DMEngine::f462_startGame() { _displayMan->D24_fillScreenBox(boxScreenBottom, k0_ColorBlack); } - _displayMan->f508_buildPaletteChangeCopperList(g21_PalDungeonView[0], _displayMan->_g347_paletteTopAndBottomScreen); + _displayMan->f508_buildPaletteChangeCopperList(_displayMan->_palDungeonView[0], _displayMan->_g347_paletteTopAndBottomScreen); _menuMan->f395_drawMovementArrows(); _championMan->f278_resetDataToStartGame(); _g301_gameTimeTicking = true; @@ -658,7 +660,7 @@ T0444017: if (_g523_restartGameRequest) { _displayMan->f436_STARTEND_FadeToPalette(darkBluePalette); _displayMan->fillScreen(k0_ColorBlack); - _displayMan->f436_STARTEND_FadeToPalette(g21_PalDungeonView[0]); + _displayMan->f436_STARTEND_FadeToPalette(_displayMan->_palDungeonView[0]); _g298_newGame = k0_modeLoadSavedGame; if (f435_loadgame(1) != kM1_LoadgameFailure) { f462_startGame(); @@ -675,7 +677,7 @@ T0444017: Box box(0, 319, 0, 199); _displayMan->f21_blitToScreen(_displayMan->f489_getNativeBitmapOrGraphic(k5_creditsGraphicIndice), &box, k160_byteWidthScreen, kM1_ColorNoTransparency, k200_heightScreen); - _displayMan->f436_STARTEND_FadeToPalette(g19_PalCredits); + _displayMan->f436_STARTEND_FadeToPalette(_displayMan->_palCredits); _eventMan->f541_waitForMouseOrKeyActivity(); if (_engineShouldQuit) return; @@ -696,6 +698,8 @@ void DMEngine::f439_drawEntrance() { static Box doorsLowerHalfBox = Box(0, 231, 81, 160); static Box closedDoorLeftBox = Box(0, 104, 30, 190); static Box closedDoorRightBox = Box(105, 231, 30, 190); + /* Atari ST: { 0x000, 0x333, 0x444, 0x420, 0x654, 0x210, 0x040, 0x050, 0x432, 0x700, 0x543, 0x321, 0x222, 0x555, 0x310, 0x777 }, RGB colors are different */ + static uint16 palEntrance[16] = {0x000, 0x666, 0x888, 0x840, 0xCA8, 0x0C0, 0x080, 0x0A0, 0x864, 0xF00, 0xA86, 0x642, 0x444, 0xAAA, 0x620, 0xFFF}; // @ G0020_aui_Graphic562_Palette_Entrance byte *microDungeonCurrentMapData[32]; @@ -732,7 +736,7 @@ void DMEngine::f439_drawEntrance() { _displayMan->f21_blitToScreen(_g562_entranceDoorAnimSteps[0], &closedDoorLeftBox, k64_byteWidth, kM1_ColorNoTransparency, 161); _displayMan->f21_blitToScreen(_g562_entranceDoorAnimSteps[4], &closedDoorRightBox, k64_byteWidth, kM1_ColorNoTransparency, 161); - _displayMan->f436_STARTEND_FadeToPalette(g20_PalEntrance); + _displayMan->f436_STARTEND_FadeToPalette(palEntrance); } void DMEngine::f438_STARTEND_OpenEntranceDoors() { @@ -772,7 +776,7 @@ void DMEngine::f442_SARTEND_processCommand202_entranceDrawCredits() { _eventMan->f78_showMouse(); _displayMan->f436_STARTEND_FadeToPalette(_displayMan->_g345_aui_BlankBuffer); _displayMan->f466_loadIntoBitmap(k5_creditsGraphicIndice, _displayMan->_g348_bitmapScreen); - _displayMan->f436_STARTEND_FadeToPalette(g19_PalCredits); + _displayMan->f436_STARTEND_FadeToPalette(_displayMan->_palCredits); f22_delay(50); _eventMan->f541_waitForMouseOrKeyActivity(); _g298_newGame = k202_modeEntranceDrawCredits; diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index 8833f89f86..c2cb3cc3e6 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -369,6 +369,8 @@ EventManager::~EventManager() { } void EventManager::initMouse() { + static uint16 gK150_PalMousePointer[16] = {0x000, 0x666, 0x888, 0x620, 0x0CC, 0x840, 0x080, 0x0C0, 0xF00, 0xFA0, 0xC86, 0xFF0, 0x000, 0xAAA, 0x00F, 0xFFF}; // @ K0150_aui_Palette_MousePointer + if (!_g615_mousePointerOriginalColorsObject) _g615_mousePointerOriginalColorsObject = new byte[32 * 18]; if (!_gK190_mousePointerTempBuffer) diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index f1fc815c28..0617999411 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -39,82 +39,14 @@ #include "eventman.h" namespace DM { - -ProjectileAspect g210_ProjectileAspect[k14_ProjectileAspectCount] = { // @ G0210_as_Graphic558_ProjectileAspects - /* ProjectileAspect( FirstNativeBitmapRelativeIndex, FirstDerivedBitmapRelativeIndex, ByteWidth, Height, GraphicInfo ) */ - ProjectileAspect(0, 0, 32, 11, 0x0011), /* Arrow */ - ProjectileAspect(3, 18, 16, 11, 0x0011), /* Dagger */ - ProjectileAspect(6, 36, 24, 47, 0x0010), /* Axe - Executioner */ - ProjectileAspect(9, 54, 32, 15, 0x0112), /* Explosion Lightning Bolt */ - ProjectileAspect(11, 54, 32, 12, 0x0011), /* Slayer */ - ProjectileAspect(14, 72, 24, 47, 0x0010), /* Stone Club */ - ProjectileAspect(17, 90, 24, 47, 0x0010), /* Club */ - ProjectileAspect(20, 108, 16, 11, 0x0011), /* Poison Dart */ - ProjectileAspect(23, 126, 48, 18, 0x0011), /* Storm - Side Splitter - Diamond Edge - Falchion - Ra Blade - Rapier - Biter - Samurai Sword - Sword - Dragon Fang */ - ProjectileAspect(26, 144, 8, 15, 0x0012), /* Throwing Star */ - ProjectileAspect(28, 156, 16, 28, 0x0103), /* Explosion Fireball */ - ProjectileAspect(29, 156, 16, 11, 0x0103), /* Explosion Default */ - ProjectileAspect(30, 156, 16, 28, 0x0103), /* Explosion Slime */ - ProjectileAspect(31, 156, 16, 24, 0x0103) /* Explosion Poison Bolt Poison Cloud */ -}; - - -/* Identical to the palette at the end of the swoosh palette animation */ -uint16 gK57_PalSwoosh[16] = {0x000, 0xFFF, 0xFFF, 0xFFF, 0xFFF, 0xFFF, 0xFFF, 0xFFF, 0x000, 0xFFF, 0xAAA, 0xFFF, 0xAAA, 0x444, 0xFF0, 0xFF0}; // @ K0057_aui_Palette_Swoosh -uint16 gK150_PalMousePointer[16] = {0x000, 0x666, 0x888, 0x620, 0x0CC, 0x840, 0x080, 0x0C0, 0xF00, 0xFA0, 0xC86, 0xFF0, 0x000, 0xAAA, 0x00F, 0xFFF}; // @ K0150_aui_Palette_MousePointer -/* Atari ST: { 0x003, 0x055, 0x773, 0x420, 0x774, 0x000, 0x040, 0x500, 0x642, 0x775, 0x742, 0x760, 0x750, 0x000, 0x310, 0x776 }, RGB colors are different */ -uint16 g19_PalCredits[16] = {0x006, 0x0AA, 0xFF6, 0x840, 0xFF8, 0x000, 0x080, 0xA00, 0xC84, 0xFFA, 0xF84, 0xFC0, 0xFA0, 0x000, 0x620, 0xFFC}; // @ G0019_aui_Graphic562_Palette_Credits -/* Atari ST: { 0x000, 0x333, 0x444, 0x420, 0x654, 0x210, 0x040, 0x050, 0x432, 0x700, 0x543, 0x321, 0x222, 0x555, 0x310, 0x777 }, RGB colors are different */ -uint16 g20_PalEntrance[16] = {0x000, 0x666, 0x888, 0x840, 0xCA8, 0x0C0, 0x080, 0x0A0, 0x864, 0xF00, 0xA86, 0x642, 0x444, 0xAAA, 0x620, 0xFFF}; // @ G0020_aui_Graphic562_Palette_Entrance -uint16 g21_PalDungeonView[6][16] = { // @ G0021_aaui_Graphic562_Palette_DungeonView - /* Atari ST: { 0x000, 0x333, 0x444, 0x310, 0x066, 0x420, 0x040, 0x060, 0x700, 0x750, 0x643, 0x770, 0x222, 0x555, 0x007, 0x777 }, RGB colors are different */ - 0x000, 0x666, 0x888, 0x620, 0x0CC, 0x840, 0x080, 0x0C0, 0xF00, 0xFA0, 0xC86, 0xFF0, 0x444, 0xAAA, 0x00F, 0xFFF, - /* Atari ST: { 0x000, 0x222, 0x333, 0x310, 0x066, 0x410, 0x030, 0x050, 0x600, 0x640, 0x532, 0x760, 0x111, 0x444, 0x006, 0x666 }, RGB colors are different */ - 0x000, 0x444, 0x666, 0x620, 0x0CC, 0x820, 0x060, 0x0A0, 0xC00, 0x000, 0x000, 0xFC0, 0x222, 0x888, 0x00C, 0xCCC, - /* Atari ST: { 0x000, 0x111, 0x222, 0x210, 0x066, 0x310, 0x020, 0x040, 0x500, 0x530, 0x421, 0x750, 0x000, 0x333, 0x005, 0x555 }, RGB colors are different */ - 0x000, 0x222, 0x444, 0x420, 0x0CC, 0x620, 0x040, 0x080, 0xA00, 0x000, 0x000, 0xFA0, 0x000, 0x666, 0x00A, 0xAAA, - /* Atari ST: { 0x000, 0x000, 0x111, 0x100, 0x066, 0x210, 0x010, 0x030, 0x400, 0x420, 0x310, 0x640, 0x000, 0x222, 0x004, 0x444 }, RGB colors are different */ - 0x000, 0x000, 0x222, 0x200, 0x0CC, 0x420, 0x020, 0x060, 0x800, 0x000, 0x000, 0xC80, 0x000, 0x444, 0x008, 0x888, - /* Atari ST: { 0x000, 0x000, 0x000, 0x000, 0x066, 0x100, 0x000, 0x020, 0x300, 0x310, 0x200, 0x530, 0x000, 0x111, 0x003, 0x333 }, RGB colors are different */ - 0x000, 0x000, 0x000, 0x000, 0x0CC, 0x200, 0x000, 0x040, 0x600, 0x000, 0x000, 0xA60, 0x000, 0x222, 0x006, 0x666, - /* Atari ST: { 0x000, 0x000, 0x000, 0x000, 0x066, 0x000, 0x000, 0x010, 0x200, 0x200, 0x100, 0x320, 0x000, 0x000, 0x002, 0x222 }, RGB colors are different */ - 0x000, 0x000, 0x000, 0x000, 0x0CC, 0x000, 0x000, 0x020, 0x400, 0x000, 0x000, 0x640, 0x000, 0x000, 0x004, 0x444 -}; - -CreatureReplColorSet g220_CreatureReplColorSets[13] = { // @ G0220_as_Graphic558_CreatureReplacementColorSets - /* { Color, Color, Color, Color, Color, Color, D2 replacement color index (x10), D3 replacement color index (x10) } */ - {0x0CA0, 0x0A80, 0x0860, 0x0640, 0x0420, 0x0200, 90, 90}, /* Atari ST: { 0x0650, 0x0540, 0x0430, 0x0320, 0x0210, 0x0100, 90, 90 }, RGB colors are different */ - {0x0060, 0x0040, 0x0020, 0x0000, 0x0000, 0x0000, 0, 0}, /* Atari ST: { 0x0030, 0x0020, 0x0010, 0x0000, 0x0000, 0x0000, 0, 0 }, */ - {0x0860, 0x0640, 0x0420, 0x0200, 0x0000, 0x0000, 100, 100}, /* Atari ST: { 0x0430, 0x0320, 0x0210, 0x0100, 0x0000, 0x0000, 100, 100 }, */ - {0x0640, 0x0420, 0x0200, 0x0000, 0x0000, 0x0000, 90, 0}, /* Atari ST: { 0x0320, 0x0210, 0x0100, 0x0000, 0x0000, 0x0000, 90, 0 }, */ - {0x000A, 0x0008, 0x0006, 0x0004, 0x0002, 0x0000, 90, 100}, /* Atari ST: { 0x0005, 0x0004, 0x0003, 0x0002, 0x0001, 0x0000, 90, 100 }, */ - {0x0008, 0x0006, 0x0004, 0x0002, 0x0000, 0x0000, 100, 0}, /* Atari ST: { 0x0004, 0x0003, 0x0002, 0x0001, 0x0000, 0x0000, 100, 0 }, */ - {0x0808, 0x0606, 0x0404, 0x0202, 0x0000, 0x0000, 90, 0}, /* Atari ST: { 0x0404, 0x0303, 0x0202, 0x0101, 0x0000, 0x0000, 90, 0 }, */ - {0x0A0A, 0x0808, 0x0606, 0x0404, 0x0202, 0x0000, 100, 90}, /* Atari ST: { 0x0505, 0x0404, 0x0303, 0x0202, 0x0101, 0x0000, 100, 90 }, */ - {0x0FA0, 0x0C80, 0x0A60, 0x0840, 0x0620, 0x0400, 100, 50}, /* Atari ST: { 0x0750, 0x0640, 0x0530, 0x0420, 0x0310, 0x0200, 100, 50 }, */ - {0x0F80, 0x0C60, 0x0A40, 0x0820, 0x0600, 0x0200, 50, 70}, /* Atari ST: { 0x0740, 0x0630, 0x0520, 0x0410, 0x0300, 0x0100, 50, 30 }, D3 replacement color index is different */ - {0x0800, 0x0600, 0x0400, 0x0200, 0x0000, 0x0000, 100, 120}, /* Atari ST: { 0x0400, 0x0300, 0x0200, 0x0100, 0x0000, 0x0000, 100, 100 }, D3 replacement color index is different */ - {0x0600, 0x0400, 0x0200, 0x0000, 0x0000, 0x0000, 120, 0}, /* Atari ST: { 0x0300, 0x0200, 0x0100, 0x0000, 0x0000, 0x0000, 120, 0 }, */ - {0x0C86, 0x0A64, 0x0842, 0x0620, 0x0400, 0x0200, 100, 50}}; /* Atari ST: { 0x0643, 0x0532, 0x0421, 0x0310, 0x0200, 0x0100, 100, 50 } }; */ - byte g221_PalChangesCreature_D3[16] = {0, 120, 10, 30, 40, 30, 0, 60, 30, 0, 0, 110, 0, 20, 0, 130}; // @ G0221_auc_Graphic558_PaletteChanges_Creature_D3 byte g222_PalChangesCreature_D2[16] = {0, 10, 20, 30, 40, 30, 60, 70, 50, 0, 0, 110, 120, 130, 140, 150}; // @ G0222_auc_Graphic558_PaletteChanges_Creature_D2 - - - - byte g17_PalChangesNoChanges[16] = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150}; // @ G0017_auc_Graphic562_PaletteChanges_NoChanges byte g213_PalChangesFloorOrn_D3[16] = {0, 120, 10, 30, 40, 30, 0, 60, 30, 90, 100, 110, 0, 20, 140, 130}; // @ G0213_auc_Graphic558_PaletteChanges_FloorOrnament_D3 byte g214_PalChangesFloorOrn_D2[16] = {0, 10, 20, 30, 40, 30, 60, 70, 50, 90, 100, 110, 120, 130, 140, 150}; // @ G0214_auc_Graphic558_PaletteChanges_FloorOrnament_D2 -int16 g193_FountainOrnIndices[k1_FountainOrnCount] = {35}; // @ G0193_ai_Graphic558_FountainOrnamentIndices -byte g192_AlcoveOrnIndices[k3_AlcoveOrnCount] = { // @ G0192_auc_Graphic558_AlcoveOrnamentIndices - 1, /* Square Alcove */ - 2, /* Vi Altar */ - 3}; /* Arched Alcove */ - DisplayMan::DisplayMan(DMEngine *dmEngine) : _vm(dmEngine) { _g348_bitmapScreen = nullptr; @@ -390,6 +322,41 @@ void DisplayMan::initConstants() { ObjectAspect(85, 176, 32, 17, 0x00, 0) }; + static ProjectileAspect projectileAspect[k14_ProjectileAspectCount] = { // @ G0210_as_Graphic558_ProjectileAspects + /* ProjectileAspect( FirstNativeBitmapRelativeIndex, FirstDerivedBitmapRelativeIndex, ByteWidth, Height, GraphicInfo ) */ + ProjectileAspect(0, 0, 32, 11, 0x0011), /* Arrow */ + ProjectileAspect(3, 18, 16, 11, 0x0011), /* Dagger */ + ProjectileAspect(6, 36, 24, 47, 0x0010), /* Axe - Executioner */ + ProjectileAspect(9, 54, 32, 15, 0x0112), /* Explosion Lightning Bolt */ + ProjectileAspect(11, 54, 32, 12, 0x0011), /* Slayer */ + ProjectileAspect(14, 72, 24, 47, 0x0010), /* Stone Club */ + ProjectileAspect(17, 90, 24, 47, 0x0010), /* Club */ + ProjectileAspect(20, 108, 16, 11, 0x0011), /* Poison Dart */ + ProjectileAspect(23, 126, 48, 18, 0x0011), /* Storm - Side Splitter - Diamond Edge - Falchion - Ra Blade - Rapier - Biter - Samurai Sword - Sword - Dragon Fang */ + ProjectileAspect(26, 144, 8, 15, 0x0012), /* Throwing Star */ + ProjectileAspect(28, 156, 16, 28, 0x0103), /* Explosion Fireball */ + ProjectileAspect(29, 156, 16, 11, 0x0103), /* Explosion Default */ + ProjectileAspect(30, 156, 16, 28, 0x0103), /* Explosion Slime */ + ProjectileAspect(31, 156, 16, 24, 0x0103) /* Explosion Poison Bolt Poison Cloud */ + }; + + /* Atari ST: { 0x003, 0x055, 0x773, 0x420, 0x774, 0x000, 0x040, 0x500, 0x642, 0x775, 0x742, 0x760, 0x750, 0x000, 0x310, 0x776 }, RGB colors are different */ + static uint16 palCredits[16] = {0x006, 0x0AA, 0xFF6, 0x840, 0xFF8, 0x000, 0x080, 0xA00, 0xC84, 0xFFA, 0xF84, 0xFC0, 0xFA0, 0x000, 0x620, 0xFFC}; // @ G0019_aui_Graphic562_Palette_Credits + static uint16 palDungeonView[6][16] = { // @ G0021_aaui_Graphic562_Palette_DungeonView + /* Atari ST: { 0x000, 0x333, 0x444, 0x310, 0x066, 0x420, 0x040, 0x060, 0x700, 0x750, 0x643, 0x770, 0x222, 0x555, 0x007, 0x777 }, RGB colors are different */ + 0x000, 0x666, 0x888, 0x620, 0x0CC, 0x840, 0x080, 0x0C0, 0xF00, 0xFA0, 0xC86, 0xFF0, 0x444, 0xAAA, 0x00F, 0xFFF, + /* Atari ST: { 0x000, 0x222, 0x333, 0x310, 0x066, 0x410, 0x030, 0x050, 0x600, 0x640, 0x532, 0x760, 0x111, 0x444, 0x006, 0x666 }, RGB colors are different */ + 0x000, 0x444, 0x666, 0x620, 0x0CC, 0x820, 0x060, 0x0A0, 0xC00, 0x000, 0x000, 0xFC0, 0x222, 0x888, 0x00C, 0xCCC, + /* Atari ST: { 0x000, 0x111, 0x222, 0x210, 0x066, 0x310, 0x020, 0x040, 0x500, 0x530, 0x421, 0x750, 0x000, 0x333, 0x005, 0x555 }, RGB colors are different */ + 0x000, 0x222, 0x444, 0x420, 0x0CC, 0x620, 0x040, 0x080, 0xA00, 0x000, 0x000, 0xFA0, 0x000, 0x666, 0x00A, 0xAAA, + /* Atari ST: { 0x000, 0x000, 0x111, 0x100, 0x066, 0x210, 0x010, 0x030, 0x400, 0x420, 0x310, 0x640, 0x000, 0x222, 0x004, 0x444 }, RGB colors are different */ + 0x000, 0x000, 0x222, 0x200, 0x0CC, 0x420, 0x020, 0x060, 0x800, 0x000, 0x000, 0xC80, 0x000, 0x444, 0x008, 0x888, + /* Atari ST: { 0x000, 0x000, 0x000, 0x000, 0x066, 0x100, 0x000, 0x020, 0x300, 0x310, 0x200, 0x530, 0x000, 0x111, 0x003, 0x333 }, RGB colors are different */ + 0x000, 0x000, 0x000, 0x000, 0x0CC, 0x200, 0x000, 0x040, 0x600, 0x000, 0x000, 0xA60, 0x000, 0x222, 0x006, 0x666, + /* Atari ST: { 0x000, 0x000, 0x000, 0x000, 0x066, 0x000, 0x000, 0x010, 0x200, 0x200, 0x100, 0x320, 0x000, 0x000, 0x002, 0x222 }, RGB colors are different */ + 0x000, 0x000, 0x000, 0x000, 0x0CC, 0x000, 0x000, 0x020, 0x400, 0x000, 0x000, 0x640, 0x000, 0x000, 0x004, 0x444 + }; + _frameWallD3R2 = Frame(208, 223, 25, 73, 8, 49, 0, 0); // @ G0712_s_Graphic558_Frame_Wall_D3R2 _doorFrameLeftD1C = Frame(43, 74, 14, 107, 16, 94, 0, 0); // @ G0170_s_Graphic558_Frame_DoorFrameLeft_D1C @@ -399,6 +366,9 @@ void DisplayMan::initConstants() { _palChangesDoorButtonAndWallOrnD3[i] = palChangesDoorButtonAndWallOrnD3[i]; _palChangesDoorButtonAndWallOrnD2[i] = palChangesDoorButtonAndWallOrnD2[i]; _palChangeSmoke[i] = palChangeSmoke[i]; + _palCredits[i] = palCredits[i]; + for (int j = 0; j < 6; j++) + _palDungeonView[j][i] = palDungeonView[j][i]; } for (int i = 0; i < 12; i++) { @@ -418,6 +388,9 @@ void DisplayMan::initConstants() { for (int i = 0; i < k85_ObjAspectCount; i++) _objectAspects209[i] = objectAspects209[i]; + for (int i = 0; i < k14_ProjectileAspectCount; i++) + _projectileAspect[i] = projectileAspect[i]; + _doorFrameD1C = new DoorFrames( // @ G0186_s_Graphic558_Frames_Door_D1C Frame(64, 159, 17, 102, 48, 88, 0, 0), /* Closed Or Destroyed */ Frame(64, 159, 17, 38, 48, 88, 0, 66), /* Vertical Closed one fourth */ @@ -577,7 +550,7 @@ void DisplayMan::f460_initializeGraphicData() { } } - ProjectileAspect *projectileAspect = g210_ProjectileAspect; + ProjectileAspect *projectileAspect = _projectileAspect; for (int16 projectileAspectIndex = 0; projectileAspectIndex < k14_ProjectileAspectCount; projectileAspectIndex++, projectileAspect++) { if (!getFlag(projectileAspect->_graphicInfo, k0x0100_ProjectileScaleWithKineticEnergyMask)) { @@ -936,13 +909,12 @@ void DisplayMan::f97_drawViewport(int16 palSwitchingRequestedState) { palSwitchingRequestedState = _g322_paletteSwitchingEnabled ? 1 : 0; if (_g342_refreshDungeonViewPaleteRequested) { - gK10_dungeonViewCurrentPalette = g21_PalDungeonView[_g304_dungeonViewPaletteIndex]; + gK10_dungeonViewCurrentPalette = _palDungeonView[_g304_dungeonViewPaletteIndex]; _g342_refreshDungeonViewPaleteRequested = false; - if (palSwitchingRequestedState == k0_viewportNotDungeonView) { + if (palSwitchingRequestedState == k0_viewportNotDungeonView) _g322_paletteSwitchingEnabled = true; - } else { + else _g322_paletteSwitchingEnabled = false; - } } if (palSwitchingRequestedState != (_g322_paletteSwitchingEnabled ? 1 : 0)) { @@ -2207,8 +2179,11 @@ void DisplayMan::f96_loadCurrentMapGraphics() { 6, /* Wall Ornament 58 Amalgam (Without Gem) */ 7 /* Wall Ornament 59 Lord Order (Outside) */ }; - - + static byte g192_AlcoveOrnIndices[k3_AlcoveOrnCount] = { // @ G0192_auc_Graphic558_AlcoveOrnamentIndices + 1, /* Square Alcove */ + 2, /* Vi Altar */ + 3}; /* Arched Alcove */ + static int16 g193_FountainOrnIndices[k1_FountainOrnCount] = {35}; // @ G0193_ai_Graphic558_FountainOrnamentIndices f94_loadFloorSet(_vm->_dungeonMan->_g269_currMap->_floorSet); f95_loadWallSet(_vm->_dungeonMan->_g269_currMap->_wallSet); @@ -2329,11 +2304,28 @@ void DisplayMan::f96_loadCurrentMapGraphics() { } void DisplayMan::f93_applyCreatureReplColors(int replacedColor, int replacementColor) { + CreatureReplColorSet creatureReplColorSets[13] = { // @ G0220_as_Graphic558_CreatureReplacementColorSets + /* { Color, Color, Color, Color, Color, Color, D2 replacement color index (x10), D3 replacement color index (x10) } */ + {0x0CA0, 0x0A80, 0x0860, 0x0640, 0x0420, 0x0200, 90, 90}, /* Atari ST: { 0x0650, 0x0540, 0x0430, 0x0320, 0x0210, 0x0100, 90, 90 }, RGB colors are different */ + {0x0060, 0x0040, 0x0020, 0x0000, 0x0000, 0x0000, 0, 0}, /* Atari ST: { 0x0030, 0x0020, 0x0010, 0x0000, 0x0000, 0x0000, 0, 0 }, */ + {0x0860, 0x0640, 0x0420, 0x0200, 0x0000, 0x0000, 100, 100}, /* Atari ST: { 0x0430, 0x0320, 0x0210, 0x0100, 0x0000, 0x0000, 100, 100 }, */ + {0x0640, 0x0420, 0x0200, 0x0000, 0x0000, 0x0000, 90, 0}, /* Atari ST: { 0x0320, 0x0210, 0x0100, 0x0000, 0x0000, 0x0000, 90, 0 }, */ + {0x000A, 0x0008, 0x0006, 0x0004, 0x0002, 0x0000, 90, 100}, /* Atari ST: { 0x0005, 0x0004, 0x0003, 0x0002, 0x0001, 0x0000, 90, 100 }, */ + {0x0008, 0x0006, 0x0004, 0x0002, 0x0000, 0x0000, 100, 0}, /* Atari ST: { 0x0004, 0x0003, 0x0002, 0x0001, 0x0000, 0x0000, 100, 0 }, */ + {0x0808, 0x0606, 0x0404, 0x0202, 0x0000, 0x0000, 90, 0}, /* Atari ST: { 0x0404, 0x0303, 0x0202, 0x0101, 0x0000, 0x0000, 90, 0 }, */ + {0x0A0A, 0x0808, 0x0606, 0x0404, 0x0202, 0x0000, 100, 90}, /* Atari ST: { 0x0505, 0x0404, 0x0303, 0x0202, 0x0101, 0x0000, 100, 90 }, */ + {0x0FA0, 0x0C80, 0x0A60, 0x0840, 0x0620, 0x0400, 100, 50}, /* Atari ST: { 0x0750, 0x0640, 0x0530, 0x0420, 0x0310, 0x0200, 100, 50 }, */ + {0x0F80, 0x0C60, 0x0A40, 0x0820, 0x0600, 0x0200, 50, 70}, /* Atari ST: { 0x0740, 0x0630, 0x0520, 0x0410, 0x0300, 0x0100, 50, 30 }, D3 replacement color index is different */ + {0x0800, 0x0600, 0x0400, 0x0200, 0x0000, 0x0000, 100, 120}, /* Atari ST: { 0x0400, 0x0300, 0x0200, 0x0100, 0x0000, 0x0000, 100, 100 }, D3 replacement color index is different */ + {0x0600, 0x0400, 0x0200, 0x0000, 0x0000, 0x0000, 120, 0}, /* Atari ST: { 0x0300, 0x0200, 0x0100, 0x0000, 0x0000, 0x0000, 120, 0 }, */ + {0x0C86, 0x0A64, 0x0842, 0x0620, 0x0400, 0x0200, 100, 50} /* Atari ST: { 0x0643, 0x0532, 0x0421, 0x0310, 0x0200, 0x0100, 100, 50 } }; */ + }; + for (int16 i = 0; i < 6; ++i) - g21_PalDungeonView[i][replacedColor] = g220_CreatureReplColorSets[replacementColor]._RGBColor[i]; + _palDungeonView[i][replacedColor] = creatureReplColorSets[replacementColor]._RGBColor[i]; - g222_PalChangesCreature_D2[replacedColor] = g220_CreatureReplColorSets[replacementColor]._D2ReplacementColor; - g221_PalChangesCreature_D3[replacedColor] = g220_CreatureReplColorSets[replacementColor]._D3ReplacementColor; + g222_PalChangesCreature_D2[replacedColor] = creatureReplColorSets[replacementColor]._D2ReplacementColor; + g221_PalChangesCreature_D3[replacedColor] = creatureReplColorSets[replacementColor]._D3ReplacementColor; } void DisplayMan::f104_drawFloorPitOrStairsBitmap(uint16 nativeIndex, Frame &f) { @@ -3399,7 +3391,7 @@ T0115129_DrawProjectiles: if ((thingParam.getType() == k14_ProjectileThingType) && (thingParam.getCell() == cellYellowBear)) { projectile = (Projectile*)_vm->_dungeonMan->f156_getThingData(thingParam); if ((AL_4_projectileAspect = _vm->_dungeonMan->f142_getProjectileAspect(projectile->_slot)) < 0) { /* Negative value: projectile aspect is the ordinal of a PROJECTIL_ASPECT */ - objectAspect = (ObjectAspect*)&g210_ProjectileAspect[_vm->M1_ordinalToIndex(-AL_4_projectileAspect)]; + objectAspect = (ObjectAspect*)&_projectileAspect[_vm->M1_ordinalToIndex(-AL_4_projectileAspect)]; AL_4_nativeBitmapIndex = ((ProjectileAspect*)objectAspect)->_firstNativeBitmapRelativeIndex + k316_FirstProjectileGraphicIndice; projectileAspectType = getFlag(((ProjectileAspect*)objectAspect)->_graphicInfo, k0x0003_ProjectileAspectTypeMask); if (((doNotScaleWithKineticEnergy = !getFlag(((ProjectileAspect*)objectAspect)->_graphicInfo, k0x0100_ProjectileScaleWithKineticEnergyMask)) || (projectile->_kineticEnergy == 255)) && (viewSquareIndex == k9_ViewSquare_D0C)) { @@ -3536,7 +3528,7 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:; AL_4_explosionAspectIndex = k3_ExplosionAspectSmoke; } else { if (AL_4_explosionType == k100_ExplosionType_RebirthStep1) { - objectAspect = (ObjectAspect*)&g210_ProjectileAspect[_vm->M1_ordinalToIndex(-_vm->_dungeonMan->f142_getProjectileAspect(Thing::_explLightningBolt))]; + objectAspect = (ObjectAspect*)&_projectileAspect[_vm->M1_ordinalToIndex(-_vm->_dungeonMan->f142_getProjectileAspect(Thing::_explLightningBolt))]; AL_6_bitmapRedBanana = f489_getNativeBitmapOrGraphic(((ProjectileAspect*)objectAspect)->_firstNativeBitmapRelativeIndex + (k316_FirstProjectileGraphicIndice + 1)); explosionCoordinates = g228_RebirthStep1ExplosionCoordinates[AL_1_viewSquareExplosionIndex - 3]; byteWidth = M78_getScaledDimension((((ProjectileAspect*)objectAspect)->_byteWidth), explosionCoordinates[2]); diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index 27abe1192e..99a8442134 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -310,12 +310,6 @@ enum GraphicIndice { }; extern byte g17_PalChangesNoChanges[16]; -extern uint16 gK57_PalSwoosh[16]; // @ K0057_aui_Palette_Swoosh -extern uint16 gK150_PalMousePointer[16]; // @ K0150_aui_Palette_MousePointer -extern uint16 g19_PalCredits[16]; // @ G0019_aui_Graphic562_Palette_Credits -extern uint16 g20_PalEntrance[16]; // @ G0020_aui_Graphic562_Palette_Entrance -extern uint16 g21_PalDungeonView[6][16]; // @ G0021_aaui_Graphic562_Palette_DungeonView - // in all cases, where a function takes a Box, it expects it to contain inclusive boundaries class Box { @@ -416,8 +410,6 @@ public: FieldAspect() {} }; // @ FIELD_ASPECT - - class CreatureAspect { public: uint16 _firstNativeBitmapRelativeIndex; @@ -475,6 +467,9 @@ public: ProjectileAspect(byte firstN, byte firstD, byte byteWidth, byte h, uint16 grap) : _firstNativeBitmapRelativeIndex(firstN), _firstDerivedBitmapRelativeIndex(firstD), _byteWidth(byteWidth), _height(h), _graphicInfo(grap) {} + + ProjectileAspect() : _firstNativeBitmapRelativeIndex(0), + _firstDerivedBitmapRelativeIndex(0), _byteWidth(0), _height(0), _graphicInfo(0) {} }; // @ PROJECTIL_ASPECT class CreatureReplColorSet { @@ -790,6 +785,9 @@ public: Frame _frameWalls163[12]; CreatureAspect _creatureAspects219[k27_CreatureTypeCount]; ObjectAspect _objectAspects209[k85_ObjAspectCount]; // @ G0209_as_Graphic558_ObjectAspects + ProjectileAspect _projectileAspect[k14_ProjectileAspectCount]; // @ G0210_as_Graphic558_ProjectileAspects + uint16 _palCredits[16]; // @ G0019_aui_Graphic562_Palette_Credits + uint16 _palDungeonView[6][16]; // @ G0021_aaui_Graphic562_Palette_DungeonView bool f491_isDerivedBitmapInCache(int16 derivedBitmapIndex); // @ F0491_CACHE_IsDerivedBitmapInCache byte *f492_getDerivedBitmap(int16 derivedBitmapIndex); // @ F0492_CACHE_GetDerivedBitmap -- cgit v1.2.3