Skip to content
Permalink
Browse files

- added a texture that can display the start screen

Needed to experiment with this part of the engine. At the moment this only compiles on Windows because the other platforms do not have the needed backing code.
  • Loading branch information...
coelckers committed Oct 1, 2019
1 parent b0acfc3 commit 69eac1f37fed01175c843d0d409986161979a96b
@@ -500,16 +500,15 @@ 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
win32/win32glvideo.cpp)

if (HAVE_VULKAN)
set (PLAT_WIN32_SOURCES ${PLAT_WIN32_SOURCES} win32/win32vulkanvideo.cpp )
endif()

set( PLAT_POSIX_SOURCES
posix/i_steam.cpp )
set( PLAT_SDL_SOURCES
@@ -839,7 +838,7 @@ set( FASTMATH_SOURCES
r_data/models/models.cpp
utility/matrix.cpp
)

#Vulkan stuff must go into a separate list later because it needs to be disabled for some platforms
set (VULKAN_SOURCES
rendering/vulkan/system/vk_device.cpp
@@ -934,6 +933,7 @@ set (PCH_SOURCES
serializer.cpp
scriptutil.cpp
st_stuff.cpp
st_start_util.cpp
rendering/v_framebuffer.cpp
r_data/v_palette.cpp
rendering/v_video.cpp
@@ -1090,6 +1090,7 @@ set (PCH_SOURCES
gamedata/textures/formats/emptytexture.cpp
gamedata/textures/formats/shadertexture.cpp
gamedata/textures/formats/tgatexture.cpp
gamedata/textures/formats/startscreentexture.cpp
gamedata/textures/hires/hqresize.cpp
gamedata/textures/hires/hirestex.cpp
gamedata/fonts/singlelumpfont.cpp
@@ -1098,7 +1099,7 @@ set (PCH_SOURCES
gamedata/fonts/font.cpp
gamedata/fonts/hexfont.cpp
gamedata/fonts/v_font.cpp
gamedata/fonts/v_text.cpp
gamedata/fonts/v_text.cpp
gamedata/p_xlat.cpp
gamedata/xlat/parse_xlat.cpp
gamedata/xlat/parsecontext.cpp
@@ -0,0 +1,113 @@
/*
** startscreentexture.cpp
** Texture class to create a texture from the start screen's imagé
**
**---------------------------------------------------------------------------
** Copyright 2004-2006 Randy Heit
** Copyright 2019 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
**
*/

#include "doomtype.h"
#include "files.h"
#include "w_wad.h"
#include "gi.h"
#include "bitmap.h"
#include "textures/textures.h"
#include "imagehelpers.h"
#include "image.h"
#include "st_start.h"


//==========================================================================
//
//
//
//==========================================================================

class FStartScreenTexture : public FImageSource
{
BitmapInfo *info; // This must remain constant for the lifetime of this texture

public:
FStartScreenTexture (BitmapInfo *srcdata);
int CopyPixels(FBitmap *bmp, int conversion) override;
};

//==========================================================================
//
//
//
//==========================================================================

FImageSource *CreateStartScreenTexture(BitmapInfo *srcdata)
{
return new FStartScreenTexture(srcdata);
}


//==========================================================================
//
//
//
//==========================================================================

FStartScreenTexture::FStartScreenTexture (BitmapInfo *srcdata)
: FImageSource(-1)
{
Width = srcdata->bmiHeader.biWidth;
Height = srcdata->bmiHeader.biHeight;
info = srcdata;
bUseGamePalette = false;

}

//==========================================================================
//
//
//
//==========================================================================

int FStartScreenTexture::CopyPixels(FBitmap *bmp, int conversion)
{
const RgbQuad *psource = info->bmiColors;
PalEntry paldata[256] = {};
auto pixels = ST_Util_BitsForBitmap(info);
for (uint32_t i = 0; i < info->bmiHeader.biClrUsed; i++)
{
PalEntry &pe = paldata[i];
pe.r = psource[i].rgbRed;
pe.g = psource[i].rgbGreen;
pe.b = psource[i].rgbBlue;
pe.a = 255;
}
bmp->CopyPixelData(0, 0, pixels, Width, Height, 1, (Width + 3) & ~3, 0, paldata);

return 0;
}
@@ -60,22 +60,6 @@
// ---------------------------------------------------------------------------


class FBasicStartupScreen : public FStartupScreen
{
public:
FBasicStartupScreen(int maxProgress, bool showBar);
~FBasicStartupScreen();

virtual void Progress();

virtual void NetInit(const char* message, int playerCount);
virtual void NetProgress(int count);
virtual void NetMessage(const char *format, ...);
virtual void NetDone();
virtual bool NetLoop(bool (*timerCallback)(void*), void* userData);
};


FBasicStartupScreen::FBasicStartupScreen(int maxProgress, bool showBar)
: FStartupScreen(maxProgress)
{
@@ -42,6 +42,8 @@
#include "s_sound.h"
#include "s_music.h"
#include "d_main.h"
#include "textures.h"
#include "image.h"

void I_GetEvent(); // i_input.h pulls in too much garbage.

@@ -308,6 +310,7 @@ static const uint16_t IBM437ToUnicode[] = {
};

BitmapInfo* StartupBitmap;
FTexture * StartupTexture;

// Hexen startup screen
#define ST_MAX_NOTCHES 32
@@ -392,6 +395,21 @@ static const int StrifeStartupPicSizes[4 + 2 + 1] =
2304
};

FImageSource *CreateStartScreenTexture(BitmapInfo *srcdata);

void InvalidateTexture()
{
if (StartupTexture == nullptr)
{
auto imgsource = CreateStartScreenTexture(StartupBitmap);
StartupTexture = new FImageTexture(imgsource);
StartupTexture->SetUseType(ETextureType::Override);
}
else
{
StartupTexture->SystemTextures.Clean(true, true);
}
}

//==========================================================================
//

0 comments on commit 69eac1f

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