This commit is contained in:
Christoph Oelckers 2016-02-10 10:05:14 +01:00
commit 15177c34f9
4 changed files with 24 additions and 19 deletions

View file

@ -217,20 +217,10 @@ endif()
if( NOT NO_OPENAL )
find_package( OpenAL )
mark_as_advanced(CLEAR OPENAL_INCLUDE_DIR)
if( NOT WIN32 )
mark_as_advanced(CLEAR OPENAL_LIBRARY)
endif()
if( OPENAL_FOUND )
if( OPENAL_INCLUDE_DIR )
include_directories( ${OPENAL_INCLUDE_DIR} )
if( NOT WIN32 )
set( ZDOOM_LIBS ${OPENAL_LIBRARY} ${ZDOOM_LIBS} )
endif()
else()
if ( NOT WIN32 )
set( NO_OPENAL ON )
else()
include_directories( ${OPENAL_INCLUDE_DIR} )
endif()
set( NO_OPENAL ON )
endif()
endif()

View file

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

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;