From 2afac5c716145715c989a92251b2854e9629b394 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 29 Jun 2008 08:42:07 +0000 Subject: [PATCH] - Changed: I_Error and I_FatalError now use ZDoom's internal string formatting code to process their messages. This was necessary to handle the %zu format option used in some memory allocation failure messages. - Fixed: The flat texture scaling action specials were completely broken. SVN r1056 (trunk) --- docs/rh-log.txt | 24 +++++++++++-------- src/p_lnspec.cpp | 52 +++++++++++++++++++++--------------------- src/win32/i_system.cpp | 18 ++++++++++++--- 3 files changed, 56 insertions(+), 38 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index c85cceba8..40ae111d1 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,12 +1,8 @@ -June 28, 2008 (Changes by Graf Zahl) -- Removed some unused constant definitions from sc_man.cpp. -- Fixed: A_FireBlasterPL2 played the weapon sound with the missile as origin - instead of the shooting player. -- Fixed: Dead players didn't get the MF_CORPSE flag set. -- Fixed: The internal definition of Floor_LowerToNearest had incorrect parameter - settings. -- Fixed: Heretic's ActivatedTimeBomb had the same spawn ID as the inventory item. -- fixed: Heretic's mace did not have its spawn ID set. +June 29, 2008 (Changes by Graf Zahl) +- Changed: I_Error and I_FatalError now use ZDoom's internal string formatting + code to process their messages. This was necessary to handle the %zu format + option used in some memory allocation failure messages. +- Fixed: The flat texture scaling action specials were completely broken. June 28, 2008 - The sound code now handles restarting looping sounds itself. As far as @@ -34,6 +30,16 @@ June 28, 2008 to dump them now, which leaves the movie player in a totally unworkable state. +June 28, 2008 (Changes by Graf Zahl) +- Removed some unused constant definitions from sc_man.cpp. +- Fixed: A_FireBlasterPL2 played the weapon sound with the missile as origin + instead of the shooting player. +- Fixed: Dead players didn't get the MF_CORPSE flag set. +- Fixed: The internal definition of Floor_LowerToNearest had incorrect parameter + settings. +- Fixed: Heretic's ActivatedTimeBomb had the same spawn ID as the inventory item. +- fixed: Heretic's mace did not have its spawn ID set. + June 26, 2008 - Changed S_Sound() to take the same floating point attenuation that the internal S_StartSound() uses. Now ambient sounds can use the public diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index cfe7ac87c..59ae2af2d 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -2181,6 +2181,28 @@ FUNC(LS_Sector_SetFloorPanning) return true; } +FUNC(LS_Sector_SetFloorScale) +// Sector_SetFloorScale (tag, x-int, x-frac, y-int, y-frac) +{ + int secnum = -1; + fixed_t xscale = arg1 * FRACUNIT + arg2 * (FRACUNIT/100); + fixed_t yscale = arg3 * FRACUNIT + arg4 * (FRACUNIT/100); + + if (xscale) + xscale = FixedDiv (FRACUNIT, xscale); + if (yscale) + yscale = FixedDiv (FRACUNIT, yscale); + + while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0) + { + if (xscale) + sectors[secnum].SetXScale(sector_t::floor, xscale); + if (yscale) + sectors[secnum].SetYScale(sector_t::floor, yscale); + } + return true; +} + FUNC(LS_Sector_SetCeilingScale) // Sector_SetCeilingScale (tag, x-int, x-frac, y-int, y-frac) { @@ -2196,9 +2218,9 @@ FUNC(LS_Sector_SetCeilingScale) while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0) { if (xscale) - sectors[secnum].SetXScale(sector_t::ceiling, arg1); + sectors[secnum].SetXScale(sector_t::ceiling, xscale); if (yscale) - sectors[secnum].SetYScale(sector_t::ceiling, arg2); + sectors[secnum].SetYScale(sector_t::ceiling, yscale); } return true; } @@ -2218,7 +2240,7 @@ FUNC(LS_Sector_SetFloorScale2) if (arg1) sectors[secnum].SetXScale(sector_t::floor, arg1); if (arg2) - sectors[secnum].SetXScale(sector_t::floor, arg1); + sectors[secnum].SetYScale(sector_t::floor, arg2); } return true; } @@ -2238,29 +2260,7 @@ FUNC(LS_Sector_SetCeilingScale2) if (arg1) sectors[secnum].SetXScale(sector_t::ceiling, arg1); if (arg2) - sectors[secnum].SetXScale(sector_t::ceiling, arg1); - } - return true; -} - -FUNC(LS_Sector_SetFloorScale) -// Sector_SetFloorScale (tag, x-int, x-frac, y-int, y-frac) -{ - int secnum = -1; - fixed_t xscale = arg1 * FRACUNIT + arg2 * (FRACUNIT/100); - fixed_t yscale = arg3 * FRACUNIT + arg4 * (FRACUNIT/100); - - if (xscale) - xscale = FixedDiv (FRACUNIT, xscale); - if (yscale) - yscale = FixedDiv (FRACUNIT, yscale); - - while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0) - { - if (xscale) - sectors[secnum].SetXScale(sector_t::floor, arg1); - if (yscale) - sectors[secnum].SetXScale(sector_t::floor, arg1); + sectors[secnum].SetYScale(sector_t::ceiling, arg2); } return true; } diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 7ba365ad6..bf42589c9 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -515,6 +515,19 @@ void I_Quit (void) extern FILE *Logfile; bool gameisdead; +// We should use ZDoom's internal formatting routine here so that the extended +// format specifiers work here as well. +// However, since throwing FStrings around causes some problems in VC++ the +// error message is still copied to a local buffer. +static void myvsnprintf(char *DstBuf, size_t MaxCount, const char * Format, va_list ArgList) +{ + FString formatstr; + + formatstr.VFormat(Format, ArgList); + strncpy(DstBuf, formatstr.GetChars(), MaxCount); + DstBuf[MaxCount-1] = 0; +} + void STACK_ARGS I_FatalError (const char *error, ...) { static BOOL alreadyThrown = false; @@ -524,10 +537,9 @@ void STACK_ARGS I_FatalError (const char *error, ...) { alreadyThrown = true; char errortext[MAX_ERRORTEXT]; - int index; va_list argptr; va_start (argptr, error); - index = vsprintf (errortext, error, argptr); + myvsnprintf (errortext, MAX_ERRORTEXT, error, argptr); va_end (argptr); // Record error to log (if logging) @@ -550,7 +562,7 @@ void STACK_ARGS I_Error (const char *error, ...) char errortext[MAX_ERRORTEXT]; va_start (argptr, error); - vsprintf (errortext, error, argptr); + myvsnprintf (errortext, MAX_ERRORTEXT, error, argptr); va_end (argptr); throw CRecoverableError (errortext);