use FTranslationID in all places where strict type checking is needed.

This means all properties in serializable classes now use this wrapper type. The backend hasn't been changed yet
This commit is contained in:
Christoph Oelckers 2023-11-09 19:20:04 +01:00
parent f0c9b1765e
commit 8c5eb2c807
42 changed files with 189 additions and 139 deletions

View file

@ -996,7 +996,7 @@ class DAutomap :public DAutomapBase
void calcMinMaxMtoF();
void DrawMarker(FGameTexture *tex, double x, double y, int yadjust,
INTBOOL flip, double xscale, double yscale, int translation, double alpha, uint32_t fillcolor, FRenderStyle renderstyle);
INTBOOL flip, double xscale, double yscale, FTranslationID translation, double alpha, uint32_t fillcolor, FRenderStyle renderstyle);
void rotatePoint(double *x, double *y);
void rotate(double *x, double *y, DAngle an);
@ -3074,7 +3074,7 @@ void DAutomap::drawThings ()
//=============================================================================
void DAutomap::DrawMarker (FGameTexture *tex, double x, double y, int yadjust,
INTBOOL flip, double xscale, double yscale, int translation, double alpha, uint32_t fillcolor, FRenderStyle renderstyle)
INTBOOL flip, double xscale, double yscale, FTranslationID translation, double alpha, uint32_t fillcolor, FRenderStyle renderstyle)
{
if (tex == nullptr || !tex->isValid())
{
@ -3097,7 +3097,7 @@ void DAutomap::DrawMarker (FGameTexture *tex, double x, double y, int yadjust,
DTA_ClipLeft, f_x,
DTA_ClipRight, f_x + f_w,
DTA_FlipX, flip,
DTA_TranslationIndex, translation,
DTA_TranslationIndex, translation.index(),
DTA_Alpha, alpha,
DTA_FillColor, fillcolor,
DTA_RenderStyle, renderstyle.AsDWORD,
@ -3128,7 +3128,7 @@ void DAutomap::drawMarks ()
if (font == nullptr)
{
DrawMarker(TexMan.GetGameTexture(marknums[i], true), markpoints[i].x, markpoints[i].y, -3, 0,
1, 1, 0, 1, 0, LegacyRenderStyles[STYLE_Normal]);
1, 1, NO_TRANSLATION, 1, 0, LegacyRenderStyles[STYLE_Normal]);
}
else
{

View file

@ -10,6 +10,7 @@ class FGameTexture;
class FTextureID;
enum EUpscaleFlags : int;
class FConfigFile;
struct FTranslationID;
struct SystemCallbacks
{

View file

@ -220,7 +220,7 @@ FRemapTable* PaletteContainer::AddRemap(FRemapTable* remap)
//
//----------------------------------------------------------------------------
void PaletteContainer::UpdateTranslation(int trans, FRemapTable* remap)
void PaletteContainer::UpdateTranslation(FTranslationID trans, FRemapTable* remap)
{
auto newremap = AddRemap(remap);
TranslationTables[GetTranslationType(trans)].SetVal(GetTranslationIndex(trans), newremap);
@ -232,7 +232,7 @@ void PaletteContainer::UpdateTranslation(int trans, FRemapTable* remap)
//
//----------------------------------------------------------------------------
int PaletteContainer::AddTranslation(int slot, FRemapTable* remap, int count)
FTranslationID PaletteContainer::AddTranslation(int slot, FRemapTable* remap, int count)
{
uint32_t id = 0;
for (int i = 0; i < count; i++)
@ -249,9 +249,9 @@ int PaletteContainer::AddTranslation(int slot, FRemapTable* remap, int count)
//
//----------------------------------------------------------------------------
void PaletteContainer::CopyTranslation(int dest, int src)
void PaletteContainer::CopyTranslation(FTranslationID dest, FTranslationID src)
{
TranslationTables[GetTranslationType(dest)].SetVal(GetTranslationIndex(dest), TranslationToTable(src));
TranslationTables[GetTranslationType(dest)].SetVal(GetTranslationIndex(dest), TranslationToTable(src.index()));
}
//----------------------------------------------------------------------------
@ -260,8 +260,9 @@ void PaletteContainer::CopyTranslation(int dest, int src)
//
//----------------------------------------------------------------------------
FRemapTable *PaletteContainer::TranslationToTable(int translation)
FRemapTable *PaletteContainer::TranslationToTable(int translation) const
{
if (IsLuminosityTranslation(translation)) return nullptr;
unsigned int type = GetTranslationType(translation);
unsigned int index = GetTranslationIndex(translation);
@ -278,14 +279,14 @@ FRemapTable *PaletteContainer::TranslationToTable(int translation)
//
//----------------------------------------------------------------------------
int PaletteContainer::StoreTranslation(int slot, FRemapTable *remap)
FTranslationID PaletteContainer::StoreTranslation(int slot, FRemapTable *remap)
{
unsigned int i;
auto size = NumTranslations(slot);
for (i = 0; i < size; i++)
{
if (*remap == *TranslationToTable(TRANSLATION(slot, i)))
if (*remap == *TranslationToTable(TRANSLATION(slot, i).index()))
{
// A duplicate of this translation already exists
return TRANSLATION(slot, i);

View file

@ -43,6 +43,8 @@ private:
};
// outside facing translation ID
struct FTranslationID
{
public:
@ -67,21 +69,22 @@ public:
{
return ID == other.ID;
}
bool operator ==(int other) const = delete;
bool operator !=(int other) const = delete;
constexpr int index() const
{
return ID;
}
constexpr bool isvalid() const
{
return ID > 0;
return ID >= 0;
}
private:
int ID;
};
constexpr FTranslationID NO_TRANSLATION = FTranslationID::fromInt(0);
constexpr FTranslationID INVALID_TRANSLATION = FTranslationID::fromInt(-1);
// A class that initializes unusued pointers to NULL. This is used so that when
// the TAutoGrowArray below is expanded, the new elements will be NULLed.
class FRemapTablePtr
@ -107,28 +110,45 @@ enum
TRANSLATIONTYPE_MASK = (255 << TRANSLATION_SHIFT)
};
inline constexpr uint32_t TRANSLATION(uint8_t a, uint32_t b)
inline constexpr FTranslationID TRANSLATION(uint8_t a, uint32_t b)
{
return (a << TRANSLATION_SHIFT) | b;
return FTranslationID::fromInt((a << TRANSLATION_SHIFT) | b);
}
inline constexpr uint32_t LuminosityTranslation(int range, uint8_t min, uint8_t max)
inline constexpr int MakeLuminosityTranslation(int range, uint8_t min, uint8_t max)
{
// ensure that the value remains positive.
return ( (1 << 30) | ((range&0x3fff) << 16) | (min << 8) | max );
}
inline constexpr bool IsLuminosityTranslation(FTranslationID trans)
{
return trans.index() > 0 && (trans.index() & (1 << 30));
}
inline constexpr bool IsLuminosityTranslation(int trans)
{
return trans > 0 && (trans & (1 << 30));
}
inline constexpr int GetTranslationType(uint32_t trans)
inline constexpr int GetTranslationType(FTranslationID trans)
{
assert(!IsLuminosityTranslation(trans));
return (trans.index() & TRANSLATIONTYPE_MASK) >> TRANSLATION_SHIFT;
}
inline constexpr int GetTranslationIndex(FTranslationID trans)
{
assert(!IsLuminosityTranslation(trans));
return (trans.index() & TRANSLATION_MASK);
}
inline constexpr int GetTranslationType(int trans)
{
assert(!IsLuminosityTranslation(trans));
return (trans & TRANSLATIONTYPE_MASK) >> TRANSLATION_SHIFT;
}
inline constexpr int GetTranslationIndex(uint32_t trans)
inline constexpr int GetTranslationIndex(int trans)
{
assert(!IsLuminosityTranslation(trans));
return (trans & TRANSLATION_MASK);
@ -162,11 +182,11 @@ public:
void Clear();
int DetermineTranslucency(FileReader& file);
FRemapTable* AddRemap(FRemapTable* remap);
void UpdateTranslation(int trans, FRemapTable* remap);
int AddTranslation(int slot, FRemapTable* remap, int count = 1);
void CopyTranslation(int dest, int src);
int StoreTranslation(int slot, FRemapTable* remap);
FRemapTable* TranslationToTable(int translation);
void UpdateTranslation(FTranslationID trans, FRemapTable* remap);
FTranslationID AddTranslation(int slot, FRemapTable* remap, int count = 1);
void CopyTranslation(FTranslationID dest, FTranslationID src);
FTranslationID StoreTranslation(int slot, FRemapTable* remap);
FRemapTable* TranslationToTable(int translation) const;
void GenerateGlobalBrightmapFromColormap(const uint8_t* cmapdata, int numlevels);
void PushIdentityTable(int slot)
@ -174,7 +194,7 @@ public:
AddTranslation(slot, nullptr);
}
FRemapTable* GetTranslation(int slot, int index)
FRemapTable* GetTranslation(int slot, int index) const
{
if (TranslationTables.Size() <= (unsigned)slot) return nullptr;
return TranslationTables[slot].GetVal(index);
@ -192,6 +212,28 @@ public:
return TranslationTables[slot].Size();
}
};
struct LuminosityTranslationDesc
{
int colorrange;
int lum_min;
int lum_max;
static LuminosityTranslationDesc fromInt(int translation)
{
LuminosityTranslationDesc t;
t.colorrange = (translation >> 16) & 0x3fff;
t.lum_min = (translation >> 8) & 0xff;
t.lum_max = translation & 0xff;
return t;
}
static LuminosityTranslationDesc fromID(FTranslationID translation)
{
return fromInt(translation.index());
}
};
extern PaletteContainer GPalette;

View file

@ -1060,7 +1060,7 @@ void FFont::LoadTranslations()
for (int i = 0; i < NumTextColors; i++)
{
if (i == CR_UNTRANSLATED) Translations[i] = 0;
else Translations[i] = LuminosityTranslation(i*2 + TranslationType, minlum, maxlum);
else Translations[i] = MakeLuminosityTranslation(i*2 + TranslationType, minlum, maxlum);
}
}

View file

@ -324,7 +324,7 @@ public:
for (int i = 0; i < NumTextColors; i++)
{
if (i == CR_UNTRANSLATED) Translations[i] = 0;
else Translations[i] = LuminosityTranslation(i * 2 + 1, minlum, maxlum);
else Translations[i] = MakeLuminosityTranslation(i * 2 + 1, minlum, maxlum);
}
}
@ -388,7 +388,7 @@ public:
for (int i = 0; i < NumTextColors; i++)
{
if (i == CR_UNTRANSLATED) Translations[i] = 0;
else Translations[i] = LuminosityTranslation(i * 2, minlum, maxlum);
else Translations[i] = MakeLuminosityTranslation(i * 2, minlum, maxlum);
}
}
};

View file

@ -195,7 +195,7 @@ void FSingleLumpFont::LoadTranslations()
for (int i = 0; i < NumTextColors; i++)
{
if (i == CR_UNTRANSLATED) Translations[i] = 0;
else Translations[i] = LuminosityTranslation(i * 2 + (FontType == FONT1 ? 1 : 0), minlum, maxlum);
else Translations[i] = MakeLuminosityTranslation(i * 2 + (FontType == FONT1 ? 1 : 0), minlum, maxlum);
}
}

View file

@ -196,7 +196,7 @@ void FSpecialFont::LoadTranslations()
remap.Remap[i] = i;
}
}
trans = GPalette.StoreTranslation(TRANSLATION_Internal, &remap);
trans = GPalette.StoreTranslation(TRANSLATION_Internal, &remap).index();
}
}

