* Updated to ZDoom r3850:

- Fixed: side_t::SetTextureYScale() did not allow negative scales, even though they are perfectly valid for flipping a texture vertically. [OpenGL renderer did not have this problem.]
- Fixed: PrepWall() and PrepLWall() did not understand negative walxrepeats, which should cause
  them to flip the texture horizontally. [OpenGL renderer did not have this problem.]
- Changed the gamma slider in the menu to bottom out at 0.75 instead of 1.0 and to move in increments of 0.05 instead of 0.1. [Including in GZDoom's menudef.z.]
- Added support for random state durations.
- Added the mapinfo flag ForgetState.

git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1448 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
gez 2012-08-25 14:19:08 +00:00
parent d135217b18
commit cb32eb5e28
13 changed files with 84 additions and 21 deletions

View file

@ -1353,7 +1353,7 @@ static int PatchFrame (int frameNum)
if (keylen == 8 && stricmp (Line1, "Duration") == 0) if (keylen == 8 && stricmp (Line1, "Duration") == 0)
{ {
tics = clamp (val, -1, 65534); tics = clamp (val, -1, SHRT_MAX);
} }
else if (keylen == 9 && stricmp (Line1, "Unknown 1") == 0) else if (keylen == 9 && stricmp (Line1, "Unknown 1") == 0)
{ {

View file

@ -737,7 +737,14 @@ void G_DoCompleted (void)
if (mode == FINISH_SameHub) if (mode == FINISH_SameHub)
{ // Remember the level's state for re-entry. { // Remember the level's state for re-entry.
G_SnapshotLevel (); if (!(level.flags2 & LEVEL2_FORGETSTATE))
{
G_SnapshotLevel ();
}
else
{ // Make sure we don't have a snapshot lying around from before.
level.info->ClearSnapshot();
}
} }
else else
{ // Forget the states of all existing levels. { // Forget the states of all existing levels.

View file

@ -213,6 +213,7 @@ enum ELevelFlags
LEVEL2_NOSTATISTICS = 0x10000000, // This level should not have statistics collected LEVEL2_NOSTATISTICS = 0x10000000, // This level should not have statistics collected
LEVEL2_ENDGAME = 0x20000000, // This is an epilogue level that cannot be quit. LEVEL2_ENDGAME = 0x20000000, // This is an epilogue level that cannot be quit.
LEVEL2_NOAUTOSAVEHINT = 0x40000000, // tell the game that an autosave for this level does not need to be kept LEVEL2_NOAUTOSAVEHINT = 0x40000000, // tell the game that an autosave for this level does not need to be kept
LEVEL2_FORGETSTATE = 0x80000000, // forget this map's state in a hub
}; };

View file

@ -1264,6 +1264,8 @@ MapFlagHandlers[] =
{ "endofgame", MITYPE_SETFLAG2, LEVEL2_ENDGAME, 0 }, { "endofgame", MITYPE_SETFLAG2, LEVEL2_ENDGAME, 0 },
{ "nostatistics", MITYPE_SETFLAG2, LEVEL2_NOSTATISTICS, 0 }, { "nostatistics", MITYPE_SETFLAG2, LEVEL2_NOSTATISTICS, 0 },
{ "noautosavehint", MITYPE_SETFLAG2, LEVEL2_NOAUTOSAVEHINT, 0 }, { "noautosavehint", MITYPE_SETFLAG2, LEVEL2_NOAUTOSAVEHINT, 0 },
{ "forgetstate", MITYPE_SETFLAG2, LEVEL2_FORGETSTATE, 0 },
{ "rememberstate", MITYPE_CLRFLAG2, LEVEL2_FORGETSTATE, 0 },
{ "unfreezesingleplayerconversations",MITYPE_SETFLAG2, LEVEL2_CONV_SINGLE_UNFREEZE, 0 }, { "unfreezesingleplayerconversations",MITYPE_SETFLAG2, LEVEL2_CONV_SINGLE_UNFREEZE, 0 },
{ "nobotnodes", MITYPE_IGNORE, 0, 0 }, // Skulltag option: nobotnodes { "nobotnodes", MITYPE_IGNORE, 0, 0 }, // Skulltag option: nobotnodes
{ "compat_shorttex", MITYPE_COMPATFLAG, COMPATF_SHORTTEX, 0 }, { "compat_shorttex", MITYPE_COMPATFLAG, COMPATF_SHORTTEX, 0 },

View file

@ -55,6 +55,8 @@ extern void LoadActors ();
extern void InitBotStuff(); extern void InitBotStuff();
extern void ClearStrifeTypes(); extern void ClearStrifeTypes();
FRandom FState::pr_statetics;
//========================================================================== //==========================================================================
// //
// //

View file

@ -45,6 +45,7 @@
#include "doomdef.h" #include "doomdef.h"
#include "m_fixed.h" #include "m_fixed.h"
#include "m_random.h"
struct Baggage; struct Baggage;
class FScanner; class FScanner;
@ -61,18 +62,19 @@ enum
struct FState struct FState
{ {
FState *NextState;
actionf_p ActionFunc;
WORD sprite; WORD sprite;
SWORD Tics; SWORD Tics;
int Misc1; // Was changed to SBYTE, reverted to long for MBF compat WORD TicRange;
int Misc2; // Was changed to BYTE, reverted to long for MBF compat
BYTE Frame; BYTE Frame;
BYTE DefineFlags; // Unused byte so let's use it during state creation. BYTE DefineFlags; // Unused byte so let's use it during state creation.
int Misc1; // Was changed to SBYTE, reverted to long for MBF compat
int Misc2; // Was changed to BYTE, reverted to long for MBF compat
short Light; short Light;
BYTE Fullbright:1; // State is fullbright BYTE Fullbright:1; // State is fullbright
BYTE SameFrame:1; // Ignore Frame (except when spawning actor) BYTE SameFrame:1; // Ignore Frame (except when spawning actor)
BYTE Fast:1; BYTE Fast:1;
FState *NextState;
actionf_p ActionFunc;
int ParameterIndex; int ParameterIndex;
inline int GetFrame() const inline int GetFrame() const
@ -89,7 +91,11 @@ struct FState
} }
inline int GetTics() const inline int GetTics() const
{ {
return Tics; if (TicRange == 0)
{
return Tics;
}
return Tics + pr_statetics.GenRand32() % (TicRange + 1);
} }
inline int GetMisc1() const inline int GetMisc1() const
{ {
@ -134,6 +140,7 @@ struct FState
} }
static const PClass *StaticFindStateOwner (const FState *state); static const PClass *StaticFindStateOwner (const FState *state);
static const PClass *StaticFindStateOwner (const FState *state, const FActorInfo *info); static const PClass *StaticFindStateOwner (const FState *state, const FActorInfo *info);
static FRandom pr_statetics;
}; };
struct FStateLabels; struct FStateLabels;

