- Modified the way autosaves are done. Instead of setting gameaction to

ga_autosave, write DEM_CHECKAUTOSAVE to the net stream. When this is
  processed, it will check if it's okay to do an autosave. If it is, it writes
  DEM_DOAUTOSAVE to the net stream, which the sets gameaction to ga_autosave.
  Essentially, about half of the functionality was moved out of G_DoAutoSave()
  and into Net_DoCommand().
- Minor changes to OS detection: The os_WinNT enumeration has been renamed to
  os_WinNT4, since every new OS coming out of Microsoft these days is
  essentially NT. NT 5.2 and 6.0 are now properly identified as "Windows
  Server 2003" and "Windows Vista" respectively, and any unknown NT versions
  Microsoft introduces in the future will now be displayed as "Windows NT"
  instead of "Windows 2000" if the minor version is 0 and "Windows XP" if the
  minor version is non-0. Win32s detection has also been removed. Presumably
  if somebody is foolish enough to try to run this on Windows 3.x with Win32s,
  it won't even load due to missing DLLs.
- Fixed: Demos with NETD chunks should not set netgame to true unless they
  have more than one player. And since netdemo is ignored if netgame is
  false, it doesn't need to set that either.
- Fixed: FTexture::GetScaled* functions did not check for scale values of 0.


SVN r354 (trunk)
This commit is contained in:
Randy Heit 2006-10-19 20:20:56 +00:00
parent 39d2ef0460
commit 7c1fbe7ee5
13 changed files with 89 additions and 54 deletions

View file

@ -1,3 +1,20 @@
October 19, 2006
- Modified the way autosaves are done. Instead of setting gameaction to
ga_autosave, write DEM_CHECKAUTOSAVE to the net stream. When this is
processed, it will check if it's okay to do an autosave. If it is, it writes
DEM_DOAUTOSAVE to the net stream, which the sets gameaction to ga_autosave.
Essentially, about half of the functionality was moved out of G_DoAutoSave()
and into Net_DoCommand().
- Minor changes to OS detection: The os_WinNT enumeration has been renamed to
os_WinNT4, since every new OS coming out of Microsoft these days is
essentially NT. NT 5.2 and 6.0 are now properly identified as "Windows
Server 2003" and "Windows Vista" respectively, and any unknown NT versions
Microsoft introduces in the future will now be displayed as "Windows NT"
instead of "Windows 2000" if the minor version is 0 and "Windows XP" if the
minor version is non-0. Win32s detection has also been removed. Presumably
if somebody is foolish enough to try to run this on Windows 3.x with Win32s,
it won't even load due to missing DLLs.
October 15, 2006 (Changes by Graf Zahl) October 15, 2006 (Changes by Graf Zahl)
- Changed the rocket so that the FX_ROCKET flag is set in the actor - Changed the rocket so that the FX_ROCKET flag is set in the actor
definition and not in BeginPlay. definition and not in BeginPlay.
@ -5,6 +22,12 @@ October 15, 2006 (Changes by Graf Zahl)
(MF5_DEHEXPLOSION) so that its effects can be used on other actors (MF5_DEHEXPLOSION) so that its effects can be used on other actors
as well without having to inherit from the rocket. as well without having to inherit from the rocket.
October 9, 2006
- Fixed: Demos with NETD chunks should not set netgame to true unless they
have more than one player. And since netdemo is ignored if netgame is
false, it doesn't need to set that either.
- Fixed: FTexture::GetScaled* functions did not check for scale values of 0.
October 7, 2006 (Changes by Graf Zahl) October 7, 2006 (Changes by Graf Zahl)
- Fixed: PrintAlias passed FString objects directly to Printf. - Fixed: PrintAlias passed FString objects directly to Printf.
- Added bitwise not (~) operator to ACS. - Added bitwise not (~) operator to ACS.

View file

