Skip to content
Permalink
Browse files

- split up st_start.cpp into one file with the Windows interface code…

… and a second one which only contains platform independent code.

Since this made heavy use of Windows type, those were duplicated to avoid rewriting the entire interface.
This split at least reduces the amount of code needed to refactor for making the screens work on other platforms than Windows.
  • Loading branch information...
coelckers committed Oct 1, 2019
1 parent 5179a69 commit b0acfc3ce64985e9e47a040325512f2cf03cbaf4
Showing with 1,326 additions and 1,191 deletions.
  1. +1 −0 src/CMakeLists.txt
  2. +122 −0 src/st_start.h
  3. +1 −3 src/win32/i_main.cpp
  4. +17 −1,188 src/win32/st_start.cpp
  5. +1,185 −0 src/win32/st_start_util.cpp
@@ -500,6 +500,7 @@ set( PLAT_WIN32_SOURCES
win32/i_system.cpp
win32/i_specialpaths.cpp
win32/st_start.cpp
win32/st_start_util.cpp
win32/gl_sysfb.cpp
win32/base_sysfb.cpp
win32/win32basevideo.cpp
@@ -34,6 +34,7 @@
** The startup screen interface is based on a mix of Heretic and Hexen.
** Actual implementation is system-specific.
*/
#include <stdint.h>

class FStartupScreen
{
@@ -56,6 +57,127 @@ class FStartupScreen
int MaxPos, CurPos, NotchPos;
};

class FBasicStartupScreen : public FStartupScreen
{
public:
FBasicStartupScreen(int max_progress, bool show_bar);
~FBasicStartupScreen();

void Progress();
void NetInit(const char* message, int num_players);
void NetProgress(int count);
void NetMessage(const char* format, ...); // cover for printf
void NetDone();
bool NetLoop(bool (*timer_callback)(void*), void* userdata);
protected:
long long NetMarqueeMode;
int NetMaxPos, NetCurPos;
};

class FGraphicalStartupScreen : public FBasicStartupScreen
{
public:
FGraphicalStartupScreen(int max_progress);
~FGraphicalStartupScreen();
};

class FHereticStartupScreen : public FGraphicalStartupScreen
{
public:
FHereticStartupScreen(int max_progress, long &hr);

void Progress();
void LoadingStatus(const char *message, int colors);
void AppendStatusLine(const char *status);
protected:
void SetWindowSize();

int ThermX, ThermY, ThermWidth, ThermHeight;
int HMsgY, SMsgX;
};

class FHexenStartupScreen : public FGraphicalStartupScreen
{
public:
FHexenStartupScreen(int max_progress, long &hr);
~FHexenStartupScreen();

void Progress();
void NetProgress(int count);
void NetDone();
void SetWindowSize();

// Hexen's notch graphics, converted to chunky pixels.
uint8_t * NotchBits;
uint8_t * NetNotchBits;
};

class FStrifeStartupScreen : public FGraphicalStartupScreen
{
public:
FStrifeStartupScreen(int max_progress, long &hr);
~FStrifeStartupScreen();

void Progress();
protected:
void DrawStuff(int old_laser, int new_laser);
void SetWindowSize();

uint8_t *StartupPics[4+2+1];
};



extern FStartupScreen *StartScreen;

extern void ST_Endoom();

// The entire set of functions here uses native Windows types. These are recreations of those types so that the code doesn't need to be changed more than necessary

struct BitmapInfoHeader
{
uint32_t biSize;
int32_t biWidth;
int32_t biHeight;
uint16_t biPlanes;
uint16_t biBitCount;
uint32_t biCompression;
uint32_t biSizeImage;
int32_t biXPelsPerMeter;
int32_t biYPelsPerMeter;
uint32_t biClrUsed;
uint32_t biClrImportant;
};

struct RgbQuad
{
uint8_t rgbBlue;
uint8_t rgbGreen;
uint8_t rgbRed;
uint8_t rgbReserved;
};


struct BitmapInfo
{
BitmapInfoHeader bmiHeader;
RgbQuad bmiColors[1];
};

extern BitmapInfo* StartupBitmap;


void ST_Util_PlanarToChunky4(uint8_t* dest, const uint8_t* src, int width, int height);
void ST_Util_DrawBlock(BitmapInfo* bitmap_info, const uint8_t* src, int x, int y, int bytewidth, int height);
void ST_Util_ClearBlock(BitmapInfo* bitmap_info, uint8_t fill, int x, int y, int bytewidth, int height);
BitmapInfo* ST_Util_CreateBitmap(int width, int height, int color_bits);
uint8_t* ST_Util_BitsForBitmap(BitmapInfo* bitmap_info);
void ST_Util_FreeBitmap(BitmapInfo* bitmap_info);
void ST_Util_BitmapColorsFromPlaypal(BitmapInfo* bitmap_info);
uint8_t* ST_Util_LoadFont(const char* filename);
void ST_Util_FreeFont(uint8_t* font);
BitmapInfo* ST_Util_AllocTextBitmap(const uint8_t* font);
void ST_Util_DrawTextScreen(BitmapInfo* bitmap_info, const uint8_t* text_screen, const uint8_t* font);
void ST_Util_DrawChar(BitmapInfo* screen, const uint8_t* font, int x, int y, uint8_t charnum, uint8_t attrib);
void ST_Util_UpdateTextBlink(BitmapInfo* bitmap_info, const uint8_t* text_screen, const uint8_t* font, bool on);

@@ -98,7 +98,6 @@
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
void CreateCrashLog (const char *custominfo, DWORD customsize, HWND richedit);
void DisplayCrashLog ();
extern uint8_t *ST_Util_BitsForBitmap (BITMAPINFO *bitmap_info);
void I_FlushBufferedConsoleStuff();

// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
@@ -108,7 +107,6 @@ void I_FlushBufferedConsoleStuff();
// EXTERNAL DATA DECLARATIONS ----------------------------------------------

extern EXCEPTION_POINTERS CrashPointers;
extern BITMAPINFO *StartupBitmap;
extern UINT TimerPeriod;

// PUBLIC DATA DEFINITIONS -------------------------------------------------
@@ -481,7 +479,7 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
// so flip it vertically while drawing it.
StretchDIBits (drawitem->hDC, rect.left, rect.bottom - 1, rect.right - rect.left, rect.top - rect.bottom,
0, 0, StartupBitmap->bmiHeader.biWidth, StartupBitmap->bmiHeader.biHeight,
ST_Util_BitsForBitmap(StartupBitmap), StartupBitmap, DIB_RGB_COLORS, SRCCOPY);
ST_Util_BitsForBitmap(StartupBitmap), reinterpret_cast<const BITMAPINFO*>(StartupBitmap), DIB_RGB_COLORS, SRCCOPY);

// If the title banner is gone, then this is an ENDOOM screen, so draw a short prompt
// where the command prompt would have been in DOS.

0 comments on commit b0acfc3

Please sign in to comment.
You can’t perform that action at this time.