2 //**************************************************************************
4 //** st_start.c : Heretic 2 : Raven Software, Corp.
11 //**************************************************************************
14 // HEADER FILES ------------------------------------------------------------
17 #include <sys/types.h>
25 #include <stdarg.h> // Needed for next as well as dos
29 // MACROS ------------------------------------------------------------------
30 #define ST_MAX_NOTCHES 32
31 #define ST_NOTCH_WIDTH 16
32 #define ST_NOTCH_HEIGHT 23
33 #define ST_PROGRESS_X 64 // Start of notches x screen pos.
34 #define ST_PROGRESS_Y 441 // Start of notches y screen pos.
36 #define ST_NETPROGRESS_X 288
37 #define ST_NETPROGRESS_Y 32
38 #define ST_NETNOTCH_WIDTH 8
39 #define ST_NETNOTCH_HEIGHT 16
40 #define ST_MAX_NETNOTCHES 8
42 // TYPES -------------------------------------------------------------------
44 // EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
45 extern void SetVideoModeHR(void);
46 extern void ClearScreenHR(void);
47 extern void SlamHR(char *buffer);
48 extern void SlamBlockHR(int x, int y, int w, int h, char *src);
49 extern void InitPaletteHR(void);
50 extern void SetPaletteHR(byte *palette);
51 extern void GetPaletteHR(byte *palette);
52 extern void FadeToPaletteHR(byte *palette);
53 extern void FadeToBlackHR(void);
54 extern void BlackPaletteHR(void);
55 extern void I_StartupReadKeys(void);
57 // PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
59 // PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
60 char *ST_LoadScreen(void);
61 void ST_UpdateNotches(int notchPosition);
62 void ST_UpdateNetNotches(int notchPosition);
64 // EXTERNAL DATA DECLARATIONS ----------------------------------------------
66 // PUBLIC DATA DEFINITIONS -------------------------------------------------
68 // PRIVATE DATA DEFINITIONS ------------------------------------------------
74 0x00, 0x80, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40,
75 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x03, 0xC0,
76 0x0F, 0x90, 0x1B, 0x68, 0x3D, 0xBC, 0x3F, 0xFC, 0x20, 0x08, 0x20, 0x08,
77 0x2F, 0xD8, 0x37, 0xD8, 0x37, 0xF8, 0x1F, 0xF8, 0x1C, 0x50,
80 0x00, 0x80, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x02, 0x40,
81 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0xA0,
82 0x30, 0x6C, 0x24, 0x94, 0x42, 0x4A, 0x60, 0x0E, 0x60, 0x06, 0x7F, 0xF6,
83 0x7F, 0xF6, 0x7F, 0xF6, 0x5E, 0xF6, 0x38, 0x16, 0x23, 0xAC,
86 0x00, 0x80, 0x01, 0x80, 0x01, 0x80, 0x00, 0x00, 0x02, 0x40, 0x02, 0x40,
87 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x03, 0xE0,
88 0x30, 0x6C, 0x24, 0x94, 0x52, 0x6A, 0x7F, 0xFE, 0x60, 0x0E, 0x60, 0x0E,
89 0x6F, 0xD6, 0x77, 0xD6, 0x56, 0xF6, 0x38, 0x36, 0x23, 0xAC,
92 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80,
93 0x03, 0xC0, 0x03, 0xC0, 0x03, 0xC0, 0x03, 0xC0, 0x03, 0x80, 0x02, 0x40,
94 0x0F, 0x90, 0x1B, 0x68, 0x3D, 0xB4, 0x1F, 0xF0, 0x1F, 0xF8, 0x1F, 0xF8,
95 0x10, 0x28, 0x08, 0x28, 0x29, 0x08, 0x07, 0xE8, 0x1C, 0x50
99 // Red Network Progress notches
100 char netnotchTable[]=
103 0x80, 0x50, 0xD0, 0xf0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xD0, 0xF0, 0xC0,
104 0x70, 0x50, 0x80, 0x60,
107 0x60, 0xE0, 0xE0, 0xA0, 0xA0, 0xA0, 0xE0, 0xA0, 0xA0, 0xA0, 0xE0, 0xA0,
108 0xA0, 0xE0, 0x60, 0x00,
111 0x80, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00,
112 0x10, 0x10, 0x80, 0x60,
115 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
116 0x00, 0x00, 0x00, 0x00
119 // CODE --------------------------------------------------------------------
123 //--------------------------------------------------------------------------
125 // Startup Screen Functions
127 //--------------------------------------------------------------------------
130 //==========================================================================
132 // ST_Init - Do the startup screen
134 //==========================================================================
144 // Set 640x480x16 mode
151 buffer = ST_LoadScreen();
153 bitmap = buffer + 16*3;
156 FadeToPaletteHR(pal);
169 //==========================================================================
173 //==========================================================================
175 void ST_UpdateNotches(int notchPosition)
178 int x = ST_PROGRESS_X + notchPosition*ST_NOTCH_WIDTH;
179 int y = ST_PROGRESS_Y;
180 SlamBlockHR(x,y, ST_NOTCH_WIDTH,ST_NOTCH_HEIGHT, notchTable);
185 //==========================================================================
187 // ST_UpdateNetNotches - indicates network progress
189 //==========================================================================
191 void ST_UpdateNetNotches(int notchPosition)
194 int x = ST_NETPROGRESS_X + notchPosition*ST_NETNOTCH_WIDTH;
195 int y = ST_NETPROGRESS_Y;
196 SlamBlockHR(x,y, ST_NETNOTCH_WIDTH, ST_NETNOTCH_HEIGHT, netnotchTable);
201 //==========================================================================
203 // ST_Progress - increments progress indicator
205 //==========================================================================
207 void ST_Progress(void)
210 static int notchPosition=0;
212 // Check for ESC press -- during startup all events eaten here
221 if(notchPosition<ST_MAX_NOTCHES)
223 ST_UpdateNotches(notchPosition);
224 S_StartSound(NULL, SFX_STARTUP_TICK);
233 //==========================================================================
235 // ST_NetProgress - indicates network progress
237 //==========================================================================
239 void ST_NetProgress(void)
242 static int netnotchPosition=0;
249 if(netnotchPosition<ST_MAX_NETNOTCHES)
251 ST_UpdateNetNotches(netnotchPosition);
252 S_StartSound(NULL, SFX_DRIP);
260 //==========================================================================
262 // ST_NetDone - net progress complete
264 //==========================================================================
265 void ST_NetDone(void)
267 S_StartSound(NULL, SFX_PICKUP_WEAPON);
271 //==========================================================================
273 // ST_Message - gives debug message
275 //==========================================================================
277 void ST_Message(char *message, ...)
282 va_start(argptr, message);
283 vsprintf(buffer, message, argptr);
286 if ( strlen(buffer) >= 80 )
288 I_Error("Long debug message has overwritten memory");
294 //==========================================================================
296 // ST_RealMessage - gives user message
298 //==========================================================================
300 void ST_RealMessage(char *message, ...)
305 va_start(argptr, message);
306 vsprintf(buffer, message, argptr);
309 if ( strlen(buffer) >= 80 )
311 I_Error("Long debug message has overwritten memory\n");
314 printf(buffer); // Always print these messages
319 //==========================================================================
321 // ST_LoadScreen - loads startup graphic
323 //==========================================================================
326 char *ST_LoadScreen(void)
331 lump = W_GetNumForName("STARTUP");
332 length = W_LumpLength(lump);
333 buffer = (char *)Z_Malloc(length, PU_STATIC, NULL);
334 W_ReadLump(lump, buffer);