Merge branch 'maint' of https://github.com/rheit/zdoom into maint

This commit is contained in:
Christoph Oelckers 2016-02-18 01:22:03 +01:00
commit ccd3d42037
12 changed files with 46 additions and 38 deletions

View file

@ -216,13 +216,12 @@ endif( WIN32 )
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 )

View file

@ -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;
}
}

View file

@ -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);

View file

@ -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();

View file

@ -626,7 +626,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact)
}
else
{ // Seek
self->angle = self->AngleTo(target);
angle = self->AngleTo(target);
newAngle = true;
}
}

View file

@ -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

View file

@ -478,7 +478,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
(floor->m_Direction<0 && floor->m_FloorDestDist<sec->floorplane.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

View file

@ -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)

View file

@ -25,7 +25,7 @@ protected:
public:
int AddRef();
int DelRef();
int DelRef(bool force = false);
virtual void Destroy();
virtual void UpdateInterpolation() = 0;

View file

@ -497,7 +497,6 @@ struct sector_t
sector_t *GetHeightSec() const;
DInterpolation *SetInterpolation(int position, bool attach);
void StopInterpolation(int position);
ASkyViewpoint *GetSkyBox(int which);

View file

@ -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"

View file

@ -36,6 +36,8 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define USE_WINDOWS_DWORD
#else
#include <dlfcn.h>
#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;