@ -55,6 +55,9 @@
int P_StartScript (AActor *who, line_t *where, int script, char *map, bool backSide, int P_StartScript (AActor *who, line_t *where, int script, char *map, bool backSide,
int arg0, int arg1, int arg2, int always, bool wantResultCode, bool net); int arg0, int arg1, int arg2, int always, bool wantResultCode, bool net);
EXTERN_CVAR (Int, disableautosave)
EXTERN_CVAR (Int, autosavecount)
//#define SIMULATEERRORS (RAND_MAX/3) //#define SIMULATEERRORS (RAND_MAX/3)
#define SIMULATEERRORS 0 #define SIMULATEERRORS 0
@ -2220,6 +2223,25 @@ void Net_DoCommand (int type, BYTE **stream, int player)
gameaction = ga_savegame; gameaction = ga_savegame;
break; break;
case DEM_CHECKAUTOSAVE:
// Do not autosave in multiplayer games or when dead.
// For demo playback, DEM_DOAUTOSAVE already exists in the demo if the
// autosave happened. And if it doesn't, we must not generate it.
if (multiplayer ||
demoplayback ||
players[consoleplayer].playerstate != PST_LIVE ||
disableautosave >= 2 ||
autosavecount == 0)
{
break;
}
Net_WriteByte (DEM_DOAUTOSAVE);
break;
case DEM_DOAUTOSAVE:
gameaction = ga_autosave;
break;
case DEM_FOV: case DEM_FOV:
{ {
float newfov = (float)ReadByte (stream); float newfov = (float)ReadByte (stream);

View file

@ -139,7 +139,9 @@ enum EDemoCommand
DEM_SUMMONFRIEND, // 37 String: Thing to fabricate DEM_SUMMONFRIEND, // 37 String: Thing to fabricate
DEM_SPRAY, // 38 String: The decal to spray DEM_SPRAY, // 38 String: The decal to spray
DEM_CROUCH, // 39 DEM_CROUCH, // 39
DEM_RUNSCRIPT2 // 40 Same as DEM_RUNSCRIPT, but always executes DEM_RUNSCRIPT2, // 40 Same as DEM_RUNSCRIPT, but always executes
DEM_CHECKAUTOSAVE, // 41 Check if the user has autosaves enabled. Ignored for demoplayback.
DEM_DOAUTOSAVE, // 42 An autosave should be made
}; };
// The following are implemented by cht_DoCheat in m_cheat.cpp // The following are implemented by cht_DoCheat in m_cheat.cpp

View file