View file

@ -49,7 +49,7 @@
extern FRandom pr_exrandom;
FMemArena FxAlloc(65536);
CompileEnvironment compileEnvironment;
int R_FindCustomTranslation(FName name);
FTranslationID R_FindCustomTranslation(FName name);
struct FLOP
{

View file

@ -48,6 +48,7 @@
#include "types.h"
#include "vmintern.h"
#include "c_cvars.h"
#include "palettecontainer.h"
struct FState; // needed for FxConstant. Maybe move the state constructor to a subclass later?
@ -508,6 +509,13 @@ public:
isresolved = true;
}
FxConstant(FTranslationID state, const FScriptPosition& pos) : FxExpression(EFX_Constant, pos)
{
value.Int = state.index();
ValueType = value.Type = TypeTranslationID;
isresolved = true;
}
FxConstant(VMFunction* state, const FScriptPosition& pos) : FxExpression(EFX_Constant, pos)
{
value.pointer = state;

View file

@ -1372,16 +1372,16 @@ DEFINE_ACTION_FUNCTION_NATIVE(DObject, FindFunction, FindFunctionPointer)
ACTION_RETURN_POINTER(FindFunctionPointer(cls, fn.GetIndex()));
}
int R_FindCustomTranslation(FName name);
FTranslationID R_FindCustomTranslation(FName name);
static int ZFindTranslation(int intname)
{
return R_FindCustomTranslation(ENamedName(intname));
return R_FindCustomTranslation(ENamedName(intname)).index();
}
static int MakeTransID(int g, int s)
{
return TRANSLATION(g, s);
return TRANSLATION(g, s).index();
}
DEFINE_ACTION_FUNCTION_NATIVE(_Translation, GetID, ZFindTranslation)

