summaryrefslogtreecommitdiff
path: root/src/msgbox.h
blob: 22ae8122b2f020d8577655ff2a3c833028a8ef74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef MSGBOX_H
#define MSGBOX_H 
#include <common.h>
#include <game.h>

class dMsgBoxManager_c : public dStageActor_c {
	public:
		void showMessage(int id, bool canCancel=true, int delay=-1);

		dMsgBoxManager_c() : state(this, &StateID_LoadRes) { }

		int onCreate();
		int onDelete();
		int onExecute();
		int onDraw();

		int beforeExecute() { return true; }
		int afterExecute(int) { return true; }
		int beforeDraw() { return true; }
		int afterDraw(int) { return true; }

		m2d::EmbedLayout_c layout;
		dDvdLoader_c msgDataLoader;

		bool layoutLoaded;
		bool visible;

		bool canCancel;
		int delay;

		dStateWrapper_c<dMsgBoxManager_c> state;

		USING_STATES(dMsgBoxManager_c);
		DECLARE_STATE(LoadRes);
		DECLARE_STATE(Wait);
		DECLARE_STATE(BoxAppearWait);
		DECLARE_STATE(ShownWait);
		DECLARE_STATE(BoxDisappearWait);

		static dMsgBoxManager_c *instance;
		static dMsgBoxManager_c *build();

	private:
		struct entry_s {
			u32 id;
			u32 titleOffset;
			u32 msgOffset;
		};

		struct header_s {
			u32 count;
			entry_s entry[1];
		};
};
#endif /* MSGBOX_H */