Skip to content

Commit

Permalink
DM: Add F0392_MENUS_BuildSpellAreaLine
Browse files Browse the repository at this point in the history
  • Loading branch information
Bendegúz Nagy committed Aug 26, 2016
1 parent 5893dc7 commit fc6837b
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 2 deletions.
7 changes: 6 additions & 1 deletion engines/dm/gfx.cpp
Expand Up @@ -817,7 +817,12 @@ void DisplayMan::blitToBitmap(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uin
}
}

void DisplayMan::blitToScreen(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY,
void DisplayMan::blitToBitmap(byte* srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY, byte* destBitmap, uint16 destWidth, Box& box, Color transparent, Viewport& viewport)
{
blitToBitmap(srcBitmap, srcWidth, srcX, srcY, destBitmap, destWidth, box._x1, box._x2, box._y1, box._y2, transparent, viewport);
}

void DisplayMan::blitToScreen(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY,
uint16 destFromX, uint16 destToX, uint16 destFromY, uint16 destToY,
Color transparent, Viewport &viewport) {
blitToBitmap(srcBitmap, srcWidth, srcX, srcY,
Expand Down
5 changes: 4 additions & 1 deletion engines/dm/gfx.h
Expand Up @@ -72,7 +72,8 @@ enum GraphicIndice {
kFontGraphicIndice = 557, // @ C557_GRAPHIC_FONT
kSlotBoxActingHandIndice = 35, // @ C035_GRAPHIC_SLOT_BOX_ACTING_HAND
kPanelRenameChampionIndice = 27, // @ C027_GRAPHIC_PANEL_RENAME_CHAMPION
kMenuActionAreaIndice = 10 // @ C010_GRAPHIC_MENU_ACTION_AREA
kMenuActionAreaIndice = 10, // @ C010_GRAPHIC_MENU_ACTION_AREA
kMenuSpellAreLinesIndice = 11 // @ C011_GRAPHIC_MENU_SPELL_AREA_LINES
};

extern uint16 gPalSwoosh[16];
Expand Down Expand Up @@ -336,6 +337,8 @@ class DisplayMan {
byte *destBitmap, uint16 destWidth,
uint16 destFromX, uint16 destToX, uint16 destFromY, uint16 destToY,
Color transparent = kColorNoTransparency, Viewport &viewport = gDefultViewPort);
void blitToBitmap(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY,
byte *destBitmap, uint16 destWidth, Box &box, Color transparent = kColorNoTransparency, Viewport &viewport = gDefultViewPort);
void blitToBitmapShrinkWithPalChange(byte *srcBitmap, int16 srcWidth, int16 srcHight,
byte *destBitmap, int16 destWidth, int16 destHeight, byte *palChange); // @ F0129_VIDEO_BlitShrinkWithPaletteChanges

Expand Down
39 changes: 39 additions & 0 deletions engines/dm/menus.cpp
Expand Up @@ -42,10 +42,19 @@ Box gBoxActionArea1ActionMenu = Box(224, 319, 77, 97); // @ G0501_s_Graphic560_
Box gBoxActionArea = Box(224, 319, 77, 121); // @ G0001_s_Graphic562_Box_ActionArea
byte gPalChangesActionAreaObjectIcon[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0}; // @ G0498_auc_Graphic560_PaletteChanges_ActionAreaObjectIcon

Box gBoxSpellAreaLine = Box(0, 95, 0, 11); // @ K0074_s_Box_SpellAreaLine
Box gBoxSpellAreaLine2 = Box(224, 319, 50, 61); // @ K0075_s_Box_SpellAreaLine2
Box gBoxSpellAreaLine3 = Box(224, 319, 62, 73); // @ K0076_s_Box_SpellAreaLine3

MenuMan::MenuMan(DMEngine *vm) : _vm(vm) {
_refreshActionArea = false;
_actionAreaContainsIcons = false;
_actionDamage = 0;
_bitmapSpellAreaLine = new byte[96 * 12];
}

MenuMan::~MenuMan() {
delete[] _bitmapSpellAreaLine;
}

void MenuMan::drawMovementArrows() {
Expand Down Expand Up @@ -294,4 +303,34 @@ void MenuMan::drawSpellAreaControls(ChampionIndex champIndex) {
warning("MISSING CODE: F0078_MOUSE_ShowPointer");
}

#define kSpellAreaAvailableSymbols 2 // @ C2_SPELL_AREA_AVAILABLE_SYMBOLS
#define kSpellAreaChampionSymbols 3 // @ C3_SPELL_AREA_CHAMPION_SYMBOLS

void MenuMan::buildSpellAreaLine(int16 spellAreaBitmapLine) {
DisplayMan &dispMan = *_vm->_displayMan;

Champion &champ = _vm->_championMan->_champions[_vm->_championMan->_magicCasterChampionIndex];
if (spellAreaBitmapLine == kSpellAreaAvailableSymbols) {
dispMan._useByteBoxCoordinates = false;
dispMan.blitToBitmap(dispMan.getBitmap(kMenuSpellAreLinesIndice), 96, 0, 12, _bitmapSpellAreaLine, 96, gBoxSpellAreaLine, kColorNoTransparency);
int16 x = 1;
char c = 96 + (6 * champ._symbolStep);
char spellSymbolString[2] = {'\0', '\0'};
for (uint16 symbolIndex = 0; symbolIndex < 6; symbolIndex++) {
spellSymbolString[0] = c++;
_vm->_textMan->printTextToBitmap(_bitmapSpellAreaLine, 96, x += 14, 8, kColorCyan, kColorBlack, spellSymbolString, 12);
}
} else if (spellAreaBitmapLine == kSpellAreaChampionSymbols) {
dispMan._useByteBoxCoordinates = false;
dispMan.blitToBitmap(dispMan.getBitmap(kMenuSpellAreLinesIndice), 96, 0, 24, _bitmapSpellAreaLine, 96, gBoxSpellAreaLine, kColorNoTransparency);
int16 x = 8;
char spellSymbolString[2] = {'\0', '\0'};
for (uint16 symbolIndex = 0; symbolIndex < 4; symbolIndex++) {
if ((spellSymbolString[0] = champ._symbols[symbolIndex]) == '\0')
break;
_vm->_textMan->printTextToBitmap(_bitmapSpellAreaLine, 96, x += 9, 8, kColorCyan, kColorBlack, spellSymbolString, 12);
}
}
}

}
3 changes: 3 additions & 0 deletions engines/dm/menus.h
Expand Up @@ -51,11 +51,13 @@ class MenuMan {
DMEngine *_vm;
public:
explicit MenuMan(DMEngine *vm);
~MenuMan();

bool _refreshActionArea; // @ G0508_B_RefreshActionArea
bool _actionAreaContainsIcons; // @ G0509_B_ActionAreaContainsIcons
int16 _actionDamage; // @ G0513_i_ActionDamage
ActionList _actionList; // @ G0713_s_ActionList
byte *_bitmapSpellAreaLine; // @ K0072_puc_Bitmap_SpellAreaLine

void clearActingChampion(); // @ F0388_MENUS_ClearActingChampion
void drawActionIcon(ChampionIndex championIndex); // @ F0386_MENUS_DrawActionIcon
Expand All @@ -66,6 +68,7 @@ class MenuMan {
void drawActionArea(); // @ F0387_MENUS_DrawActionArea
const char* getActionName(ChampionAction actionIndex); // @ F0384_MENUS_GetActionName
void drawSpellAreaControls(ChampionIndex champIndex); // @ F0393_MENUS_DrawSpellAreaControls
void buildSpellAreaLine(int16 spellAreaBitmapLine);// @ F0392_MENUS_BuildSpellAreaLine
};

}
Expand Down

0 comments on commit fc6837b

Please sign in to comment.