From 9dd3c4b2d59c9d332d0d70aedb0d3033ea13eea3 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Fri, 5 Jul 2013 00:45:45 -0400 Subject: [PATCH 01/10] - When erroring due to the lack of iwads, print instructions more relevent to the user's platform. --- src/d_iwad.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index e53a1d362..6b430fa03 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -367,7 +367,7 @@ int FIWadManager::CheckIWAD (const char *doomwaddir, WadStuff *wads) // Under UNIX OSes, the search path is: // 1. Current directory // 2. $DOOMWADDIR -// 3. $HOME/.zdoom +// 3. $HOME/.config/zdoom // 4. The share directory defined at compile time (/usr/local/share/zdoom) // // The search path can be altered by editing the IWADSearch.Directories @@ -516,9 +516,19 @@ int FIWadManager::IdentifyVersion (TArray &wadfiles, const char *iwad, I_FatalError ("Cannot find a game IWAD (doom.wad, doom2.wad, heretic.wad, etc.).\n" "Did you install ZDoom properly? You can do either of the following:\n" "\n" +#if defined(_WIN32) "1. Place one or more of these wads in the same directory as ZDoom.\n" "2. Edit your zdoom-username.ini and add the directories of your iwads\n" "to the list beneath [IWADSearch.Directories]"); +#elif defined(__APPLE__) + "1. Place one or more of these wads in ~/Library/Application Support/zdoom/\n" + "2. Edit your ~/Library/Preferences/zdoom.ini and add the directories\n" + "of your iwads to the list beneath [IWADSearch.Directories]"); +#else + "1. Place one or more of these wads in ~/.config/zdoom/.\n" + "2. Edit your ~/.config/zdoom/zdoom.ini and add the directories of your\n" + "iwads to the list beneath [IWADSearch.Directories]"); +#endif } pickwad = 0; From 453f4ace5c4bab61fd3741433ee43884f4a1283d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 14 Jul 2013 09:01:00 +0200 Subject: [PATCH 02/10] - added compatibility setting for stuff in Cheogsh2 MAP04's megasphere cage which is positioned too low. --- wadsrc/static/compatibility.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/wadsrc/static/compatibility.txt b/wadsrc/static/compatibility.txt index 795b9348a..4b75dfaba 100644 --- a/wadsrc/static/compatibility.txt +++ b/wadsrc/static/compatibility.txt @@ -361,3 +361,18 @@ F481922F4881F74760F3C0437FD5EDD0 // map03 // still set when returning to the origin map. linkfrozenprops } + +D62DCA9EC226DE49108D5DD9271F7631 // Cheogsh 2 map04 +{ + // Stuff in megasphere cage is positioned too low + setthingz 1640 528 + setthingz 1641 528 + setthingz 1642 528 + setthingz 1643 528 + setthingz 1644 528 + setthingz 1645 528 + setthingz 1646 528 + setthingz 1647 528 + setthingz 1648 528 + setthingz 1649 528 +} \ No newline at end of file From 10dd75f9028e45db9f5264c9b5e654c7973d9ef7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 14 Jul 2013 09:31:49 +0200 Subject: [PATCH 03/10] - externalized "New save game" line for save screen. --- src/menu/loadsavemenu.cpp | 2 +- wadsrc/static/language.enu | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/menu/loadsavemenu.cpp b/src/menu/loadsavemenu.cpp index 99ac59938..20779a221 100644 --- a/src/menu/loadsavemenu.cpp +++ b/src/menu/loadsavemenu.cpp @@ -898,7 +898,7 @@ IMPLEMENT_CLASS(DSaveMenu) DSaveMenu::DSaveMenu(DMenu *parent, FListMenuDescriptor *desc) : DLoadSaveMenu(parent, desc) { - strcpy (NewSaveNode.Title, ""); + strcpy (NewSaveNode.Title, GStrings["NEWSAVE"]); NewSaveNode.bNoDelete = true; SaveGames.Insert(0, &NewSaveNode); TopItem = 0; diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index 0c8fff5d3..4b5225f54 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -112,6 +112,7 @@ PD_YELLOWCO = "You need a yellow card to activate this object"; PD_BLUESO = "You need a blue skull to activate this object"; PD_REDSO = "You need a red skull to activate this object"; PD_YELLOWSO = "You need a yellow skull to activate this object"; +NEWSAVE = ""; GGSAVED = "game saved."; HUSTR_MSGU = "[Message unsent]"; PICKUP_PISTOL_DROPPED = "Picked up a pistol."; From e9be49f37dcf175ad9d750eec8c27bc04522a250 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 14 Jul 2013 09:47:39 +0200 Subject: [PATCH 04/10] - fixed: R_DeinitPlanes did not free all visplanes because it called R_ClearPlanes with 'fullclear' set to false. - removed some redundancy from R_ClearPlanes. --- src/r_plane.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/r_plane.cpp b/src/r_plane.cpp index 8bf544455..986d99203 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -174,7 +174,15 @@ void R_InitPlanes () void R_DeinitPlanes () { fakeActive = 0; - R_ClearPlanes(false); + + // do not use R_ClearPlanes because at this point the screen pointer is no longer valid. + for (int i = 0; i <= MAXVISPLANES; i++) // new code -- killough + { + for (*freehead = visplanes[i], visplanes[i] = NULL; *freehead; ) + { + freehead = &(*freehead)->next; + } + } for (visplane_t *pl = freetail; pl != NULL; ) { visplane_t *next = pl->next; @@ -490,7 +498,7 @@ void R_MapColoredPlane (int y, int x1) void R_ClearPlanes (bool fullclear) { - int i, max; + int i; // Don't clear fake planes if not doing a full clear. if (!fullclear) @@ -516,7 +524,6 @@ void R_ClearPlanes (bool fullclear) } else { - max = fullclear ? MAXVISPLANES : MAXVISPLANES-1; for (i = 0; i <= MAXVISPLANES; i++) // new code -- killough { for (*freehead = visplanes[i], visplanes[i] = NULL; *freehead; ) @@ -524,10 +531,7 @@ void R_ClearPlanes (bool fullclear) freehead = &(*freehead)->next; } } - } - if (fullclear) - { // opening / clipping determination clearbufshort (floorclip, viewwidth, viewheight); // [RH] clip ceiling to console bottom From 2d2498d1e2772e49098ad17ea5b39adb81c6271f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 14 Jul 2013 10:58:53 +0200 Subject: [PATCH 05/10] - fixed: userinfo_t needs a destructor to delete its CVARs when it is destroyed. --- src/d_netinfo.cpp | 11 +++++++++++ src/d_player.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/d_netinfo.cpp b/src/d_netinfo.cpp index 92c8abc3e..6832a047e 100644 --- a/src/d_netinfo.cpp +++ b/src/d_netinfo.cpp @@ -1048,3 +1048,14 @@ CCMD (playerinfo) } } } + +userinfo_t::~userinfo_t() +{ + TMapIterator it(*this); + TMap::Pair *pair; + + while (it.NextPair(pair)) + { + delete pair->Value; + } +} diff --git a/src/d_player.h b/src/d_player.h index 6169dcebf..fcc541551 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -260,6 +260,8 @@ enum struct userinfo_t : TMap { + ~userinfo_t(); + int GetAimDist() const { if (dmflags2 & DF2_NOAUTOAIM) From 3e8e587ac7cc2e9a59929874d70ea7ae6406474e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 14 Jul 2013 12:37:25 +0200 Subject: [PATCH 06/10] - fixed another leak with userinfos: Since they are no longer POD they may not be memset to 0 in the player_t constructor. --- src/p_user.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/p_user.cpp b/src/p_user.cpp index 5ac8a1a88..35ab99036 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -309,7 +309,6 @@ player_t::player_t() ConversationFaceTalker(0) { memset (&cmd, 0, sizeof(cmd)); - memset (&userinfo, 0, sizeof(userinfo)); memset (frags, 0, sizeof(frags)); memset (psprites, 0, sizeof(psprites)); memset (&skill, 0, sizeof(skill)); From a59a886f949b7121c983b24222a5373b6aa4d593 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 14 Jul 2013 13:24:00 +0200 Subject: [PATCH 07/10] - fixed: The SectorDamage 3D-floor code didn't account for Vavoom-style 3D floors where floor and ceiling plane of the control sector are inverted. --- src/p_spec.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 3a6357748..a831029cf 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -639,12 +639,21 @@ void P_SectorDamage(int tag, int amount, FName type, const PClass *protectClass, { next = actor->snext; // Only affect actors touching the 3D floor - if (actor->z + actor->height > sec->floorplane.ZatPoint(actor->x, actor->y)) + fixed_t z1 = sec->floorplane.ZatPoint(actor->x, actor->y); + fixed_t z2 = sec->ceilingplane.ZatPoint(actor->x, actor->y); + if (z2 < z1) + { + // Account for Vavoom-style 3D floors + fixed_t zz = z1; + z1 = z2; + z2 = zz; + } + if (actor->z + actor->height > z1) { // If DAMAGE_IN_AIR is used, anything not beneath the 3D floor will be // damaged (so, anything touching it or above it). Other 3D floors between // the actor and this one will not stop this effect. - if ((flags & DAMAGE_IN_AIR) || actor->z <= sec->ceilingplane.ZatPoint(actor->x, actor->y)) + if ((flags & DAMAGE_IN_AIR) || actor->z <= z2)) { // Here we pass the DAMAGE_IN_AIR flag to disable the floor check, since it // only works with the real sector's floor. We did the appropriate height checks From 0c86650db03664712103d2d15278b49d08f52b98 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 14 Jul 2013 14:22:49 +0200 Subject: [PATCH 08/10] - fixed: The savegame code for player restoration did some undefined things with the userinfo that only worked due to previous memory leaks. It must ensure that the userinfos get properly transferred and not implicitly rely on the copy assignment being used to copy the actual player data. --- src/p_saveg.cpp | 16 +++++++++++++--- src/p_spec.cpp | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index a045c5098..d33f21f6f 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -256,11 +256,20 @@ static void CopyPlayer (player_t *dst, player_t *src, const char *name) { // The userinfo needs to be saved for real players, but it // needs to come from the save for bots. - userinfo_t uibackup = dst->userinfo; + userinfo_t uibackup; + userinfo_t uibackup2; + + uibackup.TransferFrom(dst->userinfo); + uibackup2.TransferFrom(src->userinfo); + int chasecam = dst->cheats & CF_CHASECAM; // Remember the chasecam setting bool attackdown = dst->attackdown; bool usedown = dst->usedown; - *dst = *src; + + + dst->~player_t(); // ensure that the userinfo in dst does not contain anything before copying everything over. + *dst = *src; // To avoid memory leaks at this point the userinfo in src must be empty which is taken care of by the TransferFrom call above. + dst->cheats |= chasecam; if (dst->isbot) @@ -276,10 +285,11 @@ static void CopyPlayer (player_t *dst, player_t *src, const char *name) } bglobal.botnum++; bglobal.botingame[dst - players] = true; + dst->userinfo.TransferFrom(uibackup2); } else { - dst->userinfo = uibackup; + dst->userinfo.TransferFrom(uibackup); } // Validate the skin dst->userinfo.SkinNumChanged(R_FindSkin(skins[dst->userinfo.GetSkin()].name, dst->CurrentPlayerClass)); diff --git a/src/p_spec.cpp b/src/p_spec.cpp index a831029cf..63f7c1c89 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -653,7 +653,7 @@ void P_SectorDamage(int tag, int amount, FName type, const PClass *protectClass, // If DAMAGE_IN_AIR is used, anything not beneath the 3D floor will be // damaged (so, anything touching it or above it). Other 3D floors between // the actor and this one will not stop this effect. - if ((flags & DAMAGE_IN_AIR) || actor->z <= z2)) + if ((flags & DAMAGE_IN_AIR) || actor->z <= z2) { // Here we pass the DAMAGE_IN_AIR flag to disable the floor check, since it // only works with the real sector's floor. We did the appropriate height checks From a90b49dc72447fb7ba29f1f1bd5d9a0441babdba Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 14 Jul 2013 14:33:45 +0200 Subject: [PATCH 09/10] - added string table replacement for A_Print, A_PrintBold and A_Log. --- src/thingdef/thingdef_codeptr.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index d2b64c718..638dd2753 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -70,6 +70,7 @@ #include "m_bbox.h" #include "r_data/r_translate.h" #include "p_trace.h" +#include "gstrings.h" static FRandom pr_camissile ("CustomActorfire"); @@ -2133,6 +2134,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Print) ACTION_PARAM_FLOAT(time, 1); ACTION_PARAM_NAME(fontname, 2); + if (text[0] == '$') text = GStrings(text+1); if (self->CheckLocalView (consoleplayer) || (self->target!=NULL && self->target->CheckLocalView (consoleplayer))) { @@ -2171,6 +2173,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PrintBold) float saved = con_midtime; FFont *font = NULL; + if (text[0] == '$') text = GStrings(text+1); if (fontname != NAME_None) { font = V_GetFont(fontname); @@ -2196,11 +2199,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Log) { ACTION_PARAM_START(1); ACTION_PARAM_STRING(text, 0); + + if (text[0] == '$') text = GStrings(text+1); Printf("%s\n", text); ACTION_SET_RESULT(false); // Prints should never set the result for inventory state chains! } -//=========================================================================== +//========================================================================= // // A_LogInt // From 77236132932d08a508855c3b44bd5b428f19d851 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Mon, 22 Jul 2013 02:09:46 -0400 Subject: [PATCH 10/10] - Fixed: ACS function pointer instructions were not updated when library tag size changed. - Fixed: undefined sequence compiler warning. --- src/p_acs.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index f57846b3c..74a670346 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -5556,7 +5556,8 @@ int DLevelScript::RunScript () case PCD_PUSHFUNCTION: { int funcnum = NEXTBYTE; - PushToStack(funcnum | activeBehavior->GetLibraryID()); + // Not technically a string, but since we use the same tagging mechanism + PushToStack(TAGSTR(funcnum)); break; } case PCD_CALL: @@ -5572,7 +5573,7 @@ int DLevelScript::RunScript () if(pcd == PCD_CALLSTACK) { funcnum = STACK(1); - module = FBehavior::StaticGetModule(funcnum>>16); + module = FBehavior::StaticGetModule(funcnum>>LIBRARYID_SHIFT); --sp; funcnum &= 0xFFFF; // Clear out tag @@ -8449,7 +8450,8 @@ scriptwait: case PCD_SAVESTRING: // Saves the string { - PushToStack(GlobalACSStrings.AddString(work, Stack, sp)); + const int str = GlobalACSStrings.AddString(work, Stack, sp); + PushToStack(str); STRINGBUILDER_FINISH(work); } break;