mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-02-07 16:31:07 +00:00
- backend sync with Raze
Mostly code reformatting plus license and copyright adjustments
This commit is contained in:
parent
4881ec257a
commit
c892fb1ddb
18 changed files with 126 additions and 98 deletions
|
@ -45,7 +45,7 @@ F2DDrawer* twod = &drawer;
|
||||||
|
|
||||||
EXTERN_CVAR(Float, transsouls)
|
EXTERN_CVAR(Float, transsouls)
|
||||||
CVAR(Float, classic_scaling_factor, 1.0, CVAR_ARCHIVE)
|
CVAR(Float, classic_scaling_factor, 1.0, CVAR_ARCHIVE)
|
||||||
CVAR(Float, classic_scaling_pixelaspect, 1.2, CVAR_ARCHIVE)
|
CVAR(Float, classic_scaling_pixelaspect, 1.2f, CVAR_ARCHIVE)
|
||||||
|
|
||||||
IMPLEMENT_CLASS(DShape2DTransform, false, false)
|
IMPLEMENT_CLASS(DShape2DTransform, false, false)
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "s_soundinternal.h"
|
#include "s_soundinternal.h"
|
||||||
#include "texturemanager.h"
|
#include "texturemanager.h"
|
||||||
|
#include "palutil.h"
|
||||||
|
|
||||||
void JitCompiler::EmitMOVE()
|
void JitCompiler::EmitMOVE()
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "basics.h"
|
#include "basics.h"
|
||||||
#include "texturemanager.h"
|
#include "texturemanager.h"
|
||||||
|
#include "palutil.h"
|
||||||
|
|
||||||
extern cycle_t VMCycles[10];
|
extern cycle_t VMCycles[10];
|
||||||
extern int VMCalls[10];
|
extern int VMCalls[10];
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
/*
|
/*
|
||||||
** pngtexture.cpp
|
** ddstexture.cpp
|
||||||
** Texture class for DDS images
|
** Texture class for DDS images
|
||||||
**
|
**
|
||||||
**---------------------------------------------------------------------------
|
**---------------------------------------------------------------------------
|
||||||
** Copyright 2006-2007 Randy Heit
|
** Copyright 2006-2016 Randy Heit
|
||||||
|
** Copyright 2006-2019 Christoph Oelckers
|
||||||
** All rights reserved.
|
** All rights reserved.
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without
|
** Redistribution and use in source and binary forms, with or without
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
** Texture class for JPEG images
|
** Texture class for JPEG images
|
||||||
**
|
**
|
||||||
**---------------------------------------------------------------------------
|
**---------------------------------------------------------------------------
|
||||||
** Copyright 2006-2007 Randy Heit
|
** Copyright 2005-2016 Randy Heit
|
||||||
|
** Copyright 2005-2019 Christoph Oelckers
|
||||||
** All rights reserved.
|
** All rights reserved.
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without
|
** Redistribution and use in source and binary forms, with or without
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
**
|
**
|
||||||
**---------------------------------------------------------------------------
|
**---------------------------------------------------------------------------
|
||||||
** Copyright 2005 David HENRY
|
** Copyright 2005 David HENRY
|
||||||
** Copyright 2006 Christoph Oelckers
|
** Copyright 2006-2019 Christoph Oelckers
|
||||||
** All rights reserved.
|
** All rights reserved.
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without
|
** Redistribution and use in source and binary forms, with or without
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
**
|
**
|
||||||
**---------------------------------------------------------------------------
|
**---------------------------------------------------------------------------
|
||||||
** Copyright 2004-2007 Randy Heit
|
** Copyright 2004-2007 Randy Heit
|
||||||
|
** Copyright 2005-2019 Christoph Oelckers
|
||||||
** All rights reserved.
|
** All rights reserved.
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without
|
** Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -34,7 +35,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
#include "filesystem.h"
|
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "m_png.h"
|
#include "m_png.h"
|
||||||
#include "bitmap.h"
|
#include "bitmap.h"
|
||||||
|
@ -42,6 +42,7 @@
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
#include "texturemanager.h"
|
#include "texturemanager.h"
|
||||||
|
#include "filesystem.h"
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
|
@ -640,7 +641,7 @@ class FPNGFileTexture : public FTexture
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FPNGFileTexture (FileReader &lump, int width, int height, uint8_t colortype);
|
FPNGFileTexture (FileReader &lump, int width, int height, uint8_t colortype);
|
||||||
virtual FBitmap GetBgraBitmap(const PalEntry *remap, int *trans);
|
virtual FBitmap GetBgraBitmap(const PalEntry *remap, int *trans) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -721,7 +722,7 @@ FBitmap FPNGFileTexture::GetBgraBitmap(const PalEntry *remap, int *trans)
|
||||||
lump->Seek (len, FileReader::SeekCur);
|
lump->Seek (len, FileReader::SeekCur);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PaletteSize = MIN<int> (len / 3, 256);
|
PaletteSize = std::min<int> (len / 3, 256);
|
||||||
for(int i = 0; i < PaletteSize; i++)
|
for(int i = 0; i < PaletteSize; i++)
|
||||||
{
|
{
|
||||||
pe[i].r = lump->ReadUInt8();
|
pe[i].r = lump->ReadUInt8();
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
** Texture class for TGA images
|
** Texture class for TGA images
|
||||||
**
|
**
|
||||||
**---------------------------------------------------------------------------
|
**---------------------------------------------------------------------------
|
||||||
** Copyright 2006 Christoph Oelckers
|
** Copyright 2006-2019 Christoph Oelckers
|
||||||
** All rights reserved.
|
** All rights reserved.
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without
|
** Redistribution and use in source and binary forms, with or without
|
||||||
|
|
|
@ -108,6 +108,8 @@ class FGameTexture
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
float alphaThreshold = 0.5f;
|
||||||
|
|
||||||
FGameTexture(FTexture* wrap, const char *name);
|
FGameTexture(FTexture* wrap, const char *name);
|
||||||
~FGameTexture();
|
~FGameTexture();
|
||||||
void Setup(FTexture* wrap);
|
void Setup(FTexture* wrap);
|
||||||
|
@ -253,6 +255,13 @@ public:
|
||||||
LeftOffset[which] = x;
|
LeftOffset[which] = x;
|
||||||
TopOffset[which] = y;
|
TopOffset[which] = y;
|
||||||
}
|
}
|
||||||
|
void SetOffsets(int x, int y)
|
||||||
|
{
|
||||||
|
LeftOffset[0] = x;
|
||||||
|
TopOffset[0] = y;
|
||||||
|
LeftOffset[1] = x;
|
||||||
|
TopOffset[1] = y;
|
||||||
|
}
|
||||||
void SetScale(float x, float y)
|
void SetScale(float x, float y)
|
||||||
{
|
{
|
||||||
ScaleX = x;
|
ScaleX = x;
|
||||||
|
|
|
@ -59,9 +59,15 @@ private:
|
||||||
TArray<TranslatedTexture> hwTex_Translated;
|
TArray<TranslatedTexture> hwTex_Translated;
|
||||||
|
|
||||||
TranslatedTexture * GetTexID(int translation, int scaleflags)
|
TranslatedTexture * GetTexID(int translation, int scaleflags)
|
||||||
|
{
|
||||||
|
// Allow negative indices to pass through unchanged.
|
||||||
|
// This is needed for allowing the client to allocate slots that aren't matched to a palette, e.g. Build's indexed variants.
|
||||||
|
if (translation >= 0)
|
||||||
{
|
{
|
||||||
auto remap = GPalette.TranslationToTable(translation);
|
auto remap = GPalette.TranslationToTable(translation);
|
||||||
translation = remap == nullptr ? 0 : remap->Index;
|
translation = remap == nullptr ? 0 : remap->Index;
|
||||||
|
}
|
||||||
|
else translation &= ~0x7fffffff;
|
||||||
|
|
||||||
if (translation == 0 && !(scaleflags & CTF_Upscale))
|
if (translation == 0 && !(scaleflags & CTF_Upscale))
|
||||||
{
|
{
|
||||||
|
|
|
@ -147,5 +147,4 @@ namespace ImageHelpers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -873,7 +873,6 @@ void FMultipatchTextureBuilder::ResolveAllPatches()
|
||||||
for (int i = BuiltTextures.Size()-1; i>= 0; i--)
|
for (int i = BuiltTextures.Size()-1; i>= 0; i--)
|
||||||
{
|
{
|
||||||
auto &buildinfo = BuiltTextures[i];
|
auto &buildinfo = BuiltTextures[i];
|
||||||
|
|
||||||
bool hasEmpty = false;
|
bool hasEmpty = false;
|
||||||
|
|
||||||
for (unsigned j = 0; j < buildinfo.Inits.Size(); j++)
|
for (unsigned j = 0; j < buildinfo.Inits.Size(); j++)
|
||||||
|
|
|
@ -1,24 +1,35 @@
|
||||||
//
|
/*
|
||||||
//---------------------------------------------------------------------------
|
** skyboxtexture.cpp
|
||||||
//
|
**
|
||||||
// Copyright(C) 2004-2016 Christoph Oelckers
|
**---------------------------------------------------------------------------
|
||||||
// All rights reserved.
|
** Copyright 2004-2019 Christoph Oelckers
|
||||||
//
|
** All rights reserved.
|
||||||
// This program is free software: you can redistribute it and/or modify
|
**
|
||||||
// it under the terms of the GNU Lesser General Public License as published by
|
** Redistribution and use in source and binary forms, with or without
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
** modification, are permitted provided that the following conditions
|
||||||
// (at your option) any later version.
|
** are met:
|
||||||
//
|
**
|
||||||
// This program is distributed in the hope that it will be useful,
|
** 1. Redistributions of source code must retain the above copyright
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
** notice, this list of conditions and the following disclaimer.
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
** 2. Redistributions in binary form must reproduce the above copyright
|
||||||
// GNU Lesser General Public License for more details.
|
** notice, this list of conditions and the following disclaimer in the
|
||||||
//
|
** documentation and/or other materials provided with the distribution.
|
||||||
// You should have received a copy of the GNU Lesser General Public License
|
** 3. The name of the author may not be used to endorse or promote products
|
||||||
// along with this program. If not, see http://www.gnu.org/licenses/
|
** 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 "filesystem.h"
|
#include "filesystem.h"
|
||||||
#include "textures.h"
|
#include "textures.h"
|
||||||
|
|
|
@ -378,6 +378,7 @@ FTextureBuffer FTexture::CreateTexBuffer(int translation, int flags)
|
||||||
if (GetImage() && flags & CTF_ProcessData)
|
if (GetImage() && flags & CTF_ProcessData)
|
||||||
{
|
{
|
||||||
if (flags & CTF_Upscale) CreateUpsampledTextureBuffer(result, !!isTransparent, checkonly);
|
if (flags & CTF_Upscale) CreateUpsampledTextureBuffer(result, !!isTransparent, checkonly);
|
||||||
|
|
||||||
if (!checkonly) ProcessData(result.mBuffer, result.mWidth, result.mHeight, false);
|
if (!checkonly) ProcessData(result.mBuffer, result.mWidth, result.mHeight, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,4 +540,3 @@ FWrapperTexture::FWrapperTexture(int w, int h, int bits)
|
||||||
SystemTextures.AddHardwareTexture(0, false, hwtex);
|
SystemTextures.AddHardwareTexture(0, false, hwtex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -625,7 +625,6 @@ void FTextureManager::AddHiresTextures (int wadnum)
|
||||||
auto gtex = MakeGameTexture(newtex, nullptr, ETextureType::Override);
|
auto gtex = MakeGameTexture(newtex, nullptr, ETextureType::Override);
|
||||||
gtex->SetWorldPanning(true);
|
gtex->SetWorldPanning(true);
|
||||||
gtex->SetDisplaySize(oldtex->GetDisplayWidth(), oldtex->GetDisplayHeight());
|
gtex->SetDisplaySize(oldtex->GetDisplayWidth(), oldtex->GetDisplayHeight());
|
||||||
|
|
||||||
gtex->SetOffsets(0, xs_RoundToInt(oldtex->GetDisplayLeftOffset(0) * gtex->GetScaleX()), xs_RoundToInt(oldtex->GetDisplayTopOffset(0) * gtex->GetScaleY()));
|
gtex->SetOffsets(0, xs_RoundToInt(oldtex->GetDisplayLeftOffset(0) * gtex->GetScaleX()), xs_RoundToInt(oldtex->GetDisplayTopOffset(0) * gtex->GetScaleY()));
|
||||||
gtex->SetOffsets(1, xs_RoundToInt(oldtex->GetDisplayLeftOffset(1) * gtex->GetScaleX()), xs_RoundToInt(oldtex->GetDisplayTopOffset(1) * gtex->GetScaleY()));
|
gtex->SetOffsets(1, xs_RoundToInt(oldtex->GetDisplayLeftOffset(1) * gtex->GetScaleX()), xs_RoundToInt(oldtex->GetDisplayTopOffset(1) * gtex->GetScaleY()));
|
||||||
ReplaceTexture(tlist[i], gtex, true);
|
ReplaceTexture(tlist[i], gtex, true);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
**
|
**
|
||||||
**---------------------------------------------------------------------------
|
**---------------------------------------------------------------------------
|
||||||
** Copyright 2005-2016 Randy Heit
|
** Copyright 2005-2016 Randy Heit
|
||||||
** Copyright 2005-2016 Christoph Oelckers
|
** Copyright 2005-2019 Christoph Oelckers
|
||||||
** All rights reserved.
|
** All rights reserved.
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without
|
** Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -203,8 +203,9 @@ class FTexture : public RefCountedBase
|
||||||
{
|
{
|
||||||
friend class FGameTexture; // only for the porting work
|
friend class FGameTexture; // only for the porting work
|
||||||
|
|
||||||
protected:
|
public:
|
||||||
FHardwareTextureContainer SystemTextures;
|
FHardwareTextureContainer SystemTextures;
|
||||||
|
protected:
|
||||||
FloatRect* areas = nullptr;
|
FloatRect* areas = nullptr;
|
||||||
int SourceLump;
|
int SourceLump;
|
||||||
uint16_t Width = 0, Height = 0;
|
uint16_t Width = 0, Height = 0;
|
||||||
|
@ -250,7 +251,6 @@ public:
|
||||||
int GetSourceLump() { return SourceLump; } // needed by the scripted GetName method.
|
int GetSourceLump() { return SourceLump; } // needed by the scripted GetName method.
|
||||||
bool FindHoles(const unsigned char * buffer, int w, int h);
|
bool FindHoles(const unsigned char * buffer, int w, int h);
|
||||||
|
|
||||||
|
|
||||||
void CopySize(FTexture* BaseTexture)
|
void CopySize(FTexture* BaseTexture)
|
||||||
{
|
{
|
||||||
Width = BaseTexture->GetWidth();
|
Width = BaseTexture->GetWidth();
|
||||||
|
|
Loading…
Reference in a new issue