From 0c850e8ddd5fe5c4ae70593d25404e094b17cae2 Mon Sep 17 00:00:00 2001 From: slatenails Date: Sun, 28 Jul 2013 14:58:30 +0300 Subject: [PATCH 01/20] Results for console tab-completion are now color-coded. CCMDs appear blue, CVars green and aliases red. --- src/c_console.cpp | 15 ++++++++++++++- src/c_dispatch.cpp | 5 +++++ src/c_dispatch.h | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/c_console.cpp b/src/c_console.cpp index 170cc97d44..0ecd600e4d 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -2121,7 +2121,20 @@ static bool C_TabCompleteList () Printf (TEXTCOLOR_BLUE "Completions for %s:\n", CmdLine+2); for (i = TabPos; nummatches > 0; ++i, --nummatches) { - Printf ("%-*s", int(maxwidth), TabCommands[i].TabName.GetChars()); + // [Dusk] Print console commands blue, CVars green, aliases red. + const char* colorcode = ""; + FConsoleCommand* ccmd; + if (FindCVar (TabCommands[i].TabName, NULL)) + colorcode = "\\c[Green]"; + else if ((ccmd = FConsoleCommand::FindByName (TabCommands[i].TabName)) != NULL) + { + if (ccmd->IsAlias()) + colorcode = "\\c[Red]"; + else + colorcode = "\\c[Light Blue]"; + } + + Printf ("%s%-*s", strbin1 (colorcode).GetChars(), int(maxwidth), TabCommands[i].TabName.GetChars()); x += maxwidth; if (x > ConCols - maxwidth) { diff --git a/src/c_dispatch.cpp b/src/c_dispatch.cpp index d253549868..76b6e395df 100644 --- a/src/c_dispatch.cpp +++ b/src/c_dispatch.cpp @@ -955,6 +955,11 @@ bool FConsoleCommand::AddToHash (FConsoleCommand **table) return true; } +FConsoleCommand* FConsoleCommand::FindByName (const char* name) +{ + return FindNameInHashTable (Commands, name, strlen (name)); +} + FConsoleCommand::FConsoleCommand (const char *name, CCmdRun runFunc) : m_RunFunc (runFunc) { diff --git a/src/c_dispatch.h b/src/c_dispatch.h index 12ea559de3..96dc50644e 100644 --- a/src/c_dispatch.h +++ b/src/c_dispatch.h @@ -93,6 +93,7 @@ public: void PrintCommand () { Printf ("%s\n", m_Name); } virtual void Run (FCommandLine &args, APlayerPawn *instigator, int key); + static FConsoleCommand* FindByName (const char* name); FConsoleCommand *m_Next, **m_Prev; char *m_Name; From 6dee878b2e29fc6107c81b5b76ab5b72fa4bf05b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 28 Jul 2013 17:15:47 +0200 Subject: [PATCH 02/20] - used TEXTCOLOR_ #defines for colorizing CCMD list, remove use of strbin1. --- src/c_console.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/c_console.cpp b/src/c_console.cpp index 0ecd600e4d..e5d3d97ab1 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -2125,16 +2125,16 @@ static bool C_TabCompleteList () const char* colorcode = ""; FConsoleCommand* ccmd; if (FindCVar (TabCommands[i].TabName, NULL)) - colorcode = "\\c[Green]"; + colorcode = TEXTCOLOR_GREEN; else if ((ccmd = FConsoleCommand::FindByName (TabCommands[i].TabName)) != NULL) { if (ccmd->IsAlias()) - colorcode = "\\c[Red]"; + colorcode = TEXTCOLOR_RED; else - colorcode = "\\c[Light Blue]"; + colorcode = TEXTCOLOR_LIGHTBLUE; } - Printf ("%s%-*s", strbin1 (colorcode).GetChars(), int(maxwidth), TabCommands[i].TabName.GetChars()); + Printf ("%s%-*s", colorcode, int(maxwidth), TabCommands[i].TabName.GetChars()); x += maxwidth; if (x > ConCols - maxwidth) { From c4af738bf6b0d7f093ccdb0b060a04b8c4ff0cad Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Mon, 29 Jul 2013 18:30:26 -0400 Subject: [PATCH 03/20] - Fixed: crash when closing ZDoom in the save menu and a memory leak. --- src/menu/loadsavemenu.cpp | 3 ++- src/sdl/i_system.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/menu/loadsavemenu.cpp b/src/menu/loadsavemenu.cpp index 20779a221b..9a87bb806b 100644 --- a/src/menu/loadsavemenu.cpp +++ b/src/menu/loadsavemenu.cpp @@ -131,7 +131,8 @@ void ClearSaveGames() { for(unsigned i=0;ibNoDelete) + delete DLoadSaveMenu::SaveGames[i]; } DLoadSaveMenu::SaveGames.Clear(); } diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index 292da5930b..def35606a4 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -749,6 +749,8 @@ int I_FindClose (void *handle) findstate_t *state = (findstate_t *)handle; if (handle != (void*)-1 && state->count > 0) { + for(int i = 0;i < state->count;++i) + free (state->namelist[i]); state->count = 0; free (state->namelist); state->namelist = NULL; From 8e8f6cf5a6fbe6393a0dfd290f728f54d7557274 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 20 Aug 2013 20:33:03 +0200 Subject: [PATCH 04/20] - A_AlertMonsters flags submission by NeuralStunner. --- src/g_strife/a_strifeweapons.cpp | 28 +++++++++++++++++++++++++--- wadsrc/static/actors/actor.txt | 2 +- wadsrc/static/actors/constants.txt | 7 +++++++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index 82560e6f79..d37f0ea5ad 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -137,18 +137,40 @@ DEFINE_ACTION_FUNCTION(AActor, A_JabDagger) // //============================================================================ +enum +{ + AMF_TARGETEMITTER = 1, + AMF_TARGETNONPLAYER = 2, + AMF_EMITFROMTARGET = 4, +}; + DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_AlertMonsters) { ACTION_PARAM_START(1); ACTION_PARAM_FIXED(maxdist, 0); + ACTION_PARAM_INT(Flags, 1); - if (self->player != NULL) + AActor * target; + AActor * emitter = self; + + if (self->player != NULL || (Flags & AMF_TARGETEMITTER)) { - P_NoiseAlert(self, self, false, maxdist); + target = self; + } + else if (self->target != NULL && (Flags & AMF_TARGETNONPLAYER)) + { + target = self->target; } else if (self->target != NULL && self->target->player != NULL) { - P_NoiseAlert (self->target, self, false, maxdist); + target = self->target; + } + + if (Flags & AMF_EMITFROMTARGET) emitter = target; + + if (target != NULL && emitter != NULL) + { + P_NoiseAlert(target, emitter, false, maxdist); } } diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 3ba47a5c1d..73119c9413 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -180,7 +180,7 @@ ACTOR Actor native //: Thinker action native A_TurretLook(); action native A_KlaxonBlare(); action native A_Countdown(); - action native A_AlertMonsters(float maxdist = 0); + action native A_AlertMonsters(float maxdist = 0, int flags = 0); action native A_ClearSoundTarget(); action native A_FireAssaultGun(); action native A_CheckTerrain(); diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index cd9b088ab9..dee498b6a0 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -348,5 +348,12 @@ enum CLOFF_NOAIM = CLOFF_NOAIM_VERT|CLOFF_NOAIM_HORZ }; + +// Flags for A_AlertMonsters +const int AMF_TARGETEMITTER = 1; +const int AMF_TARGETNONPLAYER = 2; +const int AMF_EMITFROMTARGET = 4; + + // This is only here to provide one global variable for testing. native int testglobalvar; From ded1715625246695251c1a3adb5b996e044a732c Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Sun, 25 Aug 2013 02:11:44 +0200 Subject: [PATCH 05/20] - Merge DUMB commit d31fb2084659b64d07eb0644d9bacfd67059d066 to zdoom. Fixed C++11 compilation error on Mac OS X --- dumb/include/dumb.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dumb/include/dumb.h b/dumb/include/dumb.h index bcd2022987..cafcfea3b8 100644 --- a/dumb/include/dumb.h +++ b/dumb/include/dumb.h @@ -44,7 +44,7 @@ #define DUMB_VERSION_STR "0.9.3" -#define DUMB_NAME "DUMB v"DUMB_VERSION_STR +#define DUMB_NAME "DUMB v" DUMB_VERSION_STR #define DUMB_YEAR 2005 #define DUMB_MONTH 8 @@ -56,13 +56,13 @@ #define DUMB_DAY_STR1 "7" #if DUMB_MONTH < 10 -#define DUMB_MONTH_STR2 "0"DUMB_MONTH_STR1 +#define DUMB_MONTH_STR2 "0" DUMB_MONTH_STR1 #else #define DUMB_MONTH_STR2 DUMB_MONTH_STR1 #endif #if DUMB_DAY < 10 -#define DUMB_DAY_STR2 "0"DUMB_DAY_STR1 +#define DUMB_DAY_STR2 "0" DUMB_DAY_STR1 #else #define DUMB_DAY_STR2 DUMB_DAY_STR1 #endif @@ -74,7 +74,7 @@ */ #define DUMB_DATE (DUMB_YEAR*10000 + DUMB_MONTH*100 + DUMB_DAY) -#define DUMB_DATE_STR DUMB_DAY_STR1"."DUMB_MONTH_STR1"."DUMB_YEAR_STR4 +#define DUMB_DATE_STR DUMB_DAY_STR1 "." DUMB_MONTH_STR1 "." DUMB_YEAR_STR4 #undef MIN From 7b5084df4491d3d604a8e0e1d112fdddfaeb0a52 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Sun, 25 Aug 2013 02:21:21 +0200 Subject: [PATCH 06/20] Shut up warnings from the customized DUMB code. --- dumb/src/it/readmod.c | 4 ++-- dumb/src/it/readxm.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dumb/src/it/readmod.c b/dumb/src/it/readmod.c index 9d105f126d..801b1ce766 100644 --- a/dumb/src/it/readmod.c +++ b/dumb/src/it/readmod.c @@ -650,8 +650,8 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f, int rstrict) if ( ( rstrict & 2 ) ) { - long total_sample_size; - long remain; + int32 total_sample_size; + int32 remain; rem = f; f = dumbfile_buffer_mod_2(rem, sigdata->n_samples, sigdata->sample, &total_sample_size, &remain); if (!f) { diff --git a/dumb/src/it/readxm.c b/dumb/src/it/readxm.c index 25ca07108e..7b92cb9548 100644 --- a/dumb/src/it/readxm.c +++ b/dumb/src/it/readxm.c @@ -436,7 +436,7 @@ static int limit_xm_getc(void *f) -static long limit_xm_getnc(char *ptr, int32 n, void *f) +static int32 limit_xm_getnc(char *ptr, int32 n, void *f) { LIMITED_XM *lx = f; int left; From 5079d6c505a85c83cab04df23d811997fb78f66f Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Tue, 27 Aug 2013 20:28:38 -0400 Subject: [PATCH 07/20] - Fixed: clang 32-bit compile (I hear it still doesn't run though). - Applied edward's patch to remove boolean increment. --- src/m_fixed.h | 2 +- src/thingdef/thingdef_parse.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/m_fixed.h b/src/m_fixed.h index 61080d73d2..71b3981241 100644 --- a/src/m_fixed.h +++ b/src/m_fixed.h @@ -12,7 +12,7 @@ #include #include "doomtype.h" -#if defined(__GNUC__) && defined(__i386__) +#if defined(__GNUC__) && defined(__i386__) && !defined(__clang__) #include "gccinlines.h" #elif defined(_MSC_VER) && defined(_M_IX86) #include "mscinlines.h" diff --git a/src/thingdef/thingdef_parse.cpp b/src/thingdef/thingdef_parse.cpp index c065dfbe03..498003b4ee 100644 --- a/src/thingdef/thingdef_parse.cpp +++ b/src/thingdef/thingdef_parse.cpp @@ -867,7 +867,7 @@ static void ParseActionDef (FScanner &sc, PClass *cls) OPTIONAL = 1 }; - bool error = false; + unsigned int error = 0; const AFuncDesc *afd; FName funcname; FString args; @@ -876,8 +876,8 @@ static void ParseActionDef (FScanner &sc, PClass *cls) if (sc.LumpNum == -1 || Wads.GetLumpFile(sc.LumpNum) > 0) { - sc.ScriptMessage ("action functions can only be imported by internal class and actor definitions!"); - error++; + sc.ScriptMessage ("Action functions can only be imported by internal class and actor definitions!"); + ++error; } sc.MustGetToken(TK_Native); @@ -887,7 +887,7 @@ static void ParseActionDef (FScanner &sc, PClass *cls) if (afd == NULL) { sc.ScriptMessage ("The function '%s' has not been exported from the executable.", sc.String); - error++; + ++error; } sc.MustGetToken('('); if (!sc.CheckToken(')')) @@ -998,7 +998,7 @@ static void ParseActionDef (FScanner &sc, PClass *cls) } if (error) { - FScriptPosition::ErrorCounter++; + FScriptPosition::ErrorCounter += error; } else if (cls->Symbols.AddSymbol (sym) == NULL) { From 0a16e9a2562cb560a5459c52d6ee42d8685447f4 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Tue, 27 Aug 2013 20:42:35 -0400 Subject: [PATCH 08/20] - Fixed uninitialized variable in A_AlertMonsters. --- src/g_strife/a_strifeweapons.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index d37f0ea5ad..a410584925 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -150,7 +150,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_AlertMonsters) ACTION_PARAM_FIXED(maxdist, 0); ACTION_PARAM_INT(Flags, 1); - AActor * target; + AActor * target = NULL; AActor * emitter = self; if (self->player != NULL || (Flags & AMF_TARGETEMITTER)) From f8899f98fcb523a4e78fc739faacc81c0f8e216c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 28 Aug 2013 11:14:48 +0200 Subject: [PATCH 09/20] - fixed: The secret counter was not incremented for items that had the UDMF COUNTSECRET flag set. --- src/g_shared/a_randomspawner.cpp | 9 +++++++-- src/p_mobj.cpp | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/g_shared/a_randomspawner.cpp b/src/g_shared/a_randomspawner.cpp index 293b17d3b6..adfc09b6e6 100644 --- a/src/g_shared/a_randomspawner.cpp +++ b/src/g_shared/a_randomspawner.cpp @@ -121,7 +121,11 @@ class ARandomSpawner : public AActor AActor * newmobj = NULL; bool boss = false; Super::PostBeginPlay(); - if (Species == NAME_None) { Destroy(); return; } + if (Species == NAME_None) + { + Destroy(); + return; + } const PClass * cls = PClass::FindClass(Species); if (this->flags & MF_MISSILE && target && target->target) // Attempting to spawn a missile. { @@ -142,8 +146,9 @@ class ARandomSpawner : public AActor newmobj->args[4] = args[4]; newmobj->special1 = special1; newmobj->special2 = special2; - newmobj->SpawnFlags = SpawnFlags; + newmobj->SpawnFlags = SpawnFlags & ~MTF_SECRET; // MTF_SECRET needs special treatment to avoid incrementing the secret counter twice. It had already been processed for the spawner itself. newmobj->HandleSpawnFlags(); + newmobj->SpawnFlags = SpawnFlags; newmobj->tid = tid; newmobj->AddToHash(); newmobj->velx = velx; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 14607a6823..03bbb4d8d2 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3993,8 +3993,12 @@ void AActor::HandleSpawnFlags () } if (SpawnFlags & MTF_SECRET) { - //Printf("Secret %s in sector %i!\n", GetTag(), Sector->sectornum); - flags5 |= MF5_COUNTSECRET; + if (!(flags5 & MF5_COUNTSECRET)) + { + //Printf("Secret %s in sector %i!\n", GetTag(), Sector->sectornum); + flags5 |= MF5_COUNTSECRET; + level.total_secrets++; + } } } From 26c381224c9cd3a06f4c4836640c142cd3d1d071 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 28 Aug 2013 11:16:30 +0200 Subject: [PATCH 10/20] - removed unused constants in p_map.cpp. --- src/p_map.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index da87481d00..8b0b605c63 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -53,11 +53,6 @@ #include "r_data/r_translate.h" #include "g_level.h" -#define WATER_SINK_FACTOR 3 -#define WATER_SINK_SMALL_FACTOR 4 -#define WATER_SINK_SPEED (FRACUNIT/2) -#define WATER_JUMP_SPEED (FRACUNIT*7/2) - CVAR (Bool, cl_bloodsplats, true, CVAR_ARCHIVE) CVAR (Int, sv_smartaim, 0, CVAR_ARCHIVE|CVAR_SERVERINFO) CVAR (Bool, cl_doautoaim, false, CVAR_ARCHIVE) From 28e5cc536aa28a5b5ccad032da524d5a99d6cce3 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 29 Aug 2013 21:16:11 -0500 Subject: [PATCH 11/20] Add some awareness of short file names - Added I_GetLongPathName(). It wraps the Win32 API's GetLongPathName(). DArgs::CollectFiles() now calls this for every argument it processes, so any arguments passed using short file names will be converted to long file names. This is mainly of interest so that savegames will never record the short file name, which can change based on what else is in the directory. --- src/m_argv.cpp | 9 +++++++++ src/win32/i_system.cpp | 28 ++++++++++++++++++++++++++++ src/win32/i_system.h | 3 +++ 3 files changed, 40 insertions(+) diff --git a/src/m_argv.cpp b/src/m_argv.cpp index 54d9ffda46..816a2d54c0 100644 --- a/src/m_argv.cpp +++ b/src/m_argv.cpp @@ -35,6 +35,7 @@ #include #include "m_argv.h" #include "cmdlib.h" +#include "i_system.h" IMPLEMENT_CLASS (DArgs) @@ -391,6 +392,14 @@ void DArgs::CollectFiles(const char *param, const char *extension) } } + // Optional: Replace short path names with long path names +#ifdef _WIN32 + for (i = 0; i < work.Size(); ++i) + { + work[i] = I_GetLongPathName(work[i]); + } +#endif + // Step 3: Add work back to Argv, as long as it's non-empty. if (work.Size() > 0) { diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index b5843ec7a5..a82cb65f9c 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -1569,3 +1569,31 @@ unsigned int I_MakeRNGSeed() CryptReleaseContext(prov, 0); return seed; } + +//========================================================================== +// +// I_GetLongPathName +// +// Returns the long version of the path, or the original if there isn't +// anything worth changing. +// +//========================================================================== + +FString I_GetLongPathName(FString shortpath) +{ + DWORD buffsize = GetLongPathName(shortpath.GetChars(), NULL, 0); + if (buffsize == 0) + { // nothing to change (it doesn't exist, maybe?) + return shortpath; + } + TCHAR *buff = new TCHAR[buffsize]; + DWORD buffsize2 = GetLongPathName(shortpath.GetChars(), buff, buffsize); + if (buffsize2 >= buffsize) + { // Failure! Just return the short path + delete[] buff; + return shortpath; + } + FString longpath(buff, buffsize2); + delete[] buff; + return longpath; +} diff --git a/src/win32/i_system.h b/src/win32/i_system.h index 6bafdc01c3..9fbf2db5cb 100644 --- a/src/win32/i_system.h +++ b/src/win32/i_system.h @@ -155,6 +155,9 @@ typedef _W64 long WLONG_PTR; typedef long WLONG_PTR; #endif +// Wrapper for GetLongPathName +FString I_GetLongPathName(FString shortpath); + // Directory searching routines // Mirror WIN32_FIND_DATAA in From aac0de3e48f3d869ed3fce584cab42e68cfb3d0b Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 29 Aug 2013 21:40:01 -0500 Subject: [PATCH 12/20] Fixed: Make A_SetTics work with weapons. - When A_SetTics is called from a weapon, we need to set the tics for the psprite instead of the actor itself. --- src/thingdef/thingdef_codeptr.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 456a1d6e37..ee3e4ee2f0 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -4935,6 +4935,18 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTics) ACTION_PARAM_START(1); ACTION_PARAM_INT(tics_to_set, 0); + if (stateowner != self && self->player != NULL) + { // Is this a weapon? Need to check psp states for a match, then. Blah. + for (int i = 0; i < NUMPSPRITES; ++i) + { + if (self->player->psprites[i].state == CallingState) + { + self->player->psprites[i].tics = tics_to_set; + return; + } + } + } + // Just set tics for self. self->tics = tics_to_set; } From 7143ae49e1f4048f74000bd8390c351cecc1c719 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 29 Aug 2013 21:45:37 -0500 Subject: [PATCH 13/20] Fixed: CheckPlayerCamera not sync safe - If a player is spying through another player, CheckPlayerCamera will return the TID of the player you are "spying", but as coopspy isn't a net command, this wont be reflected by all nodes. So to fix this, CheckPlayerCamera now returns -1 if a player's camera is that of any player at all. (thanks edward850) --- src/p_acs.cpp | 2 +- src/thingdef/thingdef_codeptr.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index dc696ca45f..b707f4444c 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -8394,7 +8394,7 @@ scriptwait: { int playernum = STACK(1); - if (playernum < 0 || playernum >= MAXPLAYERS || !playeringame[playernum] || players[playernum].camera == NULL) + if (playernum < 0 || playernum >= MAXPLAYERS || !playeringame[playernum] || players[playernum].camera == NULL || players[playernum].camera->player != NULL) { STACK(1) = -1; } diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index ee3e4ee2f0..f5ef45f45c 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -4935,7 +4935,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTics) ACTION_PARAM_START(1); ACTION_PARAM_INT(tics_to_set, 0); - if (stateowner != self && self->player != NULL) + if (stateowner != self && self->player != NULL && stateowner->IsKindOf(RUNTIME_CLASS(AWeapon))) { // Is this a weapon? Need to check psp states for a match, then. Blah. for (int i = 0; i < NUMPSPRITES; ++i) { From 0f0d9da839742701da4998a51ddc3850282e0530 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 29 Aug 2013 22:22:30 -0500 Subject: [PATCH 14/20] Reset FirstFreeEntry in ACSStringPool::ReadStrings() - Fixed: When an ACS string pool was read from a savegame, FirstFreeEntry would not be updatedt, except by the Clear() function. This left FirstFreeEntry at 0, which meant the next string added to the pool would always go in slot 0, whether it was free or not. --- src/p_acs.cpp | 25 ++++++++++++++++++++----- src/p_acs.h | 1 + 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index b707f4444c..32a70cd153 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -575,11 +575,7 @@ int ACSStringPool::InsertString(FString &str, unsigned int h, unsigned int bucke } else { // Scan for the next free entry - unsigned int i; - for (i = FirstFreeEntry + 1; i < Pool.Size() && Pool[i].Next != FREE_ENTRY; ++i) - { - } - FirstFreeEntry = i; + FindFirstFreeEntry(FirstFreeEntry + 1); } PoolEntry *entry = &Pool[index]; entry->Str = str; @@ -590,6 +586,23 @@ int ACSStringPool::InsertString(FString &str, unsigned int h, unsigned int bucke return index | STRPOOL_LIBRARYID_OR; } +//============================================================================ +// +// ACSStringPool :: FindFirstFreeEntry +// +// Finds the first free entry, starting at base. +// +//============================================================================ + +void ACSStringPool::FindFirstFreeEntry(unsigned base) +{ + while (base < Pool.Size() && Pool[base].Next != FREE_ENTRY) + { + base++; + } + FirstFreeEntry = base; +} + //============================================================================ // // ACSStringPool :: ReadStrings @@ -638,6 +651,7 @@ void ACSStringPool::ReadStrings(PNGHandle *png, DWORD id) { delete[] str; } + FindFirstFreeEntry(0); } } @@ -690,6 +704,7 @@ void ACSStringPool::Dump() const Printf("%4u. (%2d) \"%s\"\n", i, Pool[i].LockCount, Pool[i].Str.GetChars()); } } + Printf("First free %u\n", FirstFreeEntry); } //============================================================================ diff --git a/src/p_acs.h b/src/p_acs.h index 1a0fb3f60c..ec41ab886c 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -100,6 +100,7 @@ public: private: int FindString(const char *str, size_t len, unsigned int h, unsigned int bucketnum); int InsertString(FString &str, unsigned int h, unsigned int bucketnum, const SDWORD *stack, int stackdepth); + void FindFirstFreeEntry(unsigned int base); enum { NUM_BUCKETS = 251 }; enum { FREE_ENTRY = 0xFFFFFFFE }; // Stored in PoolEntry's Next field From b0371e18048ac12bc469a66679945ebf67ec287e Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 30 Aug 2013 22:38:57 -0500 Subject: [PATCH 15/20] Don't abort when merely checking if a non-map is a map - When P_OpenMapData() is called by P_CheckMapData(), we don't actually care if any required lumps are missing. This just means it isn't a valid map, so don't abort with I_Error(). --- src/compatibility.cpp | 2 +- src/g_level.cpp | 2 +- src/p_setup.cpp | 20 +++++++++++++++----- src/p_setup.h | 2 +- src/statistics.cpp | 2 +- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/compatibility.cpp b/src/compatibility.cpp index 7bbff73224..dca0d34851 100644 --- a/src/compatibility.cpp +++ b/src/compatibility.cpp @@ -541,7 +541,7 @@ CCMD (mapchecksum) } for (int i = 1; i < argv.argc(); ++i) { - map = P_OpenMapData(argv[i]); + map = P_OpenMapData(argv[i], true); if (map == NULL) { Printf("Cannot load %s as a map\n", argv[i]); diff --git a/src/g_level.cpp b/src/g_level.cpp index 7e56d8843d..0b07ae2b56 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1923,7 +1923,7 @@ CCMD(listmaps) for(unsigned i = 0; i < wadlevelinfos.Size(); i++) { level_info_t *info = &wadlevelinfos[i]; - MapData *map = P_OpenMapData(info->mapname); + MapData *map = P_OpenMapData(info->mapname, true); if (map != NULL) { diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 784e6946fd..3693e9f7ea 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -250,7 +250,7 @@ static int GetMapIndex(const char *mapname, int lastindex, const char *lumpname, // //=========================================================================== -MapData *P_OpenMapData(const char * mapname) +MapData *P_OpenMapData(const char * mapname, bool justcheck) { MapData * map = new MapData; FileReader * wadReader = NULL; @@ -331,13 +331,18 @@ MapData *P_OpenMapData(const char * mapname) const char * lumpname = Wads.GetLumpFullName(lump_name + i); try { - index = GetMapIndex(mapname, index, lumpname, true); + index = GetMapIndex(mapname, index, lumpname, !justcheck); } catch(...) { delete map; throw; } + if (index == -2) + { + delete map; + return NULL; + } if (index == ML_BEHAVIOR) map->HasBehavior = true; // The next lump is not part of this map anymore @@ -471,13 +476,18 @@ MapData *P_OpenMapData(const char * mapname) { try { - index = GetMapIndex(maplabel, index, lumpname, true); + index = GetMapIndex(maplabel, index, lumpname, !justcheck); } catch(...) { delete map; throw; } + if (index == -2) + { + delete map; + return NULL; + } if (index == ML_BEHAVIOR) map->HasBehavior = true; // The next lump is not part of this map anymore @@ -508,7 +518,7 @@ MapData *P_OpenMapData(const char * mapname) bool P_CheckMapData(const char *mapname) { - MapData *mapd = P_OpenMapData(mapname); + MapData *mapd = P_OpenMapData(mapname, true); if (mapd == NULL) return false; delete mapd; return true; @@ -3610,7 +3620,7 @@ void P_SetupLevel (char *lumpname, int position) P_FreeLevelData (); interpolator.ClearInterpolations(); // [RH] Nothing to interpolate on a fresh level. - MapData *map = P_OpenMapData(lumpname); + MapData *map = P_OpenMapData(lumpname, true); if (map == NULL) { I_Error("Unable to open map '%s'\n", lumpname); diff --git a/src/p_setup.h b/src/p_setup.h index 6e0a90a1d7..4a41a76f98 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -94,7 +94,7 @@ struct MapData void GetChecksum(BYTE cksum[16]); }; -MapData * P_OpenMapData(const char * mapname); +MapData * P_OpenMapData(const char * mapname, bool justcheck); bool P_CheckMapData(const char * mapname); diff --git a/src/statistics.cpp b/src/statistics.cpp index aa8d9afc16..81cd889835 100644 --- a/src/statistics.cpp +++ b/src/statistics.cpp @@ -463,7 +463,7 @@ void STAT_ChangeLevel(const char *newl) { // we reached the end of this episode int wad = 0; - MapData * map = P_OpenMapData(StartEpisode->mEpisodeMap); + MapData * map = P_OpenMapData(StartEpisode->mEpisodeMap, false); if (map != NULL) { wad = Wads.GetLumpFile(map->lumpnum); From 260ce62175e0a6f16bcc2fa6a61c2399db7633d6 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 30 Aug 2013 23:10:20 -0500 Subject: [PATCH 16/20] Don't abort for TEXTUREx lumps that define textures with no patches - A texture defined in TEXTUREx without any patches isn't necessarily an error, so accept. This also means they shouldn't be used for determining if a TEXTURE directory belongs to Strife instead of Doom. --- src/textures/multipatchtexture.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp index 3083735a9e..fd2b59fb16 100644 --- a/src/textures/multipatchtexture.cpp +++ b/src/textures/multipatchtexture.cpp @@ -233,13 +233,13 @@ FMultiPatchTexture::FMultiPatchTexture (const void *texdef, FPatchLookup *patchl NumParts = SAFESHORT(mtexture.d->patchcount); } - if (NumParts <= 0) + if (NumParts < 0) { I_FatalError ("Bad texture directory"); } UseType = FTexture::TEX_Wall; - Parts = new TexPart[NumParts]; + Parts = NumParts > 0 ? new TexPart[NumParts] : NULL; Width = SAFESHORT(mtexture.d->width); Height = SAFESHORT(mtexture.d->height); strncpy (Name, (const char *)mtexture.d->name, 8); @@ -906,7 +906,7 @@ void FTextureManager::AddTexturesLump (const void *lumpdata, int lumpsize, int d // There is bizzarely a Doom editing tool that writes to the // first two elements of columndirectory, so I can't check those. - if (SAFESHORT(tex->patchcount) <= 0 || + if (SAFESHORT(tex->patchcount) < 0 || tex->columndirectory[2] != 0 || tex->columndirectory[3] != 0) { From ba2a07fb26fe47e4c11d9df0bcf330eec4d6b0e0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 2 Sep 2013 09:08:47 +0200 Subject: [PATCH 17/20] - removed all uses of single precision floats from FraggleScript code. --- src/fragglescript/t_func.cpp | 7 +++---- src/fragglescript/t_script.h | 2 +- src/fragglescript/t_variable.cpp | 9 +++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index 448c200d84..2513a68a82 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -73,7 +73,6 @@ static FRandom pr_script("FScript"); #define AngleToFixed(x) ((((double) x) / ((double) ANG45/45)) * FRACUNIT) #define FixedToAngle(x) ((((double) x) / FRACUNIT) * ANG45/45) -#define FIXED_TO_FLOAT(f) ((f)/(float)FRACUNIT) // functions. FParser::SF_ means Script Function not, well.. heh, me @@ -1417,11 +1416,11 @@ void FParser::SF_PointToDist(void) if (CheckArgs(4)) { // Doing this in floating point is actually faster with modern computers! - float x = floatvalue(t_argv[2]) - floatvalue(t_argv[0]); - float y = floatvalue(t_argv[3]) - floatvalue(t_argv[1]); + double x = floatvalue(t_argv[2]) - floatvalue(t_argv[0]); + double y = floatvalue(t_argv[3]) - floatvalue(t_argv[1]); t_return.type = svt_fixed; - t_return.value.f = (fixed_t)(sqrtf(x*x+y*y)*65536.f); + t_return.value.f = FLOAT2FIXED(sqrt(x*x+y*y)*65536.f); } } diff --git a/src/fragglescript/t_script.h b/src/fragglescript/t_script.h index e3db7da3db..ffa2dae3c5 100644 --- a/src/fragglescript/t_script.h +++ b/src/fragglescript/t_script.h @@ -110,7 +110,7 @@ struct svalue_t int intvalue(const svalue_t & v); fixed_t fixedvalue(const svalue_t & v); -float floatvalue(const svalue_t & v); +double floatvalue(const svalue_t & v); const char *stringvalue(const svalue_t & v); AActor *actorvalue(const svalue_t &svalue); diff --git a/src/fragglescript/t_variable.cpp b/src/fragglescript/t_variable.cpp index 7326fe4eb1..7076a395b9 100644 --- a/src/fragglescript/t_variable.cpp +++ b/src/fragglescript/t_variable.cpp @@ -89,11 +89,12 @@ fixed_t fixedvalue(const svalue_t &v) // //========================================================================== -float floatvalue(const svalue_t &v) +double floatvalue(const svalue_t &v) { - return (float)( (v.type == svt_string ? atof(v.string) : - v.type == svt_fixed ? (float)(v.value.f / (float)FRACUNIT) : - v.type == svt_mobj ? -1.f : (float)v.value.i )); + return + v.type == svt_string ? atof(v.string) : + v.type == svt_fixed ? FIXED2DBL(v.value.f) : + v.type == svt_mobj ? -1. : (double)v.value.i; } //========================================================================== From b6baeecd9a18c5e0cb46e58059f52672a16e83e4 Mon Sep 17 00:00:00 2001 From: Alex Qyoun-ae Date: Tue, 3 Sep 2013 03:49:39 +0400 Subject: [PATCH 18/20] Fixed compilation with LLVM compilers --- src/sdl/i_system.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index def35606a4..ba126bf541 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -699,7 +699,7 @@ bool I_WriteIniFailed () static const char *pattern; -#ifdef __APPLE__ +#if defined(__APPLE__) && !defined(__llvm__) static int matchfile (struct dirent *ent) #else static int matchfile (const struct dirent *ent) From 75dd5503cf953238e749d075673d0bb6a6fe0691 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 3 Sep 2013 08:24:47 +0200 Subject: [PATCH 19/20] - fixed: Cost strings for dialogues must not be added in the dialogue parser but while displaying the message to properly handle stringtable entries. --- src/p_conversation.cpp | 5 ++++- src/p_usdf.cpp | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 350c464789..e51389ce8d 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -752,7 +752,10 @@ public: { ReplyText = GStrings(ReplyText + 1); } - FBrokenLines *ReplyLines = V_BreakLines (SmallFont, 320-50-10, ReplyText); + FString ReplyString = ReplyText; + if (reply->NeedsGold) ReplyString.AppendFormat(" for %u", reply->ItemCheck[0].Amount); + + FBrokenLines *ReplyLines = V_BreakLines (SmallFont, 320-50-10, ReplyString); mResponses.Push(mResponseLines.Size()); for (j = 0; ReplyLines[j].Width >= 0; ++j) diff --git a/src/p_usdf.cpp b/src/p_usdf.cpp index 95c8f5dc04..6ea32b3085 100644 --- a/src/p_usdf.cpp +++ b/src/p_usdf.cpp @@ -224,7 +224,6 @@ class USDFParser : public UDMFParserBase if (reply->ItemCheck.Size() > 0) { if (reply->ItemCheck[0].Amount <= 0) reply->NeedsGold = false; - if (reply->NeedsGold) ReplyString.AppendFormat(" for %u", reply->ItemCheck[0].Amount); } reply->Reply = ncopystring(ReplyString); From 11c026ee840684333327e307673bd0f48332704a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 3 Sep 2013 08:34:55 +0200 Subject: [PATCH 20/20] - fixed: displaying sprites on the automap ignored both the actor's scale and translation. --- src/am_map.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 610ba48253..ad34995d0a 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -2388,10 +2388,11 @@ void AM_drawThings () if (texture == NULL) goto drawTriangle; // fall back to standard display if no sprite can be found. - const fixed_t spriteScale = 10 * scale_mtof; + const fixed_t spriteXScale = FixedMul(t->scaleX, 10 * scale_mtof); + const fixed_t spriteYScale = FixedMul(t->scaleY, 10 * scale_mtof); DrawMarker (texture, p.x, p.y, 0, !!(frame->Flip & (1 << rotation)), - spriteScale, spriteScale, 0, FRACUNIT, 0, LegacyRenderStyles[STYLE_Normal]); + spriteXScale, spriteYScale, t->Translation, FRACUNIT, 0, LegacyRenderStyles[STYLE_Normal]); } else {