View file

@ -601,7 +601,7 @@ void DStatusBarCore::DrawGraphic(FGameTexture* tex, double x, double y, int flag
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_TranslationIndex, translation? translation : (flags & DI_TRANSLATABLE) ? GetTranslation().index() : 0,
DTA_ColorOverlay, (flags & DI_DIM) ? MAKEARGB(170, 0, 0, 0) : 0,
DTA_Alpha, Alpha,
DTA_AlphaChannel, !!(flags & DI_ALPHAMAPPED),
@ -686,7 +686,7 @@ void DStatusBarCore::DrawRotated(FGameTexture* tex, double x, double y, int flag
DTA_Color, color,
DTA_CenterOffsetRel, !!(flags & DI_ITEM_RELCENTER),
DTA_Rotate, angle,
DTA_TranslationIndex, translation ? translation : (flags & DI_TRANSLATABLE) ? GetTranslation() : 0,
DTA_TranslationIndex, translation ? translation : (flags & DI_TRANSLATABLE) ? GetTranslation().index() : 0,
DTA_ColorOverlay, (flags & DI_DIM) ? MAKEARGB(170, 0, 0, 0) : 0,
DTA_Alpha, Alpha,
DTA_AlphaChannel, !!(flags & DI_ALPHAMAPPED),
@ -704,7 +704,7 @@ void DStatusBarCore::DrawRotated(FGameTexture* tex, double x, double y, int flag
//
//============================================================================
void DStatusBarCore::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, int style)
void DStatusBarCore::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, FTranslationID pt, int style)
{
bool monospaced = monospacing != EMonospacing::Off;
double dx = 0;
@ -823,11 +823,11 @@ void DStatusBarCore::DrawString(FFont* font, const FString& cstring, double x, d
DTA_FillColor, 0,
TAG_DONE);
}
DrawChar(twod, font, pt == 0? fontcolor : CR_NATIVEPAL, rx, ry, ch,
DrawChar(twod, font, pt == NO_TRANSLATION? fontcolor : CR_NATIVEPAL, rx, ry, ch,
DTA_DestWidthF, rw,
DTA_DestHeightF, rh,
DTA_Alpha, Alpha,
DTA_TranslationIndex, pt,
DTA_TranslationIndex, pt.index(),
DTA_LegacyRenderStyle, ERenderStyle(style),
TAG_DONE);
@ -840,10 +840,11 @@ void DStatusBarCore::DrawString(FFont* font, const FString& cstring, double x, d
}
}
void SBar_DrawString(DStatusBarCore* self, DHUDFont* font, const FString& string, double x, double y, int flags, int trans, double alpha, int wrapwidth, int linespacing, double scaleX, double scaleY, int pt, int style)
void SBar_DrawString(DStatusBarCore* self, DHUDFont* font, const FString& string, double x, double y, int flags, int trans, double alpha, int wrapwidth, int linespacing, double scaleX, double scaleY, int pt_, int style)
{
if (font == nullptr || font->mFont == nullptr) ThrowAbortException(X_READ_NIL, nullptr);
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
auto pt = FTranslationID::fromInt(pt_);
// resolve auto-alignment before making any adjustments to the position values.
if (!(flags & DI_SCREEN_MANUAL_ALIGN))

View file

@ -179,7 +179,7 @@ public:
void BeginHUD(int resW, int resH, double Alpha, bool forceScaled = false);
void SetSize(int reltop = 32, int hres = 320, int vres = 200, int hhres = -1, int hvres = -1);
virtual DVector2 GetHUDScale() const;
virtual uint32_t GetTranslation() const { return 0; }
virtual FTranslationID GetTranslation() const { return NO_TRANSLATION; }
void SetDrawSize(int reltop, int hres, int vres);
virtual void SetScale();
void ValidateResolution(int& hres, int& vres) const;
@ -188,7 +188,7 @@ public:
void DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, ERenderStyle style = STYLE_Translucent, PalEntry color = 0xffffffff, int translation = 0, double clipwidth = -1.0);
void DrawRotated(FTextureID texture, 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 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, int style);
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, FTranslationID pt, int style);
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);
void SetClipRect(double x, double y, double w, double h, int flags = 0);

View file

@ -402,7 +402,7 @@ public:
virtual bool MustDrawLog(EHudState state);
virtual void SetMugShotState (const char *state_name, bool wait_till_done=false, bool reset=false);
void DrawLog();
uint32_t GetTranslation() const override;
FTranslationID GetTranslation() const override;
void CreateAltHUD();
void DrawAltHUD();

View file

