1 // SONIC ROBO BLAST 2
2 //-----------------------------------------------------------------------------
3 // Copyright (C) 1993-1996 by id Software, Inc.
4 // Copyright (C) 1998-2000 by DooM Legacy Team.
5 // Copyright (C) 1999-2020 by Sonic Team Junior.
6 //
7 // This program is free software distributed under the
8 // terms of the GNU General Public License, version 2.
9 // See the 'LICENSE' file for more details.
10 //-----------------------------------------------------------------------------
11 /// \file  f_finale.h
12 /// \brief Title screen, intro, game evaluation, and credits.
13 ///        Also includes protos for screen wipe functions.
14 
15 #ifndef __F_FINALE__
16 #define __F_FINALE__
17 
18 #include "doomtype.h"
19 #include "d_event.h"
20 #include "p_mobj.h"
21 
22 //
23 // FINALE
24 //
25 
26 // Called by main loop.
27 boolean F_IntroResponder(event_t *ev);
28 boolean F_CutsceneResponder(event_t *ev);
29 boolean F_CreditResponder(event_t *ev);
30 
31 // Called by main loop.
32 void F_GameEndTicker(void);
33 void F_IntroTicker(void);
34 void F_TitleScreenTicker(boolean run);
35 void F_CutsceneTicker(void);
36 void F_TitleDemoTicker(void);
37 void F_TextPromptTicker(void);
38 
39 // Called by main loop.
40 void F_GameEndDrawer(void);
41 void F_IntroDrawer(void);
42 void F_TitleScreenDrawer(void);
43 void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname);
44 
45 void F_GameEvaluationDrawer(void);
46 void F_StartGameEvaluation(void);
47 void F_GameEvaluationTicker(void);
48 
49 void F_EndingTicker(void);
50 void F_EndingDrawer(void);
51 
52 void F_CreditTicker(void);
53 void F_CreditDrawer(void);
54 
55 void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean resetplayer);
56 void F_CutsceneDrawer(void);
57 void F_EndCutScene(void);
58 
59 void F_StartTextPrompt(INT32 promptnum, INT32 pagenum, mobj_t *mo, UINT16 postexectag, boolean blockcontrols, boolean freezerealtime);
60 void F_GetPromptPageByNamedTag(const char *tag, INT32 *promptnum, INT32 *pagenum);
61 void F_TextPromptDrawer(void);
62 void F_EndTextPrompt(boolean forceexec, boolean noexec);
63 boolean F_GetPromptHideHudAll(void);
64 boolean F_GetPromptHideHud(fixed_t y);
65 
66 void F_StartGameEnd(void);
67 void F_StartIntro(void);
68 void F_StartTitleScreen(void);
69 void F_StartEnding(void);
70 void F_StartCredits(void);
71 
72 boolean F_ContinueResponder(event_t *event);
73 void F_StartContinue(void);
74 void F_ContinueTicker(void);
75 void F_ContinueDrawer(void);
76 
77 extern INT32 finalecount;
78 extern INT32 titlescrollxspeed;
79 extern INT32 titlescrollyspeed;
80 
81 typedef enum
82 {
83 	TTMODE_NONE = 0,
84 	TTMODE_OLD,
85 	TTMODE_ALACROIX,
86 	TTMODE_USER
87 } ttmode_enum;
88 
89 #define TTMAX_ALACROIX 30 // max frames for SONIC typeface, plus one for NULL terminating entry
90 #define TTMAX_USER 100
91 
92 extern ttmode_enum ttmode;
93 extern UINT8 ttscale;
94 // ttmode user vars
95 extern char ttname[9];
96 extern INT16 ttx;
97 extern INT16 tty;
98 extern INT16 ttloop;
99 extern UINT16 tttics;
100 extern boolean ttavailable[6];
101 
102 
103 typedef enum
104 {
105 	TITLEMAP_OFF = 0,
106 	TITLEMAP_LOADING,
107 	TITLEMAP_RUNNING
108 } titlemap_enum;
109 
110 // Current menu parameters
111 
112 extern mobj_t *titlemapcameraref;
113 extern char curbgname[9];
114 extern SINT8 curfadevalue;
115 extern INT32 curbgcolor;
116 extern INT32 curbgxspeed;
117 extern INT32 curbgyspeed;
118 extern boolean curbghide;
119 extern boolean hidetitlemap;
120 
121 extern boolean curhidepics;
122 extern ttmode_enum curttmode;
123 extern UINT8 curttscale;
124 // ttmode user vars
125 extern char curttname[9];
126 extern INT16 curttx;
127 extern INT16 curtty;
128 extern INT16 curttloop;
129 extern UINT16 curtttics;
130 
131 #define TITLEBACKGROUNDACTIVE (curfadevalue >= 0 || curbgname[0])
132 
133 void F_InitMenuPresValues(void);
134 void F_MenuPresTicker(boolean run);
135 
136 //
137 // WIPE
138 //
139 // HACK for menu fading while titlemapinaction; skips the level check
140 #define FORCEWIPE -3
141 #define FORCEWIPEOFF -2
142 
143 extern boolean WipeInAction;
144 extern boolean WipeStageTitle;
145 
146 typedef enum
147 {
148 	WIPESTYLE_NORMAL,
149 	WIPESTYLE_COLORMAP
150 } wipestyle_t;
151 extern wipestyle_t wipestyle;
152 
153 typedef enum
154 {
155 	WSF_FADEOUT   = 1,
156 	WSF_FADEIN    = 1<<1,
157 	WSF_TOWHITE   = 1<<2,
158 	WSF_CROSSFADE = 1<<3,
159 } wipestyleflags_t;
160 extern wipestyleflags_t wipestyleflags;
161 
162 // Even my function names are borderline
163 boolean F_ShouldColormapFade(void);
164 boolean F_TryColormapFade(UINT8 wipecolor);
165 #ifndef NOWIPE
166 void F_DecideWipeStyle(void);
167 #endif
168 
169 #define FADECOLORMAPDIV 8
170 #define FADECOLORMAPROWS (256/FADECOLORMAPDIV)
171 
172 #define FADEREDFACTOR   15
173 #define FADEGREENFACTOR 15
174 #define FADEBLUEFACTOR  10
175 
176 extern INT32 lastwipetic;
177 
178 // Don't know where else to place this constant
179 // But this file seems appropriate
180 #define PRELEVELTIME 24 // frames in tics
181 
182 void F_WipeStartScreen(void);
183 void F_WipeEndScreen(void);
184 void F_RunWipe(UINT8 wipetype, boolean drawMenu);
185 void F_WipeStageTitle(void);
186 #define F_WipeColorFill(c) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, c)
187 tic_t F_GetWipeLength(UINT8 wipetype);
188 boolean F_WipeExists(UINT8 wipetype);
189 
190 enum
191 {
192 	wipe_credits_intermediate, // makes a good 0 I guess.
193 
194 	wipe_level_toblack,
195 	wipe_intermission_toblack,
196 	wipe_continuing_toblack,
197 	wipe_titlescreen_toblack,
198 	wipe_timeattack_toblack,
199 	wipe_credits_toblack,
200 	wipe_evaluation_toblack,
201 	wipe_gameend_toblack,
202 	wipe_intro_toblack,
203 	wipe_ending_toblack,
204 	wipe_cutscene_toblack,
205 
206 	// custom intermissions
207 	wipe_specinter_toblack,
208 	wipe_multinter_toblack,
209 	wipe_speclevel_towhite,
210 
211 	wipe_level_final,
212 	wipe_intermission_final,
213 	wipe_continuing_final,
214 	wipe_titlescreen_final,
215 	wipe_timeattack_final,
216 	wipe_credits_final,
217 	wipe_evaluation_final,
218 	wipe_gameend_final,
219 	wipe_intro_final,
220 	wipe_ending_final,
221 	wipe_cutscene_final,
222 
223 	// custom intermissions
224 	wipe_specinter_final,
225 	wipe_multinter_final,
226 
227 	NUMWIPEDEFS,
228 	WIPEFINALSHIFT = (wipe_level_final-wipe_level_toblack)
229 };
230 extern UINT8 wipedefs[NUMWIPEDEFS];
231 
232 #endif
233