From ef08e29d51fdbfdbf59c22ba1cdd694470016880 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 10 Apr 2016 12:33:35 +0200 Subject: [PATCH 01/10] - remove windows header #include from gameconfigfile.cpp, because it isn't needed. --- src/gameconfigfile.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index f162e932a7..e6a0f99350 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -39,13 +39,6 @@ #include #endif -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#include -extern HWND Window; -#define USE_WINDOWS_DWORD -#endif - #include "doomdef.h" #include "gameconfigfile.h" #include "c_cvars.h" From 12129b0f074745f15d97f27d9d3e6aa5189a99c0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 10 Apr 2016 13:03:44 +0200 Subject: [PATCH 02/10] - added a system-include independent wrapper for Windows's OutputDebugString, so that this can be used more easily in files that cannot include windows.h. --- src/oplsynth/music_opl_mididevice.cpp | 3 ++- src/posix/cocoa/i_system.mm | 6 ++++++ src/posix/i_system.h | 2 ++ src/posix/sdl/i_system.cpp | 4 ++++ src/sound/music_softsynth_mididevice.cpp | 3 ++- src/timidity/timidity.cpp | 7 +------ src/win32/i_system.cpp | 5 +++++ src/win32/i_system.h | 2 ++ 8 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/oplsynth/music_opl_mididevice.cpp b/src/oplsynth/music_opl_mididevice.cpp index 3939aa8143..3cd3e625a4 100644 --- a/src/oplsynth/music_opl_mididevice.cpp +++ b/src/oplsynth/music_opl_mididevice.cpp @@ -41,13 +41,14 @@ #include "m_swap.h" #include "w_wad.h" #include "v_text.h" +#include "i_system.h" #include "opl.h" // MACROS ------------------------------------------------------------------ #if defined(_DEBUG) && defined(_WIN32) && defined(_MSC_VER) #define DEBUGOUT(m,c,s,t) \ - { char foo[128]; mysnprintf(foo, countof(foo), m, c, s, t); OutputDebugString(foo); } + { char foo[128]; mysnprintf(foo, countof(foo), m, c, s, t); I_DebugPrint(foo); } #else #define DEBUGOUT(m,c,s,t) #endif diff --git a/src/posix/cocoa/i_system.mm b/src/posix/cocoa/i_system.mm index 07e85281ba..6224228ada 100644 --- a/src/posix/cocoa/i_system.mm +++ b/src/posix/cocoa/i_system.mm @@ -183,6 +183,12 @@ void I_SetIWADInfo() } +void I_DebugPrint(const char *cp) +{ + NSLog(@"%s", cp); +} + + void I_PrintStr(const char* const message) { FConsoleWindow::GetInstance().AddText(message); diff --git a/src/posix/i_system.h b/src/posix/i_system.h index 0515f2d857..5051b19c1b 100644 --- a/src/posix/i_system.h +++ b/src/posix/i_system.h @@ -111,6 +111,8 @@ void addterm (void (*func)(void), const char *name); #define atterm(t) addterm (t, #t) void popterm (); +void I_DebugPrint (const char *cp); + // Print a console string void I_PrintStr (const char *str); diff --git a/src/posix/sdl/i_system.cpp b/src/posix/sdl/i_system.cpp index 84b9537177..5cf5bf280f 100644 --- a/src/posix/sdl/i_system.cpp +++ b/src/posix/sdl/i_system.cpp @@ -232,6 +232,10 @@ void I_SetIWADInfo () { } +void I_DebugPrint(const char *cp) +{ +} + void I_PrintStr (const char *cp) { // Strip out any color escape sequences before writing to the log file diff --git a/src/sound/music_softsynth_mididevice.cpp b/src/sound/music_softsynth_mididevice.cpp index 9897da95c7..6bde3edf68 100644 --- a/src/sound/music_softsynth_mididevice.cpp +++ b/src/sound/music_softsynth_mididevice.cpp @@ -40,6 +40,7 @@ #include "m_swap.h" #include "w_wad.h" #include "v_text.h" +#include "i_system.h" // MACROS ------------------------------------------------------------------ @@ -337,7 +338,7 @@ int SoftSynthMIDIDevice::PlayTick() char buffer[128]; mysnprintf(buffer, countof(buffer), "C%02d: %11s %3d %3d\n", (status & 15) + 1, commands[(status >> 4) & 7], parm1, parm2); #ifdef _WIN32 - OutputDebugString(buffer); + I_DebugPrint(buffer); #else fputs(buffer, stderr); #endif diff --git a/src/timidity/timidity.cpp b/src/timidity/timidity.cpp index efebcd284f..4ca2b872e3 100644 --- a/src/timidity/timidity.cpp +++ b/src/timidity/timidity.cpp @@ -782,11 +782,6 @@ void Renderer::MarkInstrument(int banknum, int percussion, int instr) } } -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#include -#endif - void cmsg(int type, int verbosity_level, const char *fmt, ...) { /* @@ -801,7 +796,7 @@ void cmsg(int type, int verbosity_level, const char *fmt, ...) va_start(args, fmt); vsprintf(buf, fmt, args); va_end(args); - OutputDebugString(buf); + I_DebugPrint(buf); #endif } diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index ebf90e476d..98eaf669c9 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -1051,6 +1051,11 @@ static void DoPrintStr(const char *cp, HWND edit, HANDLE StdOut) static TArray bufferedConsoleStuff; +void I_DebugPrint(const char *cp) +{ + OutputDebugStringA(cp); +} + void I_PrintStr(const char *cp) { if (con_debugoutput) diff --git a/src/win32/i_system.h b/src/win32/i_system.h index 8e75b22a3f..6bee888f2d 100644 --- a/src/win32/i_system.h +++ b/src/win32/i_system.h @@ -145,6 +145,8 @@ bool I_SetCursor(FTexture *cursor); // Repaint the pre-game console void I_PaintConsole (void); +void I_DebugPrint (const char *cp); + // Print a console string void I_PrintStr (const char *cp); From 9cc873ecdd57e13feed842d009fbfe660f5fc96b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 10 Apr 2016 13:08:54 +0200 Subject: [PATCH 03/10] - enable use of precompiled headers for MSVC. Thanks to a small CMake script I recently found this could be done non-invasively. Due to the VC++ 2015 headers being rather bloated (the average include size per source is 400-500kb) this provides a noticable compile speedup, although right now this only covers the game code, so there should be more room for improvement. --- precompiled_headers.cmake | 34 ++++++++++++++++++++ src/CMakeLists.txt | 66 ++++++++++++++++++++++----------------- 2 files changed, 71 insertions(+), 29 deletions(-) create mode 100644 precompiled_headers.cmake diff --git a/precompiled_headers.cmake b/precompiled_headers.cmake new file mode 100644 index 0000000000..0130c15339 --- /dev/null +++ b/precompiled_headers.cmake @@ -0,0 +1,34 @@ +# +# Christoph Heindl 2010 +# Precompiled Headers Demo +# http://cheind.wordpress.com +# + +# Instructs the MSVC toolset to use the precompiled header PRECOMPILED_HEADER +# for each source file given in the collection named by SOURCE_VARIABLE_NAME. +function(enable_precompiled_headers PRECOMPILED_HEADER SOURCE_VARIABLE_NAME) + if(MSVC) + set(files ${${SOURCE_VARIABLE_NAME}}) + + # Generate precompiled header translation unit + get_filename_component(pch_basename ${PRECOMPILED_HEADER} NAME_WE) + set(pch_abs ${CMAKE_CURRENT_SOURCE_DIR}/${PRECOMPILED_HEADER}) + set(pch_unity ${CMAKE_CURRENT_BINARY_DIR}/${pch_basename}.cpp) + FILE(WRITE ${pch_unity} "// Precompiled header unity generated by CMake\n") + FILE(APPEND ${pch_unity} "#include <${pch_abs}>\n") + set_source_files_properties(${pch_unity} PROPERTIES COMPILE_FLAGS "/Yc\"${pch_abs}\"") + + # Update properties of source files to use the precompiled header. + # Additionally, force the inclusion of the precompiled header at beginning of each source file. + foreach(source_file ${files} ) + set_source_files_properties( + ${source_file} + PROPERTIES COMPILE_FLAGS + "/Yu\"${pch_abs}\" /FI\"${pch_abs}\"" + ) + endforeach(source_file) + + # Finally, update the source file collection to contain the precompiled header translation unit + set(${SOURCE_VARIABLE_NAME} ${${SOURCE_VARIABLE_NAME}} ${pch_unity} PARENT_SCOPE) + endif(MSVC) +endfunction(enable_precompiled_headers) \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6900202492..bbd3a0d80d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required( VERSION 2.8.7 ) +include(../precompiled_headers.cmake) + if( COMMAND cmake_policy ) cmake_policy( SET CMP0003 NEW ) endif() @@ -959,15 +961,8 @@ set( FASTMATH_SOURCES r_data/colormaps.cpp r_data/r_translate.cpp ) -add_executable( zdoom WIN32 MACOSX_BUNDLE - ${HEADER_FILES} - ${NOT_COMPILED_SOURCE_FILES} - __autostart.cpp - ${ASM_SOURCES} - ${SYSTEM_SOURCES} - ${X86_SOURCES} - ${FASTMATH_SOURCES} - x86.cpp + +set (PCH_SOURCES actorptrselect.cpp am_map.cpp b_bot.cpp @@ -1028,7 +1023,6 @@ add_executable( zdoom WIN32 MACOSX_BUNDLE m_misc.cpp m_png.cpp m_random.cpp - m_specialpaths.cpp memarena.cpp md5.cpp name.cpp @@ -1090,7 +1084,6 @@ add_executable( zdoom WIN32 MACOSX_BUNDLE statistics.cpp stats.cpp stringtable.cpp - strnatcmp.c tables.cpp teaminfo.cpp tempfiles.cpp @@ -1105,7 +1098,6 @@ add_executable( zdoom WIN32 MACOSX_BUNDLE w_wad.cpp wi_stuff.cpp zstrformat.cpp - zstring.cpp g_doom/a_doommisc.cpp g_heretic/a_hereticmisc.cpp g_hexen/a_hexenmisc.cpp @@ -1149,22 +1141,6 @@ add_executable( zdoom WIN32 MACOSX_BUNDLE g_shared/sbar_mugshot.cpp g_shared/shared_hud.cpp g_shared/shared_sbar.cpp - math/asin.c - math/atan.c - math/const.c - math/cosh.c - math/exp.c - math/isnan.c - math/log.c - math/log10.c - math/mtherr.c - math/polevl.c - math/sin.c - math/sinh.c - math/sqrt.c - math/tan.c - math/tanh.c - math/fastsin.cpp resourcefiles/ancientzip.cpp resourcefiles/file_7z.cpp resourcefiles/file_grp.cpp @@ -1175,7 +1151,6 @@ add_executable( zdoom WIN32 MACOSX_BUNDLE resourcefiles/file_pak.cpp resourcefiles/file_directory.cpp resourcefiles/resourcefile.cpp - sfmt/SFMT.cpp textures/animations.cpp textures/anim_switches.cpp textures/automaptexture.cpp @@ -1228,6 +1203,39 @@ add_executable( zdoom WIN32 MACOSX_BUNDLE zscript/zcc_compile.cpp zscript/zcc_expr.cpp zscript/zcc_parser.cpp +) +enable_precompiled_headers( g_pch.h PCH_SOURCES ) + +add_executable( zdoom WIN32 MACOSX_BUNDLE + ${HEADER_FILES} + ${NOT_COMPILED_SOURCE_FILES} + __autostart.cpp + ${ASM_SOURCES} + ${SYSTEM_SOURCES} + ${X86_SOURCES} + ${FASTMATH_SOURCES} + ${PCH_SOURCES} + x86.cpp + m_specialpaths.cpp + strnatcmp.c + zstring.cpp + math/asin.c + math/atan.c + math/const.c + math/cosh.c + math/exp.c + math/isnan.c + math/log.c + math/log10.c + math/mtherr.c + math/polevl.c + math/sin.c + math/sinh.c + math/sqrt.c + math/tan.c + math/tanh.c + math/fastsin.cpp + sfmt/SFMT.cpp zzautozend.cpp ) From 08b0be11a6dd080cbce4a1a0286c9dfb700863f6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 10 Apr 2016 13:10:41 +0200 Subject: [PATCH 04/10] - add the precompiled header file for the previous commit. --- src/g_pch.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/g_pch.h diff --git a/src/g_pch.h b/src/g_pch.h new file mode 100644 index 0000000000..3f44cf9b54 --- /dev/null +++ b/src/g_pch.h @@ -0,0 +1,20 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include From fe973ba442c8b2864d2ca2d54dd9482c47555e4e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 10 Apr 2016 13:54:42 +0200 Subject: [PATCH 05/10] - tried to add precompiled headers to fastmath sources as well, but VC++ doesn't seem to want to play along. So I left this stuff in but disabled the precompilation until a solution can be found. --- src/CMakeLists.txt | 49 ++++++++++++++++++++++++++-------------------- src/g_pch2.h | 22 +++++++++++++++++++++ 2 files changed, 50 insertions(+), 21 deletions(-) create mode 100644 src/g_pch2.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bbd3a0d80d..19f7c9c197 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -877,8 +877,7 @@ set( NOT_COMPILED_SOURCE_FILES asm_x86_64/tmap3.s ) -# Enable fast math for some sources -set( FASTMATH_SOURCES +set( FASTMATH_PCH_SOURCES r_swrenderer.cpp r_3dfloors.cpp r_bsp.cpp @@ -914,12 +913,35 @@ set( FASTMATH_SOURCES oplsynth/fmopl.cpp oplsynth/mlopl.cpp oplsynth/mlopl_io.cpp - oplsynth/music_opldumper_mididevice.cpp - oplsynth/music_opl_mididevice.cpp - oplsynth/opl_mus_player.cpp oplsynth/dosbox/opl.cpp oplsynth/OPL3.cpp oplsynth/nukedopl3.cpp + timidity/common.cpp + timidity/instrum.cpp + timidity/instrum_dls.cpp + timidity/instrum_font.cpp + timidity/instrum_sf2.cpp + timidity/mix.cpp + timidity/playmidi.cpp + timidity/resample.cpp + timidity/timidity.cpp + wildmidi/file_io.cpp + wildmidi/gus_pat.cpp + wildmidi/reverb.cpp + wildmidi/wm_error.cpp + r_data/colormaps.cpp + r_data/r_translate.cpp +) +# This is disabled for now because I cannot find a way to give the .pch file a different name. +# Visual C++ 2015 seems hell-bent of only allowing one .pch file with the same name as the executable. +#enable_precompiled_headers( g_pch2.h FASTMATH_PCH_SOURCES ) + +# Enable fast math for some sources +set( FASTMATH_SOURCES + ${FASTMATH_PCH_SOURCES} + oplsynth/music_opldumper_mididevice.cpp + oplsynth/music_opl_mididevice.cpp + oplsynth/opl_mus_player.cpp sound/fmodsound.cpp sound/i_music.cpp sound/i_sound.cpp @@ -944,22 +966,7 @@ set( FASTMATH_SOURCES sound/oalsound.cpp sound/sndfile_decoder.cpp sound/music_pseudo_mididevice.cpp - timidity/common.cpp - timidity/instrum.cpp - timidity/instrum_dls.cpp - timidity/instrum_font.cpp - timidity/instrum_sf2.cpp - timidity/mix.cpp - timidity/playmidi.cpp - timidity/resample.cpp - timidity/timidity.cpp - wildmidi/file_io.cpp - wildmidi/gus_pat.cpp - wildmidi/reverb.cpp wildmidi/wildmidi_lib.cpp - wildmidi/wm_error.cpp - r_data/colormaps.cpp - r_data/r_translate.cpp ) set (PCH_SOURCES @@ -1195,6 +1202,7 @@ set (PCH_SOURCES r_data/voxels.cpp r_data/renderstyle.cpp r_data/r_interpolate.cpp + sfmt/SFMT.cpp zscript/ast.cpp zscript/vmbuilder.cpp zscript/vmdisasm.cpp @@ -1235,7 +1243,6 @@ add_executable( zdoom WIN32 MACOSX_BUNDLE math/tan.c math/tanh.c math/fastsin.cpp - sfmt/SFMT.cpp zzautozend.cpp ) diff --git a/src/g_pch2.h b/src/g_pch2.h new file mode 100644 index 0000000000..4cd69197e0 --- /dev/null +++ b/src/g_pch2.h @@ -0,0 +1,22 @@ +// This is separate because the files being compiled with it use different compiler settings which may affect how the header is compiled +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include From 93c334059a8334eecf27779125e0c6ffc114c0b9 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 10 Apr 2016 11:50:12 +0300 Subject: [PATCH 06/10] Made title text always visible in OS X startup window Added temporary solution for the same foreground and background colors of the title in OS X startup window It's used in graphical startup screen, with Hexen style in particular (for example WolfenDoom - Blade of Agony) Native OS X backend doesn't implement this yet --- src/posix/cocoa/st_console.mm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/posix/cocoa/st_console.mm b/src/posix/cocoa/st_console.mm index b595023987..5d82551bc1 100644 --- a/src/posix/cocoa/st_console.mm +++ b/src/posix/cocoa/st_console.mm @@ -363,6 +363,15 @@ void FConsoleWindow::SetTitleText() textViewFrame.size.width, TITLE_TEXT_HEIGHT); + // Temporary solution for the same foreground and background colors + // It's used in graphical startup screen, with Hexen style in particular + // Native OS X backend doesn't implement this yet + + if (DoomStartupInfo.FgColor == DoomStartupInfo.BkColor) + { + DoomStartupInfo.FgColor = ~DoomStartupInfo.FgColor; + } + NSTextField* titleText = [[NSTextField alloc] initWithFrame:titleTextRect]; [titleText setStringValue:[NSString stringWithUTF8String:DoomStartupInfo.Name]]; [titleText setAlignment:NSCenterTextAlignment]; From c12a85ee85f17ff823cf64c855b435cd4caca733 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 10 Apr 2016 18:14:01 +0200 Subject: [PATCH 07/10] - removed some unused content from p_spec.h --- src/p_spec.h | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/src/p_spec.h b/src/p_spec.h index 75a1814202..eda0a08206 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -71,9 +71,6 @@ typedef enum // (This is so scrolling floors and objects on them can move at same speed.) const double CARRYFACTOR = 3 / 32.; -// Define values for map objects -#define MO_TELEPORTMAN 14 - // Flags for P_SectorDamage #define DAMAGE_PLAYERS 1 #define DAMAGE_NONPLAYERS 2 @@ -87,7 +84,6 @@ const double CARRYFACTOR = 3 / 32.; bool CheckIfExitIsGood (AActor *self, level_info_t *info); // at map load -void P_InitSectorSpecial(sector_t *sector, int special); void P_SpawnSpecials (void); // every tic @@ -105,39 +101,6 @@ void P_SetSectorFriction (int tag, int amount, bool alterFlag); double FrictionToMoveFactor(double friction); void P_GiveSecret(AActor *actor, bool printmessage, bool playsound, int sectornum); -// -// getSide() -// Will return a side_t* -// given the number of the current sector, -// the line number, and the side (0/1) that you want. -// -inline side_t *getSide (int currentSector, int line, int side) -{ - return (sectors[currentSector].lines[line])->sidedef[side]; -} - -// -// getSector() -// Will return a sector_t* -// given the number of the current sector, -// the line number and the side (0/1) that you want. -// -inline sector_t *getSector (int currentSector, int line, int side) -{ - return (sectors[currentSector].lines[line])->sidedef[side]->sector; -} - - -// -// twoSided() -// Given the sector number and the line number, -// it will tell you whether the line is two-sided or not. -// -inline int twoSided (int sector, int line) -{ - return (sectors[sector].lines[line])->flags & ML_TWOSIDED; -} - // // getNextSector() // Return sector_t * of sector next to current. From 76c18820cb2a0432b8902567eba1e3194b0418bf Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 10 Apr 2016 18:29:23 +0200 Subject: [PATCH 08/10] - moved the declarations for the lighting thinkers to p_light.cpp. Aside from the init function they are not needed anywhere else and that could also be placed into this file. --- src/p_lights.cpp | 185 +++++++++++++++++++++++++++++++++++++++++++++++ src/p_spec.cpp | 42 +---------- src/p_spec.h | 133 +--------------------------------- 3 files changed, 190 insertions(+), 170 deletions(-) diff --git a/src/p_lights.cpp b/src/p_lights.cpp index bd2535c819..10bf9edf40 100644 --- a/src/p_lights.cpp +++ b/src/p_lights.cpp @@ -42,6 +42,131 @@ static FRandom pr_lightflash ("LightFlash"); static FRandom pr_strobeflash ("StrobeFlash"); static FRandom pr_fireflicker ("FireFlicker"); + +class DFireFlicker : public DLighting +{ + DECLARE_CLASS(DFireFlicker, DLighting) +public: + DFireFlicker(sector_t *sector); + DFireFlicker(sector_t *sector, int upper, int lower); + void Serialize(FArchive &arc); + void Tick(); +protected: + int m_Count; + int m_MaxLight; + int m_MinLight; +private: + DFireFlicker(); +}; + +class DFlicker : public DLighting +{ + DECLARE_CLASS(DFlicker, DLighting) +public: + DFlicker(sector_t *sector, int upper, int lower); + void Serialize(FArchive &arc); + void Tick(); +protected: + int m_Count; + int m_MaxLight; + int m_MinLight; +private: + DFlicker(); +}; + +class DLightFlash : public DLighting +{ + DECLARE_CLASS(DLightFlash, DLighting) +public: + DLightFlash(sector_t *sector); + DLightFlash(sector_t *sector, int min, int max); + void Serialize(FArchive &arc); + void Tick(); +protected: + int m_Count; + int m_MaxLight; + int m_MinLight; + int m_MaxTime; + int m_MinTime; +private: + DLightFlash(); +}; + +class DStrobe : public DLighting +{ + DECLARE_CLASS(DStrobe, DLighting) +public: + DStrobe(sector_t *sector, int utics, int ltics, bool inSync); + DStrobe(sector_t *sector, int upper, int lower, int utics, int ltics); + void Serialize(FArchive &arc); + void Tick(); +protected: + int m_Count; + int m_MinLight; + int m_MaxLight; + int m_DarkTime; + int m_BrightTime; +private: + DStrobe(); +}; + +class DGlow : public DLighting +{ + DECLARE_CLASS(DGlow, DLighting) +public: + DGlow(sector_t *sector); + void Serialize(FArchive &arc); + void Tick(); +protected: + int m_MinLight; + int m_MaxLight; + int m_Direction; +private: + DGlow(); +}; + +// [RH] Glow from Light_Glow and Light_Fade specials +class DGlow2 : public DLighting +{ + DECLARE_CLASS(DGlow2, DLighting) +public: + DGlow2(sector_t *sector, int start, int end, int tics, bool oneshot); + void Serialize(FArchive &arc); + void Tick(); +protected: + int m_Start; + int m_End; + int m_MaxTics; + int m_Tics; + bool m_OneShot; +private: + DGlow2(); +}; + +// [RH] Phased light thinker +class DPhased : public DLighting +{ + DECLARE_CLASS(DPhased, DLighting) +public: + DPhased(sector_t *sector); + DPhased(sector_t *sector, int baselevel, int phase); + void Serialize(FArchive &arc); + void Tick(); +protected: + BYTE m_BaseLevel; + BYTE m_Phase; +private: + DPhased(); + DPhased(sector_t *sector, int baselevel); + int PhaseHelper(sector_t *sector, int index, int light, sector_t *prev); +}; + +#define GLOWSPEED 8 +#define STROBEBRIGHT 5 +#define FASTDARK 15 +#define SLOWDARK TICRATE + + //----------------------------------------------------------------------------- // // @@ -845,3 +970,63 @@ void EV_StopLightEffect (int tag) } } } + + +void P_SpawnLights(sector_t *sector) +{ + switch (sector->special) + { + case Light_Phased: + new DPhased(sector, 48, 63 - (sector->lightlevel & 63)); + break; + + // [RH] Hexen-like phased lighting + case LightSequenceStart: + new DPhased(sector); + break; + + case dLight_Flicker: + new DLightFlash(sector); + break; + + case dLight_StrobeFast: + new DStrobe(sector, STROBEBRIGHT, FASTDARK, false); + break; + + case dLight_StrobeSlow: + new DStrobe(sector, STROBEBRIGHT, SLOWDARK, false); + break; + + case dLight_Strobe_Hurt: + new DStrobe(sector, STROBEBRIGHT, FASTDARK, false); + break; + + case dLight_Glow: + new DGlow(sector); + break; + + case dLight_StrobeSlowSync: + new DStrobe(sector, STROBEBRIGHT, SLOWDARK, true); + break; + + case dLight_StrobeFastSync: + new DStrobe(sector, STROBEBRIGHT, FASTDARK, true); + break; + + case dLight_FireFlicker: + new DFireFlicker(sector); + break; + + case dScroll_EastLavaDamage: + new DStrobe(sector, STROBEBRIGHT, FASTDARK, false); + break; + + case sLight_Strobe_Hurt: + new DStrobe(sector, STROBEBRIGHT, FASTDARK, false); + break; + + default: + break; + } +} + diff --git a/src/p_spec.cpp b/src/p_spec.cpp index c39b3ba694..994f7584d9 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -1039,6 +1039,7 @@ static void P_SetupSectorDamage(sector_t *sector, int damage, int interval, int // Sets up everything derived from 'sector->special' for one sector // ('fromload' is necessary to allow conversion upon savegame load.) // +void P_SpawnLights(sector_t *sector); void P_InitSectorSpecial(sector_t *sector, int special) { @@ -1072,31 +1073,10 @@ void P_InitSectorSpecial(sector_t *sector, int special) // [RH] Normal DOOM special or BOOM specialized? bool keepspecial = false; + P_SpawnLights(sector); switch (sector->special) { - case Light_Phased: - new DPhased (sector, 48, 63 - (sector->lightlevel & 63)); - break; - - // [RH] Hexen-like phased lighting - case LightSequenceStart: - new DPhased (sector); - break; - - case dLight_Flicker: - new DLightFlash (sector); - break; - - case dLight_StrobeFast: - new DStrobe (sector, STROBEBRIGHT, FASTDARK, false); - break; - - case dLight_StrobeSlow: - new DStrobe (sector, STROBEBRIGHT, SLOWDARK, false); - break; - case dLight_Strobe_Hurt: - new DStrobe (sector, STROBEBRIGHT, FASTDARK, false); P_SetupSectorDamage(sector, 20, 32, 5, NAME_Slime, 0); break; @@ -1108,10 +1088,6 @@ void P_InitSectorSpecial(sector_t *sector, int special) P_SetupSectorDamage(sector, 5, 32, 0, NAME_Slime, 0); break; - case dLight_Glow: - new DGlow (sector); - break; - case dSector_DoorCloseIn30: new DDoor(sector, DDoor::doorWaitClose, 2, 0, 0, 30 * TICRATE); break; @@ -1120,14 +1096,6 @@ void P_InitSectorSpecial(sector_t *sector, int special) P_SetupSectorDamage(sector, 20, 32, 256, NAME_None, SECF_ENDGODMODE|SECF_ENDLEVEL); break; - case dLight_StrobeSlowSync: - new DStrobe (sector, STROBEBRIGHT, SLOWDARK, true); - break; - - case dLight_StrobeFastSync: - new DStrobe (sector, STROBEBRIGHT, FASTDARK, true); - break; - case dSector_DoorRaiseIn5Mins: new DDoor (sector, DDoor::doorWaitRaise, 2, TICRATE*30/7, 0, 5*60*TICRATE); break; @@ -1142,10 +1110,6 @@ void P_InitSectorSpecial(sector_t *sector, int special) P_SetupSectorDamage(sector, 20, 32, 5, NAME_Slime, 0); break; - case dLight_FireFlicker: - new DFireFlicker (sector); - break; - case dDamage_LavaWimpy: P_SetupSectorDamage(sector, 5, 32, 256, NAME_Fire, SECF_DMGTERRAINFX); break; @@ -1156,7 +1120,6 @@ void P_InitSectorSpecial(sector_t *sector, int special) case dScroll_EastLavaDamage: P_SetupSectorDamage(sector, 5, 32, 256, NAME_Fire, SECF_DMGTERRAINFX); - new DStrobe(sector, STROBEBRIGHT, FASTDARK, false); P_CreateScroller(EScroll::sc_floor, -4., 0, -1, int(sector - sectors), 0); keepspecial = true; break; @@ -1167,7 +1130,6 @@ void P_InitSectorSpecial(sector_t *sector, int special) case sLight_Strobe_Hurt: P_SetupSectorDamage(sector, 5, 32, 0, NAME_Slime, 0); - new DStrobe (sector, STROBEBRIGHT, FASTDARK, false); break; case sDamage_Hellslime: diff --git a/src/p_spec.h b/src/p_spec.h index eda0a08206..0899c6268f 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -119,142 +119,15 @@ inline sector_t *getNextSector (line_t *line, const sector_t *sec) #include "p_tags.h" -// -// P_LIGHTS -// - class DLighting : public DSectorEffect { - DECLARE_CLASS (DLighting, DSectorEffect) + DECLARE_CLASS(DLighting, DSectorEffect) public: - DLighting (sector_t *sector); + DLighting(sector_t *sector); protected: - DLighting (); + DLighting(); }; -class DFireFlicker : public DLighting -{ - DECLARE_CLASS (DFireFlicker, DLighting) -public: - DFireFlicker (sector_t *sector); - DFireFlicker (sector_t *sector, int upper, int lower); - void Serialize (FArchive &arc); - void Tick (); -protected: - int m_Count; - int m_MaxLight; - int m_MinLight; -private: - DFireFlicker (); -}; - -class DFlicker : public DLighting -{ - DECLARE_CLASS (DFlicker, DLighting) -public: - DFlicker (sector_t *sector, int upper, int lower); - void Serialize (FArchive &arc); - void Tick (); -protected: - int m_Count; - int m_MaxLight; - int m_MinLight; -private: - DFlicker (); -}; - -class DLightFlash : public DLighting -{ - DECLARE_CLASS (DLightFlash, DLighting) -public: - DLightFlash (sector_t *sector); - DLightFlash (sector_t *sector, int min, int max); - void Serialize (FArchive &arc); - void Tick (); -protected: - int m_Count; - int m_MaxLight; - int m_MinLight; - int m_MaxTime; - int m_MinTime; -private: - DLightFlash (); -}; - -class DStrobe : public DLighting -{ - DECLARE_CLASS (DStrobe, DLighting) -public: - DStrobe (sector_t *sector, int utics, int ltics, bool inSync); - DStrobe (sector_t *sector, int upper, int lower, int utics, int ltics); - void Serialize (FArchive &arc); - void Tick (); -protected: - int m_Count; - int m_MinLight; - int m_MaxLight; - int m_DarkTime; - int m_BrightTime; -private: - DStrobe (); -}; - -class DGlow : public DLighting -{ - DECLARE_CLASS (DGlow, DLighting) -public: - DGlow (sector_t *sector); - void Serialize (FArchive &arc); - void Tick (); -protected: - int m_MinLight; - int m_MaxLight; - int m_Direction; -private: - DGlow (); -}; - -// [RH] Glow from Light_Glow and Light_Fade specials -class DGlow2 : public DLighting -{ - DECLARE_CLASS (DGlow2, DLighting) -public: - DGlow2 (sector_t *sector, int start, int end, int tics, bool oneshot); - void Serialize (FArchive &arc); - void Tick (); -protected: - int m_Start; - int m_End; - int m_MaxTics; - int m_Tics; - bool m_OneShot; -private: - DGlow2 (); -}; - -// [RH] Phased light thinker -class DPhased : public DLighting -{ - DECLARE_CLASS (DPhased, DLighting) -public: - DPhased (sector_t *sector); - DPhased (sector_t *sector, int baselevel, int phase); - void Serialize (FArchive &arc); - void Tick (); -protected: - BYTE m_BaseLevel; - BYTE m_Phase; -private: - DPhased (); - DPhased (sector_t *sector, int baselevel); - int PhaseHelper (sector_t *sector, int index, int light, sector_t *prev); -}; - -#define GLOWSPEED 8 -#define STROBEBRIGHT 5 -#define FASTDARK 15 -#define SLOWDARK TICRATE - void EV_StartLightFlickering (int tag, int upper, int lower); void EV_StartLightStrobing (int tag, int upper, int lower, int utics, int ltics); void EV_StartLightStrobing (int tag, int utics, int ltics); From 76f00131ff545fa2ab296580a77d2bd0bb40df0c Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Sun, 10 Apr 2016 11:51:40 -0500 Subject: [PATCH 09/10] - Fixed: A_CheckBlock's dropoff check ignored the specifications of NOACTORS and NOLINES due to P_CheckMove blindly failing if P_CheckPosition failed. This lead to false positives such as blocking actors being detected when they shouldn't be. --- src/p_local.h | 9 +++++++-- src/p_map.cpp | 18 +++++++++++++++--- src/thingdef/thingdef_codeptr.cpp | 12 ++++++++++-- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index 82f4580b9c..45b02e8eaf 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -186,7 +186,12 @@ enum WARPF WARPF_COPYPITCH = 0x8000, }; - +enum PCM +{ + PCM_DROPOFF = 1, + PCM_NOACTORS = 1 << 1, + PCM_NOLINES = 1 << 2, +}; AActor *P_BlockmapSearch (AActor *mo, int distance, AActor *(*check)(AActor*, int, void *), void *params = NULL); @@ -221,7 +226,7 @@ void P_FakeZMovement (AActor *mo); bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor, FCheckPosition &tm, bool missileCheck = false); bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor = NULL); -bool P_CheckMove(AActor *thing, const DVector2 &pos, bool dropoff = false); +bool P_CheckMove(AActor *thing, const DVector2 &pos, int flags = 0); void P_ApplyTorque(AActor *mo); bool P_TeleportMove(AActor* thing, const DVector3 &pos, bool telefrag, bool modifyactor = true); // [RH] Added z and telefrag parameters diff --git a/src/p_map.cpp b/src/p_map.cpp index 73aa3f73fd..a1ef28cc42 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -2410,14 +2410,26 @@ bool P_TryMove(AActor *thing, const DVector2 &pos, // //========================================================================== -bool P_CheckMove(AActor *thing, const DVector2 &pos, bool dropoff) +bool P_CheckMove(AActor *thing, const DVector2 &pos, int flags) { FCheckPosition tm; double newz = thing->Z(); if (!P_CheckPosition(thing, pos, tm)) { - return false; + // Ignore PCM_DROPOFF. Not necessary here: a little later it is. + if (!flags || (!(flags & PCM_NOACTORS) && !(flags & PCM_NOLINES))) + { + return false; + } + if (!(flags & PCM_NOACTORS) && thing->BlockingMobj) + { + return false; + } + if (!(flags & PCM_NOLINES) && thing->BlockingLine) + { + return false; + } } if (thing->flags3 & MF3_FLOORHUGGER) @@ -2469,7 +2481,7 @@ bool P_CheckMove(AActor *thing, const DVector2 &pos, bool dropoff) return false; } } - else if (dropoff) + else if (flags & PCM_DROPOFF) { const DVector3 oldpos = thing->Pos(); thing->SetOrigin(pos.X, pos.Y, newz, true); diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index cc4ffd33bb..53685c43b4 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -6706,8 +6706,16 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckBlock) bool checker = false; if (flags & CBF_DROPOFF) { + // Unfortunately, whenever P_CheckMove returned false, that means it could + // ignore a variety of flags mainly because of P_CheckPosition. This + // results in picking up false positives due to actors or lines being in the way + // when they clearly should not be. + + int fpass = PCM_DROPOFF; + if (flags & CBF_NOACTORS) fpass |= PCM_NOACTORS; + if (flags & CBF_NOLINES) fpass |= PCM_NOLINES; mobj->SetZ(pos.Z); - checker = P_CheckMove(mobj, pos, true); + checker = P_CheckMove(mobj, pos, fpass); mobj->SetZ(oldpos.Z); } else @@ -6743,7 +6751,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckBlock) //[MC] I don't know why I let myself be persuaded not to include a flag. //If an actor is loaded with pointers, they don't really have any options to spare. //Also, fail if a dropoff or a step is too great to pass over when checking for dropoffs. - + if ((!(flags & CBF_NOACTORS) && (mobj->BlockingMobj)) || (!(flags & CBF_NOLINES) && mobj->BlockingLine != NULL) || ((flags & CBF_DROPOFF) && !checker)) { From db86385cf69fcf7a0a9b040dfe14d59945b5ebb0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 11 Apr 2016 10:46:30 +0200 Subject: [PATCH 10/10] - removed STACK_ARGS. The only reason this even existed was that ZDoom's original VC projects used __fastcall. The CMake generated project do not, they stick to __cdecl. Since no performance gain can be seen by using __fastcall the best course of action is to just remove all traces of it from the source and forget that it ever existed. --- src/c_console.cpp | 6 +-- src/c_cvars.cpp | 2 +- src/d_netinfo.cpp | 4 +- src/dobjtype.cpp | 2 +- src/doomtype.h | 12 ++---- src/g_doomedmap.cpp | 2 +- src/g_shared/a_weapons.cpp | 4 +- src/g_shared/shared_hud.cpp | 2 +- src/hu_scores.cpp | 4 +- src/hu_stuff.h | 4 +- src/nodebuild.cpp | 2 +- src/nodebuild.h | 2 +- src/nodebuild_gl.cpp | 2 +- src/p_acs.cpp | 18 ++++---- src/p_acs.h | 2 +- src/p_effect.cpp | 2 +- src/p_effect.h | 9 +++- src/p_lnspec.cpp | 2 +- src/p_map.cpp | 18 ++++---- src/p_states.cpp | 2 +- src/p_things.cpp | 2 +- src/p_trace.cpp | 24 +++++++++-- src/p_udmf.cpp | 2 +- src/p_user.cpp | 2 +- src/po_man.cpp | 2 +- src/posix/cocoa/i_system.mm | 4 +- src/posix/i_system.h | 4 +- src/posix/sdl/i_main.cpp | 4 +- src/posix/sdl/i_system.cpp | 4 +- src/r_data/sprites.cpp | 2 +- src/r_draw.cpp | 66 +++++++++++++++--------------- src/r_draw.h | 50 +++++++++++----------- src/r_drawt.cpp | 24 +++++------ src/r_main.cpp | 2 +- src/r_main.h | 2 +- src/r_plane.cpp | 4 +- src/r_things.cpp | 4 +- src/r_things.h | 2 +- src/resourcefiles/ancientzip.cpp | 2 +- src/resourcefiles/ancientzip.h | 2 +- src/resourcefiles/resourcefile.cpp | 2 +- src/s_advsound.cpp | 4 +- src/sc_man.cpp | 6 +-- src/sound/i_musicinterns.h | 56 ++++++++++++------------- src/statistics.cpp | 6 +-- src/textures/anim_switches.cpp | 2 +- src/thingdef/thingdef_data.cpp | 6 +-- src/v_draw.cpp | 2 +- src/v_font.cpp | 10 ++--- src/v_palette.cpp | 10 ++--- src/v_text.cpp | 4 +- src/v_video.h | 6 +-- src/win32/i_dijoy.cpp | 2 +- src/win32/i_main.cpp | 4 +- src/win32/i_rawps2.cpp | 2 +- src/win32/i_system.cpp | 4 +- src/win32/i_system.h | 4 +- src/x86.cpp | 2 +- 58 files changed, 231 insertions(+), 210 deletions(-) diff --git a/src/c_console.cpp b/src/c_console.cpp index b86ea0b2cc..2f221e319c 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -581,7 +581,7 @@ int VPrintf (int printlevel, const char *format, va_list parms) return PrintString (printlevel, outline.GetChars()); } -int STACK_ARGS Printf (int printlevel, const char *format, ...) +int Printf (int printlevel, const char *format, ...) { va_list argptr; int count; @@ -593,7 +593,7 @@ int STACK_ARGS Printf (int printlevel, const char *format, ...) return count; } -int STACK_ARGS Printf (const char *format, ...) +int Printf (const char *format, ...) { va_list argptr; int count; @@ -605,7 +605,7 @@ int STACK_ARGS Printf (const char *format, ...) return count; } -int STACK_ARGS DPrintf (const char *format, ...) +int DPrintf (const char *format, ...) { va_list argptr; int count; diff --git a/src/c_cvars.cpp b/src/c_cvars.cpp index 6d81bc3f64..1a1b71647d 100644 --- a/src/c_cvars.cpp +++ b/src/c_cvars.cpp @@ -1259,7 +1259,7 @@ void FMaskCVar::DoSet (UCVarValue value, ECVarType type) //////////////////////////////////////////////////////////////////////// -static int STACK_ARGS sortcvars (const void *a, const void *b) +static int sortcvars (const void *a, const void *b) { return strcmp (((*(FBaseCVar **)a))->GetName(), ((*(FBaseCVar **)b))->GetName()); } diff --git a/src/d_netinfo.cpp b/src/d_netinfo.cpp index c20b2aff6c..7a366e2d45 100644 --- a/src/d_netinfo.cpp +++ b/src/d_netinfo.cpp @@ -663,14 +663,14 @@ void D_DoServerInfoChange (BYTE **stream, bool singlebit) } } -static int STACK_ARGS userinfosortfunc(const void *a, const void *b) +static int userinfosortfunc(const void *a, const void *b) { TMap::ConstPair *pair1 = *(TMap::ConstPair **)a; TMap::ConstPair *pair2 = *(TMap::ConstPair **)b; return stricmp(pair1->Key.GetChars(), pair2->Key.GetChars()); } -static int STACK_ARGS namesortfunc(const void *a, const void *b) +static int namesortfunc(const void *a, const void *b) { FName *name1 = (FName *)a; FName *name2 = (FName *)b; diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index d2df43fded..e707c77110 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -2827,7 +2827,7 @@ bool PClass::ReadValue(FArchive &ar, void *addr) const // //========================================================================== -static int STACK_ARGS cregcmp (const void *a, const void *b) NO_SANITIZE +static int cregcmp (const void *a, const void *b) NO_SANITIZE { const PClass *class1 = *(const PClass **)a; const PClass *class2 = *(const PClass **)b; diff --git a/src/doomtype.h b/src/doomtype.h index fa84824f2b..39c59751d3 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -100,12 +100,6 @@ typedef TMap FClassMap; #endif -#if defined(_MSC_VER) || defined(__WATCOMC__) -#define STACK_ARGS __cdecl -#else -#define STACK_ARGS -#endif - #if defined(_MSC_VER) #define NOVTABLE __declspec(novtable) #else @@ -149,11 +143,11 @@ enum // [RH] This gets used all over; define it here: -int STACK_ARGS Printf (int printlevel, const char *, ...) GCCPRINTF(2,3); -int STACK_ARGS Printf (const char *, ...) GCCPRINTF(1,2); +int Printf (int printlevel, const char *, ...) GCCPRINTF(2,3); +int Printf (const char *, ...) GCCPRINTF(1,2); // [RH] Same here: -int STACK_ARGS DPrintf (const char *, ...) GCCPRINTF(1,2); +int DPrintf (const char *, ...) GCCPRINTF(1,2); extern "C" int mysnprintf(char *buffer, size_t count, const char *format, ...) GCCPRINTF(3,4); extern "C" int myvsnprintf(char *buffer, size_t count, const char *format, va_list argptr) GCCFORMAT(3); diff --git a/src/g_doomedmap.cpp b/src/g_doomedmap.cpp index b18347a0f9..b3aa966c30 100644 --- a/src/g_doomedmap.cpp +++ b/src/g_doomedmap.cpp @@ -100,7 +100,7 @@ static IdMap DoomEdFromMapinfo; FDoomEdMap DoomEdMap; -static int STACK_ARGS sortnums (const void *a, const void *b) +static int sortnums (const void *a, const void *b) { return (*(const FDoomEdMap::Pair**)a)->Key - (*(const FDoomEdMap::Pair**)b)->Key; } diff --git a/src/g_shared/a_weapons.cpp b/src/g_shared/a_weapons.cpp index 971d974de2..adb010d0c8 100644 --- a/src/g_shared/a_weapons.cpp +++ b/src/g_shared/a_weapons.cpp @@ -34,7 +34,7 @@ FWeaponSlots *PlayingKeyConf; TArray Weapons_ntoh; TMap Weapons_hton; -static int STACK_ARGS ntoh_cmp(const void *a, const void *b); +static int ntoh_cmp(const void *a, const void *b); IMPLEMENT_CLASS(PClassWeapon) @@ -1725,7 +1725,7 @@ void P_SetupWeapons_ntohton() // //=========================================================================== -static int STACK_ARGS ntoh_cmp(const void *a, const void *b) +static int ntoh_cmp(const void *a, const void *b) { PClassWeapon *c1 = *(PClassWeapon **)a; PClassWeapon *c2 = *(PClassWeapon **)b; diff --git a/src/g_shared/shared_hud.cpp b/src/g_shared/shared_hud.cpp index 7169cb7dba..36ffdd5b59 100644 --- a/src/g_shared/shared_hud.cpp +++ b/src/g_shared/shared_hud.cpp @@ -379,7 +379,7 @@ static void DrawArmor(ABasicArmor * barmor, AHexenArmor * harmor, int x, int y) //--------------------------------------------------------------------------- static TArray KeyTypes, UnassignedKeyTypes; -static int STACK_ARGS ktcmp(const void * a, const void * b) +static int ktcmp(const void * a, const void * b) { AKey *key1 = (AKey*)GetDefaultByType ( *(PClassActor **)a ); AKey *key2 = (AKey*)GetDefaultByType ( *(PClassActor **)b ); diff --git a/src/hu_scores.cpp b/src/hu_scores.cpp index a971672cde..35e18006d2 100644 --- a/src/hu_scores.cpp +++ b/src/hu_scores.cpp @@ -84,7 +84,7 @@ CVAR (Int, sb_deathmatch_otherplayercolor, CR_GREY, CVAR_ARCHIVE) CVAR (Bool, sb_teamdeathmatch_enable, true, CVAR_ARCHIVE) CVAR (Int, sb_teamdeathmatch_headingcolor, CR_RED, CVAR_ARCHIVE) -int STACK_ARGS comparepoints (const void *arg1, const void *arg2) +int comparepoints (const void *arg1, const void *arg2) { // Compare first be frags/kills, then by name. player_t *p1 = *(player_t **)arg1; @@ -99,7 +99,7 @@ int STACK_ARGS comparepoints (const void *arg1, const void *arg2) return diff; } -int STACK_ARGS compareteams (const void *arg1, const void *arg2) +int compareteams (const void *arg1, const void *arg2) { // Compare first by teams, then by frags, then by name. player_t *p1 = *(player_t **)arg1; diff --git a/src/hu_stuff.h b/src/hu_stuff.h index e829ed1d59..9c3250d735 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -56,7 +56,7 @@ extern bool SB_ForceActive; // Sorting routines -int STACK_ARGS comparepoints(const void *arg1, const void *arg2); -int STACK_ARGS compareteams(const void *arg1, const void *arg2); +int comparepoints(const void *arg1, const void *arg2); +int compareteams(const void *arg1, const void *arg2); #endif diff --git a/src/nodebuild.cpp b/src/nodebuild.cpp index a6609d3317..c56ee697ea 100644 --- a/src/nodebuild.cpp +++ b/src/nodebuild.cpp @@ -253,7 +253,7 @@ void FNodeBuilder::CreateSubsectorsForReal () } } -int STACK_ARGS FNodeBuilder::SortSegs (const void *a, const void *b) +int FNodeBuilder::SortSegs (const void *a, const void *b) { const FPrivSeg *x = ((const USegPtr *)a)->SegPtr; const FPrivSeg *y = ((const USegPtr *)b)->SegPtr; diff --git a/src/nodebuild.h b/src/nodebuild.h index e7380895ef..7e2a61aaac 100644 --- a/src/nodebuild.h +++ b/src/nodebuild.h @@ -299,7 +299,7 @@ private: void PushConnectingGLSeg (int subsector, TArray &segs, vertex_t *v1, vertex_t *v2); int OutputDegenerateSubsector (TArray &segs, int subsector, bool bForward, double lastdot, FPrivSeg *&prev, vertex_t *outVerts); - static int STACK_ARGS SortSegs (const void *a, const void *b); + static int SortSegs (const void *a, const void *b); double InterceptVector (const node_t &splitter, const FPrivSeg &seg); diff --git a/src/nodebuild_gl.cpp b/src/nodebuild_gl.cpp index cdbfeeb043..61bed0727e 100644 --- a/src/nodebuild_gl.cpp +++ b/src/nodebuild_gl.cpp @@ -40,7 +40,7 @@ #include "doomtype.h" #include "nodebuild.h" -static inline void STACK_ARGS Warn (const char *format, ...) +static inline void Warn (const char *format, ...) { } diff --git a/src/p_acs.cpp b/src/p_acs.cpp index bdc13357e7..00b3229b22 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -2507,7 +2507,7 @@ void FBehavior::LoadScriptsDirectory () } } -int STACK_ARGS FBehavior::SortScripts (const void *a, const void *b) +int FBehavior::SortScripts (const void *a, const void *b) { ScriptPtr *ptr1 = (ScriptPtr *)a; ScriptPtr *ptr2 = (ScriptPtr *)b; @@ -9997,7 +9997,7 @@ void ClearProfiles(TArray &profiles) } } -static int STACK_ARGS sort_by_total_instr(const void *a_, const void *b_) +static int sort_by_total_instr(const void *a_, const void *b_) { const ProfileCollector *a = (const ProfileCollector *)a_; const ProfileCollector *b = (const ProfileCollector *)b_; @@ -10007,7 +10007,7 @@ static int STACK_ARGS sort_by_total_instr(const void *a_, const void *b_) return (int)(b->ProfileData->TotalInstr - a->ProfileData->TotalInstr); } -static int STACK_ARGS sort_by_min(const void *a_, const void *b_) +static int sort_by_min(const void *a_, const void *b_) { const ProfileCollector *a = (const ProfileCollector *)a_; const ProfileCollector *b = (const ProfileCollector *)b_; @@ -10015,7 +10015,7 @@ static int STACK_ARGS sort_by_min(const void *a_, const void *b_) return b->ProfileData->MinInstrPerRun - a->ProfileData->MinInstrPerRun; } -static int STACK_ARGS sort_by_max(const void *a_, const void *b_) +static int sort_by_max(const void *a_, const void *b_) { const ProfileCollector *a = (const ProfileCollector *)a_; const ProfileCollector *b = (const ProfileCollector *)b_; @@ -10023,7 +10023,7 @@ static int STACK_ARGS sort_by_max(const void *a_, const void *b_) return b->ProfileData->MaxInstrPerRun - a->ProfileData->MaxInstrPerRun; } -static int STACK_ARGS sort_by_avg(const void *a_, const void *b_) +static int sort_by_avg(const void *a_, const void *b_) { const ProfileCollector *a = (const ProfileCollector *)a_; const ProfileCollector *b = (const ProfileCollector *)b_; @@ -10033,7 +10033,7 @@ static int STACK_ARGS sort_by_avg(const void *a_, const void *b_) return b_avg - a_avg; } -static int STACK_ARGS sort_by_runs(const void *a_, const void *b_) +static int sort_by_runs(const void *a_, const void *b_) { const ProfileCollector *a = (const ProfileCollector *)a_; const ProfileCollector *b = (const ProfileCollector *)b_; @@ -10042,7 +10042,7 @@ static int STACK_ARGS sort_by_runs(const void *a_, const void *b_) } static void ShowProfileData(TArray &profiles, long ilimit, - int (STACK_ARGS *sorter)(const void *, const void *), bool functions) + int (*sorter)(const void *, const void *), bool functions) { static const char *const typelabels[2] = { "script", "function" }; @@ -10113,7 +10113,7 @@ static void ShowProfileData(TArray &profiles, long ilimit, CCMD(acsprofile) { - static int (STACK_ARGS *sort_funcs[])(const void*, const void *) = + static int (*sort_funcs[])(const void*, const void *) = { sort_by_total_instr, sort_by_min, @@ -10126,7 +10126,7 @@ CCMD(acsprofile) TArray ScriptProfiles, FuncProfiles; long limit = 10; - int (STACK_ARGS *sorter)(const void *, const void *) = sort_by_total_instr; + int (*sorter)(const void *, const void *) = sort_by_total_instr; assert(countof(sort_names) == countof(sort_match_len)); diff --git a/src/p_acs.h b/src/p_acs.h index 6a7a8d3a1c..e3c502f7c4 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -361,7 +361,7 @@ private: void LoadScriptsDirectory (); - static int STACK_ARGS SortScripts (const void *a, const void *b); + static int SortScripts (const void *a, const void *b); void UnencryptStrings (); void UnescapeStringTable(BYTE *chunkstart, BYTE *datastart, bool haspadding); int FindStringInChunk (DWORD *chunk, const char *varname) const; diff --git a/src/p_effect.cpp b/src/p_effect.cpp index e5964af8be..db2724a02c 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -621,7 +621,7 @@ void P_DrawSplash2 (int count, const DVector3 &pos, DAngle angle, int updown, in } } -void P_DrawRailTrail(AActor *source, const DVector3 &start, const DVector3 &end, int color1, int color2, double maxdiff_d, int flags, PClassActor *spawnclass, DAngle angle, int duration, double sparsity, double drift, int SpiralOffset) +void P_DrawRailTrail(AActor *source, const DVector3 &start, TArray &portalhits, const DVector3 &end, int color1, int color2, double maxdiff_d, int flags, PClassActor *spawnclass, DAngle angle, int duration, double sparsity, double drift, int SpiralOffset) { double length, lengthsquared; int steps, i; diff --git a/src/p_effect.h b/src/p_effect.h index fad9012d02..74df5552f7 100644 --- a/src/p_effect.h +++ b/src/p_effect.h @@ -90,7 +90,14 @@ void P_RunEffects (void); void P_RunEffect (AActor *actor, int effects); -void P_DrawRailTrail(AActor *source, const DVector3 &start, const DVector3 &end, int color1, int color2, double maxdiff = 0, int flags = 0, PClassActor *spawnclass = NULL, DAngle angle = 0., int duration = 35, double sparsity = 1.0, double drift = 1.0, int SpiralOffset = 270); +struct SPortalHit +{ + DVector3 HitPos; + DVector3 ContPos; + DVector3 OutDir; +}; + +void P_DrawRailTrail(AActor *source, const DVector3 &start, TArray &portalhits, const DVector3 &end, int color1, int color2, double maxdiff = 0, int flags = 0, PClassActor *spawnclass = NULL, DAngle angle = 0., int duration = 35, double sparsity = 1.0, double drift = 1.0, int SpiralOffset = 270); void P_DrawSplash (int count, const DVector3 &pos, DAngle angle, int kind); void P_DrawSplash2 (int count, const DVector3 &pos, DAngle angle, int updown, int kind); void P_DisconnectEffect (AActor *actor); diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 2d6670b56f..49aac88c5b 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -3551,7 +3551,7 @@ static FLineSpecial LineSpecialNames[] = { #include "actionspecials.h" }; -static int STACK_ARGS lscmp (const void * a, const void * b) +static int lscmp (const void * a, const void * b) { return stricmp( ((FLineSpecial*)a)->name, ((FLineSpecial*)b)->name); } diff --git a/src/p_map.cpp b/src/p_map.cpp index a1ef28cc42..5d01f7af2e 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -4486,12 +4486,6 @@ struct SRailHit DVector3 HitPos; DAngle HitAngle; }; -struct SPortalHit -{ - DVector3 HitPos; - DVector3 ContPos; - DVector3 OutDir; -}; struct RailData { AActor *Caller; @@ -4600,11 +4594,19 @@ void P_RailAttack(FRailParams *p) AActor *puffDefaults = GetDefaultByType(puffclass->GetReplacement()); //Contains all the flags such as FOILINVUL, etc. // disabled because not complete yet. - flags = (puffDefaults->flags6 & MF6_NOTRIGGER) ? 0/*TRACE_ReportPortals*/ : TRACE_PCross | TRACE_Impact /*| TRACE_ReportPortals*/; + flags = (puffDefaults->flags6 & MF6_NOTRIGGER) ? TRACE_ReportPortals : TRACE_PCross | TRACE_Impact | TRACE_ReportPortals; rail_data.StopAtInvul = (puffDefaults->flags3 & MF3_FOILINVUL) ? false : true; rail_data.ThruSpecies = (puffDefaults->flags6 & MF6_MTHRUSPECIES) ? true : false; + + // to make things easier, push the start position and directional vector onto the PortalHits array as its first element + SPortalHit phit = { start, start, vec }; + rail_data.PortalHits.Push(phit); Trace(start, source->Sector, vec, p->distance, MF_SHOOTABLE, ML_BLOCKEVERYTHING, source, trace, flags, ProcessRailHit, &rail_data); + // and push the hit position, too, so that the array contains the entire trace with all transition points. + phit = { trace.HitPos, trace.HitPos, trace.HitVector }; + rail_data.PortalHits.Push(phit); + // Hurt anything the trace hit unsigned int i; FName damagetype = (puffDefaults == NULL || puffDefaults->DamageType == NAME_None) ? FName(NAME_Railgun) : puffDefaults->DamageType; @@ -4707,7 +4709,7 @@ void P_RailAttack(FRailParams *p) } // Draw the slug's trail. - P_DrawRailTrail(source, start, trace.HitPos, p->color1, p->color2, p->maxdiff, p->flags, p->spawnclass, angle, p->duration, p->sparsity, p->drift, p->SpiralOffset); + P_DrawRailTrail(source, start, rail_data.PortalHits, trace.HitPos, p->color1, p->color2, p->maxdiff, p->flags, p->spawnclass, angle, p->duration, p->sparsity, p->drift, p->SpiralOffset); } //========================================================================== diff --git a/src/p_states.cpp b/src/p_states.cpp index 0dea542059..2e61a78440 100644 --- a/src/p_states.cpp +++ b/src/p_states.cpp @@ -451,7 +451,7 @@ FState *FStateDefinitions::FindState(const char * name) // //========================================================================== -static int STACK_ARGS labelcmp(const void *a, const void *b) +static int labelcmp(const void *a, const void *b) { FStateLabel *A = (FStateLabel *)a; FStateLabel *B = (FStateLabel *)b; diff --git a/src/p_things.cpp b/src/p_things.cpp index 1560736a00..4afc5deaf3 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -532,7 +532,7 @@ typedef TMap SpawnMap; static SpawnMap SpawnablesFromMapinfo; static SpawnMap ConversationIDsFromMapinfo; -static int STACK_ARGS SpawnableSort(const void *a, const void *b) +static int SpawnableSort(const void *a, const void *b) { return (*((FClassMap::Pair **)a))->Key - (*((FClassMap::Pair **)b))->Key; } diff --git a/src/p_trace.cpp b/src/p_trace.cpp index 7526456e18..bc022535fc 100644 --- a/src/p_trace.cpp +++ b/src/p_trace.cpp @@ -231,7 +231,7 @@ int FTraceInfo::EnterLinePortal(line_t *li, double frac) frac += 1 / MaxDist; double enterdist = MaxDist / frac; - DVector2 enter = newtrace.Start + enterdist * Vec; + DVector3 enter = newtrace.Start + enterdist * Vec; newtrace.ActorMask = ActorMask; newtrace.WallMask = WallMask; @@ -253,6 +253,18 @@ int FTraceInfo::EnterLinePortal(line_t *li, double frac) newtrace.lastfloorportalheight = newtrace.lastceilingportalheight = newtrace.limitz; newtrace.sectorsel = 0; Results->unlinked = true; + + if ((TraceFlags & TRACE_ReportPortals) && TraceCallback != NULL) + { + Results->HitType = TRACE_CrossingPortal; + Results->HitPos = enter; + P_TranslatePortalXY(li, enter.X, enter.Y); + P_TranslatePortalZ(li, enter.Z); + Results->SrcFromTarget = enter; + Results->HitVector = newtrace.Vec; + TraceCallback(*Results, TraceCallbackData); + } + return newtrace.TraceTraverse(ActorMask ? PT_ADDLINES | PT_ADDTHINGS | PT_COMPATIBLE : PT_ADDLINES); } @@ -455,8 +467,11 @@ bool FTraceInfo::LineCheck(intercept_t *in) lastfloorportalheight = fc; if (TraceCallback != NULL) { - // Todo: calculate the intersection point. Results->HitType = TRACE_CrossingPortal; + double hitz = CurSector->SkyBoxes[sector_t::floor]->specialf1; + Results->HitPos = Start + Vec * (hitz - Start.Z) / Vec.Z; + Results->SrcFromTarget = Results->HitPos + CurSector->SkyBoxes[sector_t::floor]->Scale; + Results->HitVector = Vec; TraceCallback(*Results, TraceCallbackData); } } @@ -483,8 +498,11 @@ bool FTraceInfo::LineCheck(intercept_t *in) lastceilingportalheight = fc; if (TraceCallback != NULL) { - // Todo: calculate the intersection point. Results->HitType = TRACE_CrossingPortal; + double hitz = CurSector->SkyBoxes[sector_t::ceiling]->specialf1; + Results->HitPos = Start + Vec * (hitz - Start.Z) / Vec.Z; + Results->SrcFromTarget = Results->HitPos + CurSector->SkyBoxes[sector_t::ceiling]->Scale; + Results->HitVector = Vec; TraceCallback(*Results, TraceCallbackData); } } diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 35ad22f635..017f73cf15 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -294,7 +294,7 @@ void P_ClearUDMFKeys() } } -static int STACK_ARGS udmfcmp(const void *a, const void *b) +static int udmfcmp(const void *a, const void *b) { FUDMFKey *A = (FUDMFKey*)a; FUDMFKey *B = (FUDMFKey*)b; diff --git a/src/p_user.cpp b/src/p_user.cpp index 64c4f3a116..30a849b846 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -540,7 +540,7 @@ void PClassPlayerPawn::DeriveData(PClass *newclass) } } -static int STACK_ARGS intcmp(const void *a, const void *b) +static int intcmp(const void *a, const void *b) { return *(const int *)a - *(const int *)b; } diff --git a/src/po_man.cpp b/src/po_man.cpp index d21141c358..c025ff6c4e 100644 --- a/src/po_man.cpp +++ b/src/po_man.cpp @@ -1469,7 +1469,7 @@ static void IterFindPolySides (FPolyObj *po, side_t *side) // //========================================================================== -static int STACK_ARGS posicmp(const void *a, const void *b) +static int posicmp(const void *a, const void *b) { return (*(const side_t **)a)->linedef->args[1] - (*(const side_t **)b)->linedef->args[1]; } diff --git a/src/posix/cocoa/i_system.mm b/src/posix/cocoa/i_system.mm index 6224228ada..2e27a80028 100644 --- a/src/posix/cocoa/i_system.mm +++ b/src/posix/cocoa/i_system.mm @@ -128,7 +128,7 @@ void I_Quit() extern FILE* Logfile; bool gameisdead; -void STACK_ARGS I_FatalError(const char* const error, ...) +void I_FatalError(const char* const error, ...) { static bool alreadyThrown = false; gameisdead = true; @@ -165,7 +165,7 @@ void STACK_ARGS I_FatalError(const char* const error, ...) } } -void STACK_ARGS I_Error(const char* const error, ...) +void I_Error(const char* const error, ...) { va_list argptr; char errortext[MAX_ERRORTEXT]; diff --git a/src/posix/i_system.h b/src/posix/i_system.h index 5051b19c1b..3754d29e76 100644 --- a/src/posix/i_system.h +++ b/src/posix/i_system.h @@ -104,8 +104,8 @@ void I_Quit (void); void I_Tactile (int on, int off, int total); -void STACK_ARGS I_Error (const char *error, ...) GCCPRINTF(1,2); -void STACK_ARGS I_FatalError (const char *error, ...) GCCPRINTF(1,2); +void I_Error (const char *error, ...) GCCPRINTF(1,2); +void I_FatalError (const char *error, ...) GCCPRINTF(1,2); void addterm (void (*func)(void), const char *name); #define atterm(t) addterm (t, #t) diff --git a/src/posix/sdl/i_main.cpp b/src/posix/sdl/i_main.cpp index 54d2c27059..41497afe34 100644 --- a/src/posix/sdl/i_main.cpp +++ b/src/posix/sdl/i_main.cpp @@ -129,7 +129,7 @@ void popterm () NumTerms--; } -void STACK_ARGS call_terms () +void call_terms () { while (NumTerms > 0) { @@ -138,7 +138,7 @@ void STACK_ARGS call_terms () } } -static void STACK_ARGS NewFailure () +static void NewFailure () { I_FatalError ("Failed to allocate memory from system heap"); } diff --git a/src/posix/sdl/i_system.cpp b/src/posix/sdl/i_system.cpp index 5cf5bf280f..dcefcdbad6 100644 --- a/src/posix/sdl/i_system.cpp +++ b/src/posix/sdl/i_system.cpp @@ -179,7 +179,7 @@ bool gameisdead; void Mac_I_FatalError(const char* errortext); #endif -void STACK_ARGS I_FatalError (const char *error, ...) +void I_FatalError (const char *error, ...) { static bool alreadyThrown = false; gameisdead = true; @@ -216,7 +216,7 @@ void STACK_ARGS I_FatalError (const char *error, ...) } } -void STACK_ARGS I_Error (const char *error, ...) +void I_Error (const char *error, ...) { va_list argptr; char errortext[MAX_ERRORTEXT]; diff --git a/src/r_data/sprites.cpp b/src/r_data/sprites.cpp index 62bb4ba1c4..fbb01b24d5 100644 --- a/src/r_data/sprites.cpp +++ b/src/r_data/sprites.cpp @@ -497,7 +497,7 @@ static const char *skinsoundnames[NUMSKINSOUNDS][2] = }; /* -static int STACK_ARGS skinsorter (const void *a, const void *b) +static int skinsorter (const void *a, const void *b) { return stricmp (((FPlayerSkin *)a)->name, ((FPlayerSkin *)b)->name); } diff --git a/src/r_draw.cpp b/src/r_draw.cpp index 24a48e3b38..c12fce97a4 100644 --- a/src/r_draw.cpp +++ b/src/r_draw.cpp @@ -80,7 +80,7 @@ void (*R_DrawSpanTranslucent)(void); void (*R_DrawSpanMaskedTranslucent)(void); void (*R_DrawSpanAddClamp)(void); void (*R_DrawSpanMaskedAddClamp)(void); -void (STACK_ARGS *rt_map4cols)(int,int,int); +void (*rt_map4cols)(int,int,int); // // R_DrawColumn @@ -984,7 +984,7 @@ int dscount; #ifdef X86_ASM extern "C" void R_SetSpanSource_ASM (const BYTE *flat); -extern "C" void STACK_ARGS R_SetSpanSize_ASM (int xbits, int ybits); +extern "C" void R_SetSpanSize_ASM (int xbits, int ybits); extern "C" void R_SetSpanColormap_ASM (BYTE *colormap); extern "C" BYTE *ds_curcolormap, *ds_cursource, *ds_curtiltedsource; #endif @@ -1493,7 +1493,7 @@ extern "C" void R_SetupDrawSlabC(const BYTE *colormap) slabcolormap = colormap; } -extern "C" void STACK_ARGS R_DrawSlabC(int dx, fixed_t v, int dy, fixed_t vi, const BYTE *vptr, BYTE *p) +extern "C" void R_DrawSlabC(int dx, fixed_t v, int dy, fixed_t vi, const BYTE *vptr, BYTE *p) { int x; const BYTE *colormap = slabcolormap; @@ -1574,53 +1574,53 @@ extern "C" void STACK_ARGS R_DrawSlabC(int dx, fixed_t v, int dy, fixed_t vi, co // wallscan stuff, in C #ifndef X86_ASM -static DWORD STACK_ARGS vlinec1 (); +static DWORD vlinec1 (); static int vlinebits; -DWORD (STACK_ARGS *dovline1)() = vlinec1; -DWORD (STACK_ARGS *doprevline1)() = vlinec1; +DWORD (*dovline1)() = vlinec1; +DWORD (*doprevline1)() = vlinec1; #ifdef X64_ASM extern "C" void vlinetallasm4(); #define dovline4 vlinetallasm4 extern "C" void setupvlinetallasm (int); #else -static void STACK_ARGS vlinec4 (); -void (STACK_ARGS *dovline4)() = vlinec4; +static void vlinec4 (); +void (*dovline4)() = vlinec4; #endif -static DWORD STACK_ARGS mvlinec1(); -static void STACK_ARGS mvlinec4(); +static DWORD mvlinec1(); +static void mvlinec4(); static int mvlinebits; -DWORD (STACK_ARGS *domvline1)() = mvlinec1; -void (STACK_ARGS *domvline4)() = mvlinec4; +DWORD (*domvline1)() = mvlinec1; +void (*domvline4)() = mvlinec4; #else extern "C" { -DWORD STACK_ARGS vlineasm1 (); -DWORD STACK_ARGS prevlineasm1 (); -DWORD STACK_ARGS vlinetallasm1 (); -DWORD STACK_ARGS prevlinetallasm1 (); -void STACK_ARGS vlineasm4 (); -void STACK_ARGS vlinetallasmathlon4 (); -void STACK_ARGS vlinetallasm4 (); -void STACK_ARGS setupvlineasm (int); -void STACK_ARGS setupvlinetallasm (int); +DWORD vlineasm1 (); +DWORD prevlineasm1 (); +DWORD vlinetallasm1 (); +DWORD prevlinetallasm1 (); +void vlineasm4 (); +void vlinetallasmathlon4 (); +void vlinetallasm4 (); +void setupvlineasm (int); +void setupvlinetallasm (int); -DWORD STACK_ARGS mvlineasm1(); -void STACK_ARGS mvlineasm4(); -void STACK_ARGS setupmvlineasm (int); +DWORD mvlineasm1(); +void mvlineasm4(); +void setupmvlineasm (int); } -DWORD (STACK_ARGS *dovline1)() = vlinetallasm1; -DWORD (STACK_ARGS *doprevline1)() = prevlinetallasm1; -void (STACK_ARGS *dovline4)() = vlinetallasm4; +DWORD (*dovline1)() = vlinetallasm1; +DWORD (*doprevline1)() = prevlinetallasm1; +void (*dovline4)() = vlinetallasm4; -DWORD (STACK_ARGS *domvline1)() = mvlineasm1; -void (STACK_ARGS *domvline4)() = mvlineasm4; +DWORD (*domvline1)() = mvlineasm1; +void (*domvline4)() = mvlineasm4; #endif void setupvline (int fracbits) @@ -1660,7 +1660,7 @@ void setupvline (int fracbits) } #if !defined(X86_ASM) -DWORD STACK_ARGS vlinec1 () +DWORD vlinec1 () { DWORD fracstep = dc_iscale; DWORD frac = dc_texturefrac; @@ -1681,7 +1681,7 @@ DWORD STACK_ARGS vlinec1 () return frac; } -void STACK_ARGS vlinec4 () +void vlinec4 () { BYTE *dest = dc_dest; int count = dc_count; @@ -1711,7 +1711,7 @@ void setupmvline (int fracbits) } #if !defined(X86_ASM) -DWORD STACK_ARGS mvlinec1 () +DWORD mvlinec1 () { DWORD fracstep = dc_iscale; DWORD frac = dc_texturefrac; @@ -1736,7 +1736,7 @@ DWORD STACK_ARGS mvlinec1 () return frac; } -void STACK_ARGS mvlinec4 () +void mvlinec4 () { BYTE *dest = dc_dest; int count = dc_count; diff --git a/src/r_draw.h b/src/r_draw.h index 326ce217b2..80dc77768b 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -65,18 +65,18 @@ extern "C" unsigned int horizspans[4]; // Hook in assembler or system specific BLT here. extern void (*R_DrawColumn)(void); -extern DWORD (STACK_ARGS *dovline1) (); -extern DWORD (STACK_ARGS *doprevline1) (); +extern DWORD (*dovline1) (); +extern DWORD (*doprevline1) (); #ifdef X64_ASM #define dovline4 vlinetallasm4 extern "C" void vlinetallasm4(); #else -extern void (STACK_ARGS *dovline4) (); +extern void (*dovline4) (); #endif extern void setupvline (int); -extern DWORD (STACK_ARGS *domvline1) (); -extern void (STACK_ARGS *domvline4) (); +extern DWORD (*domvline1) (); +extern void (*domvline4) (); extern void setupmvline (int); extern void setuptmvline (int); @@ -123,11 +123,11 @@ void R_InitColumnDrawers (); extern "C" { void rt_copy1col_c (int hx, int sx, int yl, int yh); -void STACK_ARGS rt_copy4cols_c (int sx, int yl, int yh); +void rt_copy4cols_c (int sx, int yl, int yh); void rt_shaded1col (int hx, int sx, int yl, int yh); -void STACK_ARGS rt_shaded4cols_c (int sx, int yl, int yh); -void STACK_ARGS rt_shaded4cols_asm (int sx, int yl, int yh); +void rt_shaded4cols_c (int sx, int yl, int yh); +void rt_shaded4cols_asm (int sx, int yl, int yh); void rt_map1col_c (int hx, int sx, int yl, int yh); void rt_add1col (int hx, int sx, int yl, int yh); @@ -141,29 +141,29 @@ void rt_tlateaddclamp1col (int hx, int sx, int yl, int yh); void rt_tlatesubclamp1col (int hx, int sx, int yl, int yh); void rt_tlaterevsubclamp1col (int hx, int sx, int yl, int yh); -void STACK_ARGS rt_map4cols_c (int sx, int yl, int yh); -void STACK_ARGS rt_add4cols_c (int sx, int yl, int yh); -void STACK_ARGS rt_addclamp4cols_c (int sx, int yl, int yh); -void STACK_ARGS rt_subclamp4cols (int sx, int yl, int yh); -void STACK_ARGS rt_revsubclamp4cols (int sx, int yl, int yh); +void rt_map4cols_c (int sx, int yl, int yh); +void rt_add4cols_c (int sx, int yl, int yh); +void rt_addclamp4cols_c (int sx, int yl, int yh); +void rt_subclamp4cols (int sx, int yl, int yh); +void rt_revsubclamp4cols (int sx, int yl, int yh); -void STACK_ARGS rt_tlate4cols (int sx, int yl, int yh); -void STACK_ARGS rt_tlateadd4cols (int sx, int yl, int yh); -void STACK_ARGS rt_tlateaddclamp4cols (int sx, int yl, int yh); -void STACK_ARGS rt_tlatesubclamp4cols (int sx, int yl, int yh); -void STACK_ARGS rt_tlaterevsubclamp4cols (int sx, int yl, int yh); +void rt_tlate4cols (int sx, int yl, int yh); +void rt_tlateadd4cols (int sx, int yl, int yh); +void rt_tlateaddclamp4cols (int sx, int yl, int yh); +void rt_tlatesubclamp4cols (int sx, int yl, int yh); +void rt_tlaterevsubclamp4cols (int sx, int yl, int yh); void rt_copy1col_asm (int hx, int sx, int yl, int yh); void rt_map1col_asm (int hx, int sx, int yl, int yh); -void STACK_ARGS rt_copy4cols_asm (int sx, int yl, int yh); -void STACK_ARGS rt_map4cols_asm1 (int sx, int yl, int yh); -void STACK_ARGS rt_map4cols_asm2 (int sx, int yl, int yh); -void STACK_ARGS rt_add4cols_asm (int sx, int yl, int yh); -void STACK_ARGS rt_addclamp4cols_asm (int sx, int yl, int yh); +void rt_copy4cols_asm (int sx, int yl, int yh); +void rt_map4cols_asm1 (int sx, int yl, int yh); +void rt_map4cols_asm2 (int sx, int yl, int yh); +void rt_add4cols_asm (int sx, int yl, int yh); +void rt_addclamp4cols_asm (int sx, int yl, int yh); } -extern void (STACK_ARGS *rt_map4cols)(int sx, int yl, int yh); +extern void (*rt_map4cols)(int sx, int yl, int yh); #ifdef X86_ASM #define rt_copy1col rt_copy1col_asm @@ -231,7 +231,7 @@ void R_FillSpan (void); #endif extern "C" void R_SetupDrawSlab(const BYTE *colormap); -extern "C" void STACK_ARGS R_DrawSlab(int dx, fixed_t v, int dy, fixed_t vi, const BYTE *vptr, BYTE *p); +extern "C" void R_DrawSlab(int dx, fixed_t v, int dy, fixed_t vi, const BYTE *vptr, BYTE *p); extern "C" int ds_y; extern "C" int ds_x1; diff --git a/src/r_drawt.cpp b/src/r_drawt.cpp index 8a8405370d..b6dd12f32c 100644 --- a/src/r_drawt.cpp +++ b/src/r_drawt.cpp @@ -112,7 +112,7 @@ void rt_copy1col_c (int hx, int sx, int yl, int yh) } // Copies all four spans to the screen starting at sx. -void STACK_ARGS rt_copy4cols_c (int sx, int yl, int yh) +void rt_copy4cols_c (int sx, int yl, int yh) { int *source; int *dest; @@ -180,7 +180,7 @@ void rt_map1col_c (int hx, int sx, int yl, int yh) } // Maps all four spans to the screen starting at sx. -void STACK_ARGS rt_map4cols_c (int sx, int yl, int yh) +void rt_map4cols_c (int sx, int yl, int yh) { BYTE *colormap; BYTE *source; @@ -320,7 +320,7 @@ void rt_tlate1col (int hx, int sx, int yl, int yh) } // Translates all four spans to the screen starting at sx. -void STACK_ARGS rt_tlate4cols (int sx, int yl, int yh) +void rt_tlate4cols (int sx, int yl, int yh) { rt_Translate4cols(dc_translation, yl, yh); rt_map4cols(sx, yl, yh); @@ -361,7 +361,7 @@ void rt_add1col (int hx, int sx, int yl, int yh) } // Adds all four spans to the screen starting at sx without clamping. -void STACK_ARGS rt_add4cols_c (int sx, int yl, int yh) +void rt_add4cols_c (int sx, int yl, int yh) { BYTE *colormap; BYTE *source; @@ -424,7 +424,7 @@ void rt_tlateadd1col (int hx, int sx, int yl, int yh) } // Translates and adds all four spans to the screen starting at sx without clamping. -void STACK_ARGS rt_tlateadd4cols (int sx, int yl, int yh) +void rt_tlateadd4cols (int sx, int yl, int yh) { rt_Translate4cols(dc_translation, yl, yh); rt_add4cols(sx, yl, yh); @@ -462,7 +462,7 @@ void rt_shaded1col (int hx, int sx, int yl, int yh) } // Shades all four spans to the screen starting at sx. -void STACK_ARGS rt_shaded4cols_c (int sx, int yl, int yh) +void rt_shaded4cols_c (int sx, int yl, int yh) { DWORD *fgstart; BYTE *colormap; @@ -543,7 +543,7 @@ void rt_addclamp1col (int hx, int sx, int yl, int yh) } // Adds all four spans to the screen starting at sx with clamping. -void STACK_ARGS rt_addclamp4cols_c (int sx, int yl, int yh) +void rt_addclamp4cols_c (int sx, int yl, int yh) { BYTE *colormap; BYTE *source; @@ -614,7 +614,7 @@ void rt_tlateaddclamp1col (int hx, int sx, int yl, int yh) } // Translates and adds all four spans to the screen starting at sx with clamping. -void STACK_ARGS rt_tlateaddclamp4cols (int sx, int yl, int yh) +void rt_tlateaddclamp4cols (int sx, int yl, int yh) { rt_Translate4cols(dc_translation, yl, yh); rt_addclamp4cols(sx, yl, yh); @@ -656,7 +656,7 @@ void rt_subclamp1col (int hx, int sx, int yl, int yh) } // Subtracts all four spans to the screen starting at sx with clamping. -void STACK_ARGS rt_subclamp4cols (int sx, int yl, int yh) +void rt_subclamp4cols (int sx, int yl, int yh) { BYTE *colormap; BYTE *source; @@ -723,7 +723,7 @@ void rt_tlatesubclamp1col (int hx, int sx, int yl, int yh) } // Translates and subtracts all four spans to the screen starting at sx with clamping. -void STACK_ARGS rt_tlatesubclamp4cols (int sx, int yl, int yh) +void rt_tlatesubclamp4cols (int sx, int yl, int yh) { rt_Translate4cols(dc_translation, yl, yh); rt_subclamp4cols(sx, yl, yh); @@ -765,7 +765,7 @@ void rt_revsubclamp1col (int hx, int sx, int yl, int yh) } // Subtracts all four spans from the screen starting at sx with clamping. -void STACK_ARGS rt_revsubclamp4cols (int sx, int yl, int yh) +void rt_revsubclamp4cols (int sx, int yl, int yh) { BYTE *colormap; BYTE *source; @@ -832,7 +832,7 @@ void rt_tlaterevsubclamp1col (int hx, int sx, int yl, int yh) } // Translates and subtracts all four spans from the screen starting at sx with clamping. -void STACK_ARGS rt_tlaterevsubclamp4cols (int sx, int yl, int yh) +void rt_tlaterevsubclamp4cols (int sx, int yl, int yh) { rt_Translate4cols(dc_translation, yl, yh); rt_revsubclamp4cols(sx, yl, yh); diff --git a/src/r_main.cpp b/src/r_main.cpp index 0a8a635129..8e74527893 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -158,7 +158,7 @@ void (*spanfunc) (void); void (*hcolfunc_pre) (void); void (*hcolfunc_post1) (int hx, int sx, int yl, int yh); void (*hcolfunc_post2) (int hx, int sx, int yl, int yh); -void (STACK_ARGS *hcolfunc_post4) (int sx, int yl, int yh); +void (*hcolfunc_post4) (int sx, int yl, int yh); cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles; diff --git a/src/r_main.h b/src/r_main.h index e5bd9b9442..5602439c7e 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -117,7 +117,7 @@ extern void (*spanfunc) (void); extern void (*hcolfunc_pre) (void); extern void (*hcolfunc_post1) (int hx, int sx, int yl, int yh); extern void (*hcolfunc_post2) (int hx, int sx, int yl, int yh); -extern void (STACK_ARGS *hcolfunc_post4) (int sx, int yl, int yh); +extern void (*hcolfunc_post4) (int sx, int yl, int yh); void R_InitTextureMapping (); diff --git a/src/r_plane.cpp b/src/r_plane.cpp index e24bbe0b63..087487cd51 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -148,7 +148,7 @@ static DWORD basexfrac, baseyfrac; #ifdef X86_ASM extern "C" void R_SetSpanSource_ASM (const BYTE *flat); -extern "C" void STACK_ARGS R_SetSpanSize_ASM (int xbits, int ybits); +extern "C" void R_SetSpanSize_ASM (int xbits, int ybits); extern "C" void R_SetSpanColormap_ASM (BYTE *colormap); extern "C" void R_SetTiltedSpanSource_ASM (const BYTE *flat); extern "C" BYTE *ds_curcolormap, *ds_cursource, *ds_curtiltedsource; @@ -253,7 +253,7 @@ void R_MapPlane (int y, int x1) //========================================================================== extern "C" { -void STACK_ARGS R_CalcTiltedLighting (fixed_t lval, fixed_t lend, int width) +void R_CalcTiltedLighting (fixed_t lval, fixed_t lend, int width) { fixed_t lstep; BYTE *lightfiller; diff --git a/src/r_things.cpp b/src/r_things.cpp index d2c0dcdb4e..2033423e81 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -1709,13 +1709,13 @@ static drawseg_t **drawsegsorter; static int drawsegsortersize = 0; // Sort vissprites by leftmost column, left to right -static int STACK_ARGS sv_comparex (const void *arg1, const void *arg2) +static int sv_comparex (const void *arg1, const void *arg2) { return (*(vissprite_t **)arg2)->x1 - (*(vissprite_t **)arg1)->x1; } // Sort drawsegs by rightmost column, left to right -static int STACK_ARGS sd_comparex (const void *arg1, const void *arg2) +static int sd_comparex (const void *arg1, const void *arg2) { return (*(drawseg_t **)arg2)->x2 - (*(drawseg_t **)arg1)->x2; } diff --git a/src/r_things.h b/src/r_things.h index c3b0e3fb4c..a80466d5bf 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -116,7 +116,7 @@ void R_DrawMaskedColumn (const BYTE *column, const FTexture::Span *spans); void R_WallSpriteColumn (void (*drawfunc)(const BYTE *column, const FTexture::Span *spans)); void R_CacheSprite (spritedef_t *sprite); -void R_SortVisSprites (int (STACK_ARGS *compare)(const void *, const void *), size_t first); +void R_SortVisSprites (int (*compare)(const void *, const void *), size_t first); void R_AddSprites (sector_t *sec, int lightlevel, int fakeside); void R_AddPSprites (); void R_DrawSprites (); diff --git a/src/resourcefiles/ancientzip.cpp b/src/resourcefiles/ancientzip.cpp index 2ed6bebd9f..89ae043f8a 100644 --- a/src/resourcefiles/ancientzip.cpp +++ b/src/resourcefiles/ancientzip.cpp @@ -135,7 +135,7 @@ unsigned int FZipExploder::InitTable(TArray &decoder, int numspots) return start; } -int STACK_ARGS FZipExploder::buildercmp(const void *a, const void *b) +int FZipExploder::buildercmp(const void *a, const void *b) { const TableBuilder *v1 = (const TableBuilder *)a; const TableBuilder *v2 = (const TableBuilder *)b; diff --git a/src/resourcefiles/ancientzip.h b/src/resourcefiles/ancientzip.h index 013b81b876..d51e89ca59 100644 --- a/src/resourcefiles/ancientzip.h +++ b/src/resourcefiles/ancientzip.h @@ -31,7 +31,7 @@ class FZipExploder unsigned char ReadBuf[256]; unsigned int bs, be; - static int STACK_ARGS buildercmp(const void *a, const void *b); + static int buildercmp(const void *a, const void *b); void InsertCode(TArray &decoder, unsigned int pos, int bits, unsigned short code, int len, unsigned char value); unsigned int InitTable(TArray &decoder, int numspots); int BuildDecoder(TArray &decoder, TableBuilder *values, int numvals); diff --git a/src/resourcefiles/resourcefile.cpp b/src/resourcefiles/resourcefile.cpp index d686e227ad..c66430a66a 100644 --- a/src/resourcefiles/resourcefile.cpp +++ b/src/resourcefiles/resourcefile.cpp @@ -316,7 +316,7 @@ FResourceFile::~FResourceFile() delete Reader; } -int STACK_ARGS lumpcmp(const void * a, const void * b) +int lumpcmp(const void * a, const void * b) { FResourceLump * rec1 = (FResourceLump *)a; FResourceLump * rec2 = (FResourceLump *)b; diff --git a/src/s_advsound.cpp b/src/s_advsound.cpp index 7995f2655a..6c7bb97dfc 100644 --- a/src/s_advsound.cpp +++ b/src/s_advsound.cpp @@ -199,7 +199,7 @@ extern bool IsFloat (const char *str); // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- -static int STACK_ARGS SortPlayerClasses (const void *a, const void *b); +static int SortPlayerClasses (const void *a, const void *b); static int S_DupPlayerSound (const char *pclass, int gender, int refid, int aliasref); static void S_SavePlayerSound (const char *pclass, int gender, int refid, int lumpnum, bool alias); static void S_RestorePlayerSounds(); @@ -1627,7 +1627,7 @@ void S_ShrinkPlayerSoundLists () DefPlayerClass = S_FindPlayerClass (DefPlayerClassName); } -static int STACK_ARGS SortPlayerClasses (const void *a, const void *b) +static int SortPlayerClasses (const void *a, const void *b) { return stricmp (((const FPlayerClassLookup *)a)->Name, ((const FPlayerClassLookup *)b)->Name); diff --git a/src/sc_man.cpp b/src/sc_man.cpp index 50ec1214e8..dadbae0ed1 100644 --- a/src/sc_man.cpp +++ b/src/sc_man.cpp @@ -940,7 +940,7 @@ int FScanner::GetMessageLine() // //========================================================================== -void STACK_ARGS FScanner::ScriptError (const char *message, ...) +void FScanner::ScriptError (const char *message, ...) { FString composed; @@ -966,7 +966,7 @@ void STACK_ARGS FScanner::ScriptError (const char *message, ...) // //========================================================================== -void STACK_ARGS FScanner::ScriptMessage (const char *message, ...) +void FScanner::ScriptMessage (const char *message, ...) { FString composed; @@ -1038,7 +1038,7 @@ FScriptPosition &FScriptPosition::operator=(const FScriptPosition &other) // //========================================================================== -void STACK_ARGS FScriptPosition::Message (int severity, const char *message, ...) const +void FScriptPosition::Message (int severity, const char *message, ...) const { FString composed; diff --git a/src/sound/i_musicinterns.h b/src/sound/i_musicinterns.h index ead9184c87..861d94927e 100644 --- a/src/sound/i_musicinterns.h +++ b/src/sound/i_musicinterns.h @@ -386,34 +386,34 @@ protected: #ifdef DYN_FLUIDSYNTH enum { FLUID_FAILED = -1, FLUID_OK = 0 }; - fluid_settings_t *(STACK_ARGS *new_fluid_settings)(); - fluid_synth_t *(STACK_ARGS *new_fluid_synth)(fluid_settings_t *); - int (STACK_ARGS *delete_fluid_synth)(fluid_synth_t *); - void (STACK_ARGS *delete_fluid_settings)(fluid_settings_t *); - int (STACK_ARGS *fluid_settings_setnum)(fluid_settings_t *, const char *, double); - int (STACK_ARGS *fluid_settings_setstr)(fluid_settings_t *, const char *, const char *); - int (STACK_ARGS *fluid_settings_setint)(fluid_settings_t *, const char *, int); - int (STACK_ARGS *fluid_settings_getstr)(fluid_settings_t *, const char *, char **); - int (STACK_ARGS *fluid_settings_getint)(fluid_settings_t *, const char *, int *); - void (STACK_ARGS *fluid_synth_set_reverb_on)(fluid_synth_t *, int); - void (STACK_ARGS *fluid_synth_set_chorus_on)(fluid_synth_t *, int); - int (STACK_ARGS *fluid_synth_set_interp_method)(fluid_synth_t *, int, int); - int (STACK_ARGS *fluid_synth_set_polyphony)(fluid_synth_t *, int); - int (STACK_ARGS *fluid_synth_get_polyphony)(fluid_synth_t *); - int (STACK_ARGS *fluid_synth_get_active_voice_count)(fluid_synth_t *); - double (STACK_ARGS *fluid_synth_get_cpu_load)(fluid_synth_t *); - int (STACK_ARGS *fluid_synth_system_reset)(fluid_synth_t *); - int (STACK_ARGS *fluid_synth_noteon)(fluid_synth_t *, int, int, int); - int (STACK_ARGS *fluid_synth_noteoff)(fluid_synth_t *, int, int); - int (STACK_ARGS *fluid_synth_cc)(fluid_synth_t *, int, int, int); - int (STACK_ARGS *fluid_synth_program_change)(fluid_synth_t *, int, int); - int (STACK_ARGS *fluid_synth_channel_pressure)(fluid_synth_t *, int, int); - int (STACK_ARGS *fluid_synth_pitch_bend)(fluid_synth_t *, int, int); - int (STACK_ARGS *fluid_synth_write_float)(fluid_synth_t *, int, void *, int, int, void *, int, int); - int (STACK_ARGS *fluid_synth_sfload)(fluid_synth_t *, const char *, int); - void (STACK_ARGS *fluid_synth_set_reverb)(fluid_synth_t *, double, double, double, double); - void (STACK_ARGS *fluid_synth_set_chorus)(fluid_synth_t *, int, double, double, double, int); - int (STACK_ARGS *fluid_synth_sysex)(fluid_synth_t *, const char *, int, char *, int *, int *, int); + fluid_settings_t *(*new_fluid_settings)(); + fluid_synth_t *(*new_fluid_synth)(fluid_settings_t *); + int (*delete_fluid_synth)(fluid_synth_t *); + void (*delete_fluid_settings)(fluid_settings_t *); + int (*fluid_settings_setnum)(fluid_settings_t *, const char *, double); + int (*fluid_settings_setstr)(fluid_settings_t *, const char *, const char *); + int (*fluid_settings_setint)(fluid_settings_t *, const char *, int); + int (*fluid_settings_getstr)(fluid_settings_t *, const char *, char **); + int (*fluid_settings_getint)(fluid_settings_t *, const char *, int *); + void (*fluid_synth_set_reverb_on)(fluid_synth_t *, int); + void (*fluid_synth_set_chorus_on)(fluid_synth_t *, int); + int (*fluid_synth_set_interp_method)(fluid_synth_t *, int, int); + int (*fluid_synth_set_polyphony)(fluid_synth_t *, int); + int (*fluid_synth_get_polyphony)(fluid_synth_t *); + int (*fluid_synth_get_active_voice_count)(fluid_synth_t *); + double (*fluid_synth_get_cpu_load)(fluid_synth_t *); + int (*fluid_synth_system_reset)(fluid_synth_t *); + int (*fluid_synth_noteon)(fluid_synth_t *, int, int, int); + int (*fluid_synth_noteoff)(fluid_synth_t *, int, int); + int (*fluid_synth_cc)(fluid_synth_t *, int, int, int); + int (*fluid_synth_program_change)(fluid_synth_t *, int, int); + int (*fluid_synth_channel_pressure)(fluid_synth_t *, int, int); + int (*fluid_synth_pitch_bend)(fluid_synth_t *, int, int); + int (*fluid_synth_write_float)(fluid_synth_t *, int, void *, int, int, void *, int, int); + int (*fluid_synth_sfload)(fluid_synth_t *, const char *, int); + void (*fluid_synth_set_reverb)(fluid_synth_t *, double, double, double, double); + void (*fluid_synth_set_chorus)(fluid_synth_t *, int, double, double, double, int); + int (*fluid_synth_sysex)(fluid_synth_t *, const char *, int, char *, int *, int *, int); #ifdef _WIN32 HMODULE FluidSynthDLL; diff --git a/src/statistics.cpp b/src/statistics.cpp index 3676b8678f..5d14bad0a0 100644 --- a/src/statistics.cpp +++ b/src/statistics.cpp @@ -209,7 +209,7 @@ void ReadStatistics() // // ==================================================================== -int STACK_ARGS compare_episode_names(const void *a, const void *b) +int compare_episode_names(const void *a, const void *b) { FStatistics *A = (FStatistics*)a; FStatistics *B = (FStatistics*)b; @@ -217,7 +217,7 @@ int STACK_ARGS compare_episode_names(const void *a, const void *b) return strnatcasecmp(A->epi_header, B->epi_header); } -int STACK_ARGS compare_level_names(const void *a, const void *b) +int compare_level_names(const void *a, const void *b) { FLevelStatistics *A = (FLevelStatistics*)a; FLevelStatistics *B = (FLevelStatistics*)b; @@ -225,7 +225,7 @@ int STACK_ARGS compare_level_names(const void *a, const void *b) return strnatcasecmp(A->name, B->name); } -int STACK_ARGS compare_dates(const void *a, const void *b) +int compare_dates(const void *a, const void *b) { FLevelStatistics *A = (FLevelStatistics*)a; FLevelStatistics *B = (FLevelStatistics*)b; diff --git a/src/textures/anim_switches.cpp b/src/textures/anim_switches.cpp index 104bc2a405..2cde1d0c8f 100644 --- a/src/textures/anim_switches.cpp +++ b/src/textures/anim_switches.cpp @@ -46,7 +46,7 @@ #include "farchive.h" -static int STACK_ARGS SortSwitchDefs (const void *a, const void *b) +static int SortSwitchDefs (const void *a, const void *b) { return (*(FSwitchDef **)a)->PreTexture - (*(FSwitchDef **)b)->PreTexture; } diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 16fcc9a558..55f20df034 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -557,17 +557,17 @@ PFunction *FindGlobalActionFunction(const char *name) // //========================================================================== -static int STACK_ARGS flagcmp (const void * a, const void * b) +static int flagcmp (const void * a, const void * b) { return stricmp( ((FFlagDef*)a)->name, ((FFlagDef*)b)->name); } -static int STACK_ARGS propcmp(const void * a, const void * b) +static int propcmp(const void * a, const void * b) { return stricmp( (*(FPropertyInfo**)a)->name, (*(FPropertyInfo**)b)->name); } -static int STACK_ARGS funccmp(const void * a, const void * b) +static int funccmp(const void * a, const void * b) { return stricmp( ((AFuncDesc*)a)->Name, ((AFuncDesc*)b)->Name); } diff --git a/src/v_draw.cpp b/src/v_draw.cpp index 6cfb8aa416..0a839eb7f7 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -106,7 +106,7 @@ static int PalFromRGB(uint32 rgb) return LastPal; } -void STACK_ARGS DCanvas::DrawTexture (FTexture *img, double x, double y, int tags_first, ...) +void DCanvas::DrawTexture (FTexture *img, double x, double y, int tags_first, ...) { va_list tags; va_start(tags, tags_first); diff --git a/src/v_font.cpp b/src/v_font.cpp index 775ca38f14..052074d11e 100644 --- a/src/v_font.cpp +++ b/src/v_font.cpp @@ -134,7 +134,7 @@ protected: void LoadBMF (int lump, const BYTE *data); void CreateFontFromPic (FTextureID picnum); - static int STACK_ARGS BMFCompare(const void *a, const void *b); + static int BMFCompare(const void *a, const void *b); enum { @@ -231,7 +231,7 @@ struct TempColorInfo // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- -static int STACK_ARGS TranslationMapCompare (const void *a, const void *b); +static int TranslationMapCompare (const void *a, const void *b); // EXTERNAL DATA DECLARATIONS ---------------------------------------------- @@ -594,7 +594,7 @@ void RecordTextureColors (FTexture *pic, BYTE *usedcolors) // //========================================================================== -static int STACK_ARGS compare (const void *arg1, const void *arg2) +static int compare (const void *arg1, const void *arg2) { if (RPART(GPalette.BaseColors[*((BYTE *)arg1)]) * 299 + GPART(GPalette.BaseColors[*((BYTE *)arg1)]) * 587 + @@ -1360,7 +1360,7 @@ void FSingleLumpFont::LoadBMF(int lump, const BYTE *data) // //========================================================================== -int STACK_ARGS FSingleLumpFont::BMFCompare(const void *a, const void *b) +int FSingleLumpFont::BMFCompare(const void *a, const void *b) { const PalEntry *pa = (const PalEntry *)a; const PalEntry *pb = (const PalEntry *)b; @@ -2474,7 +2474,7 @@ void V_InitFontColors () // //========================================================================== -static int STACK_ARGS TranslationMapCompare (const void *a, const void *b) +static int TranslationMapCompare (const void *a, const void *b) { return int(((const TranslationMap *)a)->Name) - int(((const TranslationMap *)b)->Name); } diff --git a/src/v_palette.cpp b/src/v_palette.cpp index fe6e622f7d..934a57dd3c 100644 --- a/src/v_palette.cpp +++ b/src/v_palette.cpp @@ -64,8 +64,8 @@ FColorMatcher ColorMatcher; /* Current color blending values */ int BlendR, BlendG, BlendB, BlendA; -static int STACK_ARGS sortforremap (const void *a, const void *b); -static int STACK_ARGS sortforremap2 (const void *a, const void *b); +static int sortforremap (const void *a, const void *b); +static int sortforremap2 (const void *a, const void *b); /**************************/ /* Gamma correction stuff */ @@ -222,7 +222,7 @@ void FPalette::MakeGoodRemap () // 256 entries are different. :-) } -static int STACK_ARGS sortforremap (const void *a, const void *b) +static int sortforremap (const void *a, const void *b) { return (*(const DWORD *)a & 0xFFFFFF) - (*(const DWORD *)b & 0xFFFFFF); } @@ -298,7 +298,7 @@ void FPalette::MakeRemap (const DWORD *colors, BYTE *remap, const BYTE *useful, } } -static int STACK_ARGS sortforremap2 (const void *a, const void *b) +static int sortforremap2 (const void *a, const void *b) { const RemappingWork *ap = (const RemappingWork *)a; const RemappingWork *bp = (const RemappingWork *)b; @@ -384,7 +384,7 @@ void InitPalette () R_InitColormaps (); } -extern "C" void STACK_ARGS DoBlending_MMX (const PalEntry *from, PalEntry *to, int count, int r, int g, int b, int a); +extern "C" void DoBlending_MMX (const PalEntry *from, PalEntry *to, int count, int r, int g, int b, int a); extern void DoBlending_SSE2 (const PalEntry *from, PalEntry *to, int count, int r, int g, int b, int a); void DoBlending (const PalEntry *from, PalEntry *to, int count, int r, int g, int b, int a) diff --git a/src/v_text.cpp b/src/v_text.cpp index b2ecb8d2c9..5772b078c0 100644 --- a/src/v_text.cpp +++ b/src/v_text.cpp @@ -52,7 +52,7 @@ // // Write a single character using the given font // -void STACK_ARGS DCanvas::DrawChar (FFont *font, int normalcolor, int x, int y, BYTE character, int tag_first, ...) +void DCanvas::DrawChar (FFont *font, int normalcolor, int x, int y, BYTE character, int tag_first, ...) { if (font == NULL) return; @@ -84,7 +84,7 @@ void STACK_ARGS DCanvas::DrawChar (FFont *font, int normalcolor, int x, int y, B // // Write a string using the given font // -void STACK_ARGS DCanvas::DrawText(FFont *font, int normalcolor, int x, int y, const char *string, int tag_first, ...) +void DCanvas::DrawText(FFont *font, int normalcolor, int x, int y, const char *string, int tag_first, ...) { int w; const BYTE *ch; diff --git a/src/v_video.h b/src/v_video.h index 3af56513cb..693bfa687c 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -246,7 +246,7 @@ public: // 2D Texture drawing bool SetTextureParms(DrawParms *parms, FTexture *img, double x, double y) const; - void STACK_ARGS DrawTexture (FTexture *img, double x, double y, int tags, ...); + void DrawTexture (FTexture *img, double x, double y, int tags, ...); void FillBorder (FTexture *img); // Fills the border around a 4:3 part of the screen on non-4:3 displays void VirtualToRealCoords(double &x, double &y, double &w, double &h, double vwidth, double vheight, bool vbottom=false, bool handleaspect=true) const; @@ -258,8 +258,8 @@ public: #undef DrawText // See WinUser.h for the definition of DrawText as a macro #endif // 2D Text drawing - void STACK_ARGS DrawText (FFont *font, int normalcolor, int x, int y, const char *string, int tag_first, ...); - void STACK_ARGS DrawChar (FFont *font, int normalcolor, int x, int y, BYTE character, int tag_first, ...); + void DrawText (FFont *font, int normalcolor, int x, int y, const char *string, int tag_first, ...); + void DrawChar (FFont *font, int normalcolor, int x, int y, BYTE character, int tag_first, ...); protected: BYTE *Buffer; diff --git a/src/win32/i_dijoy.cpp b/src/win32/i_dijoy.cpp index 04516e481a..0db93b3b49 100644 --- a/src/win32/i_dijoy.cpp +++ b/src/win32/i_dijoy.cpp @@ -227,7 +227,7 @@ protected: FDInputJoystick *EnumDevices(); static BOOL CALLBACK EnumCallback(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef); - static int STACK_ARGS NameSort(const void *a, const void *b); + static int NameSort(const void *a, const void *b); static bool IsXInputDevice(const GUID *guid); static bool IsXInputDeviceFast(const GUID *guid); static bool IsXInputDeviceSlow(const GUID *guid); diff --git a/src/win32/i_main.cpp b/src/win32/i_main.cpp index 241e9dae24..7a804dd81f 100644 --- a/src/win32/i_main.cpp +++ b/src/win32/i_main.cpp @@ -199,7 +199,7 @@ void popterm () // //========================================================================== -static void STACK_ARGS call_terms (void) +static void call_terms (void) { while (NumTerms > 0) { @@ -208,7 +208,7 @@ static void STACK_ARGS call_terms (void) } #ifdef _MSC_VER -static int STACK_ARGS NewFailure (size_t size) +static int NewFailure (size_t size) { I_FatalError ("Failed to allocate %d bytes from process heap", size); return 0; diff --git a/src/win32/i_rawps2.cpp b/src/win32/i_rawps2.cpp index f75d648ad6..50de1d0f45 100644 --- a/src/win32/i_rawps2.cpp +++ b/src/win32/i_rawps2.cpp @@ -158,7 +158,7 @@ protected: void DoRegister(); FRawPS2Controller *EnumDevices(); - static int STACK_ARGS DeviceSort(const void *a, const void *b); + static int DeviceSort(const void *a, const void *b); }; // Each entry is an offset to the corresponding data field in the diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 98eaf669c9..8590bface8 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -784,7 +784,7 @@ void I_Quit() // //========================================================================== -void STACK_ARGS I_FatalError(const char *error, ...) +void I_FatalError(const char *error, ...) { static BOOL alreadyThrown = false; gameisdead = true; @@ -824,7 +824,7 @@ void STACK_ARGS I_FatalError(const char *error, ...) // //========================================================================== -void STACK_ARGS I_Error(const char *error, ...) +void I_Error(const char *error, ...) { va_list argptr; char errortext[MAX_ERRORTEXT]; diff --git a/src/win32/i_system.h b/src/win32/i_system.h index 6bee888f2d..a7fca25a68 100644 --- a/src/win32/i_system.h +++ b/src/win32/i_system.h @@ -132,8 +132,8 @@ void I_Quit (void); void I_Tactile (int on, int off, int total); -void STACK_ARGS I_Error (const char *error, ...) GCCPRINTF(1,2); -void STACK_ARGS I_FatalError (const char *error, ...) GCCPRINTF(1,2); +void I_Error (const char *error, ...) GCCPRINTF(1,2); +void I_FatalError (const char *error, ...) GCCPRINTF(1,2); void atterm (void (*func)(void)); void popterm (); diff --git a/src/x86.cpp b/src/x86.cpp index 654ec1c8b0..f6c878da61 100644 --- a/src/x86.cpp +++ b/src/x86.cpp @@ -273,7 +273,7 @@ void DoBlending_MMX2(const PalEntry *from, PalEntry *to, int count, int r, int g #endif #ifdef X86_ASM -extern "C" void STACK_ARGS DoBlending_MMX(const PalEntry *from, PalEntry *to, int count, int r, int g, int b, int a); +extern "C" void DoBlending_MMX(const PalEntry *from, PalEntry *to, int count, int r, int g, int b, int a); #endif void DoBlending_SSE2(const PalEntry *from, PalEntry *to, int count, int r, int g, int b, int a)