@ -1247,7 +1247,7 @@ public:
DTA_ClipTop, static_cast<int>(dcy),
DTA_ClipRight, static_cast<int>(min<double>(INT_MAX, dcr)),
DTA_ClipBottom, static_cast<int>(min<double>(INT_MAX, dcb)),
DTA_TranslationIndex, translate ? GetTranslation() : 0,
DTA_TranslationIndex, GetTranslationIndex(translate),
DTA_ColorOverlay, dim ? DIM_OVERLAY : 0,
DTA_CenterBottomOffset, (offsetflags & SBarInfoCommand::CENTER_BOTTOM) == SBarInfoCommand::CENTER_BOTTOM,
DTA_Alpha, Alpha,
@ -1264,7 +1264,7 @@ public:
DTA_ClipTop, static_cast<int>(dcy),
DTA_ClipRight, static_cast<int>(min<double>(INT_MAX, dcr)),
DTA_ClipBottom, static_cast<int>(min<double>(INT_MAX, dcb)),
DTA_TranslationIndex, translate ? GetTranslation() : 0,
DTA_TranslationIndex, GetTranslationIndex(translate),
DTA_ColorOverlay, dim ? DIM_OVERLAY : 0,
DTA_CenterBottomOffset, (offsetflags & SBarInfoCommand::CENTER_BOTTOM) == SBarInfoCommand::CENTER_BOTTOM,
DTA_Alpha, Alpha,
@ -1319,7 +1319,7 @@ public:
DTA_ClipTop, static_cast<int>(rcy),
DTA_ClipRight, static_cast<int>(rcr),
DTA_ClipBottom, static_cast<int>(rcb),
DTA_TranslationIndex, translate ? GetTranslation() : 0,
DTA_TranslationIndex, GetTranslationIndex(translate),
DTA_ColorOverlay, dim ? DIM_OVERLAY : 0,
DTA_CenterBottomOffset, (offsetflags & SBarInfoCommand::CENTER_BOTTOM) == SBarInfoCommand::CENTER_BOTTOM,
DTA_Alpha, Alpha,
@ -1336,7 +1336,7 @@ public:
DTA_ClipTop, static_cast<int>(rcy),
DTA_ClipRight, static_cast<int>(rcr),
DTA_ClipBottom, static_cast<int>(rcb),
DTA_TranslationIndex, translate ? GetTranslation() : 0,
DTA_TranslationIndex, GetTranslationIndex(translate),
DTA_ColorOverlay, dim ? DIM_OVERLAY : 0,
DTA_CenterBottomOffset, (offsetflags & SBarInfoCommand::CENTER_BOTTOM) == SBarInfoCommand::CENTER_BOTTOM,
DTA_Alpha, Alpha,
@ -1467,13 +1467,18 @@ public:
}
}
uint32_t GetTranslation() const
FTranslationID GetTranslation() const
{
if(gameinfo.gametype & GAME_Raven)
return TRANSLATION(TRANSLATION_PlayersExtra, int(CPlayer - players));
return TRANSLATION(TRANSLATION_Players, int(CPlayer - players));
}
int GetTranslationIndex(bool translate) const
{
return translate? GetTranslation().index() : 0;
}
PClassActor *AmmoType(int no) const
{
auto w = StatusBar->CPlayer->ReadyWeapon;

View file

@ -1376,7 +1376,7 @@ AActor *DBaseStatusBar::ValidateInvFirst (int numVisible) const
return nullptr;
}
uint32_t DBaseStatusBar::GetTranslation() const
FTranslationID DBaseStatusBar::GetTranslation() const
{
if (gameinfo.gametype & GAME_Raven)
return TRANSLATION(TRANSLATION_PlayersExtra, int(CPlayer - players));

View file

@ -1390,7 +1390,7 @@ static int PatchThing (int thingy)
if (val > 8 || val < 0) val = 0;
unsigned color = bloodcolor[val];
info->BloodColor = color;
info->BloodTranslation = val == 0? 0 : TRANSLATION(TRANSLATION_Blood, CreateBloodTranslation(color));
info->BloodTranslation = val == 0? NO_TRANSLATION : CreateBloodTranslation(color);
}
else if (linelen == 10 && stricmp(Line1, "MBF21 Bits") == 0)
{
@ -3966,10 +3966,9 @@ bool CheckTranslucent(AActor* a)
return !(a->renderflags & RF_ZDOOMTRANS) && a->Alpha < 1 - FLT_EPSILON;
}
constexpr int t0 = 0;
constexpr int t1 = TRANSLATION(TRANSLATION_Standard, 0);
constexpr int t2 = TRANSLATION(TRANSLATION_Standard, 1);
constexpr int t3 = TRANSLATION(TRANSLATION_Standard, 2);
constexpr FTranslationID t1 = TRANSLATION(TRANSLATION_Standard, 0);
constexpr FTranslationID t2 = TRANSLATION(TRANSLATION_Standard, 1);
constexpr FTranslationID t3 = TRANSLATION(TRANSLATION_Standard, 2);
void SetTranslation1(AActor* a)
{
@ -3980,7 +3979,7 @@ void SetTranslation1(AActor* a)
void ClearTranslation1(AActor* a)
{
if (a->Translation == t3 || a->Translation == t2) a->Translation = t2;
else a->Translation = t0;
else a->Translation = NO_TRANSLATION;
}
bool CheckTranslation1(AActor* a)
@ -3997,7 +3996,7 @@ void SetTranslation2(AActor* a)
void ClearTranslation2(AActor* a)
{
if (a->Translation == t3 || a->Translation == t1) a->Translation = t1;
else a->Translation = t0;
else a->Translation = NO_TRANSLATION;
}
bool CheckTranslation2(AActor* a)

View file

@ -92,7 +92,7 @@ struct FDecalLib::FTranslation
uint32_t StartColor, EndColor;
FTranslation *Next;
uint32_t Index;
FTranslationID Index;
};
struct FDecalAnimator
@ -1002,7 +1002,7 @@ FDecalLib::FTranslation::FTranslation (uint32_t start, uint32_t end)
if (DecalTranslations.Size() == 256*256)
{
Printf ("Too many decal translations defined\n");
Index = 0;
Index = NO_TRANSLATION;
return;
}
@ -1028,7 +1028,7 @@ FDecalLib::FTranslation::FTranslation (uint32_t start, uint32_t end)
table[i] = ColorMatcher.Pick (ri >> 24, gi >> 24, bi >> 24);
}
table[0] = table[1];
Index = (uint32_t)TRANSLATION(TRANSLATION_Decals, tablei >> 8);
Index = TRANSLATION(TRANSLATION_Decals, tablei >> 8);
}
FDecalLib::FTranslation *FDecalLib::FTranslation::LocateTranslation (uint32_t start, uint32_t end)

