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
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (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, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 */
22 
23 /*
24 * Based on the Reverse Engineering work of Christophe Fontanel,
25 * maintainer of the Dungeon Master Encyclopaedia (http://dmweb.free.fr/)
26 */
27 
28 #ifndef DM_OBJECTMAN_H
29 #define DM_OBJECTMAN_H
30 
31 #include "dm/dm.h"
32 #include "dm/champion.h"
33 
34 namespace DM {
35 
36 #define kDMObjectNameMaximumLength 14 // @ C014_OBJECT_NAME_MAXIMUM_LENGTH
37 #define kDMObjectNameCount 199 // @ C199_OBJECT_NAME_COUNT
38 #define kDMObjectNamesGraphicIndice 556 // @ C556_GRAPHIC_OBJECT_NAMES
39 
40 class SlotBox {
41 public:
42 	int16 _x;
43 	int16 _y;
44 	int16 _iconIndex;
SlotBox(int16 x,int16 y,int16 iconIndex)45 	SlotBox(int16 x, int16 y, int16 iconIndex): _x(x), _y(y), _iconIndex(iconIndex) {}
SlotBox()46 	SlotBox(): _x(-1), _y(-1), _iconIndex(-1) {}
47 }; // @ SLOT_BOX
48 
49 class ObjectMan {
50 	DMEngine *_vm;
51 
52 public:
53 	explicit ObjectMan(DMEngine *vm);
54 	~ObjectMan();
55 	void loadObjectNames();	// @ F0031_OBJECT_LoadNames
56 
57 	SlotBox _slotBoxes[46]; // @ G0030_as_Graphic562_SlotBoxes;
58 	char *_objectNames[kDMObjectNameCount]; // @ G0352_apc_ObjectNames
59 	byte *_objectIconForMousePointer; // @ G0412_puc_Bitmap_ObjectIconForMousePointer
60 
61 	IconIndice getObjectType(Thing thing); // @ F0032_OBJECT_GetType
62 	IconIndice getIconIndex(Thing thing); // @ F0033_OBJECT_GetIconIndex
63 	void extractIconFromBitmap(uint16 iconIndex, byte *destBitmap); // @ F0036_OBJECT_ExtractIconFromBitmap
64 	void drawIconInSlotBox(uint16 slotBoxIndex, int16 iconIndex); // @ F0038_OBJECT_DrawIconInSlotBox
65 	void drawLeaderObjectName(Thing thing); // @ F0034_OBJECT_DrawLeaderHandObjectName
66 	IconIndice getIconIndexInSlotBox(uint16 slotBoxIndex); // @ F0039_OBJECT_GetIconIndexInSlotBox
67 	void clearLeaderObjectName(); // @ F0035_OBJECT_ClearLeaderHandObjectName
68 	void drawIconToScreen(int16 iconIndex, int16 posX, int16 posY); // @ F0037_OBJECT_DrawIconToScreen
69 
70 	int16 _iconGraphicHeight[7]; // @ K0077_ai_IconGraphicHeight
71 	int16 _iconGraphicFirstIndex[7]; // G0026_ai_Graphic562_IconGraphicFirstIconIndex
72 
73 	void initConstants();
74 };
75 }
76 
77 #endif
78