diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c89b881798..4ebce76cdc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -229,13 +229,12 @@ include_directories( ${OPENGL_INCLUDE_DIR} ) if( NOT NO_OPENAL ) find_package( OpenAL ) - mark_as_advanced(CLEAR OPENAL_LIBRARY OPENAL_INCLUDE_DIR) - if( OPENAL_FOUND ) + mark_as_advanced(CLEAR OPENAL_INCLUDE_DIR) + if( OPENAL_INCLUDE_DIR ) include_directories( ${OPENAL_INCLUDE_DIR} ) - set( ZDOOM_LIBS ${OPENAL_LIBRARY} ${ZDOOM_LIBS} ) - else( OPENAL_FOUND ) - set( NO_OPENAL ON ) - endif( OPENAL_FOUND ) + else( OPENAL_INCLUDE_DIR ) + set( NO_OPENAL ON ) + endif( OPENAL_INCLUDE_DIR ) endif( NOT NO_OPENAL ) if( NOT NO_FMOD ) diff --git a/src/dsectoreffect.cpp b/src/dsectoreffect.cpp index 6732a19dc8..7bc9fc400e 100644 --- a/src/dsectoreffect.cpp +++ b/src/dsectoreffect.cpp @@ -95,11 +95,11 @@ void DMover::Serialize (FArchive &arc) arc << interpolation; } -void DMover::StopInterpolation() +void DMover::StopInterpolation(bool force) { if (interpolation != NULL) { - interpolation->DelRef(); + interpolation->DelRef(force); interpolation = NULL; } } diff --git a/src/dsectoreffect.h b/src/dsectoreffect.h index 95e1178aa3..3788c6d88f 100644 --- a/src/dsectoreffect.h +++ b/src/dsectoreffect.h @@ -36,7 +36,7 @@ protected: DMover (); void Serialize (FArchive &arc); void Destroy(); - void StopInterpolation(); + void StopInterpolation(bool force = false); inline EResult MoveFloor (fixed_t speed, fixed_t dest, int crush, int direction, bool hexencrush) { return MovePlane (speed, dest, crush, 0, direction, hexencrush); diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index 3060c65aa1..be838d54bc 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -1571,7 +1571,7 @@ public: bool res = DMover::crushed != MoveFloor(speed, dest, crush, direction, false); Destroy(); m_Sector->floordata=NULL; - StopInterpolation(); + StopInterpolation(true); m_Sector=NULL; return res; } @@ -1656,6 +1656,14 @@ public: m_Speed=movespeed; m_Direction = _m_Direction; m_FloorDestDist = moveheight; + + // Do not interpolate instant movement floors. + fixed_t movedist = abs(-sec->floorplane.d - moveheight); + if (m_Speed >= movedist) + { + StopInterpolation(true); + } + StartFloorSound(); } }; @@ -1713,7 +1721,7 @@ public: bool res = DMover::crushed != MoveCeiling(speed, dest, crush, direction, false); Destroy(); m_Sector->ceilingdata=NULL; - StopInterpolation (); + StopInterpolation (true); m_Sector=NULL; return res; } @@ -1806,7 +1814,7 @@ public: fixed_t movedist = abs(sec->ceilingplane.d - m_BottomHeight); if (m_Speed >= movedist) { - StopInterpolation (); + StopInterpolation (true); m_Silent=2; } PlayCeilingSound(); diff --git a/src/g_heretic/a_hereticweaps.cpp b/src/g_heretic/a_hereticweaps.cpp index c6ccc6ae6a..92cffd64b6 100644 --- a/src/g_heretic/a_hereticweaps.cpp +++ b/src/g_heretic/a_hereticweaps.cpp @@ -626,7 +626,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact) } else { // Seek - self->angle = self->AngleTo(target); + angle = self->AngleTo(target); newAngle = true; } } diff --git a/src/p_ceiling.cpp b/src/p_ceiling.cpp index 3203cf7779..24ab121c41 100644 --- a/src/p_ceiling.cpp +++ b/src/p_ceiling.cpp @@ -412,7 +412,7 @@ DCeiling *DCeiling::Create(sector_t *sec, DCeiling::ECeiling type, line_t *line, } if (ceiling->m_Speed >= movedist) { - ceiling->StopInterpolation(); + ceiling->StopInterpolation(true); } // set texture/type change properties diff --git a/src/p_floor.cpp b/src/p_floor.cpp index 013f0a78ff..eb9aaa4f9a 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -478,7 +478,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, (floor->m_Direction<0 && floor->m_FloorDestDistfloorplane.d) || // moving down but going up (floor->m_Speed >= abs(sec->floorplane.d - floor->m_FloorDestDist))) // moving in one step { - floor->StopInterpolation(); + floor->StopInterpolation(true); // [Graf Zahl] // Don't make sounds for instant movement hacks but make an exception for diff --git a/src/p_terrain.cpp b/src/p_terrain.cpp index af8de5cab2..9d0b8456ad 100644 --- a/src/p_terrain.cpp +++ b/src/p_terrain.cpp @@ -627,13 +627,19 @@ static void ParseFloor (FScanner &sc) FTextureID picnum; int terrain; + bool opt = sc.CheckString("optional"); sc.MustGetString (); + picnum = TexMan.CheckForTexture (sc.String, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny); + if (!picnum.Exists()) { - Printf ("Unknown flat %s\n", sc.String); - sc.MustGetString (); + if (!opt) + { + Printf("Unknown flat %s\n", sc.String); + } + sc.MustGetString(); return; } sc.MustGetString (); diff --git a/src/r_data/r_interpolate.cpp b/src/r_data/r_interpolate.cpp index 5f2632737b..4e0781a98a 100644 --- a/src/r_data/r_interpolate.cpp +++ b/src/r_data/r_interpolate.cpp @@ -344,9 +344,10 @@ int DInterpolation::AddRef() // //========================================================================== -int DInterpolation::DelRef() +int DInterpolation::DelRef(bool force) { if (refcount > 0) --refcount; + if (force && refcount == 0) Destroy(); return refcount; } @@ -943,20 +944,6 @@ DInterpolation *sector_t::SetInterpolation(int position, bool attach) // //========================================================================== -void sector_t::StopInterpolation(int position) -{ - if (interpolations[position] != NULL) - { - interpolations[position]->DelRef(); - } -} - -//========================================================================== -// -// -// -//========================================================================== - DInterpolation *FPolyObj::SetInterpolation() { if (interpolation != NULL) diff --git a/src/r_data/r_interpolate.h b/src/r_data/r_interpolate.h index 29e8a61712..92e74c3f29 100644 --- a/src/r_data/r_interpolate.h +++ b/src/r_data/r_interpolate.h @@ -25,7 +25,7 @@ protected: public: int AddRef(); - int DelRef(); + int DelRef(bool force = false); virtual void Destroy(); virtual void UpdateInterpolation() = 0; diff --git a/src/r_defs.h b/src/r_defs.h index aae0a9d676..d67c633eba 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -542,7 +542,6 @@ struct sector_t sector_t *GetHeightSec() const; DInterpolation *SetInterpolation(int position, bool attach); - void StopInterpolation(int position); ASkyViewpoint *GetSkyBox(int which); diff --git a/src/sc_man_scanner.re b/src/sc_man_scanner.re index 519ee4a1e7..7f15d862e2 100644 --- a/src/sc_man_scanner.re +++ b/src/sc_man_scanner.re @@ -55,6 +55,8 @@ std2: /*!re2c "/*" { goto comment; } /* C comment */ "//" (any\"\n")* "\n" { goto newline; } /* C++ comment */ + ("#region"|"#endregion") (any\"\n")* "\n" + { goto newline; } /* Region blocks [mxd] */ /* C Keywords */ 'break' { RET(TK_Break); } @@ -241,6 +243,8 @@ std2: /*!re2c "/*" { goto comment; } /* C comment */ ("//"|";") (any\"\n")* "\n" { goto newline; } /* C++/Hexen comment */ + ("#region"|"#endregion") (any\"\n")* "\n" + { goto newline; } /* Region blocks [mxd] */ WSP+ { goto std1; } /* whitespace */ "\n" { goto newline; } @@ -259,6 +263,8 @@ std2: /*!re2c "/*" { goto comment; } /* C comment */ "//" (any\"\n")* "\n" { goto newline; } /* C++ comment */ + ("#region"|"#endregion") (any\"\n")* "\n" + { goto newline; } /* Region blocks [mxd] */ WSP+ { goto std1; } /* whitespace */ "\n" { goto newline; } diff --git a/src/sound/oalload.h b/src/sound/oalload.h index 7d4e62287f..986131b2c9 100644 --- a/src/sound/oalload.h +++ b/src/sound/oalload.h @@ -1,7 +1,11 @@ #ifndef OALDEF_H #define OALDEF_H -#if defined _WIN32 && !defined NO_OPENAL +#ifndef NO_OPENAL + +#ifndef _WIN32 +typedef void* FARPROC; +#endif #define DEFINE_ENTRY(type, name) static type p_##name; #include "oaldef.h" diff --git a/src/sound/oalsound.cpp b/src/sound/oalsound.cpp index a5ec97f97e..6030c9142c 100644 --- a/src/sound/oalsound.cpp +++ b/src/sound/oalsound.cpp @@ -36,6 +36,8 @@ #define WIN32_LEAN_AND_MEAN #include #define USE_WINDOWS_DWORD +#else +#include #endif #include "except.h" @@ -61,14 +63,23 @@ CVAR (Bool, snd_efx, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) #ifdef _WIN32 static HMODULE hmodOpenAL; +#define OPENALLIB "openal32.dll" +#else +static void* hmodOpenAL; +#ifdef __APPLE__ +#define OPENALLIB "OpenAL.framework/OpenAL" +#else +#define OPENALLIB "libopenal.so" +#endif +#define LoadLibrary(x) dlopen((x), RTLD_LAZY) +#define GetProcAddress(a,b) dlsym((a),(b)) +#define FreeLibrary(x) dlclose((x)) #endif bool IsOpenALPresent() { #ifdef NO_OPENAL return false; -#elif !defined _WIN32 - return true; #else static bool cached_result = false; static bool done = false; @@ -78,10 +89,10 @@ bool IsOpenALPresent() done = true; if (hmodOpenAL == NULL) { - hmodOpenAL = LoadLibrary(NicePath("$PROGDIR/openal32.dll")); + hmodOpenAL = LoadLibrary(NicePath("$PROGDIR/" OPENALLIB)); if (hmodOpenAL == NULL) { - hmodOpenAL = LoadLibrary("openal32.dll"); + hmodOpenAL = LoadLibrary(OPENALLIB); if (hmodOpenAL == NULL) { return false; @@ -90,7 +101,7 @@ bool IsOpenALPresent() for(int i = 0; oalfuncs[i].name != NULL; i++) { *oalfuncs[i].funcaddr = GetProcAddress(hmodOpenAL, oalfuncs[i].name); - if (oalfuncs[i].funcaddr == NULL) + if (*oalfuncs[i].funcaddr == NULL) { FreeLibrary(hmodOpenAL); hmodOpenAL = NULL; diff --git a/wadsrc/static/actors/doom/fatso.txt b/wadsrc/static/actors/doom/fatso.txt index 0b30393257..88eaef39b3 100644 --- a/wadsrc/static/actors/doom/fatso.txt +++ b/wadsrc/static/actors/doom/fatso.txt @@ -34,7 +34,7 @@ ACTOR Fatso FATT H 10 BRIGHT A_FatAttack2 FATT IG 5 A_FaceTarget FATT H 10 BRIGHT A_FatAttack3 - FATT IG 5 + FATT IG 5 A_FaceTarget Goto See Pain: FATT J 3 diff --git a/wadsrc/static/actors/doom/painelemental.txt b/wadsrc/static/actors/doom/painelemental.txt index 5951afd6b5..ab0cd5cc9a 100644 --- a/wadsrc/static/actors/doom/painelemental.txt +++ b/wadsrc/static/actors/doom/painelemental.txt @@ -29,8 +29,8 @@ ACTOR PainElemental Missile: PAIN D 5 A_FaceTarget PAIN E 5 A_FaceTarget - PAIN F 4 BRIGHT A_FaceTarget - PAIN F 1 BRIGHT A_PainAttack + PAIN F 5 BRIGHT A_FaceTarget + PAIN F 0 BRIGHT A_PainAttack Goto See Pain: PAIN G 6 diff --git a/wadsrc/static/actors/doom/revenant.txt b/wadsrc/static/actors/doom/revenant.txt index ce072bec46..1a5045f345 100644 --- a/wadsrc/static/actors/doom/revenant.txt +++ b/wadsrc/static/actors/doom/revenant.txt @@ -31,7 +31,7 @@ ACTOR Revenant SKEL AABBCCDDEEFF 2 A_Chase Loop Melee: - SKEL G 1 A_FaceTarget + SKEL G 0 A_FaceTarget SKEL G 6 A_SkelWhoosh SKEL H 6 A_FaceTarget SKEL I 6 A_SkelFist diff --git a/wadsrc/static/confont.lmp b/wadsrc/static/confont.lmp index 3d46a3ca4c..6b68df2e3e 100644 Binary files a/wadsrc/static/confont.lmp and b/wadsrc/static/confont.lmp differ