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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef NUVIE_VIEWS_DOLL_WIDGET_H
24 #define NUVIE_VIEWS_DOLL_WIDGET_H
25 
26 #include "ultima/nuvie/gui/widgets/gui_widget.h"
27 #include "ultima/nuvie/core/tile_manager.h"
28 #include "ultima/nuvie/core/obj_manager.h"
29 #include "ultima/nuvie/views/inventory_message.h"
30 
31 namespace Ultima {
32 namespace Nuvie {
33 
34 class Configuration;
35 class Actor;
36 class U6Shape;
37 
38 class DollWidget : public GUI_Widget {
39 
40 	Configuration *config;
41 	TileManager *tile_manager;
42 	ObjManager *obj_manager;
43 
44 	Actor *actor;
45 	bool use_new_dolls, old_use_new_dolls;
46 
47 	Obj *selected_obj, *unready_obj;
48 
49 	uint8 bg_color;
50 	bool is_in_portrait_view;
51 	bool need_to_free_tiles;
52 	Tile *empty_tile, *blocked_tile;
53 
54 	U6Shape *md_doll_shp;
55 	Graphics::ManagedSurface *actor_doll, *doll_bg;
56 
57 public:
58 	DollWidget(Configuration *cfg, GUI_CallBack *callback = NULL);
59 	~DollWidget() override;
60 
61 	bool init(Actor *a, uint16 x, uint16 y, TileManager *tm, ObjManager *om, bool in_portrat_view = false);
62 	void free_doll_shapes();
63 	void setColorKey(Graphics::ManagedSurface *image);
64 	void set_actor(Actor *a);
65 	void Display(bool full_redraw) override;
66 
67 	GUI_status MouseDown(int x, int y, Shared::MouseButton button) override;
68 	GUI_status MouseUp(int x, int y, Shared::MouseButton button) override;
69 	GUI_status MouseMotion(int x, int y, uint8 state) override;
70 	GUI_status MouseDouble(int x, int y, Shared::MouseButton button) override;
71 	GUI_status MouseClick(int x, int y, Shared::MouseButton button) override;
72 	GUI_status MouseDelayed(int x, int y, Shared::MouseButton button) override;
73 
74 	void drag_drop_success(int x, int y, int message, void *data) override;
75 	void drag_drop_failed(int x, int y, int message, void *data) override;
76 
77 	bool drag_accept_drop(int x, int y, int message, void *data) override;
78 	void drag_perform_drop(int x, int y, int message, void *data) override;
79 
80 	void drag_draw(int x, int y, int message, void *data) override;
81 
82 	Common::Rect *get_item_hit_rect(uint8 location);
83 
84 protected:
85 
86 	GUI_CallBack *callback_object; // object-selected callback
87 
88 	void display_doll();
89 	void display_old_doll();
90 	void display_new_doll();
91 	void display_readied_object(uint8 location, uint16 x, uint16 y, Actor *actor, Tile *emptyTile);
92 
93 private:
94 	Common::Rect item_hit_rects[8];
95 
96 	void load_md_doll_shp();
97 };
98 
99 } // End of namespace Nuvie
100 } // End of namespace Ultima
101 
102 #endif
103