View file

@ -38,6 +38,7 @@
#include "doomtype.h"
#include "renderstyle.h"
#include "palettecontainer.h"
class FScanner;
class FDecalTemplate;
@ -67,7 +68,7 @@ class FDecalTemplate : public FDecalBase
{
friend class FDecalLib;
public:
FDecalTemplate () : Translation (0) {}
FDecalTemplate () : Translation (NO_TRANSLATION) {}
void ApplyToDecal (DBaseDecal *actor, side_t *wall) const;
const FDecalTemplate *GetDecal () const;
@ -75,7 +76,7 @@ public:
double ScaleX, ScaleY;
uint32_t ShadeColor;
uint32_t Translation;
FTranslationID Translation;
FRenderStyle RenderStyle;
FTextureID PicNum;
uint16_t RenderFlags;

View file

@ -514,8 +514,8 @@ void DIntermissionScreenCast::Init(FIntermissionAction *desc, bool first)
else
{
advplayerstate = NULL;
casttranslation = 0;
if (mDefaults->Translation != 0)
casttranslation = NO_TRANSLATION;
if (mDefaults->Translation != NO_TRANSLATION)
{
casttranslation = mDefaults->Translation;
}
@ -707,7 +707,7 @@ void DIntermissionScreenCast::Drawer ()
DTA_DestWidthF, pic->GetDisplayWidth() * castscale.X,
DTA_RenderStyle, mDefaults->RenderStyle,
DTA_Alpha, mDefaults->Alpha,
DTA_TranslationIndex, casttranslation,
DTA_TranslationIndex, casttranslation.index(),
TAG_DONE);
}
}

View file

@ -246,7 +246,7 @@ class DIntermissionScreenCast : public DIntermissionScreen
TArray<FICastSound> mCastSounds;
int casttics;
uint32_t casttranslation; // [RH] Draw "our hero" with their chosen suit color
FTranslationID casttranslation; // [RH] Draw "our hero" with their chosen suit color
FState* caststate;
FState* basestate;
FState* advplayerstate;

View file

@ -243,17 +243,6 @@ void DBaseDecal::SetShade (int r, int g, int b)
AlphaColor = MAKEARGB(ColorMatcher.Pick (r, g, b), r, g, b);
}
//----------------------------------------------------------------------------
//
//
//
//----------------------------------------------------------------------------
void DBaseDecal::SetTranslation(uint32_t trans)
{
Translation = trans;
}
//----------------------------------------------------------------------------
//
// Returns the texture the decal stuck to.
@ -708,7 +697,7 @@ void DImpactDecal::Expired()
//
//----------------------------------------------------------------------------
DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, uint32_t bloodTranslation)
DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, FTranslationID bloodTranslation)
{
if (cl_maxdecals > 0)
{
@ -728,7 +717,7 @@ DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name, c
//
//----------------------------------------------------------------------------
DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, uint32_t bloodTranslation, bool permanent)
DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, FTranslationID bloodTranslation, bool permanent)
{
DBaseDecal *decal = NULL;
if (tpl != NULL && ((cl_maxdecals > 0 && !(wall->Flags & WALLF_NOAUTODECALS)) || permanent))
@ -743,9 +732,7 @@ DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplat
if (tpl->ShadeColor != tpl_low->ShadeColor) lowercolor=0;
else lowercolor = color;
uint32_t lowerTrans = (bloodTranslation != 0 ? bloodTranslation : 0);
StaticCreate (Level, tpl_low, pos, wall, ffloor, lowercolor, lowerTrans, permanent);
StaticCreate (Level, tpl_low, pos, wall, ffloor, lowercolor, bloodTranslation, permanent);
}
if (!permanent) decal = Level->CreateThinker<DImpactDecal>(pos.Z);
else decal = Level->CreateThinker<DBaseDecal>(pos.Z);
@ -768,7 +755,7 @@ DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplat
}
// [Nash] opaque blood
if (bloodTranslation != 0 && tpl->ShadeColor == 0 && tpl->opaqueBlood)
if (bloodTranslation != NO_TRANSLATION && tpl->ShadeColor == 0 && tpl->opaqueBlood)
{
decal->SetTranslation(bloodTranslation);
decal->RenderStyle = STYLE_Normal;
@ -860,7 +847,7 @@ void SprayDecal(AActor *shooter, const char *name, double distance, DVector3 off
else
dir = direction;
uint32_t bloodTrans = useBloodColor ? shooter->BloodTranslation : 0;
auto bloodTrans = useBloodColor ? shooter->BloodTranslation : NO_TRANSLATION;
PalEntry entry = !useBloodColor ? (PalEntry)decalColor : shooter->BloodColor;
if (Trace(off, shooter->Sector, dir, distance, 0, ML_BLOCKEVERYTHING, shooter, trace, TRACE_NoSky))
@ -891,7 +878,7 @@ DBaseDecal *ShootDecal(FLevelLocals *Level, const FDecalTemplate *tpl, sector_t
if (trace.HitType == TRACE_HitWall)
{
return DImpactDecal::StaticCreate(Level, tpl, trace.HitPos, trace.Line->sidedef[trace.Side], trace.ffloor, 0, 0, permanent);
return DImpactDecal::StaticCreate(Level, tpl, trace.HitPos, trace.Line->sidedef[trace.Side], trace.ffloor, 0, NO_TRANSLATION, permanent);
}
return NULL;
}

View file

@ -31,7 +31,11 @@ public:
double GetRealZ (const side_t *wall) const;
void SetShade (uint32_t rgb);
void SetShade (int r, int g, int b);
void SetTranslation(uint32_t trans);
void SetTranslation(FTranslationID trans)
{
Translation = trans;
}
void Spread (const FDecalTemplate *tpl, side_t *wall, double x, double y, double z, F3DFloor * ffloor);
void GetXY (side_t *side, double &x, double &y) const;
@ -42,7 +46,7 @@ public:
double ScaleX = 1, ScaleY = 1;
double Alpha = 1;
uint32_t AlphaColor = 0;
int Translation = 0;
FTranslationID Translation = NO_TRANSLATION;
FTextureID PicNum;
uint32_t RenderFlags = 0;
FRenderStyle RenderStyle;
@ -69,8 +73,8 @@ public:
}
void Construct(side_t *wall, const FDecalTemplate *templ);
static DBaseDecal *StaticCreate(FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, uint32_t bloodTranslation = 0);
static DBaseDecal *StaticCreate(FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, uint32_t bloodTranslation = 0, bool permanent = false);
static DBaseDecal *StaticCreate(FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, FTranslationID bloodTranslation = NO_TRANSLATION);
static DBaseDecal *StaticCreate(FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, FTranslationID bloodTranslation = NO_TRANSLATION, bool permanent = false);
void BeginPlay ();
void Expired() override;

View file

@ -1082,7 +1082,7 @@ public:
FRenderStyle RenderStyle; // Style to draw this actor with
FTextureID picnum; // Draw this instead of sprite if valid
uint32_t fillcolor; // Color to draw when STYLE_Shaded
uint32_t Translation;
FTranslationID Translation;
uint32_t RenderRequired; // current renderer must have this feature set
uint32_t RenderHidden; // current renderer must *not* have any of these features
@ -1262,7 +1262,7 @@ public:
uint8_t FriendPlayer; // [RH] Player # + 1 this friendly monster works for (so 0 is no player, 1 is player 0, etc)
double FloatBobStrength;
PalEntry BloodColor;
uint32_t BloodTranslation;
FTranslationID BloodTranslation;
// [RH] Stuff that used to be part of an Actor Info
FSoundID SeeSound;

View file

@ -1877,7 +1877,7 @@ FUNC(LS_Thing_SetTranslation)
// Thing_SetTranslation (tid, range)
{
auto iterator = Level->GetActorIterator(arg0);
int range;
FTranslationID range;
AActor *target;
bool ok = false;
@ -1895,7 +1895,7 @@ FUNC(LS_Thing_SetTranslation)
}
else
{
range = 0;
range = NO_TRANSLATION;
}
if (arg0 == 0)
@ -1903,7 +1903,7 @@ FUNC(LS_Thing_SetTranslation)
if (it != NULL)
{
ok = true;
it->Translation = range==0? it->GetDefault()->Translation : range;
it->Translation = range == NO_TRANSLATION ? it->GetDefault()->Translation : range;
}
}
else
@ -1911,7 +1911,7 @@ FUNC(LS_Thing_SetTranslation)
while ( (target = iterator.Next ()) )
{
ok = true;
target->Translation = range==0? target->GetDefault()->Translation : range;
target->Translation = range == NO_TRANSLATION ? target->GetDefault()->Translation : range;
}
}

