- code cleanup.

This commit is contained in:
Christoph Oelckers 2022-12-08 12:44:06 +01:00
parent 3874cf365c
commit bea6834f8e
7 changed files with 23 additions and 9 deletions

View file

@ -117,6 +117,13 @@ public:
void MustGetNumber(bool evaluate = false);
bool CheckNumber(bool evaluate = false);
bool GetNumber(int16_t& var, bool evaluate = false)
{
if (!GetNumber(evaluate)) return false;
var = Number;
return true;
}
bool GetNumber(int& var, bool evaluate = false)
{
if (!GetNumber(evaluate)) return false;

View file

@ -82,8 +82,8 @@ PalettedPixels FImageSource::GetCachedPalettedPixels(int conversion)
{
PalettedPixels ret;
FString name;
fileSystem.GetFileShortName(name, SourceLump);
//FString name;
//fileSystem.GetFileShortName(name, SourceLump);
auto imageID = ImageID;
@ -196,10 +196,10 @@ FBitmap FImageSource::GetCachedBitmap(const PalEntry *remap, int conversion, int
{
FBitmap ret;
FString name;
int trans = -1;
fileSystem.GetFileShortName(name, SourceLump);
//FString name;
//fileSystem.GetFileShortName(name, SourceLump);
int trans = -1;
auto imageID = ImageID;
if (remap != nullptr)

View file

@ -60,7 +60,7 @@ public:
virtual bool SupportRemap0() { return false; } // Unfortunate hackery that's needed for Hexen's skies. Only the image can know about the needed parameters
virtual bool IsRawCompatible() { return true; } // Same thing for mid texture compatibility handling. Can only be determined by looking at the composition data which is private to the image.
void CopySize(FImageSource &other)
void CopySize(FImageSource &other) noexcept
{
Width = other.Width;
Height = other.Height;
@ -71,6 +71,7 @@ public:
// Images are statically allocated and freed in bulk. None of the subclasses may hold any destructible data.
void *operator new(size_t block) { return ImageArena.Alloc(block); }
void* operator new(size_t block, void* mem) { return mem; }
void operator delete(void *block) {}
bool bMasked = true; // Image (might) have holes (Assume true unless proven otherwise!)
@ -102,8 +103,8 @@ public:
noremap0 = 2
};
FImageSource(int sourcelump = -1) : SourceLump(sourcelump) { ImageID = ++NextID; }
virtual ~FImageSource() {}
FImageSource(int sourcelump = -1) noexcept : SourceLump(sourcelump) { ImageID = ++NextID; }
virtual ~FImageSource() = default;
int GetWidth() const
{

View file

@ -174,6 +174,10 @@ public:
BuildTileData.Reserve(1);
return BuildTileData.Last();
}
TArray<TArray<uint8_t>>& GetBuildTileDataStore()
{
return BuildTileData;
}
FGameTexture* GameTexture(FTextureID id) { return Textures[id.GetIndex()].Texture; }
void SetTranslation(FTextureID fromtexnum, FTextureID totexnum);

View file

@ -4,6 +4,7 @@
#include "maptypes.h"
#include "build.h"
#include "actorinfo.h"
#include "clip.h"
enum
{

View file

@ -98,7 +98,7 @@ SkyDefinition getSky(int tilenum)
result = {};
result.scale = 1.f;
}
int w = tileWidth(tilenum);
int w = tileWidth(tilenum);
if (result.lognumtiles == 0 || w >= 256)
{
if (w < 512) result.lognumtiles = 2;

View file

@ -43,6 +43,7 @@ BEGIN_DUKE_NS
void tileCopySection(FTextureID tilenum1, int sx1, int sy1, int xsiz, int ysiz, uint8_t* p2, int xsiz2, int ysiz2, int sx2, int sy2)
{
auto tex = TexMan.GetGameTexture(tilenum1);
if (!tex->isValid()) return;
int xsiz1 = tex->GetTexelWidth();
int ysiz1 = tex->GetTexelHeight();
if (xsiz1 > 0 && ysiz1 > 0)