1 /** @file intermission.h  DOOM64 specific intermission screens.
2  *
3  * @authors Copyright © 2003-2017 Jaakko Keränen <jaakko.keranen@iki.fi>
4  * @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
5  * @authors Copyright © 1993-1996 id Software, Inc.
6  *
7  * @par License
8  * GPL: http://www.gnu.org/licenses/gpl.html
9  *
10  * <small>This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by the
12  * Free Software Foundation; either version 2 of the License, or (at your
13  * option) any later version. This program is distributed in the hope that it
14  * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
15  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16  * Public License for more details. You should have received a copy of the GNU
17  * General Public License along with this program; if not, write to the Free
18  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19  * 02110-1301 USA</small>
20  */
21 
22 #ifndef LIBDOOM64_INTERMISSION_H
23 #define LIBDOOM64_INTERMISSION_H
24 #ifdef __cplusplus
25 
26 #ifndef __JDOOM64__
27 #  error "Using jDoom64 headers without __JDOOM64__"
28 #endif
29 
30 #include "d_player.h"
31 #include <doomsday/uri.h>
32 
33 // Global locations
34 #define WI_TITLEY               (2)
35 #define WI_SPACINGY             (33)
36 
37 // Single-player stuff
38 #define SP_STATSX               (50)
39 #define SP_STATSY               (50)
40 #define SP_TIMEX                (16)
41 #define SP_TIMEY                (SCREENHEIGHT-32)
42 
43 // Net game stuff
44 #define NG_STATSY               (50)
45 #define NG_STATSX               (32)
46 #define NG_SPACINGX             (64)
47 
48 // Deathmatch stuff
49 #define DM_MATRIXX              (42)
50 #define DM_MATRIXY              (68)
51 #define DM_SPACINGX             (40)
52 #define DM_TOTALSX              (269)
53 #define DM_KILLERSX             (10)
54 #define DM_KILLERSY             (100)
55 #define DM_VICTIMSX             (5)
56 #define DM_VICTIMSY             (50)
57 
58 // States for single-player
59 #define SP_KILLS                (0)
60 #define SP_ITEMS                (2)
61 #define SP_SECRET               (4)
62 #define SP_FRAGS                (6)
63 #define SP_TIME                 (8)
64 #define SP_PAR                  (ST_TIME)
65 #define SP_PAUSE                (1)
66 
67 // States for the intermission
68 enum interludestate_t
69 {
70     ILS_NONE = -1,
71     ILS_SHOW_STATS,
72     ILS_UNUSED /// dj: DOOM64 has no "show next map" state as Doom does however
73                /// the DOOM64TC did not update the actual state progression.
74                /// Instead it had to pass through a this state requring an extra
75                /// key press to skip. This should be addressed by updating the
76                /// relevant state progressions.
77 };
78 
79 /**
80  * Structure passed to IN_Begin(), etc...
81  */
82 struct wbplayerstruct_t
83 {
84     dd_bool inGame;  ///< Whether the player is in game.
85 
86     int kills;
87     int items;
88     int secret;
89     int time;
90     int frags[MAXPLAYERS];
91     int score;       ///< Current score on entry, modified on return.
92 };
93 
94 struct wbstartstruct_t
95 {
96     de::Uri currentMap;
97     de::Uri nextMap;
98     bool didSecret;      /**< @c true= the secret map has been visited during the
99                               game session. Used to generate the visited maps info
100                               for backward compatibility purposes. */
101     int maxKills;
102     int maxItems;
103     int maxSecret;
104     int maxFrags;
105     int parTime;
106     int pNum;           ///< Index of this player in game.
107     wbplayerstruct_t plyr[MAXPLAYERS];
108 };
109 
110 /// To be called to register the console commands and variables of this module.
111 void IN_ConsoleRegister();
112 
113 /**
114  * Begin the intermission using the given game session and player configuration.
115  *
116  * @param wbstartstruct  Configuration to use for the intermission. Ownership is
117  *                       @em not given to IN_Begin() however it is assumed that
118  *                       this structure is @em not modified while the intermission
119  *                       is in progress.
120  */
121 void IN_Begin(wbstartstruct_t const &wbstartstruct);
122 
123 /**
124  * Process game tic for the intermission.
125  *
126  * @note Handles user input due to timing issues in netgames.
127  */
128 void IN_Ticker();
129 
130 /**
131  * Draw the intermission.
132  */
133 void IN_Drawer();
134 
135 /**
136  * Change the current intermission state.
137  */
138 void IN_SetState(interludestate_t st);
139 
140 /**
141  * End the current intermission.
142  */
143 void IN_End();
144 
145 /**
146  * Skip to the next state in the intermission.
147  */
148 void IN_SkipToNext();
149 
150 #endif // __cplusplus
151 #endif // LIBDOOM64_INTERMISSION_H
152