View file

@ -5163,7 +5163,7 @@ void P_TraceBleed(int damage, const DVector3 &pos, AActor *actor, DAngle angle,
bloodcolor.a = 1;
}
uint32_t bloodTrans = (bloodcolor != 0 ? actor->BloodTranslation : 0);
auto bloodTrans = (bloodcolor != 0 ? actor->BloodTranslation : NO_TRANSLATION);
DImpactDecal::StaticCreate(actor->Level, bloodType, bleedtrace.HitPos,
bleedtrace.Line->sidedef[bleedtrace.Side], bleedtrace.ffloor, bloodcolor, bloodTrans);
@ -6481,7 +6481,7 @@ void P_DoCrunch(AActor *thing, FChangePosition *cpos)
mo->Vel.X = pr_crunch.Random2() / 16.;
mo->Vel.Y = pr_crunch.Random2() / 16.;
if (thing->BloodTranslation != 0 && !(mo->flags2 & MF2_DONTTRANSLATE))
if (thing->BloodTranslation != NO_TRANSLATION && !(mo->flags2 & MF2_DONTTRANSLATE))
{
mo->Translation = thing->BloodTranslation;
}

View file

@ -7558,8 +7558,8 @@ void AActor::SetTranslation(FName trname)
return;
}
int tnum = R_FindCustomTranslation(trname);
if (tnum >= 0)
auto tnum = R_FindCustomTranslation(trname);
if (tnum != INVALID_TRANSLATION)
{
Translation = tnum;
}

View file

@ -171,7 +171,7 @@ DPSprite::DPSprite(player_t *owner, AActor *caller, int id)
InterpolateTic(false),
firstTic(true),
Tics(0),
Translation(0),
Translation(NO_TRANSLATION),
Flags(0),
Owner(owner),
State(nullptr),
@ -1023,12 +1023,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_OverlayTranslation)
{
// an empty string resets to the default
// (unlike AActor::SetTranslation, there is no Default block for PSprites, so just set the translation to 0)
pspr->Translation = 0;
pspr->Translation = NO_TRANSLATION;
return 0;
}
int tnum = R_FindCustomTranslation(trname);
if (tnum >= 0)
auto tnum = R_FindCustomTranslation(trname);
if (tnum != INVALID_TRANSLATION)
{
pspr->Translation = tnum;
}

View file

@ -31,6 +31,7 @@
#define __P_PSPR_H__
#include "renderstyle.h"
#include "palettecontainer.h"
// Basic data types.
// Needs fixed point, and BAM angles.
@ -104,7 +105,7 @@ public:
int GetSprite() const { return Sprite; }
int GetFrame() const { return Frame; }
int GetTics() const { return Tics; }
uint32_t GetTranslation() { return Translation; }
FTranslationID GetTranslation() { return Translation; }
FState* GetState() const { return State; }
DPSprite* GetNext() { return Next; }
AActor* GetCaller() { return Caller; }
@ -127,7 +128,7 @@ public:
WeaponInterp Vert; // Current Position
bool firstTic;
int Tics;
uint32_t Translation;
FTranslationID Translation;
int Flags;
FRenderStyle Renderstyle;

View file

