ScummVM API documentation
icon_list_manager.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  * Additional copyright for this file:
8  * Copyright (C) 1999-2000 Revolution Software Ltd.
9  * This code is based on source code created by Revolution Software,
10  * used with permission.
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  *
25  */
26 
27 #ifndef ICB_ICON_LIST_MANAGER_H_INCLUDED
28 #define ICB_ICON_LIST_MANAGER_H_INCLUDED
29 
30 #include "engines/icb/common/px_string.h"
31 #include "engines/icb/string_vest.h"
32 #include "engines/icb/p4.h"
33 #include "engines/icb/icon_menu.h"
34 #include "engines/icb/icon_list.h"
35 
36 namespace ICB {
37 
38 #define ICON_LIST_MANAGER_LOG "icon_list_manager_log.txt"
39 
40 extern const char *global_icon_list_remora;
41 extern const char *global_icon_list_inventory;
42 extern const char *global_icon_list_arms;
43 
44 // These are predefined lists : make them global to reduce rdata usage
45 #define ICON_LIST_REMORA global_icon_list_remora
46 #define ICON_LIST_INVENTORY global_icon_list_inventory
47 
48 // This indicates a list cannot be found.
49 #define ICON_LIST_NOT_FOUND (-1)
50 
51 // The maximum number of lists allowed.
52 #define ICON_LIST_MANAGER_MAX_LISTS 8
53 
54 // Class to manage the lists of icons used in the game. the inventory, Remora and speech system all use these lists.
56 public:
57  // Default constructor and destructor.
59  ~_icon_list_manager() {}
60 
61  // This resets lists that have a scope less than the argument passed in.
62  void ResetToScopeLevel(IconListScope eScope);
63 
64  // Call this to activate the menu selection for a list of icons. Note that the chooser does not have a
65  // deactivate or cycle-logic function because once activated, all its functionality (including shutting down)
66  // is handled by class _icon_menu.
67  void ActivateIconMenu(const char *pcListName, bool8 bAllowEscape, bool8 bDrawStatusIcons);
68 
69  // This reports whether or not the inventory is active.
70  bool8 IsActive() const { return (g_oIconMenu->IsActive()); }
71 
72  // This returns the contents of a list to the engine (for save and restore etc.).
73  uint32 GetList(const char *pcListName, char *pNames[ICON_LIST_MAX_ICONS], uint32 *pnHashes, uint32 *pnCounts) const;
74 
75  // The same logic as the adding of ammo etc is borrowed for when an email arrives.
76  void SetEmailArrived() { g_oIconMenu->SetEmailArrived(); }
77 
78  // Call this every cycle to cycle the inventory's logic when it is active.
79  void CycleInventoryLogic(const _input &sKeyboardState) const { g_oIconMenu->CycleIconMenu(sKeyboardState); }
80 
81  // These cycle the logic for a currently-held item.
82  bool8 IsHolding() const { return (g_oIconMenu->IsHolding()); }
83  void CycleHoldingLogic() const { g_oIconMenu->CycleHoldingLogic(); }
84 
85  // This is for internal engine use only, as it returns a string, which cannot go back to script.
86  inline const char *HoldingWhat() const;
87 
88  // These have direct script counterparts.
89  void AddIconToList(const char *pcListName, const char *pcIconName);
90  void AddIconToList(const char *pcListName, const char *pcIconName, const uint32 nHash);
91  void RemoveIconFromList(const char *pcListName, const char *pcIconName);
92  uint32 GetItemCount(const char *pcListName) const;
93  bool8 Carrying(const char *pcListName, const char *pcItem) const;
94  uint32 CarryingHowMany(const char *pcListName, const char *pcItem) const;
95  bool8 ItemHeld() const { return (g_oIconMenu->IsHolding()); }
96  bool8 Holding(const char *pcItem) const;
97  void Drop() { g_oIconMenu->ClearSelection(); }
98  void SetListScope(const char *pcListName, IconListScope eScope);
99  void DestroyList(const char *pcListName);
100  void ResetList(const char *pcListName);
101 
102 private:
103  _icon_list m_pListOfLists[ICON_LIST_MANAGER_MAX_LISTS]; // The list of icon lists.
104 
105  // Here I block the use of the default '='.
107 
108  void operator=(const _icon_list_manager &) {}
109 
110  // Private functions used only within this class.
111  int32 FindListByName(const char *pcListName) const;
112 };
113 
114 inline const char *_icon_list_manager::HoldingWhat() const { return (g_oIconMenu->GetLastSelection()); }
115 
116 extern _icon_list_manager *g_oIconListManager;
117 
118 } // End of namespace ICB
119 
120 #endif // #if !defined( ICON_LIST_MANAGER_H_INCLUDED )
Definition: player.h:147
Definition: actor.h:32
Definition: icon_list.h:65
Definition: icon_list_manager.h:55