- Fixed: ACS used incompatible values for APROP_RenderStyle. It needs to use

the exact same values as previous ZDoom versions
- Added a DECORATE 'stencilcolor' property so that the stencil render style
  can be used.
- Added some NULL pointer checks to the font loading code.

SVN r713 (trunk)
This commit is contained in:
Christoph Oelckers 2008-01-26 15:50:52 +00:00
parent 9706a2b140
commit d134deda95
6 changed files with 126 additions and 39 deletions

View file

@ -1,3 +1,10 @@
January 26, 2008 (Changes by Graf Zahl)
- Fixed: ACS used incompatible values for APROP_RenderStyle. It needs to use
the exact same values as previous ZDoom versions
- Added a DECORATE 'stencilcolor' property so that the stencil render style
can be used.
- Added some NULL pointer checks to the font loading code.
January 25, 2008 January 25, 2008
- Undid some of the changes from lempar.c v1.30->v1.31, because it broke - Undid some of the changes from lempar.c v1.30->v1.31, because it broke
error handling. error handling.

View file

@ -2152,6 +2152,22 @@ void DLevelScript::DoSetFont (int fontnum)
#define APROP_DeathSound 8 #define APROP_DeathSound 8
#define APROP_ActiveSound 9 #define APROP_ActiveSound 9
// These are needed for ACS's APROP_RenderStyle
static const int LegacyRenderStyleIndices[] =
{
0, // STYLE_None,
1, // STYLE_Normal,
2, // STYLE_Fuzzy,
3, // STYLE_SoulTrans,
4, // STYLE_OptFuzzy,
5, // STYLE_Stencil,
64, // STYLE_Translucent
65, // STYLE_Add,
66, // STYLE_Shaded,
67, // STYLE_TranslucentStencil,
-1
};
void DLevelScript::SetActorProperty (int tid, int property, int value) void DLevelScript::SetActorProperty (int tid, int property, int value)
{ {
if (tid == 0) if (tid == 0)
@ -2199,7 +2215,14 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
break; break;
case APROP_RenderStyle: case APROP_RenderStyle:
actor->RenderStyle = ERenderStyle(value); for(int i=0; LegacyRenderStyleIndices[i] >= 0; i++)
{
if (LegacyRenderStyleIndices[i] == value)
{
actor->RenderStyle = ERenderStyle(i);
break;
}
}
break; break;
case APROP_Ambush: case APROP_Ambush:
@ -2293,7 +2316,7 @@ int DLevelScript::GetActorProperty (int tid, int property)
{ // Check for a legacy render style that matches. { // Check for a legacy render style that matches.
if (LegacyRenderStyles[style] == actor->RenderStyle) if (LegacyRenderStyles[style] == actor->RenderStyle)
{ {
return style; return LegacyRenderStyleIndices[style];
} }
} }
// The current render style isn't expressable as a legacy style, // The current render style isn't expressable as a legacy style,

View file

@ -1,3 +1,6 @@
#ifndef __R_BLEND_H
#define __R_BLEND_H
/* /*
** r_blend.h ** r_blend.h
** Constants and types for specifying texture blending. ** Constants and types for specifying texture blending.
@ -116,7 +119,7 @@ union FRenderStyle
inline FRenderStyle &operator= (ERenderStyle legacy); inline FRenderStyle &operator= (ERenderStyle legacy);
operator DWORD() const { return AsDWORD; } operator DWORD() const { return AsDWORD; }
bool operator==(const FRenderStyle &o) const { return AsDWORD == o.AsDWORD; } bool operator==(const FRenderStyle &o) const { return AsDWORD == o.AsDWORD; }
void CheckFuzz();
bool IsVisible(fixed_t alpha) const throw(); bool IsVisible(fixed_t alpha) const throw();
private: private:
// Code that compares an actor's render style with a legacy render // Code that compares an actor's render style with a legacy render
@ -142,3 +145,5 @@ inline FArchive &operator<< (FArchive &arc, FRenderStyle &style)
arc << style.BlendOp << style.SrcAlpha << style.DestAlpha << style.Flags; arc << style.BlendOp << style.SrcAlpha << style.DestAlpha << style.Flags;
return arc; return arc;
} }
#endif

View file

@ -2223,18 +2223,7 @@ ESPSResult R_SetPatchStyle (FRenderStyle style, fixed_t alpha, int translation,
{ {
fixed_t fglevel, bglevel; fixed_t fglevel, bglevel;
if (style.BlendOp == STYLEOP_FuzzOrAdd) style.CheckFuzz();
{
style.BlendOp = (r_drawfuzz || !r_drawtrans) ? STYLEOP_Fuzz : STYLEOP_Add;
}
else if (style.BlendOp == STYLEOP_FuzzOrSub)
{
style.BlendOp = (r_drawfuzz || !r_drawtrans) ? STYLEOP_Fuzz : STYLEOP_Sub;
}
else if (style.BlendOp == STYLEOP_FuzzOrRevSub)
{
style.BlendOp = (r_drawfuzz || !r_drawtrans) ? STYLEOP_Fuzz : STYLEOP_RevSub;
}
if (style.Flags & STYLEF_TransSoulsAlpha) if (style.Flags & STYLEF_TransSoulsAlpha)
{ {
@ -2376,3 +2365,28 @@ bool FRenderStyle::IsVisible(fixed_t alpha) const throw()
// Treat anything else as visible. // Treat anything else as visible.
return true; return true;
} }
//==========================================================================
//
// FRenderStyle :: CheckFuzz
//
// Adjusts settings based on r_drawfuzz CVAR
//
//==========================================================================
void FRenderStyle::CheckFuzz()
{
if (BlendOp == STYLEOP_FuzzOrAdd)
{
BlendOp = (r_drawfuzz || !r_drawtrans) ? STYLEOP_Fuzz : STYLEOP_Add;
}
else if (BlendOp == STYLEOP_FuzzOrSub)
{
BlendOp = (r_drawfuzz || !r_drawtrans) ? STYLEOP_Fuzz : STYLEOP_Sub;
}
else if (BlendOp == STYLEOP_FuzzOrRevSub)
{
BlendOp = (r_drawfuzz || !r_drawtrans) ? STYLEOP_Fuzz : STYLEOP_RevSub;
}
}

View file

@ -1216,7 +1216,7 @@ static void ActorRenderStyle (FScanner &sc, AActor *defaults, Baggage &bag)
static const int renderstyle_values[]={ static const int renderstyle_values[]={
STYLE_None, STYLE_Normal, STYLE_Fuzzy, STYLE_SoulTrans, STYLE_OptFuzzy, STYLE_None, STYLE_Normal, STYLE_Fuzzy, STYLE_SoulTrans, STYLE_OptFuzzy,
STYLE_Stencil, STYLE_Translucent, STYLE_Add}; STYLE_TranslucentStencil, STYLE_Translucent, STYLE_Add};
sc.MustGetString(); sc.MustGetString();
defaults->RenderStyle = LegacyRenderStyles[renderstyle_values[sc.MustMatchString(renderstyles)]]; defaults->RenderStyle = LegacyRenderStyles[renderstyle_values[sc.MustMatchString(renderstyles)]];
@ -1395,6 +1395,36 @@ static void ActorTranslation (FScanner &sc, AActor *defaults, Baggage &bag)
} }
} }
//==========================================================================
//
//==========================================================================
static void ActorStencilColor (FScanner &sc,AActor *defaults, Baggage &bag)
{
int r,g,b;
if (sc.CheckNumber())
{
sc.MustGetNumber();
r=clamp<int>(sc.Number, 0, 255);
sc.CheckString(",");
sc.MustGetNumber();
g=clamp<int>(sc.Number, 0, 255);
sc.CheckString(",");
sc.MustGetNumber();
b=clamp<int>(sc.Number, 0, 255);
}
else
{
sc.MustGetString();
int c = V_GetColor(NULL, sc.String);
r=RPART(c);
g=GPART(c);
b=BPART(c);
}
defaults->fillcolor = MAKERGB(r,g,b);
}
//========================================================================== //==========================================================================
// //
//========================================================================== //==========================================================================
@ -2501,6 +2531,7 @@ static const ActorProps props[] =
{ "spawnid", ActorSpawnID, RUNTIME_CLASS(AActor) }, { "spawnid", ActorSpawnID, RUNTIME_CLASS(AActor) },
{ "speed", ActorSpeed, RUNTIME_CLASS(AActor) }, { "speed", ActorSpeed, RUNTIME_CLASS(AActor) },
{ "states", ActorStates, RUNTIME_CLASS(AActor) }, { "states", ActorStates, RUNTIME_CLASS(AActor) },
{ "stencilcolor", ActorStencilColor, RUNTIME_CLASS(AActor) },
{ "tag", ActorTag, RUNTIME_CLASS(AActor) }, { "tag", ActorTag, RUNTIME_CLASS(AActor) },
{ "translation", ActorTranslation, RUNTIME_CLASS(AActor) }, { "translation", ActorTranslation, RUNTIME_CLASS(AActor) },
{ "vspeed", ActorVSpeed, RUNTIME_CLASS(AActor) }, { "vspeed", ActorVSpeed, RUNTIME_CLASS(AActor) },

View file

@ -335,19 +335,22 @@ FFont::FFont (const char *name, const char *nametemplate, int first, int count,
if (lump >= 0) if (lump >= 0)
{ {
FTexture *pic = TexMan[TexMan.AddPatch (buffer)]; FTexture *pic = TexMan[TexMan.AddPatch (buffer)];
int height = pic->GetScaledHeight(); if (pic != NULL)
int yoffs = pic->GetScaledTopOffset(); {
int height = pic->GetScaledHeight();
int yoffs = pic->GetScaledTopOffset();
if (yoffs > maxyoffs) if (yoffs > maxyoffs)
{ {
maxyoffs = yoffs; maxyoffs = yoffs;
}
height += abs (yoffs);
if (height > FontHeight)
{
FontHeight = height;
}
RecordTextureColors (pic, usedcolors);
} }
height += abs (yoffs);
if (height > FontHeight)
{
FontHeight = height;
}
RecordTextureColors (pic, usedcolors);
} }
} }
@ -1478,21 +1481,25 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, int *lumplis
if (lump >= 0) if (lump >= 0)
{ {
Wads.GetLumpName(buffer, lump); Wads.GetLumpName(buffer, lump);
buffer[8]=0;
FTexture *pic = TexMan[TexMan.AddPatch (buffer)]; FTexture *pic = TexMan[TexMan.AddPatch (buffer)];
int height = pic->GetScaledHeight(); if (pic != NULL)
int yoffs = pic->GetScaledTopOffset();
if (yoffs > maxyoffs)
{ {
maxyoffs = yoffs; int height = pic->GetScaledHeight();
} int yoffs = pic->GetScaledTopOffset();
height += abs (yoffs);
if (height > FontHeight)
{
FontHeight = height;
}
RecordTextureColors (pic, usedcolors); if (yoffs > maxyoffs)
{
maxyoffs = yoffs;
}
height += abs (yoffs);
if (height > FontHeight)
{
FontHeight = height;
}
RecordTextureColors (pic, usedcolors);
}
} }
} }