@ -64,7 +64,7 @@ void RenderModel(FModelRenderer *renderer, float x, float y, float z, FSpriteMod
int translation = 0;
if (!(smf->flags & MDL_IGNORETRANSLATION))
translation = actor->Translation;
translation = actor->Translation.index();
// y scale for a sprite means height, i.e. z in the world!
float scaleFactorX = actor->Scale.X * smf->xscale;
@ -245,8 +245,8 @@ void RenderHUDModel(FModelRenderer *renderer, DPSprite *psp, FVector3 translatio
float orientation = smf->xscale * smf->yscale * smf->zscale;
renderer->BeginDrawHUDModel(playermo->RenderStyle, objectToWorldMatrix, orientation < 0, smf);
uint32_t trans = psp->GetTranslation() != 0 ? psp->GetTranslation() : 0;
if ((psp->Flags & PSPF_PLAYERTRANSLATED)) trans = psp->Owner->mo->Translation;
uint32_t trans = psp->GetTranslation().index();
if ((psp->Flags & PSPF_PLAYERTRANSLATED)) trans = psp->Owner->mo->Translation.index();
RenderFrameModels(renderer, playermo->Level, smf, psp->GetState(), psp->GetTics(), psp->Caller->modelData != nullptr ? psp->Caller->modelData->modelDef != NAME_None ? PClass::FindActor(psp->Caller->modelData->modelDef) : psp->Caller->GetClass() : psp->Caller->GetClass(), trans, psp->Caller);
renderer->EndDrawHUDModel(playermo->RenderStyle, smf);
}

View file

@ -79,7 +79,7 @@ void StaticSerializeTranslations(FSerializer &arc)
auto size = GPalette.NumTranslations(TRANSLATION_LevelScripted);
for (unsigned int i = 0; i < size; ++i)
{
trans = GPalette.TranslationToTable(TRANSLATION(TRANSLATION_LevelScripted, i));
trans = GPalette.GetTranslation(TRANSLATION_LevelScripted, i);
if (trans != NULL && !trans->IsIdentity())
{
if (arc.BeginObject(nullptr))
@ -114,7 +114,7 @@ void StaticSerializeTranslations(FSerializer &arc)
static TArray<PalEntry> BloodTranslationColors;
int CreateBloodTranslation(PalEntry color)
FTranslationID CreateBloodTranslation(PalEntry color)
{
unsigned int i;
@ -132,7 +132,7 @@ int CreateBloodTranslation(PalEntry color)
color.b == BloodTranslationColors[i].b)
{
// A duplicate of this translation already exists
return i;
return TRANSLATION(TRANSLATION_Blood, i);
}
}
if (BloodTranslationColors.Size() >= MAX_DECORATE_TRANSLATIONS)
@ -152,7 +152,7 @@ int CreateBloodTranslation(PalEntry color)
trans.Remap[i] = entry;
}
GPalette.AddTranslation(TRANSLATION_Blood, &trans);
return BloodTranslationColors.Push(color);
return TRANSLATION(TRANSLATION_Blood, BloodTranslationColors.Push(color));
}
//----------------------------------------------------------------------------
@ -628,9 +628,9 @@ DEFINE_ACTION_FUNCTION(_Translation, SetPlayerTranslation)
//
//
//----------------------------------------------------------------------------
static TMap<FName, int> customTranslationMap;
static TMap<FName, FTranslationID> customTranslationMap;
int R_FindCustomTranslation(FName name)
FTranslationID R_FindCustomTranslation(FName name)
{
switch (name.GetIndex())
{
@ -639,7 +639,7 @@ int R_FindCustomTranslation(FName name)
return TRANSLATION(TRANSLATION_Standard, 7);
case NAME_None:
return 0;
return NO_TRANSLATION;
case NAME_RainPillar1:
case NAME_RainPillar2:
@ -662,8 +662,8 @@ int R_FindCustomTranslation(FName name)
return TRANSLATION(TRANSLATION_Players, name.GetIndex() - NAME_Player1);
}
int *t = customTranslationMap.CheckKey(name);
return (t != nullptr)? *t : -1;
auto t = customTranslationMap.CheckKey(name);
return (t != nullptr)? *t : INVALID_TRANSLATION;
}
//----------------------------------------------------------------------------
@ -698,16 +698,16 @@ void R_ParseTrnslate()
{
sc.ScriptError("Translation must be in the range [0,%d]", max);
}
NewTranslation = *GPalette.TranslationToTable(TRANSLATION(TRANSLATION_Standard, sc.Number));
NewTranslation = *GPalette.GetTranslation(TRANSLATION_Standard, sc.Number);
}
else if (sc.TokenType == TK_Identifier)
{
int tnum = R_FindCustomTranslation(sc.String);
if (tnum == -1)
auto tnum = R_FindCustomTranslation(sc.String);
if (tnum == INVALID_TRANSLATION)
{
sc.ScriptError("Base translation '%s' not found in '%s'", sc.String, newtrans.GetChars());
}
NewTranslation = *GPalette.TranslationToTable(tnum);
NewTranslation = *GPalette.TranslationToTable(tnum.index());
}
else
{
@ -746,7 +746,7 @@ void R_ParseTrnslate()
}
} while (sc.CheckToken(','));
int trans = GPalette.StoreTranslation(TRANSLATION_Custom, &NewTranslation);
auto trans = GPalette.StoreTranslation(TRANSLATION_Custom, &NewTranslation);
customTranslationMap[newtrans] = trans;
}
}
@ -773,7 +773,7 @@ DEFINE_ACTION_FUNCTION(_Translation, AddTranslation)
{
NewTranslation.Remap[i] = ColorMatcher.Pick(self->colors[i]);
}
int trans = GPalette.StoreTranslation(TRANSLATION_Custom, &NewTranslation);
ACTION_RETURN_INT(trans);
auto trans = GPalette.StoreTranslation(TRANSLATION_Custom, &NewTranslation);
ACTION_RETURN_INT(trans.index());
}

View file

@ -38,9 +38,9 @@ void R_InitTranslationTables (void);
void R_BuildPlayerTranslation (int player); // [RH] Actually create a player's translation table.
void R_GetPlayerTranslation (int color, const struct FPlayerColorSet *colorset, class FPlayerSkin *skin, struct FRemapTable *table);
int CreateBloodTranslation(PalEntry color);
FTranslationID CreateBloodTranslation(PalEntry color);
int R_FindCustomTranslation(FName name);
FTranslationID R_FindCustomTranslation(FName name);
void R_ParseTrnslate();
void StaticSerializeTranslations(FSerializer& arc);

View file

