ScummVM API documentation
view_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  * 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_VIEW_MANAGER_H
23 #define NUVIE_VIEWS_VIEW_MANAGER_H
24 
25 namespace Ultima {
26 namespace Nuvie {
27 
28 class Configuration;
29 class GUI;
30 class TileManager;
31 class ObjManager;
32 class Portrait;
33 class Party;
34 class Player;
35 class Font;
36 class Actor;
37 class Obj;
38 
39 class View;
40 class PartyView;
41 class PortraitView;
42 class InventoryView;
43 class ActorView;
44 class SpellView;
45 class ContainerViewGump;
46 class DollViewGump;
47 class DraggableView;
48 class SunMoonRibbon;
49 class MDSkyStripWidget;
50 
51 typedef enum { CURSOR_HEAD, CURSOR_NECK, CURSOR_CHEST, CURSOR_RIGHT_HAND, CURSOR_LEFT_HAND, CURSOR_RIGHT_RING, CURSOR_LEFT_RING, CURSOR_FEET,
52  CURSOR_LEFT, CURSOR_RIGHT, CURSOR_COMBAT, CURSOR_CHECK, CURSOR_HEART, CURSOR_PARTY, CURSOR_INVENTORY
53  } gumpCursorPos;
54 
55 class ViewManager {
56 protected:
57 
58  const Configuration *config;
59  int game_type;
60  GUI *gui;
61  Font *font;
62  TileManager *tile_manager;
63  ObjManager *obj_manager;
64  Party *party;
65  Portrait *portrait;
66 
67  ActorView *actor_view;
68  InventoryView *inventory_view;
69  PortraitView *portrait_view;
70  PartyView *party_view;
71  SpellView *spell_view;
72 
73  View *current_view;
74 
75  Common::List<DraggableView *> container_gumps;
78 
79  uint8 doll_next_party_member;
80 
81  SunMoonRibbon *ribbon;
82  MDSkyStripWidget *mdSkyWidget;
83 
84  Common::Path DollDataDirString;
85 
86 public:
87 
88  ViewManager(const Configuration *cfg);
89  virtual ~ViewManager();
90 
91  bool init(GUI *g, Font *f, Party *p, Player *player, TileManager *tm, ObjManager *om, Portrait *por);
92  void reload();
93 
94  void update();
95 
96  void set_portrait_mode(Actor *actor, const char *name);
97  void set_inventory_mode();
98  void set_party_mode();
99  void set_actor_mode();
100  void set_spell_mode(Actor *caster, Obj *spell_container, bool eventMode = false);
101 
102  void close_spell_mode();
103 
104  View *get_current_view() {
105  return current_view;
106  }
107  ActorView *get_actor_view() {
108  return actor_view;
109  }
110  InventoryView *get_inventory_view() {
111  return inventory_view;
112  }
113  PortraitView *get_portrait_view() {
114  return portrait_view;
115  }
116  PartyView *get_party_view() {
117  return party_view;
118  }
119  SpellView *get_spell_view() {
120  return spell_view;
121  }
122  MDSkyStripWidget *get_mdSkyWidget() {
123  return mdSkyWidget;
124  }
125 
126  void close_current_view();
127 
128  void open_doll_view(Actor *actor);
129 
130  void open_container_view(Obj *obj) {
131  open_container_view(nullptr, obj);
132  }
133  void open_container_view(Actor *actor) {
134  open_container_view(actor, nullptr);
135  }
136 
137  void close_container_view(Actor *actor);
138 
139  void open_mapeditor_view();
140  void open_portrait_gump(Actor *a);
141  void open_sign_gump(const char *sign_text, uint16 length);
142  void open_scroll_gump(const char *text, uint16 length);
143  void close_gump(DraggableView *gump);
144  void close_all_gumps();
145  bool gumps_are_active() {
146  return !gumps.empty();
147  }
148 
149  bool set_current_view(View *view);
150  void double_click_obj(Obj *obj);
151  unsigned int get_display_weight(float weight);
152 
153 // custom doll functions shared between DollWidget and DollViewGump
154  Common::Path getDollDataDirString();
155  Graphics::ManagedSurface *loadAvatarDollImage(Graphics::ManagedSurface *avatar_doll, bool orig = false);
156  Graphics::ManagedSurface *loadCustomActorDollImage(Graphics::ManagedSurface *actor_doll, uint8 actor_num, bool orig = false);
157  Graphics::ManagedSurface *loadGenericDollImage(bool orig);
158 
159 protected:
160 
161  Actor *doll_view_get_next_party_member();
162  DollViewGump *get_doll_view(Actor *actor);
163  ContainerViewGump *get_container_view(Actor *actor, Obj *obj);
164  void open_container_view(Actor *actor, Obj *obj);
165  void add_gump(DraggableView *gump);
166  void add_view(View *view);
167  void move_gump_to_top(DraggableView *gump);
168 };
169 
170 } // End of namespace Nuvie
171 } // End of namespace Ultima
172 
173 #endif
Definition: managed_surface.h:51
Definition: actor.h:174
Definition: portrait.h:40
Definition: obj.h:84
Definition: party_view.h:40
Definition: configuration.h:61
Definition: list.h:44
Definition: path.h:52
Definition: player.h:41
Definition: printman.h:30
Definition: tile_manager.h:145
Definition: party.h:92
Definition: md_sky_strip_widget.h:35
Definition: detection.h:27
Definition: view.h:42
Definition: portrait_view.h:42
Definition: doll_view_gump.h:41
Definition: sun_moon_ribbon.h:30
Definition: draggable_view.h:34
Definition: spell_view.h:40
Definition: obj_manager.h:75
Definition: inventory_view.h:40
bool empty() const
Definition: list.h:258
Definition: view_manager.h:55
Definition: container_view_gump.h:40
Definition: actor_view.h:38
Definition: font.h:42