View file

@ -903,11 +903,11 @@ struct side_t
void SetTextureXScale(int which, fixed_t scale) void SetTextureXScale(int which, fixed_t scale)
{ {
textures[which].xscale = scale <= 0? FRACUNIT : scale; textures[which].xscale = scale == 0 ? FRACUNIT : scale;
} }
void SetTextureXScale(fixed_t scale) void SetTextureXScale(fixed_t scale)
{ {
textures[top].xscale = textures[mid].xscale = textures[bottom].xscale = scale <= 0? FRACUNIT : scale; textures[top].xscale = textures[mid].xscale = textures[bottom].xscale = scale == 0 ? FRACUNIT : scale;
} }
fixed_t GetTextureXScale(int which) const fixed_t GetTextureXScale(int which) const
{ {
@ -921,11 +921,11 @@ struct side_t
void SetTextureYScale(int which, fixed_t scale) void SetTextureYScale(int which, fixed_t scale)
{ {
textures[which].yscale = scale <= 0? FRACUNIT : scale; textures[which].yscale = scale == 0 ? FRACUNIT : scale;
} }
void SetTextureYScale(fixed_t scale) void SetTextureYScale(fixed_t scale)
{ {
textures[top].yscale = textures[mid].yscale = textures[bottom].yscale = scale <= 0? FRACUNIT : scale; textures[top].yscale = textures[mid].yscale = textures[bottom].yscale = scale == 0 ? FRACUNIT : scale;
} }
fixed_t GetTextureYScale(int which) const fixed_t GetTextureYScale(int which) const
{ {

View file

@ -2769,6 +2769,7 @@ int WallMost (short *mostbuf, const secplane_t &plane)
static void PrepWallRoundFix(fixed_t *lwall, fixed_t walxrepeat) static void PrepWallRoundFix(fixed_t *lwall, fixed_t walxrepeat)
{ {
// fix for rounding errors // fix for rounding errors
walxrepeat = abs(walxrepeat);
fixed_t fix = (MirrorFlags & RF_XFLIP) ? walxrepeat-1 : 0; fixed_t fix = (MirrorFlags & RF_XFLIP) ? walxrepeat-1 : 0;
int x; int x;
@ -2803,7 +2804,7 @@ static void PrepWallRoundFix(fixed_t *lwall, fixed_t walxrepeat)
void PrepWall (fixed_t *swall, fixed_t *lwall, fixed_t walxrepeat) void PrepWall (fixed_t *swall, fixed_t *lwall, fixed_t walxrepeat)
{ // swall = scale, lwall = texturecolumn { // swall = scale, lwall = texturecolumn
double top, bot, i; double top, bot, i;
double xrepeat = walxrepeat; double xrepeat = fabs((double)walxrepeat);
i = WallSX1 - centerx; i = WallSX1 - centerx;
top = WallUoverZorg + WallUoverZstep * i; top = WallUoverZorg + WallUoverZstep * i;
@ -2812,7 +2813,14 @@ void PrepWall (fixed_t *swall, fixed_t *lwall, fixed_t walxrepeat)
for (int x = WallSX1; x < WallSX2; x++) for (int x = WallSX1; x < WallSX2; x++)
{ {
double frac = top / bot; double frac = top / bot;
lwall[x] = xs_RoundToInt(frac * xrepeat); if (walxrepeat < 0)
{
lwall[x] = xs_RoundToInt(xrepeat - frac * xrepeat);
}
else
{
lwall[x] = xs_RoundToInt(frac * xrepeat);
}
swall[x] = xs_RoundToInt(frac * WallDepthScale + WallDepthOrg); swall[x] = xs_RoundToInt(frac * WallDepthScale + WallDepthOrg);
top += WallUoverZstep; top += WallUoverZstep;
bot += WallInvZstep; bot += WallInvZstep;
@ -2823,7 +2831,7 @@ void PrepWall (fixed_t *swall, fixed_t *lwall, fixed_t walxrepeat)
void PrepLWall (fixed_t *lwall, fixed_t walxrepeat) void PrepLWall (fixed_t *lwall, fixed_t walxrepeat)
{ // lwall = texturecolumn { // lwall = texturecolumn
double top, bot, i; double top, bot, i;
double xrepeat = walxrepeat; double xrepeat = fabs((double)walxrepeat);
double topstep; double topstep;
i = WallSX1 - centerx; i = WallSX1 - centerx;
@ -2835,7 +2843,14 @@ void PrepLWall (fixed_t *lwall, fixed_t walxrepeat)
for (int x = WallSX1; x < WallSX2; x++) for (int x = WallSX1; x < WallSX2; x++)
{ {
lwall[x] = xs_RoundToInt(top / bot); if (walxrepeat < 0)
{
lwall[x] = xs_RoundToInt(xrepeat - top / bot);
}
else
{
lwall[x] = xs_RoundToInt(top / bot);
}
top += topstep; top += topstep;
bot += WallInvZstep; bot += WallInvZstep;
} }

View file

@ -3,5 +3,5 @@
// This file was automatically generated by the // This file was automatically generated by the
// updaterevision tool. Do not edit by hand. // updaterevision tool. Do not edit by hand.
#define ZD_SVN_REVISION_STRING "3845" #define ZD_SVN_REVISION_STRING "3851"
#define ZD_SVN_REVISION_NUMBER 3845 #define ZD_SVN_REVISION_NUMBER 3851

View file

@ -199,6 +199,7 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def)
if (info->NumOwnedStates == 1) if (info->NumOwnedStates == 1)
{ {
info->OwnedStates->Tics = -1; info->OwnedStates->Tics = -1;
info->OwnedStates->TicRange = 0;
info->OwnedStates->Misc1 = 0; info->OwnedStates->Misc1 = 0;
} }
else else
@ -226,6 +227,7 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def)
else else
{ {
info->OwnedStates[i].Tics = -1; info->OwnedStates[i].Tics = -1;
info->OwnedStates[i].TicRange = 0;
info->OwnedStates[i].Misc1 = 0; info->OwnedStates[i].Misc1 = 0;
} }
@ -273,6 +275,7 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def)
else else
{ {
info->OwnedStates[i].Tics = -1; info->OwnedStates[i].Tics = -1;
info->OwnedStates[i].TicRange = 0;
info->OwnedStates[i].Misc1 = 0; info->OwnedStates[i].Misc1 = 0;
} }
@ -307,12 +310,14 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def)
} }
info->OwnedStates[i].NextState = &info->OwnedStates[info->NumOwnedStates-1]; info->OwnedStates[i].NextState = &info->OwnedStates[info->NumOwnedStates-1];
info->OwnedStates[i].Tics = 5; info->OwnedStates[i].Tics = 5;
info->OwnedStates[i].TicRange = 0;
info->OwnedStates[i].Misc1 = 0; info->OwnedStates[i].Misc1 = 0;
info->OwnedStates[i].SetAction(FindGlobalActionFunction("A_FreezeDeath")); info->OwnedStates[i].SetAction(FindGlobalActionFunction("A_FreezeDeath"));
i = info->NumOwnedStates - 1; i = info->NumOwnedStates - 1;
info->OwnedStates[i].NextState = &info->OwnedStates[i]; info->OwnedStates[i].NextState = &info->OwnedStates[i];
info->OwnedStates[i].Tics = 1; info->OwnedStates[i].Tics = 1;
info->OwnedStates[i].TicRange = 0;
info->OwnedStates[i].Misc1 = 0; info->OwnedStates[i].Misc1 = 0;
info->OwnedStates[i].SetAction(FindGlobalActionFunction("A_FreezeDeathChunks")); info->OwnedStates[i].SetAction(FindGlobalActionFunction("A_FreezeDeathChunks"));
bag.statedef.SetStateLabel("Ice", &info->OwnedStates[extra.IceDeathStart]); bag.statedef.SetStateLabel("Ice", &info->OwnedStates[extra.IceDeathStart]);
@ -671,6 +676,7 @@ static void ParseSpriteFrames (FActorInfo *info, TArray<FState> &states, FScanne
} }
state.Tics = rate; state.Tics = rate;
state.TicRange = 0;
while (*token) while (*token)
{ {

View file

@ -56,6 +56,7 @@
#include "colormatcher.h" #include "colormatcher.h"
#include "thingdef_exp.h" #include "thingdef_exp.h"
#include "version.h" #include "version.h"
#include "templates.h"
//========================================================================== //==========================================================================
//*** //***
@ -237,8 +238,30 @@ do_stop:
sc.MustGetString(); sc.MustGetString();
statestring = sc.String; statestring = sc.String;
sc.MustGetNumber(); if (sc.CheckString("RANDOM"))
state.Tics = clamp<int>(sc.Number, -1, 32767); {
int min, max;
sc.MustGetStringName("(");
sc.MustGetNumber();
min = clamp<int>(sc.Number, -1, SHRT_MAX);
sc.MustGetStringName(",");
sc.MustGetNumber();
max = clamp<int>(sc.Number, -1, SHRT_MAX);
sc.MustGetStringName(")");
if (min > max)
{
swapvalues(min, max);
}
state.Tics = min;
state.TicRange = max - min;
}
else
{
sc.MustGetNumber();
state.Tics = clamp<int>(sc.Number, -1, SHRT_MAX);
state.TicRange = 0;
}
while (sc.GetString() && !sc.Crossed) while (sc.GetString() && !sc.Crossed)
{ {

View file

@ -651,7 +651,7 @@ OptionMenu "VideoOptions"
Submenu "Scoreboard Options", "ScoreboardOptions" Submenu "Scoreboard Options", "ScoreboardOptions"
StaticText " " StaticText " "
Slider "Screen size", "screenblocks", 3.0, 12.0, 1.0, 0 Slider "Screen size", "screenblocks", 3.0, 12.0, 1.0, 0
Slider "Brightness", "Gamma", 1.0, 3.0, 0.1 Slider "Brightness", "Gamma", 0.75, 3.0, 0.05, 2
Option "Vertical Sync", "vid_vsync", "OnOff" Option "Vertical Sync", "vid_vsync", "OnOff"
Option "Column render mode", "r_columnmethod", "ColumnMethods" Option "Column render mode", "r_columnmethod", "ColumnMethods"

View file

@ -214,7 +214,7 @@ OptionMenu "VideoOptions"
StaticText " " StaticText " "
Slider "Screen size", "screenblocks", 3.0, 12.0, 1.0, 0 Slider "Screen size", "screenblocks", 3.0, 12.0, 1.0, 0
Slider "Gamma correction", "Gamma", 1.0, 3.0, 0.1 Slider "Gamma correction", "Gamma", 0.75, 3.0, 0.05, 2
Slider "Brightness", "vid_brightness", -0.8,0.8, 0.05 Slider "Brightness", "vid_brightness", -0.8,0.8, 0.05
Slider "Contrast", "vid_contrast", 0.1, 3.0, 0.1 Slider "Contrast", "vid_contrast", 0.1, 3.0, 0.1