@ -152,7 +152,7 @@ void hw_PrecacheTexture(uint8_t *texhitlist, TMap<PClassActor*, bool> &actorhitl
while (it.NextPair(pair))
{
PClassActor *cls = pair->Key;
auto remap = GPalette.TranslationToTable(GetDefaultByType(cls)->Translation);
auto remap = GPalette.TranslationToTable(GetDefaultByType(cls)->Translation.index());
int gltrans = remap == nullptr ? 0 : remap->Index;
for (unsigned i = 0; i < cls->GetStateCount(); i++)

View file

@ -76,7 +76,7 @@ void HWDecal::DrawDecal(HWDrawInfo *di, FRenderState &state)
state.SetTextureMode(decal->RenderStyle);
state.SetRenderStyle(decal->RenderStyle);
state.SetMaterial(texture, UF_Sprite, 0, CLAMP_XY, decal->Translation, -1);
state.SetMaterial(texture, UF_Sprite, 0, CLAMP_XY, decal->Translation.index(), -1);
// If srcalpha is one it looks better with a higher alpha threshold

View file

@ -1077,7 +1077,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
}
}
translation = thing->Translation;
translation = thing->Translation.index();
OverrideShader = -1;
trans = thing->Alpha;

View file

@ -98,8 +98,8 @@ void HWDrawInfo::DrawPSprite(HUDSprite *huds, FRenderState &state)
{
float thresh = (huds->texture->GetTranslucency() || huds->OverrideShader != -1) ? 0.f : gl_mask_sprite_threshold;
state.AlphaFunc(Alpha_GEqual, thresh);
uint32_t trans = huds->weapon->GetTranslation() != 0 ? huds->weapon->GetTranslation() : 0;
if ((huds->weapon->Flags & PSPF_PLAYERTRANSLATED)) trans = huds->owner->Translation;
uint32_t trans = huds->weapon->GetTranslation().index();
if ((huds->weapon->Flags & PSPF_PLAYERTRANSLATED)) trans = huds->owner->Translation.index();
state.SetMaterial(huds->texture, UF_Sprite, CTF_Expand, CLAMP_XY_NOMIP, trans, huds->OverrideShader);
state.Draw(DT_TriangleStrip, huds->mx, 4);
}

View file

@ -241,7 +241,7 @@ namespace swrenderer
cmlight.SetColormap(thread, MINZ, light.GetLightLevel(), light.GetFoggy(), usecolormap, decal->RenderFlags & RF_FULLBRIGHT, false, false, false, false);
SpriteDrawerArgs drawerargs;
bool visible = drawerargs.SetStyle(thread->Viewport.get(), decal->RenderStyle, (float)decal->Alpha, decal->Translation, decal->AlphaColor, cmlight);
bool visible = drawerargs.SetStyle(thread->Viewport.get(), decal->RenderStyle, (float)decal->Alpha, decal->Translation.index(), decal->AlphaColor, cmlight);
if (visible)
{
drawerargs.DrawMasked(thread, zpos + WallSpriteTile->GetTopOffset(0) * decal->ScaleY, decal->ScaleY, decal->RenderFlags & RF_XFLIP, decal->RenderFlags & RF_YFLIP, WallC, clipper->x1, clipper->x2, light, WallSpriteTile, mfloorclip, mceilingclip, decal->RenderStyle);

View file

@ -307,8 +307,8 @@ namespace swrenderer
vis.yscale = float(pspriteyscale / stex->GetScale().Y);
vis.pic = stex;
uint32_t trans = pspr->GetTranslation() != 0 ? pspr->GetTranslation() : 0;
if ((pspr->Flags & PSPF_PLAYERTRANSLATED)) trans = owner->Translation;
uint32_t trans = pspr->GetTranslation().index();
if ((pspr->Flags & PSPF_PLAYERTRANSLATED)) trans = owner->Translation.index();
vis.Translation = trans;
// If flip is used, provided that it's not already flipped (that would just invert itself)

View file

@ -173,7 +173,7 @@ namespace swrenderer
vis->RenderStyle = LegacyRenderStyles[STYLE_Normal];
}
vis->FillColor = thing->fillcolor;
vis->Translation = thing->Translation; // [RH] thing translation table
vis->Translation = thing->Translation.index(); // [RH] thing translation table
vis->FakeFlatStat = fakeside;
vis->Alpha = float(thing->Alpha);
vis->fakefloor = fakefloor;

View file

@ -157,7 +157,7 @@ namespace swrenderer
vis->renderflags |= RF_FULLBRIGHT; // kg3D
vis->RenderStyle = thing->RenderStyle;
vis->FillColor = thing->fillcolor;
vis->Translation = thing->Translation; // [RH] thing translation table
vis->Translation = thing->Translation.index(); // [RH] thing translation table
vis->FakeFlatStat = fakeside;
vis->Alpha = float(thing->Alpha);
vis->fakefloor = fakefloor;

View file

@ -128,7 +128,7 @@ namespace swrenderer
if (thing->flags5 & MF5_BRIGHT) vis->renderflags |= RF_FULLBRIGHT; // kg3D
vis->RenderStyle = thing->RenderStyle;
vis->FillColor = thing->fillcolor;
vis->Translation = thing->Translation;
vis->Translation = thing->Translation.index();
vis->FakeFlatStat = WaterFakeSide::Center;
vis->Alpha = float(thing->Alpha);
vis->fakefloor = NULL;

View file

@ -747,8 +747,8 @@ DEFINE_PROPERTY(translation, L, Actor)
for(int i = 1; i < PROP_PARM_COUNT; i++)
{
PROP_STRING_PARM(str, i);
int tnum;
if (i== 1 && PROP_PARM_COUNT == 2 && (tnum = R_FindCustomTranslation(str)) != -1)
FTranslationID tnum;
if (i== 1 && PROP_PARM_COUNT == 2 && (tnum = R_FindCustomTranslation(str)) != INVALID_TRANSLATION)
{
defaults->Translation = tnum;
return;
@ -789,7 +789,7 @@ DEFINE_PROPERTY(bloodcolor, C, Actor)
defaults->BloodColor = color;
defaults->BloodColor.a = 255; // a should not be 0.
defaults->BloodTranslation = TRANSLATION(TRANSLATION_Blood, CreateBloodTranslation(color));
defaults->BloodTranslation = CreateBloodTranslation(color);
}
//==========================================================================