mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 05:01:41 +00:00
- Backend update from Raze.
This commit is contained in:
parent
996b4f9f5c
commit
357163c60d
13 changed files with 137 additions and 24 deletions
|
@ -254,6 +254,11 @@ public:
|
|||
|
||||
virtual void StopChannel(FSoundChan* chan);
|
||||
sfxinfo_t* LoadSound(sfxinfo_t* sfx);
|
||||
const sfxinfo_t* GetSfx(unsigned snd)
|
||||
{
|
||||
if (snd >= S_sfx.Size()) return nullptr;
|
||||
return &S_sfx[snd];
|
||||
}
|
||||
|
||||
// Initializes sound stuff, including volume
|
||||
// Sets channels, SFX and music volume,
|
||||
|
|
|
@ -70,6 +70,8 @@
|
|||
#define RIGHTMARGIN 8
|
||||
#define BOTTOMARGIN 12
|
||||
|
||||
extern bool AppActive;
|
||||
|
||||
CUSTOM_CVAR(Int, con_buffersize, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
// ensure a minimum size
|
||||
|
@ -1039,7 +1041,7 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer)
|
|||
// Close console and clear command line. But if we're in the
|
||||
// fullscreen console mode, there's nothing to fall back on
|
||||
// if it's closed, so open the main menu instead.
|
||||
if (gamestate == GS_STARTUP)
|
||||
if (gamestate == GS_STARTUP || !AppActive)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -525,6 +525,7 @@ xx(ZDoom)
|
|||
xx(ZDoomTranslated)
|
||||
xx(Vavoom)
|
||||
xx(GZDoom)
|
||||
xx(Eternity)
|
||||
|
||||
xx(Xpanningfloor)
|
||||
xx(Ypanningfloor)
|
||||
|
|
|
@ -86,6 +86,7 @@ int Printf (int printlevel, const char *format, ...) ATTRIBUTE((format(printf,2,
|
|||
int Printf (const char *format, ...) ATTRIBUTE((format(printf,1,2)));
|
||||
int DPrintf (int level, const char *format, ...) ATTRIBUTE((format(printf,2,3)));
|
||||
|
||||
void I_DebugPrint(const char* cp);
|
||||
void debugprintf(const char* f, ...); // Prints to the debugger's log.
|
||||
|
||||
// flag to silence non-error output
|
||||
|
|
|
@ -306,7 +306,7 @@ void FMD3Model::AddSkins(uint8_t *hitlist)
|
|||
{
|
||||
for (unsigned i = 0; i < Surfaces.Size(); i++)
|
||||
{
|
||||
if (curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid())
|
||||
if (curSpriteMDLFrame && curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid())
|
||||
{
|
||||
hitlist[curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].GetIndex()] |= FTextureManager::HIT_Flat;
|
||||
}
|
||||
|
@ -357,13 +357,16 @@ void FMD3Model::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int f
|
|||
FGameTexture *surfaceSkin = skin;
|
||||
if (!surfaceSkin)
|
||||
{
|
||||
if (curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid())
|
||||
if (curSpriteMDLFrame)
|
||||
{
|
||||
surfaceSkin = TexMan.GetGameTexture(curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i], true);
|
||||
}
|
||||
else if (surf->numSkins > 0 && surf->Skins[0].isValid())
|
||||
{
|
||||
surfaceSkin = TexMan.GetGameTexture(surf->Skins[0], true);
|
||||
if (curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid())
|
||||
{
|
||||
surfaceSkin = TexMan.GetGameTexture(curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i], true);
|
||||
}
|
||||
else if (surf->numSkins > 0 && surf->Skins[0].isValid())
|
||||
{
|
||||
surfaceSkin = TexMan.GetGameTexture(surf->Skins[0], true);
|
||||
}
|
||||
}
|
||||
|
||||
if (!surfaceSkin)
|
||||
|
|
|
@ -636,7 +636,7 @@ void FOBJModel::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int f
|
|||
OBJSurface *surf = &surfaces[i];
|
||||
|
||||
FGameTexture *userSkin = skin;
|
||||
if (!userSkin)
|
||||
if (!userSkin && curSpriteMDLFrame)
|
||||
{
|
||||
if (i < MD3_MAX_SURFACES && curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid())
|
||||
{
|
||||
|
@ -669,7 +669,7 @@ void FOBJModel::AddSkins(uint8_t* hitlist)
|
|||
{
|
||||
for (size_t i = 0; i < surfaces.Size(); i++)
|
||||
{
|
||||
if (i < MD3_MAX_SURFACES && curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid())
|
||||
if (curSpriteMDLFrame && i < MD3_MAX_SURFACES && curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid())
|
||||
{
|
||||
// Precache skins manually reassigned by the user.
|
||||
// On OBJs with lots of skins, such as Doom map OBJs exported from GZDB,
|
||||
|
|
|
@ -242,7 +242,7 @@ void FUE1Model::RenderFrame( FModelRenderer *renderer, FGameTexture *skin, int f
|
|||
FGameTexture *sskin = skin;
|
||||
if ( !sskin )
|
||||
{
|
||||
if ( curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][groups[i].texNum].isValid() )
|
||||
if (curSpriteMDLFrame && curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][groups[i].texNum].isValid() )
|
||||
sskin = TexMan.GetGameTexture(curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][groups[i].texNum], true);
|
||||
if ( !sskin )
|
||||
{
|
||||
|
@ -303,7 +303,7 @@ void FUE1Model::BuildVertexBuffer( FModelRenderer *renderer )
|
|||
void FUE1Model::AddSkins( uint8_t *hitlist )
|
||||
{
|
||||
for ( int i=0; i<numGroups; i++ )
|
||||
if ( curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][groups[i].texNum].isValid() )
|
||||
if (curSpriteMDLFrame && curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][groups[i].texNum].isValid() )
|
||||
hitlist[curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][groups[i].texNum].GetIndex()] |= FTextureManager::HIT_Flat;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "texturemanager.h"
|
||||
#include "palettecontainer.h"
|
||||
#include "textures.h"
|
||||
#include "imagehelpers.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4244) // warning C4244: conversion from 'double' to 'float', possible loss of data
|
||||
|
@ -99,6 +100,7 @@ TArray<uint8_t> FVoxelTexture::CreatePalettedPixels(int conversion)
|
|||
pe.b = (pp[2] << 2) | (pp[2] >> 4);
|
||||
// Alphatexture handling is just for completeness, but rather unlikely to be used ever.
|
||||
Pixels[i] = conversion == luminance ? pe.r : ColorMatcher.Pick(pe);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -108,6 +110,7 @@ TArray<uint8_t> FVoxelTexture::CreatePalettedPixels(int conversion)
|
|||
Pixels[i] = (uint8_t)i;
|
||||
}
|
||||
}
|
||||
ImageHelpers::FlipSquareBlock(Pixels.Data(), Width);
|
||||
return Pixels;
|
||||
}
|
||||
|
||||
|
|
|
@ -452,16 +452,16 @@ void DStatusBarCore::StatusbarToRealCoords(double& x, double& y, double& w, doub
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
void DStatusBarCore::DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color, int translation, double rotate, ERenderStyle style)
|
||||
void DStatusBarCore::DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color, int translation, ERenderStyle style, double clipwidth)
|
||||
{
|
||||
if (!texture.isValid())
|
||||
return;
|
||||
|
||||
FGameTexture* tex = TexMan.GetGameTexture(texture, !(flags & DI_DONTANIMATE));
|
||||
DrawGraphic(tex, x, y, flags, Alpha, boxwidth, boxheight, scaleX, scaleY, color, translation, rotate, style);
|
||||
DrawGraphic(tex, x, y, flags, Alpha, boxwidth, boxheight, scaleX, scaleY, color, translation, style);
|
||||
}
|
||||
|
||||
void DStatusBarCore::DrawGraphic(FGameTexture* tex, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color, int translation, double rotate, ERenderStyle style)
|
||||
void DStatusBarCore::DrawGraphic(FGameTexture* tex, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color, int translation, ERenderStyle style, double clipwidth)
|
||||
{
|
||||
double texwidth = tex->GetDisplayWidth() * scaleX;
|
||||
double texheight = tex->GetDisplayHeight() * scaleY;
|
||||
|
@ -582,6 +582,10 @@ void DStatusBarCore::DrawGraphic(FGameTexture* tex, double x, double y, int flag
|
|||
DTA_LeftOffset, 0,
|
||||
DTA_DestWidthF, boxwidth,
|
||||
DTA_DestHeightF, boxheight,
|
||||
DTA_ClipLeft, 0,
|
||||
DTA_ClipTop, 0,
|
||||
DTA_ClipBottom, twod->GetHeight(),
|
||||
DTA_ClipRight, clipwidth < 0? twod->GetWidth() : int(x + boxwidth * clipwidth),
|
||||
DTA_Color, color,
|
||||
DTA_TranslationIndex, translation? translation : (flags & DI_TRANSLATABLE) ? GetTranslation() : 0,
|
||||
DTA_ColorOverlay, (flags & DI_DIM) ? MAKEARGB(170, 0, 0, 0) : 0,
|
||||
|
@ -590,7 +594,96 @@ void DStatusBarCore::DrawGraphic(FGameTexture* tex, double x, double y, int flag
|
|||
DTA_FillColor, (flags & DI_ALPHAMAPPED) ? 0 : -1,
|
||||
DTA_FlipX, !!(flags & DI_MIRROR),
|
||||
DTA_FlipY, !!(flags& DI_MIRRORY),
|
||||
DTA_Rotate, rotate,
|
||||
DTA_LegacyRenderStyle, style,
|
||||
TAG_DONE);
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// draw stuff
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
void DStatusBarCore::DrawRotated(FTextureID texture, double x, double y, double angle, int flags, double Alpha, double scaleX, double scaleY, PalEntry color, int translation, ERenderStyle style)
|
||||
{
|
||||
if (!texture.isValid())
|
||||
return;
|
||||
|
||||
FGameTexture* tex = TexMan.GetGameTexture(texture, !(flags & DI_DONTANIMATE));
|
||||
DrawRotated(tex, x, y, angle, flags, Alpha, scaleX, scaleY, color, translation, style);
|
||||
}
|
||||
|
||||
void DStatusBarCore::DrawRotated(FGameTexture* tex, double x, double y, int flags, double angle, double Alpha, double scaleX, double scaleY, PalEntry color, int translation, ERenderStyle style)
|
||||
{
|
||||
double texwidth = tex->GetDisplayWidth() * scaleX;
|
||||
double texheight = tex->GetDisplayHeight() * scaleY;
|
||||
double texleftoffs = tex->GetDisplayLeftOffset() * scaleY;
|
||||
double textopoffs = tex->GetDisplayTopOffset() * scaleY;
|
||||
|
||||
// resolve auto-alignment before making any adjustments to the position values.
|
||||
if (!(flags & DI_SCREEN_MANUAL_ALIGN))
|
||||
{
|
||||
if (x < 0) flags |= DI_SCREEN_RIGHT;
|
||||
else flags |= DI_SCREEN_LEFT;
|
||||
if (y < 0) flags |= DI_SCREEN_BOTTOM;
|
||||
else flags |= DI_SCREEN_TOP;
|
||||
}
|
||||
|
||||
Alpha *= this->Alpha;
|
||||
if (Alpha <= 0) return;
|
||||
x += drawOffset.X;
|
||||
y += drawOffset.Y;
|
||||
DVector2 Scale = GetHUDScale();
|
||||
|
||||
scaleX = 1 / scaleX;
|
||||
scaleY = 1 / scaleY;
|
||||
|
||||
if (!fullscreenOffsets)
|
||||
{
|
||||
StatusbarToRealCoords(x, y, texwidth, texheight);
|
||||
}
|
||||
else
|
||||
{
|
||||
double orgx, orgy;
|
||||
|
||||
switch (flags & DI_SCREEN_HMASK)
|
||||
{
|
||||
default: orgx = 0; break;
|
||||
case DI_SCREEN_HCENTER: orgx = twod->GetWidth() / 2; break;
|
||||
case DI_SCREEN_RIGHT: orgx = twod->GetWidth(); break;
|
||||
}
|
||||
|
||||
switch (flags & DI_SCREEN_VMASK)
|
||||
{
|
||||
default: orgy = 0; break;
|
||||
case DI_SCREEN_VCENTER: orgy = twod->GetHeight() / 2; break;
|
||||
case DI_SCREEN_BOTTOM: orgy = twod->GetHeight(); break;
|
||||
}
|
||||
|
||||
// move stuff in the top right corner a bit down if the fps counter is on.
|
||||
if ((flags & (DI_SCREEN_HMASK | DI_SCREEN_VMASK)) == DI_SCREEN_RIGHT_TOP && vid_fps) y += 10;
|
||||
|
||||
x *= Scale.X;
|
||||
y *= Scale.Y;
|
||||
scaleX *= Scale.X;
|
||||
scaleY *= Scale.Y;
|
||||
x += orgx;
|
||||
y += orgy;
|
||||
}
|
||||
DrawTexture(twod, tex, x, y,
|
||||
DTA_ScaleX, scaleX,
|
||||
DTA_ScaleY, scaleY,
|
||||
DTA_Color, color,
|
||||
DTA_CenterOffsetRel, !!(flags & DI_ITEM_RELCENTER),
|
||||
DTA_Rotate, angle,
|
||||
DTA_TranslationIndex, translation ? translation : (flags & DI_TRANSLATABLE) ? GetTranslation() : 0,
|
||||
DTA_ColorOverlay, (flags & DI_DIM) ? MAKEARGB(170, 0, 0, 0) : 0,
|
||||
DTA_Alpha, Alpha,
|
||||
DTA_AlphaChannel, !!(flags & DI_ALPHAMAPPED),
|
||||
DTA_FillColor, (flags & DI_ALPHAMAPPED) ? 0 : -1,
|
||||
DTA_FlipX, !!(flags & DI_MIRROR),
|
||||
DTA_FlipY, !!(flags & DI_MIRRORY),
|
||||
DTA_LegacyRenderStyle, style,
|
||||
TAG_DONE);
|
||||
}
|
||||
|
|
|
@ -184,8 +184,10 @@ public:
|
|||
virtual void SetScale();
|
||||
void ValidateResolution(int& hres, int& vres) const;
|
||||
void StatusbarToRealCoords(double& x, double& y, double& w, double& h) const;
|
||||
void DrawGraphic(FGameTexture* texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, double rotate = 0, ERenderStyle style = STYLE_Translucent);
|
||||
void DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, double rotate = 0, ERenderStyle style = STYLE_Translucent);
|
||||
void DrawGraphic(FGameTexture* texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, ERenderStyle style = STYLE_Translucent, double clipwidth = -1.0);
|
||||
void DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, ERenderStyle style = STYLE_Translucent, double clipwidth = -1.0);
|
||||
void DrawRotated(FTextureID texture, double x, double y, double angle, int flags, double Alpha, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, ERenderStyle style = STYLE_Translucent);
|
||||
void DrawRotated(FGameTexture* tex, double x, double y, int flags, double angle, double Alpha, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, ERenderStyle style = STYLE_Translucent);
|
||||
void DrawString(FFont* font, const FString& cstring, double x, double y, int flags, double Alpha, int translation, int spacing, EMonospacing monospacing, int shadowX, int shadowY, double scaleX, double scaleY, int pt);
|
||||
void TransformRect(double& x, double& y, double& w, double& h, int flags = 0);
|
||||
void Fill(PalEntry color, double x, double y, double w, double h, int flags = 0);
|
||||
|
|
|
@ -115,11 +115,6 @@ FImageSource *PNGImage_TryCreate(FileReader & data, int lumpnum)
|
|||
uint8_t filter = data.ReadUInt8();
|
||||
uint8_t interlace = data.ReadUInt8();
|
||||
|
||||
// NOTICE: GZDoom is the ONLY program in the typical development stack (GIMP, Slade, UDB) which does not support these formats
|
||||
// As such, the average developer will have no other way to figure out what's going wrong without these: these CANNOT be allowed to fail silently.
|
||||
// As things like PNG-compression and 64-bit color become more common in royalty-free PBR materials, support should be an eventual target.
|
||||
// Even then, these warnings should remain to prevent this from being an issue the next time things change.
|
||||
|
||||
if (compression != 0 || filter != 0 || interlace > 1)
|
||||
{
|
||||
Printf(TEXTCOLOR_YELLOW"WARNING: failed to load PNG %s: the compression, filter, or interlace is not supported!\n", fileSystem.GetFileFullName(lumpnum));
|
||||
|
|
|
@ -208,10 +208,10 @@ bool D_AddFile(TArray<FString>& wadfiles, const char* file, bool check, int posi
|
|||
// Confirm file exists in filesystem.
|
||||
struct stat info;
|
||||
bool found = stat(file, &info) == 0;
|
||||
FString fullpath = file;
|
||||
if (!found)
|
||||
{
|
||||
// File not found, so split file into path and filename so we can enumerate the path for the file.
|
||||
FString fullpath = file;
|
||||
auto lastindex = fullpath.LastIndexOf("/");
|
||||
FString basepath = fullpath.Left(lastindex);
|
||||
FString filename = fullpath.Right(fullpath.Len() - lastindex - 1);
|
||||
|
|
|
@ -761,6 +761,10 @@ public:
|
|||
ReadUserKey(ukey);
|
||||
loader->MapThingsUserData.Push(ukey);
|
||||
}
|
||||
else
|
||||
{
|
||||
DPrintf(DMSG_WARNING, "Unknown UDMF thing key %s\n", key.GetChars());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1111,6 +1115,7 @@ public:
|
|||
break;
|
||||
|
||||
default:
|
||||
DPrintf(DMSG_WARNING, "Unknown UDMF linedef key %s\n", key.GetChars());
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1425,6 +1430,7 @@ public:
|
|||
break;
|
||||
|
||||
default:
|
||||
DPrintf(DMSG_WARNING, "Unknown UDMF sidedef key %s\n", key.GetChars());
|
||||
break;
|
||||
|
||||
}
|
||||
|
@ -1929,6 +1935,7 @@ public:
|
|||
break;
|
||||
|
||||
default:
|
||||
DPrintf(DMSG_WARNING, "Unknown UDMF sector key %s\n", key.GetChars());
|
||||
break;
|
||||
}
|
||||
if ((namespace_bits & (Zd | Zdt)) && !strnicmp("user_", key.GetChars(), 5))
|
||||
|
@ -2179,6 +2186,7 @@ public:
|
|||
switch(namespc.GetIndex())
|
||||
{
|
||||
case NAME_ZDoom:
|
||||
case NAME_Eternity:
|
||||
namespace_bits = Zd;
|
||||
isTranslated = false;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue