Compare commits

..

21 Commits

Author SHA1 Message Date
Alibek Omarov
901b35d4b1 ref: soft: rework @SNMetamorph's fix for avoiding crash when no world is set (like Customize menu with enabled 3D view) 2024-01-27 17:31:34 +03:00
Alibek Omarov
eaafd0ff13 ref: gl: rework @SNMetamorph's fix for avoiding crash when no world is set (like Customize menu with enabled 3D view) 2024-01-27 17:31:26 +03:00
Alibek Omarov
963d9b8f2a ref: soft: remove useless R_CountDynamicLights function 2024-01-27 17:16:01 +03:00
Alibek Omarov
5696c9c96a ref: gl: remove useless R_CountDynamicLights function 2024-01-27 17:15:57 +03:00
Alibek Omarov
862b9e68be engine: server: fix possible null pointer dereference 2024-01-25 16:21:55 +03:00
Alibek Omarov
2f2890cd11 engine: client: use PARM_TEX_FILTERING to figure out whether we should apply half-texel trick to HUD textures when scaling 2024-01-25 05:50:11 +03:00
Alibek Omarov
482aa840e7 ref: soft: add PARM_TEX_FILTERING handler (stub) 2024-01-25 05:47:12 +03:00
Alibek Omarov
4599983c8e ref: gl: add PARM_TEX_FILTERING handler 2024-01-25 05:46:54 +03:00
Alibek Omarov
11172838f2 engine: ref_api: add PARM_TEX_FILTERING into RefAPI to query if filtering is enabled for selected texture 2024-01-25 05:43:51 +03:00
Alibek Omarov
47bc50b8c6 engine: client: fix taking console color from colors.lst 2024-01-25 04:22:20 +03:00
Alibek Omarov
7c82766a5c readme: add sourcehut builds badge [skip ci] 2024-01-24 21:10:21 +03:00
Alibek Omarov
5d6cf62405 engine: client: voice: open microphone only after server sends svc_voiceinit to us and shutdown immediately after disconnect 2024-01-24 20:52:21 +03:00
Alibek Omarov
edc08e39ef common: move FORCEINLINE from port.h to xash3d_types.h, alongside other compiler-specific attributes 2024-01-24 20:51:34 +03:00
Alibek Omarov
a9846e765d waf: upgrade to latest waifu 2024-01-23 21:34:49 +03:00
Alibek Omarov
aa54309d5c engine: wscript: fix pthreads check by explicitly checking it in C mode 2024-01-23 21:23:23 +03:00
Alibek Omarov
443317bedf wscript: fix RPATH under OpenBSD 2024-01-23 21:03:10 +03:00
Alibek Omarov
ffd320507f ci: enable builds.sr.ht 2024-01-23 20:42:09 +03:00
Alibek Omarov
60df08c11c engine: crashhandler: fix build for NetBSD AMD64 2024-01-23 20:25:17 +03:00
Alibek Omarov
7d464df107 engine: platform: linux: define portability macro for sigevent (oh, glibc...) 2024-01-23 19:22:56 +03:00
Alibek Omarov
296f89acf9 engine: platform: linux: fix build with musl (and probably other libcs) using portability macro 2024-01-23 18:57:33 +03:00
mittorn
5f31417bae ref_gl: fix missing vboarray split transition on some maps 2024-01-19 21:28:49 +03:00
33 changed files with 334 additions and 133 deletions

27
.builds/alpine.yml Normal file
View File

@@ -0,0 +1,27 @@
image: alpine/latest
packages:
- build-base
- sdl2-dev
- freetype-dev
- fontconfig-dev
- opus-dev
sources:
- https://git.sr.ht/~a1batross/xash3d-fwgs
tasks:
- client: |
cd xash3d-fwgs
./waf configure -8 --enable-tests --enable-engine-tests build install --destdir=bin
- server: |
cd xash3d-fwgs
./waf configure --reconfigure --dedicated build install --destdir=bin
- run-tests: |
cd xash3d-fwgs/bin
export SDL_VIDEODRIVER=wayland
./xash3d -runtests
./xash -runtests
rm -rf valve/gameinfo.txt test_*
- package: |
cd xash3d-fwgs/bin
tar -cjvf xash3d-fwgs-alpine-amd64.tar.bz2 *
artifacts:
- xash3d-fwgs/bin/xash3d-fwgs-alpine-amd64.tar.bz2

30
.builds/debian-arm64.yml Normal file
View File

@@ -0,0 +1,30 @@
image: debian/sid
arch: amd64
packages:
- build-essential
- python-is-python3
- libsdl2-dev
- libfreetype-dev
- libfontconfig-dev
- libopus-dev
sources:
- https://git.sr.ht/~a1batross/xash3d-fwgs
tasks:
- client: |
cd xash3d-fwgs
./waf configure -8 --enable-tests --enable-engine-tests build install --destdir=bin
- server: |
cd xash3d-fwgs
./waf configure --reconfigure --dedicated build install --destdir=bin
- run-tests: |
cd xash3d-fwgs/bin
export SDL_VIDEODRIVER=wayland
./xash3d -runtests
./xash -runtests
rm -rf valve/gameinfo.txt test_*
- package: |
cd xash3d-fwgs/bin
tar -cjvf xash3d-fwgs-debian-arm64.tar.bz2 *
artifacts:
- xash3d-fwgs/bin/xash3d-fwgs-debian-arm64.tar.bz2

29
.builds/debian.yml Normal file
View File

@@ -0,0 +1,29 @@
image: debian/sid
packages:
- build-essential
- python-is-python3
- libsdl2-dev
- libfreetype-dev
- libfontconfig-dev
- libopus-dev
sources:
- https://git.sr.ht/~a1batross/xash3d-fwgs
tasks:
- client: |
cd xash3d-fwgs
./waf configure -8 --enable-tests --enable-engine-tests build install --destdir=bin
- server: |
cd xash3d-fwgs
./waf configure --reconfigure --dedicated build install --destdir=bin
- run-tests: |
cd xash3d-fwgs/bin
export SDL_VIDEODRIVER=wayland
./xash3d -runtests
./xash -runtests
rm -rf valve/gameinfo.txt test_*
- package: |
cd xash3d-fwgs/bin
tar -cjvf xash3d-fwgs-debian-amd64.tar.bz2 *
artifacts:
- xash3d-fwgs/bin/xash3d-fwgs-debian-amd64.tar.bz2

29
.builds/freebsd.yml Normal file
View File

@@ -0,0 +1,29 @@
image: freebsd/latest
packages:
- lang/python
- devel/pkgconf
- devel/sdl20
- print/freetype2
- x11-fonts/fontconfig
- audio/opus
sources:
- https://git.sr.ht/~a1batross/xash3d-fwgs
tasks:
- client: |
cd xash3d-fwgs
./waf configure --enable-tests --enable-engine-tests build install --destdir=bin
- server: |
cd xash3d-fwgs
./waf configure --reconfigure --dedicated build install --destdir=bin
- run-tests: |
cd xash3d-fwgs/bin
export SDL_VIDEODRIVER=wayland
./xash3d -runtests
./xash -runtests
rm -rf valve/gameinfo.txt test_*
- package: |
cd xash3d-fwgs/bin
tar -cjvf xash3d-fwgs-freebsd-amd64.tar.bz2 *
artifacts:
- xash3d-fwgs/bin/xash3d-fwgs-freebsd-amd64.tar.bz2

29
.builds/netbsd.yml Normal file
View File

@@ -0,0 +1,29 @@
image: netbsd/latest
packages:
- python311
- SDL2
- freetype2
- fontconfig
- libopus
- pkgconf
sources:
- https://git.sr.ht/~a1batross/xash3d-fwgs
tasks:
- client: |
cd xash3d-fwgs
python3.11 waf configure --enable-tests --enable-engine-tests build install --destdir=bin
- server: |
cd xash3d-fwgs
python3.11 waf configure --reconfigure --dedicated build install --destdir=bin
- run-tests: |
cd xash3d-fwgs/bin
export SDL_VIDEODRIVER=wayland
./xash3d -runtests
./xash -runtests
rm -rf valve/gameinfo.txt test_*
- package: |
cd xash3d-fwgs/bin
tar -cjvf xash3d-fwgs-netbsd-amd64.tar.bz2 *
artifacts:
- xash3d-fwgs/bin/xash3d-fwgs-netbsd-amd64.tar.bz2

26
.builds/openbsd.yml Normal file
View File

@@ -0,0 +1,26 @@
image: openbsd/latest
packages:
- python3
- sdl2
- opus
sources:
- https://git.sr.ht/~a1batross/xash3d-fwgs
tasks:
- client: |
cd xash3d-fwgs
python3 waf configure --enable-tests --enable-engine-tests build install --destdir=bin
- server: |
cd xash3d-fwgs
python3 waf configure --reconfigure --dedicated build install --destdir=bin
- run-tests: |
cd xash3d-fwgs/bin
export SDL_VIDEODRIVER=wayland
./xash3d -runtests
./xash -runtests
rm -rf valve/gameinfo.txt test_*
- package: |
cd xash3d-fwgs/bin
tar -cjvf xash3d-fwgs-openbsd-amd64.tar.bz2 *
artifacts:
- xash3d-fwgs/bin/xash3d-fwgs-openbsd-amd64.tar.bz2

View File

@@ -1,5 +1,5 @@
# Xash3D FWGS Engine <img align="right" width="128" height="128" src="https://github.com/FWGS/xash3d-fwgs/raw/master/game_launch/icon-xash-material.png" alt="Xash3D FWGS icon" />
[![GitHub Actions Status](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml/badge.svg)](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [![FreeBSD Build Status](https://img.shields.io/cirrus/github/FWGS/xash3d-fwgs?label=freebsd%20build)](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) [![Discord Server](https://img.shields.io/discord/355697768582610945.svg)](http://fwgsdiscord.mentality.rip/) \
[![builds.sr.ht status](https://builds.sr.ht/~a1batross/xash3d-fwgs.svg)](https://builds.sr.ht/~a1batross/xash3d-fwgs?) [![GitHub Actions Status](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml/badge.svg)](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [![FreeBSD Build Status](https://img.shields.io/cirrus/github/FWGS/xash3d-fwgs?label=freebsd%20build)](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) [![Discord Server](https://img.shields.io/discord/355697768582610945.svg)](http://fwgsdiscord.mentality.rip/) \
[![Download Stable](https://img.shields.io/badge/download-stable-yellow)](https://github.com/FWGS/xash3d-fwgs/releases/latest) [![Download Testing](https://img.shields.io/badge/downloads-testing-orange)](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous)
Xash3D FWGS is a game engine, aimed to provide compatibility with Half-Life Engine and extend it, as well as to give game developers well known workflow.

View File

@@ -35,7 +35,6 @@ GNU General Public License for more details.
#define __cdecl
#define __stdcall
#define _inline static inline
#define FORCEINLINE inline __attribute__((always_inline))
#if XASH_POSIX
#include <unistd.h>
@@ -63,13 +62,6 @@ GNU General Public License for more details.
int x, y;
} POINT;
#else // WIN32
#ifdef __MINGW32__
#define _inline static inline
#define FORCEINLINE inline __attribute__((always_inline))
#else
#define FORCEINLINE __forceinline
#endif
#define open _open
#define read _read
#define alloca _alloca

View File

@@ -86,6 +86,8 @@ typedef uint64_t longtime_t;
#define NORETURN __attribute__((noreturn))
#define NONNULL __attribute__((nonnull))
#define ALLOC_CHECK(x) __attribute__((alloc_size(x)))
#define FORCEINLINE inline __attribute__((always_inline))
#define NOINLINE __attribute__((noinline))
#elif defined(_MSC_VER)
#define EXPORT __declspec( dllexport )
#define GAME_EXPORT
@@ -93,6 +95,8 @@ typedef uint64_t longtime_t;
#define NORETURN
#define NONNULL
#define ALLOC_CHECK(x)
#define FORCEINLINE __forceinline
#define NOINLINE __declspec( noinline )
#else
#define EXPORT
#define GAME_EXPORT
@@ -100,6 +104,8 @@ typedef uint64_t longtime_t;
#define NORETURN
#define NONNULL
#define ALLOC_CHECK(x)
#define FORCEINLINE
#define NOINLINE
#endif
#if ( __GNUC__ >= 3 )

View File

@@ -357,20 +357,23 @@ void SPR_AdjustSize( float *x, float *y, float *w, float *h )
*h *= yscale;
}
void SPR_AdjustTexCoords( float width, float height, float *s1, float *t1, float *s2, float *t2 )
static void SPR_AdjustTexCoords( int texnum, float width, float height, float *s1, float *t1, float *s2, float *t2 )
{
if( refState.width != clgame.scrInfo.iWidth )
if( REF_GET_PARM( PARM_TEX_FILTERING, texnum ))
{
// align to texel if scaling
*s1 += 0.5f;
*s2 -= 0.5f;
}
if( refState.width != clgame.scrInfo.iWidth )
{
// align to texel if scaling
*s1 += 0.5f;
*s2 -= 0.5f;
}
if( refState.height != clgame.scrInfo.iHeight )
{
// align to texel if scaling
*t1 += 0.5f;
*t2 -= 0.5f;
if( refState.height != clgame.scrInfo.iHeight )
{
// align to texel if scaling
*t1 += 0.5f;
*t2 -= 0.5f;
}
}
*s1 /= width;
@@ -402,6 +405,8 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei
height = h;
}
texnum = ref.dllFuncs.R_GetSpriteTexture( clgame.ds.pSprite, frame );
if( prc )
{
wrect_t rc = *prc;
@@ -418,7 +423,7 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei
t2 = rc.bottom;
// calc user-defined rectangle
SPR_AdjustTexCoords( width, height, &s1, &t1, &s2, &t2 );
SPR_AdjustTexCoords( texnum, width, height, &s1, &t1, &s2, &t2 );
width = rc.right - rc.left;
height = rc.bottom - rc.top;
}
@@ -434,7 +439,6 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei
// scale for screen sizes
SPR_AdjustSize( &x, &y, &width, &height );
texnum = ref.dllFuncs.R_GetSpriteTexture( clgame.ds.pSprite, frame );
ref.dllFuncs.Color4ub( clgame.ds.spriteColor[0], clgame.ds.spriteColor[1], clgame.ds.spriteColor[2], clgame.ds.spriteColor[3] );
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, texnum );
}

View File

@@ -1092,6 +1092,11 @@ static int pfnDelete( const char *path )
return FS_Delete( path );
}
static void GAME_EXPORT pfnCon_DefaultColor( int r, int g, int b )
{
Con_DefaultColor( r, g, b, true );
}
// engine callbacks
static ui_enginefuncs_t gEngfuncs =
{
@@ -1131,7 +1136,7 @@ static ui_enginefuncs_t gEngfuncs =
UI_DrawConsoleString,
UI_DrawSetTextColor,
Con_DrawStringLen,
Con_DefaultColor,
pfnCon_DefaultColor,
pfnGetPlayerModel,
pfnSetPlayerModel,
pfnClearScene,

View File

@@ -3139,7 +3139,7 @@ void CL_Init( void )
VID_Init(); // init video
S_Init(); // init sound
Voice_Init( VOICE_DEFAULT_CODEC, 3 ); // init voice
Voice_Init( VOICE_DEFAULT_CODEC, 3, true ); // init voice (do not open the device)
// unreliable buffer. unsed for unreliable commands and voice stream
MSG_Init( &cls.datagram, "cls.datagram", cls.datagram_buf, sizeof( cls.datagram_buf ));

View File

@@ -1778,7 +1778,7 @@ void CL_ParseVoiceInit( sizebuf_t *msg )
char *pszCodec = MSG_ReadString( msg );
int quality = MSG_ReadByte( msg );
Voice_Init( pszCodec, quality );
Voice_Init( pszCodec, quality, false ); // init requested codec and the device
}
/*

View File

@@ -846,7 +846,6 @@ model_t *CL_LoadClientSprite( const char *filename );
model_t *CL_LoadModel( const char *modelname, int *index );
HSPRITE pfnSPR_LoadExt( const char *szPicName, uint texFlags );
void SPR_AdjustSize( float *x, float *y, float *w, float *h );
void SPR_AdjustTexCoords( float width, float height, float *s1, float *t1, float *s2, float *t2 );
int CL_GetScreenInfo( SCREENINFO *pscrinfo );
void CL_FillRGBA( int x, int y, int width, int height, int r, int g, int b, int a );
pmtrace_t *PM_CL_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe );
@@ -1072,7 +1071,7 @@ int Con_UtfProcessChar( int in );
int Con_UtfProcessCharForce( int in );
int Con_UtfMoveLeft( char *str, int pos );
int Con_UtfMoveRight( char *str, int pos, int length );
void Con_DefaultColor( int r, int g, int b );
void Con_DefaultColor( int r, int g, int b, qboolean gameui );
void Con_InvalidateFonts( void );
cl_font_t *Con_GetCurFont( void );
cl_font_t *Con_GetFont( int num );

View File

@@ -175,10 +175,10 @@ static void Con_SetColor( void )
switch( num )
{
case 1:
Con_DefaultColor( r, r, r );
Con_DefaultColor( r, r, r, false );
break;
case 3:
Con_DefaultColor( r, g, b );
Con_DefaultColor( r, g, b, false );
break;
default:
Cvar_DirectSet( &con_color, con_color.def_string );
@@ -2310,11 +2310,20 @@ Con_DefaultColor
called from MainUI
=========
*/
void GAME_EXPORT Con_DefaultColor( int r, int g, int b )
void Con_DefaultColor( int r, int g, int b, qboolean gameui )
{
r = bound( 0, r, 255 );
g = bound( 0, g, 255 );
b = bound( 0, b, 255 );
// gameui wants to override console color... check if it's not default
if( gameui && ( g_color_table[7][0] != r || g_color_table[7][1] != g || g_color_table[7][2] != b ))
{
// yes, different from default orange, disable con_color
SetBits( con_color.flags, FCVAR_READ_ONLY );
ClearBits( con_color.flags, FCVAR_CHANGED );
}
MakeRGBA( g_color_table[7], r, g, b, 255 );
}

View File

@@ -428,6 +428,9 @@ void Voice_Disconnect( void )
voice.players_status[i].talking_ack = false;
}
}
VoiceCapture_Shutdown();
voice.device_opened = false;
}
/*
@@ -588,48 +591,53 @@ Voice_Init
Initialize the voice subsystem
=========================
*/
qboolean Voice_Init( const char *pszCodecName, int quality )
qboolean Voice_Init( const char *pszCodecName, int quality, qboolean preinit )
{
if( !voice_enable.value )
return false;
if( Q_strcmp( pszCodecName, VOICE_OPUS_CUSTOM_CODEC ))
{
Con_Printf( S_ERROR "Server requested unsupported codec: %s\n", pszCodecName );
return false;
}
// reinitialize only if codec parameters are different
if( !Q_strcmp( voice.codec, pszCodecName ) && voice.quality == quality )
return true;
Voice_Shutdown();
voice.autogain.block_size = 128;
if( !Voice_InitOpusDecoder( ))
if( Q_strcmp( pszCodecName, voice.codec ) || voice.quality != quality )
{
// no reason to init encoder and open audio device
// if we can't hear other players
Con_Printf( S_ERROR "Voice chat disabled.\n" );
Voice_Shutdown();
return false;
if( Q_strcmp( pszCodecName, VOICE_OPUS_CUSTOM_CODEC ))
{
Con_Printf( S_ERROR "Server requested unsupported codec: %s\n", pszCodecName );
return false;
}
voice.autogain.block_size = 128;
if( !Voice_InitOpusDecoder( ))
{
// no reason to init encoder and open audio device
// if we can't hear other players
Con_Printf( S_ERROR "Voice chat disabled.\n" );
Voice_Shutdown();
return false;
}
// we can hear others players, so it's fine to fail now
voice.initialized = true;
Q_strncpy( voice.codec, pszCodecName, sizeof( voice.codec ));
if( !Voice_InitOpusEncoder( quality ))
{
Con_Printf( S_WARN "Other players will not be able to hear you.\n" );
return false;
}
voice.quality = quality;
}
// we can hear others players, so it's fine to fail now
voice.initialized = true;
Q_strncpy( voice.codec, pszCodecName, sizeof( voice.codec ));
if( !Voice_InitOpusEncoder( quality ))
if( !preinit )
{
Con_Printf( S_WARN "Other players will not be able to hear you.\n" );
return false;
voice.device_opened = VoiceCapture_Init();
if( !voice.device_opened )
Con_Printf( S_WARN "No microphone is available.\n" );
}
voice.quality = quality;
if( !VoiceCapture_Init( ))
Con_Printf( S_WARN "No microphone is available.\n" );
return true;
}

View File

@@ -53,6 +53,7 @@ typedef struct voice_state_s
qboolean initialized;
qboolean is_recording;
qboolean device_opened;
double start_time;
voice_status_t local;
@@ -92,7 +93,7 @@ extern voice_state_t voice;
void CL_AddVoiceToDatagram( void );
void Voice_RegisterCvars( void );
qboolean Voice_Init( const char *pszCodecName, int quality );
qboolean Voice_Init( const char *pszCodecName, int quality, qboolean preinit );
void Voice_Idle( double frametime );
qboolean Voice_IsRecording( void );
void Voice_RecordStop( void );

View File

@@ -372,9 +372,9 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
bp = (void**)ucontext->uc_mcontext.mc_rbp;
sp = (void**)ucontext->uc_mcontext.mc_rsp;
#elif XASH_NETBSD
pc = (void*)ucontext->uc_mcontext.__gregs[REG_RIP];
bp = (void**)ucontext->uc_mcontext.__gregs[REG_RBP];
sp = (void**)ucontext->uc_mcontext.__gregs[REG_RSP];
pc = (void*)ucontext->uc_mcontext.__gregs[_REG_RIP];
bp = (void**)ucontext->uc_mcontext.__gregs[_REG_RBP];
sp = (void**)ucontext->uc_mcontext.__gregs[_REG_RSP];
#elif XASH_OPENBSD
pc = (void*)ucontext->sc_rip;
bp = (void**)ucontext->sc_rbp;

View File

@@ -29,7 +29,8 @@ GNU General Public License for more details.
#include "platform/platform.h"
#include <sys/types.h>
#if defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 30)
#if defined( __GLIBC__ )
#if ( __GLIBC__ <= 2 ) && ( __GLIBC_MINOR__ <= 30 )
// Library support was added in glibc 2.30.
// Earlier glibc versions did not provide a wrapper for this system call,
// necessitating the use of syscall(2).
@@ -39,7 +40,14 @@ static pid_t gettid( void )
{
return syscall( SYS_gettid );
}
#endif
#endif // ( __GLIBC__ <= 2 ) && ( __GLIBC_MINOR__ <= 30 )
// Glibc misses this macro in POSIX headers (bits/types/sigevent_t.h)
// but it does present in Linux headers (asm-generic/siginfo.h) and musl
#if !defined( sigev_notify_thread_id )
#define sigev_notify_thread_id _sigev_un._tid
#endif // !defined( sigev_notify_thread_id )
#endif // defined(__GLIBC__)
static void *g_hsystemd;
static int (*g_pfn_sd_notify)( int unset_environment, const char *state );
@@ -150,7 +158,7 @@ void Linux_SetTimer( float tm )
// this path availiable in POSIX, but may signal wrong thread...
// sev.sigev_notify = SIGEV_SIGNAL;
sev.sigev_notify = SIGEV_THREAD_ID;
sev._sigev_un._tid = gettid();
sev.sigev_notify_thread_id = gettid();
sev.sigev_signo = DEBUG_TIMER_SIGNAL;
sev.sigev_value.sival_ptr = &timerid;
timer_create( CLOCK_REALTIME, &sev, &timerid );

View File

@@ -283,6 +283,12 @@ typedef enum
PARM_GET_MOVEVARS_PTR = -13, // clgame.movevars
PARM_GET_PALETTE_PTR = -14, // clgame.palette
PARM_GET_VIEWENT_PTR = -15, // clgame.viewent
// implemented by ref_dll
// returns non-null integer if filtering is enabled for texture
// pass -1 to query global filtering settings
PARM_TEX_FILTERING = -65536,
} ref_parm_e;
typedef struct ref_api_s

View File

@@ -545,7 +545,7 @@ void SV_FreeOldEntities( void )
}
// decrement svgame.numEntities if the highest number entities died
for( ; EDICT_NUM( svgame.numEntities - 1 )->free; svgame.numEntities-- );
for( ; ( ent = EDICT_NUM( svgame.numEntities - 1 )) && ent->free; svgame.numEntities-- );
}
/*

View File

@@ -1842,8 +1842,10 @@ void SV_Physics( void )
// increase framecount
sv.framecount++;
#if 0 // figure out why this causes memory corruption
// decrement svgame.numEntities if the highest number entities died
for( ; EDICT_NUM( svgame.numEntities - 1 )->free; svgame.numEntities-- );
for( ; ( ent = EDICT_NUM( svgame.numEntities - 1 )) && ent->free; svgame.numEntities-- );
#endif
}
/*

View File

@@ -90,7 +90,7 @@ def configure(conf):
conf.define('XASH_NO_LIBDL',1)
if not conf.env.DEST_OS in ['win32', 'android'] and not conf.options.NO_ASYNC_RESOLVE:
conf.check_pthreads()
conf.check_pthreads(mode='c')
if conf.env.DEST_OS == 'linux':
conf.check_cc(lib='rt')

View File

@@ -167,6 +167,25 @@ qboolean Mod_ProcessRenderData( model_t *mod, qboolean create, const byte *buf )
return loaded;
}
static qboolean R_TextureFilteringEnabled( int arg )
{
gl_texture_t *glt;
if( arg < 0 )
return gl_texture_nearest.value == 0.0f;
glt = R_GetTexture( arg );
if( FBitSet( glt->flags, TF_NEAREST ))
return false;
// lightmaps have special cvar
if( FBitSet( glt->flags, TF_ATLAS_PAGE ))
return gl_lightmap_nearest.value == 0.0f;
return gl_texture_nearest.value == 0.0f;
}
static int GL_RefGetParm( int parm, int arg )
{
gl_texture_t *glt;
@@ -237,6 +256,8 @@ static int GL_RefGetParm( int parm, int arg )
return glState.stencilEnabled;
case PARM_SKY_SPHERE:
return FBitSet( tr.world->flags, FWORLD_SKYSPHERE ) && !FBitSet( tr.world->flags, FWORLD_CUSTOM_SKYBOX );
case PARM_TEX_FILTERING:
return R_TextureFilteringEnabled( arg );
default:
return ENGINE_GET_PARM_( parm, arg );
}

View File

@@ -383,7 +383,6 @@ void R_AnimateLight( void );
void R_GetLightSpot( vec3_t lightspot );
void R_MarkLights( dlight_t *light, int bit, mnode_t *node );
colorVec R_LightVec( const vec3_t start, const vec3_t end, vec3_t lightspot, vec3_t lightvec );
int R_CountSurfaceDlights( msurface_t *surf );
colorVec R_LightPoint( const vec3_t p0 );
//

View File

@@ -153,8 +153,12 @@ void R_PushDlights( void )
tr.dlightframecount = tr.framecount;
RI.currententity = CL_GetEntityByIndex( 0 );
if( RI.currententity )
RI.currentmodel = RI.currententity->model;
// no world -- no dlights
if( !RI.currententity )
return;
RI.currentmodel = RI.currententity->model;
for( i = 0; i < MAX_DLIGHTS; i++, l++ )
{
@@ -166,31 +170,10 @@ void R_PushDlights( void )
if( GL_FrustumCullSphere( &RI.frustum, l->origin, l->radius, 15 ))
continue;
if( RI.currententity )
R_MarkLights( l, 1<<i, RI.currentmodel->nodes );
R_MarkLights( l, 1<<i, RI.currentmodel->nodes );
}
}
/*
=============
R_CountSurfaceDlights
=============
*/
int R_CountSurfaceDlights( msurface_t *surf )
{
int i, numDlights = 0;
for( i = 0; i < MAX_DLIGHTS; i++ )
{
if(!( surf->dlightbits & BIT( i )))
continue; // not lit by this light
numDlights++;
}
return numDlights;
}
/*
=======================================================================

View File

@@ -527,7 +527,7 @@ texture_t *R_TextureAnimation( msurface_t *s )
R_AddDynamicLights
===============
*/
void R_AddDynamicLights( msurface_t *surf )
static void R_AddDynamicLights( msurface_t *surf )
{
float dist, rad, minlight;
int lnum, s, t, sd, td, smax, tmax;
@@ -541,7 +541,7 @@ void R_AddDynamicLights( msurface_t *surf )
uint *bl;
// no dlighted surfaces here
if( !R_CountSurfaceDlights( surf )) return;
if( !surf->dlightbits ) return;
sample_size = gEngfuncs.Mod_SampleSizeForFace( surf );
smax = (info->lightextents[0] / sample_size) + 1;
@@ -1947,9 +1947,10 @@ void R_GenerateVBO( void )
if( vbo->array_len + surf->polys->numverts > VBOINDEX_MAX )
{
vbotex->vboarray = vbo;
// generate new array and new vbotexture node
vbo->array = Mem_Calloc( vbos.mempool, sizeof( vbovertex_t ) * vbo->array_len );
gEngfuncs.Con_Printf( "R_GenerateVBOs: allocated array of %d verts, texture %d\n", vbo->array_len, j );
gEngfuncs.Con_Printf( "R_GenerateVBOs: allocated array of %d verts, texture %d, lm %d\n", vbo->array_len, j, k );
vbo->next = Mem_Calloc( vbos.mempool, sizeof( vboarray_t ) );
vbo = vbo->next;
vbotex->next = Mem_Calloc( vbos.mempool, sizeof( vbotexture_t ) );

View File

@@ -101,7 +101,6 @@ qboolean GAME_EXPORT Mod_ProcessRenderData( model_t *mod, qboolean create, const
return loaded;
}
static int GL_RefGetParm( int parm, int arg )
{
image_t *glt;
@@ -172,6 +171,8 @@ static int GL_RefGetParm( int parm, int arg )
return 0; //glState.stencilEnabled;
case PARM_SKY_SPHERE:
return 0; // ref_soft doesn't support sky sphere
case PARM_TEX_FILTERING:
return 0; // ref_soft doesn't do filtering in general
default:
return ENGINE_GET_PARM_( parm, arg );
}

View File

@@ -156,8 +156,12 @@ void R_PushDlights( void )
tr.dlightframecount = tr.framecount;
RI.currententity = CL_GetEntityByIndex( 0 );
if( RI.currententity )
RI.currentmodel = RI.currententity->model;
// no world -- no dlights
if( !RI.currententity )
return;
RI.currentmodel = RI.currententity->model;
for( i = 0; i < MAX_DLIGHTS; i++, l++ )
{
@@ -169,31 +173,10 @@ void R_PushDlights( void )
//if( GL_FrustumCullSphere( &RI.frustum, l->origin, l->radius, 15 ))
//continue;
if( RI.currententity )
R_MarkLights( l, 1<<i, RI.currentmodel->nodes );
R_MarkLights( l, 1<<i, RI.currentmodel->nodes );
}
}
/*
=============
R_CountSurfaceDlights
=============
*/
int R_CountSurfaceDlights( msurface_t *surf )
{
int i, numDlights = 0;
for( i = 0; i < MAX_DLIGHTS; i++ )
{
if(!( surf->dlightbits & BIT( i )))
continue; // not lit by this light
numDlights++;
}
return numDlights;
}
/*
=======================================================================

View File

@@ -461,7 +461,6 @@ void R_AnimateLight( void );
void R_GetLightSpot( vec3_t lightspot );
void R_MarkLights( dlight_t *light, int bit, mnode_t *node );
colorVec R_LightVec( const vec3_t start, const vec3_t end, vec3_t lightspot, vec3_t lightvec );
int R_CountSurfaceDlights( msurface_t *surf );
colorVec R_LightPoint( const vec3_t p0 );
#endif
//

View File

@@ -72,7 +72,7 @@ static void R_BuildLightMap( void );
R_AddDynamicLights
===============
*/
void R_AddDynamicLights( msurface_t *surf )
static void R_AddDynamicLights( msurface_t *surf )
{
float dist, rad, minlight;
int lnum, s, t, sd, td, smax, tmax;
@@ -86,7 +86,7 @@ void R_AddDynamicLights( msurface_t *surf )
uint *bl;
// no dlighted surfaces here
//if( !R_CountSurfaceDlights( surf )) return;
if( !surf->dlightbits ) return;
sample_size = gEngfuncs.Mod_SampleSizeForFace( surf );
smax = (info->lightextents[0] / sample_size) + 1;

12
waf vendored

File diff suppressed because one or more lines are too long

View File

@@ -357,6 +357,10 @@ def configure(conf):
conf.env.DEFAULT_RPATH = '/usr/share/su.xash.Engine/lib'
elif conf.env.DEST_OS == 'darwin':
conf.env.DEFAULT_RPATH = '@loader_path'
elif conf.env.DEST_OS == 'openbsd':
# OpenBSD requires -z origin to enable $ORIGIN expansion in RPATH
conf.env.RPATH_ST = '-Wl,-z,origin,-rpath,%s'
conf.env.DEFAULT_RPATH = '$ORIGIN'
else:
conf.env.DEFAULT_RPATH = '$ORIGIN'