ScummVM API documentation
inventory_view.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#ifndef NUVIE_VIEWS_INVENTORY_VIEW_H
23#define NUVIE_VIEWS_INVENTORY_VIEW_H
24
25#include "ultima/nuvie/views/view.h"
26
27namespace Ultima {
28namespace Nuvie {
29
30class Configuration;
31class TileManager;
32class ObjManager;
33class Screen;
34class Actor;
35class Font;
36class Party;
37class DollWidget;
38class InventoryWidget;
39
40class InventoryView : public View {
41
42 DollWidget *doll_widget;
43 InventoryWidget *inventory_widget;
44 GUI_Button *combat_button;
45 bool is_party_member;
46 bool picking_pocket;
47 Actor *outside_actor;
48 bool lock_actor;
49
50 enum invarea {
51 INVAREA_LIST = 0, // cursor is over the inventory list (x,y)
52 INVAREA_TOP, // the actor or container icon
53 INVAREA_DOLL, // the readied-items list (0-7)
54 INVAREA_COMMAND // the command icons (0-4)
55 };
56 struct invcursor_pos_s {
57 enum invarea area;
58 uint8 x, y; // y is only used for inventory list
59 uint32 px, py;
60 } cursor_pos;
61 Tile *cursor_tile;
62 bool show_cursor;
63
64public:
65 InventoryView(const Configuration *cfg);
66 ~InventoryView() override;
67
68 bool init(Screen *tmp_screen, void *view_manager, uint16 x, uint16 y, Font *f, Party *p, TileManager *tm, ObjManager *om);
69 bool set_party_member(uint8 party_member) override;
70 bool set_actor(Actor *actor, bool pickpocket = false);
71 void set_show_cursor(bool state);
72 void moveCursorToSlot(uint8 slot_num);
73 void moveCursorToInventory(uint8 inv_x = 0, uint8 inv_y = 0);
74 void moveCursorRelative(sint8 new_x, sint8 new_y);
75 void moveCursorToButton(uint8 button_num = 0);
76 void moveCursorToTop();
77 bool select_obj(Obj *obj);
78 void select_objAtCursor();
79 Obj *get_objAtCursor();
80 InventoryWidget *get_inventory_widget() {
81 return inventory_widget;
82 };
83
84 void Display(bool full_redraw) override;
85 void PlaceOnScreen(Screen *s, GUI_DragManager *dm, int x, int y) override;
86 GUI_status KeyDown(const Common::KeyState &key) override;
87 void simulate_CB_callback();
88 bool is_picking_pocket() const {
89 return picking_pocket;
90 }
91 void lock_to_actor(bool value) {
92 lock_actor = value;
93 }
94
95protected:
96
97 void display_name();
98 void add_command_icons(Screen *tmp_screen, void *view_manager);
99 void display_inventory_weights();
100 void display_combat_mode();
101 void update_cursor();
102 void hide_buttons();
103 void show_buttons();
104 GUI_status MouseDown(int x, int y, Events::MouseButton button) override;
105 GUI_status MouseWheel(sint32 x, sint32 y) override;
106 GUI_status callback(uint16 msg, GUI_CallBack *caller, void *data) override;
107};
108
109} // End of namespace Nuvie
110} // End of namespace Ultima
111
112#endif
Definition: actor.h:174
Definition: configuration.h:60
Definition: doll_widget.h:37
Definition: font.h:42
Definition: gui_button.h:70
Definition: gui_callback.h:31
Definition: gui_drag_manager.h:36
Definition: inventory_view.h:40
Definition: inventory_widget.h:37
Definition: obj.h:84
Definition: obj_manager.h:74
Definition: party.h:92
Definition: screen.h:41
Definition: tile_manager.h:145
Definition: view.h:42
Definition: keyboard.h:294
Definition: atari-screen.h:58
Definition: tile_manager.h:113