ScummVM API documentation
menus.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * Based on the Reverse Engineering work of Christophe Fontanel,
24 * maintainer of the Dungeon Master Encyclopaedia (http://dmweb.free.fr/)
25 */
26
27#ifndef DM_MENUS_H
28#define DM_MENUS_H
29
30#include "dm/dm.h"
31#include "dm/champion.h"
32#include "dm/dungeonman.h"
33
34namespace DM {
35
36enum Damage {
37 kDMDamageCantReach = -1, // @ CM1_DAMAGE_CANT_REACH
38 kDMDamageNoAmmunition = -2 // @ CM2_DAMAGE_NO_AMMUNITION
39};
40
41enum SpellArea {
42 kDMSpellAreaAvailableSymbols = 2, // @ C2_SPELL_AREA_AVAILABLE_SYMBOLS
43 kDMSpellAreaChampionSymbols = 3 // @ C3_SPELL_AREA_CHAMPION_SYMBOLS
44};
45
46enum ActionMask {
47 kDMActionMaskRequiresCharge = 0x0080, // @ MASK0x0080_ACTION_REQUIRES_CHARGE
48 kDMActionMaskHitNonMaterialCreatures = 0x8000 // @ MASK0x8000_HIT_NON_MATERIAL_CREATURES
49};
50
52public:
53 byte _minimumSkillLevel[3]; /* Bit 7: requires charge, Bit 6-0: minimum skill level. */
54 ChampionAction _actionIndices[3];
55 ActionList() { resetToZero(); }
56 void resetToZero() {
57 for (uint16 i = 0; i < 3; ++i) {
58 _minimumSkillLevel[i] = 0;
59 _actionIndices[i] = (ChampionAction)0;
60 }
61 }
62}; // @ ACTION_LIST
63
64class ActionSet {
65public:
66 byte _actionIndices[3]; /* 1 byte of padding inserted by compiler on Atari ST, not on Amiga */
67 byte _actionProperties[2]; /* Bit 7: requires charge, Bit 6-0: minimum skill level */
68 ActionSet(byte a1, byte a2, byte a3, byte b1, byte b2) {
69 _actionIndices[0] = a1;
70 _actionIndices[1] = a2;
71 _actionIndices[2] = a3;
72 _actionProperties[0] = b1;
73 _actionProperties[1] = b2;
74 }
75}; // @ ACTION_SET
76
77class MenuMan {
78 DMEngine *_vm;
79public:
80 explicit MenuMan(DMEngine *vm);
81 ~MenuMan();
82
83 bool _refreshActionArea; // @ G0508_B_RefreshActionArea
84 bool _actionAreaContainsIcons; // @ G0509_B_ActionAreaContainsIcons
85 int16 _actionDamage; // @ G0513_i_ActionDamage
86 ActionList _actionList; // @ G0713_s_ActionList
87 byte *_bitmapSpellAreaLine; // @ K0072_puc_Bitmap_SpellAreaLine
88 byte *_bitmapSpellAreaLines; // @ K0073_puc_Bitmap_SpellAreaLines
89 Thing _actionTargetGroupThing; // @ G0517_T_ActionTargetGroupThing
90 uint16 _actionCount; // @ G0507_ui_ActionCount
91
92 void clearActingChampion(); // @ F0388_MENUS_ClearActingChampion
93 void drawActionIcon(ChampionIndex championIndex); // @ F0386_MENUS_DrawActionIcon
94
95 void drawMovementArrows(); // @ F0395_MENUS_DrawMovementArrows
96 void drawDisabledMenu(); // @ F0456_START_DrawDisabledMenus
97 void refreshActionAreaAndSetChampDirMaxDamageReceived(); // @ F0390_MENUS_RefreshActionAreaAndSetChampionDirectionMaximumDamageReceived
98 void drawActionArea(); // @ F0387_MENUS_DrawActionArea
99 const char *getActionName(ChampionAction actionIndex); // @ F0384_MENUS_GetActionName
100 void drawSpellAreaControls(ChampionIndex champIndex); // @ F0393_MENUS_DrawSpellAreaControls
101 void buildSpellAreaLine(int16 spellAreaBitmapLine);// @ F0392_MENUS_BuildSpellAreaLine
102 void setMagicCasterAndDrawSpellArea(ChampionIndex champIndex); // @ F0394_MENUS_SetMagicCasterAndDrawSpellArea
103 void drawEnabledMenus(); // @ F0457_START_DrawEnabledMenus_CPSF
104 int16 getClickOnSpellCastResult(); // @ F0408_MENUS_GetClickOnSpellCastResult
105 int16 getChampionSpellCastResult(uint16 champIndex); // @ F0412_MENUS_GetChampionSpellCastResult
106 Spell *getSpellFromSymbols(byte *symbols); // @ F0409_MENUS_GetSpellFromSymbols
107 void menusPrintSpellFailureMessage(Champion *champ, uint16 failureType, uint16 skillIndex); // @ F0410_MENUS_PrintSpellFailureMessage
108 Potion *getEmptyFlaskInHand(Champion *champ, Thing *potionThing); // @ F0411_MENUS_GetEmptyFlaskInHand
109 void createEvent70_light(int16 lightPower, int16 ticks); // @ F0404_MENUS_CreateEvent70_Light
110 bool isPartySpellOrFireShieldSuccessful(Champion *champ, bool spellShield, uint16 ticks, bool useMana); // @ F0403_MENUS_IsPartySpellOrFireShieldSuccessful
111 void drawAvailableSymbols(uint16 symbolStep); // @ F0397_MENUS_DrawAvailableSymbols
112 void drawChampionSymbols(Champion *champ); // @ F0398_MENUS_DrawChampionSymbols
113 void addChampionSymbol(int16 symbolIndex); // @ F0399_MENUS_AddChampionSymbol
114 void deleteChampionSymbol(); // @ F0400_MENUS_DeleteChampionSymbol
115 bool didClickTriggerAction(int16 actionListIndex); // @ F0391_MENUS_DidClickTriggerAction
116 bool isActionPerformed(uint16 champIndex, int16 actionIndex); // @ F0407_MENUS_IsActionPerformed
117 void setChampionDirectionToPartyDirection(Champion *champ); // @ F0406_MENUS_SetChampionDirectionToPartyDirection
118 void decrementCharges(Champion *champ); // @ F0405_MENUS_DecrementCharges
119 bool isMeleeActionPerformed(int16 champIndex, Champion *champ, int16 actionIndex, int16 targetMapX,
120 int16 targetMapY, int16 skillIndex); // @ F0402_MENUS_IsMeleeActionPerformed
121 bool isGroupFrightenedByAction(int16 champIndex, uint16 actionIndex, int16 mapX, int16 mapY); // @ F0401_MENUS_IsGroupFrightenedByAction
122 void printMessageAfterReplacements(const char *str); // @ F0381_MENUS_PrintMessageAfterReplacements
123 void processCommands116To119_setActingChampion(uint16 champIndex); // @ F0389_MENUS_ProcessCommands116To119_SetActingChampion
124 void setActionList(ActionSet *actionSet); // @ F0383_MENUS_SetActionList
125 int16 getActionObjectChargeCount(); // @ F0382_MENUS_GetActionObjectChargeCount
126 void drawActionDamage(int16 damage); // @ F0385_MENUS_DrawActionDamage
127
128 Box _boxActionArea3ActionMenu; // @ G0499_s_Graphic560_Box_ActionArea3ActionsMenu
129 Box _boxActionArea2ActionMenu; // @ G0500_s_Graphic560_Box_ActionArea2ActionsMenu
130 Box _boxActionArea1ActionMenu; // @ G0501_s_Graphic560_Box_ActionArea1ActionMenu
131 Box _boxActionArea; // @ G0001_s_Graphic562_Box_ActionArea
132 Box _boxSpellArea;
133 unsigned char _actionSkillIndex[44]; // @ G0496_auc_Graphic560_ActionSkillIndex
134 unsigned char _actionDisabledTicks[44];
135
136 void initConstants();
137};
138}
139
140#endif // DM_MENUS_H
Definition: menus.h:51
Definition: menus.h:64
Definition: gfx.h:557
Definition: champion.h:399
Definition: dm.h:169
Definition: menus.h:77
Definition: dungeonman.h:479
Definition: champion.h:475
Definition: dm.h:135