mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-06 04:05:11 +08:00
Compare commits
177 Commits
continuous
...
continuous
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15bc09b06b | ||
|
|
315aea1991 | ||
|
|
380422a6dc | ||
|
|
be26ecf1c9 | ||
|
|
d2bbe9dfd2 | ||
|
|
9c929c1405 | ||
|
|
9551240680 | ||
|
|
6605d0456c | ||
|
|
99e8f7b486 | ||
|
|
5ac8f63741 | ||
|
|
9d3949a948 | ||
|
|
5bd1dd34b3 | ||
|
|
6862b14e59 | ||
|
|
dc1d65f621 | ||
|
|
fba3a2b67f | ||
|
|
b946c8455d | ||
|
|
c56e876043 | ||
|
|
9773d11464 | ||
|
|
3c28b11754 | ||
|
|
f2584dcb9d | ||
|
|
ce73838f1b | ||
|
|
49f972a7c9 | ||
|
|
1ae01d89de | ||
|
|
8e54e18c8f | ||
|
|
18136e5320 | ||
|
|
a29f1899d3 | ||
|
|
0f804ffc30 | ||
|
|
620a4b4894 | ||
|
|
4cf87c2c23 | ||
|
|
f031c31b77 | ||
|
|
c2447d8634 | ||
|
|
ae9c1d9f18 | ||
|
|
0132eb6e44 | ||
|
|
f12df54226 | ||
|
|
d971055927 | ||
|
|
6059538d77 | ||
|
|
17deba0606 | ||
|
|
82a2d272ad | ||
|
|
707a9228e1 | ||
|
|
59ddfb787f | ||
|
|
acdf1da995 | ||
|
|
f1cdab91eb | ||
|
|
05d5abe4db | ||
|
|
44e017a410 | ||
|
|
64f3884f23 | ||
|
|
6386782674 | ||
|
|
8084687e50 | ||
|
|
6c16de55c0 | ||
|
|
537237ef62 | ||
|
|
4dfc3f34cb | ||
|
|
d22bbb4213 | ||
|
|
0e3b14e9a5 | ||
|
|
afb0540aa3 | ||
|
|
4d802d8901 | ||
|
|
6a4bf4965f | ||
|
|
a3c9538d12 | ||
|
|
632264809f | ||
|
|
bcfabbe802 | ||
|
|
c244cfc937 | ||
|
|
520fc33394 | ||
|
|
f705a7cd26 | ||
|
|
65bfff69d0 | ||
|
|
9d8ba03f5e | ||
|
|
778b8ede58 | ||
|
|
f8a1a2ed71 | ||
|
|
b4a7c266b5 | ||
|
|
a488f79852 | ||
|
|
b290046503 | ||
|
|
e8409cee8b | ||
|
|
1d4d355b38 | ||
|
|
dfe12535a5 | ||
|
|
74946100f1 | ||
|
|
9a1717915c | ||
|
|
3691eb6e48 | ||
|
|
3bb7471fd3 | ||
|
|
74e09ddb12 | ||
|
|
6b73d056b2 | ||
|
|
3e7847551a | ||
|
|
91d92935fa | ||
|
|
eff033298a | ||
|
|
3a8f4961bc | ||
|
|
b81f94518a | ||
|
|
96f7f5457d | ||
|
|
498ec6b4f1 | ||
|
|
607e62a1ae | ||
|
|
d41a80bc2c | ||
|
|
643bec4071 | ||
|
|
a7e84230c3 | ||
|
|
c96cf7e22d | ||
|
|
46c61660cf | ||
|
|
f6fecce52b | ||
|
|
54a5947a3c | ||
|
|
521bc675a2 | ||
|
|
845cee2578 | ||
|
|
93ceb0e4ed | ||
|
|
13aab4e59c | ||
|
|
36c2f9e9f2 | ||
|
|
514da0ffa9 | ||
|
|
37b8d5da79 | ||
|
|
b5d602d953 | ||
|
|
c926fee13c | ||
|
|
a675806c91 | ||
|
|
683c4874f8 | ||
|
|
20ced857b4 | ||
|
|
c6c86f9665 | ||
|
|
1e0107944f | ||
|
|
21797f9ac8 | ||
|
|
c800b34cd4 | ||
|
|
1612e2d669 | ||
|
|
26d229c8ca | ||
|
|
9c66e86be1 | ||
|
|
7e9f87de2d | ||
|
|
67737446ac | ||
|
|
dabed4f9eb | ||
|
|
f9b6389248 | ||
|
|
9ec1e259b4 | ||
|
|
0c2d480d89 | ||
|
|
350d8ccb7b | ||
|
|
0c512d0431 | ||
|
|
3bf55c9ea4 | ||
|
|
9994c57796 | ||
|
|
3f724b6b17 | ||
|
|
255773b4de | ||
|
|
5b73a788da | ||
|
|
748b06a00e | ||
|
|
273bccdc9a | ||
|
|
f0a2362da3 | ||
|
|
be8ade23e8 | ||
|
|
6814908d80 | ||
|
|
08dbfc45d3 | ||
|
|
89f9b3df68 | ||
|
|
40c9a2fb82 | ||
|
|
a34c22fb10 | ||
|
|
e161ff0f7a | ||
|
|
fee42eab5a | ||
|
|
2d2e03f235 | ||
|
|
4c3c3529e9 | ||
|
|
7051b844ff | ||
|
|
68377435c8 | ||
|
|
652b1804a8 | ||
|
|
e7e1677786 | ||
|
|
f330aac113 | ||
|
|
dbdd330cf7 | ||
|
|
c448c7b0b1 | ||
|
|
8d7b9c2f01 | ||
|
|
b6a235445a | ||
|
|
9fcd4baa87 | ||
|
|
fb0102eb8e | ||
|
|
9c1afaa372 | ||
|
|
1d1a6badb5 | ||
|
|
2d41c9cb15 | ||
|
|
722cbe1f02 | ||
|
|
8ac2c241c4 | ||
|
|
dd11f73951 | ||
|
|
a443547d4d | ||
|
|
7a795edeb5 | ||
|
|
a8cbfb8dda | ||
|
|
5216cccef4 | ||
|
|
a87f399e68 | ||
|
|
dd310ab851 | ||
|
|
16cc0ca0fe | ||
|
|
83d26ad233 | ||
|
|
d1f9a8f2db | ||
|
|
a2e1071808 | ||
|
|
0aa8a2891c | ||
|
|
c0ceab7513 | ||
|
|
5c90e716cb | ||
|
|
0073225549 | ||
|
|
d03a64602b | ||
|
|
d67a4234cc | ||
|
|
0d37244490 | ||
|
|
6426919cb5 | ||
|
|
0a0d63663a | ||
|
|
71b06801ef | ||
|
|
cfc7b35927 | ||
|
|
76564958d1 | ||
|
|
a464c3dd66 |
39
.cirrus.yml
39
.cirrus.yml
@@ -1,22 +1,23 @@
|
|||||||
task:
|
task:
|
||||||
name: freebsd-12-amd64
|
# Seems packages for it were removed from the mirrors
|
||||||
freebsd_instance:
|
# name: freebsd-12-amd64
|
||||||
image_family: freebsd-12-3
|
# freebsd_instance:
|
||||||
setup_script:
|
# image_family: freebsd-12-4
|
||||||
- pkg update
|
# setup_script:
|
||||||
- pkg install -y git sdl2 python fontconfig
|
# - pkg update
|
||||||
- git submodule update --init --recursive
|
# - pkg install -y pkgconf git sdl2 python fontconfig opus
|
||||||
test_script:
|
# - git submodule update --init --recursive
|
||||||
- ./scripts/cirrus/build_freebsd.sh dedicated
|
# test_script:
|
||||||
- ./scripts/cirrus/build_freebsd.sh full
|
# - ./scripts/cirrus/build_freebsd.sh dedicated
|
||||||
|
# - ./scripts/cirrus/build_freebsd.sh full
|
||||||
|
|
||||||
task:
|
task:
|
||||||
name: freebsd-13-amd64
|
name: freebsd-13-amd64
|
||||||
freebsd_instance:
|
freebsd_instance:
|
||||||
image_family: freebsd-13-1
|
image_family: freebsd-13-2
|
||||||
setup_script:
|
setup_script:
|
||||||
- pkg update
|
- pkg update
|
||||||
- pkg install -y git sdl2 python fontconfig
|
- pkg install -y pkgconf git sdl2 python fontconfig opus
|
||||||
- git submodule update --init --recursive
|
- git submodule update --init --recursive
|
||||||
test_script:
|
test_script:
|
||||||
- ./scripts/cirrus/build_freebsd.sh dedicated
|
- ./scripts/cirrus/build_freebsd.sh dedicated
|
||||||
@@ -28,7 +29,19 @@ task:
|
|||||||
image_family: freebsd-14-0-snap
|
image_family: freebsd-14-0-snap
|
||||||
setup_script:
|
setup_script:
|
||||||
- pkg update
|
- pkg update
|
||||||
- pkg install -y git sdl2 python fontconfig
|
- pkg install -y pkgconf git sdl2 python fontconfig opus
|
||||||
|
- git submodule update --init --recursive
|
||||||
|
test_script:
|
||||||
|
- ./scripts/cirrus/build_freebsd.sh dedicated
|
||||||
|
- ./scripts/cirrus/build_freebsd.sh full
|
||||||
|
|
||||||
|
task:
|
||||||
|
name: freebsd-15-amd64
|
||||||
|
freebsd_instance:
|
||||||
|
image_family: freebsd-15-0-snap
|
||||||
|
setup_script:
|
||||||
|
- pkg update
|
||||||
|
- pkg install -y pkgconf git sdl2 python fontconfig opus
|
||||||
- git submodule update --init --recursive
|
- git submodule update --init --recursive
|
||||||
test_script:
|
test_script:
|
||||||
- ./scripts/cirrus/build_freebsd.sh dedicated
|
- ./scripts/cirrus/build_freebsd.sh dedicated
|
||||||
|
|||||||
2
3rdparty/mainui
vendored
2
3rdparty/mainui
vendored
Submodule 3rdparty/mainui updated: e456555cf1...b4bb815420
2
3rdparty/vgui_support
vendored
2
3rdparty/vgui_support
vendored
Submodule 3rdparty/vgui_support updated: 521cf5cb6c...f85d64c149
@@ -70,9 +70,11 @@ These strings are specific to Xash3D FWGS.
|
|||||||
|
|
||||||
| Key | Type | Default value | Description |
|
| Key | Type | Default value | Description |
|
||||||
| ----------------------- | ---------- | ------------------------ | ----------- |
|
| ----------------------- | ---------- | ------------------------ | ----------- |
|
||||||
|
| `animated_title` | boolean | 0 | Use animated title in main menu (WON Half-Life logo.avi imitation from Half-Life 25-th anniversary update)
|
||||||
| `autosave_aged_count` | integer | 2 | Auto saves limit used in saves rotation |
|
| `autosave_aged_count` | integer | 2 | Auto saves limit used in saves rotation |
|
||||||
| `gamedll_linux` | string | Generated from `gamedll` | Game server DLL for 32-bit x86 Linux (see LibraryNaming.md for details) |
|
| `gamedll_linux` | string | Generated from `gamedll` | Game server DLL for 32-bit x86 Linux (see LibraryNaming.md for details) |
|
||||||
| `gamedll_osx` | string | Generated from `gamedll` | Game server DLL for 32-bit x86 macOS (see LibraryNaming.md for details) |
|
| `gamedll_osx` | string | Generated from `gamedll` | Game server DLL for 32-bit x86 macOS (see LibraryNaming.md for details) |
|
||||||
|
| `hd_background` | boolean | 0 | Use HD background for main menu (Half-Life 25-th anniversary update) |
|
||||||
| `internal_vgui_support` | boolean | 0 | Only for programmers! Required to be set as 1 for PrimeXT!<br>When set to 1, the engine will not load vgui_support DLL, as VGUI support is done (or intentionally ignored) on the game side. |
|
| `internal_vgui_support` | boolean | 0 | Only for programmers! Required to be set as 1 for PrimeXT!<br>When set to 1, the engine will not load vgui_support DLL, as VGUI support is done (or intentionally ignored) on the game side. |
|
||||||
| `render_picbutton_text` | boolean | 0 | When set to 1, the UI will not use prerendered `btns_main.bmp` and dynamically render them instead |
|
| `render_picbutton_text` | boolean | 0 | When set to 1, the UI will not use prerendered `btns_main.bmp` and dynamically render them instead |
|
||||||
| `quicksave_aged_count` | integer | 2 | Quick saves limit used in saves rotation |
|
| `quicksave_aged_count` | integer | 2 | Quick saves limit used in saves rotation |
|
||||||
@@ -88,6 +90,7 @@ The table below defines conversion rules from liblist.gam to gameinfo.txt. Some
|
|||||||
|
|
||||||
| `liblist.gam` key | `gameinfo.txt` key | Note |
|
| `liblist.gam` key | `gameinfo.txt` key | Note |
|
||||||
| ----------------- | ------------------ | ---- |
|
| ----------------- | ------------------ | ---- |
|
||||||
|
| `animated_title` | `animated_title` | |
|
||||||
| `edicts` | `max_edicts` | |
|
| `edicts` | `max_edicts` | |
|
||||||
| `fallback_dir` | `fallback_dir` | |
|
| `fallback_dir` | `fallback_dir` | |
|
||||||
| `game` | `title` | |
|
| `game` | `title` | |
|
||||||
@@ -95,6 +98,7 @@ The table below defines conversion rules from liblist.gam to gameinfo.txt. Some
|
|||||||
| `gamedll` | `gamedll` | |
|
| `gamedll` | `gamedll` | |
|
||||||
| `gamedll_linux` | `gamedll_linux` | |
|
| `gamedll_linux` | `gamedll_linux` | |
|
||||||
| `gamedll_osx` | `gamedll_osx` | |
|
| `gamedll_osx` | `gamedll_osx` | |
|
||||||
|
| `hd_background` | `hd_background` | |
|
||||||
| `icon` | `icon` | |
|
| `icon` | `icon` | |
|
||||||
| `mpentity` | `mp_entity` | |
|
| `mpentity` | `mp_entity` | |
|
||||||
| `mpfilter` | `mp_filter` | |
|
| `mpfilter` | `mp_filter` | |
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ Branch **caseclosed** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable
|
|||||||
Branch **CAd** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/CAd
|
Branch **CAd** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/CAd
|
||||||
|
|
||||||
## Counter Strike
|
## Counter Strike
|
||||||
Reverse-engineered code of client part by a1batross - https://github.com/FWGS/cs16-client/tree/v1.32
|
Reverse-engineered code of client part by a1batross - https://github.com/Velaron/cs16-client
|
||||||
|
|
||||||
Reverse-engineered code of server part by nagist - https://github.com/nagist/cs16nd
|
Reverse-engineered code of server part by nagist - https://github.com/nagist/cs16nd
|
||||||
|
|
||||||
|
|||||||
@@ -189,4 +189,8 @@ Default build-depended cvar and constant values
|
|||||||
#define DEFAULT_FULLSCREEN "1" // must be a string
|
#define DEFAULT_FULLSCREEN "1" // must be a string
|
||||||
#endif // DEFAULT_FULLSCREEN
|
#endif // DEFAULT_FULLSCREEN
|
||||||
|
|
||||||
|
#ifndef DEFAULT_MAX_EDICTS
|
||||||
|
#define DEFAULT_MAX_EDICTS 1200 // was 900 before HL25
|
||||||
|
#endif // DEFAULT_MAX_EDICTS
|
||||||
|
|
||||||
#endif // DEFAULTS_H
|
#endif // DEFAULTS_H
|
||||||
|
|||||||
@@ -27,4 +27,19 @@ GNU General Public License for more details.
|
|||||||
#define ENGINE_COMPUTE_STUDIO_LERP (1<<7) // enable MOVETYPE_STEP lerping back in engine
|
#define ENGINE_COMPUTE_STUDIO_LERP (1<<7) // enable MOVETYPE_STEP lerping back in engine
|
||||||
#define ENGINE_LINEAR_GAMMA_SPACE (1<<8) // disable influence of gamma/brightness cvars to textures/lightmaps, for mods with custom renderer
|
#define ENGINE_LINEAR_GAMMA_SPACE (1<<8) // disable influence of gamma/brightness cvars to textures/lightmaps, for mods with custom renderer
|
||||||
|
|
||||||
|
#define ENGINE_STEP_POSHISTORY_LERP (1U<<31) // enable MOVETYPE_STEP interpolation based on position history. Incompatible with ENGINE_COMPUTE_STUDIO_LERP!
|
||||||
|
|
||||||
|
// adjust the mask when features will be added or removed
|
||||||
|
#define ENGINE_FEATURES_MASK \
|
||||||
|
( ENGINE_WRITE_LARGE_COORD \
|
||||||
|
| ENGINE_QUAKE_COMPATIBLE \
|
||||||
|
| ENGINE_LOAD_DELUXEDATA \
|
||||||
|
| ENGINE_PHYSICS_PUSHER_EXT \
|
||||||
|
| ENGINE_LARGE_LIGHTMAPS \
|
||||||
|
| ENGINE_COMPENSATE_QUAKE_BUG \
|
||||||
|
| ENGINE_IMPROVED_LINETRACE \
|
||||||
|
| ENGINE_COMPUTE_STUDIO_LERP \
|
||||||
|
| ENGINE_LINEAR_GAMMA_SPACE \
|
||||||
|
| ENGINE_STEP_POSHISTORY_LERP )
|
||||||
|
|
||||||
#endif//FEATURES_H
|
#endif//FEATURES_H
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ GNU General Public License for more details.
|
|||||||
#define GFL_NOMODELS (1<<0)
|
#define GFL_NOMODELS (1<<0)
|
||||||
#define GFL_NOSKILLS (1<<1)
|
#define GFL_NOSKILLS (1<<1)
|
||||||
#define GFL_RENDER_PICBUTTON_TEXT (1<<2)
|
#define GFL_RENDER_PICBUTTON_TEXT (1<<2)
|
||||||
|
#define GFL_HD_BACKGROUND (1<<3)
|
||||||
|
#define GFL_ANIMATED_TITLE (1<<4)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================================================================
|
========================================================================
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ typedef struct render_api_s
|
|||||||
void (*R_Reserved0)( void );
|
void (*R_Reserved0)( void );
|
||||||
|
|
||||||
// static allocations
|
// static allocations
|
||||||
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );
|
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline ) ALLOC_CHECK( 1 );
|
||||||
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
|
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
|
||||||
|
|
||||||
// engine utils (not related with render API but placed here)
|
// engine utils (not related with render API but placed here)
|
||||||
|
|||||||
@@ -88,18 +88,21 @@ typedef uint64_t longtime_t;
|
|||||||
#define _format(x) __attribute__((format(printf, x, x+1)))
|
#define _format(x) __attribute__((format(printf, x, x+1)))
|
||||||
#define NORETURN __attribute__((noreturn))
|
#define NORETURN __attribute__((noreturn))
|
||||||
#define NONNULL __attribute__((nonnull))
|
#define NONNULL __attribute__((nonnull))
|
||||||
|
#define ALLOC_CHECK(x) __attribute__((alloc_size(x)))
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
#define EXPORT __declspec( dllexport )
|
#define EXPORT __declspec( dllexport )
|
||||||
#define GAME_EXPORT
|
#define GAME_EXPORT
|
||||||
#define _format(x)
|
#define _format(x)
|
||||||
#define NORETURN
|
#define NORETURN
|
||||||
#define NONNULL
|
#define NONNULL
|
||||||
|
#define ALLOC_CHECK(x)
|
||||||
#else
|
#else
|
||||||
#define EXPORT
|
#define EXPORT
|
||||||
#define GAME_EXPORT
|
#define GAME_EXPORT
|
||||||
#define _format(x)
|
#define _format(x)
|
||||||
#define NORETURN
|
#define NORETURN
|
||||||
#define NONNULL
|
#define NONNULL
|
||||||
|
#define ALLOC_CHECK(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ( __GNUC__ >= 3 )
|
#if ( __GNUC__ >= 3 )
|
||||||
@@ -118,10 +121,15 @@ typedef uint64_t longtime_t;
|
|||||||
#define likely(x) (x)
|
#define likely(x) (x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined( static_assert ) // C11 static_assert
|
#if __STDC_VERSION >= 202311L || __cplusplus >= 201103L // C23 or C++ static_assert is a keyword
|
||||||
#define STATIC_ASSERT static_assert
|
#define STATIC_ASSERT_ static_assert
|
||||||
|
#define STATIC_ASSERT static_assert
|
||||||
|
#elif __STDC_VERSION >= 201112L // in C11 it's _Static_assert
|
||||||
|
#define STATIC_ASSERT_ _Static_assert
|
||||||
|
#define STATIC_ASSERT _Static_assert
|
||||||
#else
|
#else
|
||||||
#define STATIC_ASSERT( x, y ) extern int _static_assert_##__LINE__[( x ) ? 1 : -1]
|
#define STATIC_ASSERT_( id, x, y ) extern int id[( x ) ? 1 : -1]
|
||||||
|
#define STATIC_ASSERT( x, y ) STATIC_ASSERT_( static_assert_##__LINE__, x, y )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XASH_BIG_ENDIAN
|
#ifdef XASH_BIG_ENDIAN
|
||||||
|
|||||||
@@ -85,6 +85,12 @@ void CL_PlayCDTrack_f( void )
|
|||||||
paused = false;
|
paused = false;
|
||||||
looped = false;
|
looped = false;
|
||||||
}
|
}
|
||||||
|
else if( !Q_stricmp( command, "playfile" ))
|
||||||
|
{
|
||||||
|
S_StartBackgroundTrack( pszTrack, NULL, 0, true );
|
||||||
|
paused = false;
|
||||||
|
looped = false;
|
||||||
|
}
|
||||||
else if( !Q_stricmp( command, "loop" ))
|
else if( !Q_stricmp( command, "loop" ))
|
||||||
{
|
{
|
||||||
if( Q_isdigit( pszTrack ))
|
if( Q_isdigit( pszTrack ))
|
||||||
@@ -96,6 +102,12 @@ void CL_PlayCDTrack_f( void )
|
|||||||
paused = false;
|
paused = false;
|
||||||
looped = true;
|
looped = true;
|
||||||
}
|
}
|
||||||
|
else if( !Q_stricmp( command, "loopfile" ))
|
||||||
|
{
|
||||||
|
S_StartBackgroundTrack( pszTrack, pszTrack, 0, true );
|
||||||
|
paused = false;
|
||||||
|
looped = true;
|
||||||
|
}
|
||||||
else if( !Q_stricmp( command, "pause" ))
|
else if( !Q_stricmp( command, "pause" ))
|
||||||
{
|
{
|
||||||
S_StreamSetPause( true );
|
S_StreamSetPause( true );
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ void CL_WriteDemoHeader( const char *name )
|
|||||||
demo.header.id = IDEMOHEADER;
|
demo.header.id = IDEMOHEADER;
|
||||||
demo.header.dem_protocol = DEMO_PROTOCOL;
|
demo.header.dem_protocol = DEMO_PROTOCOL;
|
||||||
demo.header.net_protocol = cls.legacymode ? PROTOCOL_LEGACY_VERSION : PROTOCOL_VERSION;
|
demo.header.net_protocol = cls.legacymode ? PROTOCOL_LEGACY_VERSION : PROTOCOL_VERSION;
|
||||||
demo.header.host_fps = bound( MIN_FPS, host_maxfps.value, MAX_FPS );
|
demo.header.host_fps = host_maxfps.value ? bound( MIN_FPS, host_maxfps.value, MAX_FPS ) : MAX_FPS;
|
||||||
Q_strncpy( demo.header.mapname, clgame.mapname, sizeof( demo.header.mapname ));
|
Q_strncpy( demo.header.mapname, clgame.mapname, sizeof( demo.header.mapname ));
|
||||||
Q_strncpy( demo.header.comment, clgame.maptitle, sizeof( demo.header.comment ));
|
Q_strncpy( demo.header.comment, clgame.maptitle, sizeof( demo.header.comment ));
|
||||||
Q_strncpy( demo.header.gamedir, FS_Gamedir(), sizeof( demo.header.gamedir ));
|
Q_strncpy( demo.header.gamedir, FS_Gamedir(), sizeof( demo.header.gamedir ));
|
||||||
@@ -570,6 +570,9 @@ void CL_ReadDemoUserCmd( qboolean discard )
|
|||||||
memset( &nullcmd, 0, sizeof( nullcmd ));
|
memset( &nullcmd, 0, sizeof( nullcmd ));
|
||||||
MSG_Init( &buf, "UserCmd", data, sizeof( data ));
|
MSG_Init( &buf, "UserCmd", data, sizeof( data ));
|
||||||
|
|
||||||
|
// a1ba: I have no proper explanation why
|
||||||
|
cmdnumber++;
|
||||||
|
|
||||||
pcmd = &cl.commands[cmdnumber & CL_UPDATE_MASK];
|
pcmd = &cl.commands[cmdnumber & CL_UPDATE_MASK];
|
||||||
pcmd->processedfuncs = false;
|
pcmd->processedfuncs = false;
|
||||||
pcmd->senttime = 0.0f;
|
pcmd->senttime = 0.0f;
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ particle_t * GAME_EXPORT R_AllocParticle( void (*callback)( particle_t*, float )
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// never alloc particles when we not in game
|
// never alloc particles when we not in game
|
||||||
// if( tr.frametime == 0.0 ) return NULL;
|
if( cl_clientframetime() == 0.0 ) return NULL;
|
||||||
|
|
||||||
if( !cl_free_particles )
|
if( !cl_free_particles )
|
||||||
{
|
{
|
||||||
@@ -226,7 +226,7 @@ particle_t *R_AllocTracer( const vec3_t org, const vec3_t vel, float life )
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// never alloc particles when we not in game
|
// never alloc particles when we not in game
|
||||||
//if( tr.frametime == 0.0 ) return NULL;
|
if( cl_clientframetime() == 0.0 ) return NULL;
|
||||||
|
|
||||||
if( !cl_free_particles )
|
if( !cl_free_particles )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ GNU General Public License for more details.
|
|||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
#define STUDIO_INTERPOLATION_FIX
|
// #define STUDIO_INTERPOLATION_FIX
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==================
|
==================
|
||||||
@@ -54,17 +54,28 @@ Store another position into interpolation circular buffer
|
|||||||
*/
|
*/
|
||||||
void CL_UpdatePositions( cl_entity_t *ent )
|
void CL_UpdatePositions( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
position_history_t *ph;
|
position_history_t *ph, *prev;
|
||||||
|
|
||||||
|
prev = &ent->ph[ent->current_position];
|
||||||
|
|
||||||
ent->current_position = (ent->current_position + 1) & HISTORY_MASK;
|
ent->current_position = (ent->current_position + 1) & HISTORY_MASK;
|
||||||
ph = &ent->ph[ent->current_position];
|
ph = &ent->ph[ent->current_position];
|
||||||
VectorCopy( ent->curstate.origin, ph->origin );
|
VectorCopy( ent->curstate.origin, ph->origin );
|
||||||
VectorCopy( ent->curstate.angles, ph->angles );
|
VectorCopy( ent->curstate.angles, ph->angles );
|
||||||
|
|
||||||
if( ent->model && ent->model->type == mod_brush )
|
ph->animtime = ent->curstate.animtime;
|
||||||
ph->animtime = ent->curstate.animtime;
|
|
||||||
else
|
// a1ba: for some reason, this sometimes still may happen
|
||||||
ph->animtime = cl.time;
|
// at this time, I'm not sure whether this bug happens in delta readwrite code
|
||||||
|
// or server just decides to go backwards and really sends these values
|
||||||
|
if( ph->animtime < prev->animtime )
|
||||||
|
{
|
||||||
|
// try to deduce real animtime by looking up the difference between
|
||||||
|
// server messages (cl.mtime is never modified ny the interpolation code)
|
||||||
|
float diff = Q_max( 0, ent->curstate.msg_time - ent->prevstate.msg_time );
|
||||||
|
|
||||||
|
ph->animtime = prev->animtime + diff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -159,6 +170,13 @@ qboolean CL_EntityCustomLerp( cl_entity_t *e )
|
|||||||
case MOVETYPE_FLY:
|
case MOVETYPE_FLY:
|
||||||
case MOVETYPE_COMPOUND:
|
case MOVETYPE_COMPOUND:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// ABSOLUTELY STUPID HACK TO ALLOW MONSTERS
|
||||||
|
// INTERPOLATION IN GRAVGUNMOD COOP
|
||||||
|
// MUST BE REMOVED ONCE WE REMOVE 48 PROTO SUPPORT
|
||||||
|
case MOVETYPE_TOSS:
|
||||||
|
if( cls.legacymode && e->model && e->model->type == mod_studio )
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -171,7 +189,7 @@ CL_ParametricMove
|
|||||||
check for parametrical moved entities
|
check for parametrical moved entities
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
qboolean CL_ParametricMove( cl_entity_t *ent )
|
static qboolean CL_ParametricMove( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
float frac, dt, t;
|
float frac, dt, t;
|
||||||
vec3_t delta;
|
vec3_t delta;
|
||||||
@@ -349,11 +367,10 @@ CL_FindInterpolationUpdates
|
|||||||
find two timestamps
|
find two timestamps
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
qboolean CL_FindInterpolationUpdates( cl_entity_t *ent, float targettime, position_history_t **ph0, position_history_t **ph1 )
|
static qboolean CL_FindInterpolationUpdates( cl_entity_t *ent, double targettime, position_history_t **ph0, position_history_t **ph1 )
|
||||||
{
|
{
|
||||||
qboolean extrapolate = true;
|
qboolean extrapolate = true;
|
||||||
uint i, i0, i1, imod;
|
uint i, i0, i1, imod;
|
||||||
float at;
|
|
||||||
|
|
||||||
imod = ent->current_position;
|
imod = ent->current_position;
|
||||||
i0 = (imod - 0) & HISTORY_MASK; // curpos (lerp end)
|
i0 = (imod - 0) & HISTORY_MASK; // curpos (lerp end)
|
||||||
@@ -361,8 +378,10 @@ qboolean CL_FindInterpolationUpdates( cl_entity_t *ent, float targettime, positi
|
|||||||
|
|
||||||
for( i = 1; i < HISTORY_MAX - 1; i++ )
|
for( i = 1; i < HISTORY_MAX - 1; i++ )
|
||||||
{
|
{
|
||||||
at = ent->ph[( imod - i ) & HISTORY_MASK].animtime;
|
double at = ent->ph[( imod - i ) & HISTORY_MASK].animtime;
|
||||||
if( at == 0.0f ) break;
|
|
||||||
|
if( at == 0.0f )
|
||||||
|
break;
|
||||||
|
|
||||||
if( targettime > at )
|
if( targettime > at )
|
||||||
{
|
{
|
||||||
@@ -387,15 +406,14 @@ CL_PureOrigin
|
|||||||
non-local players interpolation
|
non-local players interpolation
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_PureOrigin( cl_entity_t *ent, float t, vec3_t outorigin, vec3_t outangles )
|
static void CL_PureOrigin( cl_entity_t *ent, double t, vec3_t outorigin, vec3_t outangles )
|
||||||
{
|
{
|
||||||
qboolean extrapolate;
|
double t1, t0, frac;
|
||||||
float t1, t0, frac;
|
|
||||||
position_history_t *ph0, *ph1;
|
position_history_t *ph0, *ph1;
|
||||||
vec3_t delta;
|
vec3_t delta;
|
||||||
|
|
||||||
// NOTE: ph0 is next, ph1 is a prev
|
// NOTE: ph0 is next, ph1 is a prev
|
||||||
extrapolate = CL_FindInterpolationUpdates( ent, t, &ph0, &ph1 );
|
CL_FindInterpolationUpdates( ent, t, &ph0, &ph1 );
|
||||||
|
|
||||||
if ( !ph0 || !ph1 )
|
if ( !ph0 || !ph1 )
|
||||||
return;
|
return;
|
||||||
@@ -403,7 +421,7 @@ void CL_PureOrigin( cl_entity_t *ent, float t, vec3_t outorigin, vec3_t outangle
|
|||||||
t0 = ph0->animtime;
|
t0 = ph0->animtime;
|
||||||
t1 = ph1->animtime;
|
t1 = ph1->animtime;
|
||||||
|
|
||||||
if( t0 != 0.0f )
|
if( t0 != 0.0 )
|
||||||
{
|
{
|
||||||
vec4_t q, q1, q2;
|
vec4_t q, q1, q2;
|
||||||
|
|
||||||
@@ -411,9 +429,9 @@ void CL_PureOrigin( cl_entity_t *ent, float t, vec3_t outorigin, vec3_t outangle
|
|||||||
|
|
||||||
if( !Q_equal( t0, t1 ))
|
if( !Q_equal( t0, t1 ))
|
||||||
frac = ( t - t1 ) / ( t0 - t1 );
|
frac = ( t - t1 ) / ( t0 - t1 );
|
||||||
else frac = 1.0f;
|
else frac = 1.0;
|
||||||
|
|
||||||
frac = bound( 0.0f, frac, 1.2f );
|
frac = bound( 0.0, frac, 1.2 );
|
||||||
|
|
||||||
VectorMA( ph1->origin, frac, delta, outorigin );
|
VectorMA( ph1->origin, frac, delta, outorigin );
|
||||||
|
|
||||||
@@ -437,11 +455,11 @@ CL_InterpolateModel
|
|||||||
non-players interpolation
|
non-players interpolation
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
int CL_InterpolateModel( cl_entity_t *e )
|
static int CL_InterpolateModel( cl_entity_t *e )
|
||||||
{
|
{
|
||||||
position_history_t *ph0 = NULL, *ph1 = NULL;
|
position_history_t *ph0 = NULL, *ph1 = NULL;
|
||||||
vec3_t origin, angles, delta;
|
vec3_t origin, angles, delta;
|
||||||
float t, t1, t2, frac;
|
double t, t1, t2, frac;
|
||||||
vec4_t q, q1, q2;
|
vec4_t q, q1, q2;
|
||||||
|
|
||||||
VectorCopy( e->curstate.origin, e->origin );
|
VectorCopy( e->curstate.origin, e->origin );
|
||||||
@@ -489,9 +507,7 @@ int CL_InterpolateModel( cl_entity_t *e )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// HACKHACK: workaround buggy position history animtime
|
if( Q_equal( t2, t1 ))
|
||||||
// going backward sometimes
|
|
||||||
if( Q_equal( t2, t1 ) || t2 < t1 )
|
|
||||||
{
|
{
|
||||||
VectorCopy( ph0->origin, e->origin );
|
VectorCopy( ph0->origin, e->origin );
|
||||||
VectorCopy( ph0->angles, e->angles );
|
VectorCopy( ph0->angles, e->angles );
|
||||||
@@ -529,7 +545,7 @@ interpolate non-local clients
|
|||||||
*/
|
*/
|
||||||
void CL_ComputePlayerOrigin( cl_entity_t *ent )
|
void CL_ComputePlayerOrigin( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
float targettime;
|
double targettime;
|
||||||
vec4_t q, q1, q2;
|
vec4_t q, q1, q2;
|
||||||
vec3_t origin;
|
vec3_t origin;
|
||||||
vec3_t angles;
|
vec3_t angles;
|
||||||
@@ -1212,17 +1228,33 @@ void CL_LinkPacketEntities( frame_t *frame )
|
|||||||
#else
|
#else
|
||||||
if( ent->lastmove >= cl.time )
|
if( ent->lastmove >= cl.time )
|
||||||
{
|
{
|
||||||
|
float at = ent->curstate.animtime;
|
||||||
|
|
||||||
CL_ResetLatchedVars( ent, true );
|
CL_ResetLatchedVars( ent, true );
|
||||||
|
|
||||||
|
if( cl_fixmodelinterpolationartifacts.value )
|
||||||
|
ent->latched.prevanimtime = ent->curstate.animtime = at;
|
||||||
|
|
||||||
VectorCopy( ent->curstate.origin, ent->latched.prevorigin );
|
VectorCopy( ent->curstate.origin, ent->latched.prevorigin );
|
||||||
VectorCopy( ent->curstate.angles, ent->latched.prevangles );
|
VectorCopy( ent->curstate.angles, ent->latched.prevangles );
|
||||||
|
|
||||||
// disable step interpolation in client.dll
|
if( !FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP ))
|
||||||
ent->curstate.movetype = MOVETYPE_NONE;
|
{
|
||||||
|
// disable step interpolation in client.dll
|
||||||
|
ent->curstate.movetype = MOVETYPE_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// restore step interpolation in client.dll
|
if( FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP ))
|
||||||
ent->curstate.movetype = MOVETYPE_STEP;
|
{
|
||||||
|
interpolate = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// restore step interpolation in client.dll
|
||||||
|
ent->curstate.movetype = MOVETYPE_STEP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1247,11 +1279,24 @@ void CL_LinkPacketEntities( frame_t *frame )
|
|||||||
if ( !CL_InterpolateModel( ent ))
|
if ( !CL_InterpolateModel( ent ))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if( ent->curstate.movetype == MOVETYPE_STEP && !NET_IsLocalAddress( cls.netchan.remote_address ))
|
// a1ba: in GoldSrc this is done for cstrike and czero
|
||||||
|
// but let modders use this as an engine feature
|
||||||
|
else if( FBitSet( host.features, ENGINE_STEP_POSHISTORY_LERP ) &&
|
||||||
|
ent->curstate.movetype == MOVETYPE_STEP && !NET_IsLocalAddress( cls.netchan.remote_address ))
|
||||||
{
|
{
|
||||||
if( !CL_InterpolateModel( ent ))
|
if( !CL_InterpolateModel( ent ))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
|
// ABSOLUTELY STUPID HACK TO ALLOW MONSTERS
|
||||||
|
// INTERPOLATION IN GRAVGUNMOD COOP
|
||||||
|
// MUST BE REMOVED ONCE WE REMOVE 48 PROTO SUPPORT
|
||||||
|
else if( cls.legacymode && ent->model->type == mod_studio && ent->curstate.movetype == MOVETYPE_TOSS )
|
||||||
|
{
|
||||||
|
if( !CL_InterpolateModel( ent ))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// no interpolation right now
|
// no interpolation right now
|
||||||
|
|||||||
@@ -1109,12 +1109,12 @@ void CL_InitEdicts( int maxclients )
|
|||||||
clgame.remap_info = (remap_info_t **)Mem_Calloc( clgame.mempool, sizeof( remap_info_t* ) * clgame.maxRemapInfos );
|
clgame.remap_info = (remap_info_t **)Mem_Calloc( clgame.mempool, sizeof( remap_info_t* ) * clgame.maxRemapInfos );
|
||||||
}
|
}
|
||||||
|
|
||||||
ref.dllFuncs.R_ProcessEntData( true );
|
ref.dllFuncs.R_ProcessEntData( true, clgame.entities, clgame.maxEntities );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_FreeEdicts( void )
|
void CL_FreeEdicts( void )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.R_ProcessEntData( false );
|
ref.dllFuncs.R_ProcessEntData( false, NULL, 0 );
|
||||||
|
|
||||||
if( clgame.entities )
|
if( clgame.entities )
|
||||||
Mem_Free( clgame.entities );
|
Mem_Free( clgame.entities );
|
||||||
@@ -1235,11 +1235,7 @@ static model_t *CL_LoadSpriteModel( const char *filename, uint type, uint texFla
|
|||||||
{
|
{
|
||||||
char name[MAX_QPATH];
|
char name[MAX_QPATH];
|
||||||
model_t *mod;
|
model_t *mod;
|
||||||
int i;
|
int i, start;
|
||||||
|
|
||||||
// use high indices for client sprites
|
|
||||||
// for GoldSrc bug-compatibility
|
|
||||||
const int start = type != SPR_HUDSPRITE ? MAX_CLIENT_SPRITES / 2 : 0;
|
|
||||||
|
|
||||||
if( !COM_CheckString( filename ))
|
if( !COM_CheckString( filename ))
|
||||||
{
|
{
|
||||||
@@ -1250,7 +1246,7 @@ static model_t *CL_LoadSpriteModel( const char *filename, uint type, uint texFla
|
|||||||
Q_strncpy( name, filename, sizeof( name ));
|
Q_strncpy( name, filename, sizeof( name ));
|
||||||
COM_FixSlashes( name );
|
COM_FixSlashes( name );
|
||||||
|
|
||||||
for( i = 0, mod = clgame.sprites + start; i < MAX_CLIENT_SPRITES / 2; i++, mod++ )
|
for( i = 0, mod = clgame.sprites; i < MAX_CLIENT_SPRITES; i++, mod++ )
|
||||||
{
|
{
|
||||||
if( !Q_stricmp( mod->name, name ))
|
if( !Q_stricmp( mod->name, name ))
|
||||||
{
|
{
|
||||||
@@ -1267,8 +1263,15 @@ static model_t *CL_LoadSpriteModel( const char *filename, uint type, uint texFla
|
|||||||
}
|
}
|
||||||
|
|
||||||
// find a free model slot spot
|
// find a free model slot spot
|
||||||
for( i = 0, mod = clgame.sprites + start; i < MAX_CLIENT_SPRITES / 2; i++, mod++ )
|
// use low indices only for HUD sprites
|
||||||
if( !mod->name[0] ) break; // this is a valid spot
|
// for GoldSrc bug compatibility
|
||||||
|
start = type == SPR_HUDSPRITE ? 0 : MAX_CLIENT_SPRITES / 2;
|
||||||
|
|
||||||
|
for( i = 0, mod = &clgame.sprites[start]; i < MAX_CLIENT_SPRITES / 2; i++, mod++ )
|
||||||
|
{
|
||||||
|
if( !mod->name[0] )
|
||||||
|
break; // this is a valid spot
|
||||||
|
}
|
||||||
|
|
||||||
if( i == MAX_CLIENT_SPRITES / 2 )
|
if( i == MAX_CLIENT_SPRITES / 2 )
|
||||||
{
|
{
|
||||||
@@ -1320,9 +1323,10 @@ HSPRITE pfnSPR_LoadExt( const char *szPicName, uint texFlags )
|
|||||||
=========
|
=========
|
||||||
pfnSPR_Load
|
pfnSPR_Load
|
||||||
|
|
||||||
|
function exported for support GoldSrc Monitor utility
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static HSPRITE GAME_EXPORT pfnSPR_Load( const char *szPicName )
|
HSPRITE EXPORT pfnSPR_Load( const char *szPicName )
|
||||||
{
|
{
|
||||||
model_t *spr;
|
model_t *spr;
|
||||||
|
|
||||||
@@ -1368,9 +1372,10 @@ static const model_t *CL_GetSpritePointer( HSPRITE hSprite )
|
|||||||
=========
|
=========
|
||||||
pfnSPR_Frames
|
pfnSPR_Frames
|
||||||
|
|
||||||
|
function exported for support GoldSrc Monitor utility
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static int GAME_EXPORT pfnSPR_Frames( HSPRITE hPic )
|
int EXPORT pfnSPR_Frames( HSPRITE hPic )
|
||||||
{
|
{
|
||||||
int numFrames = 0;
|
int numFrames = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -414,11 +414,15 @@ static void UI_ConvertGameInfo( GAMEINFO *out, gameinfo_t *in )
|
|||||||
out->gamemode = in->gamemode;
|
out->gamemode = in->gamemode;
|
||||||
|
|
||||||
if( in->nomodels )
|
if( in->nomodels )
|
||||||
out->flags |= GFL_NOMODELS;
|
SetBits( out->flags, GFL_NOMODELS );
|
||||||
if( in->noskills )
|
if( in->noskills )
|
||||||
out->flags |= GFL_NOSKILLS;
|
SetBits( out->flags, GFL_NOSKILLS );
|
||||||
if( in->render_picbutton_text )
|
if( in->render_picbutton_text )
|
||||||
out->flags |= GFL_RENDER_PICBUTTON_TEXT;
|
SetBits( out->flags, GFL_RENDER_PICBUTTON_TEXT );
|
||||||
|
if( in->hd_background )
|
||||||
|
SetBits( out->flags, GFL_HD_BACKGROUND );
|
||||||
|
if( in->animated_title )
|
||||||
|
SetBits( out->flags, GFL_ANIMATED_TITLE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ CVAR_DEFINE_AUTO( cl_trace_events, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable event
|
|||||||
static CVAR_DEFINE_AUTO( cl_nat, "0", 0, "show servers running under NAT" );
|
static CVAR_DEFINE_AUTO( cl_nat, "0", 0, "show servers running under NAT" );
|
||||||
CVAR_DEFINE_AUTO( hud_utf8, "0", FCVAR_ARCHIVE, "Use utf-8 encoding for hud text" );
|
CVAR_DEFINE_AUTO( hud_utf8, "0", FCVAR_ARCHIVE, "Use utf-8 encoding for hud text" );
|
||||||
CVAR_DEFINE_AUTO( ui_renderworld, "0", FCVAR_ARCHIVE, "render world when UI is visible" );
|
CVAR_DEFINE_AUTO( ui_renderworld, "0", FCVAR_ARCHIVE, "render world when UI is visible" );
|
||||||
|
static CVAR_DEFINE_AUTO( cl_maxframetime, "0", 0, "set deadline timer for client rendering to catch freezes" );
|
||||||
|
CVAR_DEFINE_AUTO( cl_fixmodelinterpolationartifacts, "1", 0, "try to fix up models interpolation on a moving platforms (monsters on trains for example)" );
|
||||||
|
|
||||||
//
|
//
|
||||||
// userinfo
|
// userinfo
|
||||||
@@ -605,10 +607,10 @@ void CL_CreateCmd( void )
|
|||||||
// message we are constructing.
|
// message we are constructing.
|
||||||
i = cls.netchan.outgoing_sequence & CL_UPDATE_MASK;
|
i = cls.netchan.outgoing_sequence & CL_UPDATE_MASK;
|
||||||
pcmd = &cl.commands[i];
|
pcmd = &cl.commands[i];
|
||||||
pcmd->processedfuncs = false;
|
|
||||||
|
|
||||||
if( !cls.demoplayback )
|
if( !cls.demoplayback )
|
||||||
{
|
{
|
||||||
|
pcmd->processedfuncs = false;
|
||||||
pcmd->senttime = host.realtime;
|
pcmd->senttime = host.realtime;
|
||||||
memset( &pcmd->cmd, 0, sizeof( pcmd->cmd ));
|
memset( &pcmd->cmd, 0, sizeof( pcmd->cmd ));
|
||||||
pcmd->receivedtime = -1.0;
|
pcmd->receivedtime = -1.0;
|
||||||
@@ -2917,6 +2919,8 @@ void CL_InitLocal( void )
|
|||||||
Cvar_RegisterVariable( &cl_showevents );
|
Cvar_RegisterVariable( &cl_showevents );
|
||||||
Cvar_Get( "lastdemo", "", FCVAR_ARCHIVE, "last played demo" );
|
Cvar_Get( "lastdemo", "", FCVAR_ARCHIVE, "last played demo" );
|
||||||
Cvar_RegisterVariable( &ui_renderworld );
|
Cvar_RegisterVariable( &ui_renderworld );
|
||||||
|
Cvar_RegisterVariable( &cl_maxframetime );
|
||||||
|
Cvar_RegisterVariable( &cl_fixmodelinterpolationartifacts );
|
||||||
|
|
||||||
// these two added to shut up CS 1.5 about 'unknown' commands
|
// these two added to shut up CS 1.5 about 'unknown' commands
|
||||||
Cvar_Get( "lightgamma", "1", FCVAR_ARCHIVE, "ambient lighting level (legacy, unused)" );
|
Cvar_Get( "lightgamma", "1", FCVAR_ARCHIVE, "ambient lighting level (legacy, unused)" );
|
||||||
@@ -3057,6 +3061,8 @@ void Host_ClientFrame( void )
|
|||||||
{
|
{
|
||||||
// if client is not active, do nothing
|
// if client is not active, do nothing
|
||||||
if( !cls.initialized ) return;
|
if( !cls.initialized ) return;
|
||||||
|
if( cls.key_dest == key_game && cls.state == ca_active && !Con_Visible() )
|
||||||
|
Platform_SetTimer( cl_maxframetime.value );
|
||||||
|
|
||||||
// if running the server remotely, send intentions now after
|
// if running the server remotely, send intentions now after
|
||||||
// the incoming messages have been read
|
// the incoming messages have been read
|
||||||
|
|||||||
@@ -903,7 +903,7 @@ void CL_ParseServerData( sizebuf_t *msg, qboolean legacy )
|
|||||||
Q_strncpy( clgame.maptitle, MSG_ReadString( msg ), sizeof( clgame.maptitle ));
|
Q_strncpy( clgame.maptitle, MSG_ReadString( msg ), sizeof( clgame.maptitle ));
|
||||||
background = MSG_ReadOneBit( msg );
|
background = MSG_ReadOneBit( msg );
|
||||||
Q_strncpy( gamefolder, MSG_ReadString( msg ), sizeof( gamefolder ));
|
Q_strncpy( gamefolder, MSG_ReadString( msg ), sizeof( gamefolder ));
|
||||||
host.features = (uint)MSG_ReadLong( msg );
|
Host_ValidateEngineFeatures( MSG_ReadDword( msg ));
|
||||||
|
|
||||||
if( !legacy )
|
if( !legacy )
|
||||||
{
|
{
|
||||||
@@ -1638,9 +1638,6 @@ void CL_RegisterResources( sizebuf_t *msg )
|
|||||||
|
|
||||||
CL_ClearWorld ();
|
CL_ClearWorld ();
|
||||||
|
|
||||||
// update the ref state.
|
|
||||||
R_UpdateRefState ();
|
|
||||||
|
|
||||||
// tell rendering system we have a new set of models.
|
// tell rendering system we have a new set of models.
|
||||||
ref.dllFuncs.R_NewMap ();
|
ref.dllFuncs.R_NewMap ();
|
||||||
|
|
||||||
|
|||||||
@@ -660,9 +660,6 @@ void CL_LegacyPrecache_f( void )
|
|||||||
if( clgame.entities )
|
if( clgame.entities )
|
||||||
clgame.entities->model = cl.worldmodel;
|
clgame.entities->model = cl.worldmodel;
|
||||||
|
|
||||||
// update the ref state.
|
|
||||||
R_UpdateRefState ();
|
|
||||||
|
|
||||||
// tell rendering system we have a new set of models.
|
// tell rendering system we have a new set of models.
|
||||||
ref.dllFuncs.R_NewMap ();
|
ref.dllFuncs.R_NewMap ();
|
||||||
|
|
||||||
|
|||||||
@@ -824,6 +824,27 @@ static void CL_SetupPMove( playermove_t *pmove, const local_state_t *from, const
|
|||||||
cd = &from->client;
|
cd = &from->client;
|
||||||
|
|
||||||
pmove->player_index = ps->number - 1;
|
pmove->player_index = ps->number - 1;
|
||||||
|
|
||||||
|
// a1ba: workaround bug on old protocol where the server refuse to send
|
||||||
|
// our local player in delta. cl.playernum, in theory, must be equal
|
||||||
|
// to our local player index anyway
|
||||||
|
// this might not be a real solution, since everything else will be bogus
|
||||||
|
// but we need to properly run prediction and avoid potential memory
|
||||||
|
// corruption
|
||||||
|
// either debug this, or remove when old protocol will be dropped!!!
|
||||||
|
if( pmove->player_index < 0 )
|
||||||
|
{
|
||||||
|
if( cls.legacymode )
|
||||||
|
{
|
||||||
|
pmove->player_index = bound( 0, cl.playernum, cl.maxclients - 1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// if this happens, record a demo and send it to a1ba
|
||||||
|
Host_Error( "%s: ps->number == %d\n", __func__, ps->number );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pmove->multiplayer = (cl.maxclients > 1);
|
pmove->multiplayer = (cl.maxclients > 1);
|
||||||
pmove->runfuncs = runfuncs;
|
pmove->runfuncs = runfuncs;
|
||||||
pmove->time = time * 1000.0f;
|
pmove->time = time * 1000.0f;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ CL_CreateRawTextureFromPixels
|
|||||||
Convert texture_t struct into mstudiotexture_t prototype
|
Convert texture_t struct into mstudiotexture_t prototype
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
byte *CL_CreateRawTextureFromPixels( texture_t *tx, size_t *size, int topcolor, int bottomcolor )
|
static byte *CL_CreateRawTextureFromPixels( texture_t *tx, size_t *size, int topcolor, int bottomcolor )
|
||||||
{
|
{
|
||||||
static mstudiotexture_t pin;
|
static mstudiotexture_t pin;
|
||||||
byte *pal;
|
byte *pal;
|
||||||
@@ -111,7 +111,7 @@ CL_DuplicateTexture
|
|||||||
Dupliacte texture with remap pixels
|
Dupliacte texture with remap pixels
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_DuplicateTexture( cl_entity_t *entity, model_t *model, mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
|
static void CL_DuplicateTexture( cl_entity_t *entity, model_t *model, mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
texture_t *tx = NULL;
|
texture_t *tx = NULL;
|
||||||
@@ -154,7 +154,7 @@ CL_UpdateStudioTexture
|
|||||||
Update texture top and bottom colors
|
Update texture top and bottom colors
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_UpdateStudioTexture( cl_entity_t *entity, mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
|
static void CL_UpdateStudioTexture( cl_entity_t *entity, mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
|
||||||
{
|
{
|
||||||
rgbdata_t *pic;
|
rgbdata_t *pic;
|
||||||
texture_t *tx = NULL;
|
texture_t *tx = NULL;
|
||||||
@@ -215,7 +215,7 @@ CL_UpdateAliasTexture
|
|||||||
Update texture top and bottom colors
|
Update texture top and bottom colors
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_UpdateAliasTexture( cl_entity_t *entity, unsigned short *texture, int skinnum, int topcolor, int bottomcolor )
|
static void CL_UpdateAliasTexture( cl_entity_t *entity, unsigned short *texture, int skinnum, int topcolor, int bottomcolor )
|
||||||
{
|
{
|
||||||
char texname[MAX_QPATH];
|
char texname[MAX_QPATH];
|
||||||
rgbdata_t skin, *pic;
|
rgbdata_t skin, *pic;
|
||||||
@@ -247,6 +247,68 @@ void CL_UpdateAliasTexture( cl_entity_t *entity, unsigned short *texture, int sk
|
|||||||
ref.dllFuncs.GL_ProcessTexture( *texture, -1.0f, topcolor, bottomcolor );
|
ref.dllFuncs.GL_ProcessTexture( *texture, -1.0f, topcolor, bottomcolor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
====================
|
||||||
|
CL_FreeRemapInfo
|
||||||
|
|
||||||
|
Release remap info per entity
|
||||||
|
====================
|
||||||
|
*/
|
||||||
|
static void CL_FreeRemapInfo( remap_info_t *info )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
Assert( info != NULL );
|
||||||
|
|
||||||
|
// release all colormap texture copies
|
||||||
|
for( i = 0; i < info->numtextures; i++ )
|
||||||
|
{
|
||||||
|
if( info->ptexture != NULL )
|
||||||
|
{
|
||||||
|
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP ))
|
||||||
|
ref.dllFuncs.GL_FreeTexture( info->ptexture[i].index );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( info->textures[i] != 0 )
|
||||||
|
ref.dllFuncs.GL_FreeTexture( info->textures[i] );
|
||||||
|
}
|
||||||
|
|
||||||
|
Mem_Free( info ); // release struct
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
====================
|
||||||
|
CL_UpdateRemapInfo
|
||||||
|
|
||||||
|
Update all remaps per entity
|
||||||
|
====================
|
||||||
|
*/
|
||||||
|
static void CL_UpdateRemapInfo( cl_entity_t *entity, int topcolor, int bottomcolor )
|
||||||
|
{
|
||||||
|
remap_info_t *info;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = ( entity == &clgame.viewent ) ? clgame.maxEntities : entity->curstate.number;
|
||||||
|
info = clgame.remap_info[i];
|
||||||
|
if( !info ) return; // no remap info
|
||||||
|
|
||||||
|
if( info->topcolor == topcolor && info->bottomcolor == bottomcolor )
|
||||||
|
return; // values is valid
|
||||||
|
|
||||||
|
for( i = 0; i < info->numtextures; i++ )
|
||||||
|
{
|
||||||
|
if( info->ptexture != NULL )
|
||||||
|
{
|
||||||
|
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP ))
|
||||||
|
CL_UpdateStudioTexture( entity, &info->ptexture[i], topcolor, bottomcolor );
|
||||||
|
}
|
||||||
|
else CL_UpdateAliasTexture( entity, &info->textures[i], i, topcolor, bottomcolor );
|
||||||
|
}
|
||||||
|
|
||||||
|
info->topcolor = topcolor;
|
||||||
|
info->bottomcolor = bottomcolor;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
CL_AllocRemapInfo
|
CL_AllocRemapInfo
|
||||||
@@ -255,7 +317,7 @@ Allocate new remap info per entity
|
|||||||
and make copy of remap textures
|
and make copy of remap textures
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_AllocRemapInfo( cl_entity_t *entity, model_t *model, int topcolor, int bottomcolor )
|
static void CL_AllocRemapInfo( cl_entity_t *entity, model_t *model, int topcolor, int bottomcolor )
|
||||||
{
|
{
|
||||||
remap_info_t *info;
|
remap_info_t *info;
|
||||||
studiohdr_t *phdr;
|
studiohdr_t *phdr;
|
||||||
@@ -362,68 +424,6 @@ void CL_AllocRemapInfo( cl_entity_t *entity, model_t *model, int topcolor, int b
|
|||||||
info->model = model;
|
info->model = model;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
====================
|
|
||||||
CL_UpdateRemapInfo
|
|
||||||
|
|
||||||
Update all remaps per entity
|
|
||||||
====================
|
|
||||||
*/
|
|
||||||
void CL_UpdateRemapInfo( cl_entity_t *entity, int topcolor, int bottomcolor )
|
|
||||||
{
|
|
||||||
remap_info_t *info;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
i = ( entity == &clgame.viewent ) ? clgame.maxEntities : entity->curstate.number;
|
|
||||||
info = clgame.remap_info[i];
|
|
||||||
if( !info ) return; // no remap info
|
|
||||||
|
|
||||||
if( info->topcolor == topcolor && info->bottomcolor == bottomcolor )
|
|
||||||
return; // values is valid
|
|
||||||
|
|
||||||
for( i = 0; i < info->numtextures; i++ )
|
|
||||||
{
|
|
||||||
if( info->ptexture != NULL )
|
|
||||||
{
|
|
||||||
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP ))
|
|
||||||
CL_UpdateStudioTexture( entity, &info->ptexture[i], topcolor, bottomcolor );
|
|
||||||
}
|
|
||||||
else CL_UpdateAliasTexture( entity, &info->textures[i], i, topcolor, bottomcolor );
|
|
||||||
}
|
|
||||||
|
|
||||||
info->topcolor = topcolor;
|
|
||||||
info->bottomcolor = bottomcolor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
====================
|
|
||||||
CL_FreeRemapInfo
|
|
||||||
|
|
||||||
Release remap info per entity
|
|
||||||
====================
|
|
||||||
*/
|
|
||||||
void CL_FreeRemapInfo( remap_info_t *info )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
Assert( info != NULL );
|
|
||||||
|
|
||||||
// release all colormap texture copies
|
|
||||||
for( i = 0; i < info->numtextures; i++ )
|
|
||||||
{
|
|
||||||
if( info->ptexture != NULL )
|
|
||||||
{
|
|
||||||
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP ))
|
|
||||||
ref.dllFuncs.GL_FreeTexture( info->ptexture[i].index );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( info->textures[i] != 0 )
|
|
||||||
ref.dllFuncs.GL_FreeTexture( info->textures[i] );
|
|
||||||
}
|
|
||||||
|
|
||||||
Mem_Free( info ); // release struct
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
CL_ClearAllRemaps
|
CL_ClearAllRemaps
|
||||||
@@ -446,3 +446,21 @@ void CL_ClearAllRemaps( void )
|
|||||||
}
|
}
|
||||||
clgame.remap_info = NULL;
|
clgame.remap_info = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
CL_EntitySetRemapColors
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
qboolean CL_EntitySetRemapColors( cl_entity_t *e, model_t *mod, int top, int bottom )
|
||||||
|
{
|
||||||
|
CL_AllocRemapInfo( e, mod, top, bottom );
|
||||||
|
|
||||||
|
if( CL_GetRemapInfoForEntity( e ))
|
||||||
|
{
|
||||||
|
CL_UpdateRemapInfo( e, top, bottom );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|||||||
@@ -142,8 +142,6 @@ intptr_t CL_RenderGetParm( const int parm, const int arg, const qboolean checkRe
|
|||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
case PARM_SKY_SPHERE:
|
|
||||||
return FBitSet( world.flags, FWORLD_SKYSPHERE ) && !FBitSet( world.flags, FWORLD_CUSTOM_SKYBOX );
|
|
||||||
case PARAM_GAMEPAUSED:
|
case PARAM_GAMEPAUSED:
|
||||||
return cl.paused;
|
return cl.paused;
|
||||||
case PARM_CLIENT_INGAME:
|
case PARM_CLIENT_INGAME:
|
||||||
@@ -187,26 +185,30 @@ intptr_t CL_RenderGetParm( const int parm, const int arg, const qboolean checkRe
|
|||||||
return CL_IsThirdPerson();
|
return CL_IsThirdPerson();
|
||||||
case PARM_QUAKE_COMPATIBLE:
|
case PARM_QUAKE_COMPATIBLE:
|
||||||
return Host_IsQuakeCompatible();
|
return Host_IsQuakeCompatible();
|
||||||
case PARM_PLAYER_INDEX:
|
|
||||||
return cl.playernum + 1;
|
|
||||||
case PARM_VIEWENT_INDEX:
|
|
||||||
return cl.viewentity;
|
|
||||||
case PARM_CONNSTATE:
|
case PARM_CONNSTATE:
|
||||||
return (int)cls.state;
|
return (int)cls.state;
|
||||||
case PARM_PLAYING_DEMO:
|
case PARM_PLAYING_DEMO:
|
||||||
return cls.demoplayback;
|
return cls.demoplayback;
|
||||||
case PARM_WATER_LEVEL:
|
case PARM_WATER_LEVEL:
|
||||||
return cl.local.waterlevel;
|
return cl.local.waterlevel;
|
||||||
case PARM_MAX_CLIENTS:
|
|
||||||
return cl.maxclients;
|
|
||||||
case PARM_LOCAL_HEALTH:
|
case PARM_LOCAL_HEALTH:
|
||||||
return cl.local.health;
|
return cl.local.health;
|
||||||
case PARM_LOCAL_GAME:
|
case PARM_LOCAL_GAME:
|
||||||
return Host_IsLocalGame();
|
return Host_IsLocalGame();
|
||||||
case PARM_NUMENTITIES:
|
case PARM_NUMENTITIES:
|
||||||
return pfnNumberOfEntities();
|
return pfnNumberOfEntities();
|
||||||
case PARM_NUMMODELS:
|
case PARM_GET_CLIENT_PTR:
|
||||||
return cl.nummodels;
|
return (intptr_t)&cl.time; // with the offset
|
||||||
|
case PARM_GET_HOST_PTR:
|
||||||
|
return (intptr_t)&host.realtime; // with the offset
|
||||||
|
case PARM_GET_WORLD_PTR:
|
||||||
|
return (intptr_t)&world;
|
||||||
|
case PARM_GET_MOVEVARS_PTR:
|
||||||
|
return (intptr_t)&clgame.movevars;
|
||||||
|
case PARM_GET_PALETTE_PTR:
|
||||||
|
return (intptr_t)&clgame.palette;
|
||||||
|
case PARM_GET_VIEWENT_PTR:
|
||||||
|
return (intptr_t)&clgame.viewent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -2624,7 +2624,7 @@ CL_UpdateFlashlight
|
|||||||
update client flashlight
|
update client flashlight
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void CL_UpdateFlashlight( cl_entity_t *ent )
|
static void CL_UpdateFlashlight( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
vec3_t forward, view_ofs;
|
vec3_t forward, view_ofs;
|
||||||
vec3_t vecSrc, vecEnd;
|
vec3_t vecSrc, vecEnd;
|
||||||
@@ -2665,7 +2665,7 @@ void CL_UpdateFlashlight( cl_entity_t *ent )
|
|||||||
// update flashlight endpos
|
// update flashlight endpos
|
||||||
dl = CL_AllocDlight( ent->index );
|
dl = CL_AllocDlight( ent->index );
|
||||||
#if 1
|
#if 1
|
||||||
hit = CL_GetEntityByIndex( clgame.pmove->visents[trace.ent].info );
|
hit = CL_GetEntityByIndex( clgame.pmove->physents[trace.ent].info );
|
||||||
if( hit && hit->model && ( hit->model->type == mod_alias || hit->model->type == mod_studio ))
|
if( hit && hit->model && ( hit->model->type == mod_alias || hit->model->type == mod_studio ))
|
||||||
VectorCopy( hit->origin, dl->origin );
|
VectorCopy( hit->origin, dl->origin );
|
||||||
else VectorCopy( trace.endpos, dl->origin );
|
else VectorCopy( trace.endpos, dl->origin );
|
||||||
@@ -2684,6 +2684,41 @@ void CL_UpdateFlashlight( cl_entity_t *ent )
|
|||||||
dl->radius = 80;
|
dl->radius = 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void R_EntityDimlight( cl_entity_t *ent, int key )
|
||||||
|
{
|
||||||
|
dlight_t *dl = CL_AllocDlight( key );
|
||||||
|
|
||||||
|
VectorCopy( ent->origin, dl->origin );
|
||||||
|
dl->color.r = dl->color.g = dl->color.b = 100;
|
||||||
|
dl->radius = COM_RandomFloat( 200.0f, 231.0f );
|
||||||
|
dl->die = cl.time + 0.001;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_EntityLight( cl_entity_t *ent, int key )
|
||||||
|
{
|
||||||
|
dlight_t *dl = CL_AllocDlight( key );
|
||||||
|
|
||||||
|
VectorCopy( ent->origin, dl->origin );
|
||||||
|
dl->color.r = dl->color.g = dl->color.b = 100;
|
||||||
|
dl->radius = 200;
|
||||||
|
dl->die = cl.time + 0.001;
|
||||||
|
|
||||||
|
R_RocketFlare( ent->origin );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_EntityBrightlight( cl_entity_t *ent, int key, int radius )
|
||||||
|
{
|
||||||
|
dlight_t *dl = CL_AllocDlight( key );
|
||||||
|
|
||||||
|
VectorCopy( ent->origin, dl->origin );
|
||||||
|
dl->origin[2] += 16.0f;
|
||||||
|
dl->color.r = dl->color.g = dl->color.b = 250;
|
||||||
|
if( !radius )
|
||||||
|
dl->radius = COM_RandomFloat( 400.0f, 431.0f );
|
||||||
|
else dl->radius = 400;
|
||||||
|
dl->die = cl.time + 0.001;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
CL_AddEntityEffects
|
CL_AddEntityEffects
|
||||||
@@ -2693,50 +2728,41 @@ apply various effects to entity origin or attachment
|
|||||||
*/
|
*/
|
||||||
void CL_AddEntityEffects( cl_entity_t *ent )
|
void CL_AddEntityEffects( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
// yellow flies effect 'monster stuck in the wall'
|
// players have special set of effects, from CL_LinkPlayers
|
||||||
if( FBitSet( ent->curstate.effects, EF_BRIGHTFIELD ) && !RP_LOCALCLIENT( ent ))
|
if( ent->player && ent->index != cl.viewentity )
|
||||||
R_EntityParticles( ent );
|
|
||||||
|
|
||||||
if( FBitSet( ent->curstate.effects, EF_DIMLIGHT ))
|
|
||||||
{
|
{
|
||||||
if( ent->player && !Host_IsQuakeCompatible( ))
|
if( FBitSet( ent->curstate.effects, EF_BRIGHTLIGHT ))
|
||||||
{
|
R_EntityBrightlight( ent, ent->index /* 4 in GoldSrc */, 0 );
|
||||||
|
|
||||||
|
if( FBitSet( ent->curstate.effects, EF_DIMLIGHT ))
|
||||||
|
R_EntityDimlight( ent, ent->index /* 4 in GoldSrc */ );
|
||||||
|
}
|
||||||
|
else if( RP_LOCALCLIENT( ent ))
|
||||||
|
{
|
||||||
|
// from CL_PlayerFlashlight
|
||||||
|
if( FBitSet( ent->curstate.effects, EF_BRIGHTLIGHT ))
|
||||||
|
R_EntityBrightlight( ent, ent->index /* 1 in GoldSrc */, 400 );
|
||||||
|
else if( FBitSet( ent->curstate.effects, EF_DIMLIGHT ))
|
||||||
CL_UpdateFlashlight( ent );
|
CL_UpdateFlashlight( ent );
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dlight_t *dl = CL_AllocDlight( ent->index );
|
|
||||||
dl->color.r = dl->color.g = dl->color.b = 100;
|
|
||||||
dl->radius = COM_RandomFloat( 200, 231 );
|
|
||||||
VectorCopy( ent->origin, dl->origin );
|
|
||||||
dl->die = cl.time + 0.001;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if( FBitSet( ent->curstate.effects, EF_BRIGHTLIGHT ))
|
|
||||||
{
|
{
|
||||||
dlight_t *dl = CL_AllocDlight( ent->index );
|
// from CL_LinkPacketEntities
|
||||||
dl->color.r = dl->color.g = dl->color.b = 250;
|
if( FBitSet( ent->curstate.effects, EF_BRIGHTFIELD ))
|
||||||
if( ent->player ) dl->radius = 400; // don't flickering
|
R_EntityParticles( ent );
|
||||||
else dl->radius = COM_RandomFloat( 400, 431 );
|
|
||||||
VectorCopy( ent->origin, dl->origin );
|
|
||||||
dl->die = cl.time + 0.001;
|
|
||||||
dl->origin[2] += 16.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
// add light effect
|
if( FBitSet( ent->curstate.effects, EF_BRIGHTLIGHT ))
|
||||||
if( FBitSet( ent->curstate.effects, EF_LIGHT ))
|
R_EntityBrightlight( ent, ent->index, 0 );
|
||||||
{
|
|
||||||
dlight_t *dl = CL_AllocDlight( ent->index );
|
if( FBitSet( ent->curstate.effects, EF_DIMLIGHT ))
|
||||||
dl->color.r = dl->color.g = dl->color.b = 100;
|
R_EntityDimlight( ent, ent->index );
|
||||||
VectorCopy( ent->origin, dl->origin );
|
|
||||||
R_RocketFlare( ent->origin );
|
if( FBitSet( ent->curstate.effects, EF_LIGHT ))
|
||||||
dl->die = cl.time + 0.001;
|
R_EntityLight( ent, ent->curstate.number );
|
||||||
dl->radius = 200;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// studio models are handle muzzleflashes difference
|
// studio models are handle muzzleflashes difference
|
||||||
if( FBitSet( ent->curstate.effects, EF_MUZZLEFLASH ) && Mod_AliasExtradata( ent->model ))
|
if( FBitSet( ent->curstate.effects, EF_MUZZLEFLASH ) && ent->model && ent->model->type == mod_alias )
|
||||||
{
|
{
|
||||||
dlight_t *dl = CL_AllocDlight( ent->index );
|
dlight_t *dl = CL_AllocDlight( ent->index );
|
||||||
vec3_t fv;
|
vec3_t fv;
|
||||||
@@ -2765,15 +2791,11 @@ void CL_AddModelEffects( cl_entity_t *ent )
|
|||||||
vec3_t neworigin;
|
vec3_t neworigin;
|
||||||
vec3_t oldorigin;
|
vec3_t oldorigin;
|
||||||
|
|
||||||
if( !ent->model ) return;
|
if( !ent->model || ent->player )
|
||||||
|
return;
|
||||||
|
|
||||||
switch( ent->model->type )
|
if( ent->model->type != mod_alias && ent->model->type != mod_studio )
|
||||||
{
|
return;
|
||||||
case mod_alias:
|
|
||||||
case mod_studio:
|
|
||||||
break;
|
|
||||||
default: return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( cls.demoplayback == DEMO_QUAKE1 )
|
if( cls.demoplayback == DEMO_QUAKE1 )
|
||||||
{
|
{
|
||||||
@@ -2793,19 +2815,15 @@ void CL_AddModelEffects( cl_entity_t *ent )
|
|||||||
|
|
||||||
if( FBitSet( ent->model->flags, STUDIO_GIB ))
|
if( FBitSet( ent->model->flags, STUDIO_GIB ))
|
||||||
R_RocketTrail( oldorigin, neworigin, 2 );
|
R_RocketTrail( oldorigin, neworigin, 2 );
|
||||||
|
else if( FBitSet( ent->model->flags, STUDIO_ZOMGIB ))
|
||||||
if( FBitSet( ent->model->flags, STUDIO_ZOMGIB ))
|
|
||||||
R_RocketTrail( oldorigin, neworigin, 4 );
|
R_RocketTrail( oldorigin, neworigin, 4 );
|
||||||
|
else if( FBitSet( ent->model->flags, STUDIO_TRACER ))
|
||||||
if( FBitSet( ent->model->flags, STUDIO_TRACER ))
|
|
||||||
R_RocketTrail( oldorigin, neworigin, 3 );
|
R_RocketTrail( oldorigin, neworigin, 3 );
|
||||||
|
else if( FBitSet( ent->model->flags, STUDIO_TRACER2 ))
|
||||||
if( FBitSet( ent->model->flags, STUDIO_TRACER2 ))
|
|
||||||
R_RocketTrail( oldorigin, neworigin, 5 );
|
R_RocketTrail( oldorigin, neworigin, 5 );
|
||||||
|
else if( FBitSet( ent->model->flags, STUDIO_ROCKET ))
|
||||||
if( FBitSet( ent->model->flags, STUDIO_ROCKET ))
|
|
||||||
{
|
{
|
||||||
dlight_t *dl = CL_AllocDlight( ent->index );
|
dlight_t *dl = CL_AllocDlight( ent->curstate.number );
|
||||||
|
|
||||||
dl->color.r = dl->color.g = dl->color.b = 200;
|
dl->color.r = dl->color.g = dl->color.b = 200;
|
||||||
VectorCopy( ent->origin, dl->origin );
|
VectorCopy( ent->origin, dl->origin );
|
||||||
@@ -2819,11 +2837,9 @@ void CL_AddModelEffects( cl_entity_t *ent )
|
|||||||
|
|
||||||
R_RocketTrail( oldorigin, neworigin, 0 );
|
R_RocketTrail( oldorigin, neworigin, 0 );
|
||||||
}
|
}
|
||||||
|
else if( FBitSet( ent->model->flags, STUDIO_GRENADE ))
|
||||||
if( FBitSet( ent->model->flags, STUDIO_GRENADE ))
|
|
||||||
R_RocketTrail( oldorigin, neworigin, 1 );
|
R_RocketTrail( oldorigin, neworigin, 1 );
|
||||||
|
else if( FBitSet( ent->model->flags, STUDIO_TRACER3 ))
|
||||||
if( FBitSet( ent->model->flags, STUDIO_TRACER3 ))
|
|
||||||
R_RocketTrail( oldorigin, neworigin, 6 );
|
R_RocketTrail( oldorigin, neworigin, 6 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ void R_DebugParticle( const vec3_t pos, byte r, byte g, byte b );
|
|||||||
void R_RicochetSound( const vec3_t pos );
|
void R_RicochetSound( const vec3_t pos );
|
||||||
struct dlight_s *CL_AllocDlight( int key );
|
struct dlight_s *CL_AllocDlight( int key );
|
||||||
struct dlight_s *CL_AllocElight( int key );
|
struct dlight_s *CL_AllocElight( int key );
|
||||||
void CL_UpdateFlashlight( cl_entity_t *pEnt );
|
|
||||||
void CL_AddEntityEffects( cl_entity_t *ent );
|
void CL_AddEntityEffects( cl_entity_t *ent );
|
||||||
void CL_AddModelEffects( cl_entity_t *ent );
|
void CL_AddModelEffects( cl_entity_t *ent );
|
||||||
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags );
|
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags );
|
||||||
|
|||||||
@@ -202,7 +202,6 @@ SCR_PlayCinematic
|
|||||||
*/
|
*/
|
||||||
qboolean SCR_PlayCinematic( const char *arg )
|
qboolean SCR_PlayCinematic( const char *arg )
|
||||||
{
|
{
|
||||||
string path;
|
|
||||||
const char *fullpath;
|
const char *fullpath;
|
||||||
|
|
||||||
fullpath = FS_GetDiskPath( arg, false );
|
fullpath = FS_GetDiskPath( arg, false );
|
||||||
|
|||||||
@@ -549,5 +549,6 @@ void V_PostRender( void )
|
|||||||
|
|
||||||
SCR_MakeScreenShot();
|
SCR_MakeScreenShot();
|
||||||
ref.dllFuncs.R_AllowFog( true );
|
ref.dllFuncs.R_AllowFog( true );
|
||||||
|
Platform_SetTimer( 0.0f );
|
||||||
ref.dllFuncs.R_EndFrame();
|
ref.dllFuncs.R_EndFrame();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,6 +174,26 @@ typedef struct
|
|||||||
// at every server map change
|
// at every server map change
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
// ==== shared through RefAPI's ref_client_t ====
|
||||||
|
double time; // this is the time value that the client
|
||||||
|
// is rendering at. always <= cls.realtime
|
||||||
|
// a lerp point for other data
|
||||||
|
double oldtime; // previous cl.time, time-oldtime is used
|
||||||
|
// to decay light values and smooth step ups
|
||||||
|
int viewentity;
|
||||||
|
|
||||||
|
// server state information
|
||||||
|
int playernum;
|
||||||
|
int maxclients;
|
||||||
|
|
||||||
|
int nummodels;
|
||||||
|
model_t *models[MAX_MODELS+1]; // precached models (plus sentinel slot)
|
||||||
|
|
||||||
|
qboolean paused;
|
||||||
|
|
||||||
|
vec3_t simorg; // predicted origin
|
||||||
|
// ==== shared through RefAPI's ref_client_t ===
|
||||||
|
|
||||||
int servercount; // server identification for prespawns
|
int servercount; // server identification for prespawns
|
||||||
int validsequence; // this is the sequence number of the last good
|
int validsequence; // this is the sequence number of the last good
|
||||||
// world snapshot/update we got. If this is 0, we can't
|
// world snapshot/update we got. If this is 0, we can't
|
||||||
@@ -183,7 +203,6 @@ typedef struct
|
|||||||
|
|
||||||
qboolean video_prepped; // false if on new level or new ref dll
|
qboolean video_prepped; // false if on new level or new ref dll
|
||||||
qboolean audio_prepped; // false if on new level or new snd dll
|
qboolean audio_prepped; // false if on new level or new snd dll
|
||||||
qboolean paused;
|
|
||||||
|
|
||||||
int delta_sequence; // acknowledged sequence number
|
int delta_sequence; // acknowledged sequence number
|
||||||
|
|
||||||
@@ -205,11 +224,6 @@ typedef struct
|
|||||||
runcmd_t commands[MULTIPLAYER_BACKUP]; // each mesage will send several old cmds
|
runcmd_t commands[MULTIPLAYER_BACKUP]; // each mesage will send several old cmds
|
||||||
local_state_t predicted_frames[MULTIPLAYER_BACKUP]; // local client state
|
local_state_t predicted_frames[MULTIPLAYER_BACKUP]; // local client state
|
||||||
|
|
||||||
double time; // this is the time value that the client
|
|
||||||
// is rendering at. always <= cls.realtime
|
|
||||||
// a lerp point for other data
|
|
||||||
double oldtime; // previous cl.time, time-oldtime is used
|
|
||||||
// to decay light values and smooth step ups
|
|
||||||
double timedelta; // floating delta between two updates
|
double timedelta; // floating delta between two updates
|
||||||
|
|
||||||
char serverinfo[MAX_SERVERINFO_STRING];
|
char serverinfo[MAX_SERVERINFO_STRING];
|
||||||
@@ -223,7 +237,6 @@ typedef struct
|
|||||||
|
|
||||||
// player final info
|
// player final info
|
||||||
usercmd_t *cmd; // cl.commands[outgoing_sequence].cmd
|
usercmd_t *cmd; // cl.commands[outgoing_sequence].cmd
|
||||||
int viewentity;
|
|
||||||
vec3_t viewangles;
|
vec3_t viewangles;
|
||||||
vec3_t viewheight;
|
vec3_t viewheight;
|
||||||
vec3_t punchangle;
|
vec3_t punchangle;
|
||||||
@@ -236,14 +249,9 @@ typedef struct
|
|||||||
float addangletotal;
|
float addangletotal;
|
||||||
float prevaddangletotal;
|
float prevaddangletotal;
|
||||||
|
|
||||||
// predicted origin and velocity
|
// predicted velocity
|
||||||
vec3_t simorg;
|
|
||||||
vec3_t simvel;
|
vec3_t simvel;
|
||||||
|
|
||||||
// server state information
|
|
||||||
int playernum;
|
|
||||||
int maxclients;
|
|
||||||
|
|
||||||
entity_state_t instanced_baseline[MAX_CUSTOM_BASELINES];
|
entity_state_t instanced_baseline[MAX_CUSTOM_BASELINES];
|
||||||
int instanced_baseline_count;
|
int instanced_baseline_count;
|
||||||
|
|
||||||
@@ -251,8 +259,6 @@ typedef struct
|
|||||||
char event_precache[MAX_EVENTS][MAX_QPATH];
|
char event_precache[MAX_EVENTS][MAX_QPATH];
|
||||||
char files_precache[MAX_CUSTOM][MAX_QPATH];
|
char files_precache[MAX_CUSTOM][MAX_QPATH];
|
||||||
lightstyle_t lightstyles[MAX_LIGHTSTYLES];
|
lightstyle_t lightstyles[MAX_LIGHTSTYLES];
|
||||||
model_t *models[MAX_MODELS+1]; // precached models (plus sentinel slot)
|
|
||||||
int nummodels;
|
|
||||||
int numfiles;
|
int numfiles;
|
||||||
|
|
||||||
consistency_t consistency_list[MAX_MODELS];
|
consistency_t consistency_list[MAX_MODELS];
|
||||||
@@ -694,6 +700,7 @@ extern convar_t rate;
|
|||||||
extern convar_t m_ignore;
|
extern convar_t m_ignore;
|
||||||
extern convar_t r_showtree;
|
extern convar_t r_showtree;
|
||||||
extern convar_t ui_renderworld;
|
extern convar_t ui_renderworld;
|
||||||
|
extern convar_t cl_fixmodelinterpolationartifacts;
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
@@ -996,9 +1003,7 @@ void CL_EmitEntities( void );
|
|||||||
// cl_remap.c
|
// cl_remap.c
|
||||||
//
|
//
|
||||||
remap_info_t *CL_GetRemapInfoForEntity( cl_entity_t *e );
|
remap_info_t *CL_GetRemapInfoForEntity( cl_entity_t *e );
|
||||||
void CL_AllocRemapInfo( cl_entity_t *entity, model_t *model, int topcolor, int bottomcolor );
|
qboolean CL_EntitySetRemapColors( cl_entity_t *e, model_t *mod, int top, int bottom );
|
||||||
void CL_FreeRemapInfo( remap_info_t *info );
|
|
||||||
void CL_UpdateRemapInfo( cl_entity_t *ent, int topcolor, int bottomcolor );
|
|
||||||
void CL_ClearAllRemaps( void );
|
void CL_ClearAllRemaps( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -172,8 +172,6 @@ void IN_ToggleClientMouse( int newstate, int oldstate )
|
|||||||
{
|
{
|
||||||
if( newstate == oldstate )
|
if( newstate == oldstate )
|
||||||
return;
|
return;
|
||||||
if( m_ignore.value )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// since SetCursorType controls cursor visibility
|
// since SetCursorType controls cursor visibility
|
||||||
// execute it first, and then check mouse grab state
|
// execute it first, and then check mouse grab state
|
||||||
@@ -194,6 +192,10 @@ void IN_ToggleClientMouse( int newstate, int oldstate )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// don't leave the user without cursor if they enabled m_ignore
|
||||||
|
if( m_ignore.value )
|
||||||
|
return;
|
||||||
|
|
||||||
if( oldstate == key_game )
|
if( oldstate == key_game )
|
||||||
{
|
{
|
||||||
IN_DeactivateMouse();
|
IN_DeactivateMouse();
|
||||||
|
|||||||
@@ -18,6 +18,31 @@ CVAR_DEFINE_AUTO( r_showtree, "0", FCVAR_ARCHIVE, "build the graph of visible BS
|
|||||||
static CVAR_DEFINE_AUTO( r_refdll, "", FCVAR_RENDERINFO, "choose renderer implementation, if supported" );
|
static CVAR_DEFINE_AUTO( r_refdll, "", FCVAR_RENDERINFO, "choose renderer implementation, if supported" );
|
||||||
static CVAR_DEFINE_AUTO( r_refdll_loaded, "", FCVAR_READ_ONLY, "currently loaded renderer" );
|
static CVAR_DEFINE_AUTO( r_refdll_loaded, "", FCVAR_READ_ONLY, "currently loaded renderer" );
|
||||||
|
|
||||||
|
// there is no need to expose whole host and cl structs into the renderer
|
||||||
|
// but we still need to update timings accurately as possible
|
||||||
|
// this looks horrible but the only other option would be passing four
|
||||||
|
// time pointers and then it's looks even worse with dereferences everywhere
|
||||||
|
#define STATIC_OFFSET_CHECK( s1, s2, field, base, msg ) \
|
||||||
|
STATIC_ASSERT( offsetof( s1, field ) == offsetof( s2, field ) - offsetof( s2, base ), msg )
|
||||||
|
#define REF_CLIENT_CHECK( field ) \
|
||||||
|
STATIC_OFFSET_CHECK( ref_client_t, client_t, field, time, "broken ref_client_t offset" ); \
|
||||||
|
STATIC_ASSERT_( szchk_##__LINE__, sizeof(((ref_client_t *)0)->field ) == sizeof( cl.field ), "broken ref_client_t size" )
|
||||||
|
#define REF_HOST_CHECK( field ) \
|
||||||
|
STATIC_OFFSET_CHECK( ref_host_t, host_parm_t, field, realtime, "broken ref_client_t offset" ); \
|
||||||
|
STATIC_ASSERT_( szchk_##__LINE__, sizeof(((ref_host_t *)0)->field ) == sizeof( host.field ), "broken ref_client_t size" )
|
||||||
|
|
||||||
|
REF_CLIENT_CHECK( time );
|
||||||
|
REF_CLIENT_CHECK( oldtime );
|
||||||
|
REF_CLIENT_CHECK( viewentity );
|
||||||
|
REF_CLIENT_CHECK( playernum );
|
||||||
|
REF_CLIENT_CHECK( maxclients );
|
||||||
|
REF_CLIENT_CHECK( models );
|
||||||
|
REF_CLIENT_CHECK( paused );
|
||||||
|
REF_CLIENT_CHECK( simorg );
|
||||||
|
REF_HOST_CHECK( realtime );
|
||||||
|
REF_HOST_CHECK( frametime );
|
||||||
|
REF_HOST_CHECK( features );
|
||||||
|
|
||||||
void R_GetTextureParms( int *w, int *h, int texnum )
|
void R_GetTextureParms( int *w, int *h, int texnum )
|
||||||
{
|
{
|
||||||
if( w ) *w = REF_GET_PARM( PARM_TEX_WIDTH, texnum );
|
if( w ) *w = REF_GET_PARM( PARM_TEX_WIDTH, texnum );
|
||||||
@@ -42,18 +67,8 @@ void GAME_EXPORT GL_FreeImage( const char *name )
|
|||||||
ref.dllFuncs.GL_FreeTexture( texnum );
|
ref.dllFuncs.GL_FreeTexture( texnum );
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_UpdateRefState( void )
|
|
||||||
{
|
|
||||||
refState.time = cl.time;
|
|
||||||
refState.oldtime = cl.oldtime;
|
|
||||||
refState.realtime = host.realtime;
|
|
||||||
refState.frametime = host.frametime;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GL_RenderFrame( const ref_viewpass_t *rvp )
|
void GL_RenderFrame( const ref_viewpass_t *rvp )
|
||||||
{
|
{
|
||||||
R_UpdateRefState();
|
|
||||||
|
|
||||||
VectorCopy( rvp->vieworigin, refState.vieworg );
|
VectorCopy( rvp->vieworigin, refState.vieworg );
|
||||||
VectorCopy( rvp->viewangles, refState.viewangles );
|
VectorCopy( rvp->viewangles, refState.viewangles );
|
||||||
|
|
||||||
@@ -65,11 +80,6 @@ static intptr_t pfnEngineGetParm( int parm, int arg )
|
|||||||
return CL_RenderGetParm( parm, arg, false ); // prevent recursion
|
return CL_RenderGetParm( parm, arg, false ); // prevent recursion
|
||||||
}
|
}
|
||||||
|
|
||||||
static world_static_t *pfnGetWorld( void )
|
|
||||||
{
|
|
||||||
return &world;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void pfnStudioEvent( const mstudioevent_t *event, const cl_entity_t *e )
|
static void pfnStudioEvent( const mstudioevent_t *event, const cl_entity_t *e )
|
||||||
{
|
{
|
||||||
clgame.dllFuncs.pfnStudioEvent( event, e );
|
clgame.dllFuncs.pfnStudioEvent( event, e );
|
||||||
@@ -99,16 +109,6 @@ static void *pfnMod_Extradata( int type, model_t *m )
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pfnGetPredictedOrigin( vec3_t v )
|
|
||||||
{
|
|
||||||
VectorCopy( cl.simorg, v );
|
|
||||||
}
|
|
||||||
|
|
||||||
static color24 *pfnCL_GetPaletteColor( int color ) // clgame.palette[color]
|
|
||||||
{
|
|
||||||
return &clgame.palette[color];
|
|
||||||
}
|
|
||||||
|
|
||||||
static void pfnCL_GetScreenInfo( int *width, int *height ) // clgame.scrInfo, ptrs may be NULL
|
static void pfnCL_GetScreenInfo( int *width, int *height ) // clgame.scrInfo, ptrs may be NULL
|
||||||
{
|
{
|
||||||
if( width ) *width = clgame.scrInfo.iWidth;
|
if( width ) *width = clgame.scrInfo.iWidth;
|
||||||
@@ -158,11 +158,6 @@ static int pfnGetStudioModelInterface( int version, struct r_studio_interface_s
|
|||||||
0;
|
0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static poolhandle_t pfnImage_GetPool( void )
|
|
||||||
{
|
|
||||||
return host.imagepool;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const bpc_desc_t *pfnImage_GetPFDesc( int idx )
|
static const bpc_desc_t *pfnImage_GetPFDesc( int idx )
|
||||||
{
|
{
|
||||||
return &PFDesc[idx];
|
return &PFDesc[idx];
|
||||||
@@ -246,16 +241,12 @@ static ref_api_t gEngfuncs =
|
|||||||
Con_DrawString,
|
Con_DrawString,
|
||||||
CL_DrawCenterPrint,
|
CL_DrawCenterPrint,
|
||||||
|
|
||||||
CL_GetLocalPlayer,
|
|
||||||
CL_GetViewModel,
|
|
||||||
CL_GetEntityByIndex,
|
|
||||||
R_BeamGetEntity,
|
R_BeamGetEntity,
|
||||||
CL_GetWaterEntity,
|
CL_GetWaterEntity,
|
||||||
CL_AddVisibleEntity,
|
CL_AddVisibleEntity,
|
||||||
|
|
||||||
Mod_SampleSizeForFace,
|
Mod_SampleSizeForFace,
|
||||||
Mod_BoxVisible,
|
Mod_BoxVisible,
|
||||||
pfnGetWorld,
|
|
||||||
Mod_PointInLeaf,
|
Mod_PointInLeaf,
|
||||||
Mod_CreatePolygonsForHull,
|
Mod_CreatePolygonsForHull,
|
||||||
|
|
||||||
@@ -272,12 +263,9 @@ static ref_api_t gEngfuncs =
|
|||||||
|
|
||||||
Mod_ForName,
|
Mod_ForName,
|
||||||
pfnMod_Extradata,
|
pfnMod_Extradata,
|
||||||
CL_ModelHandle,
|
|
||||||
|
|
||||||
|
CL_EntitySetRemapColors,
|
||||||
CL_GetRemapInfoForEntity,
|
CL_GetRemapInfoForEntity,
|
||||||
CL_AllocRemapInfo,
|
|
||||||
CL_FreeRemapInfo,
|
|
||||||
CL_UpdateRemapInfo,
|
|
||||||
|
|
||||||
CL_ExtraUpdate,
|
CL_ExtraUpdate,
|
||||||
Host_Error,
|
Host_Error,
|
||||||
@@ -285,9 +273,6 @@ static ref_api_t gEngfuncs =
|
|||||||
COM_RandomFloat,
|
COM_RandomFloat,
|
||||||
COM_RandomLong,
|
COM_RandomLong,
|
||||||
pfnRefGetScreenFade,
|
pfnRefGetScreenFade,
|
||||||
CL_TextMessageGet,
|
|
||||||
pfnGetPredictedOrigin,
|
|
||||||
pfnCL_GetPaletteColor,
|
|
||||||
pfnCL_GetScreenInfo,
|
pfnCL_GetScreenInfo,
|
||||||
pfnSetLocalLightLevel,
|
pfnSetLocalLightLevel,
|
||||||
Sys_CheckParm,
|
Sys_CheckParm,
|
||||||
@@ -337,7 +322,6 @@ static ref_api_t gEngfuncs =
|
|||||||
PM_CL_TraceLine,
|
PM_CL_TraceLine,
|
||||||
CL_VisTraceLine,
|
CL_VisTraceLine,
|
||||||
CL_TraceLine,
|
CL_TraceLine,
|
||||||
pfnGetMoveVars,
|
|
||||||
|
|
||||||
Image_AddCmdFlags,
|
Image_AddCmdFlags,
|
||||||
Image_SetForceFlags,
|
Image_SetForceFlags,
|
||||||
@@ -349,7 +333,6 @@ static ref_api_t gEngfuncs =
|
|||||||
FS_CopyImage,
|
FS_CopyImage,
|
||||||
FS_FreeImage,
|
FS_FreeImage,
|
||||||
Image_SetMDLPointer,
|
Image_SetMDLPointer,
|
||||||
pfnImage_GetPool,
|
|
||||||
pfnImage_GetPFDesc,
|
pfnImage_GetPFDesc,
|
||||||
|
|
||||||
pfnDrawNormalTriangles,
|
pfnDrawNormalTriangles,
|
||||||
@@ -431,7 +414,7 @@ static qboolean R_LoadProgs( const char *name )
|
|||||||
// make local copy of engfuncs to prevent overwrite it with user dll
|
// make local copy of engfuncs to prevent overwrite it with user dll
|
||||||
memcpy( &gpEngfuncs, &gEngfuncs, sizeof( gpEngfuncs ));
|
memcpy( &gpEngfuncs, &gEngfuncs, sizeof( gpEngfuncs ));
|
||||||
|
|
||||||
if( !GetRefAPI( REF_API_VERSION, &ref.dllFuncs, &gpEngfuncs, &refState ))
|
if( GetRefAPI( REF_API_VERSION, &ref.dllFuncs, &gpEngfuncs, &refState ) != REF_API_VERSION )
|
||||||
{
|
{
|
||||||
COM_FreeLibrary( ref.hInstance );
|
COM_FreeLibrary( ref.hInstance );
|
||||||
Con_Reportf( "R_LoadProgs: can't init renderer API: wrong version\n" );
|
Con_Reportf( "R_LoadProgs: can't init renderer API: wrong version\n" );
|
||||||
@@ -569,6 +552,9 @@ static void R_CollectRendererNames( void )
|
|||||||
#if XASH_REF_GL4ES_ENABLED
|
#if XASH_REF_GL4ES_ENABLED
|
||||||
"gl4es",
|
"gl4es",
|
||||||
#endif
|
#endif
|
||||||
|
#if XASH_REF_GLES3COMPAT_ENABLED
|
||||||
|
"gles3compat",
|
||||||
|
#endif
|
||||||
#if XASH_REF_SOFT_ENABLED
|
#if XASH_REF_SOFT_ENABLED
|
||||||
"soft",
|
"soft",
|
||||||
#endif
|
#endif
|
||||||
@@ -589,6 +575,9 @@ static void R_CollectRendererNames( void )
|
|||||||
#if XASH_REF_GL4ES_ENABLED
|
#if XASH_REF_GL4ES_ENABLED
|
||||||
"GL4ES",
|
"GL4ES",
|
||||||
#endif
|
#endif
|
||||||
|
#if XASH_REF_GLES3COMPAT_ENABLED
|
||||||
|
"GLES3 (gl2_shim)"
|
||||||
|
#endif
|
||||||
#if XASH_REF_SOFT_ENABLED
|
#if XASH_REF_SOFT_ENABLED
|
||||||
"Software",
|
"Software",
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ extern convar_t gl_clear;
|
|||||||
|
|
||||||
qboolean R_Init( void );
|
qboolean R_Init( void );
|
||||||
void R_Shutdown( void );
|
void R_Shutdown( void );
|
||||||
void R_UpdateRefState( void );
|
|
||||||
|
|
||||||
extern triangleapi_t gTriApi;
|
extern triangleapi_t gTriApi;
|
||||||
|
|
||||||
|
|||||||
@@ -302,8 +302,12 @@ typedef struct host_parm_s
|
|||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
|
|
||||||
|
// ==== shared through RefAPI's ref_host_t
|
||||||
double realtime; // host.curtime
|
double realtime; // host.curtime
|
||||||
double frametime; // time between engine frames
|
double frametime; // time between engine frames
|
||||||
|
uint features; // custom features that enables by mod-maker request
|
||||||
|
// ==== shared through RefAPI's ref_host_t
|
||||||
|
|
||||||
double realframetime; // for some system events, e.g. console animations
|
double realframetime; // for some system events, e.g. console animations
|
||||||
|
|
||||||
uint framecount; // global framecount
|
uint framecount; // global framecount
|
||||||
@@ -344,8 +348,6 @@ typedef struct host_parm_s
|
|||||||
poolhandle_t imagepool; // imagelib mempool
|
poolhandle_t imagepool; // imagelib mempool
|
||||||
poolhandle_t soundpool; // soundlib mempool
|
poolhandle_t soundpool; // soundlib mempool
|
||||||
|
|
||||||
uint features; // custom features that enables by mod-maker request
|
|
||||||
|
|
||||||
// for IN_MouseMove() easy access
|
// for IN_MouseMove() easy access
|
||||||
int window_center_x;
|
int window_center_x;
|
||||||
int window_center_y;
|
int window_center_y;
|
||||||
@@ -422,8 +424,8 @@ void Cmd_Escape( char *newCommand, const char *oldCommand, int len );
|
|||||||
// zone.c
|
// zone.c
|
||||||
//
|
//
|
||||||
void Memory_Init( void );
|
void Memory_Init( void );
|
||||||
void *_Mem_Realloc( poolhandle_t poolptr, void *memptr, size_t size, qboolean clear, const char *filename, int fileline );
|
void *_Mem_Realloc( poolhandle_t poolptr, void *memptr, size_t size, qboolean clear, const char *filename, int fileline ) ALLOC_CHECK( 3 );
|
||||||
void *_Mem_Alloc( poolhandle_t poolptr, size_t size, qboolean clear, const char *filename, int fileline );
|
void *_Mem_Alloc( poolhandle_t poolptr, size_t size, qboolean clear, const char *filename, int fileline ) ALLOC_CHECK( 2 );
|
||||||
poolhandle_t _Mem_AllocPool( const char *name, const char *filename, int fileline );
|
poolhandle_t _Mem_AllocPool( const char *name, const char *filename, int fileline );
|
||||||
void _Mem_FreePool( poolhandle_t *poolptr, const char *filename, int fileline );
|
void _Mem_FreePool( poolhandle_t *poolptr, const char *filename, int fileline );
|
||||||
void _Mem_EmptyPool( poolhandle_t poolptr, const char *filename, int fileline );
|
void _Mem_EmptyPool( poolhandle_t poolptr, const char *filename, int fileline );
|
||||||
@@ -552,7 +554,7 @@ qboolean Host_IsLocalGame( void );
|
|||||||
qboolean Host_IsLocalClient( void );
|
qboolean Host_IsLocalClient( void );
|
||||||
void Host_ShutdownServer( void );
|
void Host_ShutdownServer( void );
|
||||||
void Host_Error( const char *error, ... ) _format( 1 );
|
void Host_Error( const char *error, ... ) _format( 1 );
|
||||||
void Host_PrintEngineFeatures( void );
|
void Host_ValidateEngineFeatures( uint32_t features );
|
||||||
void Host_Frame( float time );
|
void Host_Frame( float time );
|
||||||
void Host_InitDecals( void );
|
void Host_InitDecals( void );
|
||||||
void Host_Credits( void );
|
void Host_Credits( void );
|
||||||
@@ -793,7 +795,7 @@ void VID_Init( void );
|
|||||||
void UI_SetActiveMenu( qboolean fActive );
|
void UI_SetActiveMenu( qboolean fActive );
|
||||||
void UI_ShowConnectionWarning( void );
|
void UI_ShowConnectionWarning( void );
|
||||||
void Cmd_Null_f( void );
|
void Cmd_Null_f( void );
|
||||||
void Rcon_Print( const char *pMsg );
|
void Rcon_Print( host_redirect_t *rd, const char *pMsg );
|
||||||
qboolean COM_ParseVector( char **pfile, float *v, size_t size );
|
qboolean COM_ParseVector( char **pfile, float *v, size_t size );
|
||||||
void COM_NormalizeAngles( vec3_t angles );
|
void COM_NormalizeAngles( vec3_t angles );
|
||||||
int COM_FileSize( const char *filename );
|
int COM_FileSize( const char *filename );
|
||||||
|
|||||||
@@ -320,7 +320,9 @@ void Sys_RestoreCrashHandler( void )
|
|||||||
|
|
||||||
#elif XASH_FREEBSD || XASH_NETBSD || XASH_OPENBSD || XASH_ANDROID || XASH_LINUX
|
#elif XASH_FREEBSD || XASH_NETBSD || XASH_OPENBSD || XASH_ANDROID || XASH_LINUX
|
||||||
// Posix signal handler
|
// Posix signal handler
|
||||||
|
#ifndef XASH_OPENBSD
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
|
#endif
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include "library.h"
|
#include "library.h"
|
||||||
@@ -488,7 +490,7 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
|
|||||||
#ifdef XASH_SDL
|
#ifdef XASH_SDL
|
||||||
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
|
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
|
||||||
#endif
|
#endif
|
||||||
MSGBOX( message );
|
Platform_MessageBox( "Xash Error", message, false );
|
||||||
|
|
||||||
// log saved, now we can try to save configs and close log correctly, it may crash
|
// log saved, now we can try to save configs and close log correctly, it may crash
|
||||||
if( host.type == HOST_NORMAL )
|
if( host.type == HOST_NORMAL )
|
||||||
|
|||||||
@@ -1136,8 +1136,6 @@ As Cvar_Set, but also flags it as glconfig
|
|||||||
*/
|
*/
|
||||||
void Cvar_SetGL_f( void )
|
void Cvar_SetGL_f( void )
|
||||||
{
|
{
|
||||||
convar_t *var;
|
|
||||||
|
|
||||||
if( Cmd_Argc() != 3 )
|
if( Cmd_Argc() != 3 )
|
||||||
{
|
{
|
||||||
Con_Printf( S_USAGE "setgl <variable> <value>\n" );
|
Con_Printf( S_USAGE "setgl <variable> <value>\n" );
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ struct tests_stats_s tests_stats;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
CVAR_DEFINE( host_developer, "developer", "0", FCVAR_FILTERABLE, "engine is in development-mode" );
|
CVAR_DEFINE( host_developer, "developer", "0", FCVAR_FILTERABLE, "engine is in development-mode" );
|
||||||
CVAR_DEFINE_AUTO( sys_timescale, "1.0", FCVAR_CHEAT|FCVAR_FILTERABLE, "scale frame time" );
|
CVAR_DEFINE_AUTO( sys_timescale, "1.0", FCVAR_FILTERABLE, "scale frame time" );
|
||||||
CVAR_DEFINE_AUTO( sys_ticrate, "100", 0, "framerate in dedicated mode" );
|
CVAR_DEFINE_AUTO( sys_ticrate, "100", 0, "framerate in dedicated mode" );
|
||||||
|
|
||||||
static CVAR_DEFINE_AUTO( host_serverstate, "0", FCVAR_READ_ONLY, "displays current server state" );
|
static CVAR_DEFINE_AUTO( host_serverstate, "0", FCVAR_READ_ONLY, "displays current server state" );
|
||||||
@@ -62,6 +62,7 @@ CVAR_DEFINE_AUTO( host_limitlocal, "0", 0, "apply cl_cmdrate and rate to loopbac
|
|||||||
CVAR_DEFINE( host_maxfps, "fps_max", "72", FCVAR_ARCHIVE|FCVAR_FILTERABLE, "host fps upper limit" );
|
CVAR_DEFINE( host_maxfps, "fps_max", "72", FCVAR_ARCHIVE|FCVAR_FILTERABLE, "host fps upper limit" );
|
||||||
static CVAR_DEFINE_AUTO( host_framerate, "0", FCVAR_FILTERABLE, "locks frame timing to this value in seconds" );
|
static CVAR_DEFINE_AUTO( host_framerate, "0", FCVAR_FILTERABLE, "locks frame timing to this value in seconds" );
|
||||||
static CVAR_DEFINE( host_sleeptime, "sleeptime", "1", FCVAR_ARCHIVE|FCVAR_FILTERABLE, "milliseconds to sleep for each frame. higher values reduce fps accuracy" );
|
static CVAR_DEFINE( host_sleeptime, "sleeptime", "1", FCVAR_ARCHIVE|FCVAR_FILTERABLE, "milliseconds to sleep for each frame. higher values reduce fps accuracy" );
|
||||||
|
static CVAR_DEFINE_AUTO( host_sleeptime_debug, "0", 0, "print sleeps between frames" );
|
||||||
CVAR_DEFINE( con_gamemaps, "con_mapfilter", "1", FCVAR_ARCHIVE, "when true show only maps in game folder" );
|
CVAR_DEFINE( con_gamemaps, "con_mapfilter", "1", FCVAR_ARCHIVE, "when true show only maps in game folder" );
|
||||||
|
|
||||||
void Sys_PrintUsage( void )
|
void Sys_PrintUsage( void )
|
||||||
@@ -139,7 +140,7 @@ void Sys_PrintUsage( void )
|
|||||||
O("-sdl_joy_old_api ","use SDL legacy joystick API")
|
O("-sdl_joy_old_api ","use SDL legacy joystick API")
|
||||||
O("-sdl_renderer <n>","use alternative SDL_Renderer for software")
|
O("-sdl_renderer <n>","use alternative SDL_Renderer for software")
|
||||||
#endif // XASH_SDL
|
#endif // XASH_SDL
|
||||||
#if XASH_ANDROID
|
#if XASH_ANDROID && !XASH_SDL
|
||||||
O("-nativeegl ","use native egl implementation. Use if screen does not update or black")
|
O("-nativeegl ","use native egl implementation. Use if screen does not update or black")
|
||||||
#endif // XASH_ANDROID
|
#endif // XASH_ANDROID
|
||||||
#if XASH_DOS
|
#if XASH_DOS
|
||||||
@@ -189,22 +190,66 @@ void Host_ShutdownServer( void )
|
|||||||
Host_PrintEngineFeatures
|
Host_PrintEngineFeatures
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Host_PrintEngineFeatures( void )
|
static void Host_PrintEngineFeatures( int features )
|
||||||
{
|
{
|
||||||
if( FBitSet( host.features, ENGINE_WRITE_LARGE_COORD ))
|
struct
|
||||||
Con_Reportf( "^3EXT:^7 big world support enabled\n" );
|
{
|
||||||
|
uint32_t mask;
|
||||||
|
const char *msg;
|
||||||
|
} features_str[] =
|
||||||
|
{
|
||||||
|
{ ENGINE_WRITE_LARGE_COORD, "Big World Support" },
|
||||||
|
{ ENGINE_QUAKE_COMPATIBLE, "Quake Compatibility" },
|
||||||
|
{ ENGINE_LOAD_DELUXEDATA, "Deluxemap Support" },
|
||||||
|
{ ENGINE_PHYSICS_PUSHER_EXT, "Improved MOVETYPE_PUSH" },
|
||||||
|
{ ENGINE_LARGE_LIGHTMAPS, "Large Lightmaps" },
|
||||||
|
{ ENGINE_COMPENSATE_QUAKE_BUG, "Stupid Quake Bug Compensation" },
|
||||||
|
{ ENGINE_IMPROVED_LINETRACE, "Improved Trace Line" },
|
||||||
|
{ ENGINE_COMPUTE_STUDIO_LERP, "Studio MOVETYPE_STEP Lerping" },
|
||||||
|
{ ENGINE_LINEAR_GAMMA_SPACE, "Linear Gamma Space" },
|
||||||
|
{ ENGINE_STEP_POSHISTORY_LERP, "MOVETYPE_STEP Position History Based Lerping" },
|
||||||
|
};
|
||||||
|
int i;
|
||||||
|
|
||||||
if( FBitSet( host.features, ENGINE_LOAD_DELUXEDATA ))
|
for( i = 0; i < ARRAYSIZE( features_str ); i++ )
|
||||||
Con_Reportf( "^3EXT:^7 deluxemap support enabled\n" );
|
{
|
||||||
|
if( FBitSet( features, features_str[i].mask ))
|
||||||
|
Con_Reportf( "^3EXT:^7 %s is enabled\n", features_str[i].msg );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( FBitSet( host.features, ENGINE_PHYSICS_PUSHER_EXT ))
|
/*
|
||||||
Con_Reportf( "^3EXT:^7 Improved MOVETYPE_PUSH is used\n" );
|
==============
|
||||||
|
Host_ValidateEngineFeatures
|
||||||
|
|
||||||
if( FBitSet( host.features, ENGINE_LARGE_LIGHTMAPS ))
|
validate features bits and set host.features
|
||||||
Con_Reportf( "^3EXT:^7 Large lightmaps enabled\n" );
|
==============
|
||||||
|
*/
|
||||||
|
void Host_ValidateEngineFeatures( uint32_t features )
|
||||||
|
{
|
||||||
|
uint32_t mask = ENGINE_FEATURES_MASK;
|
||||||
|
|
||||||
if( FBitSet( host.features, ENGINE_COMPENSATE_QUAKE_BUG ))
|
#if !HOST_DEDICATED
|
||||||
Con_Reportf( "^3EXT:^7 Compensate quake bug enabled\n" );
|
if( !Host_IsDedicated( ) && cls.legacymode )
|
||||||
|
mask = ENGINE_LEGACY_FEATURES_MASK;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// don't allow unsupported bits
|
||||||
|
features &= mask;
|
||||||
|
|
||||||
|
// force bits for some games
|
||||||
|
if( !Q_stricmp( GI->gamefolder, "cstrike" ) || !Q_stricmp( GI->gamefolder, "czero" ))
|
||||||
|
SetBits( features, ENGINE_STEP_POSHISTORY_LERP );
|
||||||
|
|
||||||
|
// print requested first
|
||||||
|
Host_PrintEngineFeatures( features );
|
||||||
|
|
||||||
|
// now warn about incompatible bits
|
||||||
|
if( FBitSet( features, ENGINE_STEP_POSHISTORY_LERP|ENGINE_COMPUTE_STUDIO_LERP ) == ( ENGINE_STEP_POSHISTORY_LERP|ENGINE_COMPUTE_STUDIO_LERP ))
|
||||||
|
Con_Printf( S_WARN "%s: incompatible ENGINE_STEP_POSHISTORY_LERP and ENGINE_COMPUTE_STUDIO_LERP are enabled!\n", __func__ );
|
||||||
|
|
||||||
|
// finally set global variable
|
||||||
|
host.features = features;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -618,6 +663,84 @@ double Host_CalcFPS( void )
|
|||||||
return fps;
|
return fps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static qboolean Host_Autosleep( double dt, double scale )
|
||||||
|
{
|
||||||
|
double targetframetime, fps;
|
||||||
|
int sleep;
|
||||||
|
|
||||||
|
fps = Host_CalcFPS();
|
||||||
|
|
||||||
|
if( fps <= 0 )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// limit fps to withing tolerable range
|
||||||
|
fps = bound( MIN_FPS, fps, MAX_FPS );
|
||||||
|
|
||||||
|
if( Host_IsDedicated( ))
|
||||||
|
targetframetime = ( 1.0 / ( fps + 1.0 ));
|
||||||
|
else targetframetime = ( 1.0 / fps );
|
||||||
|
|
||||||
|
sleep = Host_CalcSleep();
|
||||||
|
if( sleep == 0 ) // no sleeps between frames, much simpler code
|
||||||
|
{
|
||||||
|
if( dt < targetframetime * scale )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static double timewindow; // allocate a time window for sleeps
|
||||||
|
static int counter; // for debug
|
||||||
|
static double realsleeptime;
|
||||||
|
const double sleeptime = sleep * 0.001;
|
||||||
|
|
||||||
|
if( dt < targetframetime * scale )
|
||||||
|
{
|
||||||
|
// if we have allocated time window, try to sleep
|
||||||
|
if( timewindow > realsleeptime )
|
||||||
|
{
|
||||||
|
// Sys_Sleep isn't guaranteed to sleep an exact amount of milliseconds
|
||||||
|
// so we measure the real sleep time and use it to decrease the window
|
||||||
|
double t1 = Sys_DoubleTime(), t2;
|
||||||
|
Sys_Sleep( sleep ); // in msec!
|
||||||
|
t2 = Sys_DoubleTime();
|
||||||
|
realsleeptime = t2 - t1;
|
||||||
|
|
||||||
|
timewindow -= realsleeptime;
|
||||||
|
|
||||||
|
if( host_sleeptime_debug.value )
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
|
||||||
|
Con_NPrintf( counter, "%d: %.4f %.4f", counter, timewindow, realsleeptime );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we exhausted this time window, allocate a new one after new frame
|
||||||
|
if( timewindow <= realsleeptime )
|
||||||
|
{
|
||||||
|
double targetsleeptime = targetframetime - host.pureframetime * 2;
|
||||||
|
|
||||||
|
if( targetsleeptime > 0 )
|
||||||
|
timewindow = targetsleeptime;
|
||||||
|
else timewindow = 0;
|
||||||
|
|
||||||
|
realsleeptime = sleeptime; // reset in case CPU was too busy
|
||||||
|
|
||||||
|
if( host_sleeptime_debug.value )
|
||||||
|
{
|
||||||
|
counter = 0;
|
||||||
|
|
||||||
|
Con_NPrintf( 0, "tgt = %.4f, pft = %.4f, wnd = %.4f", targetframetime, host.pureframetime, timewindow );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===================
|
===================
|
||||||
Host_FilterTime
|
Host_FilterTime
|
||||||
@@ -628,55 +751,15 @@ Returns false if the time is too short to run a frame
|
|||||||
qboolean Host_FilterTime( float time )
|
qboolean Host_FilterTime( float time )
|
||||||
{
|
{
|
||||||
static double oldtime;
|
static double oldtime;
|
||||||
double fps, scale = sys_timescale.value;
|
double dt;
|
||||||
|
double scale = sys_timescale.value;
|
||||||
|
|
||||||
host.realtime += time * scale;
|
host.realtime += time * scale;
|
||||||
fps = Host_CalcFPS();
|
dt = host.realtime - oldtime;
|
||||||
|
|
||||||
// clamp the fps in multiplayer games
|
// clamp the fps in multiplayer games
|
||||||
if( fps != 0.0 )
|
if( !Host_Autosleep( dt, scale ))
|
||||||
{
|
return false;
|
||||||
static int sleeps;
|
|
||||||
double targetframetime;
|
|
||||||
int sleeptime = Host_CalcSleep();
|
|
||||||
|
|
||||||
// limit fps to withing tolerable range
|
|
||||||
fps = bound( MIN_FPS, fps, MAX_FPS );
|
|
||||||
|
|
||||||
if( Host_IsDedicated( ))
|
|
||||||
targetframetime = ( 1.0 / ( fps + 1.0 ));
|
|
||||||
else targetframetime = ( 1.0 / fps );
|
|
||||||
|
|
||||||
if(( host.realtime - oldtime ) < targetframetime * scale )
|
|
||||||
{
|
|
||||||
if( sleeptime > 0 && sleeps > 0 )
|
|
||||||
{
|
|
||||||
Sys_Sleep( sleeptime );
|
|
||||||
sleeps--;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( sleeptime > 0 && sleeps <= 0 )
|
|
||||||
{
|
|
||||||
if( host.status == HOST_FRAME )
|
|
||||||
{
|
|
||||||
// give few sleeps this frame with small margin
|
|
||||||
double targetsleeptime = targetframetime - host.pureframetime * 2;
|
|
||||||
|
|
||||||
// don't sleep if we can't keep up with the framerate
|
|
||||||
if( targetsleeptime > 0 )
|
|
||||||
sleeps = targetsleeptime / ( sleeptime * 0.001 );
|
|
||||||
else sleeps = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// always sleep at least once in minimized/nofocus state
|
|
||||||
sleeps = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
host.frametime = host.realtime - oldtime;
|
host.frametime = host.realtime - oldtime;
|
||||||
host.realframetime = bound( MIN_FRAMETIME, host.frametime, MAX_FRAMETIME );
|
host.realframetime = bound( MIN_FRAMETIME, host.frametime, MAX_FRAMETIME );
|
||||||
@@ -756,7 +839,7 @@ void GAME_EXPORT Host_Error( const char *error, ... )
|
|||||||
Key_SetKeyDest( key_console );
|
Key_SetKeyDest( key_console );
|
||||||
Con_Printf( "Host_Error: %s", hosterror1 );
|
Con_Printf( "Host_Error: %s", hosterror1 );
|
||||||
}
|
}
|
||||||
else MSGBOX2( hosterror1 );
|
else Platform_MessageBox( "Host Error", hosterror1, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
// host is shutting down. don't invoke infinite loop
|
// host is shutting down. don't invoke infinite loop
|
||||||
@@ -1181,6 +1264,7 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
|||||||
Cvar_RegisterVariable( &host_maxfps );
|
Cvar_RegisterVariable( &host_maxfps );
|
||||||
Cvar_RegisterVariable( &host_framerate );
|
Cvar_RegisterVariable( &host_framerate );
|
||||||
Cvar_RegisterVariable( &host_sleeptime );
|
Cvar_RegisterVariable( &host_sleeptime );
|
||||||
|
Cvar_RegisterVariable( &host_sleeptime_debug );
|
||||||
Cvar_RegisterVariable( &host_gameloaded );
|
Cvar_RegisterVariable( &host_gameloaded );
|
||||||
Cvar_RegisterVariable( &host_clientloaded );
|
Cvar_RegisterVariable( &host_clientloaded );
|
||||||
Cvar_RegisterVariable( &host_limitlocal );
|
Cvar_RegisterVariable( &host_limitlocal );
|
||||||
@@ -1297,6 +1381,8 @@ Host_Shutdown
|
|||||||
*/
|
*/
|
||||||
void EXPORT Host_Shutdown( void )
|
void EXPORT Host_Shutdown( void )
|
||||||
{
|
{
|
||||||
|
qboolean error = host.status == HOST_ERR_FATAL;
|
||||||
|
|
||||||
if( host.shutdown_issued ) return;
|
if( host.shutdown_issued ) return;
|
||||||
host.shutdown_issued = true;
|
host.shutdown_issued = true;
|
||||||
|
|
||||||
@@ -1304,7 +1390,7 @@ void EXPORT Host_Shutdown( void )
|
|||||||
if( !host.change_game ) Q_strncpy( host.finalmsg, "Server shutdown", sizeof( host.finalmsg ));
|
if( !host.change_game ) Q_strncpy( host.finalmsg, "Server shutdown", sizeof( host.finalmsg ));
|
||||||
|
|
||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
if( host.type == HOST_NORMAL )
|
if( host.type == HOST_NORMAL && !error )
|
||||||
Host_WriteConfig();
|
Host_WriteConfig();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -87,6 +87,12 @@ static qboolean Image_KTX2Parse( const ktx2_header_t *header, const byte *buffer
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( header->levelCount == 0 )
|
||||||
|
{
|
||||||
|
Con_DPrintf( S_ERROR "%s: file has no mip levels\n", __FUNCTION__ );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if( header->pixelDepth > 1 )
|
if( header->pixelDepth > 1 )
|
||||||
{
|
{
|
||||||
Con_DPrintf( S_ERROR "%s: unsupported KTX2 pixelDepth %d\n", __FUNCTION__, header->pixelDepth );
|
Con_DPrintf( S_ERROR "%s: unsupported KTX2 pixelDepth %d\n", __FUNCTION__, header->pixelDepth );
|
||||||
|
|||||||
@@ -13,17 +13,15 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef SINGLE_BINARY
|
#if XASH_ENABLE_MAIN
|
||||||
|
#if XASH_SDLMAIN
|
||||||
#include "build.h"
|
#include <SDL.h>
|
||||||
#include "common.h"
|
|
||||||
#ifdef XASH_SDLMAIN
|
|
||||||
#include "SDL.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XASH_EMSCRIPTEN
|
#if XASH_EMSCRIPTEN
|
||||||
#include <emscripten.h>
|
#include <emscripten.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include "build.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
#define E_GAME "XASH3D_GAME" // default env dir to start from
|
#define E_GAME "XASH3D_GAME" // default env dir to start from
|
||||||
#ifndef XASH_GAMEDIR
|
#ifndef XASH_GAMEDIR
|
||||||
@@ -47,40 +45,35 @@ static void Sys_ChangeGame( const char *progname )
|
|||||||
exit( Host_Main( szArgc, szArgv, szGameDir, 1, &Sys_ChangeGame ) );
|
exit( Host_Main( szArgc, szArgv, szGameDir, 1, &Sys_ChangeGame ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
_inline int Sys_Start( void )
|
static int Sys_Start( void )
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
const char *game = getenv( E_GAME );
|
const char *game = getenv( E_GAME );
|
||||||
|
|
||||||
if( !game )
|
if( !game )
|
||||||
game = XASH_GAMEDIR;
|
game = XASH_GAMEDIR;
|
||||||
|
|
||||||
Q_strncpy( szGameDir, game, sizeof( szGameDir ));
|
Q_strncpy( szGameDir, game, sizeof( szGameDir ));
|
||||||
|
|
||||||
#if XASH_EMSCRIPTEN
|
#if XASH_EMSCRIPTEN
|
||||||
#ifdef EMSCRIPTEN_LIB_FS
|
#ifdef EMSCRIPTEN_LIB_FS
|
||||||
// For some unknown reason emscripten refusing to load libraries later
|
// For some unknown reason emscripten refusing to load libraries later
|
||||||
COM_LoadLibrary("menu", 0 );
|
COM_LoadLibrary( "menu", 0 );
|
||||||
COM_LoadLibrary("server", 0 );
|
COM_LoadLibrary( "server", 0 );
|
||||||
COM_LoadLibrary("client", 0 );
|
COM_LoadLibrary( "client", 0 );
|
||||||
#endif
|
#endif
|
||||||
#if XASH_DEDICATED
|
#if XASH_DEDICATED
|
||||||
// NodeJS support for debug
|
// NodeJS support for debug
|
||||||
EM_ASM(try{
|
EM_ASM(try {
|
||||||
FS.mkdir('/xash');
|
FS.mkdir( '/xash' );
|
||||||
FS.mount(NODEFS, { root: '.'}, '/xash' );
|
FS.mount( NODEFS, { root: '.'}, '/xash' );
|
||||||
FS.chdir('/xash');
|
FS.chdir( '/xash' );
|
||||||
}catch(e){};);
|
} catch( e ) { };);
|
||||||
#endif
|
#endif
|
||||||
#elif XASH_IOS
|
#elif XASH_IOS
|
||||||
{
|
IOS_LaunchDialog();
|
||||||
void IOS_LaunchDialog( void );
|
|
||||||
IOS_LaunchDialog();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ret = Host_Main( szArgc, szArgv, game, 0, Sys_ChangeGame );
|
return Host_Main( szArgc, szArgv, game, 0, Sys_ChangeGame );
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main( int argc, char **argv )
|
int main( int argc, char **argv )
|
||||||
@@ -94,4 +87,4 @@ int main( int argc, char **argv )
|
|||||||
#endif // XASH_PSVITA
|
#endif // XASH_PSVITA
|
||||||
return Sys_Start();
|
return Sys_Start();
|
||||||
}
|
}
|
||||||
#endif // SINGLE_BINARY
|
#endif // XASH_ENABLE_MAIN
|
||||||
|
|||||||
@@ -980,7 +980,7 @@ Mod_SampleSizeForFace
|
|||||||
return the current lightmap resolution per face
|
return the current lightmap resolution per face
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
int Mod_SampleSizeForFace( msurface_t *surf )
|
int Mod_SampleSizeForFace( const msurface_t *surf )
|
||||||
{
|
{
|
||||||
if( !surf || !surf->texinfo )
|
if( !surf || !surf->texinfo )
|
||||||
return LM_SAMPLE_SIZE;
|
return LM_SAMPLE_SIZE;
|
||||||
@@ -2998,6 +2998,7 @@ static qboolean Mod_LoadBmodelLumps( model_t *mod, const byte *mod_base, qboolea
|
|||||||
|
|
||||||
if( isworld )
|
if( isworld )
|
||||||
{
|
{
|
||||||
|
world.version = bmod->version;
|
||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
Mod_InitDebugHulls( mod ); // FIXME: build hulls for separate bmodels (shells, medkits etc)
|
Mod_InitDebugHulls( mod ); // FIXME: build hulls for separate bmodels (shells, medkits etc)
|
||||||
world.deluxedata = bmod->deluxedata_out; // deluxemap data pointer
|
world.deluxedata = bmod->deluxedata_out; // deluxemap data pointer
|
||||||
|
|||||||
@@ -113,6 +113,8 @@ typedef struct world_static_s
|
|||||||
// tree visualization stuff
|
// tree visualization stuff
|
||||||
int recursion_level;
|
int recursion_level;
|
||||||
int max_recursion;
|
int max_recursion;
|
||||||
|
|
||||||
|
uint32_t version; // BSP version
|
||||||
} world_static_t;
|
} world_static_t;
|
||||||
|
|
||||||
#ifndef REF_DLL
|
#ifndef REF_DLL
|
||||||
@@ -155,7 +157,7 @@ int Mod_CheckLump( const char *filename, const int lump, int *lumpsize );
|
|||||||
int Mod_ReadLump( const char *filename, const int lump, void **lumpdata, int *lumpsize );
|
int Mod_ReadLump( const char *filename, const int lump, void **lumpdata, int *lumpsize );
|
||||||
int Mod_SaveLump( const char *filename, const int lump, void *lumpdata, int lumpsize );
|
int Mod_SaveLump( const char *filename, const int lump, void *lumpdata, int lumpsize );
|
||||||
mleaf_t *Mod_PointInLeaf( const vec3_t p, mnode_t *node );
|
mleaf_t *Mod_PointInLeaf( const vec3_t p, mnode_t *node );
|
||||||
int Mod_SampleSizeForFace( msurface_t *surf );
|
int Mod_SampleSizeForFace( const msurface_t *surf );
|
||||||
byte *Mod_GetPVSForPoint( const vec3_t p );
|
byte *Mod_GetPVSForPoint( const vec3_t p );
|
||||||
void Mod_UnloadBrushModel( model_t *mod );
|
void Mod_UnloadBrushModel( model_t *mod );
|
||||||
void Mod_PrintWorldStats_f( void );
|
void Mod_PrintWorldStats_f( void );
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ void Mod_FreeModel( model_t *mod )
|
|||||||
|
|
||||||
if( mod->type == mod_brush && FBitSet( mod->flags, MODEL_WORLD ) )
|
if( mod->type == mod_brush && FBitSet( mod->flags, MODEL_WORLD ) )
|
||||||
{
|
{
|
||||||
|
world.version = 0;
|
||||||
world.shadowdata = NULL;
|
world.shadowdata = NULL;
|
||||||
world.deluxedata = NULL;
|
world.deluxedata = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1087,7 +1087,6 @@ int Delta_TestBaseline( entity_state_t *from, entity_state_t *to, qboolean playe
|
|||||||
delta_info_t *dt = NULL;
|
delta_info_t *dt = NULL;
|
||||||
delta_t *pField;
|
delta_t *pField;
|
||||||
int i, countBits;
|
int i, countBits;
|
||||||
int numChanges = 0;
|
|
||||||
|
|
||||||
countBits = MAX_ENTITY_BITS + 2;
|
countBits = MAX_ENTITY_BITS + 2;
|
||||||
|
|
||||||
@@ -1121,7 +1120,7 @@ int Delta_TestBaseline( entity_state_t *from, entity_state_t *to, qboolean playe
|
|||||||
|
|
||||||
if( !Delta_CompareField( pField, from, to, timebase ))
|
if( !Delta_CompareField( pField, from, to, timebase ))
|
||||||
{
|
{
|
||||||
// strings are handled difference
|
// strings are handled differently
|
||||||
if( FBitSet( pField->flags, DT_STRING ))
|
if( FBitSet( pField->flags, DT_STRING ))
|
||||||
countBits += Q_strlen((char *)((byte *)to + pField->offset )) * 8;
|
countBits += Q_strlen((char *)((byte *)to + pField->offset )) * 8;
|
||||||
else countBits += pField->bits;
|
else countBits += pField->bits;
|
||||||
|
|||||||
@@ -2200,6 +2200,8 @@ HTTP downloader
|
|||||||
=================================================
|
=================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define MAX_HTTP_BUFFER_SIZE (BIT( 13 ))
|
||||||
|
|
||||||
typedef struct httpserver_s
|
typedef struct httpserver_s
|
||||||
{
|
{
|
||||||
char host[256];
|
char host[256];
|
||||||
@@ -2240,7 +2242,7 @@ typedef struct httpfile_s
|
|||||||
qboolean process;
|
qboolean process;
|
||||||
|
|
||||||
// query or response
|
// query or response
|
||||||
char buf[BUFSIZ+1];
|
char buf[MAX_HTTP_BUFFER_SIZE+1];
|
||||||
int header_size, query_length, bytes_sent;
|
int header_size, query_length, bytes_sent;
|
||||||
} httpfile_t;
|
} httpfile_t;
|
||||||
|
|
||||||
@@ -2385,18 +2387,18 @@ process incoming data
|
|||||||
*/
|
*/
|
||||||
static qboolean HTTP_ProcessStream( httpfile_t *curfile )
|
static qboolean HTTP_ProcessStream( httpfile_t *curfile )
|
||||||
{
|
{
|
||||||
char buf[BUFSIZ+1];
|
char buf[sizeof( curfile->buf )];
|
||||||
char *begin = 0;
|
char *begin = 0;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if( curfile->header_size >= BUFSIZ )
|
if( curfile->header_size >= sizeof( buf ))
|
||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "Header to big\n");
|
Con_Reportf( S_ERROR "Header too big, the size is %s\n", curfile->header_size );
|
||||||
HTTP_FreeFile( curfile, true );
|
HTTP_FreeFile( curfile, true );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
while( ( res = recv( curfile->socket, buf, BUFSIZ - curfile->header_size, 0 )) > 0) // if we got there, we are receiving data
|
while( ( res = recv( curfile->socket, buf, sizeof( buf ) - curfile->header_size, 0 )) > 0) // if we got there, we are receiving data
|
||||||
{
|
{
|
||||||
curfile->blocktime = 0;
|
curfile->blocktime = 0;
|
||||||
|
|
||||||
@@ -2409,7 +2411,7 @@ static qboolean HTTP_ProcessStream( httpfile_t *curfile )
|
|||||||
if( begin ) // Got full header
|
if( begin ) // Got full header
|
||||||
{
|
{
|
||||||
int cutheadersize = begin - curfile->buf + 4; // after that begin of data
|
int cutheadersize = begin - curfile->buf + 4; // after that begin of data
|
||||||
char *length;
|
char *content_length_line;
|
||||||
|
|
||||||
Con_Reportf( "HTTP: Got response!\n" );
|
Con_Reportf( "HTTP: Got response!\n" );
|
||||||
|
|
||||||
@@ -2428,10 +2430,13 @@ static qboolean HTTP_ProcessStream( httpfile_t *curfile )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// print size
|
// print size
|
||||||
length = Q_stristr( curfile->buf, "Content-Length: " );
|
content_length_line = Q_stristr( curfile->buf, "Content-Length: " );
|
||||||
if( length )
|
if( content_length_line )
|
||||||
{
|
{
|
||||||
int size = Q_atoi( length += 16 );
|
int size;
|
||||||
|
|
||||||
|
content_length_line += sizeof( "Content-Length: " ) - 1;
|
||||||
|
size = Q_atoi( content_length_line );
|
||||||
|
|
||||||
Con_Reportf( "HTTP: File size is %d\n", size );
|
Con_Reportf( "HTTP: File size is %d\n", size );
|
||||||
|
|
||||||
@@ -2873,6 +2878,10 @@ static void HTTP_AddCustomServer_f( void )
|
|||||||
{
|
{
|
||||||
HTTP_AddCustomServer( Cmd_Argv( 1 ));
|
HTTP_AddCustomServer( Cmd_Argv( 1 ));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Con_Printf( S_USAGE "http_addcustomserver <url>\n" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -305,6 +305,14 @@ extern const char *clc_strings[clc_lastmsg+1];
|
|||||||
#define MAX_LEGACY_EDICTS (1 << MAX_LEGACY_ENTITY_BITS) // 4096 edicts
|
#define MAX_LEGACY_EDICTS (1 << MAX_LEGACY_ENTITY_BITS) // 4096 edicts
|
||||||
#define MIN_LEGACY_EDICTS 30
|
#define MIN_LEGACY_EDICTS 30
|
||||||
|
|
||||||
|
// legacy engine features that can be implemented through currently supported features
|
||||||
|
#define ENGINE_LEGACY_FEATURES_MASK \
|
||||||
|
( ENGINE_WRITE_LARGE_COORD \
|
||||||
|
| ENGINE_LOAD_DELUXEDATA \
|
||||||
|
| ENGINE_LARGE_LIGHTMAPS \
|
||||||
|
| ENGINE_COMPENSATE_QUAKE_BUG \
|
||||||
|
| ENGINE_COMPUTE_STUDIO_LERP )
|
||||||
|
|
||||||
// Master Server protocol
|
// Master Server protocol
|
||||||
#define MS_SCAN_REQUEST "1\xFF" "0.0.0.0:0\0" // TODO: implement IP filter
|
#define MS_SCAN_REQUEST "1\xFF" "0.0.0.0:0\0" // TODO: implement IP filter
|
||||||
|
|
||||||
|
|||||||
@@ -402,7 +402,7 @@ void Sys_Warn( const char *format, ... )
|
|||||||
Msg( "Sys_Warn: %s\n", text );
|
Msg( "Sys_Warn: %s\n", text );
|
||||||
|
|
||||||
if( !Host_IsDedicated() ) // dedicated server should not hang on messagebox
|
if( !Host_IsDedicated() ) // dedicated server should not hang on messagebox
|
||||||
MSGBOX(text);
|
Platform_MessageBox( "Xash Warning", text, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -446,8 +446,8 @@ void Sys_Error( const char *error, ... )
|
|||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
Wcon_ShowConsole( false );
|
Wcon_ShowConsole( false );
|
||||||
#endif
|
#endif
|
||||||
MSGBOX( text );
|
|
||||||
Sys_Print( text );
|
Sys_Print( text );
|
||||||
|
Platform_MessageBox( "Xash Error", text, false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -562,7 +562,7 @@ void Sys_Print( const char *pMsg )
|
|||||||
|
|
||||||
Sys_PrintLog( pMsg );
|
Sys_PrintLog( pMsg );
|
||||||
|
|
||||||
Rcon_Print( pMsg );
|
Rcon_Print( &host.rd, pMsg );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -30,9 +30,6 @@ extern "C" {
|
|||||||
#include "crtlib.h"
|
#include "crtlib.h"
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
|
|
||||||
#define MSGBOX( x ) Platform_MessageBox( "Xash Error", (x), false )
|
|
||||||
#define MSGBOX2( x ) Platform_MessageBox( "Host Error", (x), true )
|
|
||||||
#define MSGBOX3( x ) Platform_MessageBox( "Host Recursive Error", (x), true )
|
|
||||||
#define ASSERT( exp ) if(!( exp )) Sys_Error( "assert failed at %s:%i\n", __FILE__, __LINE__ )
|
#define ASSERT( exp ) if(!( exp )) Sys_Error( "assert failed at %s:%i\n", __FILE__, __LINE__ )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -632,12 +632,14 @@ int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char* PATH = getenv("PATH");
|
const char* PATH = getenv("PATH");
|
||||||
|
const char* begin;
|
||||||
|
size_t argv0_length;
|
||||||
if (!PATH)
|
if (!PATH)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
size_t argv0_length = strlen(argv[0]);
|
argv0_length = strlen(argv[0]);
|
||||||
|
|
||||||
const char* begin = PATH;
|
begin = PATH;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
const char* separator = strchr(begin, ':');
|
const char* separator = strchr(begin, ':');
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ typedef struct ui_enginefuncs_s
|
|||||||
void *(*pfnKeyGetState)( const char *name ); // for mlook, klook etc
|
void *(*pfnKeyGetState)( const char *name ); // for mlook, klook etc
|
||||||
|
|
||||||
// engine memory manager
|
// engine memory manager
|
||||||
void* (*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );
|
void* (*pfnMemAlloc)( size_t cb, const char *filename, const int fileline ) ALLOC_CHECK( 1 );
|
||||||
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
|
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
|
||||||
|
|
||||||
// collect info from engine
|
// collect info from engine
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ typedef struct server_physics_api_s
|
|||||||
const byte *(*pfnGetTextureData)( unsigned int texnum );
|
const byte *(*pfnGetTextureData)( unsigned int texnum );
|
||||||
|
|
||||||
// static allocations
|
// static allocations
|
||||||
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );
|
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline ) ALLOC_CHECK( 1 );
|
||||||
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
|
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
|
||||||
|
|
||||||
// trace & contents
|
// trace & contents
|
||||||
|
|||||||
@@ -32,10 +32,9 @@ struct jnimethods_s
|
|||||||
JNIEnv *env;
|
JNIEnv *env;
|
||||||
jobject activity;
|
jobject activity;
|
||||||
jclass actcls;
|
jclass actcls;
|
||||||
jmethodID getID;
|
jmethodID loadAndroidID;
|
||||||
jmethodID saveID;
|
jmethodID getAndroidID;
|
||||||
jmethodID loadID;
|
jmethodID saveAndroidID;
|
||||||
jmethodID getKeyboardHeight;
|
|
||||||
} jni;
|
} jni;
|
||||||
|
|
||||||
void Android_Init( void )
|
void Android_Init( void )
|
||||||
@@ -43,10 +42,9 @@ void Android_Init( void )
|
|||||||
jni.env = (JNIEnv *)SDL_AndroidGetJNIEnv();
|
jni.env = (JNIEnv *)SDL_AndroidGetJNIEnv();
|
||||||
jni.activity = (jobject)SDL_AndroidGetActivity();
|
jni.activity = (jobject)SDL_AndroidGetActivity();
|
||||||
jni.actcls = (*jni.env)->GetObjectClass( jni.env, jni.activity );
|
jni.actcls = (*jni.env)->GetObjectClass( jni.env, jni.activity );
|
||||||
jni.loadID = (*jni.env)->GetMethodID( jni.env, jni.actcls, "loadAndroidID", "()Ljava/lang/String;" );
|
jni.loadAndroidID = (*jni.env)->GetMethodID( jni.env, jni.actcls, "loadAndroidID", "()Ljava/lang/String;" );
|
||||||
jni.getID = (*jni.env)->GetMethodID( jni.env, jni.actcls, "getAndroidID", "()Ljava/lang/String;" );
|
jni.getAndroidID = (*jni.env)->GetMethodID( jni.env, jni.actcls, "getAndroidID", "()Ljava/lang/String;" );
|
||||||
jni.saveID = (*jni.env)->GetMethodID( jni.env, jni.actcls, "saveAndroidID", "(Ljava/lang/String;)V" );
|
jni.saveAndroidID = (*jni.env)->GetMethodID( jni.env, jni.actcls, "saveAndroidID", "(Ljava/lang/String;)V" );
|
||||||
jni.getKeyboardHeight = (*jni.env)->GetMethodID( jni.env, jni.actcls, "getKeyboardHeight", "()I" );
|
|
||||||
|
|
||||||
SDL_SetHint( SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight" );
|
SDL_SetHint( SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight" );
|
||||||
SDL_SetHint( SDL_HINT_JOYSTICK_HIDAPI_STEAM, "1" );
|
SDL_SetHint( SDL_HINT_JOYSTICK_HIDAPI_STEAM, "1" );
|
||||||
@@ -95,7 +93,7 @@ const char *Android_GetAndroidID( void )
|
|||||||
|
|
||||||
if( COM_CheckString( id ) ) return id;
|
if( COM_CheckString( id ) ) return id;
|
||||||
|
|
||||||
resultJNIStr = (*jni.env)->CallObjectMethod( jni.env, jni.activity, jni.getID );
|
resultJNIStr = (*jni.env)->CallObjectMethod( jni.env, jni.activity, jni.getAndroidID );
|
||||||
resultCStr = (*jni.env)->GetStringUTFChars( jni.env, resultJNIStr, NULL );
|
resultCStr = (*jni.env)->GetStringUTFChars( jni.env, resultJNIStr, NULL );
|
||||||
Q_strncpy( id, resultCStr, sizeof( id ) );
|
Q_strncpy( id, resultCStr, sizeof( id ) );
|
||||||
(*jni.env)->ReleaseStringUTFChars( jni.env, resultJNIStr, resultCStr );
|
(*jni.env)->ReleaseStringUTFChars( jni.env, resultJNIStr, resultCStr );
|
||||||
@@ -114,7 +112,7 @@ const char *Android_LoadID( void )
|
|||||||
jstring resultJNIStr;
|
jstring resultJNIStr;
|
||||||
const char *resultCStr;
|
const char *resultCStr;
|
||||||
|
|
||||||
resultJNIStr = (*jni.env)->CallObjectMethod( jni.env, jni.activity, jni.loadID );
|
resultJNIStr = (*jni.env)->CallObjectMethod( jni.env, jni.activity, jni.loadAndroidID );
|
||||||
resultCStr = (*jni.env)->GetStringUTFChars( jni.env, resultJNIStr, NULL );
|
resultCStr = (*jni.env)->GetStringUTFChars( jni.env, resultJNIStr, NULL );
|
||||||
Q_strncpy( id, resultCStr, sizeof( id ) );
|
Q_strncpy( id, resultCStr, sizeof( id ) );
|
||||||
(*jni.env)->ReleaseStringUTFChars( jni.env, resultJNIStr, resultCStr );
|
(*jni.env)->ReleaseStringUTFChars( jni.env, resultJNIStr, resultCStr );
|
||||||
@@ -129,7 +127,7 @@ Android_SaveID
|
|||||||
*/
|
*/
|
||||||
void Android_SaveID( const char *id )
|
void Android_SaveID( const char *id )
|
||||||
{
|
{
|
||||||
(*jni.env)->CallVoidMethod( jni.env, jni.activity, jni.saveID, (*jni.env)->NewStringUTF( jni.env, id ) );
|
(*jni.env)->CallVoidMethod( jni.env, jni.activity, jni.saveAndroidID, (*jni.env)->NewStringUTF( jni.env, id ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -144,14 +142,4 @@ void Platform_ShellExecute( const char *path, const char *parms )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
========================
|
|
||||||
Android_GetKeyboardHeight
|
|
||||||
========================
|
|
||||||
*/
|
|
||||||
int Android_GetKeyboardHeight( void )
|
|
||||||
{
|
|
||||||
return (*jni.env)->CallIntMethod( jni.env, jni.activity, jni.getKeyboardHeight );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // XASH_DEDICATED
|
#endif // XASH_DEDICATED
|
||||||
|
|||||||
@@ -13,11 +13,33 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef _GNU_SOURCE
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <ucontext.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <math.h>
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#if defined(__GLIBC__) && (__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).
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
|
||||||
|
static pid_t gettid( void )
|
||||||
|
{
|
||||||
|
return syscall( SYS_gettid );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void *g_hsystemd;
|
static void *g_hsystemd;
|
||||||
static int (*g_pfn_sd_notify)( int unset_environment, const char *state );
|
static int (*g_pfn_sd_notify)( int unset_environment, const char *state );
|
||||||
@@ -103,3 +125,44 @@ void Linux_Shutdown( void )
|
|||||||
g_hsystemd = NULL;
|
g_hsystemd = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Linux_TimerHandler( int sig, siginfo_t *si, void *uc )
|
||||||
|
{
|
||||||
|
timer_t *tidp = si->si_value.sival_ptr;
|
||||||
|
int overrun = timer_getoverrun( *tidp );
|
||||||
|
Con_Printf( "Frame too long (overrun %d)!\n", overrun );
|
||||||
|
}
|
||||||
|
|
||||||
|
#define DEBUG_TIMER_SIGNAL SIGRTMIN
|
||||||
|
|
||||||
|
void Linux_SetTimer( float tm )
|
||||||
|
{
|
||||||
|
static timer_t timerid;
|
||||||
|
|
||||||
|
if( !timerid && tm )
|
||||||
|
{
|
||||||
|
struct sigevent sev = { 0 };
|
||||||
|
struct sigaction sa = { 0 };
|
||||||
|
|
||||||
|
sa.sa_flags = SA_SIGINFO;
|
||||||
|
sa.sa_sigaction = Linux_TimerHandler;
|
||||||
|
sigaction( DEBUG_TIMER_SIGNAL, &sa, NULL );
|
||||||
|
// 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_signo = DEBUG_TIMER_SIGNAL;
|
||||||
|
sev.sigev_value.sival_ptr = &timerid;
|
||||||
|
timer_create( CLOCK_REALTIME, &sev, &timerid );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( timerid )
|
||||||
|
{
|
||||||
|
struct itimerspec its = {0};
|
||||||
|
its.it_value.tv_sec = tm;
|
||||||
|
its.it_value.tv_nsec = 1000000000ULL * fmod( tm, 1.0f );
|
||||||
|
its.it_interval.tv_sec = 0;
|
||||||
|
its.it_interval.tv_nsec = 0;
|
||||||
|
timer_settime( timerid, 0, &its, NULL );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ void Platform_SetStatus( const char *status );
|
|||||||
// legacy iOS port functions
|
// legacy iOS port functions
|
||||||
#if TARGET_OS_IOS
|
#if TARGET_OS_IOS
|
||||||
const char *IOS_GetDocsDir( void );
|
const char *IOS_GetDocsDir( void );
|
||||||
|
void IOS_LaunchDialog( void );
|
||||||
#endif // TARGET_OS_IOS
|
#endif // TARGET_OS_IOS
|
||||||
|
|
||||||
#if XASH_WIN32 || XASH_LINUX
|
#if XASH_WIN32 || XASH_LINUX
|
||||||
@@ -63,7 +64,6 @@ const char *Android_LoadID( void );
|
|||||||
void Android_SaveID( const char *id );
|
void Android_SaveID( const char *id );
|
||||||
void Android_Init( void );
|
void Android_Init( void );
|
||||||
void *Android_GetNativeObject( const char *name );
|
void *Android_GetNativeObject( const char *name );
|
||||||
int Android_GetKeyboardHeight( void );
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
@@ -92,6 +92,7 @@ void DOS_Shutdown( void );
|
|||||||
#if XASH_LINUX
|
#if XASH_LINUX
|
||||||
void Linux_Init( void );
|
void Linux_Init( void );
|
||||||
void Linux_Shutdown( void );
|
void Linux_Shutdown( void );
|
||||||
|
void Linux_SetTimer( float time );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline void Platform_Init( void )
|
static inline void Platform_Init( void )
|
||||||
@@ -182,6 +183,13 @@ void Platform_SetClipboardText( const char *buffer );
|
|||||||
#define SDL_VERSION_ATLEAST( x, y, z ) 0
|
#define SDL_VERSION_ATLEAST( x, y, z ) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void Platform_SetTimer( float time )
|
||||||
|
{
|
||||||
|
#if XASH_LINUX
|
||||||
|
Linux_SetTimer( time );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
|
|||||||
@@ -654,9 +654,9 @@ static void VID_SetWindowIcon( SDL_Window *hWnd )
|
|||||||
{
|
{
|
||||||
rgbdata_t *icon = NULL;
|
rgbdata_t *icon = NULL;
|
||||||
char iconpath[MAX_STRING];
|
char iconpath[MAX_STRING];
|
||||||
|
#if XASH_WIN32 // ICO support only for Win32
|
||||||
const char *localIcoPath;
|
const char *localIcoPath;
|
||||||
|
|
||||||
#if XASH_WIN32 // ICO support only for Win32
|
|
||||||
if(( localIcoPath = FS_GetDiskPath( GI->iconpath, true )))
|
if(( localIcoPath = FS_GetDiskPath( GI->iconpath, true )))
|
||||||
{
|
{
|
||||||
HICON ico = (HICON)LoadImage( NULL, localIcoPath, IMAGE_ICON, 0, 0, LR_LOADFROMFILE|LR_DEFAULTSIZE );
|
HICON ico = (HICON)LoadImage( NULL, localIcoPath, IMAGE_ICON, 0, 0, LR_LOADFROMFILE|LR_DEFAULTSIZE );
|
||||||
|
|||||||
@@ -28,13 +28,21 @@ GNU General Public License for more details.
|
|||||||
#include "r_efx.h"
|
#include "r_efx.h"
|
||||||
#include "com_image.h"
|
#include "com_image.h"
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
|
#include "common/protocol.h"
|
||||||
|
|
||||||
// RefAPI changelog:
|
// RefAPI changelog:
|
||||||
// 1. Initial release
|
// 1. Initial release
|
||||||
// 2. FS functions are removed, instead we have full fs_api_t
|
// 2. FS functions are removed, instead we have full fs_api_t
|
||||||
// 3. SlerpBones, CalcBonePosition/Quaternion calls were moved to libpublic/mathlib
|
// 3. SlerpBones, CalcBonePosition/Quaternion calls were moved to libpublic/mathlib
|
||||||
// 4. R_StudioEstimateFrame now has time argument
|
// 4. R_StudioEstimateFrame now has time argument
|
||||||
#define REF_API_VERSION 4
|
// 5. Removed GetSomethingByIndex calls, renderers are supposed to cache pointer values
|
||||||
|
// Removed previously unused calls
|
||||||
|
// Simplified remapping calls
|
||||||
|
// GetRefAPI is now expected to return REF_API_VERSION
|
||||||
|
// 6. Removed timing from ref_globals_t.
|
||||||
|
// Renderers are supposed to migrate to ref_client_t/ref_host_t using PARM_GET_CLIENT_PTR and PARM_GET_HOST_PTR
|
||||||
|
// Removed functions to get internal engine structions. Use PARM_GET_*_PTR instead.
|
||||||
|
#define REF_API_VERSION 6
|
||||||
|
|
||||||
|
|
||||||
#define TF_SKY (TF_SKYSIDE|TF_NOMIPMAP)
|
#define TF_SKY (TF_SKYSIDE|TF_NOMIPMAP)
|
||||||
@@ -90,11 +98,6 @@ typedef struct ref_globals_s
|
|||||||
{
|
{
|
||||||
qboolean developer;
|
qboolean developer;
|
||||||
|
|
||||||
float time; // cl.time
|
|
||||||
float oldtime; // cl.oldtime
|
|
||||||
double realtime; // host.realtime
|
|
||||||
double frametime; // host.frametime
|
|
||||||
|
|
||||||
// viewport width and height
|
// viewport width and height
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
@@ -116,6 +119,26 @@ typedef struct ref_globals_s
|
|||||||
int desktopBitsPixel;
|
int desktopBitsPixel;
|
||||||
} ref_globals_t;
|
} ref_globals_t;
|
||||||
|
|
||||||
|
typedef struct ref_client_s
|
||||||
|
{
|
||||||
|
double time;
|
||||||
|
double oldtime;
|
||||||
|
int viewentity;
|
||||||
|
int playernum;
|
||||||
|
int maxclients;
|
||||||
|
int nummodels;
|
||||||
|
model_t *models[MAX_MODELS+1];
|
||||||
|
qboolean paused;
|
||||||
|
vec3_t simorg;
|
||||||
|
} ref_client_t;
|
||||||
|
|
||||||
|
typedef struct ref_host_s
|
||||||
|
{
|
||||||
|
double realtime;
|
||||||
|
double frametime;
|
||||||
|
int features;
|
||||||
|
} ref_host_t;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
GL_KEEP_UNIT = -1,
|
GL_KEEP_UNIT = -1,
|
||||||
@@ -247,16 +270,18 @@ typedef enum
|
|||||||
PARM_DEV_OVERVIEW = -1,
|
PARM_DEV_OVERVIEW = -1,
|
||||||
PARM_THIRDPERSON = -2,
|
PARM_THIRDPERSON = -2,
|
||||||
PARM_QUAKE_COMPATIBLE = -3,
|
PARM_QUAKE_COMPATIBLE = -3,
|
||||||
PARM_PLAYER_INDEX = -4, // cl.playernum + 1
|
PARM_GET_CLIENT_PTR = -4, // ref_client_t
|
||||||
PARM_VIEWENT_INDEX = -5, // cl.viewentity
|
PARM_GET_HOST_PTR = -5, // ref_host_t
|
||||||
PARM_CONNSTATE = -6, // cls.state
|
PARM_CONNSTATE = -6, // cls.state
|
||||||
PARM_PLAYING_DEMO = -7, // cls.demoplayback
|
PARM_PLAYING_DEMO = -7, // cls.demoplayback
|
||||||
PARM_WATER_LEVEL = -8, // cl.local.water_level
|
PARM_WATER_LEVEL = -8, // cl.local.water_level
|
||||||
PARM_MAX_CLIENTS = -9, // cl.maxclients
|
PARM_GET_WORLD_PTR = -9, // world
|
||||||
PARM_LOCAL_HEALTH = -10, // cl.local.health
|
PARM_LOCAL_HEALTH = -10, // cl.local.health
|
||||||
PARM_LOCAL_GAME = -11,
|
PARM_LOCAL_GAME = -11,
|
||||||
PARM_NUMENTITIES = -12, // local game only
|
PARM_NUMENTITIES = -12, // local game only
|
||||||
PARM_NUMMODELS = -13, // cl.nummodels
|
PARM_GET_MOVEVARS_PTR = -13, // clgame.movevars
|
||||||
|
PARM_GET_PALETTE_PTR = -14, // clgame.palette
|
||||||
|
PARM_GET_VIEWENT_PTR = -15, // clgame.viewent
|
||||||
} ref_parm_e;
|
} ref_parm_e;
|
||||||
|
|
||||||
typedef struct ref_api_s
|
typedef struct ref_api_s
|
||||||
@@ -299,17 +324,13 @@ typedef struct ref_api_s
|
|||||||
void (*CL_DrawCenterPrint)( void );
|
void (*CL_DrawCenterPrint)( void );
|
||||||
|
|
||||||
// entity management
|
// entity management
|
||||||
struct cl_entity_s *(*GetLocalPlayer)( void );
|
|
||||||
struct cl_entity_s *(*GetViewModel)( void );
|
|
||||||
struct cl_entity_s *(*GetEntityByIndex)( int idx );
|
|
||||||
struct cl_entity_s *(*R_BeamGetEntity)( int index );
|
struct cl_entity_s *(*R_BeamGetEntity)( int index );
|
||||||
struct cl_entity_s *(*CL_GetWaterEntity)( const vec3_t p );
|
struct cl_entity_s *(*CL_GetWaterEntity)( const vec3_t p );
|
||||||
qboolean (*CL_AddVisibleEntity)( cl_entity_t *ent, int entityType );
|
qboolean (*CL_AddVisibleEntity)( cl_entity_t *ent, int entityType );
|
||||||
|
|
||||||
// brushes
|
// brushes
|
||||||
int (*Mod_SampleSizeForFace)( struct msurface_s *surf );
|
int (*Mod_SampleSizeForFace)( const struct msurface_s *surf );
|
||||||
qboolean (*Mod_BoxVisible)( const vec3_t mins, const vec3_t maxs, const byte *visbits );
|
qboolean (*Mod_BoxVisible)( const vec3_t mins, const vec3_t maxs, const byte *visbits );
|
||||||
struct world_static_s *(*GetWorld)( void ); // returns &world
|
|
||||||
mleaf_t *(*Mod_PointInLeaf)( const vec3_t p, mnode_t *node );
|
mleaf_t *(*Mod_PointInLeaf)( const vec3_t p, mnode_t *node );
|
||||||
void (*Mod_CreatePolygonsForHull)( int hullnum );
|
void (*Mod_CreatePolygonsForHull)( int hullnum );
|
||||||
|
|
||||||
@@ -329,13 +350,10 @@ typedef struct ref_api_s
|
|||||||
// model management
|
// model management
|
||||||
model_t *(*Mod_ForName)( const char *name, qboolean crash, qboolean trackCRC );
|
model_t *(*Mod_ForName)( const char *name, qboolean crash, qboolean trackCRC );
|
||||||
void *(*Mod_Extradata)( int type, model_t *model );
|
void *(*Mod_Extradata)( int type, model_t *model );
|
||||||
struct model_s *(*pfnGetModelByIndex)( int index ); // CL_ModelHandle
|
|
||||||
|
|
||||||
// remap
|
// remap
|
||||||
|
qboolean (*CL_EntitySetRemapColors)( cl_entity_t *e, model_t *mod, int top, int bottom );
|
||||||
struct remap_info_s *(*CL_GetRemapInfoForEntity)( cl_entity_t *e );
|
struct remap_info_s *(*CL_GetRemapInfoForEntity)( cl_entity_t *e );
|
||||||
void (*CL_AllocRemapInfo)( cl_entity_t *entity, model_t *model, int topcolor, int bottomcolor );
|
|
||||||
void (*CL_FreeRemapInfo)( struct remap_info_s *info );
|
|
||||||
void (*CL_UpdateRemapInfo)( cl_entity_t *entity, int topcolor, int bottomcolor );
|
|
||||||
|
|
||||||
// utils
|
// utils
|
||||||
void (*CL_ExtraUpdate)( void );
|
void (*CL_ExtraUpdate)( void );
|
||||||
@@ -344,9 +362,6 @@ typedef struct ref_api_s
|
|||||||
float (*COM_RandomFloat)( float rmin, float rmax );
|
float (*COM_RandomFloat)( float rmin, float rmax );
|
||||||
int (*COM_RandomLong)( int rmin, int rmax );
|
int (*COM_RandomLong)( int rmin, int rmax );
|
||||||
struct screenfade_s *(*GetScreenFade)( void );
|
struct screenfade_s *(*GetScreenFade)( void );
|
||||||
struct client_textmessage_s *(*pfnTextMessageGet)( const char *pName );
|
|
||||||
void (*GetPredictedOrigin)( vec3_t v );
|
|
||||||
color24 *(*CL_GetPaletteColor)(int color); // clgame.palette[color]
|
|
||||||
void (*CL_GetScreenInfo)( int *width, int *height ); // clgame.scrInfo, ptrs may be NULL
|
void (*CL_GetScreenInfo)( int *width, int *height ); // clgame.scrInfo, ptrs may be NULL
|
||||||
void (*SetLocalLightLevel)( int level ); // cl.local.light_level
|
void (*SetLocalLightLevel)( int level ); // cl.local.light_level
|
||||||
int (*Sys_CheckParm)( const char *flag );
|
int (*Sys_CheckParm)( const char *flag );
|
||||||
@@ -362,8 +377,8 @@ typedef struct ref_api_s
|
|||||||
// memory
|
// memory
|
||||||
poolhandle_t (*_Mem_AllocPool)( const char *name, const char *filename, int fileline );
|
poolhandle_t (*_Mem_AllocPool)( const char *name, const char *filename, int fileline );
|
||||||
void (*_Mem_FreePool)( poolhandle_t *poolptr, const char *filename, int fileline );
|
void (*_Mem_FreePool)( poolhandle_t *poolptr, const char *filename, int fileline );
|
||||||
void *(*_Mem_Alloc)( poolhandle_t poolptr, size_t size, qboolean clear, const char *filename, int fileline );
|
void *(*_Mem_Alloc)( poolhandle_t poolptr, size_t size, qboolean clear, const char *filename, int fileline ) ALLOC_CHECK( 2 );
|
||||||
void *(*_Mem_Realloc)( poolhandle_t poolptr, void *memptr, size_t size, qboolean clear, const char *filename, int fileline );
|
void *(*_Mem_Realloc)( poolhandle_t poolptr, void *memptr, size_t size, qboolean clear, const char *filename, int fileline ) ALLOC_CHECK( 3 );
|
||||||
void (*_Mem_Free)( void *data, const char *filename, int fileline );
|
void (*_Mem_Free)( void *data, const char *filename, int fileline );
|
||||||
|
|
||||||
// library management
|
// library management
|
||||||
@@ -407,7 +422,6 @@ typedef struct ref_api_s
|
|||||||
struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehull, int ignore_pe );
|
struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehull, int ignore_pe );
|
||||||
struct pmtrace_s *(*EV_VisTraceLine )( float *start, float *end, int flags );
|
struct pmtrace_s *(*EV_VisTraceLine )( float *start, float *end, int flags );
|
||||||
struct pmtrace_s (*CL_TraceLine)( vec3_t start, vec3_t end, int flags );
|
struct pmtrace_s (*CL_TraceLine)( vec3_t start, vec3_t end, int flags );
|
||||||
struct movevars_s *(*pfnGetMoveVars)( void );
|
|
||||||
|
|
||||||
// imagelib
|
// imagelib
|
||||||
void (*Image_AddCmdFlags)( uint flags ); // used to check if hardware dxt is supported
|
void (*Image_AddCmdFlags)( uint flags ); // used to check if hardware dxt is supported
|
||||||
@@ -420,7 +434,6 @@ typedef struct ref_api_s
|
|||||||
rgbdata_t *(*FS_CopyImage)( rgbdata_t *in );
|
rgbdata_t *(*FS_CopyImage)( rgbdata_t *in );
|
||||||
void (*FS_FreeImage)( rgbdata_t *pack );
|
void (*FS_FreeImage)( rgbdata_t *pack );
|
||||||
void (*Image_SetMDLPointer)( byte *p );
|
void (*Image_SetMDLPointer)( byte *p );
|
||||||
poolhandle_t (*Image_GetPool)( void );
|
|
||||||
const struct bpc_desc_s *(*Image_GetPFDesc)( int idx );
|
const struct bpc_desc_s *(*Image_GetPFDesc)( int idx );
|
||||||
|
|
||||||
// client exports
|
// client exports
|
||||||
@@ -449,6 +462,7 @@ typedef struct ref_interface_s
|
|||||||
void (*GL_InitExtensions)( void );
|
void (*GL_InitExtensions)( void );
|
||||||
void (*GL_ClearExtensions)( void );
|
void (*GL_ClearExtensions)( void );
|
||||||
|
|
||||||
|
// scene rendering
|
||||||
void (*R_BeginFrame)( qboolean clearScene );
|
void (*R_BeginFrame)( qboolean clearScene );
|
||||||
void (*R_RenderScene)( void );
|
void (*R_RenderScene)( void );
|
||||||
void (*R_EndFrame)( void );
|
void (*R_EndFrame)( void );
|
||||||
@@ -463,7 +477,8 @@ typedef struct ref_interface_s
|
|||||||
|
|
||||||
qboolean (*R_AddEntity)( struct cl_entity_s *clent, int type );
|
qboolean (*R_AddEntity)( struct cl_entity_s *clent, int type );
|
||||||
void (*CL_AddCustomBeam)( cl_entity_t *pEnvBeam );
|
void (*CL_AddCustomBeam)( cl_entity_t *pEnvBeam );
|
||||||
void (*R_ProcessEntData)( qboolean allocate );
|
void (*R_ProcessEntData)( qboolean allocate, cl_entity_t *entities, unsigned int max_entities );
|
||||||
|
void (*R_Flush)( unsigned int flush_flags );
|
||||||
|
|
||||||
// debug
|
// debug
|
||||||
void (*R_ShowTextures)( void );
|
void (*R_ShowTextures)( void );
|
||||||
|
|||||||
@@ -472,6 +472,8 @@ extern convar_t sv_userinfo_penalty_multiplier;
|
|||||||
extern convar_t sv_userinfo_penalty_attempts;
|
extern convar_t sv_userinfo_penalty_attempts;
|
||||||
extern convar_t sv_fullupdate_penalty_time;
|
extern convar_t sv_fullupdate_penalty_time;
|
||||||
extern convar_t sv_log_outofband;
|
extern convar_t sv_log_outofband;
|
||||||
|
extern convar_t sv_allow_autoaim;
|
||||||
|
extern convar_t sv_aim;
|
||||||
|
|
||||||
//===========================================================
|
//===========================================================
|
||||||
//
|
//
|
||||||
@@ -562,7 +564,7 @@ qboolean SV_IsPlayerIndex( int idx );
|
|||||||
int SV_CalcPing( sv_client_t *cl );
|
int SV_CalcPing( sv_client_t *cl );
|
||||||
void SV_InitClientMove( void );
|
void SV_InitClientMove( void );
|
||||||
void SV_UpdateServerInfo( void );
|
void SV_UpdateServerInfo( void );
|
||||||
void SV_EndRedirect( void );
|
void SV_EndRedirect( host_redirect_t *rd );
|
||||||
void SV_RejectConnection( netadr_t from, const char *fmt, ... ) _format( 2 );
|
void SV_RejectConnection( netadr_t from, const char *fmt, ... ) _format( 2 );
|
||||||
void SV_GetPlayerCount( int *clients, int *bots );
|
void SV_GetPlayerCount( int *clients, int *bots );
|
||||||
|
|
||||||
|
|||||||
@@ -639,7 +639,7 @@ void SV_DropClient( sv_client_t *cl, qboolean crash )
|
|||||||
cl->frames = NULL;
|
cl->frames = NULL;
|
||||||
|
|
||||||
if( NET_CompareBaseAdr( cl->netchan.remote_address, host.rd.address ))
|
if( NET_CompareBaseAdr( cl->netchan.remote_address, host.rd.address ))
|
||||||
SV_EndRedirect();
|
SV_EndRedirect( &host.rd );
|
||||||
|
|
||||||
// throw away any residual garbage in the channel.
|
// throw away any residual garbage in the channel.
|
||||||
Netchan_Clear( &cl->netchan );
|
Netchan_Clear( &cl->netchan );
|
||||||
@@ -676,22 +676,19 @@ SVC COMMAND REDIRECT
|
|||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
*/
|
*/
|
||||||
void SV_BeginRedirect( netadr_t adr, rdtype_t target, char *buffer, size_t buffersize, void (*flush))
|
static void SV_BeginRedirect( host_redirect_t *rd, netadr_t adr, rdtype_t target, char *buffer, size_t buffersize, void (*flush))
|
||||||
{
|
{
|
||||||
if( !target || !buffer || !buffersize || !flush )
|
rd->target = target;
|
||||||
return;
|
rd->buffer = buffer;
|
||||||
|
rd->buffersize = buffersize;
|
||||||
host.rd.target = target;
|
rd->flush = flush;
|
||||||
host.rd.buffer = buffer;
|
rd->address = adr;
|
||||||
host.rd.buffersize = buffersize;
|
rd->buffer[0] = 0;
|
||||||
host.rd.flush = flush;
|
if( rd->lines == 0 )
|
||||||
host.rd.address = adr;
|
rd->lines = -1;
|
||||||
host.rd.buffer[0] = 0;
|
|
||||||
if( host.rd.lines == 0 )
|
|
||||||
host.rd.lines = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SV_FlushRedirect( netadr_t adr, int dest, char *buf )
|
static void SV_FlushRedirect( netadr_t adr, int dest, char *buf )
|
||||||
{
|
{
|
||||||
if( sv.current_client && FBitSet( sv.current_client->flags, FCL_FAKECLIENT ))
|
if( sv.current_client && FBitSet( sv.current_client->flags, FCL_FAKECLIENT ))
|
||||||
return;
|
return;
|
||||||
@@ -712,18 +709,18 @@ void SV_FlushRedirect( netadr_t adr, int dest, char *buf )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SV_EndRedirect( void )
|
void SV_EndRedirect( host_redirect_t *rd )
|
||||||
{
|
{
|
||||||
if( host.rd.lines > 0 )
|
if( rd->lines > 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( host.rd.flush )
|
if( rd->flush )
|
||||||
host.rd.flush( host.rd.address, host.rd.target, host.rd.buffer );
|
rd->flush( rd->address, rd->target, rd->buffer );
|
||||||
|
|
||||||
host.rd.target = 0;
|
rd->target = RD_NONE;
|
||||||
host.rd.buffer = NULL;
|
rd->buffer = NULL;
|
||||||
host.rd.buffersize = 0;
|
rd->buffersize = 0;
|
||||||
host.rd.flush = NULL;
|
rd->flush = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -733,24 +730,26 @@ Rcon_Print
|
|||||||
Print message to rcon buffer and send to rcon redirect target
|
Print message to rcon buffer and send to rcon redirect target
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Rcon_Print( const char *pMsg )
|
void Rcon_Print( host_redirect_t *rd, const char *pMsg )
|
||||||
{
|
{
|
||||||
if( host.rd.target && host.rd.lines && host.rd.flush && host.rd.buffer )
|
size_t len;
|
||||||
|
|
||||||
|
if( !rd->target || !rd->lines || !rd->flush || !rd->buffer )
|
||||||
|
return;
|
||||||
|
|
||||||
|
len = Q_strncat( rd->buffer, pMsg, rd->buffersize );
|
||||||
|
|
||||||
|
if( len && rd->buffer[len - 1] == '\n' )
|
||||||
{
|
{
|
||||||
size_t len = Q_strncat( host.rd.buffer, pMsg, host.rd.buffersize );
|
rd->flush( rd->address, rd->target, rd->buffer );
|
||||||
|
|
||||||
if( len && host.rd.buffer[len-1] == '\n' )
|
if( rd->lines > 0 )
|
||||||
{
|
rd->lines--;
|
||||||
host.rd.flush( host.rd.address, host.rd.target, host.rd.buffer );
|
|
||||||
|
|
||||||
if( host.rd.lines > 0 )
|
rd->buffer[0] = 0;
|
||||||
host.rd.lines--;
|
|
||||||
|
|
||||||
host.rd.buffer[0] = 0;
|
if( !rd->lines )
|
||||||
|
Msg( "End of redirection!\n" );
|
||||||
if( !host.rd.lines )
|
|
||||||
Msg( "End of redirection!\n" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1090,7 +1089,7 @@ void SV_RemoteCommand( netadr_t from, sizebuf_t *msg )
|
|||||||
|
|
||||||
if( Rcon_Validate( ))
|
if( Rcon_Validate( ))
|
||||||
{
|
{
|
||||||
SV_BeginRedirect( from, RD_PACKET, outputbuf, sizeof( outputbuf ) - 16, SV_FlushRedirect );
|
SV_BeginRedirect( &host.rd, from, RD_PACKET, outputbuf, sizeof( outputbuf ) - 16, SV_FlushRedirect );
|
||||||
|
|
||||||
remaining[0] = 0;
|
remaining[0] = 0;
|
||||||
for( i = 2; i < Cmd_Argc(); i++ )
|
for( i = 2; i < Cmd_Argc(); i++ )
|
||||||
@@ -1101,7 +1100,7 @@ void SV_RemoteCommand( netadr_t from, sizebuf_t *msg )
|
|||||||
}
|
}
|
||||||
Cmd_ExecuteString( remaining );
|
Cmd_ExecuteString( remaining );
|
||||||
|
|
||||||
SV_EndRedirect();
|
SV_EndRedirect( &host.rd );
|
||||||
}
|
}
|
||||||
else Con_Printf( S_ERROR "Bad rcon_password.\n" );
|
else Con_Printf( S_ERROR "Bad rcon_password.\n" );
|
||||||
}
|
}
|
||||||
@@ -1772,6 +1771,9 @@ static qboolean SV_ShouldUpdateUserinfo( sv_client_t *cl )
|
|||||||
if( FBitSet( cl->flags, FCL_FAKECLIENT ))
|
if( FBitSet( cl->flags, FCL_FAKECLIENT ))
|
||||||
return allow;
|
return allow;
|
||||||
|
|
||||||
|
if( Host_IsLocalGame( ))
|
||||||
|
return allow;
|
||||||
|
|
||||||
// start from 1 second
|
// start from 1 second
|
||||||
if( !cl->userinfo_penalty )
|
if( !cl->userinfo_penalty )
|
||||||
cl->userinfo_penalty = sv_userinfo_penalty_time.value;
|
cl->userinfo_penalty = sv_userinfo_penalty_time.value;
|
||||||
|
|||||||
@@ -2385,7 +2385,9 @@ static void GAME_EXPORT pfnGetAimVector( edict_t* ent, float speed, float *rgflR
|
|||||||
|
|
||||||
// try all possible entities
|
// try all possible entities
|
||||||
VectorCopy( svgame.globals->v_forward, bestdir );
|
VectorCopy( svgame.globals->v_forward, bestdir );
|
||||||
bestdist = Cvar_VariableValue( "sv_aim" );
|
if( sv_allow_autoaim.value )
|
||||||
|
bestdist = sv_aim.value;
|
||||||
|
else bestdist = 0;
|
||||||
|
|
||||||
check = EDICT_NUM( 1 ); // start at first client
|
check = EDICT_NUM( 1 ); // start at first client
|
||||||
for( i = 1; i < svgame.numEntities; i++, check++ )
|
for( i = 1; i < svgame.numEntities; i++, check++ )
|
||||||
@@ -4523,7 +4525,7 @@ static qboolean GAME_EXPORT pfnVoice_GetClientListening( int iReceiver, int iSen
|
|||||||
iReceiver -= 1;
|
iReceiver -= 1;
|
||||||
iSender -= 1;
|
iSender -= 1;
|
||||||
|
|
||||||
if( iReceiver < 0 || iReceiver >= svs.maxclients || iSender < 0 || iSender > svs.maxclients )
|
if( iReceiver < 0 || iReceiver >= svs.maxclients || iSender < 0 || iSender >= svs.maxclients )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (FBitSet( svs.clients[iSender].listeners, BIT( iReceiver )) != 0 );
|
return (FBitSet( svs.clients[iSender].listeners, BIT( iReceiver )) != 0 );
|
||||||
@@ -4540,7 +4542,7 @@ static qboolean GAME_EXPORT pfnVoice_SetClientListening( int iReceiver, int iSen
|
|||||||
iReceiver -= 1;
|
iReceiver -= 1;
|
||||||
iSender -= 1;
|
iSender -= 1;
|
||||||
|
|
||||||
if( iReceiver < 0 || iReceiver >= svs.maxclients || iSender < 0 || iSender > svs.maxclients )
|
if( iReceiver < 0 || iReceiver >= svs.maxclients || iSender < 0 || iSender >= svs.maxclients )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( bListen ) SetBits( svs.clients[iSender].listeners, BIT( iReceiver ));
|
if( bListen ) SetBits( svs.clients[iSender].listeners, BIT( iReceiver ));
|
||||||
@@ -4965,12 +4967,6 @@ static qboolean SV_ParseEdict( char **pfile, edict_t *ent )
|
|||||||
pkvd[i].szValue = copystring( temp );
|
pkvd[i].szValue = copystring( temp );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if( !Q_strcmp( pkvd[i].szKeyName, "light" ))
|
|
||||||
{
|
|
||||||
Mem_Free( pkvd[i].szKeyName );
|
|
||||||
pkvd[i].szKeyName = copystring( "light_level" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !pkvd[i].fHandled )
|
if( !pkvd[i].fHandled )
|
||||||
{
|
{
|
||||||
pkvd[i].szClassName = classname;
|
pkvd[i].szClassName = classname;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ CVAR_DEFINE_AUTO( sv_lan, "0", 0, "server is a lan server ( no heartbeat, no aut
|
|||||||
CVAR_DEFINE_AUTO( sv_lan_rate, "20000.0", 0, "rate for lan server" );
|
CVAR_DEFINE_AUTO( sv_lan_rate, "20000.0", 0, "rate for lan server" );
|
||||||
CVAR_DEFINE_AUTO( sv_nat, "0", 0, "enable NAT bypass for this server" );
|
CVAR_DEFINE_AUTO( sv_nat, "0", 0, "enable NAT bypass for this server" );
|
||||||
CVAR_DEFINE_AUTO( sv_aim, "1", FCVAR_ARCHIVE|FCVAR_SERVER, "auto aiming option" );
|
CVAR_DEFINE_AUTO( sv_aim, "1", FCVAR_ARCHIVE|FCVAR_SERVER, "auto aiming option" );
|
||||||
|
CVAR_DEFINE_AUTO( sv_allow_autoaim, "0", FCVAR_ARCHIVE|FCVAR_SERVER, "auto aiming option (for HL25 compatibility)" );
|
||||||
CVAR_DEFINE_AUTO( sv_unlag, "1", 0, "allow lag compensation on server-side" );
|
CVAR_DEFINE_AUTO( sv_unlag, "1", 0, "allow lag compensation on server-side" );
|
||||||
CVAR_DEFINE_AUTO( sv_maxunlag, "0.5", 0, "max latency value which can be interpolated (by default ping should not exceed 500 units)" );
|
CVAR_DEFINE_AUTO( sv_maxunlag, "0.5", 0, "max latency value which can be interpolated (by default ping should not exceed 500 units)" );
|
||||||
CVAR_DEFINE_AUTO( sv_unlagpush, "0.0", 0, "interpolation bias for unlag time" );
|
CVAR_DEFINE_AUTO( sv_unlagpush, "0.0", 0, "interpolation bias for unlag time" );
|
||||||
@@ -885,6 +886,7 @@ void SV_Init( void )
|
|||||||
Cvar_RegisterVariable( &sv_fps );
|
Cvar_RegisterVariable( &sv_fps );
|
||||||
Cvar_RegisterVariable( &showtriggers );
|
Cvar_RegisterVariable( &showtriggers );
|
||||||
Cvar_RegisterVariable( &sv_aim );
|
Cvar_RegisterVariable( &sv_aim );
|
||||||
|
Cvar_RegisterVariable( &sv_allow_autoaim );
|
||||||
Cvar_RegisterVariable( &deathmatch );
|
Cvar_RegisterVariable( &deathmatch );
|
||||||
Cvar_RegisterVariable( &coop );
|
Cvar_RegisterVariable( &coop );
|
||||||
Cvar_RegisterVariable( &teamplay );
|
Cvar_RegisterVariable( &teamplay );
|
||||||
@@ -1101,7 +1103,7 @@ void SV_Shutdown( const char *finalmsg )
|
|||||||
Con_Printf( "%s", finalmsg );
|
Con_Printf( "%s", finalmsg );
|
||||||
|
|
||||||
// rcon will be disconnected
|
// rcon will be disconnected
|
||||||
SV_EndRedirect();
|
SV_EndRedirect( &host.rd );
|
||||||
|
|
||||||
if( svs.clients )
|
if( svs.clients )
|
||||||
SV_FinalMessage( finalmsg, false );
|
SV_FinalMessage( finalmsg, false );
|
||||||
|
|||||||
@@ -2139,18 +2139,18 @@ qboolean SV_InitPhysicsAPI( void )
|
|||||||
if( svgame.physFuncs.SV_CheckFeatures != NULL )
|
if( svgame.physFuncs.SV_CheckFeatures != NULL )
|
||||||
{
|
{
|
||||||
// grab common engine features (it will be shared across the network)
|
// grab common engine features (it will be shared across the network)
|
||||||
host.features = svgame.physFuncs.SV_CheckFeatures();
|
Host_ValidateEngineFeatures( svgame.physFuncs.SV_CheckFeatures( ));
|
||||||
Host_PrintEngineFeatures ();
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure what physic functions is cleared
|
// make sure what physic functions is cleared
|
||||||
memset( &svgame.physFuncs, 0, sizeof( svgame.physFuncs ));
|
memset( &svgame.physFuncs, 0, sizeof( svgame.physFuncs ));
|
||||||
|
Host_ValidateEngineFeatures( 0 );
|
||||||
return false; // just tell user about problems
|
return false; // just tell user about problems
|
||||||
}
|
}
|
||||||
|
|
||||||
// physic interface is missed
|
// physic interface is missed
|
||||||
|
Host_ValidateEngineFeatures( 0 );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ static void SV_SourceQuery_Details( netadr_t from )
|
|||||||
{
|
{
|
||||||
sizebuf_t buf;
|
sizebuf_t buf;
|
||||||
char answer[2048];
|
char answer[2048];
|
||||||
int i, bot_count, client_count;
|
int bot_count, client_count;
|
||||||
int is_private = 0;
|
int is_private = 0;
|
||||||
|
|
||||||
SV_GetPlayerCount( &client_count, &bot_count );
|
SV_GetPlayerCount( &client_count, &bot_count );
|
||||||
|
|||||||
@@ -984,7 +984,10 @@ static void ParseSaveTables( SAVERESTOREDATA *pSaveData, SAVE_HEADER *pHeader, i
|
|||||||
InitEntityTable( pSaveData, pSaveData->tableCount );
|
InitEntityTable( pSaveData, pSaveData->tableCount );
|
||||||
|
|
||||||
for( i = 0; i < pSaveData->tableCount; i++ )
|
for( i = 0; i < pSaveData->tableCount; i++ )
|
||||||
|
{
|
||||||
svgame.dllFuncs.pfnSaveReadFields( pSaveData, "ETABLE", &pSaveData->pTable[i], gEntityTable, ARRAYSIZE( gEntityTable ));
|
svgame.dllFuncs.pfnSaveReadFields( pSaveData, "ETABLE", &pSaveData->pTable[i], gEntityTable, ARRAYSIZE( gEntityTable ));
|
||||||
|
pSaveData->pTable[i].pent = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
pSaveData->pBaseData = pSaveData->pCurrentData;
|
pSaveData->pBaseData = pSaveData->pCurrentData;
|
||||||
pSaveData->size = 0;
|
pSaveData->size = 0;
|
||||||
|
|||||||
@@ -1475,7 +1475,6 @@ static qboolean SV_RecursiveLightPoint( model_t *model, mnode_t *node, const vec
|
|||||||
float ds, dt, s, t;
|
float ds, dt, s, t;
|
||||||
int sample_size;
|
int sample_size;
|
||||||
msurface_t *surf;
|
msurface_t *surf;
|
||||||
mtexinfo_t *tex;
|
|
||||||
mextrasurf_t *info;
|
mextrasurf_t *info;
|
||||||
color24 *lm;
|
color24 *lm;
|
||||||
vec3_t mid;
|
vec3_t mid;
|
||||||
@@ -1510,7 +1509,6 @@ static qboolean SV_RecursiveLightPoint( model_t *model, mnode_t *node, const vec
|
|||||||
{
|
{
|
||||||
int smax, tmax;
|
int smax, tmax;
|
||||||
|
|
||||||
tex = surf->texinfo;
|
|
||||||
info = surf->info;
|
info = surf->info;
|
||||||
|
|
||||||
if( FBitSet( surf->flags, SURF_DRAWTILED ))
|
if( FBitSet( surf->flags, SURF_DRAWTILED ))
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ def options(opt):
|
|||||||
def configure(conf):
|
def configure(conf):
|
||||||
# check for dedicated server build
|
# check for dedicated server build
|
||||||
if conf.options.DEDICATED:
|
if conf.options.DEDICATED:
|
||||||
if conf.env.DEST_OS == 'linux':
|
|
||||||
conf.check_cc(lib='rt')
|
|
||||||
conf.define('XASH_DEDICATED', 1)
|
conf.define('XASH_DEDICATED', 1)
|
||||||
elif conf.env.DEST_OS == 'dos':
|
elif conf.env.DEST_OS == 'dos':
|
||||||
conf.options.STATIC = True
|
conf.options.STATIC = True
|
||||||
@@ -49,14 +47,14 @@ def configure(conf):
|
|||||||
# re-enable undefined reference errors
|
# re-enable undefined reference errors
|
||||||
conf.env.CXXFLAGS += ['-Wl,--no-undefined']
|
conf.env.CXXFLAGS += ['-Wl,--no-undefined']
|
||||||
conf.env.CFLAGS += ['-Wl,--no-undefined']
|
conf.env.CFLAGS += ['-Wl,--no-undefined']
|
||||||
# allow the SDL2 sanity check to complete properly by linking in libstdc++ and lm normally
|
# allow the SDL2 sanity check to complete properly by linking in lm normally
|
||||||
conf.env.LDFLAGS += ['-lstdc++', '-lm']
|
conf.env.LDFLAGS += ['-lm']
|
||||||
conf.load('sdl2')
|
conf.load('sdl2')
|
||||||
if not conf.env.HAVE_SDL2:
|
if not conf.env.HAVE_SDL2:
|
||||||
conf.fatal('SDL2 not availiable! Install switch-sdl2!')
|
conf.fatal('SDL2 not availiable! Install switch-sdl2!')
|
||||||
conf.define('XASH_SDL', 2)
|
conf.define('XASH_SDL', 2)
|
||||||
# then remove them to avoid them getting linked to shared objects
|
# then remove them to avoid them getting linked to shared objects
|
||||||
conf.env.LDFLAGS.remove('-lstdc++')
|
conf.env.LIB_SDL2.remove('stdc++') # remove libstdc++ linking from SDL2, we link it later
|
||||||
conf.env.LDFLAGS.remove('-lm')
|
conf.env.LDFLAGS.remove('-lm')
|
||||||
elif conf.env.DEST_OS == 'psvita':
|
elif conf.env.DEST_OS == 'psvita':
|
||||||
# allow the SDL2 sanity check to complete properly by linking in some deps missing from the pkg-config file
|
# allow the SDL2 sanity check to complete properly by linking in some deps missing from the pkg-config file
|
||||||
@@ -73,12 +71,9 @@ def configure(conf):
|
|||||||
# unused, XASH_LINUX without XASH_SDL gives fbdev & alsa support
|
# unused, XASH_LINUX without XASH_SDL gives fbdev & alsa support
|
||||||
# conf.define('XASH_FBDEV', 1)
|
# conf.define('XASH_FBDEV', 1)
|
||||||
conf.check_cc( lib = 'asound' )
|
conf.check_cc( lib = 'asound' )
|
||||||
conf.check_cc( lib = 'rt' )
|
|
||||||
elif conf.options.SDL12:
|
elif conf.options.SDL12:
|
||||||
conf.define('XASH_SDL', 12)
|
conf.define('XASH_SDL', 12)
|
||||||
conf.check_cfg(package='sdl', args='--cflags --libs', uselib_store='SDL2' )
|
conf.check_cfg(package='sdl', args='--cflags --libs', uselib_store='SDL2' )
|
||||||
if conf.env.DEST_OS == 'linux':
|
|
||||||
conf.check_cc( lib='rt' )
|
|
||||||
conf.env.HAVE_SDL2 = True
|
conf.env.HAVE_SDL2 = True
|
||||||
else:
|
else:
|
||||||
conf.load('sdl2')
|
conf.load('sdl2')
|
||||||
@@ -97,6 +92,9 @@ def configure(conf):
|
|||||||
if not conf.env.DEST_OS in ['win32', 'android'] and not conf.options.NO_ASYNC_RESOLVE:
|
if not conf.env.DEST_OS in ['win32', 'android'] and not conf.options.NO_ASYNC_RESOLVE:
|
||||||
conf.check_pthreads()
|
conf.check_pthreads()
|
||||||
|
|
||||||
|
if conf.env.DEST_OS == 'linux':
|
||||||
|
conf.check_cc(lib='rt')
|
||||||
|
|
||||||
if hasattr(conf.options, 'DLLEMU'):
|
if hasattr(conf.options, 'DLLEMU'):
|
||||||
conf.define_cond('XASH_DLL_LOADER', conf.options.DLLEMU)
|
conf.define_cond('XASH_DLL_LOADER', conf.options.DLLEMU)
|
||||||
|
|
||||||
@@ -112,7 +110,7 @@ def configure(conf):
|
|||||||
conf.define_cond('XASH_ENGINE_TESTS', conf.env.ENGINE_TESTS)
|
conf.define_cond('XASH_ENGINE_TESTS', conf.env.ENGINE_TESTS)
|
||||||
conf.define_cond('XASH_STATIC_LIBS', conf.env.STATIC_LINKING)
|
conf.define_cond('XASH_STATIC_LIBS', conf.env.STATIC_LINKING)
|
||||||
conf.define_cond('XASH_CUSTOM_SWAP', conf.options.CUSTOM_SWAP)
|
conf.define_cond('XASH_CUSTOM_SWAP', conf.options.CUSTOM_SWAP)
|
||||||
conf.define_cond('SINGLE_BINARY', conf.env.SINGLE_BINARY)
|
conf.define_cond('XASH_ENABLE_MAIN', conf.env.DISABLE_LAUNCHER)
|
||||||
conf.define_cond('XASH_NO_ASYNC_NS_RESOLVE', conf.options.NO_ASYNC_RESOLVE)
|
conf.define_cond('XASH_NO_ASYNC_NS_RESOLVE', conf.options.NO_ASYNC_RESOLVE)
|
||||||
conf.define_cond('SUPPORT_BSP2_FORMAT', conf.options.SUPPORT_BSP2_FORMAT)
|
conf.define_cond('SUPPORT_BSP2_FORMAT', conf.options.SUPPORT_BSP2_FORMAT)
|
||||||
conf.define_cond('XASH_64BIT', conf.env.DEST_SIZEOF_VOID_P != 4)
|
conf.define_cond('XASH_64BIT', conf.env.DEST_SIZEOF_VOID_P != 4)
|
||||||
@@ -189,7 +187,7 @@ def build(bld):
|
|||||||
# HACK: link in the entirety of libstdc++ so that dynamic libs could use all of it without manual exporting
|
# HACK: link in the entirety of libstdc++ so that dynamic libs could use all of it without manual exporting
|
||||||
# we can't do this right away because std::filesystem will complain about not having pathconf(),
|
# we can't do this right away because std::filesystem will complain about not having pathconf(),
|
||||||
# which we have defined in sys_nswitch.c
|
# which we have defined in sys_nswitch.c
|
||||||
bld.env.LDFLAGS += ['-Wl,--whole-archive', '-lstdc++', '-Wl,--no-whole-archive', '-lm']
|
bld.env.LDFLAGS += ['-v', '-Wl,--whole-archive', '-lstdc++', '-Wl,--no-whole-archive', '-lm']
|
||||||
|
|
||||||
if bld.env.DEST_OS == 'psvita':
|
if bld.env.DEST_OS == 'psvita':
|
||||||
libs += [ 'VRTLD' ]
|
libs += [ 'VRTLD' ]
|
||||||
|
|||||||
@@ -233,6 +233,13 @@ public:
|
|||||||
return FS_FileTime( p, false );
|
return FS_FileTime( p, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long int GetFileModificationTime( const char *path )
|
||||||
|
{
|
||||||
|
// TODO: properly reverse-engineer this
|
||||||
|
FixupPath( p, path );
|
||||||
|
return FS_FileTime( p, false );
|
||||||
|
}
|
||||||
|
|
||||||
void FileTimeToString( char *p, int size, long int time ) override
|
void FileTimeToString( char *p, int size, long int time ) override
|
||||||
{
|
{
|
||||||
const time_t curtime = time;
|
const time_t curtime = time;
|
||||||
|
|||||||
@@ -40,8 +40,7 @@ public:
|
|||||||
virtual ~IBaseInterface() {}
|
virtual ~IBaseInterface() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class IVFileSystem009 : public IBaseInterface
|
class IVFileSystem009 : public IBaseInterface {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
virtual void Mount() = 0; /* linkage=_ZN11IFileSystem5MountEv */
|
virtual void Mount() = 0; /* linkage=_ZN11IFileSystem5MountEv */
|
||||||
|
|
||||||
@@ -148,6 +147,8 @@ public:
|
|||||||
virtual FileHandle_t OpenFromCacheForRead(const char *, const char *, const char *) = 0; /* linkage=_ZN11IFileSystem20OpenFromCacheForReadEPKcS1_S1_ */
|
virtual FileHandle_t OpenFromCacheForRead(const char *, const char *, const char *) = 0; /* linkage=_ZN11IFileSystem20OpenFromCacheForReadEPKcS1_S1_ */
|
||||||
|
|
||||||
virtual void AddSearchPathNoWrite(const char *, const char *) = 0; /* linkage=_ZN11IFileSystem20AddSearchPathNoWriteEPKcS1_ */
|
virtual void AddSearchPathNoWrite(const char *, const char *) = 0; /* linkage=_ZN11IFileSystem20AddSearchPathNoWriteEPKcS1_ */
|
||||||
|
|
||||||
|
virtual long int GetFileModificationTime(const char *) = 0; /* linkage=_ZN11IFileSystem23GetFileModificationTimeEPKc */
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VFILESYSTEM009_H
|
#endif // VFILESYSTEM009_H
|
||||||
|
|||||||
325
filesystem/android.c
Normal file
325
filesystem/android.c
Normal file
@@ -0,0 +1,325 @@
|
|||||||
|
/*
|
||||||
|
android.c - android support for filesystem
|
||||||
|
Copyright (C) 2022 Velaron
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "port.h"
|
||||||
|
|
||||||
|
#if XASH_ANDROID
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include STDINT_H
|
||||||
|
#include "filesystem_internal.h"
|
||||||
|
#include "crtlib.h"
|
||||||
|
#include "xash3d_mathlib.h"
|
||||||
|
#include "common/com_strings.h"
|
||||||
|
|
||||||
|
#include <jni.h>
|
||||||
|
#include <android/asset_manager.h>
|
||||||
|
#include <android/asset_manager_jni.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
struct android_assets_s
|
||||||
|
{
|
||||||
|
string package_name;
|
||||||
|
qboolean engine;
|
||||||
|
AAssetManager *asset_manager;
|
||||||
|
AAssetDir *dir;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct jni_methods_s
|
||||||
|
{
|
||||||
|
JNIEnv *env;
|
||||||
|
jobject activity;
|
||||||
|
jclass activity_class;
|
||||||
|
jmethodID getPackageName;
|
||||||
|
jmethodID getCallingPackage;
|
||||||
|
jmethodID getAssetsList;
|
||||||
|
jmethodID getAssets;
|
||||||
|
} jni;
|
||||||
|
|
||||||
|
static void Android_GetAssetManager( android_assets_t *assets )
|
||||||
|
{
|
||||||
|
jobject assetManager;
|
||||||
|
|
||||||
|
assetManager = (*jni.env)->CallObjectMethod( jni.env, jni.activity, jni.getAssets, assets->engine );
|
||||||
|
|
||||||
|
if( assetManager )
|
||||||
|
assets->asset_manager = AAssetManager_fromJava( jni.env, assetManager );
|
||||||
|
else if( assets->engine )
|
||||||
|
Con_Reportf( S_WARN "Couldn't add engine assets!" );
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *Android_GetPackageName( qboolean engine )
|
||||||
|
{
|
||||||
|
static string pkg;
|
||||||
|
jstring resultJNIStr;
|
||||||
|
const char *resultCStr;
|
||||||
|
|
||||||
|
resultJNIStr = (*jni.env)->CallObjectMethod( jni.env, jni.activity, engine ? jni.getPackageName : jni.getCallingPackage );
|
||||||
|
|
||||||
|
if( !resultJNIStr )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
resultCStr = (*jni.env)->GetStringUTFChars( jni.env, resultJNIStr, NULL );
|
||||||
|
Q_strncpy( pkg, resultCStr, sizeof( pkg ));
|
||||||
|
(*jni.env)->ReleaseStringUTFChars( jni.env, resultJNIStr, resultCStr );
|
||||||
|
|
||||||
|
return pkg;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Android_ListDirectory( stringlist_t *list, const char *path, qboolean engine )
|
||||||
|
{
|
||||||
|
jstring JStr = (*jni.env)->NewStringUTF( jni.env, path );
|
||||||
|
jobjectArray JNIArray = (*jni.env)->CallObjectMethod( jni.env, jni.activity, jni.getAssetsList, engine, JStr );
|
||||||
|
int JNIArraySize = (*jni.env)->GetArrayLength( jni.env, JNIArray );
|
||||||
|
|
||||||
|
for( int i = 0; i < JNIArraySize; i++ )
|
||||||
|
{
|
||||||
|
jstring JNIStr = (*jni.env)->GetObjectArrayElement( jni.env, JNIArray, i );
|
||||||
|
const char *CStr = (*jni.env)->GetStringUTFChars( jni.env, JNIStr, NULL );
|
||||||
|
|
||||||
|
stringlistappend( list, (char *)CStr );
|
||||||
|
(*jni.env)->ReleaseStringUTFChars( jni.env, JNIStr, CStr );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FS_CloseAndroidAssets( android_assets_t *assets )
|
||||||
|
{
|
||||||
|
if( assets->dir )
|
||||||
|
AAssetDir_close( assets->dir );
|
||||||
|
|
||||||
|
Mem_Free( assets );
|
||||||
|
}
|
||||||
|
|
||||||
|
static android_assets_t *FS_LoadAndroidAssets( qboolean engine )
|
||||||
|
{
|
||||||
|
android_assets_t *assets = Mem_Calloc( fs_mempool, sizeof( *assets ));
|
||||||
|
|
||||||
|
assets->engine = engine;
|
||||||
|
|
||||||
|
Android_GetAssetManager( assets );
|
||||||
|
if( !assets->asset_manager )
|
||||||
|
{
|
||||||
|
FS_CloseAndroidAssets( assets );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
assets->dir = AAssetManager_openDir( assets->asset_manager, "" );
|
||||||
|
if( !assets->dir )
|
||||||
|
{
|
||||||
|
FS_CloseAndroidAssets( assets );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return assets;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FS_FileTime_AndroidAssets( searchpath_t *search, const char *filename )
|
||||||
|
{
|
||||||
|
static time_t time;
|
||||||
|
|
||||||
|
if( !time )
|
||||||
|
{
|
||||||
|
struct tm file_tm;
|
||||||
|
|
||||||
|
strptime( __DATE__ " "__TIME__, "%b %d %Y %H:%M:%S", &file_tm );
|
||||||
|
time = mktime( &file_tm );
|
||||||
|
}
|
||||||
|
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FS_FindFile_AndroidAssets( struct searchpath_s *search, const char *path, char *fixedname, size_t len )
|
||||||
|
{
|
||||||
|
AAsset *assets = AAssetManager_open( search->assets->asset_manager, path, AASSET_MODE_UNKNOWN );
|
||||||
|
|
||||||
|
if( assets )
|
||||||
|
{
|
||||||
|
AAsset_close( assets );
|
||||||
|
|
||||||
|
Q_strncpy( fixedname, path, len );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FS_PrintInfo_AndroidAssets( searchpath_t *search, char *dst, size_t size )
|
||||||
|
{
|
||||||
|
Q_snprintf( dst, size, "%s", search->assets->package_name );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FS_Close_AndroidAssets( searchpath_t *search )
|
||||||
|
{
|
||||||
|
FS_CloseAndroidAssets( search->assets );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FS_Search_AndroidAssets( searchpath_t *search, stringlist_t *list, const char *pattern, int caseinsensitive )
|
||||||
|
{
|
||||||
|
string temp;
|
||||||
|
stringlist_t dirlist;
|
||||||
|
const char *slash, *backslash, *colon, *separator;
|
||||||
|
int basepathlength, dirlistindex, resultlistindex;
|
||||||
|
char *basepath;
|
||||||
|
|
||||||
|
slash = Q_strrchr( pattern, '/' );
|
||||||
|
backslash = Q_strrchr( pattern, '\\' );
|
||||||
|
colon = Q_strrchr( pattern, ':' );
|
||||||
|
|
||||||
|
separator = Q_max( slash, backslash );
|
||||||
|
separator = Q_max( separator, colon );
|
||||||
|
|
||||||
|
basepathlength = separator ? (separator + 1 - pattern) : 0;
|
||||||
|
basepath = Mem_Calloc( fs_mempool, basepathlength + 1 );
|
||||||
|
if( basepathlength )
|
||||||
|
memcpy( basepath, pattern, basepathlength );
|
||||||
|
basepath[basepathlength] = '\0';
|
||||||
|
|
||||||
|
stringlistinit( &dirlist );
|
||||||
|
Android_ListDirectory( &dirlist, basepath, search->assets->engine );
|
||||||
|
|
||||||
|
Q_strncpy( temp, basepath, sizeof( temp ));
|
||||||
|
|
||||||
|
for( dirlistindex = 0; dirlistindex < dirlist.numstrings; dirlistindex++ )
|
||||||
|
{
|
||||||
|
Q_strncpy( &temp[basepathlength], dirlist.strings[dirlistindex], sizeof( temp ) - basepathlength );
|
||||||
|
|
||||||
|
if( matchpattern( temp, (char *)pattern, true ))
|
||||||
|
{
|
||||||
|
for( resultlistindex = 0; resultlistindex < list->numstrings; resultlistindex++ )
|
||||||
|
{
|
||||||
|
if( !Q_strcmp( list->strings[resultlistindex], temp ))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( resultlistindex == list->numstrings )
|
||||||
|
stringlistappend( list, temp );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stringlistfreecontents( &dirlist );
|
||||||
|
|
||||||
|
Mem_Free( basepath );
|
||||||
|
}
|
||||||
|
|
||||||
|
static file_t *FS_OpenFile_AndroidAssets( searchpath_t *search, const char *filename, const char *mode, int pack_ind )
|
||||||
|
{
|
||||||
|
file_t *file = Mem_Calloc( fs_mempool, sizeof( *file ));
|
||||||
|
AAsset *assets = AAssetManager_open( search->assets->asset_manager, filename, AASSET_MODE_RANDOM );
|
||||||
|
|
||||||
|
file->handle = AAsset_openFileDescriptor( assets, &file->offset, &file->real_length );
|
||||||
|
|
||||||
|
file->position = 0;
|
||||||
|
file->ungetc = EOF;
|
||||||
|
|
||||||
|
AAsset_close( assets );
|
||||||
|
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
static byte *FS_LoadAndroidAssetsFile( searchpath_t *search, const char *path, int pack_ind, fs_offset_t *filesize )
|
||||||
|
{
|
||||||
|
byte *buf;
|
||||||
|
off_t size;
|
||||||
|
AAsset *asset;
|
||||||
|
|
||||||
|
if( filesize ) *filesize = 0;
|
||||||
|
|
||||||
|
asset = AAssetManager_open( search->assets->asset_manager, path, AASSET_MODE_RANDOM );
|
||||||
|
if( !asset )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
size = AAsset_getLength( asset );
|
||||||
|
|
||||||
|
buf = (byte *)Mem_Malloc( fs_mempool, size + 1 );
|
||||||
|
buf[size] = '\0';
|
||||||
|
|
||||||
|
if( AAsset_read( asset, buf, size ) < 0 )
|
||||||
|
{
|
||||||
|
Mem_Free( buf );
|
||||||
|
AAsset_close( asset );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
AAsset_close( asset );
|
||||||
|
|
||||||
|
if( filesize ) *filesize = size;
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
searchpath_t *FS_AddAndroidAssets_Fullpath( const char *path, int flags )
|
||||||
|
{
|
||||||
|
searchpath_t *search;
|
||||||
|
android_assets_t *assets = NULL;
|
||||||
|
qboolean engine = true;
|
||||||
|
|
||||||
|
if( FBitSet( flags, FS_STATIC_PATH | FS_CUSTOM_PATH ))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if( FBitSet( flags, FS_GAMEDIR_PATH ) && Q_stricmp( GI->basedir, GI->gamefolder ))
|
||||||
|
engine = false;
|
||||||
|
|
||||||
|
assets = FS_LoadAndroidAssets( engine );
|
||||||
|
|
||||||
|
if( !assets )
|
||||||
|
{
|
||||||
|
Con_Reportf( S_ERROR "%s: unable to load Android assets \"%s\"\n", __FUNCTION__, Android_GetPackageName( engine ));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_strncpy( assets->package_name, Android_GetPackageName( engine ), sizeof( assets->package_name ));
|
||||||
|
|
||||||
|
search = Mem_Calloc( fs_mempool, sizeof( *search ));
|
||||||
|
|
||||||
|
Q_strncpy( search->filename, assets->package_name, sizeof( search->filename ));
|
||||||
|
search->assets = assets;
|
||||||
|
search->type = SEARCHPATH_ANDROID_ASSETS;
|
||||||
|
SetBits( search->flags, FS_NOWRITE_PATH | FS_CUSTOM_PATH );
|
||||||
|
|
||||||
|
search->pfnPrintInfo = FS_PrintInfo_AndroidAssets;
|
||||||
|
search->pfnClose = FS_Close_AndroidAssets;
|
||||||
|
search->pfnOpenFile = FS_OpenFile_AndroidAssets;
|
||||||
|
search->pfnFileTime = FS_FileTime_AndroidAssets;
|
||||||
|
search->pfnFindFile = FS_FindFile_AndroidAssets;
|
||||||
|
search->pfnSearch = FS_Search_AndroidAssets;
|
||||||
|
search->pfnLoadFile = FS_LoadAndroidAssetsFile;
|
||||||
|
|
||||||
|
Con_Reportf( "Adding Android assets: %s\n", assets->package_name );
|
||||||
|
|
||||||
|
return search;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FS_InitAndroid( void )
|
||||||
|
{
|
||||||
|
jmethodID getContext;
|
||||||
|
|
||||||
|
jni.env = (JNIEnv *)Sys_GetNativeObject( "JNIEnv" );
|
||||||
|
jni.activity_class = Sys_GetNativeObject( "ActivityClass" );
|
||||||
|
|
||||||
|
getContext = (*jni.env)->GetStaticMethodID( jni.env, jni.activity_class, "getContext", "()Landroid/content/Context;" );
|
||||||
|
jni.activity = (*jni.env)->CallStaticObjectMethod( jni.env, jni.activity_class, getContext );
|
||||||
|
|
||||||
|
jni.getPackageName = (*jni.env)->GetMethodID( jni.env, jni.activity_class, "getPackageName", "()Ljava/lang/String;" );
|
||||||
|
jni.getCallingPackage = (*jni.env)->GetMethodID( jni.env, jni.activity_class, "getCallingPackage", "()Ljava/lang/String;" );
|
||||||
|
jni.getAssetsList = (*jni.env)->GetMethodID( jni.env, jni.activity_class, "getAssetsList", "(ZLjava/lang/String;)[Ljava/lang/String;" );
|
||||||
|
jni.getAssets = (*jni.env)->GetMethodID( jni.env, jni.activity_class, "getAssets", "(Z)Landroid/content/res/AssetManager;" );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // XASH_ANDROID
|
||||||
@@ -449,7 +449,6 @@ static void FS_Search_DIR( searchpath_t *search, stringlist_t *list, const char
|
|||||||
|
|
||||||
static int FS_FileTime_DIR( searchpath_t *search, const char *filename )
|
static int FS_FileTime_DIR( searchpath_t *search, const char *filename )
|
||||||
{
|
{
|
||||||
int time;
|
|
||||||
char path[MAX_SYSPATH];
|
char path[MAX_SYSPATH];
|
||||||
|
|
||||||
Q_snprintf( path, sizeof( path ), "%s%s", search->filename, filename );
|
Q_snprintf( path, sizeof( path ), "%s%s", search->filename, filename );
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ GNU General Public License for more details.
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "port.h"
|
#include "port.h"
|
||||||
|
#include "defaults.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "crtlib.h"
|
#include "crtlib.h"
|
||||||
#include "crclib.h"
|
#include "crclib.h"
|
||||||
@@ -71,8 +72,10 @@ const fs_archive_t g_archives[] =
|
|||||||
static const fs_archive_t g_directory_archive =
|
static const fs_archive_t g_directory_archive =
|
||||||
{ NULL, SEARCHPATH_PLAIN, FS_AddDir_Fullpath, false };
|
{ NULL, SEARCHPATH_PLAIN, FS_AddDir_Fullpath, false };
|
||||||
|
|
||||||
// static const fs_archive_t g_android_archive =
|
#ifdef XASH_ANDROID
|
||||||
// { NULL, SEARCHPATH_ANDROID, FS_AddAndroid_Fullpath, false, false };
|
static const fs_archive_t g_android_archive =
|
||||||
|
{ NULL, SEARCHPATH_ANDROID_ASSETS, FS_AddAndroidAssets_Fullpath, false };
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef XASH_REDUCE_FD
|
#ifdef XASH_REDUCE_FD
|
||||||
static file_t *fs_last_readfile;
|
static file_t *fs_last_readfile;
|
||||||
@@ -154,7 +157,7 @@ void stringlistfreecontents( stringlist_t *list )
|
|||||||
list->strings = NULL;
|
list->strings = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void stringlistappend( stringlist_t *list, char *text )
|
void stringlistappend( stringlist_t *list, const char *text )
|
||||||
{
|
{
|
||||||
size_t textlen;
|
size_t textlen;
|
||||||
|
|
||||||
@@ -403,6 +406,10 @@ void FS_AddGameDirectory( const char *dir, uint flags )
|
|||||||
|
|
||||||
stringlistfreecontents( &list );
|
stringlistfreecontents( &list );
|
||||||
|
|
||||||
|
#ifdef XASH_ANDROID
|
||||||
|
FS_AddArchive_Fullpath( &g_android_archive, dir, flags );
|
||||||
|
#endif
|
||||||
|
|
||||||
// add the directory to the search path
|
// add the directory to the search path
|
||||||
// (unpacked files have the priority over packed files)
|
// (unpacked files have the priority over packed files)
|
||||||
search = FS_AddArchive_Fullpath( &g_directory_archive, dir, flags );
|
search = FS_AddArchive_Fullpath( &g_directory_archive, dir, flags );
|
||||||
@@ -596,7 +603,7 @@ static void FS_WriteGameInfo( const char *filepath, gameinfo_t *GameInfo )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( GameInfo->noskills )
|
if( GameInfo->noskills )
|
||||||
FS_Printf( f, "noskills\t\t\"%i\"\n", GameInfo->nomodels );
|
FS_Printf( f, "noskills\t\t\"%i\"\n", GameInfo->noskills );
|
||||||
|
|
||||||
#define SAVE_AGED_COUNT 2 // the default count of quick and auto saves
|
#define SAVE_AGED_COUNT 2 // the default count of quick and auto saves
|
||||||
if( GameInfo->quicksave_aged_count != SAVE_AGED_COUNT )
|
if( GameInfo->quicksave_aged_count != SAVE_AGED_COUNT )
|
||||||
@@ -606,6 +613,13 @@ static void FS_WriteGameInfo( const char *filepath, gameinfo_t *GameInfo )
|
|||||||
FS_Printf( f, "autosave_aged_count\t\t%d\n", GameInfo->autosave_aged_count );
|
FS_Printf( f, "autosave_aged_count\t\t%d\n", GameInfo->autosave_aged_count );
|
||||||
#undef SAVE_AGED_COUNT
|
#undef SAVE_AGED_COUNT
|
||||||
|
|
||||||
|
// HL25 compatibility
|
||||||
|
if( GameInfo->animated_title )
|
||||||
|
FS_Printf( f, "animated_title\t\t%i\n", GameInfo->animated_title );
|
||||||
|
|
||||||
|
if( GameInfo->hd_background )
|
||||||
|
FS_Printf( f, "hd_background\t\t%i\n", GameInfo->hd_background );
|
||||||
|
|
||||||
// always expose our extensions :)
|
// always expose our extensions :)
|
||||||
FS_Printf( f, "internal_vgui_support\t\t%s\n", GameInfo->internal_vgui_support ? "1" : "0" );
|
FS_Printf( f, "internal_vgui_support\t\t%s\n", GameInfo->internal_vgui_support ? "1" : "0" );
|
||||||
FS_Printf( f, "render_picbutton_text\t\t%s\n", GameInfo->render_picbutton_text ? "1" : "0" );
|
FS_Printf( f, "render_picbutton_text\t\t%s\n", GameInfo->render_picbutton_text ? "1" : "0" );
|
||||||
@@ -638,7 +652,7 @@ void FS_InitGameInfo( gameinfo_t *GameInfo, const char *gamedir )
|
|||||||
Q_strncpy( GameInfo->sp_entity, "info_player_start", sizeof( GameInfo->sp_entity ));
|
Q_strncpy( GameInfo->sp_entity, "info_player_start", sizeof( GameInfo->sp_entity ));
|
||||||
Q_strncpy( GameInfo->mp_entity, "info_player_deathmatch", sizeof( GameInfo->mp_entity ));
|
Q_strncpy( GameInfo->mp_entity, "info_player_deathmatch", sizeof( GameInfo->mp_entity ));
|
||||||
|
|
||||||
GameInfo->max_edicts = 900; // default value if not specified
|
GameInfo->max_edicts = DEFAULT_MAX_EDICTS; // default value if not specified
|
||||||
GameInfo->max_tents = 500;
|
GameInfo->max_tents = 500;
|
||||||
GameInfo->max_beams = 128;
|
GameInfo->max_beams = 128;
|
||||||
GameInfo->max_particles = 4096;
|
GameInfo->max_particles = 4096;
|
||||||
@@ -783,6 +797,17 @@ void FS_ParseGenericGameInfo( gameinfo_t *GameInfo, const char *buf, const qbool
|
|||||||
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
GameInfo->max_edicts = bound( MIN_EDICTS, Q_atoi( token ), MAX_EDICTS );
|
GameInfo->max_edicts = bound( MIN_EDICTS, Q_atoi( token ), MAX_EDICTS );
|
||||||
}
|
}
|
||||||
|
// valid for both
|
||||||
|
else if( !Q_stricmp( token, "hd_background" ))
|
||||||
|
{
|
||||||
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
|
GameInfo->hd_background = Q_atoi( token ) ? true : false;
|
||||||
|
}
|
||||||
|
else if( !Q_stricmp( token, "animated_title" ))
|
||||||
|
{
|
||||||
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
|
GameInfo->animated_title = Q_atoi( token ) ? true : false;
|
||||||
|
}
|
||||||
// only for gameinfo
|
// only for gameinfo
|
||||||
else if( isGameInfo )
|
else if( isGameInfo )
|
||||||
{
|
{
|
||||||
@@ -1053,29 +1078,39 @@ static qboolean FS_ParseGameInfo( const char *gamedir, gameinfo_t *GameInfo )
|
|||||||
roGameInfoTime = FS_SysFileTime( gameinfo_ro );
|
roGameInfoTime = FS_SysFileTime( gameinfo_ro );
|
||||||
rwGameInfoTime = FS_SysFileTime( gameinfo_path );
|
rwGameInfoTime = FS_SysFileTime( gameinfo_path );
|
||||||
|
|
||||||
|
// if rodir's liblist.gam newer than rwdir's gameinfo.txt, then convert it
|
||||||
if( roLibListTime > rwGameInfoTime )
|
if( roLibListTime > rwGameInfoTime )
|
||||||
{
|
{
|
||||||
haveUpdate = FS_ConvertGameInfo( gamedir, gameinfo_path, liblist_ro );
|
haveUpdate = FS_ConvertGameInfo( gamedir, gameinfo_path, liblist_ro );
|
||||||
}
|
}
|
||||||
|
// if rodir's gameinfo.txt newer than rwdir's gameinfo.txt, just copy the file
|
||||||
else if( roGameInfoTime > rwGameInfoTime )
|
else if( roGameInfoTime > rwGameInfoTime )
|
||||||
{
|
{
|
||||||
fs_offset_t len;
|
file_t *ro, *rw;
|
||||||
char *afile_ro = (char *)FS_LoadDirectFile( gameinfo_ro, &len );
|
fs_offset_t ro_size;
|
||||||
|
|
||||||
if( afile_ro )
|
// read & write as binary to copy the exact file
|
||||||
{
|
ro = FS_SysOpen( gameinfo_ro, "rb" );
|
||||||
Con_DPrintf( "Copy rodir %s to rwdir %s\n", gameinfo_ro, gameinfo_path );
|
rw = FS_SysOpen( gameinfo_path, "wb" );
|
||||||
haveUpdate = true;
|
|
||||||
FS_WriteFile( gameinfo_path, afile_ro, len );
|
FS_Seek( ro, 0, SEEK_END );
|
||||||
Mem_Free( afile_ro );
|
ro_size = FS_Tell( ro );
|
||||||
}
|
FS_Seek( ro, 0, SEEK_SET );
|
||||||
|
|
||||||
|
FS_FileCopy( rw, ro, ro_size );
|
||||||
|
|
||||||
|
FS_Close( rw );
|
||||||
|
FS_Close( ro );
|
||||||
|
|
||||||
|
haveUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FS_AllowDirectPaths( false );
|
FS_AllowDirectPaths( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// do not update gameinfo.txt, if it was just copied from rodir's
|
||||||
// if user change liblist.gam update the gameinfo.txt
|
// if user change liblist.gam update the gameinfo.txt
|
||||||
if( FS_FileTime( liblist_path, false ) > FS_FileTime( gameinfo_path, false ))
|
if( !haveUpdate && FS_FileTime( liblist_path, false ) > FS_FileTime( gameinfo_path, false ))
|
||||||
FS_ConvertGameInfo( gamedir, gameinfo_path, liblist_path );
|
FS_ConvertGameInfo( gamedir, gameinfo_path, liblist_path );
|
||||||
|
|
||||||
// force to create gameinfo for specified game if missing
|
// force to create gameinfo for specified game if missing
|
||||||
@@ -1252,6 +1287,26 @@ static qboolean FS_CheckForCrypt( const char *dllname )
|
|||||||
return ( key == 0x12345678 ) ? true : false;
|
return ( key == 0x12345678 ) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int FS_StripIdiotRelativePath( const char *dllname, const char *gamefolder )
|
||||||
|
{
|
||||||
|
string idiot_relpath;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
if(( len = Q_snprintf( idiot_relpath, sizeof( idiot_relpath ), "../%s/", gamefolder )) >= 4 )
|
||||||
|
{
|
||||||
|
if( !Q_strnicmp( dllname, idiot_relpath, len ))
|
||||||
|
return len;
|
||||||
|
|
||||||
|
// try backslashes
|
||||||
|
idiot_relpath[1] = '\\';
|
||||||
|
idiot_relpath[len - 1] = '\\';
|
||||||
|
if( !Q_strnicmp( dllname, idiot_relpath, len ))
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==================
|
==================
|
||||||
FS_FindLibrary
|
FS_FindLibrary
|
||||||
@@ -1271,9 +1326,16 @@ static qboolean FS_FindLibrary( const char *dllname, qboolean directpath, fs_dll
|
|||||||
|
|
||||||
fs_ext_path = directpath;
|
fs_ext_path = directpath;
|
||||||
|
|
||||||
// HACKHACK remove absoulte path to valve folder
|
// HACKHACK remove relative path to game folder
|
||||||
if( !Q_strnicmp( dllname, "..\\valve\\", 9 ) || !Q_strnicmp( dllname, "../valve/", 9 ))
|
if( !Q_strnicmp( dllname, "..", 2 ))
|
||||||
start += 9;
|
{
|
||||||
|
// some modders put relative path to themselves???
|
||||||
|
len = FS_StripIdiotRelativePath( dllname, GI->gamefolder );
|
||||||
|
|
||||||
|
if( len == 0 ) // or put relative path to Half-Life game libs
|
||||||
|
len = FS_StripIdiotRelativePath( dllname, "valve" );
|
||||||
|
start += len;
|
||||||
|
}
|
||||||
|
|
||||||
// replace all backward slashes
|
// replace all backward slashes
|
||||||
len = Q_strlen( dllname );
|
len = Q_strlen( dllname );
|
||||||
@@ -1406,6 +1468,10 @@ qboolean FS_InitStdio( qboolean unused_set_to_true, const char *rootdir, const c
|
|||||||
|
|
||||||
FS_InitMemory();
|
FS_InitMemory();
|
||||||
|
|
||||||
|
#ifdef XASH_ANDROID
|
||||||
|
FS_InitAndroid();
|
||||||
|
#endif
|
||||||
|
|
||||||
Q_strncpy( fs_rootdir, rootdir, sizeof( fs_rootdir ));
|
Q_strncpy( fs_rootdir, rootdir, sizeof( fs_rootdir ));
|
||||||
Q_strncpy( fs_gamedir, gamedir, sizeof( fs_gamedir ));
|
Q_strncpy( fs_gamedir, gamedir, sizeof( fs_gamedir ));
|
||||||
Q_strncpy( fs_basedir, basedir, sizeof( fs_basedir ));
|
Q_strncpy( fs_basedir, basedir, sizeof( fs_basedir ));
|
||||||
@@ -1638,6 +1704,9 @@ file_t *FS_SysOpen( const char *filepath, const char *mode )
|
|||||||
|
|
||||||
if( file->handle < 0 )
|
if( file->handle < 0 )
|
||||||
{
|
{
|
||||||
|
if( errno != ENOENT )
|
||||||
|
Con_Printf( S_ERROR "%s: can't open file %s: %s\n", __func__, filepath, strerror( errno ));
|
||||||
|
|
||||||
Mem_Free( file );
|
Mem_Free( file );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,10 @@ typedef struct gameinfo_s
|
|||||||
|
|
||||||
int quicksave_aged_count; // min is 1, max is 99
|
int quicksave_aged_count; // min is 1, max is 99
|
||||||
int autosave_aged_count; // min is 1, max is 99
|
int autosave_aged_count; // min is 1, max is 99
|
||||||
|
|
||||||
|
// HL25 compatibility keys
|
||||||
|
qboolean hd_background;
|
||||||
|
qboolean animated_title;
|
||||||
} gameinfo_t;
|
} gameinfo_t;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
@@ -206,8 +210,8 @@ typedef struct fs_interface_t
|
|||||||
// memory
|
// memory
|
||||||
poolhandle_t (*_Mem_AllocPool)( const char *name, const char *filename, int fileline );
|
poolhandle_t (*_Mem_AllocPool)( const char *name, const char *filename, int fileline );
|
||||||
void (*_Mem_FreePool)( poolhandle_t *poolptr, const char *filename, int fileline );
|
void (*_Mem_FreePool)( poolhandle_t *poolptr, const char *filename, int fileline );
|
||||||
void *(*_Mem_Alloc)( poolhandle_t poolptr, size_t size, qboolean clear, const char *filename, int fileline );
|
void *(*_Mem_Alloc)( poolhandle_t poolptr, size_t size, qboolean clear, const char *filename, int fileline ) ALLOC_CHECK( 2 );
|
||||||
void *(*_Mem_Realloc)( poolhandle_t poolptr, void *memptr, size_t size, qboolean clear, const char *filename, int fileline );
|
void *(*_Mem_Realloc)( poolhandle_t poolptr, void *memptr, size_t size, qboolean clear, const char *filename, int fileline ) ALLOC_CHECK( 3 );
|
||||||
void (*_Mem_Free)( void *data, const char *filename, int fileline );
|
void (*_Mem_Free)( void *data, const char *filename, int fileline );
|
||||||
|
|
||||||
// platform
|
// platform
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ GNU General Public License for more details.
|
|||||||
#include "xash3d_types.h"
|
#include "xash3d_types.h"
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
|
|
||||||
|
#if XASH_ANDROID
|
||||||
|
#include <android/asset_manager.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
@@ -31,6 +35,10 @@ typedef struct dir_s dir_t;
|
|||||||
typedef struct zip_s zip_t;
|
typedef struct zip_s zip_t;
|
||||||
typedef struct pack_s pack_t;
|
typedef struct pack_s pack_t;
|
||||||
typedef struct wfile_s wfile_t;
|
typedef struct wfile_s wfile_t;
|
||||||
|
#if XASH_ANDROID
|
||||||
|
typedef struct android_assets_s android_assets_t;
|
||||||
|
// typedef struct android_saf_s android_saf_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define FILE_BUFF_SIZE (2048)
|
#define FILE_BUFF_SIZE (2048)
|
||||||
|
|
||||||
@@ -58,7 +66,8 @@ enum
|
|||||||
SEARCHPATH_PAK,
|
SEARCHPATH_PAK,
|
||||||
SEARCHPATH_WAD,
|
SEARCHPATH_WAD,
|
||||||
SEARCHPATH_ZIP,
|
SEARCHPATH_ZIP,
|
||||||
SEARCHPATH_PK3DIR, // it's actually a plain directory but it must behave like a ZIP archive
|
SEARCHPATH_PK3DIR, // it's actually a plain directory but it must behave like a ZIP archive,
|
||||||
|
SEARCHPATH_ANDROID_ASSETS
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct stringlist_s
|
typedef struct stringlist_s
|
||||||
@@ -81,6 +90,9 @@ typedef struct searchpath_s
|
|||||||
pack_t *pack;
|
pack_t *pack;
|
||||||
wfile_t *wad;
|
wfile_t *wad;
|
||||||
zip_t *zip;
|
zip_t *zip;
|
||||||
|
#if XASH_ANDROID
|
||||||
|
android_assets_t *assets;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct searchpath_s *next;
|
struct searchpath_s *next;
|
||||||
@@ -179,7 +191,7 @@ qboolean MD5_HashFile( byte digest[16], const char *pszFileName, uint seed[4] );
|
|||||||
// stringlist ops
|
// stringlist ops
|
||||||
void stringlistinit( stringlist_t *list );
|
void stringlistinit( stringlist_t *list );
|
||||||
void stringlistfreecontents( stringlist_t *list );
|
void stringlistfreecontents( stringlist_t *list );
|
||||||
void stringlistappend( stringlist_t *list, char *text );
|
void stringlistappend( stringlist_t *list, const char *text );
|
||||||
void stringlistsort( stringlist_t *list );
|
void stringlistsort( stringlist_t *list );
|
||||||
void listdirectory( stringlist_t *list, const char *path );
|
void listdirectory( stringlist_t *list, const char *path );
|
||||||
|
|
||||||
@@ -225,6 +237,12 @@ searchpath_t *FS_AddDir_Fullpath( const char *path, int flags );
|
|||||||
qboolean FS_FixFileCase( dir_t *dir, const char *path, char *dst, const size_t len, qboolean createpath );
|
qboolean FS_FixFileCase( dir_t *dir, const char *path, char *dst, const size_t len, qboolean createpath );
|
||||||
void FS_InitDirectorySearchpath( searchpath_t *search, const char *path, int flags );
|
void FS_InitDirectorySearchpath( searchpath_t *search, const char *path, int flags );
|
||||||
|
|
||||||
|
//
|
||||||
|
// android.c
|
||||||
|
//
|
||||||
|
void FS_InitAndroid( void );
|
||||||
|
searchpath_t *FS_AddAndroidAssets_Fullpath( const char *path, int flags );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ searchpath_t *FS_AddPak_Fullpath( const char *pakfile, int flags )
|
|||||||
{
|
{
|
||||||
searchpath_t *search;
|
searchpath_t *search;
|
||||||
pack_t *pak;
|
pack_t *pak;
|
||||||
int i, errorcode = PAK_LOAD_COULDNT_OPEN;
|
int errorcode = PAK_LOAD_COULDNT_OPEN;
|
||||||
|
|
||||||
pak = FS_LoadPackPAK( pakfile, &errorcode );
|
pak = FS_LoadPackPAK( pakfile, &errorcode );
|
||||||
|
|
||||||
|
|||||||
@@ -10,19 +10,19 @@ def configure(conf):
|
|||||||
}
|
}
|
||||||
conf.env.append_unique('CXXFLAGS', conf.get_flags_by_compiler(nortti, conf.env.COMPILER_CC))
|
conf.env.append_unique('CXXFLAGS', conf.get_flags_by_compiler(nortti, conf.env.COMPILER_CC))
|
||||||
|
|
||||||
if conf.env.DEST_OS != 'android':
|
if conf.env.DEST_OS == 'android':
|
||||||
if conf.env.cxxshlib_PATTERN.startswith('lib'):
|
conf.check_cc(lib='android')
|
||||||
conf.env.cxxshlib_PATTERN = conf.env.cxxshlib_PATTERN[3:]
|
elif conf.env.cxxshlib_PATTERN.startswith('lib'): # remove lib prefix for other systems than Android
|
||||||
|
conf.env.cxxshlib_PATTERN = conf.env.cxxshlib_PATTERN[3:]
|
||||||
|
|
||||||
def build(bld):
|
def build(bld):
|
||||||
bld(name = 'filesystem_includes', export_includes = '.')
|
bld(name = 'filesystem_includes', export_includes = '.')
|
||||||
|
|
||||||
libs = [ 'filesystem_includes' ]
|
libs = [ 'filesystem_includes', 'sdk_includes' ]
|
||||||
|
|
||||||
# on PSVita do not link any libraries that are already in the main executable, but add the includes target
|
# on PSVita do not link any libraries that are already in the main executable, but add the includes target
|
||||||
if bld.env.DEST_OS == 'psvita':
|
if bld.env.DEST_OS != 'psvita':
|
||||||
libs += [ 'sdk_includes' ]
|
libs += [ 'public', 'ANDROID' ]
|
||||||
else:
|
|
||||||
libs += [ 'public' ]
|
|
||||||
|
|
||||||
bld.shlib(target = 'filesystem_stdio',
|
bld.shlib(target = 'filesystem_stdio',
|
||||||
features = 'cxx seq',
|
features = 'cxx seq',
|
||||||
|
|||||||
@@ -129,6 +129,8 @@ struct zip_s
|
|||||||
zipfile_t *files;
|
zipfile_t *files;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// #define ENABLE_CRC_CHECK // known to be buggy because of possible libpublic crc32 bug, disabled
|
||||||
|
|
||||||
#ifdef XASH_REDUCE_FD
|
#ifdef XASH_REDUCE_FD
|
||||||
static void FS_EnsureOpenZip( zip_t *zip )
|
static void FS_EnsureOpenZip( zip_t *zip )
|
||||||
{
|
{
|
||||||
@@ -423,12 +425,13 @@ FS_LoadZIPFile
|
|||||||
static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_ind, fs_offset_t *sizeptr )
|
static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_ind, fs_offset_t *sizeptr )
|
||||||
{
|
{
|
||||||
zipfile_t *file;
|
zipfile_t *file;
|
||||||
int index;
|
|
||||||
byte *compressed_buffer = NULL, *decompressed_buffer = NULL;
|
byte *compressed_buffer = NULL, *decompressed_buffer = NULL;
|
||||||
int zlib_result = 0;
|
int zlib_result = 0;
|
||||||
dword test_crc, final_crc;
|
|
||||||
z_stream decompress_stream;
|
z_stream decompress_stream;
|
||||||
size_t c;
|
size_t c;
|
||||||
|
#ifdef ENABLE_CRC_CHECK
|
||||||
|
dword test_crc, final_crc;
|
||||||
|
#endif // ENABLE_CRC_CHECK
|
||||||
|
|
||||||
if( sizeptr ) *sizeptr = 0;
|
if( sizeptr ) *sizeptr = 0;
|
||||||
|
|
||||||
@@ -460,7 +463,7 @@ static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_in
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#ifdef ENABLE_CRC_CHECK
|
||||||
CRC32_Init( &test_crc );
|
CRC32_Init( &test_crc );
|
||||||
CRC32_ProcessBuffer( &test_crc, decompressed_buffer, file->size );
|
CRC32_ProcessBuffer( &test_crc, decompressed_buffer, file->size );
|
||||||
|
|
||||||
@@ -472,7 +475,8 @@ static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_in
|
|||||||
Mem_Free( decompressed_buffer );
|
Mem_Free( decompressed_buffer );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif // ENABLE_CRC_CHECK
|
||||||
|
|
||||||
if( sizeptr ) *sizeptr = file->size;
|
if( sizeptr ) *sizeptr = file->size;
|
||||||
|
|
||||||
FS_EnsureOpenZip( NULL );
|
FS_EnsureOpenZip( NULL );
|
||||||
@@ -516,7 +520,7 @@ static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_in
|
|||||||
if( zlib_result == Z_OK || zlib_result == Z_STREAM_END )
|
if( zlib_result == Z_OK || zlib_result == Z_STREAM_END )
|
||||||
{
|
{
|
||||||
Mem_Free( compressed_buffer ); // finaly free compressed buffer
|
Mem_Free( compressed_buffer ); // finaly free compressed buffer
|
||||||
#if 0
|
#if ENABLE_CRC_CHECK
|
||||||
CRC32_Init( &test_crc );
|
CRC32_Init( &test_crc );
|
||||||
CRC32_ProcessBuffer( &test_crc, decompressed_buffer, file->size );
|
CRC32_ProcessBuffer( &test_crc, decompressed_buffer, file->size );
|
||||||
|
|
||||||
@@ -668,7 +672,7 @@ searchpath_t *FS_AddZip_Fullpath( const char *zipfile, int flags )
|
|||||||
{
|
{
|
||||||
searchpath_t *search;
|
searchpath_t *search;
|
||||||
zip_t *zip;
|
zip_t *zip;
|
||||||
int i, errorcode = ZIP_LOAD_COULDNT_OPEN;
|
int errorcode = ZIP_LOAD_COULDNT_OPEN;
|
||||||
|
|
||||||
zip = FS_LoadZip( zipfile, &errorcode );
|
zip = FS_LoadZip( zipfile, &errorcode );
|
||||||
|
|
||||||
|
|||||||
@@ -21,21 +21,19 @@ def configure(conf):
|
|||||||
conf.define_cond('XASH_DISABLE_MENU_CHANGEGAME', conf.options.DISABLE_MENU_CHANGEGAME)
|
conf.define_cond('XASH_DISABLE_MENU_CHANGEGAME', conf.options.DISABLE_MENU_CHANGEGAME)
|
||||||
|
|
||||||
def build(bld):
|
def build(bld):
|
||||||
libs = ['sdk_includes']
|
|
||||||
source = ['game.cpp']
|
source = ['game.cpp']
|
||||||
defines = []
|
|
||||||
|
|
||||||
if bld.env.DEST_OS != 'win32':
|
if bld.env.DEST_OS == 'win32':
|
||||||
libs += [ 'DL' ]
|
|
||||||
else:
|
|
||||||
libs += ['USER32', 'SHELL32']
|
|
||||||
source += ['game.rc']
|
source += ['game.rc']
|
||||||
|
|
||||||
|
# Half-Life 25th anniversary update doesn't have server library explicitly linked to libm
|
||||||
|
if bld.env.DEST_OS == 'linux':
|
||||||
|
bld.env.LDFLAGS += ['-Wl,--no-as-needed', '-lm']
|
||||||
|
|
||||||
bld(source = source,
|
bld(source = source,
|
||||||
target = 'xash3d', # hl.exe
|
target = 'xash3d', # hl.exe
|
||||||
features = 'c cxx cxxprogram',
|
features = 'c cxx cxxprogram',
|
||||||
use = libs,
|
use = 'sdk_includes DL USER32 SHELL32',
|
||||||
defines = defines,
|
|
||||||
rpath = bld.env.DEFAULT_RPATH,
|
rpath = bld.env.DEFAULT_RPATH,
|
||||||
install_path = bld.env.BINDIR,
|
install_path = bld.env.BINDIR,
|
||||||
subsystem = bld.env.MSVC_SUBSYSTEM
|
subsystem = bld.env.MSVC_SUBSYSTEM
|
||||||
|
|||||||
@@ -438,7 +438,10 @@ uint COM_HashKey( const char *string, uint hashSize )
|
|||||||
unsigned char i;
|
unsigned char i;
|
||||||
|
|
||||||
while(( i = *string++ ))
|
while(( i = *string++ ))
|
||||||
|
{
|
||||||
|
i = Q_tolower( i );
|
||||||
hashKey = ( hashKey << 5 ) + hashKey + ( i & 0xDF );
|
hashKey = ( hashKey << 5 ) + hashKey + ( i & 0xDF );
|
||||||
|
}
|
||||||
|
|
||||||
return hashKey & ( hashSize - 1 );
|
return hashKey & ( hashSize - 1 );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -384,18 +384,6 @@ void VectorsAngles( const vec3_t forward, const vec3_t right, const vec3_t up, v
|
|||||||
//
|
//
|
||||||
// bounds operations
|
// bounds operations
|
||||||
//
|
//
|
||||||
/*
|
|
||||||
=================
|
|
||||||
ClearBounds
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void ClearBounds( vec3_t mins, vec3_t maxs )
|
|
||||||
{
|
|
||||||
// make bogus range
|
|
||||||
mins[0] = mins[1] = mins[2] = 999999.0f;
|
|
||||||
maxs[0] = maxs[1] = maxs[2] = -999999.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
AddPointToBounds
|
AddPointToBounds
|
||||||
@@ -416,7 +404,7 @@ void AddPointToBounds( const vec3_t v, vec3_t mins, vec3_t maxs )
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
ExpandBounds
|
ExpandBounds (not used anywhere?)
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void ExpandBounds( vec3_t mins, vec3_t maxs, float offset )
|
void ExpandBounds( vec3_t mins, vec3_t maxs, float offset )
|
||||||
@@ -429,34 +417,6 @@ void ExpandBounds( vec3_t mins, vec3_t maxs, float offset )
|
|||||||
maxs[2] += offset;
|
maxs[2] += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
BoundsIntersect
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
qboolean BoundsIntersect( const vec3_t mins1, const vec3_t maxs1, const vec3_t mins2, const vec3_t maxs2 )
|
|
||||||
{
|
|
||||||
if( mins1[0] > maxs2[0] || mins1[1] > maxs2[1] || mins1[2] > maxs2[2] )
|
|
||||||
return false;
|
|
||||||
if( maxs1[0] < mins2[0] || maxs1[1] < mins2[1] || maxs1[2] < mins2[2] )
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
BoundsAndSphereIntersect
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
qboolean BoundsAndSphereIntersect( const vec3_t mins, const vec3_t maxs, const vec3_t origin, float radius )
|
|
||||||
{
|
|
||||||
if( mins[0] > origin[0] + radius || mins[1] > origin[1] + radius || mins[2] > origin[2] + radius )
|
|
||||||
return false;
|
|
||||||
if( maxs[0] < origin[0] - radius || maxs[1] < origin[1] - radius || maxs[2] < origin[2] - radius )
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
SphereIntersect
|
SphereIntersect
|
||||||
|
|||||||
@@ -195,10 +195,32 @@ void AngleVectors( const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up
|
|||||||
void VectorsAngles( const vec3_t forward, const vec3_t right, const vec3_t up, vec3_t angles );
|
void VectorsAngles( const vec3_t forward, const vec3_t right, const vec3_t up, vec3_t angles );
|
||||||
void PlaneIntersect( const struct mplane_s *plane, const vec3_t p0, const vec3_t p1, vec3_t out );
|
void PlaneIntersect( const struct mplane_s *plane, const vec3_t p0, const vec3_t p1, vec3_t out );
|
||||||
|
|
||||||
void ClearBounds( vec3_t mins, vec3_t maxs );
|
static inline void ClearBounds( vec3_t mins, vec3_t maxs )
|
||||||
|
{
|
||||||
|
// make bogus range
|
||||||
|
mins[0] = mins[1] = mins[2] = 999999.0f;
|
||||||
|
maxs[0] = maxs[1] = maxs[2] = -999999.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline qboolean BoundsIntersect( const vec3_t mins1, const vec3_t maxs1, const vec3_t mins2, const vec3_t maxs2 )
|
||||||
|
{
|
||||||
|
if( mins1[0] > maxs2[0] || mins1[1] > maxs2[1] || mins1[2] > maxs2[2] )
|
||||||
|
return false;
|
||||||
|
if( maxs1[0] < mins2[0] || maxs1[1] < mins2[1] || maxs1[2] < mins2[2] )
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline qboolean BoundsAndSphereIntersect( const vec3_t mins, const vec3_t maxs, const vec3_t origin, float radius )
|
||||||
|
{
|
||||||
|
if( mins[0] > origin[0] + radius || mins[1] > origin[1] + radius || mins[2] > origin[2] + radius )
|
||||||
|
return false;
|
||||||
|
if( maxs[0] < origin[0] - radius || maxs[1] < origin[1] - radius || maxs[2] < origin[2] - radius )
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void AddPointToBounds( const vec3_t v, vec3_t mins, vec3_t maxs );
|
void AddPointToBounds( const vec3_t v, vec3_t mins, vec3_t maxs );
|
||||||
qboolean BoundsIntersect( const vec3_t mins1, const vec3_t maxs1, const vec3_t mins2, const vec3_t maxs2 );
|
|
||||||
qboolean BoundsAndSphereIntersect( const vec3_t mins, const vec3_t maxs, const vec3_t origin, float radius );
|
|
||||||
qboolean SphereIntersect( const vec3_t vSphereCenter, float fSphereRadiusSquared, const vec3_t vLinePt, const vec3_t vLineDir );
|
qboolean SphereIntersect( const vec3_t vSphereCenter, float fSphereRadiusSquared, const vec3_t vLinePt, const vec3_t vLineDir );
|
||||||
float RadiusFromBounds( const vec3_t mins, const vec3_t maxs );
|
float RadiusFromBounds( const vec3_t mins, const vec3_t maxs );
|
||||||
void ExpandBounds( vec3_t mins, vec3_t maxs, float offset );
|
void ExpandBounds( vec3_t mins, vec3_t maxs, float offset );
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ Limitations:
|
|||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#ifndef XASH_GL_STATIC
|
#ifndef XASH_GL_STATIC
|
||||||
#include "gl2_shim.h"
|
#include "gl2_shim.h"
|
||||||
#include <malloc.h>
|
#include ALLOCA_H
|
||||||
|
|
||||||
#define MAX_SHADERLEN 4096
|
#define MAX_SHADERLEN 4096
|
||||||
// increase this when adding more attributes
|
// increase this when adding more attributes
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ rgbdata_t *Mod_CreateSkinData( model_t *mod, byte *data, int width, int height )
|
|||||||
skin.encode = DXT_ENCODE_DEFAULT;
|
skin.encode = DXT_ENCODE_DEFAULT;
|
||||||
skin.numMips = 1;
|
skin.numMips = 1;
|
||||||
skin.buffer = data;
|
skin.buffer = data;
|
||||||
skin.palette = (byte *)gEngfuncs.CL_GetPaletteColor( 0 );
|
skin.palette = (byte *)tr.palette;
|
||||||
skin.size = width * height;
|
skin.size = width * height;
|
||||||
|
|
||||||
if( !gEngfuncs.Image_CustomPalette() )
|
if( !gEngfuncs.Image_CustomPalette() )
|
||||||
@@ -765,7 +765,7 @@ similar to R_StudioDynamicLight
|
|||||||
*/
|
*/
|
||||||
void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight )
|
void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight )
|
||||||
{
|
{
|
||||||
movevars_t *mv = gEngfuncs.pfnGetMoveVars();
|
movevars_t *mv = tr.movevars;
|
||||||
vec3_t lightDir, vecSrc, vecEnd;
|
vec3_t lightDir, vecSrc, vecEnd;
|
||||||
vec3_t origin, dist, finalLight;
|
vec3_t origin, dist, finalLight;
|
||||||
float add, radius, total;
|
float add, radius, total;
|
||||||
@@ -801,7 +801,7 @@ void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight )
|
|||||||
msurface_t *psurf = NULL;
|
msurface_t *psurf = NULL;
|
||||||
pmtrace_t trace;
|
pmtrace_t trace;
|
||||||
|
|
||||||
if( FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_WRITE_LARGE_COORD ))
|
if( FBitSet( gp_host->features, ENGINE_WRITE_LARGE_COORD ))
|
||||||
{
|
{
|
||||||
vecEnd[0] = origin[0] - mv->skyvec_x * 65536.0f;
|
vecEnd[0] = origin[0] - mv->skyvec_x * 65536.0f;
|
||||||
vecEnd[1] = origin[1] - mv->skyvec_y * 65536.0f;
|
vecEnd[1] = origin[1] - mv->skyvec_y * 65536.0f;
|
||||||
@@ -1002,15 +1002,10 @@ R_AliasSetRemapColors
|
|||||||
|
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_AliasSetRemapColors( int newTop, int newBottom )
|
static void R_AliasSetRemapColors( int newTop, int newBottom )
|
||||||
{
|
{
|
||||||
gEngfuncs.CL_AllocRemapInfo( RI.currententity, RI.currentmodel, newTop, newBottom );
|
if( gEngfuncs.CL_EntitySetRemapColors( RI.currententity, RI.currentmodel, newTop, newBottom ))
|
||||||
|
|
||||||
if( gEngfuncs.CL_GetRemapInfoForEntity( RI.currententity ))
|
|
||||||
{
|
|
||||||
gEngfuncs.CL_UpdateRemapInfo( RI.currententity, newTop, newBottom );
|
|
||||||
m_fDoRemap = true;
|
m_fDoRemap = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1261,7 +1256,7 @@ static void R_AliasDrawAbsBBox( cl_entity_t *e, const vec3_t absmin, const vec3_
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
// looks ugly, skip
|
// looks ugly, skip
|
||||||
if( r_drawentities->value != 5 || e == gEngfuncs.GetViewModel() )
|
if( r_drawentities->value != 5 || e == tr.viewent )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// compute a full bounding box
|
// compute a full bounding box
|
||||||
@@ -1337,12 +1332,12 @@ static void R_AliasSetupTimings( void )
|
|||||||
if( RI.drawWorld )
|
if( RI.drawWorld )
|
||||||
{
|
{
|
||||||
// synchronize with server time
|
// synchronize with server time
|
||||||
g_alias.time = gpGlobals->time;
|
g_alias.time = gp_cl->time;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// menu stuff
|
// menu stuff
|
||||||
g_alias.time = gpGlobals->realtime;
|
g_alias.time = gp_host->realtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_fDoRemap = false;
|
m_fDoRemap = false;
|
||||||
@@ -1386,7 +1381,7 @@ void R_DrawAliasModel( cl_entity_t *e )
|
|||||||
|
|
||||||
R_AliasLerpMovement( e );
|
R_AliasLerpMovement( e );
|
||||||
|
|
||||||
if( !FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_COMPENSATE_QUAKE_BUG ))
|
if( !FBitSet( gp_host->features, ENGINE_COMPENSATE_QUAKE_BUG ))
|
||||||
e->angles[PITCH] = -e->angles[PITCH]; // stupid quake bug
|
e->angles[PITCH] = -e->angles[PITCH]; // stupid quake bug
|
||||||
|
|
||||||
// don't rotate clients, only aim
|
// don't rotate clients, only aim
|
||||||
|
|||||||
@@ -608,7 +608,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime )
|
|||||||
if( pnew )
|
if( pnew )
|
||||||
{
|
{
|
||||||
VectorCopy( pbeam->source, pnew->org );
|
VectorCopy( pbeam->source, pnew->org );
|
||||||
pnew->die = gpGlobals->time + pbeam->amplitude;
|
pnew->die = gp_cl->time + pbeam->amplitude;
|
||||||
VectorClear( pnew->vel );
|
VectorClear( pnew->vel );
|
||||||
|
|
||||||
pnew->next = particles;
|
pnew->next = particles;
|
||||||
@@ -655,7 +655,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime )
|
|||||||
VectorMA( delta, -pbeam->width, normal, last2 );
|
VectorMA( delta, -pbeam->width, normal, last2 );
|
||||||
|
|
||||||
div = 1.0f / pbeam->amplitude;
|
div = 1.0f / pbeam->amplitude;
|
||||||
fraction = ( pbeam->die - gpGlobals->time ) * div;
|
fraction = ( pbeam->die - gp_cl->time ) * div;
|
||||||
|
|
||||||
vLast = 0.0f;
|
vLast = 0.0f;
|
||||||
vStep = 1.0f;
|
vStep = 1.0f;
|
||||||
@@ -688,7 +688,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime )
|
|||||||
|
|
||||||
if( particles->next != NULL )
|
if( particles->next != NULL )
|
||||||
{
|
{
|
||||||
fraction = (particles->die - gpGlobals->time) * div;
|
fraction = (particles->die - gp_cl->time) * div;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -867,12 +867,8 @@ static qboolean R_BeamComputePoint( int beamEnt, vec3_t pt )
|
|||||||
// get attachment
|
// get attachment
|
||||||
if( attach > 0 )
|
if( attach > 0 )
|
||||||
VectorCopy( ent->attachment[attach - 1], pt );
|
VectorCopy( ent->attachment[attach - 1], pt );
|
||||||
else if( ent->index == ENGINE_GET_PARM( PARM_PLAYER_INDEX ) )
|
else if( ent->index == ( gp_cl->playernum + 1 ))
|
||||||
{
|
VectorCopy( gp_cl->simorg, pt );
|
||||||
vec3_t simorg;
|
|
||||||
gEngfuncs.GetPredictedOrigin( simorg );
|
|
||||||
VectorCopy( simorg, pt );
|
|
||||||
}
|
|
||||||
else VectorCopy( ent->origin, pt );
|
else VectorCopy( ent->origin, pt );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -916,7 +912,7 @@ qboolean R_BeamRecomputeEndpoints( BEAM *pbeam )
|
|||||||
else if( !FBitSet( pbeam->flags, FBEAM_FOREVER ))
|
else if( !FBitSet( pbeam->flags, FBEAM_FOREVER ))
|
||||||
{
|
{
|
||||||
ClearBits( pbeam->flags, FBEAM_ENDENTITY );
|
ClearBits( pbeam->flags, FBEAM_ENDENTITY );
|
||||||
pbeam->die = gpGlobals->time;
|
pbeam->die = gp_cl->time;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -943,13 +939,13 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
|
|||||||
model_t *model;
|
model_t *model;
|
||||||
vec3_t delta;
|
vec3_t delta;
|
||||||
|
|
||||||
model = gEngfuncs.pfnGetModelByIndex( pbeam->modelIndex );
|
model = CL_ModelHandle( pbeam->modelIndex );
|
||||||
SetBits( pbeam->flags, FBEAM_ISACTIVE );
|
SetBits( pbeam->flags, FBEAM_ISACTIVE );
|
||||||
|
|
||||||
if( !model || model->type != mod_sprite )
|
if( !model || model->type != mod_sprite )
|
||||||
{
|
{
|
||||||
pbeam->flags &= ~FBEAM_ISACTIVE; // force to ignore
|
pbeam->flags &= ~FBEAM_ISACTIVE; // force to ignore
|
||||||
pbeam->die = gpGlobals->time;
|
pbeam->die = gp_cl->time;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1007,7 +1003,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
|
|||||||
if( pbeam->flags & ( FBEAM_FADEIN|FBEAM_FADEOUT ))
|
if( pbeam->flags & ( FBEAM_FADEIN|FBEAM_FADEOUT ))
|
||||||
{
|
{
|
||||||
// update life cycle
|
// update life cycle
|
||||||
pbeam->t = pbeam->freq + ( pbeam->die - gpGlobals->time );
|
pbeam->t = pbeam->freq + ( pbeam->die - gp_cl->time );
|
||||||
if( pbeam->t != 0.0f ) pbeam->t = 1.0f - pbeam->freq / pbeam->t;
|
if( pbeam->t != 0.0f ) pbeam->t = 1.0f - pbeam->freq / pbeam->t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1055,7 +1051,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
|
|||||||
|
|
||||||
TriRenderMode( FBitSet( pbeam->flags, FBEAM_SOLID ) ? kRenderNormal : kRenderTransAdd );
|
TriRenderMode( FBitSet( pbeam->flags, FBEAM_SOLID ) ? kRenderNormal : kRenderTransAdd );
|
||||||
|
|
||||||
if( !TriSpriteTexture( model, (int)(pbeam->frame + pbeam->frameRate * gpGlobals->time) % pbeam->frameCount ))
|
if( !TriSpriteTexture( model, (int)(pbeam->frame + pbeam->frameRate * gp_cl->time) % pbeam->frameCount ))
|
||||||
{
|
{
|
||||||
ClearBits( pbeam->flags, FBEAM_ISACTIVE );
|
ClearBits( pbeam->flags, FBEAM_ISACTIVE );
|
||||||
return;
|
return;
|
||||||
@@ -1146,7 +1142,7 @@ passed through this
|
|||||||
*/
|
*/
|
||||||
static void R_BeamSetup( BEAM *pbeam, vec3_t start, vec3_t end, int modelIndex, float life, float width, float amplitude, float brightness, float speed )
|
static void R_BeamSetup( BEAM *pbeam, vec3_t start, vec3_t end, int modelIndex, float life, float width, float amplitude, float brightness, float speed )
|
||||||
{
|
{
|
||||||
model_t *sprite = gEngfuncs.pfnGetModelByIndex( modelIndex );
|
model_t *sprite = CL_ModelHandle( modelIndex );
|
||||||
|
|
||||||
if( !sprite ) return;
|
if( !sprite ) return;
|
||||||
|
|
||||||
@@ -1160,8 +1156,8 @@ static void R_BeamSetup( BEAM *pbeam, vec3_t start, vec3_t end, int modelIndex,
|
|||||||
VectorCopy( end, pbeam->target );
|
VectorCopy( end, pbeam->target );
|
||||||
VectorSubtract( end, start, pbeam->delta );
|
VectorSubtract( end, start, pbeam->delta );
|
||||||
|
|
||||||
pbeam->freq = speed * gpGlobals->time;
|
pbeam->freq = speed * gp_cl->time;
|
||||||
pbeam->die = life + gpGlobals->time;
|
pbeam->die = life + gp_cl->time;
|
||||||
pbeam->amplitude = amplitude;
|
pbeam->amplitude = amplitude;
|
||||||
pbeam->brightness = brightness;
|
pbeam->brightness = brightness;
|
||||||
pbeam->width = width;
|
pbeam->width = width;
|
||||||
@@ -1291,7 +1287,7 @@ void CL_DrawBeams( int fTrans, BEAM *active_beams )
|
|||||||
if( !fTrans && !FBitSet( pBeam->flags, FBEAM_SOLID ))
|
if( !fTrans && !FBitSet( pBeam->flags, FBEAM_SOLID ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
R_BeamDraw( pBeam, gpGlobals->time - gpGlobals->oldtime );
|
R_BeamDraw( pBeam, gp_cl->time - gp_cl->oldtime );
|
||||||
}
|
}
|
||||||
|
|
||||||
pglShadeModel( GL_FLAT );
|
pglShadeModel( GL_FLAT );
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
ref_api_t gEngfuncs;
|
ref_api_t gEngfuncs;
|
||||||
ref_globals_t *gpGlobals;
|
ref_globals_t *gpGlobals;
|
||||||
|
ref_client_t *gp_cl;
|
||||||
|
ref_host_t *gp_host;
|
||||||
|
|
||||||
static void R_ClearScreen( void )
|
static void R_ClearScreen( void )
|
||||||
{
|
{
|
||||||
@@ -234,7 +236,7 @@ static int GL_RefGetParm( int parm, int arg )
|
|||||||
case PARM_STENCIL_ACTIVE:
|
case PARM_STENCIL_ACTIVE:
|
||||||
return glState.stencilEnabled;
|
return glState.stencilEnabled;
|
||||||
case PARM_SKY_SPHERE:
|
case PARM_SKY_SPHERE:
|
||||||
return ENGINE_GET_PARM_( parm, arg ) && !tr.fCustomSkybox;
|
return FBitSet( tr.world->flags, FWORLD_SKYSPHERE ) && !FBitSet( tr.world->flags, FWORLD_CUSTOM_SKYBOX );
|
||||||
default:
|
default:
|
||||||
return ENGINE_GET_PARM_( parm, arg );
|
return ENGINE_GET_PARM_( parm, arg );
|
||||||
}
|
}
|
||||||
@@ -295,19 +297,32 @@ const byte *GL_TextureData( unsigned int texnum )
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_ProcessEntData( qboolean allocate )
|
void R_ProcessEntData( qboolean allocate, cl_entity_t *entities, unsigned int max_entities )
|
||||||
{
|
{
|
||||||
if( !allocate )
|
if( !allocate )
|
||||||
{
|
{
|
||||||
tr.draw_list->num_solid_entities = 0;
|
tr.draw_list->num_solid_entities = 0;
|
||||||
tr.draw_list->num_trans_entities = 0;
|
tr.draw_list->num_trans_entities = 0;
|
||||||
tr.draw_list->num_beam_entities = 0;
|
tr.draw_list->num_beam_entities = 0;
|
||||||
|
|
||||||
|
tr.max_entities = 0;
|
||||||
|
tr.entities = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tr.max_entities = max_entities;
|
||||||
|
tr.entities = entities;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( gEngfuncs.drawFuncs->R_ProcessEntData )
|
if( gEngfuncs.drawFuncs->R_ProcessEntData )
|
||||||
gEngfuncs.drawFuncs->R_ProcessEntData( allocate );
|
gEngfuncs.drawFuncs->R_ProcessEntData( allocate );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void GAME_EXPORT R_Flush( unsigned int flags )
|
||||||
|
{
|
||||||
|
// stub
|
||||||
|
}
|
||||||
|
|
||||||
qboolean R_SetDisplayTransform( ref_screen_rotation_t rotate, int offset_x, int offset_y, float scale_x, float scale_y )
|
qboolean R_SetDisplayTransform( ref_screen_rotation_t rotate, int offset_x, int offset_y, float scale_x, float scale_y )
|
||||||
{
|
{
|
||||||
qboolean ret = true;
|
qboolean ret = true;
|
||||||
@@ -372,6 +387,7 @@ ref_interface_t gReffuncs =
|
|||||||
R_AddEntity,
|
R_AddEntity,
|
||||||
CL_AddCustomBeam,
|
CL_AddCustomBeam,
|
||||||
R_ProcessEntData,
|
R_ProcessEntData,
|
||||||
|
R_Flush,
|
||||||
|
|
||||||
R_ShowTextures,
|
R_ShowTextures,
|
||||||
|
|
||||||
@@ -504,5 +520,8 @@ int EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs,
|
|||||||
memcpy( &gEngfuncs, engfuncs, sizeof( ref_api_t ));
|
memcpy( &gEngfuncs, engfuncs, sizeof( ref_api_t ));
|
||||||
gpGlobals = globals;
|
gpGlobals = globals;
|
||||||
|
|
||||||
|
gp_cl = (ref_client_t *)ENGINE_GET_PARM( PARM_GET_CLIENT_PTR );
|
||||||
|
gp_host = (ref_host_t *)ENGINE_GET_PARM( PARM_GET_HOST_PTR );
|
||||||
|
|
||||||
return REF_API_VERSION;
|
return REF_API_VERSION;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ R_CullModel
|
|||||||
*/
|
*/
|
||||||
int R_CullModel( cl_entity_t *e, const vec3_t absmin, const vec3_t absmax )
|
int R_CullModel( cl_entity_t *e, const vec3_t absmin, const vec3_t absmax )
|
||||||
{
|
{
|
||||||
if( e == gEngfuncs.GetViewModel() )
|
if( e == tr.viewent )
|
||||||
{
|
{
|
||||||
if( ENGINE_GET_PARM( PARM_DEV_OVERVIEW ))
|
if( ENGINE_GET_PARM( PARM_DEV_OVERVIEW ))
|
||||||
return 1;
|
return 1;
|
||||||
@@ -77,7 +77,7 @@ int R_CullSurface( msurface_t *surf, gl_frustum_t *frustum, uint clipflags )
|
|||||||
return CULL_VISIBLE;
|
return CULL_VISIBLE;
|
||||||
|
|
||||||
// world surfaces can be culled by vis frame too
|
// world surfaces can be culled by vis frame too
|
||||||
if( RI.currententity == gEngfuncs.GetEntityByIndex( 0 ) && surf->visframe != tr.framecount )
|
if( RI.currententity == CL_GetEntityByIndex( 0 ) && surf->visframe != tr.framecount )
|
||||||
return CULL_VISFRAME;
|
return CULL_VISFRAME;
|
||||||
|
|
||||||
// only static ents can be culled by frustum
|
// only static ents can be culled by frustum
|
||||||
@@ -92,7 +92,7 @@ int R_CullSurface( msurface_t *surf, gl_frustum_t *frustum, uint clipflags )
|
|||||||
{
|
{
|
||||||
vec3_t orthonormal;
|
vec3_t orthonormal;
|
||||||
|
|
||||||
if( e == gEngfuncs.GetEntityByIndex( 0 ) ) orthonormal[2] = surf->plane->normal[2];
|
if( e == CL_GetEntityByIndex( 0 )) orthonormal[2] = surf->plane->normal[2];
|
||||||
else Matrix4x4_VectorRotate( RI.objectMatrix, surf->plane->normal, orthonormal );
|
else Matrix4x4_VectorRotate( RI.objectMatrix, surf->plane->normal, orthonormal );
|
||||||
dist = orthonormal[2];
|
dist = orthonormal[2];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ GNU General Public License for more details.
|
|||||||
// REFTODO: rewrite in triapi
|
// REFTODO: rewrite in triapi
|
||||||
void R_DrawWorldHull( void )
|
void R_DrawWorldHull( void )
|
||||||
{
|
{
|
||||||
hull_model_t *hull = &WORLD->hull_models[0];
|
hull_model_t *hull = &tr.world->hull_models[0];
|
||||||
winding_t *poly;
|
winding_t *poly;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -69,10 +69,10 @@ void R_DrawModelHull( void )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
i = atoi( RI.currentmodel->name + 1 );
|
i = atoi( RI.currentmodel->name + 1 );
|
||||||
if( i < 1 || i >= WORLD->num_hull_models )
|
if( i < 1 || i >= tr.world->num_hull_models )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
hull = &WORLD->hull_models[i];
|
hull = &tr.world->hull_models[i];
|
||||||
|
|
||||||
pglPolygonOffset( 1.0f, 2.0 );
|
pglPolygonOffset( 1.0f, 2.0 );
|
||||||
pglEnable( GL_POLYGON_OFFSET_FILL );
|
pglEnable( GL_POLYGON_OFFSET_FILL );
|
||||||
|
|||||||
@@ -391,30 +391,15 @@ float *R_DecalVertsClip( decal_t *pDecal, msurface_t *surf, int texture, int *pV
|
|||||||
// Generate lighting coordinates at each vertex for decal vertices v[] on surface psurf
|
// Generate lighting coordinates at each vertex for decal vertices v[] on surface psurf
|
||||||
static void R_DecalVertsLight( float *v, msurface_t *surf, int vertCount )
|
static void R_DecalVertsLight( float *v, msurface_t *surf, int vertCount )
|
||||||
{
|
{
|
||||||
float s, t;
|
|
||||||
mtexinfo_t *tex;
|
|
||||||
mextrasurf_t *info = surf->info;
|
|
||||||
float sample_size;
|
float sample_size;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
sample_size = gEngfuncs.Mod_SampleSizeForFace( surf );
|
sample_size = gEngfuncs.Mod_SampleSizeForFace( surf );
|
||||||
tex = surf->texinfo;
|
|
||||||
|
|
||||||
for( j = 0; j < vertCount; j++, v += VERTEXSIZE )
|
for( j = 0; j < vertCount; j++, v += VERTEXSIZE )
|
||||||
{
|
{
|
||||||
// lightmap texture coordinates
|
// lightmap texture coordinates
|
||||||
s = DotProduct( v, info->lmvecs[0] ) + info->lmvecs[0][3] - info->lightmapmins[0];
|
R_LightmapCoord( v, surf, sample_size, &v[5] );
|
||||||
s += surf->light_s * sample_size;
|
|
||||||
s += sample_size * 0.5f;
|
|
||||||
s /= BLOCK_SIZE * sample_size; //fa->texinfo->texture->width;
|
|
||||||
|
|
||||||
t = DotProduct( v, info->lmvecs[1] ) + info->lmvecs[1][3] - info->lightmapmins[1];
|
|
||||||
t += surf->light_t * sample_size;
|
|
||||||
t += sample_size * 0.5f;
|
|
||||||
t /= BLOCK_SIZE * sample_size; //fa->texinfo->texture->height;
|
|
||||||
|
|
||||||
v[5] = s;
|
|
||||||
v[6] = t;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -765,15 +750,15 @@ void R_DecalShoot( int textureIndex, int entityIndex, int modelIndex, vec3_t pos
|
|||||||
|
|
||||||
if( entityIndex > 0 )
|
if( entityIndex > 0 )
|
||||||
{
|
{
|
||||||
ent = gEngfuncs.GetEntityByIndex( entityIndex );
|
ent = CL_GetEntityByIndex( entityIndex );
|
||||||
|
|
||||||
if( modelIndex > 0 ) model = gEngfuncs.pfnGetModelByIndex( modelIndex );
|
if( modelIndex > 0 ) model = CL_ModelHandle( modelIndex );
|
||||||
else if( ent != NULL ) model = gEngfuncs.pfnGetModelByIndex( ent->curstate.modelindex );
|
else if( ent != NULL ) model = CL_ModelHandle( ent->curstate.modelindex );
|
||||||
else return;
|
else return;
|
||||||
}
|
}
|
||||||
else if( modelIndex > 0 )
|
else if( modelIndex > 0 )
|
||||||
model = gEngfuncs.pfnGetModelByIndex( modelIndex );
|
model = CL_ModelHandle( modelIndex );
|
||||||
else model = WORLDMODEL;
|
else model = CL_ModelHandle( 1 );
|
||||||
|
|
||||||
if( !model ) return;
|
if( !model ) return;
|
||||||
|
|
||||||
|
|||||||
@@ -892,6 +892,11 @@ typedef float GLmatrix[16];
|
|||||||
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
|
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
|
||||||
#define WGL_SAMPLES_ARB 0x2042
|
#define WGL_SAMPLES_ARB 0x2042
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined( XASH_GL_STATIC ) && !defined( REF_GL_KEEP_MANGLED_FUNCTIONS )
|
#if defined( XASH_GL_STATIC ) && !defined( REF_GL_KEEP_MANGLED_FUNCTIONS )
|
||||||
#define GL_FUNCTION( name ) name
|
#define GL_FUNCTION( name ) name
|
||||||
#elif defined( XASH_GL_STATIC ) && defined( REF_GL_KEEP_MANGLED_FUNCTIONS )
|
#elif defined( XASH_GL_STATIC ) && defined( REF_GL_KEEP_MANGLED_FUNCTIONS )
|
||||||
@@ -1861,4 +1866,8 @@ APIENTRY_LINKAGE void GL_FUNCTION( glTexImage2DMultisample )(GLenum target, GLsi
|
|||||||
#define pglSwapInterval glSwapInterval
|
#define pglSwapInterval glSwapInterval
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif//GL_EXPORT_H
|
#endif//GL_EXPORT_H
|
||||||
|
|||||||
@@ -1668,11 +1668,11 @@ int GL_LoadTextureArray( const char **names, int flags )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// create new image
|
// create new image
|
||||||
pic = Mem_Malloc( gEngfuncs.Image_GetPool(), sizeof( rgbdata_t ));
|
pic = Mem_Malloc( r_temppool, sizeof( rgbdata_t ));
|
||||||
memcpy( pic, src, sizeof( rgbdata_t ));
|
memcpy( pic, src, sizeof( rgbdata_t ));
|
||||||
|
|
||||||
// expand pic buffer for all layers
|
// expand pic buffer for all layers
|
||||||
pic->buffer = Mem_Malloc( gEngfuncs.Image_GetPool(), pic->size * numLayers );
|
pic->buffer = Mem_Malloc( r_temppool, pic->size * numLayers );
|
||||||
pic->depth = 0;
|
pic->depth = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ GNU General Public License for more details.
|
|||||||
#include "common/cvar.h"
|
#include "common/cvar.h"
|
||||||
#include "gl_export.h"
|
#include "gl_export.h"
|
||||||
#include "wadfile.h"
|
#include "wadfile.h"
|
||||||
|
#include "common/mod_local.h"
|
||||||
|
|
||||||
#if XASH_PSVITA
|
#if XASH_PSVITA
|
||||||
int VGL_ShimInit( void );
|
int VGL_ShimInit( void );
|
||||||
@@ -57,10 +58,6 @@ void VGL_ShimEndFrame( void );
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define WORLD (gEngfuncs.GetWorld())
|
|
||||||
#define WORLDMODEL (gEngfuncs.pfnGetModelByIndex( 1 ))
|
|
||||||
#define MOVEVARS (gEngfuncs.pfnGetMoveVars())
|
|
||||||
|
|
||||||
// make mod_ref.h?
|
// make mod_ref.h?
|
||||||
#define LM_SAMPLE_SIZE 16
|
#define LM_SAMPLE_SIZE 16
|
||||||
|
|
||||||
@@ -91,10 +88,10 @@ extern poolhandle_t r_temppool;
|
|||||||
#define RP_NONVIEWERREF (RP_ENVVIEW)
|
#define RP_NONVIEWERREF (RP_ENVVIEW)
|
||||||
#define R_ModelOpaque( rm ) ( rm == kRenderNormal )
|
#define R_ModelOpaque( rm ) ( rm == kRenderNormal )
|
||||||
#define R_StaticEntity( ent ) ( VectorIsNull( ent->origin ) && VectorIsNull( ent->angles ))
|
#define R_StaticEntity( ent ) ( VectorIsNull( ent->origin ) && VectorIsNull( ent->angles ))
|
||||||
#define RP_LOCALCLIENT( e ) ((e) != NULL && (e)->index == ENGINE_GET_PARM( PARM_PLAYER_INDEX ) && e->player )
|
#define RP_LOCALCLIENT( e ) ((e) != NULL && (e)->index == ( gp_cl->playernum + 1 ) && e->player )
|
||||||
#define RP_NORMALPASS() ( FBitSet( RI.params, RP_NONVIEWERREF ) == 0 )
|
#define RP_NORMALPASS() ( FBitSet( RI.params, RP_NONVIEWERREF ) == 0 )
|
||||||
|
|
||||||
#define CL_IsViewEntityLocalPlayer() ( ENGINE_GET_PARM( PARM_VIEWENT_INDEX ) == ENGINE_GET_PARM( PARM_PLAYER_INDEX ) )
|
#define CL_IsViewEntityLocalPlayer() ( gp_cl->viewentity == ( gp_cl->playernum + 1 ))
|
||||||
|
|
||||||
#define CULL_VISIBLE 0 // not culled
|
#define CULL_VISIBLE 0 // not culled
|
||||||
#define CULL_BACKSIDE 1 // backside of transparent wall
|
#define CULL_BACKSIDE 1 // backside of transparent wall
|
||||||
@@ -256,7 +253,14 @@ typedef struct
|
|||||||
// cull info
|
// cull info
|
||||||
vec3_t modelorg; // relative to viewpoint
|
vec3_t modelorg; // relative to viewpoint
|
||||||
|
|
||||||
qboolean fCustomSkybox;
|
// get from engine
|
||||||
|
world_static_t *world;
|
||||||
|
cl_entity_t *entities;
|
||||||
|
movevars_t *movevars;
|
||||||
|
color24 *palette;
|
||||||
|
cl_entity_t *viewent;
|
||||||
|
|
||||||
|
uint max_entities;
|
||||||
} gl_globals_t;
|
} gl_globals_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -395,6 +399,7 @@ void R_TranslateForEntity( cl_entity_t *e );
|
|||||||
void R_RotateForEntity( cl_entity_t *e );
|
void R_RotateForEntity( cl_entity_t *e );
|
||||||
void R_SetupGL( qboolean set_gl_state );
|
void R_SetupGL( qboolean set_gl_state );
|
||||||
void R_AllowFog( qboolean allowed );
|
void R_AllowFog( qboolean allowed );
|
||||||
|
qboolean R_OpaqueEntity( cl_entity_t *ent );
|
||||||
void R_SetupFrustum( void );
|
void R_SetupFrustum( void );
|
||||||
void R_FindViewLeaf( void );
|
void R_FindViewLeaf( void );
|
||||||
void R_CheckGamma( void );
|
void R_CheckGamma( void );
|
||||||
@@ -439,6 +444,7 @@ void GL_ResetFogColor( void );
|
|||||||
void R_GenerateVBO( void );
|
void R_GenerateVBO( void );
|
||||||
void R_ClearVBO( void );
|
void R_ClearVBO( void );
|
||||||
void R_AddDecalVBO( decal_t *pdecal, msurface_t *surf );
|
void R_AddDecalVBO( decal_t *pdecal, msurface_t *surf );
|
||||||
|
void R_LightmapCoord( const vec3_t v, const msurface_t *surf, const float sample_size, vec2_t coords );
|
||||||
|
|
||||||
//
|
//
|
||||||
// gl_rpart.c
|
// gl_rpart.c
|
||||||
@@ -706,7 +712,6 @@ typedef struct
|
|||||||
qboolean in2DMode;
|
qboolean in2DMode;
|
||||||
} glstate_t;
|
} glstate_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
qboolean initialized; // OpenGL subsystem started
|
qboolean initialized; // OpenGL subsystem started
|
||||||
@@ -719,10 +724,33 @@ extern glstate_t glState;
|
|||||||
extern glwstate_t glw_state;
|
extern glwstate_t glw_state;
|
||||||
extern ref_api_t gEngfuncs;
|
extern ref_api_t gEngfuncs;
|
||||||
extern ref_globals_t *gpGlobals;
|
extern ref_globals_t *gpGlobals;
|
||||||
|
extern ref_client_t *gp_cl;
|
||||||
|
extern ref_host_t *gp_host;
|
||||||
|
|
||||||
#define ENGINE_GET_PARM_ (*gEngfuncs.EngineGetParm)
|
#define ENGINE_GET_PARM_ (*gEngfuncs.EngineGetParm)
|
||||||
#define ENGINE_GET_PARM( parm ) ENGINE_GET_PARM_( ( parm ), 0 )
|
#define ENGINE_GET_PARM( parm ) ENGINE_GET_PARM_( ( parm ), 0 )
|
||||||
|
|
||||||
|
//
|
||||||
|
// helper funcs
|
||||||
|
//
|
||||||
|
static inline cl_entity_t *CL_GetEntityByIndex( int index )
|
||||||
|
{
|
||||||
|
if( unlikely( index < 0 || index >= tr.max_entities || !tr.entities ))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return &tr.entities[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline model_t *CL_ModelHandle( int index )
|
||||||
|
{
|
||||||
|
if( unlikely( index < 0 || index >= gp_cl->nummodels ))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return gp_cl->models[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
#define WORLDMODEL (gp_cl->models[1])
|
||||||
|
|
||||||
//
|
//
|
||||||
// renderer cvars
|
// renderer cvars
|
||||||
//
|
//
|
||||||
@@ -753,6 +781,7 @@ extern convar_t r_lockfrustum;
|
|||||||
extern convar_t r_traceglow;
|
extern convar_t r_traceglow;
|
||||||
extern convar_t r_vbo;
|
extern convar_t r_vbo;
|
||||||
extern convar_t r_vbo_dlightmode;
|
extern convar_t r_vbo_dlightmode;
|
||||||
|
extern convar_t r_vbo_detail;
|
||||||
extern convar_t r_studio_sort_textures;
|
extern convar_t r_studio_sort_textures;
|
||||||
extern convar_t r_studio_drawelements;
|
extern convar_t r_studio_drawelements;
|
||||||
extern convar_t r_ripple;
|
extern convar_t r_ripple;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ CVAR_DEFINE_AUTO( r_lockfrustum, "0", FCVAR_CHEAT, "lock frustrum area at curren
|
|||||||
CVAR_DEFINE_AUTO( r_traceglow, "0", FCVAR_GLCONFIG, "cull flares behind models" );
|
CVAR_DEFINE_AUTO( r_traceglow, "0", FCVAR_GLCONFIG, "cull flares behind models" );
|
||||||
CVAR_DEFINE_AUTO( gl_round_down, "2", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "round texture sizes to nearest POT value" );
|
CVAR_DEFINE_AUTO( gl_round_down, "2", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "round texture sizes to nearest POT value" );
|
||||||
CVAR_DEFINE( r_vbo, "gl_vbo", "0", FCVAR_ARCHIVE, "draw world using VBO (known to be glitchy)" );
|
CVAR_DEFINE( r_vbo, "gl_vbo", "0", FCVAR_ARCHIVE, "draw world using VBO (known to be glitchy)" );
|
||||||
|
CVAR_DEFINE( r_vbo_detail, "gl_vbo_detail", "0", FCVAR_ARCHIVE, "detail vbo mode (0: disable, 1: multipass, 2: singlepass, broken decal dlights)" );
|
||||||
CVAR_DEFINE( r_vbo_dlightmode, "gl_vbo_dlightmode", "1", FCVAR_ARCHIVE, "vbo dlight rendering mode (0-1)" );
|
CVAR_DEFINE( r_vbo_dlightmode, "gl_vbo_dlightmode", "1", FCVAR_ARCHIVE, "vbo dlight rendering mode (0-1)" );
|
||||||
CVAR_DEFINE_AUTO( r_ripple, "0", FCVAR_GLCONFIG, "enable software-like water texture ripple simulation" );
|
CVAR_DEFINE_AUTO( r_ripple, "0", FCVAR_GLCONFIG, "enable software-like water texture ripple simulation" );
|
||||||
CVAR_DEFINE_AUTO( r_ripple_updatetime, "0.05", FCVAR_GLCONFIG, "how fast ripple simulation is" );
|
CVAR_DEFINE_AUTO( r_ripple_updatetime, "0.05", FCVAR_GLCONFIG, "how fast ripple simulation is" );
|
||||||
@@ -913,13 +914,7 @@ void GL_InitExtensionsBigGL( void )
|
|||||||
|
|
||||||
// gl4es may be used system-wide
|
// gl4es may be used system-wide
|
||||||
if( Q_stristr( glConfig.renderer_string, "gl4es" ))
|
if( Q_stristr( glConfig.renderer_string, "gl4es" ))
|
||||||
{
|
|
||||||
const char *vendor = (const char *)pglGetString( GL_VENDOR | 0x10000 );
|
|
||||||
const char *renderer = (const char *)pglGetString( GL_RENDERER | 0x10000 );
|
|
||||||
const char *version = (const char *)pglGetString( GL_VERSION | 0x10000 );
|
|
||||||
const char *extensions = (const char *)pglGetString( GL_EXTENSIONS | 0x10000 );
|
|
||||||
glConfig.wrapper = GLES_WRAPPER_GL4ES;
|
glConfig.wrapper = GLES_WRAPPER_GL4ES;
|
||||||
}
|
|
||||||
|
|
||||||
// multitexture
|
// multitexture
|
||||||
glConfig.max_texture_units = glConfig.max_texture_coords = glConfig.max_teximage_units = 1;
|
glConfig.max_texture_units = glConfig.max_texture_coords = glConfig.max_teximage_units = 1;
|
||||||
@@ -1250,6 +1245,7 @@ static void R_CheckVBO( void )
|
|||||||
|
|
||||||
gEngfuncs.Cvar_RegisterVariable( &r_vbo );
|
gEngfuncs.Cvar_RegisterVariable( &r_vbo );
|
||||||
gEngfuncs.Cvar_RegisterVariable( &r_vbo_dlightmode );
|
gEngfuncs.Cvar_RegisterVariable( &r_vbo_dlightmode );
|
||||||
|
gEngfuncs.Cvar_RegisterVariable( &r_vbo_detail );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1290,6 +1286,12 @@ qboolean R_Init( void )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// see R_ProcessEntData for tr.entities initialization
|
||||||
|
tr.world = (struct world_static_s *)ENGINE_GET_PARM( PARM_GET_WORLD_PTR );
|
||||||
|
tr.movevars = (movevars_t *)ENGINE_GET_PARM( PARM_GET_MOVEVARS_PTR );
|
||||||
|
tr.palette = (color24 *)ENGINE_GET_PARM( PARM_GET_PALETTE_PTR );
|
||||||
|
tr.viewent = (cl_entity_t *)ENGINE_GET_PARM( PARM_GET_VIEWENT_PTR );
|
||||||
|
|
||||||
GL_SetDefaults();
|
GL_SetDefaults();
|
||||||
R_CheckVBO();
|
R_CheckVBO();
|
||||||
R_InitImages();
|
R_InitImages();
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ void CL_RunLightStyles( void )
|
|||||||
{
|
{
|
||||||
int i, k, flight, clight;
|
int i, k, flight, clight;
|
||||||
float l, lerpfrac, backlerp;
|
float l, lerpfrac, backlerp;
|
||||||
float frametime = (gpGlobals->time - gpGlobals->oldtime);
|
float frametime = (gp_cl->time - gp_cl->oldtime);
|
||||||
float scale;
|
float scale;
|
||||||
lightstyle_t *ls;
|
lightstyle_t *ls;
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ void CL_RunLightStyles( void )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !ENGINE_GET_PARM( PARAM_GAMEPAUSED ) && frametime <= 0.1f )
|
if( !gp_cl->paused && frametime <= 0.1f )
|
||||||
ls->time += frametime; // evaluate local time
|
ls->time += frametime; // evaluate local time
|
||||||
|
|
||||||
flight = (int)Q_floor( ls->time * 10 );
|
flight = (int)Q_floor( ls->time * 10 );
|
||||||
@@ -152,7 +152,7 @@ void R_PushDlights( void )
|
|||||||
|
|
||||||
tr.dlightframecount = tr.framecount;
|
tr.dlightframecount = tr.framecount;
|
||||||
|
|
||||||
RI.currententity = gEngfuncs.GetEntityByIndex( 0 );
|
RI.currententity = CL_GetEntityByIndex( 0 );
|
||||||
if( RI.currententity )
|
if( RI.currententity )
|
||||||
RI.currentmodel = RI.currententity->model;
|
RI.currentmodel = RI.currententity->model;
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ void R_PushDlights( void )
|
|||||||
{
|
{
|
||||||
l = gEngfuncs.GetDynamicLight( i );
|
l = gEngfuncs.GetDynamicLight( i );
|
||||||
|
|
||||||
if( l->die < gpGlobals->time || !l->radius )
|
if( l->die < gp_cl->time || !l->radius )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( GL_FrustumCullSphere( &RI.frustum, l->origin, l->radius, 15 ))
|
if( GL_FrustumCullSphere( &RI.frustum, l->origin, l->radius, 15 ))
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ R_OpaqueEntity
|
|||||||
Opaque entity can be brush or studio model but sprite
|
Opaque entity can be brush or studio model but sprite
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static qboolean R_OpaqueEntity( cl_entity_t *ent )
|
qboolean R_OpaqueEntity( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
if( R_GetEntityRenderMode( ent ) == kRenderNormal )
|
if( R_GetEntityRenderMode( ent ) == kRenderNormal )
|
||||||
return true;
|
return true;
|
||||||
@@ -324,7 +324,7 @@ R_GetFarClip
|
|||||||
static float R_GetFarClip( void )
|
static float R_GetFarClip( void )
|
||||||
{
|
{
|
||||||
if( WORLDMODEL && RI.drawWorld )
|
if( WORLDMODEL && RI.drawWorld )
|
||||||
return MOVEVARS->zmax * 1.73f;
|
return tr.movevars->zmax * 1.73f;
|
||||||
return 2048.0f;
|
return 2048.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,8 +339,8 @@ void R_SetupFrustum( void )
|
|||||||
|
|
||||||
if( RP_NORMALPASS() && ( ENGINE_GET_PARM( PARM_WATER_LEVEL ) >= 3 ) && ENGINE_GET_PARM( PARM_QUAKE_COMPATIBLE ))
|
if( RP_NORMALPASS() && ( ENGINE_GET_PARM( PARM_WATER_LEVEL ) >= 3 ) && ENGINE_GET_PARM( PARM_QUAKE_COMPATIBLE ))
|
||||||
{
|
{
|
||||||
RI.fov_x = atan( tan( DEG2RAD( RI.fov_x ) / 2 ) * ( 0.97f + sin( gpGlobals->time * 1.5f ) * 0.03f )) * 2 / (M_PI_F / 180.0f);
|
RI.fov_x = atan( tan( DEG2RAD( RI.fov_x ) / 2 ) * ( 0.97f + sin( gp_cl->time * 1.5f ) * 0.03f )) * 2 / (M_PI_F / 180.0f);
|
||||||
RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03f - sin( gpGlobals->time * 1.5f ) * 0.03f )) * 2 / (M_PI_F / 180.0f);
|
RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03f - sin( gp_cl->time * 1.5f ) * 0.03f )) * 2 / (M_PI_F / 180.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// build the transformation matrix for the given view angles
|
// build the transformation matrix for the given view angles
|
||||||
@@ -429,7 +429,7 @@ void R_RotateForEntity( cl_entity_t *e )
|
|||||||
{
|
{
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
|
|
||||||
if( e == gEngfuncs.GetEntityByIndex( 0 ) )
|
if( e == CL_GetEntityByIndex( 0 ))
|
||||||
{
|
{
|
||||||
R_LoadIdentity();
|
R_LoadIdentity();
|
||||||
return;
|
return;
|
||||||
@@ -455,7 +455,7 @@ void R_TranslateForEntity( cl_entity_t *e )
|
|||||||
{
|
{
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
|
|
||||||
if( e == gEngfuncs.GetEntityByIndex( 0 ) )
|
if( e == CL_GetEntityByIndex( 0 ))
|
||||||
{
|
{
|
||||||
R_LoadIdentity();
|
R_LoadIdentity();
|
||||||
return;
|
return;
|
||||||
@@ -669,7 +669,7 @@ static void R_CheckFog( void )
|
|||||||
// quake global fog
|
// quake global fog
|
||||||
if( ENGINE_GET_PARM( PARM_QUAKE_COMPATIBLE ))
|
if( ENGINE_GET_PARM( PARM_QUAKE_COMPATIBLE ))
|
||||||
{
|
{
|
||||||
if( !MOVEVARS->fog_settings )
|
if( !tr.movevars->fog_settings )
|
||||||
{
|
{
|
||||||
if( pglIsEnabled( GL_FOG ))
|
if( pglIsEnabled( GL_FOG ))
|
||||||
pglDisable( GL_FOG );
|
pglDisable( GL_FOG );
|
||||||
@@ -678,10 +678,10 @@ static void R_CheckFog( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// quake-style global fog
|
// quake-style global fog
|
||||||
RI.fogColor[0] = ((MOVEVARS->fog_settings & 0xFF000000) >> 24) / 255.0f;
|
RI.fogColor[0] = ((tr.movevars->fog_settings & 0xFF000000) >> 24) / 255.0f;
|
||||||
RI.fogColor[1] = ((MOVEVARS->fog_settings & 0xFF0000) >> 16) / 255.0f;
|
RI.fogColor[1] = ((tr.movevars->fog_settings & 0xFF0000) >> 16) / 255.0f;
|
||||||
RI.fogColor[2] = ((MOVEVARS->fog_settings & 0xFF00) >> 8) / 255.0f;
|
RI.fogColor[2] = ((tr.movevars->fog_settings & 0xFF00) >> 8) / 255.0f;
|
||||||
RI.fogDensity = ((MOVEVARS->fog_settings & 0xFF) / 255.0f) * 0.01f;
|
RI.fogDensity = ((tr.movevars->fog_settings & 0xFF) / 255.0f) * 0.01f;
|
||||||
RI.fogStart = RI.fogEnd = 0.0f;
|
RI.fogStart = RI.fogEnd = 0.0f;
|
||||||
RI.fogColor[3] = 1.0f;
|
RI.fogColor[3] = 1.0f;
|
||||||
RI.fogCustom = false;
|
RI.fogCustom = false;
|
||||||
@@ -954,7 +954,7 @@ void R_RenderScene( void )
|
|||||||
|
|
||||||
// frametime is valid only for normal pass
|
// frametime is valid only for normal pass
|
||||||
if( RP_NORMALPASS( ))
|
if( RP_NORMALPASS( ))
|
||||||
tr.frametime = gpGlobals->time - gpGlobals->oldtime;
|
tr.frametime = gp_cl->time - gp_cl->oldtime;
|
||||||
else tr.frametime = 0.0;
|
else tr.frametime = 0.0;
|
||||||
|
|
||||||
// begin a new frame
|
// begin a new frame
|
||||||
@@ -1181,16 +1181,16 @@ int CL_FxBlend( cl_entity_t *e )
|
|||||||
switch( e->curstate.renderfx )
|
switch( e->curstate.renderfx )
|
||||||
{
|
{
|
||||||
case kRenderFxPulseSlowWide:
|
case kRenderFxPulseSlowWide:
|
||||||
blend = e->curstate.renderamt + 0x40 * sin( gpGlobals->time * 2 + offset );
|
blend = e->curstate.renderamt + 0x40 * sin( gp_cl->time * 2 + offset );
|
||||||
break;
|
break;
|
||||||
case kRenderFxPulseFastWide:
|
case kRenderFxPulseFastWide:
|
||||||
blend = e->curstate.renderamt + 0x40 * sin( gpGlobals->time * 8 + offset );
|
blend = e->curstate.renderamt + 0x40 * sin( gp_cl->time * 8 + offset );
|
||||||
break;
|
break;
|
||||||
case kRenderFxPulseSlow:
|
case kRenderFxPulseSlow:
|
||||||
blend = e->curstate.renderamt + 0x10 * sin( gpGlobals->time * 2 + offset );
|
blend = e->curstate.renderamt + 0x10 * sin( gp_cl->time * 2 + offset );
|
||||||
break;
|
break;
|
||||||
case kRenderFxPulseFast:
|
case kRenderFxPulseFast:
|
||||||
blend = e->curstate.renderamt + 0x10 * sin( gpGlobals->time * 8 + offset );
|
blend = e->curstate.renderamt + 0x10 * sin( gp_cl->time * 8 + offset );
|
||||||
break;
|
break;
|
||||||
case kRenderFxFadeSlow:
|
case kRenderFxFadeSlow:
|
||||||
if( RP_NORMALPASS( ))
|
if( RP_NORMALPASS( ))
|
||||||
@@ -1229,27 +1229,27 @@ int CL_FxBlend( cl_entity_t *e )
|
|||||||
blend = e->curstate.renderamt;
|
blend = e->curstate.renderamt;
|
||||||
break;
|
break;
|
||||||
case kRenderFxStrobeSlow:
|
case kRenderFxStrobeSlow:
|
||||||
blend = 20 * sin( gpGlobals->time * 4 + offset );
|
blend = 20 * sin( gp_cl->time * 4 + offset );
|
||||||
if( blend < 0 ) blend = 0;
|
if( blend < 0 ) blend = 0;
|
||||||
else blend = e->curstate.renderamt;
|
else blend = e->curstate.renderamt;
|
||||||
break;
|
break;
|
||||||
case kRenderFxStrobeFast:
|
case kRenderFxStrobeFast:
|
||||||
blend = 20 * sin( gpGlobals->time * 16 + offset );
|
blend = 20 * sin( gp_cl->time * 16 + offset );
|
||||||
if( blend < 0 ) blend = 0;
|
if( blend < 0 ) blend = 0;
|
||||||
else blend = e->curstate.renderamt;
|
else blend = e->curstate.renderamt;
|
||||||
break;
|
break;
|
||||||
case kRenderFxStrobeFaster:
|
case kRenderFxStrobeFaster:
|
||||||
blend = 20 * sin( gpGlobals->time * 36 + offset );
|
blend = 20 * sin( gp_cl->time * 36 + offset );
|
||||||
if( blend < 0 ) blend = 0;
|
if( blend < 0 ) blend = 0;
|
||||||
else blend = e->curstate.renderamt;
|
else blend = e->curstate.renderamt;
|
||||||
break;
|
break;
|
||||||
case kRenderFxFlickerSlow:
|
case kRenderFxFlickerSlow:
|
||||||
blend = 20 * (sin( gpGlobals->time * 2 ) + sin( gpGlobals->time * 17 + offset ));
|
blend = 20 * (sin( gp_cl->time * 2 ) + sin( gp_cl->time * 17 + offset ));
|
||||||
if( blend < 0 ) blend = 0;
|
if( blend < 0 ) blend = 0;
|
||||||
else blend = e->curstate.renderamt;
|
else blend = e->curstate.renderamt;
|
||||||
break;
|
break;
|
||||||
case kRenderFxFlickerFast:
|
case kRenderFxFlickerFast:
|
||||||
blend = 20 * (sin( gpGlobals->time * 16 ) + sin( gpGlobals->time * 23 + offset ));
|
blend = 20 * (sin( gp_cl->time * 16 ) + sin( gp_cl->time * 23 + offset ));
|
||||||
if( blend < 0 ) blend = 0;
|
if( blend < 0 ) blend = 0;
|
||||||
else blend = e->curstate.renderamt;
|
else blend = e->curstate.renderamt;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ void R_NewMap( void )
|
|||||||
tx->texturechain = NULL;
|
tx->texturechain = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
R_SetupSky( MOVEVARS->skyName );
|
R_SetupSky( tr.movevars->skyName );
|
||||||
|
|
||||||
GL_BuildLightmaps ();
|
GL_BuildLightmaps ();
|
||||||
R_GenerateVBO();
|
R_GenerateVBO();
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ void CL_DrawParticles( double frametime, particle_t *cl_active_particles, float
|
|||||||
{
|
{
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
vec3_t right, up;
|
vec3_t right, up;
|
||||||
color24 *pColor;
|
color24 color;
|
||||||
int alpha;
|
int alpha;
|
||||||
float size;
|
float size;
|
||||||
|
|
||||||
@@ -85,15 +85,15 @@ void CL_DrawParticles( double frametime, particle_t *cl_active_particles, float
|
|||||||
VectorScale( RI.cull_vup, size, up );
|
VectorScale( RI.cull_vup, size, up );
|
||||||
|
|
||||||
p->color = bound( 0, p->color, 255 );
|
p->color = bound( 0, p->color, 255 );
|
||||||
pColor = gEngfuncs.CL_GetPaletteColor( p->color );
|
color = tr.palette[p->color];
|
||||||
|
|
||||||
alpha = 255 * (p->die - gpGlobals->time) * 16.0f;
|
alpha = 255 * (p->die - gp_cl->time) * 16.0f;
|
||||||
if( alpha > 255 || p->type == pt_static )
|
if( alpha > 255 || p->type == pt_static )
|
||||||
alpha = 255;
|
alpha = 255;
|
||||||
|
|
||||||
pglColor4ub( gEngfuncs.LightToTexGamma( pColor->r ),
|
pglColor4ub( gEngfuncs.LightToTexGamma( color.r ),
|
||||||
gEngfuncs.LightToTexGamma( pColor->g ),
|
gEngfuncs.LightToTexGamma( color.g ),
|
||||||
gEngfuncs.LightToTexGamma( pColor->b ), alpha );
|
gEngfuncs.LightToTexGamma( color.b ), alpha );
|
||||||
|
|
||||||
pglTexCoord2f( 0.0f, 1.0f );
|
pglTexCoord2f( 0.0f, 1.0f );
|
||||||
pglVertex3f( p->org[0] - right[0] + up[0], p->org[1] - right[1] + up[1], p->org[2] - right[2] + up[2] );
|
pglVertex3f( p->org[0] - right[0] + up[0], p->org[1] - right[1] + up[1], p->org[2] - right[2] + up[2] );
|
||||||
@@ -188,13 +188,13 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
|
|||||||
pglDisable( GL_ALPHA_TEST );
|
pglDisable( GL_ALPHA_TEST );
|
||||||
pglDepthMask( GL_FALSE );
|
pglDepthMask( GL_FALSE );
|
||||||
|
|
||||||
gravity = frametime * MOVEVARS->gravity;
|
gravity = frametime * tr.movevars->gravity;
|
||||||
scale = 1.0 - (frametime * 0.9);
|
scale = 1.0 - (frametime * 0.9);
|
||||||
if( scale < 0.0f ) scale = 0.0f;
|
if( scale < 0.0f ) scale = 0.0f;
|
||||||
|
|
||||||
for( p = cl_active_tracers; p; p = p->next )
|
for( p = cl_active_tracers; p; p = p->next )
|
||||||
{
|
{
|
||||||
atten = (p->die - gpGlobals->time);
|
atten = (p->die - gp_cl->time);
|
||||||
if( atten > 0.1f ) atten = 0.1f;
|
if( atten > 0.1f ) atten = 0.1f;
|
||||||
|
|
||||||
VectorScale( p->vel, ( p->ramp * atten ), delta );
|
VectorScale( p->vel, ( p->ramp * atten ), delta );
|
||||||
@@ -205,7 +205,7 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
|
|||||||
{
|
{
|
||||||
vec3_t verts[4], tmp2;
|
vec3_t verts[4], tmp2;
|
||||||
vec3_t tmp, normal;
|
vec3_t tmp, normal;
|
||||||
color24 *pColor;
|
color24 color;
|
||||||
|
|
||||||
// Transform point into screen space
|
// Transform point into screen space
|
||||||
TriWorldToScreen( start, screen );
|
TriWorldToScreen( start, screen );
|
||||||
@@ -235,8 +235,8 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
|
|||||||
p->color = 0;
|
p->color = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pColor = &gTracerColors[p->color];
|
color = gTracerColors[p->color];
|
||||||
pglColor4ub( pColor->r, pColor->g, pColor->b, p->packedColor );
|
pglColor4ub( color.r, color.g, color.b, p->packedColor );
|
||||||
|
|
||||||
pglBegin( GL_QUADS );
|
pglBegin( GL_QUADS );
|
||||||
pglTexCoord2f( 0.0f, 0.8f );
|
pglTexCoord2f( 0.0f, 0.8f );
|
||||||
@@ -259,7 +259,7 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
|
|||||||
p->vel[1] *= scale;
|
p->vel[1] *= scale;
|
||||||
p->vel[2] -= gravity;
|
p->vel[2] -= gravity;
|
||||||
|
|
||||||
p->packedColor = 255 * (p->die - gpGlobals->time) * 2;
|
p->packedColor = 255 * (p->die - gp_cl->time) * 2;
|
||||||
if( p->packedColor > 255 ) p->packedColor = 255;
|
if( p->packedColor > 255 ) p->packedColor = 255;
|
||||||
}
|
}
|
||||||
else if( p->type == pt_slowgrav )
|
else if( p->type == pt_slowgrav )
|
||||||
|
|||||||
1445
ref/gl/gl_rsurf.c
1445
ref/gl/gl_rsurf.c
File diff suppressed because it is too large
Load Diff
@@ -430,7 +430,7 @@ mspriteframe_t *R_GetSpriteFrame( const model_t *pModel, int frame, float yaw )
|
|||||||
|
|
||||||
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
|
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
|
||||||
// are positive, so we don't have to worry about division by zero
|
// are positive, so we don't have to worry about division by zero
|
||||||
targettime = gpGlobals->time - ((int)( gpGlobals->time / fullinterval )) * fullinterval;
|
targettime = gp_cl->time - ((int)( gp_cl->time / fullinterval )) * fullinterval;
|
||||||
|
|
||||||
for( i = 0; i < (numframes - 1); i++ )
|
for( i = 0; i < (numframes - 1); i++ )
|
||||||
{
|
{
|
||||||
@@ -494,25 +494,25 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
|
|||||||
// this can be happens when rendering switched between single and angled frames
|
// this can be happens when rendering switched between single and angled frames
|
||||||
// or change model on replace delta-entity
|
// or change model on replace delta-entity
|
||||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||||
ent->latched.sequencetime = gpGlobals->time;
|
ent->latched.sequencetime = gp_cl->time;
|
||||||
lerpFrac = 1.0f;
|
lerpFrac = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ent->latched.sequencetime < gpGlobals->time )
|
if( ent->latched.sequencetime < gp_cl->time )
|
||||||
{
|
{
|
||||||
if( frame != ent->latched.prevblending[1] )
|
if( frame != ent->latched.prevblending[1] )
|
||||||
{
|
{
|
||||||
ent->latched.prevblending[0] = ent->latched.prevblending[1];
|
ent->latched.prevblending[0] = ent->latched.prevblending[1];
|
||||||
ent->latched.prevblending[1] = frame;
|
ent->latched.prevblending[1] = frame;
|
||||||
ent->latched.sequencetime = gpGlobals->time;
|
ent->latched.sequencetime = gp_cl->time;
|
||||||
lerpFrac = 0.0f;
|
lerpFrac = 0.0f;
|
||||||
}
|
}
|
||||||
else lerpFrac = (gpGlobals->time - ent->latched.sequencetime) * 11.0f;
|
else lerpFrac = (gp_cl->time - ent->latched.sequencetime) * 11.0f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||||
ent->latched.sequencetime = gpGlobals->time;
|
ent->latched.sequencetime = gp_cl->time;
|
||||||
lerpFrac = 0.0f;
|
lerpFrac = 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -526,7 +526,7 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
|
|||||||
{
|
{
|
||||||
// reset interpolation on change model
|
// reset interpolation on change model
|
||||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||||
ent->latched.sequencetime = gpGlobals->time;
|
ent->latched.sequencetime = gp_cl->time;
|
||||||
lerpFrac = 0.0f;
|
lerpFrac = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -541,7 +541,7 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
|
|||||||
numframes = pspritegroup->numframes;
|
numframes = pspritegroup->numframes;
|
||||||
fullinterval = pintervals[numframes-1];
|
fullinterval = pintervals[numframes-1];
|
||||||
jinterval = pintervals[1] - pintervals[0];
|
jinterval = pintervals[1] - pintervals[0];
|
||||||
time = gpGlobals->time;
|
time = gp_cl->time;
|
||||||
jtime = 0.0f;
|
jtime = 0.0f;
|
||||||
|
|
||||||
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
|
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
|
||||||
@@ -580,25 +580,25 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
|
|||||||
// this can be happens when rendering switched between single and angled frames
|
// this can be happens when rendering switched between single and angled frames
|
||||||
// or change model on replace delta-entity
|
// or change model on replace delta-entity
|
||||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||||
ent->latched.sequencetime = gpGlobals->time;
|
ent->latched.sequencetime = gp_cl->time;
|
||||||
lerpFrac = 1.0f;
|
lerpFrac = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ent->latched.sequencetime < gpGlobals->time )
|
if( ent->latched.sequencetime < gp_cl->time )
|
||||||
{
|
{
|
||||||
if( frame != ent->latched.prevblending[1] )
|
if( frame != ent->latched.prevblending[1] )
|
||||||
{
|
{
|
||||||
ent->latched.prevblending[0] = ent->latched.prevblending[1];
|
ent->latched.prevblending[0] = ent->latched.prevblending[1];
|
||||||
ent->latched.prevblending[1] = frame;
|
ent->latched.prevblending[1] = frame;
|
||||||
ent->latched.sequencetime = gpGlobals->time;
|
ent->latched.sequencetime = gp_cl->time;
|
||||||
lerpFrac = 0.0f;
|
lerpFrac = 0.0f;
|
||||||
}
|
}
|
||||||
else lerpFrac = (gpGlobals->time - ent->latched.sequencetime) * ent->curstate.framerate;
|
else lerpFrac = (gp_cl->time - ent->latched.sequencetime) * ent->curstate.framerate;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||||
ent->latched.sequencetime = gpGlobals->time;
|
ent->latched.sequencetime = gp_cl->time;
|
||||||
lerpFrac = 0.0f;
|
lerpFrac = 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -826,7 +826,7 @@ void R_DrawSpriteModel( cl_entity_t *e )
|
|||||||
{
|
{
|
||||||
cl_entity_t *parent;
|
cl_entity_t *parent;
|
||||||
|
|
||||||
parent = gEngfuncs.GetEntityByIndex( e->curstate.aiment );
|
parent = CL_GetEntityByIndex( e->curstate.aiment );
|
||||||
|
|
||||||
if( parent && parent->model )
|
if( parent && parent->model )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -174,14 +174,14 @@ static void R_StudioSetupTimings( void )
|
|||||||
if( RI.drawWorld )
|
if( RI.drawWorld )
|
||||||
{
|
{
|
||||||
// synchronize with server time
|
// synchronize with server time
|
||||||
g_studio.time = gpGlobals->time;
|
g_studio.time = gp_cl->time;
|
||||||
g_studio.frametime = gpGlobals->time - gpGlobals->oldtime;
|
g_studio.frametime = gp_cl->time - gp_cl->oldtime;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// menu stuff
|
// menu stuff
|
||||||
g_studio.time = gpGlobals->realtime;
|
g_studio.time = gp_host->realtime;
|
||||||
g_studio.frametime = gpGlobals->frametime;
|
g_studio.frametime = gp_host->frametime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ static qboolean R_AllowFlipViewModel( cl_entity_t *e )
|
|||||||
{
|
{
|
||||||
if( cl_righthand && cl_righthand->value > 0 )
|
if( cl_righthand && cl_righthand->value > 0 )
|
||||||
{
|
{
|
||||||
if( e == gEngfuncs.GetViewModel() )
|
if( e == tr.viewent )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,7 +412,7 @@ pfnGetViewEntity
|
|||||||
*/
|
*/
|
||||||
static cl_entity_t *pfnGetViewEntity( void )
|
static cl_entity_t *pfnGetViewEntity( void )
|
||||||
{
|
{
|
||||||
return gEngfuncs.GetViewModel();
|
return tr.viewent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -424,8 +424,8 @@ pfnGetEngineTimes
|
|||||||
static void pfnGetEngineTimes( int *framecount, double *current, double *old )
|
static void pfnGetEngineTimes( int *framecount, double *current, double *old )
|
||||||
{
|
{
|
||||||
if( framecount ) *framecount = tr.realframecount;
|
if( framecount ) *framecount = tr.realframecount;
|
||||||
if( current ) *current = gpGlobals->time;
|
if( current ) *current = gp_cl->time;
|
||||||
if( old ) *old = gpGlobals->oldtime;
|
if( old ) *old = gp_cl->oldtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -596,12 +596,12 @@ void R_StudioSetUpTransform( cl_entity_t *e )
|
|||||||
VectorCopy( e->angles, angles );
|
VectorCopy( e->angles, angles );
|
||||||
|
|
||||||
// interpolate monsters position (moved into UpdateEntityFields by user request)
|
// interpolate monsters position (moved into UpdateEntityFields by user request)
|
||||||
if( e->curstate.movetype == MOVETYPE_STEP && !FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_COMPUTE_STUDIO_LERP ))
|
if( e->curstate.movetype == MOVETYPE_STEP && !FBitSet( gp_host->features, ENGINE_COMPUTE_STUDIO_LERP ))
|
||||||
{
|
{
|
||||||
R_StudioLerpMovement( e, g_studio.time, origin, angles );
|
R_StudioLerpMovement( e, g_studio.time, origin, angles );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_COMPENSATE_QUAKE_BUG ))
|
if( !FBitSet( gp_host->features, ENGINE_COMPENSATE_QUAKE_BUG ))
|
||||||
angles[PITCH] = -angles[PITCH]; // stupid quake bug
|
angles[PITCH] = -angles[PITCH]; // stupid quake bug
|
||||||
|
|
||||||
// don't rotate clients, only aim
|
// don't rotate clients, only aim
|
||||||
@@ -1324,7 +1324,7 @@ R_StudioDynamicLight
|
|||||||
*/
|
*/
|
||||||
void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
|
void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
|
||||||
{
|
{
|
||||||
movevars_t *mv = gEngfuncs.pfnGetMoveVars();
|
movevars_t *mv = tr.movevars;
|
||||||
vec3_t lightDir, vecSrc, vecEnd;
|
vec3_t lightDir, vecSrc, vecEnd;
|
||||||
vec3_t origin, dist, finalLight;
|
vec3_t origin, dist, finalLight;
|
||||||
float add, radius, total;
|
float add, radius, total;
|
||||||
@@ -1360,7 +1360,7 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
|
|||||||
msurface_t *psurf = NULL;
|
msurface_t *psurf = NULL;
|
||||||
pmtrace_t trace;
|
pmtrace_t trace;
|
||||||
|
|
||||||
if( FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_WRITE_LARGE_COORD ))
|
if( FBitSet( gp_host->features, ENGINE_WRITE_LARGE_COORD ))
|
||||||
{
|
{
|
||||||
vecEnd[0] = origin[0] - mv->skyvec_x * 65536.0f;
|
vecEnd[0] = origin[0] - mv->skyvec_x * 65536.0f;
|
||||||
vecEnd[1] = origin[1] - mv->skyvec_y * 65536.0f;
|
vecEnd[1] = origin[1] - mv->skyvec_y * 65536.0f;
|
||||||
@@ -1851,7 +1851,7 @@ void R_StudioRenderShadow( int iSprite, float *p1, float *p2, float *p3, float *
|
|||||||
if( !p1 || !p2 || !p3 || !p4 )
|
if( !p1 || !p2 || !p3 || !p4 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( TriSpriteTexture( gEngfuncs.pfnGetModelByIndex( iSprite ), 0 ))
|
if( TriSpriteTexture( CL_ModelHandle( iSprite ), 0 ))
|
||||||
{
|
{
|
||||||
TriRenderMode( kRenderTransAlpha );
|
TriRenderMode( kRenderTransAlpha );
|
||||||
TriColor4f( 0.0f, 0.0f, 0.0f, 1.0f );
|
TriColor4f( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||||
@@ -2242,8 +2242,7 @@ static void R_StudioDrawPoints( void )
|
|||||||
|
|
||||||
g_studio.numverts = g_studio.numelems = 0;
|
g_studio.numverts = g_studio.numelems = 0;
|
||||||
|
|
||||||
// safety bounding the skinnum
|
m_skinnum = RI.currententity->curstate.skin;
|
||||||
m_skinnum = bound( 0, RI.currententity->curstate.skin, ( m_pStudioHeader->numskinfamilies - 1 ));
|
|
||||||
ptexture = (mstudiotexture_t *)((byte *)m_pStudioHeader + m_pStudioHeader->textureindex);
|
ptexture = (mstudiotexture_t *)((byte *)m_pStudioHeader + m_pStudioHeader->textureindex);
|
||||||
pvertbone = ((byte *)m_pStudioHeader + m_pSubModel->vertinfoindex);
|
pvertbone = ((byte *)m_pStudioHeader + m_pSubModel->vertinfoindex);
|
||||||
pnormbone = ((byte *)m_pStudioHeader + m_pSubModel->norminfoindex);
|
pnormbone = ((byte *)m_pStudioHeader + m_pSubModel->norminfoindex);
|
||||||
@@ -2253,7 +2252,8 @@ static void R_StudioDrawPoints( void )
|
|||||||
pstudionorms = (vec3_t *)((byte *)m_pStudioHeader + m_pSubModel->normindex);
|
pstudionorms = (vec3_t *)((byte *)m_pStudioHeader + m_pSubModel->normindex);
|
||||||
|
|
||||||
pskinref = (short *)((byte *)m_pStudioHeader + m_pStudioHeader->skinindex);
|
pskinref = (short *)((byte *)m_pStudioHeader + m_pStudioHeader->skinindex);
|
||||||
if( m_skinnum != 0 ) pskinref += (m_skinnum * m_pStudioHeader->numskinref);
|
if( m_skinnum > 0 && m_skinnum < m_pStudioHeader->numskinfamilies )
|
||||||
|
pskinref += (m_skinnum * m_pStudioHeader->numskinref);
|
||||||
|
|
||||||
if( FBitSet( m_pStudioHeader->flags, STUDIO_HAS_BONEWEIGHTS ) && m_pSubModel->blendvertinfoindex != 0 && m_pSubModel->blendnorminfoindex != 0 )
|
if( FBitSet( m_pStudioHeader->flags, STUDIO_HAS_BONEWEIGHTS ) && m_pSubModel->blendvertinfoindex != 0 && m_pSubModel->blendnorminfoindex != 0 )
|
||||||
{
|
{
|
||||||
@@ -2488,7 +2488,7 @@ static void R_StudioDrawAbsBBox( void )
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
// looks ugly, skip
|
// looks ugly, skip
|
||||||
if( RI.currententity == gEngfuncs.GetViewModel() )
|
if( RI.currententity == tr.viewent )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( !R_StudioComputeBBox( p ))
|
if( !R_StudioComputeBBox( p ))
|
||||||
@@ -2624,13 +2624,8 @@ R_StudioSetRemapColors
|
|||||||
*/
|
*/
|
||||||
static void R_StudioSetRemapColors( int newTop, int newBottom )
|
static void R_StudioSetRemapColors( int newTop, int newBottom )
|
||||||
{
|
{
|
||||||
gEngfuncs.CL_AllocRemapInfo( RI.currententity, RI.currentmodel, newTop, newBottom );
|
if( gEngfuncs.CL_EntitySetRemapColors( RI.currententity, RI.currentmodel, newTop, newBottom ))
|
||||||
|
|
||||||
if( gEngfuncs.CL_GetRemapInfoForEntity( RI.currententity ))
|
|
||||||
{
|
|
||||||
gEngfuncs.CL_UpdateRemapInfo( RI.currententity, newTop, newBottom );
|
|
||||||
m_fDoRemap = true;
|
m_fDoRemap = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_StudioResetPlayerModels( void )
|
void R_StudioResetPlayerModels( void )
|
||||||
@@ -2761,7 +2756,7 @@ static void R_StudioClientEvents( void )
|
|||||||
|
|
||||||
ClearBits( e->curstate.effects, EF_MUZZLEFLASH );
|
ClearBits( e->curstate.effects, EF_MUZZLEFLASH );
|
||||||
VectorCopy( e->attachment[0], el->origin );
|
VectorCopy( e->attachment[0], el->origin );
|
||||||
el->die = gpGlobals->time + 0.05f;
|
el->die = gp_cl->time + 0.05f;
|
||||||
el->color.r = 255;
|
el->color.r = 255;
|
||||||
el->color.g = 192;
|
el->color.g = 192;
|
||||||
el->color.b = 64;
|
el->color.b = 64;
|
||||||
@@ -2777,7 +2772,7 @@ static void R_StudioClientEvents( void )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
end = R_StudioEstimateFrame( e, pseqdesc, g_studio.time );
|
end = R_StudioEstimateFrame( e, pseqdesc, g_studio.time );
|
||||||
start = end - e->curstate.framerate * gpGlobals->frametime * pseqdesc->fps;
|
start = end - e->curstate.framerate * gp_host->frametime * pseqdesc->fps;
|
||||||
pevent = (mstudioevent_t *)((byte *)m_pStudioHeader + pseqdesc->eventindex);
|
pevent = (mstudioevent_t *)((byte *)m_pStudioHeader + pseqdesc->eventindex);
|
||||||
|
|
||||||
if( e->latched.sequencetime == e->curstate.animtime )
|
if( e->latched.sequencetime == e->curstate.animtime )
|
||||||
@@ -3302,7 +3297,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
|
|||||||
|
|
||||||
m_nPlayerIndex = pplayer->number - 1;
|
m_nPlayerIndex = pplayer->number - 1;
|
||||||
|
|
||||||
if( m_nPlayerIndex < 0 || m_nPlayerIndex >= ENGINE_GET_PARM( PARM_MAX_CLIENTS ) )
|
if( m_nPlayerIndex < 0 || m_nPlayerIndex >= gp_cl->maxclients )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
RI.currentmodel = R_StudioSetupPlayerModel( m_nPlayerIndex );
|
RI.currentmodel = R_StudioSetupPlayerModel( m_nPlayerIndex );
|
||||||
@@ -3371,7 +3366,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
|
|||||||
// copy attachments into global entity array
|
// copy attachments into global entity array
|
||||||
if( RI.currententity->index > 0 )
|
if( RI.currententity->index > 0 )
|
||||||
{
|
{
|
||||||
cl_entity_t *ent = gEngfuncs.GetEntityByIndex( RI.currententity->index );
|
cl_entity_t *ent = CL_GetEntityByIndex( RI.currententity->index );
|
||||||
memcpy( ent->attachment, RI.currententity->attachment, sizeof( vec3_t ) * 4 );
|
memcpy( ent->attachment, RI.currententity->attachment, sizeof( vec3_t ) * 4 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3384,7 +3379,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
|
|||||||
RI.currententity->curstate.body = 255;
|
RI.currententity->curstate.body = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !( !gpGlobals->developer && ENGINE_GET_PARM( PARM_MAX_CLIENTS ) == 1 ) && ( RI.currentmodel == RI.currententity->model ))
|
if( !( !gpGlobals->developer && gp_cl->maxclients == 1 ) && ( RI.currentmodel == RI.currententity->model ))
|
||||||
RI.currententity->curstate.body = 1; // force helmet
|
RI.currententity->curstate.body = 1; // force helmet
|
||||||
|
|
||||||
lighting.plightvec = dir;
|
lighting.plightvec = dir;
|
||||||
@@ -3414,7 +3409,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
|
|||||||
if( pplayer->weaponmodel )
|
if( pplayer->weaponmodel )
|
||||||
{
|
{
|
||||||
cl_entity_t saveent = *RI.currententity;
|
cl_entity_t saveent = *RI.currententity;
|
||||||
model_t *pweaponmodel = gEngfuncs.pfnGetModelByIndex( pplayer->weaponmodel );
|
model_t *pweaponmodel = CL_ModelHandle( pplayer->weaponmodel );
|
||||||
|
|
||||||
m_pStudioHeader = (studiohdr_t *)gEngfuncs.Mod_Extradata( mod_studio, pweaponmodel );
|
m_pStudioHeader = (studiohdr_t *)gEngfuncs.Mod_Extradata( mod_studio, pweaponmodel );
|
||||||
|
|
||||||
@@ -3447,7 +3442,7 @@ static int R_StudioDrawModel( int flags )
|
|||||||
int result;
|
int result;
|
||||||
|
|
||||||
if( RI.currententity->curstate.renderamt <= 0 ||
|
if( RI.currententity->curstate.renderamt <= 0 ||
|
||||||
RI.currententity->curstate.renderamt > ENGINE_GET_PARM( PARM_MAX_CLIENTS ) )
|
RI.currententity->curstate.renderamt > gp_cl->maxclients )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// get copy of player
|
// get copy of player
|
||||||
@@ -3500,7 +3495,7 @@ static int R_StudioDrawModel( int flags )
|
|||||||
// copy attachments into global entity array
|
// copy attachments into global entity array
|
||||||
if( RI.currententity->index > 0 )
|
if( RI.currententity->index > 0 )
|
||||||
{
|
{
|
||||||
cl_entity_t *ent = gEngfuncs.GetEntityByIndex( RI.currententity->index );
|
cl_entity_t *ent = CL_GetEntityByIndex( RI.currententity->index );
|
||||||
memcpy( ent->attachment, RI.currententity->attachment, sizeof( vec3_t ) * 4 );
|
memcpy( ent->attachment, RI.currententity->attachment, sizeof( vec3_t ) * 4 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3532,7 +3527,7 @@ static int R_StudioDrawModel( int flags )
|
|||||||
R_StudioDrawModelInternal
|
R_StudioDrawModelInternal
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void R_StudioDrawModelInternal( cl_entity_t *e, int flags )
|
static void R_StudioDrawModelInternal( cl_entity_t *e, int flags )
|
||||||
{
|
{
|
||||||
if( !RI.drawWorld )
|
if( !RI.drawWorld )
|
||||||
{
|
{
|
||||||
@@ -3565,22 +3560,42 @@ void R_DrawStudioModel( cl_entity_t *e )
|
|||||||
{
|
{
|
||||||
R_StudioDrawModelInternal( e, STUDIO_RENDER|STUDIO_EVENTS );
|
R_StudioDrawModelInternal( e, STUDIO_RENDER|STUDIO_EVENTS );
|
||||||
}
|
}
|
||||||
else
|
else if( e->curstate.movetype == MOVETYPE_FOLLOW && e->curstate.aiment > 0 )
|
||||||
{
|
{
|
||||||
if( e->curstate.movetype == MOVETYPE_FOLLOW && e->curstate.aiment > 0 )
|
cl_entity_t *parent = CL_GetEntityByIndex( e->curstate.aiment ), **entities;
|
||||||
{
|
uint i, num_entities;
|
||||||
cl_entity_t *parent = gEngfuncs.GetEntityByIndex( e->curstate.aiment );
|
|
||||||
|
|
||||||
if( parent && parent->model && parent->model->type == mod_studio )
|
if( !parent || !parent->model || parent->model->type != mod_studio )
|
||||||
{
|
return;
|
||||||
RI.currententity = parent;
|
|
||||||
R_StudioDrawModelInternal( RI.currententity, 0 );
|
if( R_OpaqueEntity( parent ))
|
||||||
VectorCopy( parent->curstate.origin, e->curstate.origin );
|
{
|
||||||
VectorCopy( parent->origin, e->origin );
|
entities = tr.draw_list->solid_entities;
|
||||||
RI.currententity = e;
|
num_entities = tr.draw_list->num_solid_entities;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entities = tr.draw_list->trans_entities;
|
||||||
|
num_entities = tr.draw_list->num_solid_entities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for( i = 0; i < num_entities; i++ )
|
||||||
|
{
|
||||||
|
if( (*entities)[i].index != e->curstate.aiment )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
RI.currententity = &(*entities)[i];
|
||||||
|
R_StudioDrawModelInternal( RI.currententity, 0 );
|
||||||
|
VectorCopy( RI.currententity->curstate.origin, e->curstate.origin );
|
||||||
|
VectorCopy( RI.currententity->origin, e->origin );
|
||||||
|
RI.currententity = e;
|
||||||
|
|
||||||
|
R_StudioDrawModelInternal( e, STUDIO_RENDER|STUDIO_EVENTS );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
R_StudioDrawModelInternal( e, STUDIO_RENDER|STUDIO_EVENTS );
|
R_StudioDrawModelInternal( e, STUDIO_RENDER|STUDIO_EVENTS );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3605,14 +3620,14 @@ void R_RunViewmodelEvents( void )
|
|||||||
if( !RP_NORMALPASS() || ENGINE_GET_PARM( PARM_LOCAL_HEALTH ) <= 0 || !CL_IsViewEntityLocalPlayer())
|
if( !RP_NORMALPASS() || ENGINE_GET_PARM( PARM_LOCAL_HEALTH ) <= 0 || !CL_IsViewEntityLocalPlayer())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RI.currententity = gEngfuncs.GetViewModel();
|
RI.currententity = tr.viewent;
|
||||||
|
|
||||||
if( !RI.currententity->model || RI.currententity->model->type != mod_studio )
|
if( !RI.currententity->model || RI.currententity->model->type != mod_studio )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
R_StudioSetupTimings();
|
R_StudioSetupTimings();
|
||||||
|
|
||||||
gEngfuncs.GetPredictedOrigin( simorg );
|
VectorCopy( gp_cl->simorg, simorg );
|
||||||
for( i = 0; i < 4; i++ )
|
for( i = 0; i < 4; i++ )
|
||||||
VectorCopy( simorg, RI.currententity->attachment[i] );
|
VectorCopy( simorg, RI.currententity->attachment[i] );
|
||||||
RI.currentmodel = RI.currententity->model;
|
RI.currentmodel = RI.currententity->model;
|
||||||
@@ -3627,7 +3642,7 @@ R_GatherPlayerLight
|
|||||||
*/
|
*/
|
||||||
void R_GatherPlayerLight( void )
|
void R_GatherPlayerLight( void )
|
||||||
{
|
{
|
||||||
cl_entity_t *view = gEngfuncs.GetViewModel();
|
cl_entity_t *view = tr.viewent;
|
||||||
colorVec c;
|
colorVec c;
|
||||||
|
|
||||||
tr.ignore_lightgamma = true;
|
tr.ignore_lightgamma = true;
|
||||||
@@ -3643,7 +3658,7 @@ R_DrawViewModel
|
|||||||
*/
|
*/
|
||||||
void R_DrawViewModel( void )
|
void R_DrawViewModel( void )
|
||||||
{
|
{
|
||||||
cl_entity_t *view = gEngfuncs.GetViewModel();
|
cl_entity_t *view = tr.viewent;
|
||||||
|
|
||||||
R_GatherPlayerLight();
|
R_GatherPlayerLight();
|
||||||
|
|
||||||
@@ -3761,7 +3776,7 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture
|
|||||||
gEngfuncs.Image_SetMDLPointer((byte *)phdr + ptexture->index);
|
gEngfuncs.Image_SetMDLPointer((byte *)phdr + ptexture->index);
|
||||||
size = sizeof( mstudiotexture_t ) + ptexture->width * ptexture->height + 768;
|
size = sizeof( mstudiotexture_t ) + ptexture->width * ptexture->height + 768;
|
||||||
|
|
||||||
if( FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_IMPROVED_LINETRACE ) && FBitSet( ptexture->flags, STUDIO_NF_MASKED ))
|
if( FBitSet( gp_host->features, ENGINE_IMPROVED_LINETRACE ) && FBitSet( ptexture->flags, STUDIO_NF_MASKED ))
|
||||||
flags |= TF_KEEP_SOURCE; // Paranoia2 texture alpha-tracing
|
flags |= TF_KEEP_SOURCE; // Paranoia2 texture alpha-tracing
|
||||||
|
|
||||||
// build the texname
|
// build the texname
|
||||||
@@ -3828,7 +3843,9 @@ void Mod_StudioUnloadTextures( void *data )
|
|||||||
|
|
||||||
static model_t *pfnModelHandle( int modelindex )
|
static model_t *pfnModelHandle( int modelindex )
|
||||||
{
|
{
|
||||||
return gEngfuncs.pfnGetModelByIndex( modelindex );
|
if( modelindex < 0 || modelindex >= MAX_MODELS )
|
||||||
|
return NULL;
|
||||||
|
return CL_ModelHandle( modelindex );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *pfnMod_CacheCheck( struct cache_user_s *c )
|
static void *pfnMod_CacheCheck( struct cache_user_s *c )
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ void R_AddSkyBoxSurface( msurface_t *fa )
|
|||||||
float *v;
|
float *v;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( ENGINE_GET_PARM( PARM_SKY_SPHERE ) && fa->polys && !tr.fCustomSkybox )
|
if( FBitSet( tr.world->flags, FWORLD_SKYSPHERE ) && fa->polys && !FBitSet( tr.world->flags, FWORLD_CUSTOM_SKYBOX ))
|
||||||
{
|
{
|
||||||
glpoly_t *p = fa->polys;
|
glpoly_t *p = fa->polys;
|
||||||
|
|
||||||
@@ -376,7 +376,7 @@ void R_UnloadSkybox( void )
|
|||||||
tr.skyboxbasenum = SKYBOX_BASE_NUM; // set skybox base (to let some mods load hi-res skyboxes)
|
tr.skyboxbasenum = SKYBOX_BASE_NUM; // set skybox base (to let some mods load hi-res skyboxes)
|
||||||
|
|
||||||
memset( tr.skyboxTextures, 0, sizeof( tr.skyboxTextures ));
|
memset( tr.skyboxTextures, 0, sizeof( tr.skyboxTextures ));
|
||||||
tr.fCustomSkybox = false;
|
ClearBits( tr.world->flags, FWORLD_CUSTOM_SKYBOX );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -478,7 +478,7 @@ void R_SetupSky( const char *skyboxname )
|
|||||||
|
|
||||||
if( i == 6 )
|
if( i == 6 )
|
||||||
{
|
{
|
||||||
tr.fCustomSkybox = true;
|
SetBits( tr.world->flags, FWORLD_CUSTOM_SKYBOX );
|
||||||
gEngfuncs.Con_DPrintf( "done\n" );
|
gEngfuncs.Con_DPrintf( "done\n" );
|
||||||
return; // loaded
|
return; // loaded
|
||||||
}
|
}
|
||||||
@@ -526,7 +526,7 @@ static void R_CloudTexCoord( vec3_t v, float speed, float *s, float *t )
|
|||||||
float length, speedscale;
|
float length, speedscale;
|
||||||
vec3_t dir;
|
vec3_t dir;
|
||||||
|
|
||||||
speedscale = gpGlobals->time * speed;
|
speedscale = gp_cl->time * speed;
|
||||||
speedscale -= (int)speedscale & ~127;
|
speedscale -= (int)speedscale & ~127;
|
||||||
|
|
||||||
VectorSubtract( v, RI.vieworg, dir );
|
VectorSubtract( v, RI.vieworg, dir );
|
||||||
@@ -813,8 +813,8 @@ void EmitWaterPolys( msurface_t *warp, qboolean reverse )
|
|||||||
{
|
{
|
||||||
if( waveHeight )
|
if( waveHeight )
|
||||||
{
|
{
|
||||||
nv = r_turbsin[(int)(gpGlobals->time * 160.0f + v[1] + v[0]) & 255] + 8.0f;
|
nv = r_turbsin[(int)(gp_cl->time * 160.0f + v[1] + v[0]) & 255] + 8.0f;
|
||||||
nv = (r_turbsin[(int)(v[0] * 5.0f + gpGlobals->time * 171.0f - v[1]) & 255] + 8.0f ) * 0.8f + nv;
|
nv = (r_turbsin[(int)(v[0] * 5.0f + gp_cl->time * 171.0f - v[1]) & 255] + 8.0f ) * 0.8f + nv;
|
||||||
nv = nv * waveHeight + v[2];
|
nv = nv * waveHeight + v[2];
|
||||||
}
|
}
|
||||||
else nv = v[2];
|
else nv = v[2];
|
||||||
@@ -824,8 +824,8 @@ void EmitWaterPolys( msurface_t *warp, qboolean reverse )
|
|||||||
|
|
||||||
if( !r_ripple.value )
|
if( !r_ripple.value )
|
||||||
{
|
{
|
||||||
s = os + r_turbsin[(int)((ot * 0.125f + gpGlobals->time) * TURBSCALE) & 255];
|
s = os + r_turbsin[(int)((ot * 0.125f + gp_cl->time) * TURBSCALE) & 255];
|
||||||
t = ot + r_turbsin[(int)((os * 0.125f + gpGlobals->time) * TURBSCALE) & 255];
|
t = ot + r_turbsin[(int)((os * 0.125f + gp_cl->time) * TURBSCALE) & 255];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -865,7 +865,7 @@ void R_ResetRipples( void )
|
|||||||
{
|
{
|
||||||
g_ripple.curbuf = g_ripple.buf[0];
|
g_ripple.curbuf = g_ripple.buf[0];
|
||||||
g_ripple.oldbuf = g_ripple.buf[1];
|
g_ripple.oldbuf = g_ripple.buf[1];
|
||||||
g_ripple.time = g_ripple.oldtime = gpGlobals->time - 0.1;
|
g_ripple.time = g_ripple.oldtime = gp_cl->time - 0.1;
|
||||||
memset( g_ripple.buf, 0, sizeof( g_ripple.buf ));
|
memset( g_ripple.buf, 0, sizeof( g_ripple.buf ));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -936,14 +936,14 @@ static int MostSignificantBit( unsigned int v )
|
|||||||
|
|
||||||
void R_AnimateRipples( void )
|
void R_AnimateRipples( void )
|
||||||
{
|
{
|
||||||
double frametime = gpGlobals->time - g_ripple.time;
|
double frametime = gp_cl->time - g_ripple.time;
|
||||||
|
|
||||||
g_ripple.update = r_ripple.value && frametime >= r_ripple_updatetime.value;
|
g_ripple.update = r_ripple.value && frametime >= r_ripple_updatetime.value;
|
||||||
|
|
||||||
if( !g_ripple.update )
|
if( !g_ripple.update )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_ripple.time = gpGlobals->time;
|
g_ripple.time = gp_cl->time;
|
||||||
|
|
||||||
R_SwapBufs();
|
R_SwapBufs();
|
||||||
|
|
||||||
|
|||||||
@@ -611,7 +611,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime )
|
|||||||
if( pnew )
|
if( pnew )
|
||||||
{
|
{
|
||||||
VectorCopy( pbeam->source, pnew->org );
|
VectorCopy( pbeam->source, pnew->org );
|
||||||
pnew->die = gpGlobals->time + pbeam->amplitude;
|
pnew->die = gp_cl->time + pbeam->amplitude;
|
||||||
VectorClear( pnew->vel );
|
VectorClear( pnew->vel );
|
||||||
|
|
||||||
pnew->next = particles;
|
pnew->next = particles;
|
||||||
@@ -658,7 +658,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime )
|
|||||||
VectorMA( delta, -pbeam->width, normal, last2 );
|
VectorMA( delta, -pbeam->width, normal, last2 );
|
||||||
|
|
||||||
div = 1.0f / pbeam->amplitude;
|
div = 1.0f / pbeam->amplitude;
|
||||||
fraction = ( pbeam->die - gpGlobals->time ) * div;
|
fraction = ( pbeam->die - gp_cl->time ) * div;
|
||||||
|
|
||||||
vLast = 0.0f;
|
vLast = 0.0f;
|
||||||
vStep = 1.0f;
|
vStep = 1.0f;
|
||||||
@@ -694,7 +694,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime )
|
|||||||
|
|
||||||
if( particles->next != NULL )
|
if( particles->next != NULL )
|
||||||
{
|
{
|
||||||
fraction = (particles->die - gpGlobals->time) * div;
|
fraction = (particles->die - gp_cl->time) * div;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -880,12 +880,8 @@ static qboolean R_BeamComputePoint( int beamEnt, vec3_t pt )
|
|||||||
// get attachment
|
// get attachment
|
||||||
if( attach > 0 )
|
if( attach > 0 )
|
||||||
VectorCopy( ent->attachment[attach - 1], pt );
|
VectorCopy( ent->attachment[attach - 1], pt );
|
||||||
else if( ent->index == ENGINE_GET_PARM( PARM_PLAYER_INDEX ) )
|
else if( ent->index == ( gp_cl->playernum + 1 ))
|
||||||
{
|
VectorCopy( gp_cl->simorg, pt );
|
||||||
vec3_t simorg;
|
|
||||||
gEngfuncs.GetPredictedOrigin( simorg );
|
|
||||||
VectorCopy( simorg, pt );
|
|
||||||
}
|
|
||||||
else VectorCopy( ent->origin, pt );
|
else VectorCopy( ent->origin, pt );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -929,7 +925,7 @@ qboolean R_BeamRecomputeEndpoints( BEAM *pbeam )
|
|||||||
else if( !FBitSet( pbeam->flags, FBEAM_FOREVER ))
|
else if( !FBitSet( pbeam->flags, FBEAM_FOREVER ))
|
||||||
{
|
{
|
||||||
ClearBits( pbeam->flags, FBEAM_ENDENTITY );
|
ClearBits( pbeam->flags, FBEAM_ENDENTITY );
|
||||||
pbeam->die = gpGlobals->time;
|
pbeam->die = gp_cl->time;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -956,13 +952,13 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
|
|||||||
model_t *model;
|
model_t *model;
|
||||||
vec3_t delta;
|
vec3_t delta;
|
||||||
|
|
||||||
model = gEngfuncs.pfnGetModelByIndex( pbeam->modelIndex );
|
model = CL_ModelHandle( pbeam->modelIndex );
|
||||||
SetBits( pbeam->flags, FBEAM_ISACTIVE );
|
SetBits( pbeam->flags, FBEAM_ISACTIVE );
|
||||||
|
|
||||||
if( !model || model->type != mod_sprite )
|
if( !model || model->type != mod_sprite )
|
||||||
{
|
{
|
||||||
pbeam->flags &= ~FBEAM_ISACTIVE; // force to ignore
|
pbeam->flags &= ~FBEAM_ISACTIVE; // force to ignore
|
||||||
pbeam->die = gpGlobals->time;
|
pbeam->die = gp_cl->time;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1020,7 +1016,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
|
|||||||
if( pbeam->flags & ( FBEAM_FADEIN|FBEAM_FADEOUT ))
|
if( pbeam->flags & ( FBEAM_FADEIN|FBEAM_FADEOUT ))
|
||||||
{
|
{
|
||||||
// update life cycle
|
// update life cycle
|
||||||
pbeam->t = pbeam->freq + ( pbeam->die - gpGlobals->time );
|
pbeam->t = pbeam->freq + ( pbeam->die - gp_cl->time );
|
||||||
if( pbeam->t != 0.0f ) pbeam->t = 1.0f - pbeam->freq / pbeam->t;
|
if( pbeam->t != 0.0f ) pbeam->t = 1.0f - pbeam->freq / pbeam->t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1068,7 +1064,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
|
|||||||
|
|
||||||
TriRenderMode( FBitSet( pbeam->flags, FBEAM_SOLID ) ? kRenderNormal : kRenderTransAdd );
|
TriRenderMode( FBitSet( pbeam->flags, FBEAM_SOLID ) ? kRenderNormal : kRenderTransAdd );
|
||||||
|
|
||||||
if( !TriSpriteTexture( model, (int)(pbeam->frame + pbeam->frameRate * gpGlobals->time) % pbeam->frameCount ))
|
if( !TriSpriteTexture( model, (int)(pbeam->frame + pbeam->frameRate * gp_cl->time) % pbeam->frameCount ))
|
||||||
{
|
{
|
||||||
ClearBits( pbeam->flags, FBEAM_ISACTIVE );
|
ClearBits( pbeam->flags, FBEAM_ISACTIVE );
|
||||||
return;
|
return;
|
||||||
@@ -1159,7 +1155,7 @@ passed through this
|
|||||||
*/
|
*/
|
||||||
static void R_BeamSetup( BEAM *pbeam, vec3_t start, vec3_t end, int modelIndex, float life, float width, float amplitude, float brightness, float speed )
|
static void R_BeamSetup( BEAM *pbeam, vec3_t start, vec3_t end, int modelIndex, float life, float width, float amplitude, float brightness, float speed )
|
||||||
{
|
{
|
||||||
model_t *sprite = gEngfuncs.pfnGetModelByIndex( modelIndex );
|
model_t *sprite = CL_ModelHandle( modelIndex );
|
||||||
|
|
||||||
if( !sprite ) return;
|
if( !sprite ) return;
|
||||||
|
|
||||||
@@ -1173,8 +1169,8 @@ static void R_BeamSetup( BEAM *pbeam, vec3_t start, vec3_t end, int modelIndex,
|
|||||||
VectorCopy( end, pbeam->target );
|
VectorCopy( end, pbeam->target );
|
||||||
VectorSubtract( end, start, pbeam->delta );
|
VectorSubtract( end, start, pbeam->delta );
|
||||||
|
|
||||||
pbeam->freq = speed * gpGlobals->time;
|
pbeam->freq = speed * gp_cl->time;
|
||||||
pbeam->die = life + gpGlobals->time;
|
pbeam->die = life + gp_cl->time;
|
||||||
pbeam->amplitude = amplitude;
|
pbeam->amplitude = amplitude;
|
||||||
pbeam->brightness = brightness;
|
pbeam->brightness = brightness;
|
||||||
pbeam->width = width;
|
pbeam->width = width;
|
||||||
@@ -1304,7 +1300,7 @@ void GAME_EXPORT CL_DrawBeams( int fTrans, BEAM *active_beams )
|
|||||||
if( !fTrans && !FBitSet( pBeam->flags, FBEAM_SOLID ))
|
if( !fTrans && !FBitSet( pBeam->flags, FBEAM_SOLID ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
R_BeamDraw( pBeam, gpGlobals->time - gpGlobals->oldtime );
|
R_BeamDraw( pBeam, gp_cl->time - gp_cl->oldtime );
|
||||||
}
|
}
|
||||||
|
|
||||||
//pglShadeModel( GL_FLAT );
|
//pglShadeModel( GL_FLAT );
|
||||||
|
|||||||
@@ -949,8 +949,8 @@ void R_RenderWorld (void)
|
|||||||
c_drawnode=0;
|
c_drawnode=0;
|
||||||
|
|
||||||
// auto cycle the world frame for texture animation
|
// auto cycle the world frame for texture animation
|
||||||
RI.currententity = gEngfuncs.GetEntityByIndex(0);
|
RI.currententity = CL_GetEntityByIndex(0);
|
||||||
//RI.currententity->frame = (int)(gpGlobals->time*2);
|
//RI.currententity->frame = (int)(gp_cl->time*2);
|
||||||
|
|
||||||
VectorCopy (RI.vieworg, tr.modelorg);
|
VectorCopy (RI.vieworg, tr.modelorg);
|
||||||
RI.currentmodel = WORLDMODEL;
|
RI.currentmodel = WORLDMODEL;
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
ref_api_t gEngfuncs;
|
ref_api_t gEngfuncs;
|
||||||
ref_globals_t *gpGlobals;
|
ref_globals_t *gpGlobals;
|
||||||
|
ref_client_t *gp_cl;
|
||||||
|
ref_host_t *gp_host;
|
||||||
gl_globals_t tr;
|
gl_globals_t tr;
|
||||||
ref_speeds_t r_stats;
|
ref_speeds_t r_stats;
|
||||||
poolhandle_t r_temppool;
|
poolhandle_t r_temppool;
|
||||||
@@ -169,7 +171,7 @@ static int GL_RefGetParm( int parm, int arg )
|
|||||||
case PARM_STENCIL_ACTIVE:
|
case PARM_STENCIL_ACTIVE:
|
||||||
return 0; //glState.stencilEnabled;
|
return 0; //glState.stencilEnabled;
|
||||||
case PARM_SKY_SPHERE:
|
case PARM_SKY_SPHERE:
|
||||||
return ENGINE_GET_PARM_( parm, arg ) && !tr.fCustomSkybox;
|
return 0; // ref_soft doesn't support sky sphere
|
||||||
default:
|
default:
|
||||||
return ENGINE_GET_PARM_( parm, arg );
|
return ENGINE_GET_PARM_( parm, arg );
|
||||||
}
|
}
|
||||||
@@ -273,9 +275,15 @@ void Mod_UnloadTextures( model_t *mod )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GAME_EXPORT R_ProcessEntData( qboolean allocate )
|
void GAME_EXPORT R_ProcessEntData( qboolean allocate, cl_entity_t *entities, unsigned int max_entities )
|
||||||
{
|
{
|
||||||
|
tr.entities = entities;
|
||||||
|
tr.max_entities = max_entities;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GAME_EXPORT R_Flush( unsigned int flags )
|
||||||
|
{
|
||||||
|
// stub
|
||||||
}
|
}
|
||||||
|
|
||||||
// stubs
|
// stubs
|
||||||
@@ -425,6 +433,7 @@ ref_interface_t gReffuncs =
|
|||||||
R_AddEntity,
|
R_AddEntity,
|
||||||
CL_AddCustomBeam,
|
CL_AddCustomBeam,
|
||||||
R_ProcessEntData,
|
R_ProcessEntData,
|
||||||
|
R_Flush,
|
||||||
|
|
||||||
R_ShowTextures,
|
R_ShowTextures,
|
||||||
|
|
||||||
@@ -557,5 +566,8 @@ int EXPORT GAME_EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t
|
|||||||
memcpy( &gEngfuncs, engfuncs, sizeof( ref_api_t ));
|
memcpy( &gEngfuncs, engfuncs, sizeof( ref_api_t ));
|
||||||
gpGlobals = globals;
|
gpGlobals = globals;
|
||||||
|
|
||||||
|
gp_cl = (ref_client_t *)ENGINE_GET_PARM( PARM_GET_CLIENT_PTR );
|
||||||
|
gp_host = (ref_host_t *)ENGINE_GET_PARM( PARM_GET_HOST_PTR );
|
||||||
|
|
||||||
return REF_API_VERSION;
|
return REF_API_VERSION;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -774,14 +774,14 @@ void GAME_EXPORT R_DecalShoot( int textureIndex, int entityIndex, int modelIndex
|
|||||||
|
|
||||||
if( entityIndex > 0 )
|
if( entityIndex > 0 )
|
||||||
{
|
{
|
||||||
ent = gEngfuncs.GetEntityByIndex( entityIndex );
|
ent = CL_GetEntityByIndex( entityIndex );
|
||||||
|
|
||||||
if( modelIndex > 0 ) model = gEngfuncs.pfnGetModelByIndex( modelIndex );
|
if( modelIndex > 0 ) model = CL_ModelHandle( modelIndex );
|
||||||
else if( ent != NULL ) model = gEngfuncs.pfnGetModelByIndex( ent->curstate.modelindex );
|
else if( ent != NULL ) model = CL_ModelHandle( ent->curstate.modelindex );
|
||||||
else return;
|
else return;
|
||||||
}
|
}
|
||||||
else if( modelIndex > 0 )
|
else if( modelIndex > 0 )
|
||||||
model = gEngfuncs.pfnGetModelByIndex( modelIndex );
|
model = CL_ModelHandle( modelIndex );
|
||||||
else model = WORLDMODEL;
|
else model = WORLDMODEL;
|
||||||
|
|
||||||
if( !model ) return;
|
if( !model ) return;
|
||||||
|
|||||||
@@ -864,9 +864,9 @@ void D_CalcGradients (msurface_t *pface)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if(pface->flags & SURF_DRAWTURB)
|
if(pface->flags & SURF_DRAWTURB)
|
||||||
sadjust += 0x10000 * (-128 * ( (gpGlobals->time * 0.25f) - (int)(gpGlobals->time * 0.25f) ));
|
sadjust += 0x10000 * (-128 * ( (gp_cl->time * 0.25f) - (int)(gp_cl->time * 0.25f) ));
|
||||||
else
|
else
|
||||||
sadjust += 0x10000 * (-128 * ( (gpGlobals->time * 0.77f) - (int)(gpGlobals->time * 0.77f) ));
|
sadjust += 0x10000 * (-128 * ( (gp_cl->time * 0.77f) - (int)(gp_cl->time * 0.77f) ));
|
||||||
bbextents = ((pface->extents[0] << 16) >> miplevel) - 1;
|
bbextents = ((pface->extents[0] << 16) >> miplevel) - 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1118,7 +1118,7 @@ void D_SolidSurf (surf_t *s)
|
|||||||
{
|
{
|
||||||
if( alphaspans )
|
if( alphaspans )
|
||||||
return;
|
return;
|
||||||
RI.currententity = gEngfuncs.GetEntityByIndex(0); //r_worldentity;
|
RI.currententity = CL_GetEntityByIndex(0); //r_worldentity;
|
||||||
tr.modelviewIdentity = true;
|
tr.modelviewIdentity = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ void GAME_EXPORT CL_RunLightStyles( void )
|
|||||||
{
|
{
|
||||||
int i, k, flight, clight;
|
int i, k, flight, clight;
|
||||||
float l, lerpfrac, backlerp;
|
float l, lerpfrac, backlerp;
|
||||||
float frametime = (gpGlobals->time - gpGlobals->oldtime);
|
float frametime = (gp_cl->time - gp_cl->oldtime);
|
||||||
float scale;
|
float scale;
|
||||||
lightstyle_t *ls;
|
lightstyle_t *ls;
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ void GAME_EXPORT CL_RunLightStyles( void )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !ENGINE_GET_PARM( PARAM_GAMEPAUSED ) && frametime <= 0.1f )
|
if( !gp_cl->paused && frametime <= 0.1f )
|
||||||
ls->time += frametime; // evaluate local time
|
ls->time += frametime; // evaluate local time
|
||||||
|
|
||||||
flight = (int)Q_floor( ls->time * 10 );
|
flight = (int)Q_floor( ls->time * 10 );
|
||||||
@@ -155,7 +155,7 @@ void R_PushDlights( void )
|
|||||||
|
|
||||||
tr.dlightframecount = tr.framecount;
|
tr.dlightframecount = tr.framecount;
|
||||||
|
|
||||||
RI.currententity = gEngfuncs.GetEntityByIndex( 0 );
|
RI.currententity = CL_GetEntityByIndex( 0 );
|
||||||
if( RI.currententity )
|
if( RI.currententity )
|
||||||
RI.currentmodel = RI.currententity->model;
|
RI.currentmodel = RI.currententity->model;
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ void R_PushDlights( void )
|
|||||||
{
|
{
|
||||||
l = gEngfuncs.GetDynamicLight( i );
|
l = gEngfuncs.GetDynamicLight( i );
|
||||||
|
|
||||||
if( l->die < gpGlobals->time || !l->radius )
|
if( l->die < gp_cl->time || !l->radius )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//if( GL_FrustumCullSphere( &RI.frustum, l->origin, l->radius, 15 ))
|
//if( GL_FrustumCullSphere( &RI.frustum, l->origin, l->radius, 15 ))
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user