diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 8852b18de6..25fa7ede74 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,18 @@ 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. - Added multiple-choice sound sequences. These overcome one of the major 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 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 - TArray usses behind pointers. + TArray uses behind pointers. - Added a countof macro to doomtype.h. See the1's blog to find out why it's implemented the way it is. diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index f01747c10c..cc0c265075 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -339,14 +339,14 @@ CCMD (give) Net_WriteByte (DEM_GIVECHEAT); Net_WriteString (argv[1]); if (argv.argc() > 2) - Net_WriteByte (clamp (atoi (argv[2]), 1, 255)); + Net_WriteWord (clamp (atoi (argv[2]), 1, 32767)); else - Net_WriteByte (0); + Net_WriteWord (0); } CCMD (gameversion) { - Printf ("%d.%d : " __DATE__ "\n", GAMEVERSION / 100, GAMEVERSION % 100); + Printf ("%s : " __DATE__ "\n", DOTVERSIONSTR); } CCMD (print) diff --git a/src/d_net.cpp b/src/d_net.cpp index c9e2938162..51d2e0bebe 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -49,6 +49,8 @@ #include "d_gui.h" #include "templates.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 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 - P_DisconnectEffect (players[netconsole].mo); - players[netconsole].mo->Destroy (); - players[netconsole].mo = NULL; + if (players[netconsole].mo != NULL) + { + P_DisconnectEffect (players[netconsole].mo); + players[netconsole].mo->Destroy (); + players[netconsole].mo = NULL; + } // [RH] Let the scripts know the player left FBehavior::StaticStartTypedScripts (SCRIPT_Disconnect, NULL, true, netconsole); if (netconsole == Net_Arbitrator) @@ -1419,7 +1424,7 @@ void D_ArbitrateNetStart (void) if (!nodeingame[node]) { - if (netbuffer[2] != GAMEVERSION) + if (netbuffer[2] != NETGAMEVERSION) I_Error ("Different DOOM versions cannot play a net game!"); playeringame[netbuffer[1]] = true; @@ -1465,7 +1470,7 @@ void D_ArbitrateNetStart (void) break; } - netbuffer[2] = GAMEVERSION; + netbuffer[2] = NETGAMEVERSION; netbuffer[3] = playersdetected[0] >> 24; netbuffer[4] = playersdetected[0] >> 16; netbuffer[5] = playersdetected[0] >> 8; @@ -1483,7 +1488,7 @@ void D_ArbitrateNetStart (void) else { // Send user info for all nodes netbuffer[0] = NCMD_SETUP+1; - netbuffer[2] = GAMEVERSION; + netbuffer[2] = NETGAMEVERSION; for (i = 1; i < doomcom->numnodes; ++i) { for (j = 0; j < doomcom->numnodes; ++j) @@ -2000,7 +2005,7 @@ void Net_DoCommand (int type, byte **stream, int player) case DEM_GIVECHEAT: s = ReadString (stream); - cht_Give (&players[player], s, ReadByte (stream)); + cht_Give (&players[player], s, ReadWord (stream)); break; case DEM_WARPCHEAT: @@ -2131,6 +2136,34 @@ void Net_DoCommand (int type, byte **stream, int player) } 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: if (gamestate == GS_LEVEL) { @@ -2241,7 +2274,7 @@ void Net_SkipCommand (int type, byte **stream) break; case DEM_GIVECHEAT: - skip = strlen ((char *)(*stream)) + 2; + skip = strlen ((char *)(*stream)) + 3; break; case DEM_MUSICCHANGE: @@ -2250,6 +2283,8 @@ void Net_SkipCommand (int type, byte **stream) case DEM_UINFCHANGED: case DEM_CHANGEMAP: case DEM_SUMMON: + case DEM_SUMMONFRIEND: + case DEM_SPRAY: skip = strlen ((char *)(*stream)) + 1; break; diff --git a/src/d_protocol.h b/src/d_protocol.h index 01205eee5f..eef5412619 100644 --- a/src/d_protocol.h +++ b/src/d_protocol.h @@ -109,7 +109,7 @@ enum EDemoCommand DEM_UINFCHANGED, // 8 User info changed DEM_SINFCHANGED, // 9 Server/Host info changed 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_DROPPLAYER, // 13 Not implemented, takes a byte 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_CENTERVIEW, // 36 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 diff --git a/src/g_game.cpp b/src/g_game.cpp index 8c08885ed7..1ae89f1e14 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -2185,7 +2185,7 @@ void G_BeginRecording (const char *startmap) // Write header chunk 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++ = 3; // (Useful?) 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; 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"); //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"); 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) { if (!demorecording) { // [RH] Restore the player's userinfo settings. - D_UserInfoChanged (&name); - D_UserInfoChanged (&autoaim); - D_UserInfoChanged (&color); + D_SetupUserInfo(); } if (demoplayback) diff --git a/src/g_shared/a_decals.cpp b/src/g_shared/a_decals.cpp index 40795e8b8c..731438e10c 100644 --- a/src/g_shared/a_decals.cpp +++ b/src/g_shared/a_decals.cpp @@ -690,27 +690,8 @@ CCMD (spray) return; } - FTraceResults trace; - - 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]); - } - } + Net_WriteByte (DEM_SPRAY); + Net_WriteString (argv[1]); } class ADecal : public AActor diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index 3197b69d88..67f8caadd4 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -59,31 +59,6 @@ const TypeInfo *AAmmo::GetParentAmmo () const 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 @@ -97,8 +72,18 @@ bool AAmmo::HandlePickup (AInventory *item) { 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; - Amount += item->Amount; + Amount += receiving; if (Amount > MaxAmount) { Amount = MaxAmount; @@ -143,6 +128,16 @@ bool AAmmo::HandlePickup (AInventory *item) AInventory *AAmmo::CreateCopy (AActor *other) { 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)) { @@ -152,12 +147,13 @@ AInventory *AAmmo::CreateCopy (AActor *other) Destroy (); } copy = static_cast(Spawn (type, 0, 0, 0)); - copy->Amount = Amount; + copy->Amount = amount; copy->BecomeItem (); } else { copy = Super::CreateCopy (other); + copy->Amount = amount; } if (copy->Amount > copy->MaxAmount) { // Don't pick up more ammo than you're supposed to be able to carry. diff --git a/src/g_shared/a_pickups.h b/src/g_shared/a_pickups.h index fd37dc0f0f..89e6ac9d64 100644 --- a/src/g_shared/a_pickups.h +++ b/src/g_shared/a_pickups.h @@ -171,7 +171,6 @@ class AAmmo : public AInventory DECLARE_STATELESS_ACTOR (AAmmo, AInventory) public: void Serialize (FArchive &arc); - bool TryPickup (AActor *toucher); AInventory *CreateCopy (AActor *other); bool HandlePickup (AInventory *item); const TypeInfo *GetParentAmmo () const; diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index 1b681d9899..781ba3b87e 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -1243,7 +1243,7 @@ void FBaseStatusBar::Draw (EHudState state) void FBaseStatusBar::DrawTopStuff (EHudState state) { - if (demoplayback && demover != GAMEVER) + if (demoplayback && demover != DEMOGAMEVERSION) { screen->DrawText (CR_TAN, 0, ST_Y - 40 * CleanYfac, "Demo was recorded with a different version\n" diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index e42242c487..08dbc604da 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -493,7 +493,7 @@ void FGameConfigFile::ArchiveGlobalData () { SetSection ("LastRun", true); ClearCurrentSection (); - SetValueForKey ("Version", STRVERSION); + SetValueForKey ("Version", LASTRUNVERSION); SetSection ("GlobalSettings", true); ClearCurrentSection (); diff --git a/src/m_menu.cpp b/src/m_menu.cpp index d5c08ea5db..d863c0b99d 100644 --- a/src/m_menu.cpp +++ b/src/m_menu.cpp @@ -1792,7 +1792,7 @@ void M_PlayerSetup (void) { PlayerClass = RUNTIME_TYPE(players[consoleplayer].mo); } - PlayerState = GetDefaultByType (PlayerClass)->SeeState; + PlayerState = GetDefaultByType (PlayerClass)->SpawnState; PlayerTics = PlayerState->GetTics(); if (FireScreen == NULL) FireScreen = new DSimpleCanvas (144, 160); diff --git a/src/version.h b/src/version.h index 452a9852b7..10e987e045 100644 --- a/src/version.h +++ b/src/version.h @@ -34,17 +34,36 @@ #ifndef __VERSION_H__ #define __VERSION_H__ -// Lots of different representations for the version number -enum { GAMEVERSION = 205 }; -#define STRVERSION "205" +/** Lots of different version numbers **/ + +// The version string the user actually sees. #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. // Note that SAVEVER is not directly comparable to VERSION. // SAVESIG should match SAVEVER. #define SAVEVER 232 #define SAVESIG "ZDOOMSAVE232" + // This is so that derivates can use the same savegame versions without worrying about engine compatibility #define GAMESIG "ZDOOM"