@ -97,7 +97,7 @@ void G_DoCompleted (void);
void G_DoVictory (void); void G_DoVictory (void);
void G_DoWorldDone (void); void G_DoWorldDone (void);
void G_DoSaveGame (bool okForQuicksave); void G_DoSaveGame (bool okForQuicksave);
void G_DoAutoSave (void); void G_DoAutoSave ();
FIntCVar gameskill ("skill", 2, CVAR_SERVERINFO|CVAR_LATCH); FIntCVar gameskill ("skill", 2, CVAR_SERVERINFO|CVAR_LATCH);
CVAR (Int, deathmatch, 0, CVAR_SERVERINFO|CVAR_LATCH); CVAR (Int, deathmatch, 0, CVAR_SERVERINFO|CVAR_LATCH);
@ -1700,7 +1700,9 @@ void G_DoLoadGame ()
// load a base level // load a base level
savegamerestore = true; // Use the player actors in the savegame savegamerestore = true; // Use the player actors in the savegame
bool demoplaybacksave = demoplayback;
G_InitNew (map, false); G_InitNew (map, false);
demoplayback = demoplaybacksave;
delete[] map; delete[] map;
savegamerestore = false; savegamerestore = false;
@ -1802,22 +1804,12 @@ extern void P_CalcHeight (player_t *);
void G_DoAutoSave () void G_DoAutoSave ()
{ {
// Do not autosave in multiplayer games or demos or when dead
if (multiplayer ||
demoplayback ||
players[consoleplayer].playerstate != PST_LIVE ||
disableautosave >= 2 ||
autosavecount == 0)
{
gameaction = ga_nothing;
return;
}
// Keep up to four autosaves at a time // Keep up to four autosaves at a time
UCVarValue num; UCVarValue num;
char *readableTime; char *readableTime;
int count = autosavecount != 0 ? autosavecount : 1;
num.Int = (autosavenum + 1) % autosavecount; num.Int = (autosavenum + 1) % count;
autosavenum.ForceSet (num, CVAR_Int); autosavenum.ForceSet (num, CVAR_Int);
savegamefile = G_BuildSaveName ("auto", num.Int); savegamefile = G_BuildSaveName ("auto", num.Int);
@ -1967,11 +1959,10 @@ void G_DoSaveGame (bool okForQuicksave)
{ {
if (demoplayback) if (demoplayback)
{ {
gameaction = ga_nothing; savegamefile = G_BuildSaveName ("demosave.zds", -1);
return;
} }
insave=true; insave = true;
G_SnapshotLevel (); G_SnapshotLevel ();
FILE *stdfile = fopen (savegamefile.GetChars(), "wb"); FILE *stdfile = fopen (savegamefile.GetChars(), "wb");
@ -2368,7 +2359,7 @@ bool G_ProcessIFFDemo (char *mapname)
break; break;
case NETD_ID: case NETD_ID:
multiplayer = netgame = netdemo = true; multiplayer = true;
break; break;
case BODY_ID: case BODY_ID:

View file

@ -1819,7 +1819,7 @@ IMPLEMENT_CLASS (DAutosaver)
void DAutosaver::Tick () void DAutosaver::Tick ()
{ {
gameaction = ga_autosave; Net_WriteByte (DEM_CHECKAUTOSAVE);
Destroy (); Destroy ();
} }

View file

@ -2470,7 +2470,7 @@ FUNC(LS_Autosave)
{ {
if (gameaction != ga_savegame) if (gameaction != ga_savegame)
{ {
gameaction = ga_autosave; Net_WriteByte (DEM_CHECKAUTOSAVE);
} }
return true; return true;
} }

View file

@ -648,11 +648,11 @@ public:
int GetWidth () { return Width; } int GetWidth () { return Width; }
int GetHeight () { return Height; } int GetHeight () { return Height; }
int GetScaledWidth () { return DivScale3(Width, ScaleX); } int GetScaledWidth () { return ScaleX ? DivScale3(Width, ScaleX) : Width; }
int GetScaledHeight () { return DivScale3(Height, ScaleY); } int GetScaledHeight () { return ScaleY ? DivScale3(Height, ScaleY) : Height; }
int GetScaledLeftOffset () { return DivScale3(LeftOffset, ScaleX); } int GetScaledLeftOffset () { return ScaleX ? DivScale3(LeftOffset, ScaleX) : Width; }
int GetScaledTopOffset () { return DivScale3(TopOffset, ScaleY); } int GetScaledTopOffset () { return ScaleY ? DivScale3(TopOffset, ScaleY) : Height; }
virtual void SetFrontSkyLayer(); virtual void SetFrontSkyLayer();

View file

@ -302,7 +302,7 @@ bool FMODSoundRenderer::Init ()
{ {
// If snd_3d is true, try for a3d output if snd_output was not recognized above. // If snd_3d is true, try for a3d output if snd_output was not recognized above.
// However, if running under NT 4.0, a3d will only be tried if specifically requested. // However, if running under NT 4.0, a3d will only be tried if specifically requested.
outindex = (OSPlatform == os_WinNT) ? 1 : 0; outindex = (OSPlatform == os_WinNT4) ? 1 : 0;
#if 0 #if 0
// FMOD 3.6 no longer supports a3d. Keep this code here in case support comes back. // FMOD 3.6 no longer supports a3d. Keep this code here in case support comes back.
if (stricmp (snd_output, "a3d") == 0 || (outindex == 0 && snd_3d)) if (stricmp (snd_output, "a3d") == 0 || (outindex == 0 && snd_3d))
@ -342,7 +342,7 @@ bool FMODSoundRenderer::Init ()
} }
#ifdef _WIN32 #ifdef _WIN32
if (OSPlatform == os_WinNT) if (OSPlatform == os_WinNT4)
{ {
// If running Windows NT 4, we need to initialize DirectSound before // If running Windows NT 4, we need to initialize DirectSound before
// using WinMM. If we don't, then FSOUND_Close will corrupt a // using WinMM. If we don't, then FSOUND_Close will corrupt a

View file

@ -54,7 +54,7 @@
// Version identifier for network games. // Version identifier for network games.
// Bump it every time you do a release unless you're certain you // Bump it every time you do a release unless you're certain you
// didn't change anything that will affect sync. // didn't change anything that will affect sync.
#define NETGAMEVERSION 209 #define NETGAMEVERSION 210
// Version stored in the ini's [LastRun] section. // Version stored in the ini's [LastRun] section.
// Bump it if you made some configuration change that you want to // Bump it if you made some configuration change that you want to
@ -64,7 +64,7 @@
// Protocol version used in demos. // Protocol version used in demos.
// Bump it if you change existing DEM_ commands or add new ones. // Bump it if you change existing DEM_ commands or add new ones.
// Otherwise, it should be safe to leave it alone. // Otherwise, it should be safe to leave it alone.
#define DEMOGAMEVERSION 0x205 #define DEMOGAMEVERSION 0x206
// Minimum demo version we can play. // Minimum demo version we can play.
// Bump it whenever you change or remove existing DEM_ commands. // Bump it whenever you change or remove existing DEM_ commands.

View file

@ -339,7 +339,7 @@ CUSTOM_CVAR (Int, in_mouse, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{ {
int new_mousemode; int new_mousemode;
if (self == 1 || (self == 0 && OSPlatform == os_WinNT)) if (self == 1 || (self == 0 && OSPlatform == os_WinNT4))
new_mousemode = win32; new_mousemode = win32;
else else
new_mousemode = dinput; new_mousemode = dinput;
@ -1327,7 +1327,7 @@ static BOOL I_GetDIMouse ()
mousemode = win32; // Assume failure mousemode = win32; // Assume failure
UngrabMouse_Win32 (); UngrabMouse_Win32 ();
if (in_mouse == 1 || (in_mouse == 0 && OSPlatform == os_WinNT)) if (in_mouse == 1 || (in_mouse == 0 && OSPlatform == os_WinNT4))
return FALSE; return FALSE;
// Obtain an interface to the system mouse device. // Obtain an interface to the system mouse device.

View file

@ -218,11 +218,6 @@ void I_DetectOS (void)
switch (info.dwPlatformId) switch (info.dwPlatformId)
{ {
case VER_PLATFORM_WIN32s:
OSPlatform = os_Win32s;
osname = "3.x";
break;
case VER_PLATFORM_WIN32_WINDOWS: case VER_PLATFORM_WIN32_WINDOWS:
OSPlatform = os_Win95; OSPlatform = os_Win95;
if (info.dwMinorVersion < 10) if (info.dwMinorVersion < 10)
@ -240,19 +235,27 @@ void I_DetectOS (void)
break; break;
case VER_PLATFORM_WIN32_NT: case VER_PLATFORM_WIN32_NT:
OSPlatform = info.dwMajorVersion < 5 ? os_WinNT : os_Win2k; OSPlatform = info.dwMajorVersion < 5 ? os_WinNT4 : os_Win2k;
if (OSPlatform == os_WinNT)
{
osname = "NT"; osname = "NT";
} if (info.dwMajorVersion == 5)
else if (info.dwMinorVersion == 0) {
if (info.dwMinorVersion == 0)
{ {
osname = "2000"; osname = "2000";
} }
else if (info.dwMinorVersion == 1)
{ {
osname = "XP"; osname = "XP";
} }
else if (info.dwMinorVersion == 2)
{
osname = "Server 2003";
}
}
else if (info.dwMajorVersion == 6 && info.dwMinorVersion == 0)
{
osname = "Vista";
}
break; break;
default: default:
@ -270,12 +273,7 @@ void I_DetectOS (void)
Printf (" %s\n", info.szCSDVersion); Printf (" %s\n", info.szCSDVersion);
} }
if (OSPlatform == os_Win32s) if (OSPlatform == os_unknown)
{
I_FatalError ("Sorry, Win32s is not supported.\n"
"Upgrade to a newer version of Windows.");
}
else if (OSPlatform == os_unknown)
{ {
Printf ("(Assuming Windows 95)\n"); Printf ("(Assuming Windows 95)\n");
OSPlatform = os_Win95; OSPlatform = os_Win95;

View file

@ -44,9 +44,8 @@ void I_DetectOS (void);
typedef enum { typedef enum {
os_unknown, os_unknown,
os_Win95, os_Win95,
os_WinNT, os_WinNT4,
os_Win2k, os_Win2k
os_Win32s
} os_t; } os_t;
extern os_t OSPlatform; extern os_t OSPlatform;

View file

@ -625,7 +625,7 @@ bool DDrawFB::CreateResources ()
} }
LOG3 ("Mode set to %d x %d x %d\n", Width, Height, bits); LOG3 ("Mode set to %d x %d x %d\n", Width, Height, bits);
if (vid_attachedsurfaces && OSPlatform == os_WinNT) if (vid_attachedsurfaces && OSPlatform == os_WinNT4)
{ {
if (!CreateSurfacesAttached ()) if (!CreateSurfacesAttached ())
return false; return false;