2016-08-26 22:36:31 +02:00
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers , whose names
* are too numerous to list here . Please refer to the COPYRIGHT
* file distributed with this source distribution .
*
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation ; either version 2
* of the License , or ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software
* Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 , USA .
*
*/
/*
* Based on the Reverse Engineering work of Christophe Fontanel ,
* maintainer of the Dungeon Master Encyclopaedia ( http : //dmweb.free.fr/)
*/
2016-06-15 10:41:33 +02:00
# include "common/system.h"
2016-06-15 18:22:32 +02:00
# include "graphics/cursorman.h"
2016-06-15 22:42:08 +02:00
# include "eventman.h"
# include "dungeonman.h"
2016-06-23 17:32:55 +02:00
# include "movesens.h"
2016-06-23 23:54:37 +02:00
# include "objectman.h"
2016-06-24 01:43:43 +02:00
# include "inventory.h"
2016-06-25 17:03:02 +02:00
# include "menus.h"
2016-06-15 10:41:33 +02:00
2016-06-16 23:48:18 +02:00
namespace DM {
2016-06-15 10:41:33 +02:00
2016-07-02 02:58:44 +02:00
Box g462_BoxObjectPiles [ 4 ] = { // @ G0462_as_Graphic561_Box_ObjectPiles
2016-06-23 23:54:37 +02:00
/* { X1, X2, Y1, Y2 } */
Box ( 24 , 111 , 148 , 168 ) , /* Front left */
Box ( 112 , 199 , 148 , 168 ) , /* Front right */
Box ( 112 , 183 , 122 , 147 ) , /* Back right */
Box ( 40 , 111 , 122 , 147 ) } ; /* Back left */
2016-07-02 02:58:44 +02:00
MouseInput g445_PrimaryMouseInput_Entrance [ 4 ] = { // @ G0445_as_Graphic561_PrimaryMouseInput_Entrance[4]
2016-06-16 15:16:45 +02:00
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
2016-07-02 02:58:44 +02:00
MouseInput ( k200_CommandEntranceEnterDungeon , 244 , 298 , 45 , 58 , k1_LeftMouseButton ) ,
2016-06-16 15:16:45 +02:00
// Strangerke - C201_COMMAND_ENTRANCE_RESUME isn't present in the demo
2016-07-02 02:58:44 +02:00
MouseInput ( k201_CommandEntranceResume , 244 , 298 , 76 , 93 , k1_LeftMouseButton ) ,
MouseInput ( k202_CommandEntranceDrawCredits , 248 , 293 , 187 , 199 , k1_LeftMouseButton ) ,
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g446_PrimaryMouseInput_RestartGame [ 2 ] = { // @ G0446_as_Graphic561_PrimaryMouseInput_RestartGame[2]
2016-06-16 15:16:45 +02:00
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
2016-07-02 02:58:44 +02:00
MouseInput ( k215_CommandRestartGame , 103 , 217 , 145 , 159 , k1_LeftMouseButton ) ,
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g447_PrimaryMouseInput_Interface [ 20 ] = { // @ G0447_as_Graphic561_PrimaryMouseInput_Interface[20]
2016-06-16 15:16:45 +02:00
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
2016-07-02 02:58:44 +02:00
MouseInput ( k12_CommandClickInChampion_0_StatusBox , 0 , 42 , 0 , 28 , k1_LeftMouseButton ) ,
MouseInput ( k13_CommandClickInChampion_1_StatusBox , 69 , 111 , 0 , 28 , k1_LeftMouseButton ) ,
MouseInput ( k14_CommandClickInChampion_2_StatusBox , 138 , 180 , 0 , 28 , k1_LeftMouseButton ) ,
MouseInput ( k15_CommandClickInChampion_3_StatusBox , 207 , 249 , 0 , 28 , k1_LeftMouseButton ) ,
MouseInput ( k125_CommandClickOnChamptionIcon_Top_Left , 274 , 299 , 0 , 13 , k1_LeftMouseButton ) ,
MouseInput ( k126_CommandClickOnChamptionIcon_Top_Right , 301 , 319 , 0 , 13 , k1_LeftMouseButton ) ,
MouseInput ( k127_CommandClickOnChamptionIcon_Lower_Right , 301 , 319 , 15 , 28 , k1_LeftMouseButton ) ,
MouseInput ( k128_CommandClickOnChamptionIcon_Lower_Left , 274 , 299 , 15 , 28 , k1_LeftMouseButton ) ,
MouseInput ( k7_CommandToggleInventoryChampion_0 , 43 , 66 , 0 , 28 , k1_LeftMouseButton ) , /* Atari ST: Only present in CSB 2.x and with Box.X1 = 44. swapped with 4 next entries */
MouseInput ( k8_CommandToggleInventoryChampion_1 , 112 , 135 , 0 , 28 , k1_LeftMouseButton ) , /* Atari ST: Only present in CSB 2.x and with Box.X1 = 113. swapped with 4 next entries */
MouseInput ( k9_CommandToggleInventoryChampion_2 , 181 , 204 , 0 , 28 , k1_LeftMouseButton ) , /* Atari ST: Only present in CSB 2.x and with Box.X1 = 182. swapped with 4 next entries */
MouseInput ( k10_CommandToggleInventoryChampion_3 , 250 , 273 , 0 , 28 , k1_LeftMouseButton ) , /* Atari ST: Only present in CSB 2.x and with Box.X1 = 251. swapped with 4 next entries */
MouseInput ( k7_CommandToggleInventoryChampion_0 , 0 , 66 , 0 , 28 , k2_RightMouseButton ) , /* Atari ST: swapped with 4 previous entries */
MouseInput ( k8_CommandToggleInventoryChampion_1 , 69 , 135 , 0 , 28 , k2_RightMouseButton ) , /* Atari ST: swapped with 4 previous entries */
MouseInput ( k9_CommandToggleInventoryChampion_2 , 138 , 204 , 0 , 28 , k2_RightMouseButton ) , /* Atari ST: swapped with 4 previous entries */
MouseInput ( k10_CommandToggleInventoryChampion_3 , 207 , 273 , 0 , 28 , k2_RightMouseButton ) , /* Atari ST: swapped with 4 previous entries */
MouseInput ( k100_CommandClickInSpellArea , 233 , 319 , 42 , 73 , k1_LeftMouseButton ) ,
MouseInput ( k111_CommandClickInActionArea , 233 , 319 , 77 , 121 , k1_LeftMouseButton ) ,
MouseInput ( k147_CommandFreezeGame , 0 , 1 , 198 , 199 , k1_LeftMouseButton ) ,
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g448_SecondaryMouseInput_Movement [ 9 ] = { // @ G0448_as_Graphic561_SecondaryMouseInput_Movement[9]
2016-06-16 15:16:45 +02:00
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
2016-07-02 02:58:44 +02:00
MouseInput ( k1_CommandTurnLeft , 234 , 261 , 125 , 145 , k1_LeftMouseButton ) ,
MouseInput ( k3_CommandMoveForward , 263 , 289 , 125 , 145 , k1_LeftMouseButton ) ,
MouseInput ( k2_CommandTurnRight , 291 , 318 , 125 , 145 , k1_LeftMouseButton ) ,
MouseInput ( k6_CommandMoveLeft , 234 , 261 , 147 , 167 , k1_LeftMouseButton ) ,
MouseInput ( k5_CommandMoveBackward , 263 , 289 , 147 , 167 , k1_LeftMouseButton ) ,
MouseInput ( k4_CommandMoveRight , 291 , 318 , 147 , 167 , k1_LeftMouseButton ) ,
MouseInput ( k80_CommandClickInDungeonView , 0 , 223 , 33 , 168 , k1_LeftMouseButton ) ,
MouseInput ( k83_CommandToggleInventoryLeader , 0 , 319 , 33 , 199 , k2_RightMouseButton ) ,
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g449_SecondaryMouseInput_ChampionInventory [ 38 ] = { // @ G0449_as_Graphic561_SecondaryMouseInput_ChampionInventory[38]
2016-06-16 15:16:45 +02:00
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
2016-07-02 02:58:44 +02:00
MouseInput ( k11_CommandCloseInventory , 0 , 319 , 0 , 199 , k2_RightMouseButton ) ,
MouseInput ( k140_CommandSaveGame , 174 , 182 , 36 , 44 , k1_LeftMouseButton ) ,
MouseInput ( k145_CommandSleep , 188 , 204 , 36 , 44 , k1_LeftMouseButton ) ,
MouseInput ( k11_CommandCloseInventory , 210 , 218 , 36 , 44 , k1_LeftMouseButton ) ,
MouseInput ( k28_CommandClickOnSlotBoxInventoryReadyHand , 6 , 21 , 86 , 101 , k1_LeftMouseButton ) ,
MouseInput ( k29_CommandClickOnSlotBoxInventoryActionHand , 62 , 77 , 86 , 101 , k1_LeftMouseButton ) ,
MouseInput ( k30_CommandClickOnSlotBoxInventoryHead , 34 , 49 , 59 , 74 , k1_LeftMouseButton ) ,
MouseInput ( k31_CommandClickOnSlotBoxInventoryTorso , 34 , 49 , 79 , 94 , k1_LeftMouseButton ) ,
MouseInput ( k32_CommandClickOnSlotBoxInventoryLegs , 34 , 49 , 99 , 114 , k1_LeftMouseButton ) ,
MouseInput ( k33_CommandClickOnSlotBoxInventoryFeet , 34 , 49 , 119 , 134 , k1_LeftMouseButton ) ,
MouseInput ( k34_CommandClickOnSlotBoxInventoryPouch_2 , 6 , 21 , 123 , 138 , k1_LeftMouseButton ) ,
MouseInput ( k70_CommandClickOnMouth , 56 , 71 , 46 , 61 , k1_LeftMouseButton ) ,
MouseInput ( k71_CommandClickOnEye , 12 , 27 , 46 , 61 , k1_LeftMouseButton ) ,
MouseInput ( k35_CommandClickOnSlotBoxInventoryQuiverLine_2_1 , 79 , 94 , 106 , 121 , k1_LeftMouseButton ) ,
MouseInput ( k36_CommandClickOnSlotBoxInventoryQuiverLine_1_2 , 62 , 77 , 123 , 138 , k1_LeftMouseButton ) ,
MouseInput ( k37_CommandClickOnSlotBoxInventoryQuiverLine_2_2 , 79 , 94 , 123 , 138 , k1_LeftMouseButton ) ,
MouseInput ( k38_CommandClickOnSlotBoxInventoryNeck , 6 , 21 , 66 , 81 , k1_LeftMouseButton ) ,
MouseInput ( k39_CommandClickOnSlotBoxInventoryPouch_1 , 6 , 21 , 106 , 121 , k1_LeftMouseButton ) ,
MouseInput ( k40_CommandClickOnSlotBoxInventoryQuiverLine_1_1 , 62 , 77 , 106 , 121 , k1_LeftMouseButton ) ,
MouseInput ( k41_CommandClickOnSlotBoxInventoryBackpackLine_1_1 , 66 , 81 , 66 , 81 , k1_LeftMouseButton ) ,
MouseInput ( k42_CommandClickOnSlotBoxInventoryBackpackLine_2_2 , 83 , 98 , 49 , 64 , k1_LeftMouseButton ) ,
MouseInput ( k43_CommandClickOnSlotBoxInventoryBackpackLine_2_3 , 100 , 115 , 49 , 64 , k1_LeftMouseButton ) ,
MouseInput ( k44_CommandClickOnSlotBoxInventoryBackpackLine_2_4 , 117 , 132 , 49 , 64 , k1_LeftMouseButton ) ,
MouseInput ( k45_CommandClickOnSlotBoxInventoryBackpackLine_2_5 , 134 , 149 , 49 , 64 , k1_LeftMouseButton ) ,
MouseInput ( k46_CommandClickOnSlotBoxInventoryBackpackLine_2_6 , 151 , 166 , 49 , 64 , k1_LeftMouseButton ) ,
MouseInput ( k47_CommandClickOnSlotBoxInventoryBackpackLine_2_7 , 168 , 183 , 49 , 64 , k1_LeftMouseButton ) ,
MouseInput ( k48_CommandClickOnSlotBoxInventoryBackpackLine_2_8 , 185 , 200 , 49 , 64 , k1_LeftMouseButton ) ,
MouseInput ( k49_CommandClickOnSlotBoxInventoryBackpackLine_2_9 , 202 , 217 , 49 , 64 , k1_LeftMouseButton ) ,
MouseInput ( k50_CommandClickOnSlotBoxInventoryBackpackLine_1_2 , 83 , 98 , 66 , 81 , k1_LeftMouseButton ) ,
MouseInput ( k51_CommandClickOnSlotBoxInventoryBackpackLine_1_3 , 100 , 115 , 66 , 81 , k1_LeftMouseButton ) ,
MouseInput ( k52_CommandClickOnSlotBoxInventoryBackpackLine_1_4 , 117 , 132 , 66 , 81 , k1_LeftMouseButton ) ,
MouseInput ( k53_CommandClickOnSlotBoxInventoryBackpackLine_1_5 , 134 , 149 , 66 , 81 , k1_LeftMouseButton ) ,
MouseInput ( k54_CommandClickOnSlotBoxInventoryBackpackLine_1_6 , 151 , 166 , 66 , 81 , k1_LeftMouseButton ) ,
MouseInput ( k55_CommandClickOnSlotBoxInventoryBackpackLine_1_7 , 168 , 183 , 66 , 81 , k1_LeftMouseButton ) ,
MouseInput ( k56_CommandClickOnSlotBoxInventoryBackpackLine_1_8 , 185 , 200 , 66 , 81 , k1_LeftMouseButton ) ,
MouseInput ( k57_CommandClickOnSlotBoxInventoryBackpackLine_1_9 , 202 , 217 , 66 , 81 , k1_LeftMouseButton ) ,
MouseInput ( k81_CommandClickInPanel , 96 , 223 , 83 , 167 , k1_LeftMouseButton ) ,
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g450_PrimaryMouseInput_PartySleeping [ 3 ] = { // @ G0450_as_Graphic561_PrimaryMouseInput_PartySleeping[3]
2016-06-16 15:16:45 +02:00
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
2016-07-02 02:58:44 +02:00
MouseInput ( k146_CommandWakeUp , 0 , 223 , 33 , 168 , k1_LeftMouseButton ) ,
MouseInput ( k146_CommandWakeUp , 0 , 223 , 33 , 168 , k2_RightMouseButton ) ,
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g451_PrimaryMouseInput_FrozenGame [ 3 ] = { // @ G0451_as_Graphic561_PrimaryMouseInput_FrozenGame[3]
2016-06-16 15:16:45 +02:00
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
2016-07-02 02:58:44 +02:00
MouseInput ( k148_CommandUnfreezeGame , 0 , 319 , 0 , 199 , k1_LeftMouseButton ) ,
MouseInput ( k148_CommandUnfreezeGame , 0 , 319 , 0 , 199 , k2_RightMouseButton ) ,
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g452_MouseInput_ActionAreaNames [ 5 ] = { // @ G0452_as_Graphic561_MouseInput_ActionAreaNames[5]
2016-06-16 15:16:45 +02:00
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
2016-07-02 02:58:44 +02:00
MouseInput ( k112_CommandClickInActionAreaPass , 285 , 318 , 77 , 83 , k1_LeftMouseButton ) ,
MouseInput ( k113_CommandClickInActionAreaAction_0 , 234 , 318 , 86 , 96 , k1_LeftMouseButton ) ,
MouseInput ( k114_CommandClickInActionAreaAction_1 , 234 , 318 , 98 , 108 , k1_LeftMouseButton ) ,
MouseInput ( k115_CommandClickInActionAreaAction_2 , 234 , 318 , 110 , 120 , k1_LeftMouseButton ) ,
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g453_MouseInput_ActionAreaIcons [ 5 ] = { // @ G0453_as_Graphic561_MouseInput_ActionAreaIcons[5]
2016-06-16 15:16:45 +02:00
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
2016-07-02 02:58:44 +02:00
MouseInput ( k116_CommandClickInActionAreaChampion_0_Action , 233 , 252 , 86 , 120 , k1_LeftMouseButton ) ,
MouseInput ( k117_CommandClickInActionAreaChampion_1_Action , 255 , 274 , 86 , 120 , k1_LeftMouseButton ) ,
MouseInput ( k118_CommandClickInActionAreaChampion_2_Action , 277 , 296 , 86 , 120 , k1_LeftMouseButton ) ,
MouseInput ( k119_CommandClickInActionAreaChampion_3_Action , 299 , 318 , 86 , 120 , k1_LeftMouseButton ) ,
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g454_MouseInput_SpellArea [ 9 ] = { // @ G0454_as_Graphic561_MouseInput_SpellArea[9]
2016-06-16 15:16:45 +02:00
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
2016-07-02 02:58:44 +02:00
MouseInput ( k101_CommandClickInSpellAreaSymbol_1 , 235 , 247 , 51 , 61 , k1_LeftMouseButton ) ,
MouseInput ( k102_CommandClickInSpellAreaSymbol_2 , 249 , 261 , 51 , 61 , k1_LeftMouseButton ) ,
MouseInput ( k103_CommandClickInSpellAreaSymbol_3 , 263 , 275 , 51 , 61 , k1_LeftMouseButton ) ,
MouseInput ( k104_CommandClickInSpellAreaSymbol_4 , 277 , 289 , 51 , 61 , k1_LeftMouseButton ) ,
MouseInput ( k105_CommandClickInSpellAreaSymbol_5 , 291 , 303 , 51 , 61 , k1_LeftMouseButton ) ,
MouseInput ( k106_CommandClickInSpellAreaSymbol_6 , 305 , 317 , 51 , 61 , k1_LeftMouseButton ) ,
MouseInput ( k108_CommandClickInSpeallAreaCastSpell , 234 , 303 , 63 , 73 , k1_LeftMouseButton ) ,
MouseInput ( k107_CommandClickInSpellAreaRecantSymbol , 305 , 318 , 63 , 73 , k1_LeftMouseButton ) ,
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g455_MouseInput_ChampionNamesHands [ 13 ] = { // @ G0455_as_Graphic561_MouseInput_ChampionNamesHands[13]
2016-06-16 15:16:45 +02:00
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
2016-07-02 02:58:44 +02:00
MouseInput ( k16_CommandSetLeaderChampion_0 , 0 , 42 , 0 , 6 , k1_LeftMouseButton ) ,
MouseInput ( k17_CommandSetLeaderChampion_1 , 69 , 111 , 0 , 6 , k1_LeftMouseButton ) ,
MouseInput ( k18_CommandSetLeaderChampion_2 , 138 , 180 , 0 , 6 , k1_LeftMouseButton ) ,
MouseInput ( k19_CommandSetLeaderChampion_3 , 207 , 249 , 0 , 6 , k1_LeftMouseButton ) ,
MouseInput ( k20_CommandClickOnSlotBoxChampion_0_StatusBoxReadyHand , 4 , 19 , 10 , 25 , k1_LeftMouseButton ) ,
MouseInput ( k21_CommandClickOnSlotBoxChampion_0_StatusBoxActionHand , 24 , 39 , 10 , 25 , k1_LeftMouseButton ) ,
MouseInput ( k22_CommandClickOnSlotBoxChampion_1_StatusBoxReadyHand , 73 , 88 , 10 , 25 , k1_LeftMouseButton ) ,
MouseInput ( k23_CommandClickOnSlotBoxChampion_1_StatusBoxActionHand , 93 , 108 , 10 , 25 , k1_LeftMouseButton ) ,
MouseInput ( k24_CommandClickOnSlotBoxChampion_2_StatusBoxReadyHand , 142 , 157 , 10 , 25 , k1_LeftMouseButton ) ,
MouseInput ( k25_CommandClickOnSlotBoxChampion_2_StatusBoxActionHand , 162 , 177 , 10 , 25 , k1_LeftMouseButton ) ,
MouseInput ( k26_CommandClickOnSlotBoxChampion_3_StatusBoxReadyHand , 211 , 226 , 10 , 25 , k1_LeftMouseButton ) ,
MouseInput ( k27_CommandClickOnSlotBoxChampion_3_StatusBoxActionHand , 231 , 246 , 10 , 25 , k1_LeftMouseButton ) ,
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g456_MouseInput_PanelChest [ 9 ] = { // @ G0456_as_Graphic561_MouseInput_PanelChest[9]
2016-06-16 15:16:45 +02:00
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
2016-07-02 02:58:44 +02:00
MouseInput ( k58_CommandClickOnSlotBoxChest_1 , 117 , 132 , 92 , 107 , k1_LeftMouseButton ) ,
MouseInput ( k59_CommandClickOnSlotBoxChest_2 , 106 , 121 , 109 , 124 , k1_LeftMouseButton ) ,
MouseInput ( k60_CommandClickOnSlotBoxChest_3 , 111 , 126 , 126 , 141 , k1_LeftMouseButton ) ,
MouseInput ( k61_CommandClickOnSlotBoxChest_4 , 128 , 143 , 131 , 146 , k1_LeftMouseButton ) ,
MouseInput ( k62_CommandClickOnSlotBoxChest_5 , 145 , 160 , 134 , 149 , k1_LeftMouseButton ) ,
MouseInput ( k63_CommandClickOnSlotBoxChest_6 , 162 , 177 , 136 , 151 , k1_LeftMouseButton ) ,
MouseInput ( k64_CommandClickOnSlotBoxChest_7 , 179 , 194 , 137 , 152 , k1_LeftMouseButton ) ,
MouseInput ( k65_CommandClickOnSlotBoxChest_8 , 196 , 211 , 138 , 153 , k1_LeftMouseButton ) ,
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g457_MouseInput_PanelResurrectReincarnateCancel [ 4 ] = { // @ G0457_as_Graphic561_MouseInput_PanelResurrectReincarnateCancel[4]
2016-06-16 15:16:45 +02:00
/* { Command, Box.X1, Box.X2, Box.Y1, Box.Y2, Button } */
2016-07-02 02:58:44 +02:00
MouseInput ( k160_CommandClickInPanelResurrect , 108 , 158 , 90 , 138 , k1_LeftMouseButton ) , /* Atari ST: Box = 104, 158, 86, 142 */
MouseInput ( k161_CommandClickInPanelReincarnate , 161 , 211 , 90 , 138 , k1_LeftMouseButton ) , /* Atari ST: Box = 163, 217, 86, 142 */
MouseInput ( k162_CommandClickInPanelCancel , 108 , 211 , 141 , 153 , k1_LeftMouseButton ) , /* Atari ST: Box = 104, 217, 146, 156 */
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g471_PrimaryMouseInput_ViewportDialog1Choice [ 2 ] = { // @ G0471_as_Graphic561_PrimaryMouseInput_ViewportDialog1Choice[2]
MouseInput ( k210_CommandClickOnDialogChoice_1 , 16 , 207 , 138 , 152 , k1_LeftMouseButton ) , /* Bottom button */
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g472_PrimaryMouseInput_ViewportDialog2Choices [ 3 ] = { // @ G0472_as_Graphic561_PrimaryMouseInput_ViewportDialog2Choices[3]
MouseInput ( k210_CommandClickOnDialogChoice_1 , 16 , 207 , 101 , 115 , k1_LeftMouseButton ) , /* Top button */
MouseInput ( k211_CommandClickOnDialogChoice_2 , 16 , 207 , 138 , 152 , k1_LeftMouseButton ) , /* Bottom button */
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g473_PrimaryMouseInput_ViewportDialog3Choices [ 4 ] = { // @ G0473_as_Graphic561_PrimaryMouseInput_ViewportDialog3Choices[4]
MouseInput ( k210_CommandClickOnDialogChoice_1 , 16 , 207 , 101 , 115 , k1_LeftMouseButton ) , /* Top button */
MouseInput ( k211_CommandClickOnDialogChoice_2 , 16 , 101 , 138 , 152 , k1_LeftMouseButton ) , /* Lower left button */
MouseInput ( k212_CommandClickOnDialogChoice_3 , 123 , 207 , 138 , 152 , k1_LeftMouseButton ) , /* Lower right button */
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g474_PrimaryMouseInput_ViewportDialog4Choices [ 5 ] = { // @ G0474_as_Graphic561_PrimaryMouseInput_ViewportDialog4Choices[5]
MouseInput ( k210_CommandClickOnDialogChoice_1 , 16 , 101 , 101 , 115 , k1_LeftMouseButton ) , /* Top left button */
MouseInput ( k211_CommandClickOnDialogChoice_2 , 123 , 207 , 101 , 115 , k1_LeftMouseButton ) , /* Top right button */
MouseInput ( k212_CommandClickOnDialogChoice_3 , 16 , 101 , 138 , 152 , k1_LeftMouseButton ) , /* Lower left button */
MouseInput ( k213_CommandClickOnDialogChoice_4 , 123 , 207 , 138 , 152 , k1_LeftMouseButton ) , /* Lower right button */
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g475_PrimaryMouseInput_ScreenDialog1Choice [ 2 ] = { // @ G0475_as_Graphic561_PrimaryMouseInput_ScreenDialog1Choice[2]
MouseInput ( k210_CommandClickOnDialogChoice_1 , 63 , 254 , 138 , 152 , k1_LeftMouseButton ) , /* Bottom button */
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g476_PrimaryMouseInput_ScreenDialog2Choices [ 3 ] = { // @ G0476_as_Graphic561_PrimaryMouseInput_ScreenDialog2Choices[3]
MouseInput ( k210_CommandClickOnDialogChoice_1 , 63 , 254 , 101 , 115 , k1_LeftMouseButton ) , /* Top button */
MouseInput ( k211_CommandClickOnDialogChoice_2 , 63 , 254 , 138 , 152 , k1_LeftMouseButton ) , /* Bottom button */
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g477_PrimaryMouseInput_ScreenDialog3Choices [ 4 ] = { // @ G0477_as_Graphic561_PrimaryMouseInput_ScreenDialog3Choices[4]
MouseInput ( k210_CommandClickOnDialogChoice_1 , 63 , 254 , 101 , 115 , k1_LeftMouseButton ) , /* Top button */
MouseInput ( k211_CommandClickOnDialogChoice_2 , 63 , 148 , 138 , 152 , k1_LeftMouseButton ) , /* Lower left button */
MouseInput ( k212_CommandClickOnDialogChoice_3 , 170 , 254 , 138 , 152 , k1_LeftMouseButton ) , /* Lower right button */
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput g478_PrimaryMouseInput_ScreenDialog4Choices [ 5 ] = { // @ G0478_as_Graphic561_PrimaryMouseInput_ScreenDialog4Choices[5]
MouseInput ( k210_CommandClickOnDialogChoice_1 , 63 , 148 , 101 , 115 , k1_LeftMouseButton ) , /* Top left button */
MouseInput ( k211_CommandClickOnDialogChoice_2 , 170 , 254 , 101 , 115 , k1_LeftMouseButton ) , /* Top right button */
MouseInput ( k212_CommandClickOnDialogChoice_3 , 63 , 148 , 138 , 152 , k1_LeftMouseButton ) , /* Lower left button */
MouseInput ( k213_CommandClickOnDialogChoice_4 , 170 , 254 , 138 , 152 , k1_LeftMouseButton ) , /* Lower right button */
MouseInput ( k0_CommandNone , 0 , 0 , 0 , 0 , k0_NoneMouseButton ) } ;
MouseInput * g480_PrimaryMouseInput_DialogSets [ 2 ] [ 4 ] = { // @ G0480_aaps_PrimaryMouseInput_DialogSets
{ g471_PrimaryMouseInput_ViewportDialog1Choice ,
g472_PrimaryMouseInput_ViewportDialog2Choices ,
g473_PrimaryMouseInput_ViewportDialog3Choices ,
g474_PrimaryMouseInput_ViewportDialog4Choices } ,
{ g475_PrimaryMouseInput_ScreenDialog1Choice ,
g476_PrimaryMouseInput_ScreenDialog2Choices ,
g477_PrimaryMouseInput_ScreenDialog3Choices ,
g478_PrimaryMouseInput_ScreenDialog4Choices } , } ;
2016-06-16 15:16:45 +02:00
2016-06-15 18:22:32 +02:00
EventManager : : EventManager ( DMEngine * vm ) : _vm ( vm ) {
2016-07-02 02:58:44 +02:00
_g441_primaryMouseInput = nullptr ;
_g442_secondaryMouseInput = nullptr ;
2016-06-16 23:48:18 +02:00
2016-07-02 02:58:44 +02:00
_g436_pendingClickPresent = false ;
_g435_isCommandQueueLocked = true ;
_g598_mousePointerBitmapUpdated = false ;
_g326_refreshMousePointerInMainLoop = false ;
_g341_highlightBoxEnabled = false ;
2016-06-16 23:48:18 +02:00
_dummyMapIndex = 0 ;
2016-07-02 02:58:44 +02:00
_g439_pendingClickButton = k0_NoneMouseButton ;
2016-06-15 18:22:32 +02:00
}
// dummy data
static const byte mouseData [ ] = {
1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
1 , 7 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
1 , 7 , 7 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ,
1 , 7 , 7 , 7 , 1 , 0 , 0 , 0 , 0 , 0 ,
1 , 7 , 7 , 7 , 7 , 1 , 0 , 0 , 0 , 0 ,
1 , 7 , 7 , 7 , 7 , 7 , 1 , 0 , 0 , 0 ,
1 , 7 , 7 , 7 , 7 , 7 , 7 , 1 , 0 , 0 ,
1 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 1 , 0 ,
1 , 7 , 7 , 7 , 7 , 7 , 1 , 1 , 1 , 1 ,
1 , 7 , 7 , 1 , 7 , 7 , 1 , 0 , 0 , 0 ,
1 , 7 , 1 , 0 , 1 , 7 , 7 , 1 , 0 , 0 ,
1 , 1 , 0 , 0 , 1 , 7 , 7 , 1 , 0 , 0 ,
0 , 0 , 0 , 0 , 0 , 1 , 7 , 7 , 1 , 0 ,
0 , 0 , 0 , 0 , 0 , 1 , 7 , 7 , 1 , 0 ,
0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 , 0
} ;
# define MOUSE_WIDTH 10
# define MOUSE_HEIGHT 15
2016-06-15 10:41:33 +02:00
void EventManager : : initMouse ( ) {
_mousePos = Common : : Point ( 0 , 0 ) ;
2016-06-15 18:22:32 +02:00
CursorMan . pushCursor ( mouseData , MOUSE_WIDTH , MOUSE_HEIGHT , 0 , 0 , 0 ) ;
CursorMan . showMouse ( false ) ;
2016-06-16 23:48:18 +02:00
setMousePos ( Common : : Point ( 320 / 2 , 200 / 2 ) ) ;
2016-06-15 10:41:33 +02:00
// TODO: add cursor creatin, set to hidden
}
2016-06-15 18:22:32 +02:00
void EventManager : : showMouse ( bool visibility ) {
CursorMan . showMouse ( visibility ) ;
2016-06-15 10:41:33 +02:00
}
void EventManager : : setMousePos ( Common : : Point pos ) {
_vm - > _system - > warpMouse ( pos . x , pos . y ) ;
}
void EventManager : : processInput ( ) {
DungeonMan & dungeonMan = * _vm - > _dungeonMan ;
CurrMapData & currMap = dungeonMan . _currMap ;
Common : : Event event ;
while ( _vm - > _system - > getEventManager ( ) - > pollEvent ( event ) ) {
2016-06-16 23:48:18 +02:00
switch ( event . type ) {
2016-06-17 22:32:42 +02:00
// DUMMY CODE: case EVENT_KEYDOWN, only for testing
2016-06-16 23:48:18 +02:00
case Common : : EVENT_KEYDOWN :
if ( event . synthetic )
break ;
2016-06-15 10:41:33 +02:00
switch ( event . kbd . keycode ) {
case Common : : KEYCODE_w :
2016-08-26 22:43:17 +02:00
dungeonMan . mapCoordsAfterRelMovement ( dungeonMan . _currMap . _g308_partyDir , 1 , 0 , currMap . _g306_partyPosX , currMap . _g307_partyPosY ) ;
2016-06-15 10:41:33 +02:00
break ;
case Common : : KEYCODE_a :
2016-08-26 22:43:17 +02:00
dungeonMan . mapCoordsAfterRelMovement ( dungeonMan . _currMap . _g308_partyDir , 0 , - 1 , currMap . _g306_partyPosX , currMap . _g307_partyPosY ) ;
2016-06-15 10:41:33 +02:00
break ;
case Common : : KEYCODE_s :
2016-08-26 22:43:17 +02:00
dungeonMan . mapCoordsAfterRelMovement ( dungeonMan . _currMap . _g308_partyDir , - 1 , 0 , currMap . _g306_partyPosX , currMap . _g307_partyPosY ) ;
2016-06-15 10:41:33 +02:00
break ;
case Common : : KEYCODE_d :
2016-08-26 22:43:17 +02:00
dungeonMan . mapCoordsAfterRelMovement ( dungeonMan . _currMap . _g308_partyDir , 0 , 1 , currMap . _g306_partyPosX , currMap . _g307_partyPosY ) ;
2016-06-15 10:41:33 +02:00
break ;
case Common : : KEYCODE_q :
2016-08-26 22:43:17 +02:00
turnDirLeft ( currMap . _g308_partyDir ) ;
2016-06-15 10:41:33 +02:00
break ;
case Common : : KEYCODE_e :
2016-08-26 22:43:17 +02:00
turnDirRight ( currMap . _g308_partyDir ) ;
2016-06-15 10:41:33 +02:00
break ;
case Common : : KEYCODE_UP :
if ( _dummyMapIndex < 13 )
dungeonMan . setCurrentMapAndPartyMap ( + + _dummyMapIndex ) ;
break ;
case Common : : KEYCODE_DOWN :
if ( _dummyMapIndex > 0 )
dungeonMan . setCurrentMapAndPartyMap ( - - _dummyMapIndex ) ;
break ;
2016-06-23 23:22:50 +02:00
default :
break ;
2016-06-15 10:41:33 +02:00
}
2016-06-16 23:48:18 +02:00
case Common : : EVENT_MOUSEMOVE :
2016-06-15 10:41:33 +02:00
_mousePos = event . mouse ;
2016-06-16 23:48:18 +02:00
break ;
2016-06-17 14:29:05 +02:00
case Common : : EVENT_LBUTTONDOWN :
case Common : : EVENT_RBUTTONDOWN :
2016-07-02 02:58:44 +02:00
_g436_pendingClickPresent = true ;
_g437_pendingClickPos = _mousePos ;
_g439_pendingClickButton = ( event . type = = Common : : EVENT_LBUTTONDOWN ) ? k1_LeftMouseButton : k2_RightMouseButton ;
2016-06-16 23:48:18 +02:00
break ;
2016-06-23 23:22:50 +02:00
default :
break ;
2016-06-15 10:41:33 +02:00
}
}
}
2016-06-16 23:48:18 +02:00
void EventManager : : processPendingClick ( ) {
2016-07-02 02:58:44 +02:00
if ( _g436_pendingClickPresent ) {
_g436_pendingClickPresent = false ;
processClick ( _g437_pendingClickPos , _g439_pendingClickButton ) ;
2016-06-16 23:48:18 +02:00
}
}
void EventManager : : processClick ( Common : : Point mousePos , MouseButton button ) {
CommandType commandType ;
2016-07-02 02:58:44 +02:00
commandType = getCommandTypeFromMouseInput ( _g441_primaryMouseInput , mousePos , button ) ;
if ( commandType = = k0_CommandNone )
commandType = getCommandTypeFromMouseInput ( _g442_secondaryMouseInput , mousePos , button ) ;
2016-06-16 23:48:18 +02:00
2016-07-02 02:58:44 +02:00
if ( commandType ! = k0_CommandNone )
2016-06-16 23:48:18 +02:00
_commandQueue . push ( Command ( mousePos , commandType ) ) ;
2016-07-02 02:58:44 +02:00
_g435_isCommandQueueLocked = false ;
2016-06-16 23:48:18 +02:00
}
CommandType EventManager : : getCommandTypeFromMouseInput ( MouseInput * input , Common : : Point mousePos , MouseButton button ) {
if ( ! input )
2016-07-02 02:58:44 +02:00
return k0_CommandNone ;
CommandType commandType = k0_CommandNone ;
2016-06-16 23:48:18 +02:00
2016-07-02 02:58:44 +02:00
while ( ( commandType = input - > _commandTypeToIssue ) ! = k0_CommandNone ) {
2016-06-18 18:02:48 +02:00
if ( input - > _hitbox . isPointInside ( mousePos ) & & input - > _button = = button )
2016-06-16 23:48:18 +02:00
break ;
input + + ;
}
return commandType ;
}
2016-06-17 14:29:05 +02:00
void EventManager : : processCommandQueue ( ) {
2016-07-02 02:58:44 +02:00
_g435_isCommandQueueLocked = true ;
2016-06-17 14:29:05 +02:00
if ( _commandQueue . empty ( ) ) {
2016-07-02 02:58:44 +02:00
_g435_isCommandQueueLocked = false ;
2016-06-17 14:29:05 +02:00
processPendingClick ( ) ;
return ;
}
Command cmd = _commandQueue . pop ( ) ;
2016-06-23 23:54:37 +02:00
int16 commandX = cmd . _pos . x ;
int16 commandY = cmd . _pos . y ;
2016-06-17 14:29:05 +02:00
2016-07-02 02:58:44 +02:00
_g435_isCommandQueueLocked = false ;
2016-06-17 14:29:05 +02:00
processPendingClick ( ) ;
2016-07-02 02:58:44 +02:00
if ( ( cmd . _type = = k2_CommandTurnRight ) | | ( cmd . _type = = k1_CommandTurnLeft ) ) {
2016-06-18 18:02:48 +02:00
commandTurnParty ( cmd . _type ) ;
2016-06-17 14:29:05 +02:00
return ;
}
2016-07-02 02:58:44 +02:00
if ( ( cmd . _type > = k3_CommandMoveForward ) & & ( cmd . _type < = k6_CommandMoveLeft ) ) {
2016-06-18 18:02:48 +02:00
commandMoveParty ( cmd . _type ) ;
2016-06-17 14:29:05 +02:00
return ;
2016-06-23 17:32:55 +02:00
}
2016-07-02 02:58:44 +02:00
if ( cmd . _type = = k80_CommandClickInDungeonView ) {
2016-06-23 23:54:37 +02:00
commandProcessType80ClickInDungeonView ( commandX , commandY ) ;
2016-06-17 14:29:05 +02:00
}
2016-07-02 02:58:44 +02:00
if ( cmd . _type = = k81_CommandClickInPanel ) {
2016-06-24 02:08:26 +02:00
commandProcess81ClickInPanel ( commandX , commandY ) ;
}
2016-06-17 14:29:05 +02:00
// MISSING CODE: the rest of the function
}
void EventManager : : commandTurnParty ( CommandType cmdType ) {
2016-08-26 22:43:17 +02:00
_vm - > _g321_stopWaitingForPlayerInput = true ;
2016-06-17 14:29:05 +02:00
// MISSING CODE: highlight turn left/right buttons
// MISSING CODE: processing stairs
// MISSING CODE: process sensors
// DUMMY CODE: should call F0284_CHAMPION_SetPartyDirection instead
2016-08-26 22:43:17 +02:00
direction & partyDir = _vm - > _dungeonMan - > _currMap . _g308_partyDir ;
2016-07-02 02:58:44 +02:00
( cmdType = = k1_CommandTurnLeft ) ? turnDirLeft ( partyDir ) : turnDirRight ( partyDir ) ;
2016-06-17 14:29:05 +02:00
// MISSING CODE: process sensors
}
void EventManager : : commandMoveParty ( CommandType cmdType ) {
2016-08-26 22:43:17 +02:00
_vm - > _g321_stopWaitingForPlayerInput = true ;
2016-06-17 14:29:05 +02:00
// MISSING CODE: Lots of code
// DUMMY CODE:
DungeonMan & dungeonMan = * _vm - > _dungeonMan ;
CurrMapData & currMap = dungeonMan . _currMap ;
switch ( cmdType ) {
2016-07-02 02:58:44 +02:00
case k3_CommandMoveForward :
2016-08-26 22:43:17 +02:00
dungeonMan . mapCoordsAfterRelMovement ( dungeonMan . _currMap . _g308_partyDir , 1 , 0 , currMap . _g306_partyPosX , currMap . _g307_partyPosY ) ;
2016-06-17 14:29:05 +02:00
break ;
2016-07-02 02:58:44 +02:00
case k6_CommandMoveLeft :
2016-08-26 22:43:17 +02:00
dungeonMan . mapCoordsAfterRelMovement ( dungeonMan . _currMap . _g308_partyDir , 0 , - 1 , currMap . _g306_partyPosX , currMap . _g307_partyPosY ) ;
2016-06-17 14:29:05 +02:00
break ;
2016-07-02 02:58:44 +02:00
case k5_CommandMoveBackward :
2016-08-26 22:43:17 +02:00
dungeonMan . mapCoordsAfterRelMovement ( dungeonMan . _currMap . _g308_partyDir , - 1 , 0 , currMap . _g306_partyPosX , currMap . _g307_partyPosY ) ;
2016-06-17 14:29:05 +02:00
break ;
2016-07-02 02:58:44 +02:00
case k4_CommandMoveRight :
2016-08-26 22:43:17 +02:00
dungeonMan . mapCoordsAfterRelMovement ( dungeonMan . _currMap . _g308_partyDir , 0 , 1 , currMap . _g306_partyPosX , currMap . _g307_partyPosY ) ;
2016-06-17 14:29:05 +02:00
break ;
2016-06-23 23:22:50 +02:00
default :
break ;
2016-06-17 14:29:05 +02:00
}
// MISSING CODE: Lots of code
}
2016-08-26 22:24:42 +02:00
void EventManager : : commandSetLeader ( ChampionIndex champIndex ) {
2016-06-18 16:23:44 +02:00
ChampionMan & cm = * _vm - > _championMan ;
ChampionIndex leaderIndex ;
2016-07-02 01:55:48 +02:00
if ( ( cm . _g411_leaderIndex = = champIndex ) | | ( ( champIndex ! = kM1_ChampionNone ) & & ! cm . _champions [ champIndex ] . _currHealth ) )
2016-06-18 16:23:44 +02:00
return ;
2016-07-02 01:55:48 +02:00
if ( cm . _g411_leaderIndex ! = kM1_ChampionNone ) {
leaderIndex = cm . _g411_leaderIndex ;
cm . _champions [ leaderIndex ] . setAttributeFlag ( k0x0200_ChampionAttributeLoad , true ) ;
cm . _champions [ leaderIndex ] . setAttributeFlag ( k0x0080_ChampionAttributeNameTitle , true ) ;
cm . _champions [ leaderIndex ] . _load - = _vm - > _dungeonMan - > getObjectWeight ( cm . _414_leaderHandObject ) ;
cm . _g411_leaderIndex = kM1_ChampionNone ;
2016-08-26 22:24:42 +02:00
cm . drawChampionState ( leaderIndex ) ;
2016-06-18 16:23:44 +02:00
}
2016-07-02 01:55:48 +02:00
if ( champIndex = = kM1_ChampionNone ) {
cm . _g411_leaderIndex = kM1_ChampionNone ;
2016-06-18 16:23:44 +02:00
return ;
}
2016-07-02 01:55:48 +02:00
cm . _g411_leaderIndex = champIndex ;
Champion * champion = & cm . _champions [ cm . _g411_leaderIndex ] ;
2016-08-26 22:43:17 +02:00
champion - > _dir = _vm - > _dungeonMan - > _currMap . _g308_partyDir ;
2016-07-02 01:55:48 +02:00
cm . _champions [ champIndex ] . _load + = _vm - > _dungeonMan - > getObjectWeight ( cm . _414_leaderHandObject ) ;
if ( _vm - > indexToOrdinal ( champIndex ) ! = cm . _g299_candidateChampionOrdinal ) {
champion - > setAttributeFlag ( k0x0400_ChampionAttributeIcon , true ) ;
champion - > setAttributeFlag ( k0x0080_ChampionAttributeNameTitle , true ) ;
2016-08-26 22:24:42 +02:00
cm . drawChampionState ( champIndex ) ;
2016-06-18 16:23:44 +02:00
}
}
2016-06-17 14:29:05 +02:00
2016-06-23 17:32:55 +02:00
void EventManager : : commandProcessType80ClickInDungeonViewTouchFrontWall ( ) {
DungeonMan & dunMan = * _vm - > _dungeonMan ;
CurrMapData & currMap = dunMan . _currMap ;
2016-08-26 22:43:17 +02:00
int16 mapX = currMap . _g306_partyPosX + _vm - > _dirIntoStepCountEast [ currMap . _g308_partyDir ] ;
int16 mapY = currMap . _g307_partyPosY + _vm - > _dirIntoStepCountNorth [ currMap . _g308_partyDir ] ;
if ( ( mapX > = 0 ) & & ( mapX < currMap . _g273_width ) & & ( mapY > = 0 ) & & ( mapY < currMap . _g274_height ) ) {
_vm - > _g321_stopWaitingForPlayerInput = _vm - > _movsens - > sensorIsTriggeredByClickOnWall ( mapX , mapY , returnOppositeDir ( currMap . _g308_partyDir ) ) ;
2016-06-23 17:32:55 +02:00
}
}
2016-06-23 23:54:37 +02:00
void EventManager : : commandProcessType80ClickInDungeonView ( int16 posX , int16 posY ) {
DungeonMan & dunMan = * _vm - > _dungeonMan ;
ChampionMan & champMan = * _vm - > _championMan ;
CurrMapData & currMap = _vm - > _dungeonMan - > _currMap ;
2016-08-26 22:43:17 +02:00
if ( dunMan . _g285_squareAheadElement = = k17_ElementTypeDoorFront ) {
2016-07-02 01:55:48 +02:00
if ( champMan . _g411_leaderIndex = = kM1_ChampionNone )
2016-06-23 23:54:37 +02:00
return ;
2016-07-02 01:55:48 +02:00
if ( champMan . _g415_leaderEmptyHanded ) {
2016-08-26 22:43:17 +02:00
int16 mapX = currMap . _g306_partyPosX + _vm - > _dirIntoStepCountEast [ currMap . _g308_partyDir ] ;
int16 mapY = currMap . _g307_partyPosY + _vm - > _dirIntoStepCountNorth [ currMap . _g308_partyDir ] ;
2016-06-27 22:01:40 +02:00
2016-06-23 23:54:37 +02:00
if ( Door ( dunMan . getSquareFirstThingData ( mapX , mapY ) ) . hasButton ( ) & &
2016-08-26 22:43:17 +02:00
dunMan . _g291_dungeonViewClickableBoxes [ k5_ViewCellDoorButtonOrWallOrn ] . isPointInside ( Common : : Point ( posX , posY - 33 ) ) ) {
_vm - > _g321_stopWaitingForPlayerInput = true ;
2016-06-23 23:54:37 +02:00
warning ( " MISSING CODE: F0064_SOUND_RequestPlay_CPSD " ) ;
warning ( " MISSING CODE: F0268_SENSOR_AddEvent " ) ;
return ;
}
warning ( " MISSING CODE: F0375_COMMAND_ProcessType80_ClickInDungeonView_IsLeaderHandObjectThrown in elseif condition " ) ;
}
}
2016-07-02 01:55:48 +02:00
if ( champMan . _g415_leaderEmptyHanded ) {
2016-07-02 00:27:05 +02:00
for ( int16 viewCell = k0_ViewCellFronLeft ; viewCell < = k5_ViewCellDoorButtonOrWallOrn ; viewCell + + ) {
2016-08-26 22:43:17 +02:00
if ( dunMan . _g291_dungeonViewClickableBoxes [ viewCell ] . isPointInside ( Common : : Point ( posX , posY - 33 ) ) ) {
2016-07-02 00:27:05 +02:00
if ( viewCell = = k5_ViewCellDoorButtonOrWallOrn ) {
2016-08-26 22:43:17 +02:00
if ( ! dunMan . _g286_isFacingAlcove ) {
2016-06-23 23:54:37 +02:00
commandProcessType80ClickInDungeonViewTouchFrontWall ( ) ;
2016-06-24 01:43:43 +02:00
}
2016-06-23 23:54:37 +02:00
} else {
warning ( " MISSING CODE: F0373_COMMAND_ProcessType80_ClickInDungeonView_GrabLeaderHandObject " ) ;
}
return ;
}
}
} else {
2016-07-02 01:55:48 +02:00
Thing thing = champMan . _414_leaderHandObject ;
2016-06-23 23:54:37 +02:00
uint16 * rawThingPointer = dunMan . getThingData ( thing ) ;
2016-08-26 22:43:17 +02:00
if ( dunMan . _g285_squareAheadElement = = k0_ElementTypeWall ) {
2016-07-02 00:27:05 +02:00
for ( int16 viewCell = k0_ViewCellFronLeft ; viewCell < = k1_ViewCellFrontRight ; + + viewCell ) {
2016-07-02 02:58:44 +02:00
if ( g462_BoxObjectPiles [ viewCell ] . isPointInside ( Common : : Point ( posX , posY ) ) ) {
2016-06-23 23:54:37 +02:00
warning ( " F0374_COMMAND_ProcessType80_ClickInDungeonView_DropLeaderHandObject " ) ;
return ;
}
}
2016-08-26 22:43:17 +02:00
if ( dunMan . _g291_dungeonViewClickableBoxes [ k5_ViewCellDoorButtonOrWallOrn ] . isPointInside ( Common : : Point ( posX , posY - 33 ) ) ) {
if ( dunMan . _g286_isFacingAlcove ) {
2016-06-23 23:54:37 +02:00
warning ( " MISSING CODE: F0374_COMMAND_ProcessType80_ClickInDungeonView_DropLeaderHandObject " ) ;
} else {
2016-08-26 22:43:17 +02:00
if ( dunMan . _g288_isFacingFountain ) {
2016-06-23 23:54:37 +02:00
uint16 iconIndex = _vm - > _objectMan - > getIconIndex ( thing ) ;
int16 weight = dunMan . getObjectWeight ( thing ) ;
2016-07-02 01:55:48 +02:00
if ( ( iconIndex > = k8_IconIndiceJunkWater ) & & ( iconIndex < = k9_IconIndiceJunkWaterSkin ) ) {
2016-06-23 23:54:37 +02:00
( ( Junk * ) rawThingPointer ) - > setChargeCount ( 3 ) ;
2016-07-02 01:55:48 +02:00
} else if ( iconIndex = = k195_IconIndicePotionEmptyFlask ) {
2016-08-26 22:43:17 +02:00
( ( Potion * ) rawThingPointer ) - > setType ( k15_PotionTypeWaterFlask ) ;
2016-06-23 23:54:37 +02:00
} else {
goto T0377019 ;
}
2016-06-28 23:16:34 +02:00
champMan . drawChangedObjectIcons ( ) ;
2016-07-02 01:55:48 +02:00
champMan . _champions [ champMan . _g411_leaderIndex ] . _load + = dunMan . getObjectWeight ( thing ) - weight ;
2016-06-23 23:54:37 +02:00
}
T0377019 :
commandProcessType80ClickInDungeonViewTouchFrontWall ( ) ;
}
}
} else {
warning ( " MISSING CODE: F0375_COMMAND_ProcessType80_ClickInDungeonView_IsLeaderHandObjectThrown in if branch " ) ;
2016-07-02 00:27:05 +02:00
for ( int16 viewCell = k0_ViewCellFronLeft ; viewCell < = k3_ViewCellBackLeft ; viewCell + + ) {
2016-07-02 02:58:44 +02:00
if ( g462_BoxObjectPiles [ viewCell ] . isPointInside ( Common : : Point ( posX , posY ) ) ) {
2016-06-23 23:54:37 +02:00
warning ( " MISSING CODE: F0374_COMMAND_ProcessType80_ClickInDungeonView_DropLeaderHandObject " ) ;
return ;
}
}
}
}
}
2016-06-24 01:43:43 +02:00
void EventManager : : commandProcessCommands160To162ClickInResurrectReincarnatePanel ( CommandType commandType ) {
ChampionMan & champMan = * _vm - > _championMan ;
InventoryMan & invMan = * _vm - > _inventoryMan ;
DisplayMan & dispMan = * _vm - > _displayMan ;
CurrMapData & currMap = _vm - > _dungeonMan - > _currMap ;
DungeonMan & dunMan = * _vm - > _dungeonMan ;
2016-07-02 01:55:48 +02:00
uint16 championIndex = champMan . _g305_partyChampionCount - 1 ;
2016-06-24 01:43:43 +02:00
Champion * champ = & champMan . _champions [ championIndex ] ;
2016-07-02 02:58:44 +02:00
if ( commandType = = k162_CommandClickInPanelCancel ) {
2016-07-02 01:55:48 +02:00
invMan . toggleInventory ( k4_ChampionCloseInventory ) ;
champMan . _g299_candidateChampionOrdinal = _vm - > indexToOrdinal ( kM1_ChampionNone ) ;
if ( champMan . _g305_partyChampionCount = = 1 ) {
commandSetLeader ( kM1_ChampionNone ) ;
2016-06-24 01:43:43 +02:00
}
2016-07-02 01:55:48 +02:00
champMan . _g305_partyChampionCount - - ;
2016-06-24 01:43:43 +02:00
Box box ;
box . _y1 = 0 ;
box . _y2 = 28 + 1 ;
box . _x1 = championIndex * kChampionStatusBoxSpacing ;
box . _x2 = box . _x1 + 66 + 1 ;
2016-07-02 00:27:05 +02:00
dispMan . _g578_useByteBoxCoordinates = false ;
dispMan . clearScreenBox ( k0_ColorBlack , box ) ;
2016-08-26 22:43:17 +02:00
dispMan . clearScreenBox ( k0_ColorBlack , g54_BoxChampionIcons [ champMan . championIconIndex ( champ - > _cell , currMap . _g308_partyDir ) * 2 ] ) ;
2016-06-24 01:43:43 +02:00
warning ( " F0457_START_DrawEnabledMenus_CPSF " ) ;
warning ( " F0078_MOUSE_ShowPointer " ) ;
return ;
}
2016-07-02 01:55:48 +02:00
champMan . _g299_candidateChampionOrdinal = _vm - > indexToOrdinal ( kM1_ChampionNone ) ;
2016-08-26 22:43:17 +02:00
int16 mapX = currMap . _g306_partyPosX + _vm - > _dirIntoStepCountEast [ currMap . _g308_partyDir ] ;
int16 mapY = currMap . _g307_partyPosY + _vm - > _dirIntoStepCountNorth [ currMap . _g308_partyDir ] ;
2016-06-24 01:43:43 +02:00
2016-07-02 01:55:48 +02:00
for ( uint16 slotIndex = k0_ChampionSlotReadyHand ; slotIndex < k30_ChampionSlotChest_1 ; slotIndex + + ) {
2016-06-24 01:43:43 +02:00
Thing thing = champ - > getSlot ( ( ChampionSlot ) slotIndex ) ;
2016-06-30 13:29:42 +02:00
if ( thing ! = Thing : : _none ) {
2016-06-24 01:43:43 +02:00
warning ( " MISSING CODE: F0164_DUNGEON_UnlinkThingFromList " ) ;
}
}
Thing thing = dunMan . getSquareFirstThing ( mapX , mapY ) ;
for ( ; ; ) { // infinite
2016-08-26 22:43:17 +02:00
if ( thing . getType ( ) = = k3_SensorThingType ) {
2016-06-24 01:43:43 +02:00
( ( Sensor * ) dunMan . getThingData ( thing ) ) - > setTypeDisabled ( ) ;
break ;
}
thing = dunMan . getNextThing ( thing ) ;
}
2016-07-02 02:58:44 +02:00
if ( commandType = = k161_CommandClickInPanelReincarnate ) {
2016-06-25 13:31:47 +02:00
champMan . renameChampion ( champ ) ;
2016-06-24 01:43:43 +02:00
champ - > resetSkillsToZero ( ) ;
for ( uint16 i = 0 ; i < 12 ; i + + ) {
uint16 statIndex = _vm - > _rnd - > getRandomNumber ( 7 ) ;
2016-07-02 01:55:48 +02:00
champ - > getStatistic ( ( ChampionStatisticType ) statIndex , k1_ChampionStatCurrent ) + + ; // returns reference
champ - > getStatistic ( ( ChampionStatisticType ) statIndex , k0_ChampionStatMaximum ) + + ; // returns reference
2016-06-24 01:43:43 +02:00
}
}
2016-07-02 01:55:48 +02:00
if ( champMan . _g305_partyChampionCount = = 1 ) {
2016-06-24 01:43:43 +02:00
warning ( " MISSING CODE: setting time, G0362_l_LastPartyMovementTime , G0313_ul_GameTime " ) ;
2016-07-02 01:55:48 +02:00
commandSetLeader ( k0_ChampionFirst ) ;
_vm - > _menuMan - > setMagicCasterAndDrawSpellArea ( k0_ChampionFirst ) ;
2016-06-24 01:43:43 +02:00
} else {
2016-07-02 01:55:48 +02:00
_vm - > _menuMan - > drawSpellAreaControls ( champMan . _g514_magicCasterChampionIndex ) ;
2016-06-24 01:43:43 +02:00
}
warning ( " MISSING CODE: F0051_TEXT_MESSAGEAREA_PrintLineFeed " ) ;
2016-07-02 01:55:48 +02:00
Color champColor = g46_ChampionColor [ championIndex ] ; // unreferenced because of missing code
2016-06-24 01:43:43 +02:00
warning ( " MISSING CODE: F0047_TEXT_MESSAGEAREA_PrintMessage " ) ;
warning ( " MISSING CODE: F0047_TEXT_MESSAGEAREA_PrintMessage " ) ;
2016-07-02 01:55:48 +02:00
invMan . toggleInventory ( k4_ChampionCloseInventory ) ;
2016-06-24 01:43:43 +02:00
warning ( " MISSING CODE: F0457_START_DrawEnabledMenus_CPSF " ) ;
warning ( " MISSING CODE: F0067_MOUSE_SetPointerToNormal " ) ;
}
2016-06-24 02:08:26 +02:00
void EventManager : : commandProcess81ClickInPanel ( int16 x , int16 y ) {
ChampionMan & champMan = * _vm - > _championMan ;
InventoryMan & invMan = * _vm - > _inventoryMan ;
CommandType commandType ;
switch ( invMan . _panelContent ) {
case kPanelContentChest :
2016-07-02 01:55:48 +02:00
if ( champMan . _g411_leaderIndex = = kM1_ChampionNone ) // if no leader
2016-06-24 02:08:26 +02:00
return ;
2016-07-02 02:58:44 +02:00
commandType = getCommandTypeFromMouseInput ( g456_MouseInput_PanelChest , Common : : Point ( x , y ) , k1_LeftMouseButton ) ;
if ( commandType ! = k0_CommandNone )
2016-06-24 02:08:26 +02:00
warning ( " MISSING CODE: F0302_CHAMPION_ProcessCommands28To65_ClickOnSlotBox " ) ;
break ;
case kPanelContentResurrectReincarnate :
2016-07-02 01:55:48 +02:00
if ( ! champMan . _g415_leaderEmptyHanded )
2016-06-24 02:08:26 +02:00
break ;
2016-07-02 02:58:44 +02:00
commandType = getCommandTypeFromMouseInput ( g457_MouseInput_PanelResurrectReincarnateCancel , Common : : Point ( x , y ) , k1_LeftMouseButton ) ;
if ( commandType ! = k0_CommandNone )
2016-06-24 02:08:26 +02:00
commandProcessCommands160To162ClickInResurrectReincarnatePanel ( commandType ) ;
break ;
2016-06-27 22:41:18 +02:00
default :
break ;
2016-06-24 02:08:26 +02:00
}
}
2016-06-27 22:41:18 +02:00
bool EventManager : : hasPendingClick ( Common : : Point & point , MouseButton button ) {
2016-07-02 02:58:44 +02:00
if ( _g439_pendingClickButton & & button = = _g439_pendingClickButton )
point = _g437_pendingClickPos ;
2016-06-27 22:41:18 +02:00
2016-07-02 02:58:44 +02:00
return _g436_pendingClickPresent ;
2016-06-27 22:41:18 +02:00
}
2016-06-27 23:00:33 +02:00
} // end of namespace DM