1 /*
2  * This software is licensed under the terms of the MIT License.
3  * See COPYING for further information.
4  * ---
5  * Copyright (c) 2011-2019, Lukas Weber <laochailan@web.de>.
6  * Copyright (c) 2012-2019, Andrei Alexeyev <akari@taisei-project.org>.
7  */
8 
9 #ifndef IGUARD_ending_h
10 #define IGUARD_ending_h
11 
12 #include "taisei.h"
13 
14 #include "eventloop/eventloop.h"
15 
16 enum {
17 	ENDING_FADE_OUT = 200,
18 	ENDING_FADE_TIME = 60,
19 };
20 
21 typedef enum EndingID {
22 	// WARNING: Reordering this will break current progress files.
23 
24 	ENDING_BAD_1,
25 	ENDING_BAD_2,
26 	ENDING_GOOD_1,
27 	ENDING_GOOD_2,
28 	ENDING_BAD_3,
29 	ENDING_GOOD_3,
30 	NUM_ENDINGS,
31 } EndingID;
32 
33 #define GOOD_ENDINGS \
34 	ENDING(ENDING_GOOD_1) \
35 	ENDING(ENDING_GOOD_2) \
36 	ENDING(ENDING_GOOD_3) \
37 
38 #define BAD_ENDINGS \
39 	ENDING(ENDING_BAD_1) \
40 	ENDING(ENDING_BAD_2) \
41 	ENDING(ENDING_BAD_3) \
42 
ending_is_good(EndingID end)43 INLINE bool ending_is_good(EndingID end) {
44 	#define ENDING(e) (end == (e)) ||
45 	return (
46 		GOOD_ENDINGS
47 	false);
48 	#undef ENDING
49 }
50 
ending_is_bad(EndingID end)51 INLINE bool ending_is_bad(EndingID end) {
52 	#define ENDING(e) (end == (e)) ||
53 	return (
54 		BAD_ENDINGS
55 	false);
56 	#undef ENDING
57 }
58 
59 typedef struct Ending Ending;
60 
61 void ending_enter(CallChain next);
62 void ending_preload(void);
63 
64 /*
65  * These ending callbacks are referenced in plrmodes/ code
66  */
67 void bad_ending_marisa(Ending *e);
68 void bad_ending_youmu(Ending *e);
69 void bad_ending_reimu(Ending *e);
70 void good_ending_marisa(Ending *e);
71 void good_ending_youmu(Ending *e);
72 void good_ending_reimu(Ending *e);
73 
74 #endif // IGUARD_ending_h
75