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