1 2 /* ScummVM - Graphic Adventure Engine 3 * 4 * ScummVM is the legal property of its developers, whose names 5 * are too numerous to list here. Please refer to the COPYRIGHT 6 * file distributed with this source distribution. 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 * Inventory related functions 23 */ 24 25 #ifndef TINSEL_INVENTORY_H // prevent multiple includes 26 #define TINSEL_INVENTORY_H 27 28 #include "tinsel/dw.h" 29 #include "tinsel/events.h" // for PLR_EVENT, PLR_EVENT 30 31 namespace Common { 32 class Serializer; 33 } 34 35 namespace Tinsel { 36 37 enum { 38 INV_OPEN = -1, // DW1 only 39 INV_CONV = 0, 40 INV_1 = 1, 41 INV_2 = 2, 42 INV_CONF = 3, 43 INV_MENU = 3, // DW2 constant 44 NUM_INV = 4, 45 46 // Discworld 2 constants 47 DW2_INV_OPEN = 5, 48 INV_DEFAULT = 6 49 }; 50 51 /** structure of each inventory object */ 52 struct INV_OBJECT { 53 int32 id; // inventory objects id 54 SCNHANDLE hIconFilm; // inventory objects animation film 55 SCNHANDLE hScript; // inventory objects event handling script 56 int32 attribute; // inventory object's attribute 57 }; 58 59 // attribute values - not a bit bit field to prevent portability problems 60 #define DROPCODE 0x01 61 #define ONLYINV1 0x02 62 #define ONLYINV2 0x04 63 #define DEFINV1 0x08 64 #define DEFINV2 0x10 65 #define PERMACONV 0x20 66 #define CONVENDITEM 0x40 67 68 void PopUpInventory(int invno); 69 70 enum CONFTYPE { 71 MAIN_MENU, SAVE_MENU, LOAD_MENU, QUIT_MENU, RESTART_MENU, SOUND_MENU, 72 CONTROLS_MENU, SUBTITLES_MENU, HOPPER_MENU1, HOPPER_MENU2, TOP_WINDOW 73 }; 74 75 void OpenMenu(CONFTYPE type); 76 77 78 void Xmovement(int x); 79 void Ymovement(int y); 80 81 void EventToInventory(PLR_EVENT pEvent, const Common::Point &coOrds); 82 void ButtonToInventory(PLR_EVENT be); 83 void KeyToInventory(PLR_EVENT ke); 84 85 86 int WhichItemHeld(); 87 88 void HoldItem(int item, bool bKeepFilm = false); 89 void DropItem(int item); 90 void ClearInventory(int invno); 91 void AddToInventory(int invno, int icon, bool hold = false); 92 bool RemFromInventory(int invno, int icon); 93 94 95 void RegisterIcons(void *cptr, int num); 96 97 void idec_convw(SCNHANDLE text, int MaxContents, int MinWidth, int MinHeight, 98 int StartWidth, int StartHeight, int MaxWidth, int MaxHeight); 99 void idec_inv1(SCNHANDLE text, int MaxContents, int MinWidth, int MinHeight, 100 int StartWidth, int StartHeight, int MaxWidth, int MaxHeight); 101 void idec_inv2(SCNHANDLE text, int MaxContents, int MinWidth, int MinHeight, 102 int StartWidth, int StartHeight, int MaxWidth, int MaxHeight); 103 104 bool InventoryActive(); 105 106 void PermaConvIcon(int icon, bool bEnd = false); 107 108 void convPos(int bpos); 109 void ConvPoly(HPOLYGON hp); 110 int GetIcon(); 111 void CloseDownConv(); 112 void HideConversation(bool hide); 113 bool ConvIsHidden(); 114 115 enum { 116 NOOBJECT = -1, 117 INV_NOICON = -1, 118 INV_CLOSEICON = -2, 119 INV_OPENICON = -3, 120 INV_HELDNOTIN = -4 121 }; 122 123 enum CONV_PARAM { 124 CONV_DEF, 125 CONV_BOTTOM, 126 CONV_END, 127 CONV_TOP 128 }; 129 130 131 void ConvAction(int index); 132 void SetConvDetails(CONV_PARAM fn, HPOLYGON hPoly, int ano); 133 void InventoryIconCursor(bool bNewItem); 134 135 void setInvWinParts(SCNHANDLE hf); 136 void setFlagFilms(SCNHANDLE hf); 137 void setConfigStrings(SCNHANDLE *tp); 138 139 int InvItem(int *x, int *y, bool update); 140 int InvItemId(int x, int y); 141 142 int InventoryPos(int num); 143 144 bool IsInInventory(int object, int invnum); 145 146 void KillInventory(); 147 148 void syncInvInfo(Common::Serializer &s); 149 150 int InvGetLimit(int invno); 151 void InvSetLimit(int invno, int n); 152 void InvSetSize(int invno, int MinWidth, int MinHeight, 153 int StartWidth, int StartHeight, int MaxWidth, int MaxHeight); 154 155 bool GetIsInvObject(int id); 156 157 int WhichInventoryOpen(); 158 159 bool IsTopWindow(); 160 bool MenuActive(); 161 bool IsConvWindow(); 162 163 void SetObjectFilm(int object, SCNHANDLE hFilm); 164 165 void ObjectEvent(CORO_PARAM, int objId, TINSEL_EVENT event, bool bWait, int myEscape, bool *result = NULL); 166 167 } // End of namespace Tinsel 168 169 #endif /* TINSEL_INVENTRY_H */ 170