mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- support for indexed hightiles.
This commit is contained in:
parent
d0e6a7ea29
commit
3e76f71f02
3 changed files with 28 additions and 18 deletions
|
@ -45,8 +45,8 @@
|
|||
#include "mapinfo.h"
|
||||
#include "hw_voxels.h"
|
||||
|
||||
int tileSetHightileReplacement(int picnum, int palnum, const char* filename, float alphacut, float xscale, float yscale, float specpower, float specfactor);
|
||||
int tileSetSkybox(int picnum, int palnum, FString* facenames);
|
||||
int tileSetHightileReplacement(int picnum, int palnum, const char* filename, float alphacut, float xscale, float yscale, float specpower, float specfactor, bool indexed = false);
|
||||
int tileSetSkybox(int picnum, int palnum, FString* facenames, bool indexed = false);
|
||||
void tileRemoveReplacement(int num);
|
||||
void AddUserMapHack(usermaphack_t&);
|
||||
|
||||
|
@ -136,6 +136,7 @@ static void parseTexturePaletteBlock(FScanner& sc, int tile)
|
|||
int pal = -1, xsiz = 0, ysiz = 0;
|
||||
FString fn;
|
||||
float alphacut = -1.0, xscale = 1.0, yscale = 1.0, specpower = 1.0, specfactor = 1.0;
|
||||
bool indexed = false;
|
||||
|
||||
if (!sc.GetNumber(pal, true)) return;
|
||||
|
||||
|
@ -151,6 +152,7 @@ static void parseTexturePaletteBlock(FScanner& sc, int tile)
|
|||
else if (sc.Compare({ "specfactor", "specularfactor", "parallaxbias" })) sc.GetFloat(specfactor, true);
|
||||
else if (sc.Compare("orig_sizex")) sc.GetNumber(xsiz, true);
|
||||
else if (sc.Compare("orig_sizey")) sc.GetNumber(ysiz, true);
|
||||
else if (sc.Compare("indexed")) indexed = true;
|
||||
};
|
||||
|
||||
if ((unsigned)tile < MAXUSERTILES)
|
||||
|
@ -167,7 +169,7 @@ static void parseTexturePaletteBlock(FScanner& sc, int tile)
|
|||
xscale = 1.0f / xscale;
|
||||
yscale = 1.0f / yscale;
|
||||
|
||||
tileSetHightileReplacement(tile, pal, fn, alphacut, xscale, yscale, specpower, specfactor);
|
||||
tileSetHightileReplacement(tile, pal, fn, alphacut, xscale, yscale, specpower, specfactor, indexed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -485,6 +487,7 @@ void parseSkybox(FScanner& sc, FScriptPosition& pos)
|
|||
FString faces[6];
|
||||
FScanner::SavedPos blockend;
|
||||
int tile = -1, pal = 0;
|
||||
bool indexed = false;
|
||||
|
||||
if (sc.StartBraces(&blockend)) return;
|
||||
while (!sc.FoundEndBrace(blockend))
|
||||
|
@ -498,10 +501,11 @@ void parseSkybox(FScanner& sc, FScriptPosition& pos)
|
|||
else if (sc.Compare({ "lt", "lf", "left" })) sc.GetString(faces[3]);
|
||||
else if (sc.Compare({ "up", "ceiling", "top", "ceil" })) sc.GetString(faces[4]);
|
||||
else if (sc.Compare({ "dn", "floor", "bottom", "down" })) sc.GetString(faces[5]);
|
||||
else if (sc.Compare("indexed")) indexed = true;
|
||||
// skip over everything else.
|
||||
}
|
||||
if (tile < 0) pos.Message(MSG_ERROR, "skybox: missing tile number");
|
||||
else tileSetSkybox(tile, pal, faces);
|
||||
else tileSetSkybox(tile, pal, faces, indexed);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -60,7 +60,7 @@ enum
|
|||
|
||||
BuildTiles TileFiles;
|
||||
|
||||
int tileSetHightileReplacement(int picnum, int palnum, const char* filename, float alphacut, float xscale, float yscale, float specpower, float specfactor);
|
||||
int tileSetHightileReplacement(int picnum, int palnum, const char* filename, float alphacut, float xscale, float yscale, float specpower, float specfactor, bool indexed = false);
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
@ -59,6 +59,7 @@ struct HightileReplacement
|
|||
float alphacut, specpower, specfactor;
|
||||
uint16_t palnum;
|
||||
bool issky;
|
||||
bool indexed;
|
||||
};
|
||||
|
||||
static TMap<int, TArray<HightileReplacement>> tileReplacements;
|
||||
|
@ -242,7 +243,7 @@ void highTileSetup()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int tileSetHightileReplacement(int picnum, int palnum, const char* filename, float alphacut, float xscale, float yscale, float specpower, float specfactor)
|
||||
int tileSetHightileReplacement(int picnum, int palnum, const char* filename, float alphacut, float xscale, float yscale, float specpower, float specfactor, bool indexed)
|
||||
{
|
||||
if ((uint32_t)picnum >= (uint32_t)MAXTILES) return -1;
|
||||
if ((uint32_t)palnum >= (uint32_t)MAXPALOOKUPS) return -1;
|
||||
|
@ -268,6 +269,7 @@ int tileSetHightileReplacement(int picnum, int palnum, const char* filename, flo
|
|||
replace.specpower = specpower; // currently unused
|
||||
replace.specfactor = specfactor; // currently unused
|
||||
replace.issky = 0;
|
||||
replace.indexed = indexed;
|
||||
replace.palnum = (uint16_t)palnum;
|
||||
AddReplacement(picnum, replace);
|
||||
return 0;
|
||||
|
@ -280,7 +282,7 @@ int tileSetHightileReplacement(int picnum, int palnum, const char* filename, flo
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int tileSetSkybox(int picnum, int palnum, FString* facenames)
|
||||
int tileSetSkybox(int picnum, int palnum, FString* facenames, bool indexed)
|
||||
{
|
||||
if ((uint32_t)picnum >= (uint32_t)MAXTILES) return -1;
|
||||
if ((uint32_t)palnum >= (uint32_t)MAXPALOOKUPS) return -1;
|
||||
|
@ -311,6 +313,7 @@ int tileSetSkybox(int picnum, int palnum, FString* facenames)
|
|||
replace.image = MakeGameTexture(sbtex, "", ETextureType::Override);
|
||||
TexMan.AddGameTexture(replace.image, false);
|
||||
replace.issky = 1;
|
||||
replace.indexed = indexed;
|
||||
replace.palnum = (uint16_t)palnum;
|
||||
AddReplacement(picnum, replace);
|
||||
return 0;
|
||||
|
@ -350,21 +353,24 @@ bool PickTexture(FGameTexture* tex, int paletteid, TexturePick& pick, bool wanti
|
|||
auto rep = (hw_hightile && !(h.tintFlags & TINTF_ALWAYSUSEART)) ? FindReplacement(tex->GetID(), hipalswap, false) : nullptr;
|
||||
if (rep || tex->GetTexture()->isHardwareCanvas())
|
||||
{
|
||||
if (usepalette > 0)
|
||||
{
|
||||
// This is a global setting for the entire scene, so let's do it here, right at the start. (Fixme: Store this in a static table instead of reusing the same entry for all palettes.)
|
||||
auto& hh = lookups.tables[MAXPALOOKUPS - 1];
|
||||
// This sets a tinting color for global palettes, e.g. water or slime - only used for hires replacements (also an option for low-resource hardware where duplicating the textures may be problematic.)
|
||||
pick.basepalTint = hh.tintColor;
|
||||
}
|
||||
|
||||
if (rep)
|
||||
{
|
||||
tex = rep->image;
|
||||
}
|
||||
if (!rep || rep->palnum != hipalswap || (h.tintFlags & TINTF_APPLYOVERALTPAL))
|
||||
applytint = true;
|
||||
if (!IsLuminosityTranslation(paletteid)) pick.translation = 0;
|
||||
if (!rep || !rep->indexed)
|
||||
{
|
||||
if (usepalette > 0)
|
||||
{
|
||||
// This is a global setting for the entire scene, so let's do it here, right at the start. (Fixme: Store this in a static table instead of reusing the same entry for all palettes.)
|
||||
auto& hh = lookups.tables[MAXPALOOKUPS - 1];
|
||||
// This sets a tinting color for global palettes, e.g. water or slime - only used for hires replacements (also an option for low-resource hardware where duplicating the textures may be problematic.)
|
||||
pick.basepalTint = hh.tintColor;
|
||||
}
|
||||
|
||||
if (!rep || rep->palnum != hipalswap || (h.tintFlags & TINTF_APPLYOVERALTPAL))
|
||||
applytint = true;
|
||||
if (!IsLuminosityTranslation(paletteid)) pick.translation = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue