- Fixed: Crash when opening the player setup menu when you're so dead that

your head has popped off your body.
- Fixed: When item respawning is on and you play on skill 1 or 5, picking
  up ammo would permanently double the amount of ammo received from that
  item the next time it gets picked up.
- Added a check to PlayerIsGone() for players who have already had their
  actors destroyed before calling it.
- Fixed: G_CheckDemoStatus() only restored your name, autoaim, and color
  settings after playing back a demo.
- Added DEM_SPRAY net command so that sprayed decals work in multiplayer
  and demos.
- Changed DEM_GIVECHEAT to use a word for specifying the item quantity.
  This is useful mainly for giving yourself more than 255 health at a time.
- Fixed: DEM_SUMMONFRIEND was not handled by Net_SkipCommand().


SVN r58 (trunk)
This commit is contained in:
Randy Heit 2006-04-21 05:44:21 +00:00
parent 7e7ab6b4ec
commit 8ea6569de8
12 changed files with 118 additions and 79 deletions

View file

@ -1,4 +1,18 @@
April 20, 2006 April 20, 2006
- Fixed: Crash when opening the player setup menu when you're so dead that
your head has popped off your body.
- Fixed: When item respawning is on and you play on skill 1 or 5, picking
up ammo would permanently double the amount of ammo received from that
item the next time it gets picked up.
- Added a check to PlayerIsGone() for players who have already had their
actors destroyed before calling it.
- Fixed: G_CheckDemoStatus() only restored your name, autoaim, and color
settings after playing back a demo.
- Added DEM_SPRAY net command so that sprayed decals work in multiplayer
and demos.
- Changed DEM_GIVECHEAT to use a word for specifying the item quantity.
This is useful mainly for giving yourself more than 255 health at a time.
- Fixed: DEM_SUMMONFRIEND was not handled by Net_SkipCommand().
- Fixed compilation with mingw again. - Fixed compilation with mingw again.
- Added multiple-choice sound sequences. These overcome one of the major - Added multiple-choice sound sequences. These overcome one of the major
deficiences of the Hexen-inherited SNDSEQ system while still being Hexen deficiences of the Hexen-inherited SNDSEQ system while still being Hexen
@ -7,7 +21,7 @@ April 20, 2006
- Moved the TArray serializer into farchive.h so that tarray.h doesn't need - Moved the TArray serializer into farchive.h so that tarray.h doesn't need
farchive.h at all because GCC was much pickier than VC. Because of this, farchive.h at all because GCC was much pickier than VC. Because of this,
I don't need the FArchive change I made yesterday that hid FArchive's I don't need the FArchive change I made yesterday that hid FArchive's
TArray usses behind pointers. TArray uses behind pointers.
- Added a countof macro to doomtype.h. See the1's blog to find out why - Added a countof macro to doomtype.h. See the1's blog to find out why
it's implemented the way it is. it's implemented the way it is.
<http://blogs.msdn.com/the1/articles/210011.aspx> <http://blogs.msdn.com/the1/articles/210011.aspx>

View file

@ -339,14 +339,14 @@ CCMD (give)
Net_WriteByte (DEM_GIVECHEAT); Net_WriteByte (DEM_GIVECHEAT);
Net_WriteString (argv[1]); Net_WriteString (argv[1]);
if (argv.argc() > 2) if (argv.argc() > 2)
Net_WriteByte (clamp (atoi (argv[2]), 1, 255)); Net_WriteWord (clamp (atoi (argv[2]), 1, 32767));
else else
Net_WriteByte (0); Net_WriteWord (0);
} }
CCMD (gameversion) CCMD (gameversion)
{ {
Printf ("%d.%d : " __DATE__ "\n", GAMEVERSION / 100, GAMEVERSION % 100); Printf ("%s : " __DATE__ "\n", DOTVERSIONSTR);
} }
CCMD (print) CCMD (print)

View file

