diff options
author | Strangerke | 2016-06-04 10:44:37 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | bdc57056cde5ae86d481147b3591c2ba5cd87090 (patch) | |
tree | d504ab35f84a2f88bba8c2a67fb80319bbb97d53 | |
parent | 442d41714023d2d128d92f15a284c5c0aa341ee4 (diff) | |
download | scummvm-rg350-bdc57056cde5ae86d481147b3591c2ba5cd87090.tar.gz scummvm-rg350-bdc57056cde5ae86d481147b3591c2ba5cd87090.tar.bz2 scummvm-rg350-bdc57056cde5ae86d481147b3591c2ba5cd87090.zip |
DM: Move some structs to header in gfx
-rw-r--r-- | engines/dm/gfx.cpp | 74 | ||||
-rw-r--r-- | engines/dm/gfx.h | 69 |
2 files changed, 65 insertions, 78 deletions
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index d559fb90b6..1c820a9467 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -10,20 +10,6 @@ namespace DM { -// The frames in the orignal sources contain inclusive boundaries and byte widths, not pixel widths -struct Frame { - 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) {} -}; - - enum ViewCell { kViewCellFronLeft = 0, // @ C00_VIEW_CELL_FRONT_LEFT kViewCellFrontRight = 1, // @ C01_VIEW_CELL_FRONT_RIGHT @@ -380,25 +366,6 @@ byte gWallOrnCoordSetIndices[60] = { // @ G0194_auc_Graphic558_WallOrnamentCoord 6, /* Wall Ornament 58 Amalgam (Without Gem) */ 7}; /* Wall Ornament 59 Lord Order (Outside) */ -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 -}; // @ CREATURE_ASPECT - - CreatureAspect gCreatureAspects[kCreatureTypeCount] = { // @ G0219_as_Graphic558_CreatureAspects /* { FirstNativeBitmapRelativeIndex, FirstDerivedBitmapIndex, pixelWidthFront, HeightFront, pixelWidthSide, HeightSide, pixelWidthAttack, HeightAttack, CoordinateSet / TransparentColor, @@ -431,18 +398,6 @@ Replacement Color Set Index for color 10 / Replacement Color Set Index for color {85, 0, 32 * 2, 93, 0 * 2, 0, 0 * 2, 0, 0x04, 0xCB}, /* Creature #25 Lord Order */ {86, 0, 32 * 2, 93, 0 * 2, 0, 0 * 2, 0, 0x04, 0xCB}}; /* Creature #26 Grey Lord */ -struct ObjectAspect { - 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) {} -}; // @ OBJECT_ASPECT - ObjectAspect gObjectAspects[kObjAspectCount] = { // @ G0209_as_Graphic558_ObjectAspects /* FirstNativeBitmapRelativeIndex, FirstDerivedBitmapRelativeIndex, ByteWidth, Height, GraphicInfo, CoordinateSet */ ObjectAspect(0, 0, 24, 27, 0x11, 0), @@ -529,20 +484,8 @@ ObjectAspect gObjectAspects[kObjAspectCount] = { // @ G0209_as_Graphic558_Object ObjectAspect(82, 170, 24, 28, 0x00, 0), ObjectAspect(83, 172, 40, 13, 0x00, 1), ObjectAspect(84, 174, 8, 4, 0x00, 1), - ObjectAspect(85, 176, 32, 17, 0x00, 0)}; - -struct ProjectileAspect { - 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) {} -}; // @ PROJECTIL_ASPECT - + ObjectAspect(85, 176, 32, 17, 0x00, 0) +}; ProjectileAspect gProjectileAspect[kProjectileAspectCount] = { // @ G0210_as_Graphic558_ProjectileAspects /* ProjectileAspect( FirstNativeBitmapRelativeIndex, FirstDerivedBitmapRelativeIndex, ByteWidth, Height, GraphicInfo ) */ @@ -562,7 +505,6 @@ ProjectileAspect gProjectileAspect[kProjectileAspectCount] = { // @ G0210_as_Gra ProjectileAspect(31, 156, 16, 24, 0x0103) /* Explosion Poison Bolt Poison Cloud */ }; - // TODO: this is ONLY for the Amiga version, name will have to be refactored /* Identical to the palette at the end of the swoosh palette animation */ @@ -584,14 +526,8 @@ uint16 gPalDungeonView[6][16] = { // @ G0021_aaui_Graphic562_Palette_DungeonView /* 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}; - - -struct CreatureReplColorSet { - uint16 RGBColor[6]; - byte D2ReplacementColor; - byte D3ReplacementColor; -}; // @ CREATURE_REPLACEMENT_COLOR_SET + 0x000, 0x000, 0x000, 0x000, 0x0CC, 0x000, 0x000, 0x020, 0x400, 0x000, 0x000, 0x640, 0x000, 0x000, 0x004, 0x444 +}; CreatureReplColorSet gCreatureReplColorSets[13] = { // @ G0220_as_Graphic558_CreatureReplacementColorSets /* { Color, Color, Color, Color, Color, Color, D2 replacement color index (x10), D3 replacement color index (x10) } */ @@ -612,7 +548,6 @@ CreatureReplColorSet gCreatureReplColorSets[13] = { // @ G0220_as_Graphic558_Cre byte gPalChangesCreature_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 gPalChangesCreature_D2[16] = {0, 10, 20, 30, 40, 30, 60, 70, 50, 0, 0, 110, 120, 130, 140, 150}; // @ G0222_auc_Graphic558_PaletteChanges_Creature_D2 - enum GraphicIndice { kInscriptionFontIndice = 120, // @ C120_GRAPHIC_INSCRIPTION_FONT kDoorMaskDestroyedIndice = 301, // @ C301_GRAPHIC_DOOR_MASK_DESTROYED @@ -620,7 +555,6 @@ enum GraphicIndice { }; - Viewport gDefultViewPort = {0, 0}; // TODO: I guessed the numbers Viewport gDungeonViewport = {0, 64}; // @ G0296_puc_Bitmap_Viewport diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index 8ed7c565be..bbd2b190a6 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -12,8 +12,6 @@ extern uint16 gPalCredits[16]; extern uint16 gPalEntrance[16]; extern uint16 gPalDungeonView[6][16]; - - typedef struct { uint16 X1; uint16 X2; @@ -21,7 +19,19 @@ typedef struct { uint16 Y2; } Box; // @ BOX_BYTE, BOX_WORD -struct Frame; +// 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; + + 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) {} +}; + enum WallSet { kWallSetStone = 0 // @ C0_WALL_SET_STONE }; @@ -67,8 +77,6 @@ enum ViewWall { kViewWall_D1C_FRONT = 12 // @ C12_VIEW_WALL_D1C_FRONT }; - - enum Color { kColorNoTransparency = 255, kColorBlack = 0, @@ -89,16 +97,62 @@ enum Color { kColorWhite = 15 }; - struct Viewport { // TODO: should probably add width and height, seems redundant right meow 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 +}; // @ CREATURE_ASPECT + +struct ObjectAspect { + 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) {} +}; // @ OBJECT_ASPECT + +struct ProjectileAspect { + 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) {} +}; // @ PROJECTIL_ASPECT + +struct CreatureReplColorSet { + uint16 RGBColor[6]; + byte D2ReplacementColor; + byte D3ReplacementColor; +}; // @ CREATURE_REPLACEMENT_COLOR_SET + extern Viewport gDefultViewPort; extern Viewport gDungeonViewport; - #define kAlcoveOrnCount 3 #define kFountainOrnCount 1 @@ -114,7 +168,6 @@ extern Viewport gDungeonViewport; #define kObjAspectCount 85 // @ C085_OBJECT_ASPECT_COUNT #define kProjectileAspectCount 14 // @ C014_PROJECTILE_ASPECT_COUNT - #define kDoorButton 0 // @ C0_DOOR_BUTTON #define kWallOrnInscription 0 // @ C0_WALL_ORNAMENT_INSCRIPTION #define kFloorOrnFootprints 15 // @ C15_FLOOR_ORNAMENT_FOOTPRINTS |