@ -49,6 +49,8 @@
#include "d_gui.h" #include "d_gui.h"
#include "templates.h" #include "templates.h"
#include "p_acs.h" #include "p_acs.h"
#include "p_trace.h"
#include "a_sharedglobal.h"
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);
@ -619,9 +621,12 @@ void PlayerIsGone (int netnode, int netconsole)
} }
// [RH] Make the player disappear // [RH] Make the player disappear
if (players[netconsole].mo != NULL)
{
P_DisconnectEffect (players[netconsole].mo); P_DisconnectEffect (players[netconsole].mo);
players[netconsole].mo->Destroy (); players[netconsole].mo->Destroy ();
players[netconsole].mo = NULL; players[netconsole].mo = NULL;
}
// [RH] Let the scripts know the player left // [RH] Let the scripts know the player left
FBehavior::StaticStartTypedScripts (SCRIPT_Disconnect, NULL, true, netconsole); FBehavior::StaticStartTypedScripts (SCRIPT_Disconnect, NULL, true, netconsole);
if (netconsole == Net_Arbitrator) if (netconsole == Net_Arbitrator)
@ -1419,7 +1424,7 @@ void D_ArbitrateNetStart (void)
if (!nodeingame[node]) if (!nodeingame[node])
{ {
if (netbuffer[2] != GAMEVERSION) if (netbuffer[2] != NETGAMEVERSION)
I_Error ("Different DOOM versions cannot play a net game!"); I_Error ("Different DOOM versions cannot play a net game!");
playeringame[netbuffer[1]] = true; playeringame[netbuffer[1]] = true;
@ -1465,7 +1470,7 @@ void D_ArbitrateNetStart (void)
break; break;
} }
netbuffer[2] = GAMEVERSION; netbuffer[2] = NETGAMEVERSION;
netbuffer[3] = playersdetected[0] >> 24; netbuffer[3] = playersdetected[0] >> 24;
netbuffer[4] = playersdetected[0] >> 16; netbuffer[4] = playersdetected[0] >> 16;
netbuffer[5] = playersdetected[0] >> 8; netbuffer[5] = playersdetected[0] >> 8;
@ -1483,7 +1488,7 @@ void D_ArbitrateNetStart (void)
else else
{ // Send user info for all nodes { // Send user info for all nodes
netbuffer[0] = NCMD_SETUP+1; netbuffer[0] = NCMD_SETUP+1;
netbuffer[2] = GAMEVERSION; netbuffer[2] = NETGAMEVERSION;
for (i = 1; i < doomcom->numnodes; ++i) for (i = 1; i < doomcom->numnodes; ++i)
{ {
for (j = 0; j < doomcom->numnodes; ++j) for (j = 0; j < doomcom->numnodes; ++j)
@ -2000,7 +2005,7 @@ void Net_DoCommand (int type, byte **stream, int player)
case DEM_GIVECHEAT: case DEM_GIVECHEAT:
s = ReadString (stream); s = ReadString (stream);
cht_Give (&players[player], s, ReadByte (stream)); cht_Give (&players[player], s, ReadWord (stream));
break; break;
case DEM_WARPCHEAT: case DEM_WARPCHEAT:
@ -2131,6 +2136,34 @@ void Net_DoCommand (int type, byte **stream, int player)
} }
break; break;
case DEM_SPRAY:
{
FTraceResults trace;
angle_t ang = players[player].mo->angle >> ANGLETOFINESHIFT;
angle_t pitch = (angle_t)(players[player].mo->pitch) >> ANGLETOFINESHIFT;
fixed_t vx = FixedMul (finecosine[pitch], finecosine[ang]);
fixed_t vy = FixedMul (finecosine[pitch], finesine[ang]);
fixed_t vz = -finesine[pitch];
s = ReadString (stream);
if (Trace (players[player].mo->x, players[player].mo->y,
players[player].mo->z + players[player].mo->height - (players[player].mo->height>>2),
players[player].mo->Sector,
vx, vy, vz, 172*FRACUNIT, 0, ML_BLOCKEVERYTHING, players[player].mo,
trace, TRACE_NoSky))
{
if (trace.HitType == TRACE_HitWall)
{
DImpactDecal::StaticCreate (s,
trace.X, trace.Y, trace.Z,
sides + trace.Line->sidenum[trace.Side]);
}
}
}
break;
case DEM_PAUSE: case DEM_PAUSE:
if (gamestate == GS_LEVEL) if (gamestate == GS_LEVEL)
{ {
@ -2241,7 +2274,7 @@ void Net_SkipCommand (int type, byte **stream)
break; break;
case DEM_GIVECHEAT: case DEM_GIVECHEAT:
skip = strlen ((char *)(*stream)) + 2; skip = strlen ((char *)(*stream)) + 3;
break; break;
case DEM_MUSICCHANGE: case DEM_MUSICCHANGE:
@ -2250,6 +2283,8 @@ void Net_SkipCommand (int type, byte **stream)
case DEM_UINFCHANGED: case DEM_UINFCHANGED:
case DEM_CHANGEMAP: case DEM_CHANGEMAP:
case DEM_SUMMON: case DEM_SUMMON:
case DEM_SUMMONFRIEND:
case DEM_SPRAY:
skip = strlen ((char *)(*stream)) + 1; skip = strlen ((char *)(*stream)) + 1;
break; break;

View file

@ -109,7 +109,7 @@ enum EDemoCommand
DEM_UINFCHANGED, // 8 User info changed DEM_UINFCHANGED, // 8 User info changed
DEM_SINFCHANGED, // 9 Server/Host info changed DEM_SINFCHANGED, // 9 Server/Host info changed
DEM_GENERICCHEAT, // 10 Next byte is cheat to apply (see next enum) DEM_GENERICCHEAT, // 10 Next byte is cheat to apply (see next enum)
DEM_GIVECHEAT, // 11 String: item to give, Byte: quantity DEM_GIVECHEAT, // 11 String: item to give, Word: quantity
DEM_SAY, // 12 Byte: who to talk to, String: message to display DEM_SAY, // 12 Byte: who to talk to, String: message to display
DEM_DROPPLAYER, // 13 Not implemented, takes a byte DEM_DROPPLAYER, // 13 Not implemented, takes a byte
DEM_CHANGEMAP, // 14 Name of map to change to DEM_CHANGEMAP, // 14 Name of map to change to
@ -136,6 +136,7 @@ enum EDemoCommand
DEM_WARPCHEAT, // 35 4 bytes: 2 for x, 2 for y DEM_WARPCHEAT, // 35 4 bytes: 2 for x, 2 for y
DEM_CENTERVIEW, // 36 DEM_CENTERVIEW, // 36
DEM_SUMMONFRIEND, // 37 String: Thing to fabricate DEM_SUMMONFRIEND, // 37 String: Thing to fabricate
DEM_SPRAY, // 38 String: The decal to spray
}; };
// The following are implemented by cht_DoCheat in m_cheat.cpp // The following are implemented by cht_DoCheat in m_cheat.cpp

View file

@ -2185,7 +2185,7 @@ void G_BeginRecording (const char *startmap)
// Write header chunk // Write header chunk
StartChunk (ZDHD_ID, &demo_p); StartChunk (ZDHD_ID, &demo_p);
WriteWord (GAMEVER, &demo_p); // Write ZDoom version WriteWord (DEMOGAMEVERSION, &demo_p); // Write ZDoom version
*demo_p++ = 2; // Write minimum version needed to use this demo. *demo_p++ = 2; // Write minimum version needed to use this demo.
*demo_p++ = 3; // (Useful?) *demo_p++ = 3; // (Useful?)
for (i = 0; i < 8; i++) // Write name of map demo was recorded on. for (i = 0; i < 8; i++) // Write name of map demo was recorded on.
@ -2303,12 +2303,12 @@ BOOL G_ProcessIFFDemo (char *mapname)
headerHit = true; headerHit = true;
demover = ReadWord (&demo_p); // ZDoom version demo was created with demover = ReadWord (&demo_p); // ZDoom version demo was created with
if (demover < 0x203) if (demover < MINDEMOVERSION)
{ {
Printf ("Demo requires an older version of ZDoom!\n"); Printf ("Demo requires an older version of ZDoom!\n");
//return true; //return true;
} }
if (ReadWord (&demo_p) > GAMEVER) // Minimum ZDoom version if (ReadWord (&demo_p) > DEMOGAMEVERSION) // Minimum ZDoom version
{ {
Printf ("Demo requires a newer version of ZDoom!\n"); Printf ("Demo requires a newer version of ZDoom!\n");
return true; return true;
@ -2469,17 +2469,11 @@ void G_TimeDemo (char* name)
=================== ===================
*/ */
EXTERN_CVAR (String, name)
EXTERN_CVAR (Float, autoaim)
EXTERN_CVAR (Color, color)
BOOL G_CheckDemoStatus (void) BOOL G_CheckDemoStatus (void)
{ {
if (!demorecording) if (!demorecording)
{ // [RH] Restore the player's userinfo settings. { // [RH] Restore the player's userinfo settings.
D_UserInfoChanged (&name); D_SetupUserInfo();
D_UserInfoChanged (&autoaim);
D_UserInfoChanged (&color);
} }
if (demoplayback) if (demoplayback)

View file

@ -690,27 +690,8 @@ CCMD (spray)
return; return;
} }
FTraceResults trace; Net_WriteByte (DEM_SPRAY);
Net_WriteString (argv[1]);
angle_t ang = m_Instigator->angle >> ANGLETOFINESHIFT;
angle_t pitch = (angle_t)(m_Instigator->pitch) >> ANGLETOFINESHIFT;
fixed_t vx = FixedMul (finecosine[pitch], finecosine[ang]);
fixed_t vy = FixedMul (finecosine[pitch], finesine[ang]);
fixed_t vz = -finesine[pitch];
if (Trace (m_Instigator->x, m_Instigator->y,
m_Instigator->z + m_Instigator->height - (m_Instigator->height>>2),
m_Instigator->Sector,
vx, vy, vz, 172*FRACUNIT, 0, ML_BLOCKEVERYTHING, m_Instigator,
trace, TRACE_NoSky))
{
if (trace.HitType == TRACE_HitWall)
{
DImpactDecal::StaticCreate (argv[1],
trace.X, trace.Y, trace.Z,
sides + trace.Line->sidenum[trace.Side]);
}
}
} }
class ADecal : public AActor class ADecal : public AActor

View file

@ -59,31 +59,6 @@ const TypeInfo *AAmmo::GetParentAmmo () const
return type; return type;
} }
//===========================================================================
//
// AAmmo :: TryPickup
//
//===========================================================================
bool AAmmo::TryPickup (AActor *toucher)
{
int count = Amount;
if (gameskill == sk_baby || (gameskill == sk_nightmare && gameinfo.gametype != GAME_Strife))
{ // extra ammo in baby mode and nightmare mode
if (gameinfo.gametype & (GAME_Doom|GAME_Strife))
Amount <<= 1;
else
Amount += Amount >> 1;
}
if (!Super::TryPickup (toucher))
{
Amount = count;
return false;
}
return true;
}
//=========================================================================== //===========================================================================
// //
// AAmmo :: HandlePickup // AAmmo :: HandlePickup
@ -97,8 +72,18 @@ bool AAmmo::HandlePickup (AInventory *item)
{ {
if (Amount < MaxAmount) if (Amount < MaxAmount)
{ {
int receiving = item->Amount;
// extra ammo in baby mode and nightmare mode
if (gameskill == sk_baby || (gameskill == sk_nightmare && gameinfo.gametype != GAME_Strife))
{
if (gameinfo.gametype & (GAME_Doom|GAME_Strife))
receiving <<= 1;
else
receiving += receiving >> 1;
}
int oldamount = Amount; int oldamount = Amount;
Amount += item->Amount; Amount += receiving;
if (Amount > MaxAmount) if (Amount > MaxAmount)
{ {
Amount = MaxAmount; Amount = MaxAmount;
@ -143,6 +128,16 @@ bool AAmmo::HandlePickup (AInventory *item)
AInventory *AAmmo::CreateCopy (AActor *other) AInventory *AAmmo::CreateCopy (AActor *other)
{ {
AInventory *copy; AInventory *copy;
int amount = Amount;
// extra ammo in baby mode and nightmare mode
if (gameskill == sk_baby || (gameskill == sk_nightmare && gameinfo.gametype != GAME_Strife))
{
if (gameinfo.gametype & (GAME_Doom|GAME_Strife))
amount <<= 1;
else
amount += amount >> 1;
}
if (GetClass()->ParentType != RUNTIME_CLASS(AAmmo)) if (GetClass()->ParentType != RUNTIME_CLASS(AAmmo))
{ {
@ -152,12 +147,13 @@ AInventory *AAmmo::CreateCopy (AActor *other)
Destroy (); Destroy ();
} }
copy = static_cast<AInventory *>(Spawn (type, 0, 0, 0)); copy = static_cast<AInventory *>(Spawn (type, 0, 0, 0));
copy->Amount = Amount; copy->Amount = amount;
copy->BecomeItem (); copy->BecomeItem ();
} }
else else
{ {
copy = Super::CreateCopy (other); copy = Super::CreateCopy (other);
copy->Amount = amount;
} }
if (copy->Amount > copy->MaxAmount) if (copy->Amount > copy->MaxAmount)
{ // Don't pick up more ammo than you're supposed to be able to carry. { // Don't pick up more ammo than you're supposed to be able to carry.

View file

@ -171,7 +171,6 @@ class AAmmo : public AInventory
DECLARE_STATELESS_ACTOR (AAmmo, AInventory) DECLARE_STATELESS_ACTOR (AAmmo, AInventory)
public: public:
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
bool TryPickup (AActor *toucher);
AInventory *CreateCopy (AActor *other); AInventory *CreateCopy (AActor *other);
bool HandlePickup (AInventory *item); bool HandlePickup (AInventory *item);
const TypeInfo *GetParentAmmo () const; const TypeInfo *GetParentAmmo () const;

View file

@ -1243,7 +1243,7 @@ void FBaseStatusBar::Draw (EHudState state)
void FBaseStatusBar::DrawTopStuff (EHudState state) void FBaseStatusBar::DrawTopStuff (EHudState state)
{ {
if (demoplayback && demover != GAMEVER) if (demoplayback && demover != DEMOGAMEVERSION)
{ {
screen->DrawText (CR_TAN, 0, ST_Y - 40 * CleanYfac, screen->DrawText (CR_TAN, 0, ST_Y - 40 * CleanYfac,
"Demo was recorded with a different version\n" "Demo was recorded with a different version\n"

View file

@ -493,7 +493,7 @@ void FGameConfigFile::ArchiveGlobalData ()
{ {
SetSection ("LastRun", true); SetSection ("LastRun", true);
ClearCurrentSection (); ClearCurrentSection ();
SetValueForKey ("Version", STRVERSION); SetValueForKey ("Version", LASTRUNVERSION);
SetSection ("GlobalSettings", true); SetSection ("GlobalSettings", true);
ClearCurrentSection (); ClearCurrentSection ();

View file

@ -1792,7 +1792,7 @@ void M_PlayerSetup (void)
{ {
PlayerClass = RUNTIME_TYPE(players[consoleplayer].mo); PlayerClass = RUNTIME_TYPE(players[consoleplayer].mo);
} }
PlayerState = GetDefaultByType (PlayerClass)->SeeState; PlayerState = GetDefaultByType (PlayerClass)->SpawnState;
PlayerTics = PlayerState->GetTics(); PlayerTics = PlayerState->GetTics();
if (FireScreen == NULL) if (FireScreen == NULL)
FireScreen = new DSimpleCanvas (144, 160); FireScreen = new DSimpleCanvas (144, 160);

View file

@ -34,17 +34,36 @@
#ifndef __VERSION_H__ #ifndef __VERSION_H__
#define __VERSION_H__ #define __VERSION_H__
// Lots of different representations for the version number /** Lots of different version numbers **/
enum { GAMEVERSION = 205 };
#define STRVERSION "205" // The version string the user actually sees.
#define DOTVERSIONSTR "2.0.99" #define DOTVERSIONSTR "2.0.99"
#define GAMEVER (2*256+3)
// Version identifier for network games.
// Bump it every time you do a release unless you're certain you
// didn't change anything that will affect sync.
#define NETGAMEVERSION 206
// Version stored in the ini's [LastRun] section.
// Bump it if you made some configuration change that you want to
// be able to migrate in FGameConfigFile::DoGlobalSetup().
#define LASTRUNVERSION "205"
// Protocol version used in demos.
// Bump it if you change existing DEM_ commands or add new ones.
// Otherwise, it should be safe to leave it alone.
#define DEMOGAMEVERSION 0x204
// Minimum demo version we can play.
// Bump it whenever you change or remove existing DEM_ commands.
#define MINDEMOVERSION 0x204
// SAVEVER is the version of the information stored in level snapshots. // SAVEVER is the version of the information stored in level snapshots.
// Note that SAVEVER is not directly comparable to VERSION. // Note that SAVEVER is not directly comparable to VERSION.
// SAVESIG should match SAVEVER. // SAVESIG should match SAVEVER.
#define SAVEVER 232 #define SAVEVER 232
#define SAVESIG "ZDOOMSAVE232" #define SAVESIG "ZDOOMSAVE232"
// This is so that derivates can use the same savegame versions without worrying about engine compatibility // This is so that derivates can use the same savegame versions without worrying about engine compatibility
#define GAMESIG "ZDOOM" #define GAMESIG "ZDOOM"