mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-06 04:05:11 +08:00
Compare commits
111 Commits
continuous
...
continuous
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
150d98bd15 | ||
|
|
f162fbd806 | ||
|
|
7d8ea61ac2 | ||
|
|
40041e30eb | ||
|
|
a247e139bf | ||
|
|
00b2ca7f5a | ||
|
|
e58007aab3 | ||
|
|
dca862a838 | ||
|
|
7e71e20714 | ||
|
|
cee6862924 | ||
|
|
a8cc68f6b9 | ||
|
|
2af0adb629 | ||
|
|
628ac376ed | ||
|
|
251e6ac1dc | ||
|
|
9b6518376c | ||
|
|
6c3fee7f27 | ||
|
|
c111a59639 | ||
|
|
ba9bb70924 | ||
|
|
6acc97b0ef | ||
|
|
cd681d4303 | ||
|
|
46f30e215c | ||
|
|
2ae038c01c | ||
|
|
aaa9fbd50f | ||
|
|
51d4716bcb | ||
|
|
045caacfee | ||
|
|
95a5c670a2 | ||
|
|
30259e1573 | ||
|
|
8b884132b7 | ||
|
|
266f9a6bc6 | ||
|
|
58177d9251 | ||
|
|
69e801d6b8 | ||
|
|
388cc3061f | ||
|
|
c9d29b3955 | ||
|
|
371025dc8e | ||
|
|
cf7a79bff3 | ||
|
|
55dfa1bf44 | ||
|
|
519c8a032a | ||
|
|
c15822f375 | ||
|
|
0e91deec19 | ||
|
|
87b204c661 | ||
|
|
caefa0b7b9 | ||
|
|
a311923d4e | ||
|
|
ee4cb39f3e | ||
|
|
18436a70eb | ||
|
|
8298053e6a | ||
|
|
9304a0041d | ||
|
|
64f92003fa | ||
|
|
be0a241244 | ||
|
|
df6546d5b1 | ||
|
|
a0c31120d9 | ||
|
|
c0757bd84c | ||
|
|
9fa32a9cf4 | ||
|
|
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 |
21
.cirrus.yml
21
.cirrus.yml
@@ -1,14 +1,15 @@
|
|||||||
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-4
|
# freebsd_instance:
|
||||||
setup_script:
|
# image_family: freebsd-12-4
|
||||||
- pkg update
|
# setup_script:
|
||||||
- pkg install -y pkgconf git sdl2 python fontconfig opus
|
# - 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
|
||||||
|
|||||||
4
.github/workflows/c-cpp.yml
vendored
4
.github/workflows/c-cpp.yml
vendored
@@ -45,11 +45,11 @@ jobs:
|
|||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
targetos: win32
|
targetos: win32
|
||||||
targetarch: amd64
|
targetarch: amd64
|
||||||
- os: windows-latest
|
- os: windows-2019 # always use the oldest possible for 32-bit because of older compilers, and better support of certain legacy OSes
|
||||||
targetos: win32
|
targetos: win32
|
||||||
targetarch: i386
|
targetarch: i386
|
||||||
env:
|
env:
|
||||||
SDL_VERSION: 2.28.1
|
SDL_VERSION: 2.28.5
|
||||||
GH_CPU_ARCH: ${{ matrix.targetarch }}
|
GH_CPU_ARCH: ${{ matrix.targetarch }}
|
||||||
ANDROID_SDK_TOOLS_VER: 4333796
|
ANDROID_SDK_TOOLS_VER: 4333796
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
2
3rdparty/mainui
vendored
2
3rdparty/mainui
vendored
Submodule 3rdparty/mainui updated: b4bb815420...7223589d60
@@ -240,6 +240,8 @@ CSO-like Xash3D-based mod, CSMoE - https://github.com/MoeMod/CSMoE
|
|||||||
## Crack-Life: Campaign Mode
|
## Crack-Life: Campaign Mode
|
||||||
Recreation by lostgamer aka nillerusr - https://github.com/LostGamerHL/crack_life
|
Recreation by lostgamer aka nillerusr - https://github.com/LostGamerHL/crack_life
|
||||||
|
|
||||||
|
Reverse-engineered code: branch **clcampaign** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/clcampaign
|
||||||
|
|
||||||
## Escape from the Darkness
|
## Escape from the Darkness
|
||||||
malortie's recreation - https://github.com/malortie/hl-eftd
|
malortie's recreation - https://github.com/malortie/hl-eftd
|
||||||
|
|
||||||
|
|||||||
@@ -717,6 +717,7 @@ enum
|
|||||||
kRenderFxExplode, // Scale up really big!
|
kRenderFxExplode, // Scale up really big!
|
||||||
kRenderFxGlowShell, // Glowing Shell
|
kRenderFxGlowShell, // Glowing Shell
|
||||||
kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!)
|
kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!)
|
||||||
|
kRenderFxLightMultiplier,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef int func_t;
|
typedef int func_t;
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ 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
|
// adjust the mask when features will be added or removed
|
||||||
#define ENGINE_FEATURES_MASK \
|
#define ENGINE_FEATURES_MASK \
|
||||||
( ENGINE_WRITE_LARGE_COORD \
|
( ENGINE_WRITE_LARGE_COORD \
|
||||||
@@ -37,6 +39,7 @@ GNU General Public License for more details.
|
|||||||
| ENGINE_COMPENSATE_QUAKE_BUG \
|
| ENGINE_COMPENSATE_QUAKE_BUG \
|
||||||
| ENGINE_IMPROVED_LINETRACE \
|
| ENGINE_IMPROVED_LINETRACE \
|
||||||
| ENGINE_COMPUTE_STUDIO_LERP \
|
| ENGINE_COMPUTE_STUDIO_LERP \
|
||||||
| ENGINE_LINEAR_GAMMA_SPACE )
|
| ENGINE_LINEAR_GAMMA_SPACE \
|
||||||
|
| ENGINE_STEP_POSHISTORY_LERP )
|
||||||
|
|
||||||
#endif//FEATURES_H
|
#endif//FEATURES_H
|
||||||
|
|||||||
@@ -1,18 +1,35 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
/*
|
||||||
//
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
// Purpose:
|
|
||||||
//
|
|
||||||
// $NoKeywords: $
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
#if !defined( KBUTTONH )
|
This program is free software; you can redistribute it and/or
|
||||||
#define KBUTTONH
|
modify it under the terms of the GNU General Public License
|
||||||
#pragma once
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
typedef struct kbutton_s
|
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.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
*/
|
||||||
|
#ifndef KBUTTON_H
|
||||||
|
#define KBUTTON_H
|
||||||
|
|
||||||
|
// a1ba: copied from WinQuake/client.h
|
||||||
|
//
|
||||||
|
// cl_input
|
||||||
|
//
|
||||||
|
typedef struct
|
||||||
{
|
{
|
||||||
int down[2]; // key nums holding it down
|
int down[2]; // key nums holding it down
|
||||||
int state; // low bit is down state
|
int state; // low bit is down state
|
||||||
} kbutton_t;
|
} kbutton_t;
|
||||||
|
|
||||||
#endif // !KBUTTONH
|
STATIC_ASSERT( sizeof( kbutton_t ) == 12, "kbutton_t isn't 12 bytes!" );
|
||||||
|
|
||||||
|
#endif // KBUTTON_H
|
||||||
|
|||||||
106
common/netadr.h
106
common/netadr.h
@@ -1,76 +1,74 @@
|
|||||||
/***
|
/*
|
||||||
*
|
Copyright (C) 1997-2001 Id Software, Inc.
|
||||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
|
||||||
*
|
|
||||||
* This product contains software technology licensed from Id
|
|
||||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use, distribution, and modification of this source code and/or resulting
|
|
||||||
* object code is restricted to non-commercial enhancements to products from
|
|
||||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
|
||||||
* without written permission from Valve LLC.
|
|
||||||
*
|
|
||||||
****/
|
|
||||||
|
|
||||||
#ifndef NETADR_H
|
This program is free software; you can redistribute it and/or
|
||||||
#define NETADR_H
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
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.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NET_ADR_H
|
||||||
|
#define NET_ADR_H
|
||||||
|
|
||||||
#include "build.h"
|
|
||||||
#include STDINT_H
|
#include STDINT_H
|
||||||
|
|
||||||
typedef enum
|
// net.h -- quake's interface to the networking layer
|
||||||
{
|
// a1ba: copied from Quake-2/qcommon/qcommon.h and modified to support IPv6
|
||||||
NA_UNUSED = 0,
|
|
||||||
NA_LOOPBACK,
|
|
||||||
NA_BROADCAST,
|
|
||||||
NA_IP,
|
|
||||||
NA_IPX,
|
|
||||||
NA_BROADCAST_IPX,
|
|
||||||
NA_IP6,
|
|
||||||
NA_MULTICAST_IP6, // all nodes multicast
|
|
||||||
} netadrtype_t;
|
|
||||||
|
|
||||||
// Original structure:
|
#define PORT_ANY -1
|
||||||
// typedef struct netadr_s
|
|
||||||
// {
|
typedef enum {NA_LOOPBACK = 1, NA_BROADCAST, NA_IP, NA_IPX, NA_BROADCAST_IPX, NA_IP6, NA_MULTICAST_IP6} netadrtype_t;
|
||||||
// netadrtype_t type;
|
|
||||||
// unsigned char ip[4];
|
/*
|
||||||
// unsigned char ipx[10];
|
Original Quake-2 structure:
|
||||||
// unsigned short port;
|
typedef struct
|
||||||
// } netadr_t;
|
{
|
||||||
|
netadrtype_t type;
|
||||||
|
|
||||||
|
byte ip[4];
|
||||||
|
byte ipx[10];
|
||||||
|
|
||||||
|
unsigned short port;
|
||||||
|
} netadr_t;
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma pack( push, 1 )
|
#pragma pack( push, 1 )
|
||||||
typedef struct netadr_s
|
typedef struct netadr_s
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
// IPv6 struct
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
uint32_t type;
|
uint16_t type6;
|
||||||
|
uint8_t ip6[16];
|
||||||
|
};
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint32_t type; // must be netadrtype_t but will break with short enums
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
uint8_t ip[4];
|
uint8_t ip[4];
|
||||||
uint32_t ip4;
|
uint32_t ip4; // for easier conversions
|
||||||
};
|
};
|
||||||
uint8_t ipx[10];
|
uint8_t ipx[10];
|
||||||
};
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
#if XASH_LITTLE_ENDIAN
|
|
||||||
uint16_t type6;
|
|
||||||
uint8_t ip6[16];
|
|
||||||
#elif XASH_BIG_ENDIAN
|
|
||||||
uint8_t ip6_0[2];
|
|
||||||
uint16_t type6;
|
|
||||||
uint8_t ip6_2[14];
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
} netadr_t;
|
} netadr_t;
|
||||||
#pragma pack( pop )
|
#pragma pack( pop )
|
||||||
|
|
||||||
STATIC_ASSERT( sizeof( netadr_t ) == 20, "invalid netadr_t size" );
|
STATIC_ASSERT( sizeof( netadr_t ) == 20, "netadr_t isn't 20 bytes!" );
|
||||||
|
|
||||||
#endif//NETADR_H
|
#endif // NET_ADR_H
|
||||||
|
|||||||
@@ -58,9 +58,6 @@ typedef uint64_t longtime_t;
|
|||||||
|
|
||||||
#define BIT( n ) ( 1U << ( n ))
|
#define BIT( n ) ( 1U << ( n ))
|
||||||
#define BIT64( n ) ( 1ULL << ( n ))
|
#define BIT64( n ) ( 1ULL << ( n ))
|
||||||
#define GAMMA ( 2.2f ) // Valve Software gamma
|
|
||||||
#define INVGAMMA ( 1.0f / 2.2f ) // back to 1.0
|
|
||||||
#define TEXGAMMA ( 0.9f ) // compensate dim textures
|
|
||||||
#define SetBits( iBitVector, bits ) ((iBitVector) = (iBitVector) | (bits))
|
#define SetBits( iBitVector, bits ) ((iBitVector) = (iBitVector) | (bits))
|
||||||
#define ClearBits( iBitVector, bits ) ((iBitVector) = (iBitVector) & ~(bits))
|
#define ClearBits( iBitVector, bits ) ((iBitVector) = (iBitVector) & ~(bits))
|
||||||
#define FBitSet( iBitVector, bit ) ((iBitVector) & (bit))
|
#define FBitSet( iBitVector, bit ) ((iBitVector) & (bit))
|
||||||
@@ -121,15 +118,18 @@ typedef uint64_t longtime_t;
|
|||||||
#define likely(x) (x)
|
#define likely(x) (x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __STDC_VERSION >= 202311L || __cplusplus >= 201103L // C23 or C++ static_assert is a keyword
|
#if __STDC_VERSION__ >= 202311L || __cplusplus >= 201103L // C23 or C++ static_assert is a keyword
|
||||||
#define STATIC_ASSERT_ static_assert
|
#define STATIC_ASSERT_( ignore, x, y ) static_assert( x, y )
|
||||||
#define STATIC_ASSERT static_assert
|
#define STATIC_ASSERT static_assert
|
||||||
#elif __STDC_VERSION >= 201112L // in C11 it's _Static_assert
|
#elif __STDC_VERSION__ >= 201112L // in C11 it's _Static_assert
|
||||||
#define STATIC_ASSERT_ _Static_assert
|
#define STATIC_ASSERT_( ignore, x, y ) _Static_assert( x, y )
|
||||||
#define STATIC_ASSERT _Static_assert
|
#define STATIC_ASSERT _Static_assert
|
||||||
#else
|
#else
|
||||||
#define STATIC_ASSERT_( id, x, y ) extern int id[( 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 )
|
// need these to correctly expand the line macro
|
||||||
|
#define STATIC_ASSERT_3( line, x, y ) STATIC_ASSERT_( static_assert_ ## line, x, y )
|
||||||
|
#define STATIC_ASSERT_2( line, x, y ) STATIC_ASSERT_3( line, x, y )
|
||||||
|
#define STATIC_ASSERT( x, y ) STATIC_ASSERT_2( __LINE__, x, y )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XASH_BIG_ENDIAN
|
#ifdef XASH_BIG_ENDIAN
|
||||||
|
|||||||
356
engine/anorms.h
356
engine/anorms.h
@@ -1,177 +1,181 @@
|
|||||||
/***
|
/*
|
||||||
*
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
|
||||||
*
|
|
||||||
* This product contains software technology licensed from Id
|
|
||||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use, distribution, and modification of this source code and/or resulting
|
|
||||||
* object code is restricted to non-commercial enhancements to products from
|
|
||||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
|
||||||
* without written permission from Valve LLC.
|
|
||||||
*
|
|
||||||
****/
|
|
||||||
|
|
||||||
{-0.525731, 0.000000, 0.850651},
|
This program is free software; you can redistribute it and/or
|
||||||
{-0.442863, 0.238856, 0.864188},
|
modify it under the terms of the GNU General Public License
|
||||||
{-0.295242, 0.000000, 0.955423},
|
as published by the Free Software Foundation; either version 2
|
||||||
{-0.309017, 0.500000, 0.809017},
|
of the License, or (at your option) any later version.
|
||||||
{-0.162460, 0.262866, 0.951056},
|
|
||||||
{0.000000, 0.000000, 1.000000},
|
This program is distributed in the hope that it will be useful,
|
||||||
{0.000000, 0.850651, 0.525731},
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
{-0.147621, 0.716567, 0.681718},
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
{0.147621, 0.716567, 0.681718},
|
|
||||||
{0.000000, 0.525731, 0.850651},
|
See the GNU General Public License for more details.
|
||||||
{0.309017, 0.500000, 0.809017},
|
|
||||||
{0.525731, 0.000000, 0.850651},
|
You should have received a copy of the GNU General Public License
|
||||||
{0.295242, 0.000000, 0.955423},
|
along with this program; if not, write to the Free Software
|
||||||
{0.442863, 0.238856, 0.864188},
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
{0.162460, 0.262866, 0.951056},
|
|
||||||
{-0.681718, 0.147621, 0.716567},
|
*/
|
||||||
{-0.809017, 0.309017, 0.500000},
|
{-0.525731, 0.000000, 0.850651},
|
||||||
{-0.587785, 0.425325, 0.688191},
|
{-0.442863, 0.238856, 0.864188},
|
||||||
{-0.850651, 0.525731, 0.000000},
|
{-0.295242, 0.000000, 0.955423},
|
||||||
{-0.864188, 0.442863, 0.238856},
|
{-0.309017, 0.500000, 0.809017},
|
||||||
{-0.716567, 0.681718, 0.147621},
|
{-0.162460, 0.262866, 0.951056},
|
||||||
{-0.688191, 0.587785, 0.425325},
|
{0.000000, 0.000000, 1.000000},
|
||||||
{-0.500000, 0.809017, 0.309017},
|
{0.000000, 0.850651, 0.525731},
|
||||||
{-0.238856, 0.864188, 0.442863},
|
{-0.147621, 0.716567, 0.681718},
|
||||||
{-0.425325, 0.688191, 0.587785},
|
{0.147621, 0.716567, 0.681718},
|
||||||
{-0.716567, 0.681718, -0.147621},
|
{0.000000, 0.525731, 0.850651},
|
||||||
{-0.500000, 0.809017, -0.309017},
|
{0.309017, 0.500000, 0.809017},
|
||||||
{-0.525731, 0.850651, 0.000000},
|
{0.525731, 0.000000, 0.850651},
|
||||||
{0.000000, 0.850651, -0.525731},
|
{0.295242, 0.000000, 0.955423},
|
||||||
{-0.238856, 0.864188, -0.442863},
|
{0.442863, 0.238856, 0.864188},
|
||||||
{0.000000, 0.955423, -0.295242},
|
{0.162460, 0.262866, 0.951056},
|
||||||
{-0.262866, 0.951056, -0.162460},
|
{-0.681718, 0.147621, 0.716567},
|
||||||
{0.000000, 1.000000, 0.000000},
|
{-0.809017, 0.309017, 0.500000},
|
||||||
{0.000000, 0.955423, 0.295242},
|
{-0.587785, 0.425325, 0.688191},
|
||||||
{-0.262866, 0.951056, 0.162460},
|
{-0.850651, 0.525731, 0.000000},
|
||||||
{0.238856, 0.864188, 0.442863},
|
{-0.864188, 0.442863, 0.238856},
|
||||||
{0.262866, 0.951056, 0.162460},
|
{-0.716567, 0.681718, 0.147621},
|
||||||
{0.500000, 0.809017, 0.309017},
|
{-0.688191, 0.587785, 0.425325},
|
||||||
{0.238856, 0.864188, -0.442863},
|
{-0.500000, 0.809017, 0.309017},
|
||||||
{0.262866, 0.951056, -0.162460},
|
{-0.238856, 0.864188, 0.442863},
|
||||||
{0.500000, 0.809017, -0.309017},
|
{-0.425325, 0.688191, 0.587785},
|
||||||
{0.850651, 0.525731, 0.000000},
|
{-0.716567, 0.681718, -0.147621},
|
||||||
{0.716567, 0.681718, 0.147621},
|
{-0.500000, 0.809017, -0.309017},
|
||||||
{0.716567, 0.681718, -0.147621},
|
{-0.525731, 0.850651, 0.000000},
|
||||||
{0.525731, 0.850651, 0.000000},
|
{0.000000, 0.850651, -0.525731},
|
||||||
{0.425325, 0.688191, 0.587785},
|
{-0.238856, 0.864188, -0.442863},
|
||||||
{0.864188, 0.442863, 0.238856},
|
{0.000000, 0.955423, -0.295242},
|
||||||
{0.688191, 0.587785, 0.425325},
|
{-0.262866, 0.951056, -0.162460},
|
||||||
{0.809017, 0.309017, 0.500000},
|
{0.000000, 1.000000, 0.000000},
|
||||||
{0.681718, 0.147621, 0.716567},
|
{0.000000, 0.955423, 0.295242},
|
||||||
{0.587785, 0.425325, 0.688191},
|
{-0.262866, 0.951056, 0.162460},
|
||||||
{0.955423, 0.295242, 0.000000},
|
{0.238856, 0.864188, 0.442863},
|
||||||
{1.000000, 0.000000, 0.000000},
|
{0.262866, 0.951056, 0.162460},
|
||||||
{0.951056, 0.162460, 0.262866},
|
{0.500000, 0.809017, 0.309017},
|
||||||
{0.850651, -0.525731, 0.000000},
|
{0.238856, 0.864188, -0.442863},
|
||||||
{0.955423, -0.295242, 0.000000},
|
{0.262866, 0.951056, -0.162460},
|
||||||
{0.864188, -0.442863, 0.238856},
|
{0.500000, 0.809017, -0.309017},
|
||||||
{0.951056, -0.162460, 0.262866},
|
{0.850651, 0.525731, 0.000000},
|
||||||
{0.809017, -0.309017, 0.500000},
|
{0.716567, 0.681718, 0.147621},
|
||||||
{0.681718, -0.147621, 0.716567},
|
{0.716567, 0.681718, -0.147621},
|
||||||
{0.850651, 0.000000, 0.525731},
|
{0.525731, 0.850651, 0.000000},
|
||||||
{0.864188, 0.442863, -0.238856},
|
{0.425325, 0.688191, 0.587785},
|
||||||
{0.809017, 0.309017, -0.500000},
|
{0.864188, 0.442863, 0.238856},
|
||||||
{0.951056, 0.162460, -0.262866},
|
{0.688191, 0.587785, 0.425325},
|
||||||
{0.525731, 0.000000, -0.850651},
|
{0.809017, 0.309017, 0.500000},
|
||||||
{0.681718, 0.147621, -0.716567},
|
{0.681718, 0.147621, 0.716567},
|
||||||
{0.681718, -0.147621, -0.716567},
|
{0.587785, 0.425325, 0.688191},
|
||||||
{0.850651, 0.000000, -0.525731},
|
{0.955423, 0.295242, 0.000000},
|
||||||
{0.809017, -0.309017, -0.500000},
|
{1.000000, 0.000000, 0.000000},
|
||||||
{0.864188, -0.442863, -0.238856},
|
{0.951056, 0.162460, 0.262866},
|
||||||
{0.951056, -0.162460, -0.262866},
|
{0.850651, -0.525731, 0.000000},
|
||||||
{0.147621, 0.716567, -0.681718},
|
{0.955423, -0.295242, 0.000000},
|
||||||
{0.309017, 0.500000, -0.809017},
|
{0.864188, -0.442863, 0.238856},
|
||||||
{0.425325, 0.688191, -0.587785},
|
{0.951056, -0.162460, 0.262866},
|
||||||
{0.442863, 0.238856, -0.864188},
|
{0.809017, -0.309017, 0.500000},
|
||||||
{0.587785, 0.425325, -0.688191},
|
{0.681718, -0.147621, 0.716567},
|
||||||
{0.688191, 0.587785, -0.425325},
|
{0.850651, 0.000000, 0.525731},
|
||||||
{-0.147621, 0.716567, -0.681718},
|
{0.864188, 0.442863, -0.238856},
|
||||||
{-0.309017, 0.500000, -0.809017},
|
{0.809017, 0.309017, -0.500000},
|
||||||
{0.000000, 0.525731, -0.850651},
|
{0.951056, 0.162460, -0.262866},
|
||||||
{-0.525731, 0.000000, -0.850651},
|
{0.525731, 0.000000, -0.850651},
|
||||||
{-0.442863, 0.238856, -0.864188},
|
{0.681718, 0.147621, -0.716567},
|
||||||
{-0.295242, 0.000000, -0.955423},
|
{0.681718, -0.147621, -0.716567},
|
||||||
{-0.162460, 0.262866, -0.951056},
|
{0.850651, 0.000000, -0.525731},
|
||||||
{0.000000, 0.000000, -1.000000},
|
{0.809017, -0.309017, -0.500000},
|
||||||
{0.295242, 0.000000, -0.955423},
|
{0.864188, -0.442863, -0.238856},
|
||||||
{0.162460, 0.262866, -0.951056},
|
{0.951056, -0.162460, -0.262866},
|
||||||
{-0.442863, -0.238856, -0.864188},
|
{0.147621, 0.716567, -0.681718},
|
||||||
{-0.309017, -0.500000, -0.809017},
|
{0.309017, 0.500000, -0.809017},
|
||||||
{-0.162460, -0.262866, -0.951056},
|
{0.425325, 0.688191, -0.587785},
|
||||||
{0.000000, -0.850651, -0.525731},
|
{0.442863, 0.238856, -0.864188},
|
||||||
{-0.147621, -0.716567, -0.681718},
|
{0.587785, 0.425325, -0.688191},
|
||||||
{0.147621, -0.716567, -0.681718},
|
{0.688191, 0.587785, -0.425325},
|
||||||
{0.000000, -0.525731, -0.850651},
|
{-0.147621, 0.716567, -0.681718},
|
||||||
{0.309017, -0.500000, -0.809017},
|
{-0.309017, 0.500000, -0.809017},
|
||||||
{0.442863, -0.238856, -0.864188},
|
{0.000000, 0.525731, -0.850651},
|
||||||
{0.162460, -0.262866, -0.951056},
|
{-0.525731, 0.000000, -0.850651},
|
||||||
{0.238856, -0.864188, -0.442863},
|
{-0.442863, 0.238856, -0.864188},
|
||||||
{0.500000, -0.809017, -0.309017},
|
{-0.295242, 0.000000, -0.955423},
|
||||||
{0.425325, -0.688191, -0.587785},
|
{-0.162460, 0.262866, -0.951056},
|
||||||
{0.716567, -0.681718, -0.147621},
|
{0.000000, 0.000000, -1.000000},
|
||||||
{0.688191, -0.587785, -0.425325},
|
{0.295242, 0.000000, -0.955423},
|
||||||
{0.587785, -0.425325, -0.688191},
|
{0.162460, 0.262866, -0.951056},
|
||||||
{0.000000, -0.955423, -0.295242},
|
{-0.442863, -0.238856, -0.864188},
|
||||||
{0.000000, -1.000000, 0.000000},
|
{-0.309017, -0.500000, -0.809017},
|
||||||
{0.262866, -0.951056, -0.162460},
|
{-0.162460, -0.262866, -0.951056},
|
||||||
{0.000000, -0.850651, 0.525731},
|
{0.000000, -0.850651, -0.525731},
|
||||||
{0.000000, -0.955423, 0.295242},
|
{-0.147621, -0.716567, -0.681718},
|
||||||
{0.238856, -0.864188, 0.442863},
|
{0.147621, -0.716567, -0.681718},
|
||||||
{0.262866, -0.951056, 0.162460},
|
{0.000000, -0.525731, -0.850651},
|
||||||
{0.500000, -0.809017, 0.309017},
|
{0.309017, -0.500000, -0.809017},
|
||||||
{0.716567, -0.681718, 0.147621},
|
{0.442863, -0.238856, -0.864188},
|
||||||
{0.525731, -0.850651, 0.000000},
|
{0.162460, -0.262866, -0.951056},
|
||||||
{-0.238856, -0.864188, -0.442863},
|
{0.238856, -0.864188, -0.442863},
|
||||||
{-0.500000, -0.809017, -0.309017},
|
{0.500000, -0.809017, -0.309017},
|
||||||
{-0.262866, -0.951056, -0.162460},
|
{0.425325, -0.688191, -0.587785},
|
||||||
{-0.850651, -0.525731, 0.000000},
|
{0.716567, -0.681718, -0.147621},
|
||||||
{-0.716567, -0.681718, -0.147621},
|
{0.688191, -0.587785, -0.425325},
|
||||||
{-0.716567, -0.681718, 0.147621},
|
{0.587785, -0.425325, -0.688191},
|
||||||
{-0.525731, -0.850651, 0.000000},
|
{0.000000, -0.955423, -0.295242},
|
||||||
{-0.500000, -0.809017, 0.309017},
|
{0.000000, -1.000000, 0.000000},
|
||||||
{-0.238856, -0.864188, 0.442863},
|
{0.262866, -0.951056, -0.162460},
|
||||||
{-0.262866, -0.951056, 0.162460},
|
{0.000000, -0.850651, 0.525731},
|
||||||
{-0.864188, -0.442863, 0.238856},
|
{0.000000, -0.955423, 0.295242},
|
||||||
{-0.809017, -0.309017, 0.500000},
|
{0.238856, -0.864188, 0.442863},
|
||||||
{-0.688191, -0.587785, 0.425325},
|
{0.262866, -0.951056, 0.162460},
|
||||||
{-0.681718, -0.147621, 0.716567},
|
{0.500000, -0.809017, 0.309017},
|
||||||
{-0.442863, -0.238856, 0.864188},
|
{0.716567, -0.681718, 0.147621},
|
||||||
{-0.587785, -0.425325, 0.688191},
|
{0.525731, -0.850651, 0.000000},
|
||||||
{-0.309017, -0.500000, 0.809017},
|
{-0.238856, -0.864188, -0.442863},
|
||||||
{-0.147621, -0.716567, 0.681718},
|
{-0.500000, -0.809017, -0.309017},
|
||||||
{-0.425325, -0.688191, 0.587785},
|
{-0.262866, -0.951056, -0.162460},
|
||||||
{-0.162460, -0.262866, 0.951056},
|
{-0.850651, -0.525731, 0.000000},
|
||||||
{0.442863, -0.238856, 0.864188},
|
{-0.716567, -0.681718, -0.147621},
|
||||||
{0.162460, -0.262866, 0.951056},
|
{-0.716567, -0.681718, 0.147621},
|
||||||
{0.309017, -0.500000, 0.809017},
|
{-0.525731, -0.850651, 0.000000},
|
||||||
{0.147621, -0.716567, 0.681718},
|
{-0.500000, -0.809017, 0.309017},
|
||||||
{0.000000, -0.525731, 0.850651},
|
{-0.238856, -0.864188, 0.442863},
|
||||||
{0.425325, -0.688191, 0.587785},
|
{-0.262866, -0.951056, 0.162460},
|
||||||
{0.587785, -0.425325, 0.688191},
|
{-0.864188, -0.442863, 0.238856},
|
||||||
{0.688191, -0.587785, 0.425325},
|
{-0.809017, -0.309017, 0.500000},
|
||||||
{-0.955423, 0.295242, 0.000000},
|
{-0.688191, -0.587785, 0.425325},
|
||||||
{-0.951056, 0.162460, 0.262866},
|
{-0.681718, -0.147621, 0.716567},
|
||||||
{-1.000000, 0.000000, 0.000000},
|
{-0.442863, -0.238856, 0.864188},
|
||||||
{-0.850651, 0.000000, 0.525731},
|
{-0.587785, -0.425325, 0.688191},
|
||||||
{-0.955423, -0.295242, 0.000000},
|
{-0.309017, -0.500000, 0.809017},
|
||||||
{-0.951056, -0.162460, 0.262866},
|
{-0.147621, -0.716567, 0.681718},
|
||||||
{-0.864188, 0.442863, -0.238856},
|
{-0.425325, -0.688191, 0.587785},
|
||||||
{-0.951056, 0.162460, -0.262866},
|
{-0.162460, -0.262866, 0.951056},
|
||||||
{-0.809017, 0.309017, -0.500000},
|
{0.442863, -0.238856, 0.864188},
|
||||||
{-0.864188, -0.442863, -0.238856},
|
{0.162460, -0.262866, 0.951056},
|
||||||
{-0.951056, -0.162460, -0.262866},
|
{0.309017, -0.500000, 0.809017},
|
||||||
{-0.809017, -0.309017, -0.500000},
|
{0.147621, -0.716567, 0.681718},
|
||||||
{-0.681718, 0.147621, -0.716567},
|
{0.000000, -0.525731, 0.850651},
|
||||||
{-0.681718, -0.147621, -0.716567},
|
{0.425325, -0.688191, 0.587785},
|
||||||
{-0.850651, 0.000000, -0.525731},
|
{0.587785, -0.425325, 0.688191},
|
||||||
{-0.688191, 0.587785, -0.425325},
|
{0.688191, -0.587785, 0.425325},
|
||||||
{-0.587785, 0.425325, -0.688191},
|
{-0.955423, 0.295242, 0.000000},
|
||||||
{-0.425325, 0.688191, -0.587785},
|
{-0.951056, 0.162460, 0.262866},
|
||||||
{-0.425325, -0.688191, -0.587785},
|
{-1.000000, 0.000000, 0.000000},
|
||||||
{-0.587785, -0.425325, -0.688191},
|
{-0.850651, 0.000000, 0.525731},
|
||||||
{-0.688191, -0.587785, -0.425325},
|
{-0.955423, -0.295242, 0.000000},
|
||||||
|
{-0.951056, -0.162460, 0.262866},
|
||||||
|
{-0.864188, 0.442863, -0.238856},
|
||||||
|
{-0.951056, 0.162460, -0.262866},
|
||||||
|
{-0.809017, 0.309017, -0.500000},
|
||||||
|
{-0.864188, -0.442863, -0.238856},
|
||||||
|
{-0.951056, -0.162460, -0.262866},
|
||||||
|
{-0.809017, -0.309017, -0.500000},
|
||||||
|
{-0.681718, 0.147621, -0.716567},
|
||||||
|
{-0.681718, -0.147621, -0.716567},
|
||||||
|
{-0.850651, 0.000000, -0.525731},
|
||||||
|
{-0.688191, 0.587785, -0.425325},
|
||||||
|
{-0.587785, 0.425325, -0.688191},
|
||||||
|
{-0.425325, 0.688191, -0.587785},
|
||||||
|
{-0.425325, -0.688191, -0.587785},
|
||||||
|
{-0.587785, -0.425325, -0.688191},
|
||||||
|
{-0.688191, -0.587785, -0.425325},
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -87,7 +89,6 @@ static CVAR_DEFINE_AUTO( model, "", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABL
|
|||||||
static CVAR_DEFINE_AUTO( topcolor, "0", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player top color" );
|
static CVAR_DEFINE_AUTO( topcolor, "0", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player top color" );
|
||||||
static CVAR_DEFINE_AUTO( bottomcolor, "0", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player bottom color" );
|
static CVAR_DEFINE_AUTO( bottomcolor, "0", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player bottom color" );
|
||||||
CVAR_DEFINE_AUTO( rate, "3500", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player network rate" );
|
CVAR_DEFINE_AUTO( rate, "3500", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player network rate" );
|
||||||
static CVAR_DEFINE_AUTO( cl_maxframetime, "0", 0, "set deadline timer for client rendering to catch freezes" );
|
|
||||||
|
|
||||||
client_t cl;
|
client_t cl;
|
||||||
client_static_t cls;
|
client_static_t cls;
|
||||||
@@ -606,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;
|
||||||
@@ -2190,9 +2191,20 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
|||||||
// serverlist got from masterserver
|
// serverlist got from masterserver
|
||||||
while( MSG_GetNumBitsLeft( msg ) > 8 )
|
while( MSG_GetNumBitsLeft( msg ) > 8 )
|
||||||
{
|
{
|
||||||
MSG_ReadBytes( msg, servadr.ip, sizeof( servadr.ip )); // 4 bytes for IP
|
uint8_t addr[16];
|
||||||
|
|
||||||
|
if( from.type6 == NA_IP6 ) // IPv6 master server only sends IPv6 addresses
|
||||||
|
{
|
||||||
|
MSG_ReadBytes( msg, addr, sizeof( addr ));
|
||||||
|
NET_IP6BytesToNetadr( &servadr, addr );
|
||||||
|
servadr.type6 = NA_IP6;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MSG_ReadBytes( msg, servadr.ip, sizeof( servadr.ip )); // 4 bytes for IP
|
||||||
|
servadr.type = NA_IP;
|
||||||
|
}
|
||||||
servadr.port = MSG_ReadShort( msg ); // 2 bytes for Port
|
servadr.port = MSG_ReadShort( msg ); // 2 bytes for Port
|
||||||
servadr.type = NA_IP;
|
|
||||||
|
|
||||||
// list is ends here
|
// list is ends here
|
||||||
if( !servadr.port )
|
if( !servadr.port )
|
||||||
@@ -2919,10 +2931,7 @@ void CL_InitLocal( void )
|
|||||||
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_maxframetime );
|
||||||
|
Cvar_RegisterVariable( &cl_fixmodelinterpolationartifacts );
|
||||||
// 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( "direct", "1", FCVAR_ARCHIVE, "direct lighting level (legacy, unused)" );
|
|
||||||
|
|
||||||
// server commands
|
// server commands
|
||||||
Cmd_AddCommand ("noclip", NULL, "enable or disable no clipping mode" );
|
Cmd_AddCommand ("noclip", NULL, "enable or disable no clipping mode" );
|
||||||
|
|||||||
@@ -903,11 +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 ));
|
||||||
host.features &= legacy ? ENGINE_LEGACY_FEATURES_MASK : ENGINE_FEATURES_MASK;
|
|
||||||
|
|
||||||
if( !Host_IsLocalGame( ))
|
|
||||||
Host_PrintEngineFeatures( host.features );
|
|
||||||
|
|
||||||
if( !legacy )
|
if( !legacy )
|
||||||
{
|
{
|
||||||
@@ -1642,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;
|
||||||
|
|||||||
@@ -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,28 +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_WORLD_VERSION:
|
case PARM_GET_HOST_PTR:
|
||||||
return world.version;
|
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;
|
||||||
|
|||||||
@@ -292,6 +292,8 @@ void SCR_MakeScreenShot( void )
|
|||||||
viewsize = cls.envshot_viewsize;
|
viewsize = cls.envshot_viewsize;
|
||||||
else viewsize = cl_envshot_size.value;
|
else viewsize = cl_envshot_size.value;
|
||||||
|
|
||||||
|
V_CheckGamma();
|
||||||
|
|
||||||
switch( cls.scrshot_action )
|
switch( cls.scrshot_action )
|
||||||
{
|
{
|
||||||
case scrshot_normal:
|
case scrshot_normal:
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -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 );
|
||||||
|
|||||||
@@ -347,6 +347,8 @@ qboolean V_PreRender( void )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
V_CheckGamma();
|
||||||
|
|
||||||
ref.dllFuncs.R_BeginFrame( !cl.paused && ( cls.state == ca_active ));
|
ref.dllFuncs.R_BeginFrame( !cl.paused && ( cls.state == ca_active ));
|
||||||
|
|
||||||
GL_UpdateSwapInterval( );
|
GL_UpdateSwapInterval( );
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ static CVAR_DEFINE_AUTO( con_charset, "cp1251", FCVAR_ARCHIVE, "console font cha
|
|||||||
static CVAR_DEFINE_AUTO( con_fontscale, "1.0", FCVAR_ARCHIVE, "scale font texture" );
|
static CVAR_DEFINE_AUTO( con_fontscale, "1.0", FCVAR_ARCHIVE, "scale font texture" );
|
||||||
static CVAR_DEFINE_AUTO( con_fontnum, "-1", FCVAR_ARCHIVE, "console font number (0, 1 or 2), -1 for autoselect" );
|
static CVAR_DEFINE_AUTO( con_fontnum, "-1", FCVAR_ARCHIVE, "console font number (0, 1 or 2), -1 for autoselect" );
|
||||||
static CVAR_DEFINE_AUTO( con_color, "240 180 24", FCVAR_ARCHIVE, "set a custom console color" );
|
static CVAR_DEFINE_AUTO( con_color, "240 180 24", FCVAR_ARCHIVE, "set a custom console color" );
|
||||||
|
static CVAR_DEFINE_AUTO( scr_drawversion, "1", FCVAR_ARCHIVE, "draw version in menu or screenshots, doesn't affect console" );
|
||||||
|
static CVAR_DEFINE_AUTO( con_oldfont, "0", 0, "use legacy font from gfx.wad, might be missing or broken" );
|
||||||
|
|
||||||
static int g_codepage = 0;
|
static int g_codepage = 0;
|
||||||
static qboolean g_utf8 = false;
|
static qboolean g_utf8 = false;
|
||||||
@@ -543,8 +544,7 @@ static void Con_LoadConsoleFont( int fontNumber, cl_font_t *font )
|
|||||||
if( font->valid )
|
if( font->valid )
|
||||||
return; // already loaded
|
return; // already loaded
|
||||||
|
|
||||||
// loading conchars
|
if( con_oldfont.value )
|
||||||
if( Sys_CheckParm( "-oldfont" ))
|
|
||||||
{
|
{
|
||||||
success = Con_LoadVariableWidthFont( "gfx/conchars.fnt", font, scale, kRenderTransTexture, TF_FONT|TF_NEAREST );
|
success = Con_LoadVariableWidthFont( "gfx/conchars.fnt", font, scale, kRenderTransTexture, TF_FONT|TF_NEAREST );
|
||||||
}
|
}
|
||||||
@@ -841,6 +841,8 @@ void Con_Init( void )
|
|||||||
Cvar_RegisterVariable( &con_fontscale );
|
Cvar_RegisterVariable( &con_fontscale );
|
||||||
Cvar_RegisterVariable( &con_fontnum );
|
Cvar_RegisterVariable( &con_fontnum );
|
||||||
Cvar_RegisterVariable( &con_color );
|
Cvar_RegisterVariable( &con_color );
|
||||||
|
Cvar_RegisterVariable( &scr_drawversion );
|
||||||
|
Cvar_RegisterVariable( &con_oldfont );
|
||||||
|
|
||||||
// init the console buffer
|
// init the console buffer
|
||||||
con.bufsize = CON_TEXTSIZE;
|
con.bufsize = CON_TEXTSIZE;
|
||||||
@@ -2047,26 +2049,30 @@ void Con_DrawVersion( void )
|
|||||||
byte *color = g_color_table[7];
|
byte *color = g_color_table[7];
|
||||||
int stringLen, charH = 0;
|
int stringLen, charH = 0;
|
||||||
int start, height = refState.height;
|
int start, height = refState.height;
|
||||||
qboolean draw_version = false;
|
|
||||||
string curbuild;
|
string curbuild;
|
||||||
|
|
||||||
switch( cls.scrshot_action )
|
if( !scr_drawversion.value || CL_IsDevOverviewMode() == 2 || net_graph.value )
|
||||||
{
|
|
||||||
case scrshot_normal:
|
|
||||||
case scrshot_snapshot:
|
|
||||||
draw_version = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( host.force_draw_version_time > host.realtime )
|
|
||||||
draw_version = true;
|
|
||||||
|
|
||||||
if(( cls.key_dest != key_menu && !draw_version ) || CL_IsDevOverviewMode() == 2 || net_graph.value )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( draw_version )
|
if( cls.key_dest == key_menu )
|
||||||
Q_snprintf( curbuild, MAX_STRING, XASH_ENGINE_NAME " v%i/" XASH_VERSION " (%s-%s build %i)", PROTOCOL_VERSION, Q_buildos(), Q_buildarch(), Q_buildnum( ));
|
{
|
||||||
else Q_snprintf( curbuild, MAX_STRING, "v%i/" XASH_VERSION " (%s-%s build %i)", PROTOCOL_VERSION, Q_buildos(), Q_buildarch(), Q_buildnum( ));
|
Q_snprintf( curbuild, sizeof( curbuild ),
|
||||||
|
"v%i/" XASH_VERSION " (%s-%s build %i)", PROTOCOL_VERSION, Q_buildos(), Q_buildarch(), Q_buildnum( ));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qboolean draw_version;
|
||||||
|
|
||||||
|
draw_version = cls.scrshot_action == scrshot_normal
|
||||||
|
|| cls.scrshot_action == scrshot_snapshot
|
||||||
|
|| host.force_draw_version_time > host.realtime;
|
||||||
|
|
||||||
|
if( !draw_version )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Q_snprintf( curbuild, sizeof( curbuild ),
|
||||||
|
XASH_ENGINE_NAME " v%i/" XASH_VERSION " (%s-%s build %i)", PROTOCOL_VERSION, Q_buildos(), Q_buildarch(), Q_buildnum( ));
|
||||||
|
}
|
||||||
|
|
||||||
Con_DrawStringLen( curbuild, &stringLen, &charH );
|
Con_DrawStringLen( curbuild, &stringLen, &charH );
|
||||||
start = refState.width - stringLen * 1.05f;
|
start = refState.width - stringLen * 1.05f;
|
||||||
@@ -2112,10 +2118,7 @@ void Con_RunConsole( void )
|
|||||||
con.vislines = con.showlines;
|
con.vislines = con.showlines;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( FBitSet( con_charset.flags, FCVAR_CHANGED ) ||
|
if( FBitSet( con_charset.flags|con_fontscale.flags|con_fontnum.flags|cl_charset.flags|con_oldfont.flags, FCVAR_CHANGED ))
|
||||||
FBitSet( con_fontscale.flags, FCVAR_CHANGED ) ||
|
|
||||||
FBitSet( con_fontnum.flags, FCVAR_CHANGED ) ||
|
|
||||||
FBitSet( cl_charset.flags, FCVAR_CHANGED ))
|
|
||||||
{
|
{
|
||||||
// update codepage parameters
|
// update codepage parameters
|
||||||
if( !Q_stricmp( con_charset.string, "cp1251" ))
|
if( !Q_stricmp( con_charset.string, "cp1251" ))
|
||||||
@@ -2141,6 +2144,7 @@ void Con_RunConsole( void )
|
|||||||
ClearBits( con_fontnum.flags, FCVAR_CHANGED );
|
ClearBits( con_fontnum.flags, FCVAR_CHANGED );
|
||||||
ClearBits( con_fontscale.flags, FCVAR_CHANGED );
|
ClearBits( con_fontscale.flags, FCVAR_CHANGED );
|
||||||
ClearBits( cl_charset.flags, FCVAR_CHANGED );
|
ClearBits( cl_charset.flags, FCVAR_CHANGED );
|
||||||
|
ClearBits( con_oldfont.flags, FCVAR_CHANGED );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2186,6 +2190,9 @@ void Con_VidInit( void )
|
|||||||
con.historyLoaded = true;
|
con.historyLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( Sys_CheckParm( "-oldfont" ))
|
||||||
|
Cvar_DirectSet( &con_oldfont, "1" );
|
||||||
|
|
||||||
Con_LoadConchars();
|
Con_LoadConchars();
|
||||||
Con_CheckResize();
|
Con_CheckResize();
|
||||||
#if XASH_LOW_MEMORY
|
#if XASH_LOW_MEMORY
|
||||||
|
|||||||
428
engine/client/gamma.c
Normal file
428
engine/client/gamma.c
Normal file
@@ -0,0 +1,428 @@
|
|||||||
|
/*
|
||||||
|
gamma.c - gamma routines
|
||||||
|
Copyright (C) 2011 Uncle Mike
|
||||||
|
|
||||||
|
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 "common.h"
|
||||||
|
#include "client.h"
|
||||||
|
#include "xash3d_mathlib.h"
|
||||||
|
#include "enginefeatures.h"
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Gamma conversion support
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
static byte texgammatable[256];
|
||||||
|
static uint lightgammatable[1024];
|
||||||
|
static uint lineargammatable[1024];
|
||||||
|
static uint screengammatable[1024];
|
||||||
|
static CVAR_DEFINE( v_direct, "direct", "0.9", 0, "direct studio lighting" );
|
||||||
|
static CVAR_DEFINE( v_texgamma, "texgamma", "2.0", 0, "texgamma amount" );
|
||||||
|
static CVAR_DEFINE( v_lightgamma, "lightgamma", "2.5", 0, "lightgamma amount" );
|
||||||
|
static CVAR_DEFINE( v_brightness, "brightness", "0.0", FCVAR_ARCHIVE, "brightness factor" );
|
||||||
|
static CVAR_DEFINE( v_gamma, "gamma", "2.5", FCVAR_ARCHIVE, "gamma amount" );
|
||||||
|
|
||||||
|
static void BuildGammaTable( const float gamma, const float brightness, const float texgamma, const float lightgamma )
|
||||||
|
{
|
||||||
|
float g1, g2, g3;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if( gamma != 0.0 )
|
||||||
|
g1 = 1.0 / gamma;
|
||||||
|
else g1 = 0.4;
|
||||||
|
|
||||||
|
g2 = g1 * texgamma;
|
||||||
|
|
||||||
|
if( brightness <= 0.0 )
|
||||||
|
g3 = 0.125;
|
||||||
|
else if( brightness <= 1.0 )
|
||||||
|
g3 = 0.125 - brightness * brightness * 0.075;
|
||||||
|
else
|
||||||
|
g3 = 0.05;
|
||||||
|
|
||||||
|
for( i = 0; i < 256; i++ )
|
||||||
|
{
|
||||||
|
double d = pow( i / 255.0, (double)g2 );
|
||||||
|
int inf = d * 255.0;
|
||||||
|
texgammatable[i] = bound( 0, inf, 255 );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( i = 0; i < 1024; i++ )
|
||||||
|
{
|
||||||
|
double d;
|
||||||
|
float f = pow( i / 1023.0, (double)lightgamma );
|
||||||
|
int inf;
|
||||||
|
|
||||||
|
if( brightness > 1.0 )
|
||||||
|
f *= brightness;
|
||||||
|
|
||||||
|
if( f <= g3 )
|
||||||
|
f = ( f / g3 ) * 0.125;
|
||||||
|
else
|
||||||
|
f = (( f - g3 ) / ( 1.0 - g3 )) * 0.875 + 0.125;
|
||||||
|
|
||||||
|
d = pow( (double)f, (double)g1 ); // do not remove the cast, or tests fail
|
||||||
|
inf = d * 1023.0;
|
||||||
|
lightgammatable[i] = bound( 0, inf, 1023 );
|
||||||
|
|
||||||
|
// do these calculations in the same loop...
|
||||||
|
lineargammatable[i] = pow( i / 1023.0, (double)gamma ) * 1023.0;
|
||||||
|
screengammatable[i] = pow( i / 1023.0, 1.0 / gamma ) * 1023.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void V_ValidateGammaCvars( void )
|
||||||
|
{
|
||||||
|
if( Host_IsLocalGame( ))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( v_gamma.value < 1.8f )
|
||||||
|
Cvar_DirectSet( &v_gamma, "1.8" );
|
||||||
|
else if( v_gamma.value > 3.0f )
|
||||||
|
Cvar_DirectSet( &v_gamma, "3" );
|
||||||
|
|
||||||
|
if( v_texgamma.value < 1.8f )
|
||||||
|
Cvar_DirectSet( &v_texgamma, "1.8" );
|
||||||
|
else if( v_texgamma.value > 3.0f )
|
||||||
|
Cvar_DirectSet( &v_texgamma, "3" );
|
||||||
|
|
||||||
|
if( v_lightgamma.value < 1.8f )
|
||||||
|
Cvar_DirectSet( &v_lightgamma, "1.8" );
|
||||||
|
else if( v_lightgamma.value > 3.0f )
|
||||||
|
Cvar_DirectSet( &v_lightgamma, "3" );
|
||||||
|
|
||||||
|
if( v_brightness.value < 0.0f )
|
||||||
|
Cvar_DirectSet( &v_brightness, "0" );
|
||||||
|
else if( v_brightness.value > 2.0f )
|
||||||
|
Cvar_DirectSet( &v_brightness, "2" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void V_CheckGamma( void )
|
||||||
|
{
|
||||||
|
static qboolean dirty = false;
|
||||||
|
qboolean notify_refdll = false;
|
||||||
|
|
||||||
|
// because these cvars were defined as archive
|
||||||
|
// but wasn't doing anything useful
|
||||||
|
// reset them into default values
|
||||||
|
// this might be removed after a while
|
||||||
|
if( v_direct.value == 1.0f || v_lightgamma.value == 1.0f )
|
||||||
|
{
|
||||||
|
Cvar_DirectSet( &v_direct, "0.9" );
|
||||||
|
Cvar_DirectSet( &v_lightgamma, "2.5" );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( cls.scrshot_action == scrshot_envshot || cls.scrshot_action == scrshot_skyshot )
|
||||||
|
{
|
||||||
|
dirty = true; // force recalculate next normal frame
|
||||||
|
BuildGammaTable( 1.8f, 0.0f, 2.0f, 2.5f );
|
||||||
|
if( ref.initialized )
|
||||||
|
ref.dllFuncs.R_GammaChanged( true );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( dirty || FBitSet( v_texgamma.flags|v_lightgamma.flags|v_brightness.flags|v_gamma.flags, FCVAR_CHANGED ))
|
||||||
|
{
|
||||||
|
V_ValidateGammaCvars();
|
||||||
|
|
||||||
|
dirty = false;
|
||||||
|
BuildGammaTable( v_gamma.value, v_brightness.value, v_texgamma.value, v_lightgamma.value );
|
||||||
|
|
||||||
|
// force refdll to recalculate lightmaps
|
||||||
|
notify_refdll = true;
|
||||||
|
|
||||||
|
// unfortunately, recalculating textures isn't possible yet
|
||||||
|
ClearBits( v_texgamma.flags, FCVAR_CHANGED );
|
||||||
|
ClearBits( v_lightgamma.flags, FCVAR_CHANGED );
|
||||||
|
ClearBits( v_brightness.flags, FCVAR_CHANGED );
|
||||||
|
ClearBits( v_gamma.flags, FCVAR_CHANGED );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( notify_refdll && ref.initialized )
|
||||||
|
ref.dllFuncs.R_GammaChanged( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
void V_Init( void )
|
||||||
|
{
|
||||||
|
Cvar_RegisterVariable( &v_texgamma );
|
||||||
|
Cvar_RegisterVariable( &v_lightgamma );
|
||||||
|
Cvar_RegisterVariable( &v_brightness );
|
||||||
|
Cvar_RegisterVariable( &v_gamma );
|
||||||
|
Cvar_RegisterVariable( &v_direct );
|
||||||
|
|
||||||
|
// force gamma init
|
||||||
|
SetBits( v_gamma.flags, FCVAR_CHANGED );
|
||||||
|
V_CheckGamma();
|
||||||
|
}
|
||||||
|
|
||||||
|
byte TextureToGamma( byte b )
|
||||||
|
{
|
||||||
|
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
|
||||||
|
return b;
|
||||||
|
|
||||||
|
return texgammatable[b];
|
||||||
|
}
|
||||||
|
|
||||||
|
byte LightToTexGamma( byte b )
|
||||||
|
{
|
||||||
|
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
|
||||||
|
return b;
|
||||||
|
|
||||||
|
// 255 << 2 is 1020, impossible to overflow
|
||||||
|
return lightgammatable[b << 2] >> 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint LightToTexGammaEx( uint b )
|
||||||
|
{
|
||||||
|
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
|
||||||
|
return b;
|
||||||
|
|
||||||
|
if( unlikely( b > ARRAYSIZE( lightgammatable )))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return lightgammatable[b];
|
||||||
|
}
|
||||||
|
|
||||||
|
uint ScreenGammaTable( uint b )
|
||||||
|
{
|
||||||
|
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
|
||||||
|
return b;
|
||||||
|
|
||||||
|
if( unlikely( b > ARRAYSIZE( screengammatable )))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return screengammatable[b];
|
||||||
|
}
|
||||||
|
|
||||||
|
uint LinearGammaTable( uint b )
|
||||||
|
{
|
||||||
|
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
|
||||||
|
return b;
|
||||||
|
|
||||||
|
if( unlikely( b > ARRAYSIZE( lineargammatable )))
|
||||||
|
return 0;
|
||||||
|
return lineargammatable[b];
|
||||||
|
}
|
||||||
|
|
||||||
|
#if XASH_ENGINE_TESTS
|
||||||
|
#include "tests.h"
|
||||||
|
|
||||||
|
typedef struct precomputed_gamma_tables_s
|
||||||
|
{
|
||||||
|
float gamma;
|
||||||
|
float brightness;
|
||||||
|
float texgamma;
|
||||||
|
float lightgamma;
|
||||||
|
byte texgammatable[256];
|
||||||
|
int lightgammatable[1024];
|
||||||
|
int lineargammatable[1024];
|
||||||
|
int screengammatable[1024];
|
||||||
|
} precomputed_gamma_tables_t;
|
||||||
|
|
||||||
|
// put at the end of the file, to not confuse Qt Creator's parser
|
||||||
|
precomputed_gamma_tables_t *Test_GetGammaTables( int i );
|
||||||
|
|
||||||
|
static void Test_PrecomputedGammaTables( void )
|
||||||
|
{
|
||||||
|
precomputed_gamma_tables_t *data;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
while(( data = Test_GetGammaTables( i )))
|
||||||
|
{
|
||||||
|
int j;
|
||||||
|
|
||||||
|
BuildGammaTable( data->gamma, data->brightness, data->texgamma, data->lightgamma );
|
||||||
|
|
||||||
|
for( j = 0; j < 1024; j++ )
|
||||||
|
{
|
||||||
|
if( j < 256 )
|
||||||
|
{
|
||||||
|
TASSERT_EQi( texgammatable[j], data->texgammatable[j] );
|
||||||
|
}
|
||||||
|
|
||||||
|
TASSERT_EQi( lightgammatable[j], data->lightgammatable[j] );
|
||||||
|
TASSERT_EQi( lineargammatable[j], data->lineargammatable[j] );
|
||||||
|
TASSERT_EQi( screengammatable[j], data->screengammatable[j] );
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Test_RunGamma( void )
|
||||||
|
{
|
||||||
|
TRUN( Test_PrecomputedGammaTables() );
|
||||||
|
}
|
||||||
|
|
||||||
|
precomputed_gamma_tables_t *Test_GetGammaTables( int i )
|
||||||
|
{
|
||||||
|
static precomputed_gamma_tables_t precomputed_data[] = {
|
||||||
|
{
|
||||||
|
.gamma = 2.5,
|
||||||
|
.brightness = 0.0,
|
||||||
|
.texgamma = 2.0,
|
||||||
|
.lightgamma = 2.5,
|
||||||
|
.texgammatable = {
|
||||||
|
0, 3, 5, 7, 9, 10, 12, 14, 15, 17, 19, 20, 22, 23, 25, 26, 27, 29, 30, 31, 33, 34, 35, 37, 38, 39, 41, 42, 43, 44, 46, 47, 48, 49, 50, 52, 53, 54, 55, 56, 57, 59, 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, 82, 83, 84,
|
||||||
|
85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 132, 133, 134, 135, 136, 137, 138,
|
||||||
|
139, 140, 141, 142, 143, 144, 145, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 165, 166, 167, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 177, 178, 179, 180, 180, 181, 182, 183, 184, 185,
|
||||||
|
186, 186, 187, 188, 189, 190, 191, 192, 192, 193, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 204, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 214, 214, 215, 216, 217, 218, 219, 219, 220, 221, 222, 223, 224, 224, 225, 226, 227, 228, 229,
|
||||||
|
229, 230, 231, 232, 233, 233, 234, 235, 236, 237, 238, 238, 239, 240, 241, 242, 242, 243, 244, 245, 246, 246, 247, 248, 249, 250, 250, 251, 252, 253, 254, 255
|
||||||
|
},
|
||||||
|
.lightgammatable = {
|
||||||
|
0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
|
||||||
|
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
|
||||||
|
124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
|
||||||
|
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227,
|
||||||
|
228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
|
||||||
|
280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331,
|
||||||
|
332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 343, 343, 344, 345, 346, 347, 348, 349, 350, 351, 353, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 376, 376, 377, 379, 379, 380, 381, 382, 383,
|
||||||
|
384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435,
|
||||||
|
436, 437, 438, 439, 440, 441, 442, 443, 444, 446, 446, 447, 449, 449, 450, 451, 452, 453, 455, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 468, 469, 470, 470, 472, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487,
|
||||||
|
488, 489, 490, 491, 493, 493, 494, 495, 496, 498, 498, 499, 500, 502, 502, 503, 504, 505, 507, 508, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 520, 521, 521, 522, 523, 524, 525, 526, 527, 528, 530, 530, 531, 532, 533, 534, 536, 536, 537, 538, 539,
|
||||||
|
540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 552, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 564, 564, 565, 566, 567, 568, 570, 571, 571, 572, 573, 574, 576, 576, 577, 578, 579, 580, 581, 583, 583, 584, 585, 586, 587, 588, 590, 591, 591,
|
||||||
|
593, 593, 594, 596, 596, 597, 598, 600, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 611, 611, 612, 613, 615, 615, 616, 618, 618, 620, 621, 621, 622, 624, 625, 626, 627, 627, 628, 629, 630, 632, 633, 633, 634, 635, 636, 638, 638, 639, 641, 642, 643, 643,
|
||||||
|
644, 645, 646, 648, 648, 650, 651, 651, 652, 654, 655, 656, 656, 658, 658, 660, 660, 662, 662, 664, 664, 665, 666, 668, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 682, 682, 683, 684, 685, 686, 687, 688, 690, 690, 691, 692, 693, 695, 696,
|
||||||
|
696, 697, 698, 699, 700, 701, 702, 703, 705, 706, 706, 707, 708, 709, 710, 711, 712, 713, 715, 716, 716, 717, 718, 719, 721, 721, 722, 724, 724, 725, 727, 727, 728, 729, 730, 731, 733, 733, 734, 735, 736, 737, 738, 740, 740, 741, 743, 744, 744, 745, 747, 747,
|
||||||
|
748, 749, 750, 752, 753, 753, 755, 755, 757, 757, 758, 759, 760, 761, 762, 764, 764, 766, 766, 767, 769, 770, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 784, 785, 786, 788, 789, 790, 791, 792, 792, 794, 794, 796, 796, 797, 799, 800,
|
||||||
|
801, 801, 802, 803, 804, 805, 806, 807, 809, 810, 810, 811, 813, 813, 815, 815, 816, 817, 819, 819, 820, 822, 823, 823, 824, 825, 826, 827, 829, 829, 830, 832, 832, 833, 835, 835, 837, 837, 839, 840, 840, 841, 842, 843, 844, 845, 847, 847, 849, 849, 850, 851,
|
||||||
|
852, 854, 854, 856, 856, 857, 859, 859, 860, 861, 862, 864, 864, 865, 867, 867, 868, 870, 870, 872, 872, 874, 875, 875, 876, 877, 879, 880, 881, 881, 882, 883, 885, 885, 886, 887, 888, 890, 891, 891, 893, 893, 894, 895, 897, 898, 899, 900, 901, 902, 902, 903,
|
||||||
|
904, 905, 907, 907, 908, 910, 910, 911, 912, 914, 914, 915, 917, 918, 919, 920, 921, 922, 922, 923, 925, 925, 926, 927, 928, 930, 931, 932, 932, 933, 935, 936, 936, 937, 939, 940, 940, 942, 942, 944, 944, 946, 947, 948, 949, 949, 950, 952, 952, 953, 955, 956,
|
||||||
|
957, 958, 959, 959, 960, 962, 962, 964, 965, 965, 967, 967, 969, 970, 971, 972, 973, 973, 975, 975, 976, 977, 978, 979, 980, 982, 982, 984, 984, 986, 986, 988, 988, 990, 991, 992, 993, 993, 994, 995, 996, 998, 999, 999, 1000, 1002, 1002, 1004, 1005, 1005,
|
||||||
|
1006, 1007, 1008, 1010, 1011, 1011, 1013, 1014, 1015, 1016, 1017, 1018, 1018, 1019, 1020, 1021, 1023
|
||||||
|
},
|
||||||
|
.lineargammatable = {
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11,
|
||||||
|
11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 25, 25,
|
||||||
|
25, 25, 26, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 46, 46, 46,
|
||||||
|
47, 47, 48, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 52, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76,
|
||||||
|
77, 77, 78, 78, 79, 79, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 86, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 92, 93, 94, 94, 95, 95, 96, 97, 97, 98, 99, 99, 100, 100, 101, 102, 102, 103, 104, 104, 105, 105, 106, 107, 107, 108, 109, 109, 110, 111, 111, 112,
|
||||||
|
113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 119, 120, 121, 122, 122, 123, 124, 124, 125, 126, 126, 127, 128, 129, 129, 130, 131, 132, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 140, 141, 142, 143, 144, 144, 145, 146, 147, 147, 148, 149, 150,
|
||||||
|
151, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 164, 164, 165, 166, 167, 168, 169, 169, 170, 171, 172, 173, 174, 175, 176, 176, 177, 178, 179, 180, 181, 182, 183, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 193, 194,
|
||||||
|
195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246,
|
||||||
|
247, 248, 249, 250, 251, 252, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 265, 266, 267, 268, 269, 270, 271, 272, 274, 275, 276, 277, 278, 279, 280, 282, 283, 284, 285, 286, 287, 289, 290, 291, 292, 293, 294, 296, 297, 298, 299, 300, 302, 303, 304, 305,
|
||||||
|
306, 308, 309, 310, 311, 312, 314, 315, 316, 317, 319, 320, 321, 322, 324, 325, 326, 327, 329, 330, 331, 333, 334, 335, 336, 338, 339, 340, 342, 343, 344, 345, 347, 348, 349, 351, 352, 353, 355, 356, 357, 359, 360, 361, 363, 364, 365, 367, 368, 369, 371, 372,
|
||||||
|
373, 375, 376, 378, 379, 380, 382, 383, 384, 386, 387, 389, 390, 391, 393, 394, 396, 397, 399, 400, 401, 403, 404, 406, 407, 409, 410, 411, 413, 414, 416, 417, 419, 420, 422, 423, 425, 426, 428, 429, 431, 432, 434, 435, 437, 438, 440, 441, 443, 444, 446, 447,
|
||||||
|
449, 450, 452, 453, 455, 456, 458, 459, 461, 462, 464, 466, 467, 469, 470, 472, 473, 475, 477, 478, 480, 481, 483, 485, 486, 488, 489, 491, 493, 494, 496, 497, 499, 501, 502, 504, 506, 507, 509, 511, 512, 514, 515, 517, 519, 520, 522, 524, 525, 527, 529, 531,
|
||||||
|
532, 534, 536, 537, 539, 541, 542, 544, 546, 548, 549, 551, 553, 554, 556, 558, 560, 561, 563, 565, 567, 568, 570, 572, 574, 575, 577, 579, 581, 583, 584, 586, 588, 590, 592, 593, 595, 597, 599, 601, 602, 604, 606, 608, 610, 612, 613, 615, 617, 619, 621, 623,
|
||||||
|
625, 626, 628, 630, 632, 634, 636, 638, 639, 641, 643, 645, 647, 649, 651, 653, 655, 657, 659, 660, 662, 664, 666, 668, 670, 672, 674, 676, 678, 680, 682, 684, 686, 688, 690, 692, 694, 696, 698, 700, 702, 704, 706, 708, 710, 712, 714, 716, 718, 720, 722, 724,
|
||||||
|
726, 728, 730, 732, 734, 736, 738, 740, 742, 744, 746, 748, 750, 753, 755, 757, 759, 761, 763, 765, 767, 769, 771, 773, 776, 778, 780, 782, 784, 786, 788, 791, 793, 795, 797, 799, 801, 803, 806, 808, 810, 812, 814, 816, 819, 821, 823, 825, 827, 830, 832, 834,
|
||||||
|
836, 839, 841, 843, 845, 847, 850, 852, 854, 856, 859, 861, 863, 865, 868, 870, 872, 874, 877, 879, 881, 884, 886, 888, 890, 893, 895, 897, 900, 902, 904, 907, 909, 911, 914, 916, 918, 921, 923, 925, 928, 930, 932, 935, 937, 940, 942, 944, 947, 949, 952, 954,
|
||||||
|
956, 959, 961, 964, 966, 968, 971, 973, 976, 978, 981, 983, 985, 988, 990, 993, 995, 998, 1000, 1003, 1005, 1008, 1010, 1013, 1015, 1018, 1020, 1023
|
||||||
|
},
|
||||||
|
.screengammatable = {
|
||||||
|
0, 63, 84, 99, 111, 121, 130, 139, 146, 154, 160, 166, 172, 178, 183, 188, 193, 198, 203, 207, 212, 216, 220, 224, 228, 231, 235, 239, 242, 245, 249, 252, 255, 259, 262, 265, 268, 271, 274, 276, 279, 282, 285, 287, 290, 293, 295, 298, 300, 303, 305, 308,
|
||||||
|
310, 313, 315, 317, 320, 322, 324, 326, 328, 331, 333, 335, 337, 339, 341, 343, 345, 347, 349, 351, 353, 355, 357, 359, 361, 363, 365, 367, 369, 370, 372, 374, 376, 378, 379, 381, 383, 385, 386, 388, 390, 392, 393, 395, 397, 398, 400, 401, 403, 405, 406, 408,
|
||||||
|
409, 411, 413, 414, 416, 417, 419, 420, 422, 423, 425, 426, 428, 429, 431, 432, 434, 435, 436, 438, 439, 441, 442, 444, 445, 446, 448, 449, 450, 452, 453, 455, 456, 457, 459, 460, 461, 463, 464, 465, 466, 468, 469, 470, 472, 473, 474, 475, 477, 478, 479, 480,
|
||||||
|
482, 483, 484, 485, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 499, 500, 501, 502, 503, 504, 505, 507, 508, 509, 510, 511, 512, 513, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539,
|
||||||
|
540, 541, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 585, 586, 587, 588, 589, 590,
|
||||||
|
591, 592, 593, 594, 595, 595, 596, 597, 598, 599, 600, 601, 602, 603, 603, 604, 605, 606, 607, 608, 609, 610, 610, 611, 612, 613, 614, 615, 616, 616, 617, 618, 619, 620, 621, 622, 622, 623, 624, 625, 626, 627, 627, 628, 629, 630, 631, 632, 632, 633, 634, 635,
|
||||||
|
636, 637, 637, 638, 639, 640, 641, 641, 642, 643, 644, 645, 645, 646, 647, 648, 649, 649, 650, 651, 652, 652, 653, 654, 655, 656, 656, 657, 658, 659, 659, 660, 661, 662, 663, 663, 664, 665, 666, 666, 667, 668, 669, 669, 670, 671, 672, 672, 673, 674, 675, 675,
|
||||||
|
676, 677, 678, 678, 679, 680, 681, 681, 682, 683, 684, 684, 685, 686, 686, 687, 688, 689, 689, 690, 691, 692, 692, 693, 694, 694, 695, 696, 697, 697, 698, 699, 699, 700, 701, 701, 702, 703, 704, 704, 705, 706, 706, 707, 708, 708, 709, 710, 711, 711, 712, 713,
|
||||||
|
713, 714, 715, 715, 716, 717, 717, 718, 719, 719, 720, 721, 721, 722, 723, 723, 724, 725, 725, 726, 727, 727, 728, 729, 729, 730, 731, 731, 732, 733, 733, 734, 735, 735, 736, 737, 737, 738, 739, 739, 740, 741, 741, 742, 743, 743, 744, 745, 745, 746, 746, 747,
|
||||||
|
748, 748, 749, 750, 750, 751, 752, 752, 753, 753, 754, 755, 755, 756, 757, 757, 758, 758, 759, 760, 760, 761, 762, 762, 763, 763, 764, 765, 765, 766, 767, 767, 768, 768, 769, 770, 770, 771, 771, 772, 773, 773, 774, 774, 775, 776, 776, 777, 778, 778, 779, 779,
|
||||||
|
780, 781, 781, 782, 782, 783, 784, 784, 785, 785, 786, 786, 787, 788, 788, 789, 789, 790, 791, 791, 792, 792, 793, 794, 794, 795, 795, 796, 796, 797, 798, 798, 799, 799, 800, 801, 801, 802, 802, 803, 803, 804, 805, 805, 806, 806, 807, 807, 808, 809, 809, 810,
|
||||||
|
810, 811, 811, 812, 813, 813, 814, 814, 815, 815, 816, 816, 817, 818, 818, 819, 819, 820, 820, 821, 821, 822, 823, 823, 824, 824, 825, 825, 826, 826, 827, 828, 828, 829, 829, 830, 830, 831, 831, 832, 832, 833, 834, 834, 835, 835, 836, 836, 837, 837, 838, 838,
|
||||||
|
839, 839, 840, 841, 841, 842, 842, 843, 843, 844, 844, 845, 845, 846, 846, 847, 848, 848, 849, 849, 850, 850, 851, 851, 852, 852, 853, 853, 854, 854, 855, 855, 856, 856, 857, 857, 858, 859, 859, 860, 860, 861, 861, 862, 862, 863, 863, 864, 864, 865, 865, 866,
|
||||||
|
866, 867, 867, 868, 868, 869, 869, 870, 870, 871, 871, 872, 872, 873, 873, 874, 874, 875, 875, 876, 876, 877, 877, 878, 878, 879, 879, 880, 880, 881, 881, 882, 882, 883, 883, 884, 884, 885, 885, 886, 886, 887, 887, 888, 888, 889, 889, 890, 890, 891, 891, 892,
|
||||||
|
892, 893, 893, 894, 894, 895, 895, 896, 896, 897, 897, 898, 898, 899, 899, 900, 900, 901, 901, 902, 902, 903, 903, 904, 904, 904, 905, 905, 906, 906, 907, 907, 908, 908, 909, 909, 910, 910, 911, 911, 912, 912, 913, 913, 914, 914, 915, 915, 915, 916, 916, 917,
|
||||||
|
917, 918, 918, 919, 919, 920, 920, 921, 921, 922, 922, 922, 923, 923, 924, 924, 925, 925, 926, 926, 927, 927, 928, 928, 929, 929, 929, 930, 930, 931, 931, 932, 932, 933, 933, 934, 934, 935, 935, 935, 936, 936, 937, 937, 938, 938, 939, 939, 940, 940, 940, 941,
|
||||||
|
941, 942, 942, 943, 943, 944, 944, 944, 945, 945, 946, 946, 947, 947, 948, 948, 949, 949, 949, 950, 950, 951, 951, 952, 952, 953, 953, 953, 954, 954, 955, 955, 956, 956, 957, 957, 957, 958, 958, 959, 959, 960, 960, 961, 961, 961, 962, 962, 963, 963, 964, 964,
|
||||||
|
964, 965, 965, 966, 966, 967, 967, 968, 968, 968, 969, 969, 970, 970, 971, 971, 971, 972, 972, 973, 973, 974, 974, 974, 975, 975, 976, 976, 977, 977, 977, 978, 978, 979, 979, 980, 980, 980, 981, 981, 982, 982, 983, 983, 983, 984, 984, 985, 985, 986, 986, 986,
|
||||||
|
987, 987, 988, 988, 988, 989, 989, 990, 990, 991, 991, 991, 992, 992, 993, 993, 993, 994, 994, 995, 995, 996, 996, 996, 997, 997, 998, 998, 998, 999, 999, 1000, 1000, 1001, 1001, 1001, 1002, 1002, 1003, 1003, 1003, 1004, 1004, 1005, 1005, 1005, 1006, 1006,
|
||||||
|
1007, 1007, 1008, 1008, 1008, 1009, 1009, 1010, 1010, 1010, 1011, 1011, 1012, 1012, 1012, 1013, 1013, 1014, 1014, 1014, 1015, 1015, 1016, 1016, 1016, 1017, 1017, 1018, 1018, 1018, 1019, 1019, 1020, 1020, 1020, 1021, 1021, 1022, 1022, 1023
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
.gamma = 2.2,
|
||||||
|
.brightness = 1.0,
|
||||||
|
.texgamma = 2.2,
|
||||||
|
.lightgamma = 2.4,
|
||||||
|
.texgammatable = {
|
||||||
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
|
||||||
|
66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
|
||||||
|
124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
|
||||||
|
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227,
|
||||||
|
228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
|
||||||
|
},
|
||||||
|
.lightgammatable = {
|
||||||
|
0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 39, 40, 41, 42, 43, 45, 46, 47, 48, 50, 51, 52, 53, 55, 56, 57, 58, 60, 61, 62, 63, 65, 66, 67, 69, 70, 71, 72, 74, 75, 76,
|
||||||
|
78, 79, 80, 81, 83, 84, 85, 87, 88, 89, 91, 92, 93, 94, 96, 97, 98, 100, 101, 102, 104, 105, 106, 108, 109, 110, 112, 113, 114, 116, 117, 118, 120, 121, 122, 124, 125, 126, 128, 129, 130, 132, 133, 134, 136, 137, 138, 140, 141, 142, 144, 145, 147, 148, 149,
|
||||||
|
151, 152, 153, 155, 156, 157, 159, 160, 162, 163, 164, 166, 167, 168, 170, 171, 173, 174, 175, 177, 178, 179, 181, 182, 184, 185, 186, 188, 189, 191, 192, 193, 195, 196, 198, 199, 200, 202, 203, 204, 206, 207, 209, 210, 211, 213, 214, 216, 217, 219, 220, 221,
|
||||||
|
223, 224, 226, 227, 228, 230, 231, 233, 234, 235, 237, 238, 240, 241, 243, 244, 245, 247, 248, 250, 251, 252, 254, 255, 257, 258, 260, 261, 262, 264, 265, 267, 268, 270, 271, 272, 274, 275, 277, 278, 280, 281, 282, 284, 285, 287, 288, 290, 291, 293, 294, 295,
|
||||||
|
297, 298, 300, 301, 303, 304, 306, 307, 308, 310, 311, 313, 314, 316, 317, 319, 320, 321, 323, 324, 326, 327, 329, 330, 332, 333, 335, 336, 337, 339, 340, 342, 343, 345, 346, 348, 349, 351, 352, 354, 355, 356, 358, 359, 361, 362, 364, 365, 367, 368, 370, 371,
|
||||||
|
373, 374, 376, 377, 378, 380, 381, 383, 384, 386, 387, 389, 390, 392, 393, 395, 396, 397, 398, 398, 399, 399, 400, 401, 401, 402, 402, 403, 403, 404, 404, 405, 406, 406, 407, 407, 408, 408, 409, 410, 410, 411, 411, 412, 413, 413, 414, 414, 415, 416, 416, 417,
|
||||||
|
417, 418, 419, 419, 420, 420, 421, 422, 422, 423, 423, 424, 425, 425, 426, 427, 427, 428, 428, 429, 430, 430, 431, 432, 432, 433, 433, 434, 435, 435, 436, 437, 437, 438, 439, 439, 440, 441, 441, 442, 443, 443, 444, 445, 445, 446, 447, 447, 448, 449, 449, 450,
|
||||||
|
451, 451, 452, 453, 453, 454, 455, 455, 456, 457, 457, 458, 459, 459, 460, 461, 461, 462, 463, 464, 464, 465, 466, 466, 467, 468, 468, 469, 470, 471, 471, 472, 473, 473, 474, 475, 476, 476, 477, 478, 478, 479, 480, 481, 481, 482, 483, 483, 484, 485, 486, 486,
|
||||||
|
487, 488, 489, 489, 490, 491, 492, 492, 493, 494, 495, 495, 496, 497, 498, 498, 499, 500, 501, 501, 502, 503, 504, 504, 505, 506, 507, 507, 508, 509, 510, 510, 511, 512, 513, 513, 514, 515, 516, 517, 517, 518, 519, 520, 520, 521, 522, 523, 524, 524, 525, 526,
|
||||||
|
527, 527, 528, 529, 530, 531, 531, 532, 533, 534, 535, 535, 536, 537, 538, 538, 539, 540, 541, 542, 542, 543, 544, 545, 546, 546, 547, 548, 549, 550, 550, 551, 552, 553, 554, 555, 555, 556, 557, 558, 559, 559, 560, 561, 562, 563, 564, 564, 565, 566, 567, 568,
|
||||||
|
568, 569, 570, 571, 572, 573, 573, 574, 575, 576, 577, 578, 578, 579, 580, 581, 582, 583, 583, 584, 585, 586, 587, 588, 588, 589, 590, 591, 592, 593, 593, 594, 595, 596, 597, 598, 599, 599, 600, 601, 602, 603, 604, 605, 605, 606, 607, 608, 609, 610, 611, 611,
|
||||||
|
612, 613, 614, 615, 616, 617, 617, 618, 619, 620, 621, 622, 623, 623, 624, 625, 626, 627, 628, 629, 629, 630, 631, 632, 633, 634, 635, 636, 636, 637, 638, 639, 640, 641, 642, 643, 643, 644, 645, 646, 647, 648, 649, 650, 651, 651, 652, 653, 654, 655, 656, 657,
|
||||||
|
658, 658, 659, 660, 661, 662, 663, 664, 665, 666, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 703,
|
||||||
|
704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 749, 750, 751,
|
||||||
|
752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 795, 796, 797, 798, 799, 800,
|
||||||
|
801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850,
|
||||||
|
851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 900,
|
||||||
|
901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952,
|
||||||
|
953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002,
|
||||||
|
1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1023
|
||||||
|
},
|
||||||
|
.lineargammatable = {
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4,
|
||||||
|
4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17,
|
||||||
|
17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36,
|
||||||
|
36, 36, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 42, 42, 42, 43, 43, 44, 44, 44, 45, 45, 46, 46, 46, 47, 47, 48, 48, 48, 49, 49, 50, 50, 51, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 61, 62, 62, 63,
|
||||||
|
63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 82, 82, 83, 83, 84, 84, 85, 86, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 93, 93, 94, 94, 95, 96, 96, 97, 97, 98, 99,
|
||||||
|
99, 100, 100, 101, 102, 102, 103, 104, 104, 105, 105, 106, 107, 107, 108, 109, 109, 110, 111, 111, 112, 113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 119, 120, 121, 121, 122, 123, 123, 124, 125, 126, 126, 127, 128, 128, 129, 130, 131, 131, 132, 133, 133,
|
||||||
|
134, 135, 136, 136, 137, 138, 139, 139, 140, 141, 142, 142, 143, 144, 145, 145, 146, 147, 148, 148, 149, 150, 151, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 164, 165, 166, 167, 167, 168, 169, 170, 171, 172, 172, 173, 174,
|
||||||
|
175, 176, 177, 177, 178, 179, 180, 181, 182, 183, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 193, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221,
|
||||||
|
222, 223, 224, 225, 226, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
|
||||||
|
274, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 288, 289, 290, 291, 292, 293, 294, 295, 296, 298, 299, 300, 301, 302, 303, 304, 305, 307, 308, 309, 310, 311, 312, 313, 315, 316, 317, 318, 319, 320, 322, 323, 324, 325, 326, 328, 329, 330, 331, 332,
|
||||||
|
333, 335, 336, 337, 338, 339, 341, 342, 343, 344, 346, 347, 348, 349, 350, 352, 353, 354, 355, 357, 358, 359, 360, 362, 363, 364, 365, 367, 368, 369, 370, 372, 373, 374, 375, 377, 378, 379, 381, 382, 383, 384, 386, 387, 388, 390, 391, 392, 393, 395, 396, 397,
|
||||||
|
399, 400, 401, 403, 404, 405, 407, 408, 409, 411, 412, 413, 415, 416, 417, 419, 420, 421, 423, 424, 426, 427, 428, 430, 431, 432, 434, 435, 437, 438, 439, 441, 442, 443, 445, 446, 448, 449, 450, 452, 453, 455, 456, 458, 459, 460, 462, 463, 465, 466, 468, 469,
|
||||||
|
470, 472, 473, 475, 476, 478, 479, 481, 482, 483, 485, 486, 488, 489, 491, 492, 494, 495, 497, 498, 500, 501, 503, 504, 506, 507, 509, 510, 512, 513, 515, 516, 518, 519, 521, 522, 524, 525, 527, 528, 530, 532, 533, 535, 536, 538, 539, 541, 542, 544, 545, 547,
|
||||||
|
549, 550, 552, 553, 555, 556, 558, 560, 561, 563, 564, 566, 568, 569, 571, 572, 574, 576, 577, 579, 580, 582, 584, 585, 587, 589, 590, 592, 593, 595, 597, 598, 600, 602, 603, 605, 607, 608, 610, 612, 613, 615, 617, 618, 620, 622, 623, 625, 627, 628, 630, 632,
|
||||||
|
633, 635, 637, 639, 640, 642, 644, 645, 647, 649, 650, 652, 654, 656, 657, 659, 661, 663, 664, 666, 668, 670, 671, 673, 675, 677, 678, 680, 682, 684, 685, 687, 689, 691, 692, 694, 696, 698, 700, 701, 703, 705, 707, 709, 710, 712, 714, 716, 718, 719, 721, 723,
|
||||||
|
725, 727, 729, 730, 732, 734, 736, 738, 740, 741, 743, 745, 747, 749, 751, 753, 754, 756, 758, 760, 762, 764, 766, 767, 769, 771, 773, 775, 777, 779, 781, 783, 785, 786, 788, 790, 792, 794, 796, 798, 800, 802, 804, 806, 808, 809, 811, 813, 815, 817, 819, 821,
|
||||||
|
823, 825, 827, 829, 831, 833, 835, 837, 839, 841, 843, 845, 847, 849, 851, 853, 855, 857, 859, 861, 863, 865, 867, 869, 871, 873, 875, 877, 879, 881, 883, 885, 887, 889, 891, 893, 895, 897, 899, 901, 903, 905, 907, 910, 912, 914, 916, 918, 920, 922, 924, 926,
|
||||||
|
928, 930, 932, 934, 937, 939, 941, 943, 945, 947, 949, 951, 953, 956, 958, 960, 962, 964, 966, 968, 970, 973, 975, 977, 979, 981, 983, 985, 988, 990, 992, 994, 996, 998, 1001, 1003, 1005, 1007, 1009, 1012, 1014, 1016, 1018, 1020, 1023
|
||||||
|
},
|
||||||
|
.screengammatable = {
|
||||||
|
0, 43, 60, 72, 82, 91, 98, 106, 112, 118, 124, 130, 135, 140, 145, 150, 154, 158, 163, 167, 171, 174, 178, 182, 185, 189, 192, 196, 199, 202, 205, 208, 211, 214, 217, 220, 223, 226, 228, 231, 234, 237, 239, 242, 244, 247, 249, 252, 254, 257, 259, 261,
|
||||||
|
264, 266, 268, 270, 273, 275, 277, 279, 281, 283, 286, 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 311, 313, 315, 317, 319, 321, 323, 324, 326, 328, 330, 331, 333, 335, 337, 338, 340, 342, 343, 345, 347, 348, 350, 352, 353, 355, 357, 358, 360,
|
||||||
|
361, 363, 365, 366, 368, 369, 371, 372, 374, 375, 377, 378, 380, 381, 383, 384, 386, 387, 389, 390, 392, 393, 394, 396, 397, 399, 400, 401, 403, 404, 406, 407, 408, 410, 411, 412, 414, 415, 416, 418, 419, 420, 422, 423, 424, 426, 427, 428, 430, 431, 432, 433,
|
||||||
|
435, 436, 437, 438, 440, 441, 442, 443, 445, 446, 447, 448, 450, 451, 452, 453, 454, 456, 457, 458, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 477, 478, 479, 480, 481, 482, 483, 484, 486, 487, 488, 489, 490, 491, 492, 493, 494,
|
||||||
|
495, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 545, 546, 547,
|
||||||
|
548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 583, 584, 585, 586, 587, 588, 589, 590, 591, 591, 592, 593, 594, 595,
|
||||||
|
596, 597, 598, 598, 599, 600, 601, 602, 603, 604, 604, 605, 606, 607, 608, 609, 609, 610, 611, 612, 613, 614, 615, 615, 616, 617, 618, 619, 620, 620, 621, 622, 623, 624, 624, 625, 626, 627, 628, 629, 629, 630, 631, 632, 633, 633, 634, 635, 636, 637, 637, 638,
|
||||||
|
639, 640, 641, 641, 642, 643, 644, 645, 645, 646, 647, 648, 649, 649, 650, 651, 652, 652, 653, 654, 655, 656, 656, 657, 658, 659, 659, 660, 661, 662, 663, 663, 664, 665, 666, 666, 667, 668, 669, 669, 670, 671, 672, 672, 673, 674, 675, 675, 676, 677, 678, 678,
|
||||||
|
679, 680, 681, 681, 682, 683, 684, 684, 685, 686, 686, 687, 688, 689, 689, 690, 691, 692, 692, 693, 694, 694, 695, 696, 697, 697, 698, 699, 700, 700, 701, 702, 702, 703, 704, 705, 705, 706, 707, 707, 708, 709, 709, 710, 711, 712, 712, 713, 714, 714, 715, 716,
|
||||||
|
716, 717, 718, 719, 719, 720, 721, 721, 722, 723, 723, 724, 725, 725, 726, 727, 728, 728, 729, 730, 730, 731, 732, 732, 733, 734, 734, 735, 736, 736, 737, 738, 738, 739, 740, 740, 741, 742, 742, 743, 744, 744, 745, 746, 746, 747, 748, 748, 749, 750, 750, 751,
|
||||||
|
752, 752, 753, 754, 754, 755, 756, 756, 757, 758, 758, 759, 759, 760, 761, 761, 762, 763, 763, 764, 765, 765, 766, 767, 767, 768, 769, 769, 770, 770, 771, 772, 772, 773, 774, 774, 775, 776, 776, 777, 777, 778, 779, 779, 780, 781, 781, 782, 782, 783, 784, 784,
|
||||||
|
785, 786, 786, 787, 787, 788, 789, 789, 790, 791, 791, 792, 792, 793, 794, 794, 795, 795, 796, 797, 797, 798, 799, 799, 800, 800, 801, 802, 802, 803, 803, 804, 805, 805, 806, 806, 807, 808, 808, 809, 809, 810, 811, 811, 812, 812, 813, 814, 814, 815, 815, 816,
|
||||||
|
817, 817, 818, 818, 819, 820, 820, 821, 821, 822, 823, 823, 824, 824, 825, 825, 826, 827, 827, 828, 828, 829, 830, 830, 831, 831, 832, 833, 833, 834, 834, 835, 835, 836, 837, 837, 838, 838, 839, 839, 840, 841, 841, 842, 842, 843, 843, 844, 845, 845, 846, 846,
|
||||||
|
847, 847, 848, 849, 849, 850, 850, 851, 851, 852, 853, 853, 854, 854, 855, 855, 856, 857, 857, 858, 858, 859, 859, 860, 860, 861, 862, 862, 863, 863, 864, 864, 865, 865, 866, 867, 867, 868, 868, 869, 869, 870, 870, 871, 872, 872, 873, 873, 874, 874, 875, 875,
|
||||||
|
876, 876, 877, 878, 878, 879, 879, 880, 880, 881, 881, 882, 882, 883, 884, 884, 885, 885, 886, 886, 887, 887, 888, 888, 889, 889, 890, 891, 891, 892, 892, 893, 893, 894, 894, 895, 895, 896, 896, 897, 898, 898, 899, 899, 900, 900, 901, 901, 902, 902, 903, 903,
|
||||||
|
904, 904, 905, 905, 906, 906, 907, 908, 908, 909, 909, 910, 910, 911, 911, 912, 912, 913, 913, 914, 914, 915, 915, 916, 916, 917, 917, 918, 918, 919, 920, 920, 921, 921, 922, 922, 923, 923, 924, 924, 925, 925, 926, 926, 927, 927, 928, 928, 929, 929, 930, 930,
|
||||||
|
931, 931, 932, 932, 933, 933, 934, 934, 935, 935, 936, 936, 937, 937, 938, 938, 939, 939, 940, 940, 941, 941, 942, 942, 943, 943, 944, 944, 945, 945, 946, 946, 947, 947, 948, 948, 949, 949, 950, 950, 951, 951, 952, 952, 953, 953, 954, 954, 955, 955, 956, 956,
|
||||||
|
957, 957, 958, 958, 959, 959, 960, 960, 961, 961, 962, 962, 963, 963, 964, 964, 965, 965, 966, 966, 967, 967, 968, 968, 969, 969, 969, 970, 970, 971, 971, 972, 972, 973, 973, 974, 974, 975, 975, 976, 976, 977, 977, 978, 978, 979, 979, 980, 980, 981, 981, 982,
|
||||||
|
982, 982, 983, 983, 984, 984, 985, 985, 986, 986, 987, 987, 988, 988, 989, 989, 990, 990, 991, 991, 991, 992, 992, 993, 993, 994, 994, 995, 995, 996, 996, 997, 997, 998, 998, 999, 999, 999, 1000, 1000, 1001, 1001, 1002, 1002, 1003, 1003, 1004, 1004, 1005,
|
||||||
|
1005, 1006, 1006, 1006, 1007, 1007, 1008, 1008, 1009, 1009, 1010, 1010, 1011, 1011, 1012, 1012, 1012, 1013, 1013, 1014, 1014, 1015, 1015, 1016, 1016, 1017, 1017, 1017, 1018, 1018, 1019, 1019, 1020, 1020, 1021, 1021, 1022, 1022, 1023
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if( i < 0 || i >= ARRAYSIZE( precomputed_data ))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return &precomputed_data[i];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -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( void ) // clgame.palette[color]
|
|
||||||
{
|
|
||||||
return clgame.palette;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
||||||
@@ -178,25 +178,6 @@ static screenfade_t *pfnRefGetScreenFade( void )
|
|||||||
return &clgame.fade;
|
return &clgame.fade;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
===============
|
|
||||||
R_DoResetGamma
|
|
||||||
gamma will be reset for
|
|
||||||
some type of screenshots
|
|
||||||
===============
|
|
||||||
*/
|
|
||||||
static qboolean R_DoResetGamma( void )
|
|
||||||
{
|
|
||||||
switch( cls.scrshot_action )
|
|
||||||
{
|
|
||||||
case scrshot_envshot:
|
|
||||||
case scrshot_skyshot:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static qboolean R_Init_Video_( const int type )
|
static qboolean R_Init_Video_( const int type )
|
||||||
{
|
{
|
||||||
host.apply_opengl_config = true;
|
host.apply_opengl_config = true;
|
||||||
@@ -207,11 +188,6 @@ static qboolean R_Init_Video_( const int type )
|
|||||||
return R_Init_Video( type );
|
return R_Init_Video( type );
|
||||||
}
|
}
|
||||||
|
|
||||||
static model_t **pfnGetModels( void )
|
|
||||||
{
|
|
||||||
return cl.models;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ref_api_t gEngfuncs =
|
static ref_api_t gEngfuncs =
|
||||||
{
|
{
|
||||||
pfnEngineGetParm,
|
pfnEngineGetParm,
|
||||||
@@ -246,14 +222,12 @@ static ref_api_t gEngfuncs =
|
|||||||
Con_DrawString,
|
Con_DrawString,
|
||||||
CL_DrawCenterPrint,
|
CL_DrawCenterPrint,
|
||||||
|
|
||||||
CL_GetViewModel,
|
|
||||||
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,
|
||||||
|
|
||||||
@@ -270,7 +244,6 @@ static ref_api_t gEngfuncs =
|
|||||||
|
|
||||||
Mod_ForName,
|
Mod_ForName,
|
||||||
pfnMod_Extradata,
|
pfnMod_Extradata,
|
||||||
pfnGetModels,
|
|
||||||
|
|
||||||
CL_EntitySetRemapColors,
|
CL_EntitySetRemapColors,
|
||||||
CL_GetRemapInfoForEntity,
|
CL_GetRemapInfoForEntity,
|
||||||
@@ -281,8 +254,6 @@ static ref_api_t gEngfuncs =
|
|||||||
COM_RandomFloat,
|
COM_RandomFloat,
|
||||||
COM_RandomLong,
|
COM_RandomLong,
|
||||||
pfnRefGetScreenFade,
|
pfnRefGetScreenFade,
|
||||||
pfnGetPredictedOrigin,
|
|
||||||
pfnCL_GetPaletteColor,
|
|
||||||
pfnCL_GetScreenInfo,
|
pfnCL_GetScreenInfo,
|
||||||
pfnSetLocalLightLevel,
|
pfnSetLocalLightLevel,
|
||||||
Sys_CheckParm,
|
Sys_CheckParm,
|
||||||
@@ -316,9 +287,11 @@ static ref_api_t gEngfuncs =
|
|||||||
SW_LockBuffer,
|
SW_LockBuffer,
|
||||||
SW_UnlockBuffer,
|
SW_UnlockBuffer,
|
||||||
|
|
||||||
BuildGammaTable,
|
|
||||||
LightToTexGamma,
|
LightToTexGamma,
|
||||||
R_DoResetGamma,
|
LightToTexGammaEx,
|
||||||
|
TextureToGamma,
|
||||||
|
ScreenGammaTable,
|
||||||
|
LinearGammaTable,
|
||||||
|
|
||||||
CL_GetLightStyle,
|
CL_GetLightStyle,
|
||||||
CL_GetDynamicLight,
|
CL_GetDynamicLight,
|
||||||
@@ -332,7 +305,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,
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
s_dsp.c - digital signal processing algorithms for audio FX
|
s_dsp.c - digital signal processing algorithms for audio FX
|
||||||
Copyright (C) 2009 Uncle Mike
|
Copyright (C) 2009 Uncle Mike
|
||||||
|
Copyright (C) 2016-2024 Alibek Omarov
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -333,7 +334,7 @@ DLY_MovePointer
|
|||||||
Checks overflow and moves pointer
|
Checks overflow and moves pointer
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
_inline void DLY_MovePointer( dly_t *dly )
|
static void DLY_MovePointer( dly_t *dly )
|
||||||
{
|
{
|
||||||
if( ++dly->idelayinput >= dly->cdelaysamplesmax )
|
if( ++dly->idelayinput >= dly->cdelaysamplesmax )
|
||||||
dly->idelayinput = 0;
|
dly->idelayinput = 0;
|
||||||
@@ -806,13 +807,9 @@ DSP_Process
|
|||||||
(xash dsp interface)
|
(xash dsp interface)
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
void DSP_Process( int idsp, portable_samplepair_t *pbfront, int sampleCount )
|
void DSP_Process( portable_samplepair_t *pbfront, int sampleCount )
|
||||||
{
|
{
|
||||||
if( dsp_off.value )
|
if( dsp_off.value || !sampleCount )
|
||||||
return;
|
|
||||||
|
|
||||||
// don't process DSP while in menu
|
|
||||||
if( cls.key_dest == key_menu || !sampleCount )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// preset is already installed by CheckNewDspPresets
|
// preset is already installed by CheckNewDspPresets
|
||||||
@@ -833,7 +830,7 @@ DSP_ClearState
|
|||||||
*/
|
*/
|
||||||
void DSP_ClearState( void )
|
void DSP_ClearState( void )
|
||||||
{
|
{
|
||||||
Cvar_SetValue( "room_type", 0.0f );
|
Cvar_DirectSet( &room_type, "0" );
|
||||||
SX_ReloadRoomFX();
|
SX_ReloadRoomFX();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -892,15 +889,15 @@ void CheckNewDspPresets( void )
|
|||||||
|
|
||||||
cur = ptable + idsp_room;
|
cur = ptable + idsp_room;
|
||||||
|
|
||||||
Cvar_SetValue( "room_lp", cur->room_lp );
|
Cvar_DirectSetValue( &sxmod_lowpass, cur->room_lp );
|
||||||
Cvar_SetValue( "room_mod", cur->room_mod );
|
Cvar_DirectSetValue( &sxmod_mod, cur->room_mod );
|
||||||
Cvar_SetValue( "room_size", cur->room_size );
|
Cvar_DirectSetValue( &sxrvb_size, cur->room_size );
|
||||||
Cvar_SetValue( "room_refl", cur->room_refl );
|
Cvar_DirectSetValue( &sxrvb_feedback, cur->room_refl );
|
||||||
Cvar_SetValue( "room_rvblp", cur->room_rvblp );
|
Cvar_DirectSetValue( &sxrvb_lp, cur->room_rvblp );
|
||||||
Cvar_SetValue( "room_delay", cur->room_delay );
|
Cvar_DirectSetValue( &sxdly_delay, cur->room_delay );
|
||||||
Cvar_SetValue( "room_feedback", cur->room_feedback );
|
Cvar_DirectSetValue( &sxdly_feedback, cur->room_feedback );
|
||||||
Cvar_SetValue( "room_dlylp", cur->room_dlylp );
|
Cvar_DirectSetValue( &sxdly_lp, cur->room_dlylp );
|
||||||
Cvar_SetValue( "room_left", cur->room_left );
|
Cvar_DirectSetValue( &sxste_delay, cur->room_left );
|
||||||
}
|
}
|
||||||
|
|
||||||
room_typeprev = idsp_room;
|
room_typeprev = idsp_room;
|
||||||
@@ -929,7 +926,7 @@ static void SX_Profiling_f( void )
|
|||||||
|
|
||||||
if( Cmd_Argc() > 1 )
|
if( Cmd_Argc() > 1 )
|
||||||
{
|
{
|
||||||
Cvar_SetValue( "room_type", Q_atof( Cmd_Argv( 1 )));
|
Cvar_DirectSetValue( &room_type, Q_atof( Cmd_Argv( 1 )));
|
||||||
SX_ReloadRoomFX();
|
SX_ReloadRoomFX();
|
||||||
CheckNewDspPresets(); // we just need idsp_room immediately, for message below
|
CheckNewDspPresets(); // we just need idsp_room immediately, for message below
|
||||||
}
|
}
|
||||||
@@ -939,7 +936,7 @@ static void SX_Profiling_f( void )
|
|||||||
start = Sys_DoubleTime();
|
start = Sys_DoubleTime();
|
||||||
for( calls = 10000; calls; calls-- )
|
for( calls = 10000; calls; calls-- )
|
||||||
{
|
{
|
||||||
DSP_Process( idsp_room, testbuffer, 512 );
|
DSP_Process( testbuffer, 512 );
|
||||||
}
|
}
|
||||||
end = Sys_DoubleTime();
|
end = Sys_DoubleTime();
|
||||||
|
|
||||||
@@ -947,7 +944,7 @@ static void SX_Profiling_f( void )
|
|||||||
|
|
||||||
if( Cmd_Argc() > 1 )
|
if( Cmd_Argc() > 1 )
|
||||||
{
|
{
|
||||||
Cvar_SetValue( "room_type", oldroom );
|
Cvar_DirectSetValue( &room_type, oldroom );
|
||||||
SX_ReloadRoomFX();
|
SX_ReloadRoomFX();
|
||||||
CheckNewDspPresets();
|
CheckNewDspPresets();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -648,20 +648,6 @@ void S_StartSound( const vec3_t pos, int ent, int chan, sound_t handle, float fv
|
|||||||
|
|
||||||
// Init client entity mouth movement vars
|
// Init client entity mouth movement vars
|
||||||
SND_InitMouth( ent, chan );
|
SND_InitMouth( ent, chan );
|
||||||
|
|
||||||
for( ch_idx = NUM_AMBIENTS, check = channels + NUM_AMBIENTS; ch_idx < MAX_DYNAMIC_CHANNELS; ch_idx++, check++)
|
|
||||||
{
|
|
||||||
if( check == target_chan ) continue;
|
|
||||||
|
|
||||||
if( check->sfx == sfx && !check->pMixer.sample )
|
|
||||||
{
|
|
||||||
// skip up to 0.1 seconds of audio
|
|
||||||
int skip = COM_RandomLong( 0, (long)( 0.1f * check->sfx->cache->rate ));
|
|
||||||
|
|
||||||
S_SetSampleStart( check, sfx->cache, skip );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -999,7 +999,8 @@ void MIX_PaintChannels( int endtime )
|
|||||||
MIX_UpsampleAllPaintbuffers( end, count );
|
MIX_UpsampleAllPaintbuffers( end, count );
|
||||||
|
|
||||||
// process all sounds with DSP
|
// process all sounds with DSP
|
||||||
DSP_Process( idsp_room, MIX_GetPFrontFromIPaint( IROOMBUFFER ), count );
|
if( cls.key_dest != key_menu )
|
||||||
|
DSP_Process( MIX_GetPFrontFromIPaint( IROOMBUFFER ), count );
|
||||||
|
|
||||||
// add music or soundtrack from movie (no dsp)
|
// add music or soundtrack from movie (no dsp)
|
||||||
MIX_MixPaintbuffers( IPAINTBUFFER, IROOMBUFFER, IPAINTBUFFER, count, S_GetMasterVolume() );
|
MIX_MixPaintbuffers( IPAINTBUFFER, IROOMBUFFER, IPAINTBUFFER, count, S_GetMasterVolume() );
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ void S_StartBackgroundTrack( const char *introTrack, const char *mainTrack, int
|
|||||||
|
|
||||||
// open stream
|
// open stream
|
||||||
s_bgTrack.stream = FS_OpenStream( introTrack );
|
s_bgTrack.stream = FS_OpenStream( introTrack );
|
||||||
|
|
||||||
Q_strncpy( s_bgTrack.current, introTrack, sizeof( s_bgTrack.current ));
|
Q_strncpy( s_bgTrack.current, introTrack, sizeof( s_bgTrack.current ));
|
||||||
memset( &musicfade, 0, sizeof( musicfade )); // clear any soundfade
|
memset( &musicfade, 0, sizeof( musicfade )); // clear any soundfade
|
||||||
s_bgTrack.source = cls.key_dest;
|
s_bgTrack.source = cls.key_dest;
|
||||||
|
|||||||
@@ -16,204 +16,6 @@ GNU General Public License for more details.
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
|
||||||
// hardcoded macros to test for zero crossing
|
|
||||||
#define ZERO_X_8( b ) (( b ) < 2 && ( b ) > -2 )
|
|
||||||
#define ZERO_X_16( b ) (( b ) < 512 && ( b ) > -512 )
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Purpose: Search backward for a zero crossing starting at sample
|
|
||||||
// Input : sample - starting point
|
|
||||||
// Output : position of zero crossing
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
int S_ZeroCrossingBefore( wavdata_t *pWaveData, int sample )
|
|
||||||
{
|
|
||||||
if( pWaveData == NULL )
|
|
||||||
return sample;
|
|
||||||
|
|
||||||
if( pWaveData->type == WF_PCMDATA )
|
|
||||||
{
|
|
||||||
int sampleSize;
|
|
||||||
|
|
||||||
sampleSize = pWaveData->width * pWaveData->channels;
|
|
||||||
|
|
||||||
// this can never be zero -- other functions divide by this.
|
|
||||||
// This should never happen, but avoid crashing
|
|
||||||
if( sampleSize <= 0 ) sampleSize = 1;
|
|
||||||
|
|
||||||
if( pWaveData->width == 1 )
|
|
||||||
{
|
|
||||||
signed char *pData = (signed char *)(pWaveData->buffer + sample * sampleSize);
|
|
||||||
qboolean zero = false;
|
|
||||||
|
|
||||||
if( pWaveData->channels == 1 )
|
|
||||||
{
|
|
||||||
while( sample > 0 && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_8( *pData ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sample--;
|
|
||||||
pData--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while( sample > 0 && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_8( *pData ) && ZERO_X_8( pData[1] ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sample--;
|
|
||||||
pData--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
short *pData = (short *)(pWaveData->buffer + sample * sampleSize);
|
|
||||||
qboolean zero = false;
|
|
||||||
|
|
||||||
if( pWaveData->channels == 1 )
|
|
||||||
{
|
|
||||||
while( sample > 0 && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_16(*pData ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pData--;
|
|
||||||
sample--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while( sample > 0 && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_16( *pData ) && ZERO_X_16( pData[1] ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sample--;
|
|
||||||
pData--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sample;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Purpose: Search forward for a zero crossing
|
|
||||||
// Input : sample - starting point
|
|
||||||
// Output : position of found zero crossing
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
int S_ZeroCrossingAfter( wavdata_t *pWaveData, int sample )
|
|
||||||
{
|
|
||||||
if( pWaveData == NULL )
|
|
||||||
return sample;
|
|
||||||
|
|
||||||
if( pWaveData->type == WF_PCMDATA )
|
|
||||||
{
|
|
||||||
int sampleSize;
|
|
||||||
|
|
||||||
sampleSize = pWaveData->width * pWaveData->channels;
|
|
||||||
|
|
||||||
// this can never be zero -- other functions divide by this.
|
|
||||||
// This should never happen, but avoid crashing
|
|
||||||
if( sampleSize <= 0 ) sampleSize = 1;
|
|
||||||
|
|
||||||
if( pWaveData->width == 1 ) // 8-bit
|
|
||||||
{
|
|
||||||
signed char *pData = (signed char *)(pWaveData->buffer + sample * sampleSize);
|
|
||||||
qboolean zero = false;
|
|
||||||
|
|
||||||
if( pWaveData->channels == 1 )
|
|
||||||
{
|
|
||||||
while( sample < pWaveData->samples && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_8( *pData ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sample++;
|
|
||||||
pData++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while( sample < pWaveData->samples && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_8( *pData ) && ZERO_X_8( pData[1] ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sample++;
|
|
||||||
pData++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
short *pData = (short *)(pWaveData->buffer + sample * sampleSize);
|
|
||||||
qboolean zero = false;
|
|
||||||
|
|
||||||
if( pWaveData->channels == 1 )
|
|
||||||
{
|
|
||||||
while( sample > 0 && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_16( *pData ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pData++;
|
|
||||||
sample++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while( sample > 0 && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_16( *pData ) && ZERO_X_16( pData[1] ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sample++;
|
|
||||||
pData++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sample;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: wrap the position wrt looping
|
// Purpose: wrap the position wrt looping
|
||||||
// Input : samplePosition - absolute position
|
// Input : samplePosition - absolute position
|
||||||
@@ -279,28 +81,3 @@ int S_GetOutputData( wavdata_t *pSource, void **pData, int samplePosition, int s
|
|||||||
|
|
||||||
return sampleCount;
|
return sampleCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// move the current position to newPosition
|
|
||||||
void S_SetSampleStart( channel_t *pChan, wavdata_t *pSource, int newPosition )
|
|
||||||
{
|
|
||||||
if( pSource )
|
|
||||||
newPosition = S_ZeroCrossingAfter( pSource, newPosition );
|
|
||||||
|
|
||||||
pChan->pMixer.sample = newPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
// end playback at newEndPosition
|
|
||||||
void S_SetSampleEnd( channel_t *pChan, wavdata_t *pSource, int newEndPosition )
|
|
||||||
{
|
|
||||||
// forced end of zero means play the whole sample
|
|
||||||
if( !newEndPosition ) newEndPosition = 1;
|
|
||||||
|
|
||||||
if( pSource )
|
|
||||||
newEndPosition = S_ZeroCrossingBefore( pSource, newEndPosition );
|
|
||||||
|
|
||||||
// past current position? limit.
|
|
||||||
if( newEndPosition < pChan->pMixer.sample )
|
|
||||||
newEndPosition = pChan->pMixer.sample;
|
|
||||||
|
|
||||||
pChan->pMixer.forcedEndSample = newEndPosition;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -18,10 +18,126 @@ GNU General Public License for more details.
|
|||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#define TRIM_SCAN_MAX 255
|
||||||
|
#define TRIM_SAMPLES_BELOW_8 2
|
||||||
|
#define TRIM_SAMPLES_BELOW_16 512 // 65k * 2 / 256
|
||||||
|
|
||||||
|
#define CVOXFILESENTENCEMAX 4096
|
||||||
|
|
||||||
static int cszrawsentences = 0;
|
static int cszrawsentences = 0;
|
||||||
static char *rgpszrawsentence[CVOXFILESENTENCEMAX];
|
static char *rgpszrawsentence[CVOXFILESENTENCEMAX];
|
||||||
static const char *voxperiod = "_period", *voxcomma = "_comma";
|
static const char *voxperiod = "_period", *voxcomma = "_comma";
|
||||||
|
|
||||||
|
static qboolean S_ShouldTrimSample8( const int8_t *buf, int channels )
|
||||||
|
{
|
||||||
|
if( abs( buf[0] ) > TRIM_SAMPLES_BELOW_8 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( channels >= 2 && abs( buf[1] ) > TRIM_SAMPLES_BELOW_8 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static qboolean S_ShouldTrimSample16( const int16_t *buf, int channels )
|
||||||
|
{
|
||||||
|
if( abs( buf[0] ) > TRIM_SAMPLES_BELOW_16 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( channels >= 2 && abs( buf[1] ) > TRIM_SAMPLES_BELOW_16 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int S_TrimStart( const wavdata_t *wav, int start )
|
||||||
|
{
|
||||||
|
size_t channels = wav->channels, width = wav->width, i;
|
||||||
|
|
||||||
|
if( wav->type != WF_PCMDATA )
|
||||||
|
return start;
|
||||||
|
|
||||||
|
if( width == 1 )
|
||||||
|
{
|
||||||
|
const int8_t *data = (const int8_t *)&wav->buffer[channels * width * start];
|
||||||
|
|
||||||
|
for( i = 0; i < TRIM_SCAN_MAX && start < wav->samples; i++ )
|
||||||
|
{
|
||||||
|
if( !S_ShouldTrimSample8( data, wav->channels ))
|
||||||
|
break;
|
||||||
|
|
||||||
|
start += channels;
|
||||||
|
data += channels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( width == 2 )
|
||||||
|
{
|
||||||
|
const int16_t *data = (const int16_t *)&wav->buffer[channels * width * start];
|
||||||
|
|
||||||
|
for( i = 0; i < TRIM_SCAN_MAX && start < wav->samples; i++ )
|
||||||
|
{
|
||||||
|
if( !S_ShouldTrimSample16( data, wav->channels ))
|
||||||
|
break;
|
||||||
|
|
||||||
|
start += channels;
|
||||||
|
data += channels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int S_TrimEnd( const wavdata_t *wav, int end )
|
||||||
|
{
|
||||||
|
size_t channels = wav->channels, width = wav->width, i;
|
||||||
|
|
||||||
|
if( wav->type != WF_PCMDATA )
|
||||||
|
return end;
|
||||||
|
|
||||||
|
if( width == 1 )
|
||||||
|
{
|
||||||
|
const int8_t *data = (const int8_t *)&wav->buffer[channels * width * end];
|
||||||
|
|
||||||
|
for( i = 0; i < TRIM_SCAN_MAX && end > 0; i++ )
|
||||||
|
{
|
||||||
|
if( !S_ShouldTrimSample8( data, wav->channels ))
|
||||||
|
break;
|
||||||
|
|
||||||
|
end -= channels;
|
||||||
|
data -= channels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( width == 2 )
|
||||||
|
{
|
||||||
|
const int16_t *data = (const int16_t *)&wav->buffer[channels * width * end];
|
||||||
|
|
||||||
|
for( i = 0; i < TRIM_SCAN_MAX && end > 0; i++ )
|
||||||
|
{
|
||||||
|
if( !S_ShouldTrimSample16( data, wav->channels ))
|
||||||
|
break;
|
||||||
|
|
||||||
|
end -= channels;
|
||||||
|
data -= channels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void S_TrimStartEndTimes( channel_t *ch, wavdata_t *wav, int start, int end )
|
||||||
|
{
|
||||||
|
ch->pMixer.sample = start = S_TrimStart( wav, start );
|
||||||
|
|
||||||
|
// don't overrun the buffer while trimming end
|
||||||
|
if( end == 0 )
|
||||||
|
end = wav->samples - wav->channels;
|
||||||
|
|
||||||
|
if( end < start )
|
||||||
|
end = start;
|
||||||
|
|
||||||
|
ch->pMixer.forcedEndSample = S_TrimEnd( wav, end );
|
||||||
|
}
|
||||||
|
|
||||||
// return number of samples mixed
|
// return number of samples mixed
|
||||||
int VOX_MixDataToDevice( channel_t *pchan, int sampleCount, int outputRate, int outputOffset )
|
int VOX_MixDataToDevice( channel_t *pchan, int sampleCount, int outputRate, int outputOffset )
|
||||||
{
|
{
|
||||||
@@ -78,11 +194,7 @@ void VOX_LoadWord( channel_t *ch )
|
|||||||
|
|
||||||
if( end <= start ) end = 0;
|
if( end <= start ) end = 0;
|
||||||
|
|
||||||
if( start )
|
S_TrimStartEndTimes( ch, data, start * 0.01f * samples, end * 0.01f * samples );
|
||||||
S_SetSampleStart( ch, data, start * 0.01f * samples );
|
|
||||||
|
|
||||||
if( end )
|
|
||||||
S_SetSampleEnd( ch, data, end * 0.01f * samples );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VOX_FreeWord( channel_t *ch )
|
void VOX_FreeWord( channel_t *ch )
|
||||||
|
|||||||
@@ -255,8 +255,7 @@ void S_InitSounds( void );
|
|||||||
void SX_Init( void );
|
void SX_Init( void );
|
||||||
void SX_Free( void );
|
void SX_Free( void );
|
||||||
void CheckNewDspPresets( void );
|
void CheckNewDspPresets( void );
|
||||||
void DSP_Process( int idsp, portable_samplepair_t *pbfront, int sampleCount );
|
void DSP_Process( portable_samplepair_t *pbfront, int sampleCount );
|
||||||
float DSP_GetGain( int idsp );
|
|
||||||
void DSP_ClearState( void );
|
void DSP_ClearState( void );
|
||||||
|
|
||||||
qboolean S_Init( void );
|
qboolean S_Init( void );
|
||||||
@@ -305,8 +304,6 @@ int S_ZeroCrossingAfter( wavdata_t *pWaveData, int sample );
|
|||||||
int S_ZeroCrossingBefore( wavdata_t *pWaveData, int sample );
|
int S_ZeroCrossingBefore( wavdata_t *pWaveData, int sample );
|
||||||
int S_ConvertLoopedPosition( wavdata_t *pSource, int samplePosition, qboolean use_loop );
|
int S_ConvertLoopedPosition( wavdata_t *pSource, int samplePosition, qboolean use_loop );
|
||||||
int S_GetOutputData( wavdata_t *pSource, void **pData, int samplePosition, int sampleCount, qboolean use_loop );
|
int S_GetOutputData( wavdata_t *pSource, void **pData, int samplePosition, int sampleCount, qboolean use_loop );
|
||||||
void S_SetSampleStart( channel_t *pChan, wavdata_t *pSource, int newPosition );
|
|
||||||
void S_SetSampleEnd( channel_t *pChan, wavdata_t *pSource, int newEndPosition );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// s_vox.c
|
// s_vox.c
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
static CVAR_DEFINE( window_width, "width", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen width" );
|
static CVAR_DEFINE( window_width, "width", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen width" );
|
||||||
static CVAR_DEFINE( window_height, "height", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen height" );
|
static CVAR_DEFINE( window_height, "height", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen height" );
|
||||||
static CVAR_DEFINE( vid_brightness, "brightness", "0.0", FCVAR_ARCHIVE, "brightness factor" );
|
|
||||||
static CVAR_DEFINE( vid_gamma, "gamma", "2.5", FCVAR_ARCHIVE, "gamma amount" );
|
|
||||||
static CVAR_DEFINE_AUTO( vid_mode, "0", FCVAR_RENDERINFO, "current video mode index (used only for storage)" );
|
static CVAR_DEFINE_AUTO( vid_mode, "0", FCVAR_RENDERINFO, "current video mode index (used only for storage)" );
|
||||||
static CVAR_DEFINE_AUTO( vid_rotate, "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen rotation (0-3)" );
|
static CVAR_DEFINE_AUTO( vid_rotate, "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen rotation (0-3)" );
|
||||||
static CVAR_DEFINE_AUTO( vid_scale, "1.0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "pixel scale" );
|
static CVAR_DEFINE_AUTO( vid_scale, "1.0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "pixel scale" );
|
||||||
@@ -36,19 +34,6 @@ CVAR_DEFINE( window_ypos, "_window_ypos", "-1", FCVAR_RENDERINFO, "window positi
|
|||||||
|
|
||||||
glwstate_t glw_state;
|
glwstate_t glw_state;
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
VID_StartupGamma
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void VID_StartupGamma( void )
|
|
||||||
{
|
|
||||||
BuildGammaTable( vid_gamma.value, vid_brightness.value );
|
|
||||||
Con_Reportf( "VID_StartupGamma: gamma %g brightness %g\n", vid_gamma.value, vid_brightness.value );
|
|
||||||
ClearBits( vid_brightness.flags, FCVAR_CHANGED );
|
|
||||||
ClearBits( vid_gamma.flags, FCVAR_CHANGED );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
VID_InitDefaultResolution
|
VID_InitDefaultResolution
|
||||||
@@ -224,8 +209,6 @@ void VID_Init( void )
|
|||||||
Cvar_RegisterVariable( &vid_scale );
|
Cvar_RegisterVariable( &vid_scale );
|
||||||
Cvar_RegisterVariable( &vid_fullscreen );
|
Cvar_RegisterVariable( &vid_fullscreen );
|
||||||
Cvar_RegisterVariable( &vid_maximized );
|
Cvar_RegisterVariable( &vid_maximized );
|
||||||
Cvar_RegisterVariable( &vid_brightness );
|
|
||||||
Cvar_RegisterVariable( &vid_gamma );
|
|
||||||
Cvar_RegisterVariable( &window_xpos );
|
Cvar_RegisterVariable( &window_xpos );
|
||||||
Cvar_RegisterVariable( &window_ypos );
|
Cvar_RegisterVariable( &window_ypos );
|
||||||
|
|
||||||
@@ -233,5 +216,6 @@ void VID_Init( void )
|
|||||||
// but supported mode list is filled by backends, so numbers are not portable any more
|
// but supported mode list is filled by backends, so numbers are not portable any more
|
||||||
Cmd_AddRestrictedCommand( "vid_setmode", VID_Mode_f, "display video mode" );
|
Cmd_AddRestrictedCommand( "vid_setmode", VID_Mode_f, "display video mode" );
|
||||||
|
|
||||||
|
V_Init(); // init gamma
|
||||||
R_Init(); // init renderer
|
R_Init(); // init renderer
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,5 @@ void R_SaveVideoMode( int w, int h, int render_w, int render_h, qboolean maximiz
|
|||||||
void VID_SetDisplayTransform( int *render_w, int *render_h );
|
void VID_SetDisplayTransform( int *render_w, int *render_h );
|
||||||
void VID_CheckChanges( void );
|
void VID_CheckChanges( void );
|
||||||
const char *VID_GetModeString( int vid_mode );
|
const char *VID_GetModeString( int vid_mode );
|
||||||
void VID_StartupGamma( void );
|
|
||||||
|
|
||||||
#endif // VID_COMMON
|
#endif // VID_COMMON
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ GNU General Public License for more details.
|
|||||||
#define VOX_H
|
#define VOX_H
|
||||||
|
|
||||||
#define CVOXWORDMAX 64
|
#define CVOXWORDMAX 64
|
||||||
#define CVOXFILESENTENCEMAX 4096
|
|
||||||
|
|
||||||
#define SENTENCE_INDEX -99999 // unique sentence index
|
#define SENTENCE_INDEX -99999 // unique sentence index
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -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( int features );
|
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 );
|
||||||
@@ -810,8 +812,13 @@ void S_StopBackgroundTrack( void );
|
|||||||
void S_StopAllSounds( qboolean ambient );
|
void S_StopAllSounds( qboolean ambient );
|
||||||
|
|
||||||
// gamma routines
|
// gamma routines
|
||||||
void BuildGammaTable( float gamma, float brightness );
|
|
||||||
byte LightToTexGamma( byte b );
|
byte LightToTexGamma( byte b );
|
||||||
|
byte TextureToGamma( byte );
|
||||||
|
uint LightToTexGammaEx( uint );
|
||||||
|
uint ScreenGammaTable( uint );
|
||||||
|
uint LinearGammaTable( uint );
|
||||||
|
void V_Init( void );
|
||||||
|
void V_CheckGamma( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
// identification.c
|
// identification.c
|
||||||
|
|||||||
@@ -563,6 +563,27 @@ void Cvar_RegisterVariable( convar_t *var )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static qboolean Cvar_CanSet( const convar_t *cv )
|
||||||
|
{
|
||||||
|
if( FBitSet( cv->flags, FCVAR_READ_ONLY ))
|
||||||
|
{
|
||||||
|
Con_Printf( "%s is read-only.\n", cv->name );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( FBitSet( cv->flags, FCVAR_CHEAT ) && !host.allow_cheats )
|
||||||
|
{
|
||||||
|
Con_Printf( "%s is cheat protected.\n", cv->name );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// just tell user about deferred changes
|
||||||
|
if( FBitSet( cv->flags, FCVAR_LATCH ) && ( SV_Active() || CL_Active( )))
|
||||||
|
Con_Printf( "%s will be changed upon restarting.\n", cv->name );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
Cvar_Set2
|
Cvar_Set2
|
||||||
@@ -632,22 +653,9 @@ static convar_t *Cvar_Set2( const char *var_name, const char *value )
|
|||||||
force = true;
|
force = true;
|
||||||
|
|
||||||
if( !force )
|
if( !force )
|
||||||
{
|
{
|
||||||
if( FBitSet( var->flags, FCVAR_READ_ONLY ))
|
if( !Cvar_CanSet( var ))
|
||||||
{
|
|
||||||
Con_Printf( "%s is read-only.\n", var->name );
|
|
||||||
return var;
|
return var;
|
||||||
}
|
|
||||||
|
|
||||||
if( FBitSet( var->flags, FCVAR_CHEAT ) && !host.allow_cheats )
|
|
||||||
{
|
|
||||||
Con_Printf( "%s is cheat protected.\n", var->name );
|
|
||||||
return var;
|
|
||||||
}
|
|
||||||
|
|
||||||
// just tell user about deferred changes
|
|
||||||
if( FBitSet( var->flags, FCVAR_LATCH ) && ( SV_Active() || CL_Active( )))
|
|
||||||
Con_Printf( "%s will be changed upon restarting.\n", var->name );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pszValue = Cvar_ValidateString( var, value );
|
pszValue = Cvar_ValidateString( var, value );
|
||||||
@@ -694,21 +702,8 @@ void Cvar_DirectSet( convar_t *var, const char *value )
|
|||||||
return; // how this possible?
|
return; // how this possible?
|
||||||
}
|
}
|
||||||
|
|
||||||
if( FBitSet( var->flags, FCVAR_READ_ONLY ))
|
if( !Cvar_CanSet( var ))
|
||||||
{
|
|
||||||
Con_Printf( "%s is read-only.\n", var->name );
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if( FBitSet( var->flags, FCVAR_CHEAT ) && !host.allow_cheats )
|
|
||||||
{
|
|
||||||
Con_Printf( "%s is cheat protected.\n", var->name );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// just tell user about deferred changes
|
|
||||||
if( FBitSet( var->flags, FCVAR_LATCH ) && ( SV_Active() || CL_Active( )))
|
|
||||||
Con_Printf( "%s will be changed upon restarting.\n", var->name );
|
|
||||||
|
|
||||||
// check value
|
// check value
|
||||||
if( !value )
|
if( !value )
|
||||||
@@ -741,6 +736,24 @@ void Cvar_DirectSet( convar_t *var, const char *value )
|
|||||||
Cvar_Changed( var );
|
Cvar_Changed( var );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
============
|
||||||
|
Cvar_DirectSetValue
|
||||||
|
|
||||||
|
functionally is the same as Cvar_SetValue but for direct cvar access
|
||||||
|
============
|
||||||
|
*/
|
||||||
|
void Cvar_DirectSetValue( convar_t *var, float value )
|
||||||
|
{
|
||||||
|
char val[32];
|
||||||
|
|
||||||
|
if( fabs( value - (int)value ) < 0.000001 )
|
||||||
|
Q_snprintf( val, sizeof( val ), "%d", (int)value );
|
||||||
|
else Q_snprintf( val, sizeof( val ), "%f", value );
|
||||||
|
|
||||||
|
Cvar_DirectSet( var, val );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
Cvar_FullSet
|
Cvar_FullSet
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ convar_t *Cvar_Getf( const char *var_name, int flags, const char *description, c
|
|||||||
void Cvar_LookupVars( int checkbit, void *buffer, void *ptr, setpair_t callback );
|
void Cvar_LookupVars( int checkbit, void *buffer, void *ptr, setpair_t callback );
|
||||||
void Cvar_FullSet( const char *var_name, const char *value, int flags );
|
void Cvar_FullSet( const char *var_name, const char *value, int flags );
|
||||||
void Cvar_DirectSet( convar_t *var, const char *value );
|
void Cvar_DirectSet( convar_t *var, const char *value );
|
||||||
|
void Cvar_DirectSetValue( convar_t *var, float value );
|
||||||
void Cvar_Set( const char *var_name, const char *value );
|
void Cvar_Set( const char *var_name, const char *value );
|
||||||
void Cvar_SetValue( const char *var_name, float value );
|
void Cvar_SetValue( const char *var_name, float value );
|
||||||
const char *Cvar_BuildAutoDescription( const char *szName, int flags );
|
const char *Cvar_BuildAutoDescription( const char *szName, int flags );
|
||||||
|
|||||||
@@ -247,4 +247,14 @@ void CL_HudMessage( const char *pMessage )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
byte TextureToGamma( byte b )
|
||||||
|
{
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte LightToTexGamma( byte b )
|
||||||
|
{
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // XASH_DEDICATED
|
#endif // XASH_DEDICATED
|
||||||
|
|||||||
@@ -1,78 +0,0 @@
|
|||||||
/*
|
|
||||||
gamma.c - gamma routines
|
|
||||||
Copyright (C) 2011 Uncle Mike
|
|
||||||
|
|
||||||
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 "common.h"
|
|
||||||
#include "xash3d_mathlib.h"
|
|
||||||
#include "enginefeatures.h"
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Gamma conversion support
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
static byte lightgammatable[256];
|
|
||||||
static int lineargammatable[1024];
|
|
||||||
static int screengammatable[1024];
|
|
||||||
|
|
||||||
void BuildGammaTable( float lightgamma, float brightness )
|
|
||||||
{
|
|
||||||
int i, inf;
|
|
||||||
float f, g, g1, g3;
|
|
||||||
|
|
||||||
lightgamma = bound( 1.8f, lightgamma, 3.0f );
|
|
||||||
brightness = bound( 0.0f, brightness, 10.0f );
|
|
||||||
|
|
||||||
if( brightness <= 0.0f )
|
|
||||||
g3 = 0.125f;
|
|
||||||
else if( brightness > 1.0f )
|
|
||||||
g3 = 0.05f;
|
|
||||||
else g3 = 0.125f - (brightness * brightness) * 0.075f;
|
|
||||||
|
|
||||||
g = 1.0f / lightgamma;
|
|
||||||
g1 = GAMMA * g;
|
|
||||||
|
|
||||||
for( i = 0; i < 256; i++ )
|
|
||||||
{
|
|
||||||
f = pow( i / 255.f, GAMMA );
|
|
||||||
|
|
||||||
// scale up
|
|
||||||
if( brightness > 1.0f )
|
|
||||||
f = f * brightness;
|
|
||||||
|
|
||||||
// shift up
|
|
||||||
if( f <= g3 ) f = (f / g3) * 0.125f;
|
|
||||||
else f = 0.125f + ((f - g3) / (1.0f - g3)) * 0.875f;
|
|
||||||
|
|
||||||
// convert linear space to desired gamma space
|
|
||||||
inf = (int)( 255.0f * pow( f, g ));
|
|
||||||
|
|
||||||
lightgammatable[i] = bound( 0, inf, 255 );
|
|
||||||
}
|
|
||||||
|
|
||||||
for( i = 0; i < 1024; i++ )
|
|
||||||
{
|
|
||||||
// convert from screen gamma space to linear space
|
|
||||||
lineargammatable[i] = 1023 * pow( i / 1023.0f, g1 );
|
|
||||||
|
|
||||||
// convert from linear gamma space to screen space
|
|
||||||
screengammatable[i] = 1023 * pow( i / 1023.0f, 1.0f / g1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
byte LightToTexGamma( byte b )
|
|
||||||
{
|
|
||||||
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
|
|
||||||
return b;
|
|
||||||
else
|
|
||||||
return lightgammatable[b];
|
|
||||||
}
|
|
||||||
@@ -190,29 +190,68 @@ void Host_ShutdownServer( void )
|
|||||||
Host_PrintEngineFeatures
|
Host_PrintEngineFeatures
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Host_PrintEngineFeatures( int features )
|
static void Host_PrintEngineFeatures( int features )
|
||||||
{
|
{
|
||||||
const char *features_str[] =
|
struct
|
||||||
{
|
{
|
||||||
"Big World Support",
|
uint32_t mask;
|
||||||
"Quake Compatibility",
|
const char *msg;
|
||||||
"Deluxemap Support",
|
} features_str[] =
|
||||||
"Improved MOVETYPE_PUSH",
|
{
|
||||||
"Large Lightmaps",
|
{ ENGINE_WRITE_LARGE_COORD, "Big World Support" },
|
||||||
"Stupid Quake Bug Compensation",
|
{ ENGINE_QUAKE_COMPATIBLE, "Quake Compatibility" },
|
||||||
"Improved Trace Line",
|
{ ENGINE_LOAD_DELUXEDATA, "Deluxemap Support" },
|
||||||
"Studio MOVETYPE_STEP Lerping",
|
{ ENGINE_PHYSICS_PUSHER_EXT, "Improved MOVETYPE_PUSH" },
|
||||||
"Linear Gamma Space"
|
{ 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;
|
int i;
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( features_str ); i++ )
|
for( i = 0; i < ARRAYSIZE( features_str ); i++ )
|
||||||
{
|
{
|
||||||
if( FBitSet( features, BIT( i )))
|
if( FBitSet( features, features_str[i].mask ))
|
||||||
Con_Reportf( "^3EXT:^7 %s is enabled\n", features_str[i] );
|
Con_Reportf( "^3EXT:^7 %s is enabled\n", features_str[i].msg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==============
|
||||||
|
Host_ValidateEngineFeatures
|
||||||
|
|
||||||
|
validate features bits and set host.features
|
||||||
|
==============
|
||||||
|
*/
|
||||||
|
void Host_ValidateEngineFeatures( uint32_t features )
|
||||||
|
{
|
||||||
|
uint32_t mask = ENGINE_FEATURES_MASK;
|
||||||
|
|
||||||
|
#if !HOST_DEDICATED
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============
|
==============
|
||||||
Host_IsQuakeCompatible
|
Host_IsQuakeCompatible
|
||||||
@@ -915,7 +954,7 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
|||||||
int developer = DEFAULT_DEV;
|
int developer = DEFAULT_DEV;
|
||||||
const char *baseDir;
|
const char *baseDir;
|
||||||
char ticrate[16];
|
char ticrate[16];
|
||||||
int len;
|
int len, i;
|
||||||
|
|
||||||
// some commands may turn engine into infinite loop,
|
// some commands may turn engine into infinite loop,
|
||||||
// e.g. xash.exe +game xash -game xash
|
// e.g. xash.exe +game xash -game xash
|
||||||
@@ -990,7 +1029,7 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
|||||||
progname++;
|
progname++;
|
||||||
|
|
||||||
Q_strncpy( SI.exeName, progname, sizeof( SI.exeName ));
|
Q_strncpy( SI.exeName, progname, sizeof( SI.exeName ));
|
||||||
Q_strncpy( SI.basedirName, progname, sizeof( SI.exeName ));
|
Q_strncpy( SI.basedirName, progname, sizeof( SI.basedirName ));
|
||||||
|
|
||||||
if( Host_IsDedicated() )
|
if( Host_IsDedicated() )
|
||||||
{
|
{
|
||||||
@@ -1162,12 +1201,25 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
|||||||
FS_LoadGameInfo( NULL );
|
FS_LoadGameInfo( NULL );
|
||||||
Cvar_PostFSInit();
|
Cvar_PostFSInit();
|
||||||
|
|
||||||
if( FS_FileExists( va( "%s.rc", SI.basedirName ), false ))
|
|
||||||
Q_strncpy( SI.rcName, SI.basedirName, sizeof( SI.rcName )); // e.g. valve.rc
|
|
||||||
else Q_strncpy( SI.rcName, SI.exeName, sizeof( SI.rcName )); // e.g. quake.rc
|
|
||||||
|
|
||||||
Q_strncpy( host.gamefolder, GI->gamefolder, sizeof( host.gamefolder ));
|
Q_strncpy( host.gamefolder, GI->gamefolder, sizeof( host.gamefolder ));
|
||||||
|
|
||||||
|
for( i = 0; i < 3; i++ )
|
||||||
|
{
|
||||||
|
const char *rcName;
|
||||||
|
switch( i )
|
||||||
|
{
|
||||||
|
case 0: rcName = SI.basedirName; break; // e.g. valve.rc
|
||||||
|
case 1: rcName = SI.exeName; break; // e.g. quake.rc
|
||||||
|
case 2: rcName = host.gamefolder; break; // e.g. game.rc (ran from default launcher)
|
||||||
|
}
|
||||||
|
|
||||||
|
if( FS_FileExists( va( "%s.rc", rcName ), false ))
|
||||||
|
{
|
||||||
|
Q_strncpy( SI.rcName, rcName, sizeof( SI.rcName ));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Image_CheckPaletteQ1 ();
|
Image_CheckPaletteQ1 ();
|
||||||
Host_InitDecals (); // reload decals
|
Host_InitDecals (); // reload decals
|
||||||
|
|
||||||
@@ -1342,6 +1394,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;
|
||||||
|
|
||||||
@@ -1349,7 +1403,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
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ void COM_NewGame( char const *pMapName )
|
|||||||
GameState->landmarkName[0] = 0;
|
GameState->landmarkName[0] = 0;
|
||||||
GameState->loadGame = false;
|
GameState->loadGame = false;
|
||||||
GameState->newGame = true;
|
GameState->newGame = true;
|
||||||
|
|
||||||
|
SV_ShutdownGame(); // exit from current game
|
||||||
}
|
}
|
||||||
|
|
||||||
void COM_LoadLevel( char const *pMapName, qboolean background )
|
void COM_LoadLevel( char const *pMapName, qboolean background )
|
||||||
@@ -74,6 +76,8 @@ void COM_LoadLevel( char const *pMapName, qboolean background )
|
|||||||
GameState->landmarkName[0] = 0;
|
GameState->landmarkName[0] = 0;
|
||||||
GameState->loadGame = false;
|
GameState->loadGame = false;
|
||||||
GameState->newGame = false;
|
GameState->newGame = false;
|
||||||
|
|
||||||
|
SV_ShutdownGame(); // exit from current game
|
||||||
}
|
}
|
||||||
|
|
||||||
void COM_LoadGame( char const *pMapName )
|
void COM_LoadGame( char const *pMapName )
|
||||||
|
|||||||
@@ -287,16 +287,15 @@ void Image_SetPalette( const byte *pal, uint *d_table )
|
|||||||
uint uirgba; // TODO: palette looks byte-swapped on big-endian
|
uint uirgba; // TODO: palette looks byte-swapped on big-endian
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
// setup palette
|
// setup palette
|
||||||
switch( image.d_rendermode )
|
switch( image.d_rendermode )
|
||||||
{
|
{
|
||||||
case LUMP_NORMAL:
|
case LUMP_NORMAL:
|
||||||
for( i = 0; i < 256; i++ )
|
for( i = 0; i < 256; i++ )
|
||||||
{
|
{
|
||||||
rgba[0] = pal[i*3+0];
|
rgba[0] = TextureToGamma( pal[i*3+0] );
|
||||||
rgba[1] = pal[i*3+1];
|
rgba[1] = TextureToGamma( pal[i*3+1] );
|
||||||
rgba[2] = pal[i*3+2];
|
rgba[2] = TextureToGamma( pal[i*3+2] );
|
||||||
rgba[3] = 0xFF;
|
rgba[3] = 0xFF;
|
||||||
memcpy( &uirgba, rgba, sizeof( uirgba ));
|
memcpy( &uirgba, rgba, sizeof( uirgba ));
|
||||||
d_table[i] = uirgba;
|
d_table[i] = uirgba;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ static net_gai_state_t NET_GetMasterHostByName( master_t *m )
|
|||||||
if( res == NET_EAI_OK )
|
if( res == NET_EAI_OK )
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
m->adr.type = NA_UNUSED;
|
m->adr.type = 0;
|
||||||
if( res == NET_EAI_NONAME )
|
if( res == NET_EAI_NONAME )
|
||||||
Con_Reportf( "Can't resolve adr: %s\n", m->address );
|
Con_Reportf( "Can't resolve adr: %s\n", m->address );
|
||||||
|
|
||||||
@@ -266,7 +266,7 @@ static void NET_AddMaster( const char *addr, qboolean save )
|
|||||||
master->sent = false;
|
master->sent = false;
|
||||||
master->save = save;
|
master->save = save;
|
||||||
master->next = NULL;
|
master->next = NULL;
|
||||||
master->adr.type = NA_UNUSED;
|
master->adr.type = 0;
|
||||||
|
|
||||||
// link in
|
// link in
|
||||||
if( last )
|
if( last )
|
||||||
@@ -322,7 +322,7 @@ static void NET_ListMasters_f( void )
|
|||||||
for( i = 1, list = ml.list; list; i++, list = list->next )
|
for( i = 1, list = ml.list; list; i++, list = list->next )
|
||||||
{
|
{
|
||||||
Msg( "%d\t%s", i, list->address );
|
Msg( "%d\t%s", i, list->address );
|
||||||
if( list->adr.type != NA_UNUSED )
|
if( list->adr.type != 0 )
|
||||||
Msg( "\t%s\n", NET_AdrToString( list->adr ));
|
Msg( "\t%s\n", NET_AdrToString( list->adr ));
|
||||||
else Msg( "\n" );
|
else Msg( "\n" );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ static const struct in6_addr in6addr_any;
|
|||||||
|
|
||||||
#define NET_USE_FRAGMENTS
|
#define NET_USE_FRAGMENTS
|
||||||
|
|
||||||
#define PORT_ANY -1
|
|
||||||
#define MAX_LOOPBACK 4
|
#define MAX_LOOPBACK 4
|
||||||
#define MASK_LOOPBACK (MAX_LOOPBACK - 1)
|
#define MASK_LOOPBACK (MAX_LOOPBACK - 1)
|
||||||
|
|
||||||
@@ -132,7 +131,7 @@ static CVAR_DEFINE_AUTO( net6_address, "0", FCVAR_PRIVILEGED|FCVAR_READ_ONLY, "c
|
|||||||
NET_ErrorString
|
NET_ErrorString
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
char *NET_ErrorString( void )
|
static char *NET_ErrorString( void )
|
||||||
{
|
{
|
||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
int err = WSANOTINITIALISED;
|
int err = WSANOTINITIALISED;
|
||||||
@@ -226,34 +225,17 @@ _inline qboolean NET_IsSocketValid( int socket )
|
|||||||
|
|
||||||
void NET_NetadrToIP6Bytes( uint8_t *ip6, const netadr_t *adr )
|
void NET_NetadrToIP6Bytes( uint8_t *ip6, const netadr_t *adr )
|
||||||
{
|
{
|
||||||
#if XASH_LITTLE_ENDIAN
|
|
||||||
memcpy( ip6, adr->ip6, sizeof( adr->ip6 ));
|
memcpy( ip6, adr->ip6, sizeof( adr->ip6 ));
|
||||||
#elif XASH_BIG_ENDIAN
|
|
||||||
memcpy( ip6, adr->ip6_0, sizeof( adr->ip6_0 ));
|
|
||||||
memcpy( ip6 + sizeof( adr->ip6_0 ), adr->ip6_2, sizeof( adr->ip6_2 ));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NET_IP6BytesToNetadr( netadr_t *adr, const uint8_t *ip6 )
|
void NET_IP6BytesToNetadr( netadr_t *adr, const uint8_t *ip6 )
|
||||||
{
|
{
|
||||||
#if XASH_LITTLE_ENDIAN
|
|
||||||
memcpy( adr->ip6, ip6, sizeof( adr->ip6 ));
|
memcpy( adr->ip6, ip6, sizeof( adr->ip6 ));
|
||||||
#elif XASH_BIG_ENDIAN
|
|
||||||
memcpy( adr->ip6_0, ip6, sizeof( adr->ip6_0 ));
|
|
||||||
memcpy( adr->ip6_2, ip6 + sizeof( adr->ip6_0 ), sizeof( adr->ip6_2 ));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_inline int NET_NetadrIP6Compare( const netadr_t *a, const netadr_t *b )
|
static int NET_NetadrIP6Compare( const netadr_t *a, const netadr_t *b )
|
||||||
{
|
{
|
||||||
#if XASH_LITTLE_ENDIAN
|
|
||||||
return memcmp( a->ip6, b->ip6, sizeof( a->ip6 ));
|
return memcmp( a->ip6, b->ip6, sizeof( a->ip6 ));
|
||||||
#elif XASH_BIG_ENDIAN
|
|
||||||
int ret = memcmp( a->ip6_0, b->ip6_0, sizeof( a->ip6_0 ));
|
|
||||||
if( !ret )
|
|
||||||
return memcmp( a->ip6_2, b->ip6_2, sizeof( a->ip6_2 ));
|
|
||||||
return ret;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ stream_t *FS_OpenStream( const char *filename )
|
|||||||
string path, loadname;
|
string path, loadname;
|
||||||
qboolean anyformat = true;
|
qboolean anyformat = true;
|
||||||
const streamfmt_t *format;
|
const streamfmt_t *format;
|
||||||
stream_t *stream;
|
stream_t *stream = NULL;
|
||||||
|
|
||||||
Sound_Reset(); // clear old streaminfo
|
Sound_Reset(); // clear old streaminfo
|
||||||
Q_strncpy( loadname, filename, sizeof( loadname ));
|
Q_strncpy( loadname, filename, sizeof( loadname ));
|
||||||
@@ -188,9 +188,18 @@ stream_t *FS_OpenStream( const char *filename )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Con_Reportf( "FS_OpenStream: couldn't open \"%s\"\n", loadname );
|
// compatibility with original Xash3D, try media/ folder
|
||||||
|
if( Q_strncmp( filename, "media/", sizeof( "media/" ) - 1 ))
|
||||||
|
{
|
||||||
|
Q_snprintf( loadname, sizeof( loadname ), "media/%s", filename );
|
||||||
|
stream = FS_OpenStream( loadname );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Con_Reportf( "%s: couldn't open \"%s\" or \"%s\"\n", __func__, filename + 6, filename );
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ void Test_RunCvar( void );
|
|||||||
void Test_RunCon( void );
|
void Test_RunCon( void );
|
||||||
void Test_RunVOX( void );
|
void Test_RunVOX( void );
|
||||||
void Test_RunIPFilter( void );
|
void Test_RunIPFilter( void );
|
||||||
|
void Test_RunGamma( void );
|
||||||
|
|
||||||
#define TEST_LIST_0 \
|
#define TEST_LIST_0 \
|
||||||
Test_RunLibCommon(); \
|
Test_RunLibCommon(); \
|
||||||
@@ -47,7 +48,8 @@ void Test_RunIPFilter( void );
|
|||||||
Test_RunIPFilter();
|
Test_RunIPFilter();
|
||||||
|
|
||||||
#define TEST_LIST_0_CLIENT \
|
#define TEST_LIST_0_CLIENT \
|
||||||
Test_RunCon();
|
Test_RunCon(); \
|
||||||
|
Test_RunGamma();
|
||||||
|
|
||||||
#define TEST_LIST_1 \
|
#define TEST_LIST_1 \
|
||||||
Test_RunImagelib();
|
Test_RunImagelib();
|
||||||
|
|||||||
@@ -48,8 +48,6 @@ qboolean R_Init_Video( const int type )
|
|||||||
{
|
{
|
||||||
qboolean retval;
|
qboolean retval;
|
||||||
|
|
||||||
VID_StartupGamma();
|
|
||||||
|
|
||||||
if( type != REF_SOFTWARE )
|
if( type != REF_SOFTWARE )
|
||||||
return false; /// glide???
|
return false; /// glide???
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,10 @@ 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
|
#define _GNU_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@@ -24,6 +27,19 @@ GNU General Public License for more details.
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <math.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 );
|
||||||
|
|||||||
@@ -51,8 +51,6 @@ qboolean R_Init_Video( const int type )
|
|||||||
string fbdev = DEFAULT_FBDEV;
|
string fbdev = DEFAULT_FBDEV;
|
||||||
fb.fd = -1;
|
fb.fd = -1;
|
||||||
|
|
||||||
VID_StartupGamma();
|
|
||||||
|
|
||||||
if( type != REF_SOFTWARE )
|
if( type != REF_SOFTWARE )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -843,13 +843,10 @@ qboolean VID_CreateWindow( int width, int height, window_mode_t window_mode )
|
|||||||
return false;
|
return false;
|
||||||
GL_SetupAttributes(); // re-choose attributes
|
GL_SetupAttributes(); // re-choose attributes
|
||||||
}
|
}
|
||||||
|
|
||||||
VID_StartupGamma();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !GL_UpdateContext( ))
|
if( !GL_UpdateContext( ))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
#else // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ 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
|
||||||
@@ -38,7 +39,11 @@ GNU General Public License for more details.
|
|||||||
// Removed previously unused calls
|
// Removed previously unused calls
|
||||||
// Simplified remapping calls
|
// Simplified remapping calls
|
||||||
// GetRefAPI is now expected to return REF_API_VERSION
|
// GetRefAPI is now expected to return REF_API_VERSION
|
||||||
#define REF_API_VERSION 5
|
// 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.
|
||||||
|
// 7. Gamma fixes.
|
||||||
|
#define REF_API_VERSION 7
|
||||||
|
|
||||||
|
|
||||||
#define TF_SKY (TF_SKYSIDE|TF_NOMIPMAP)
|
#define TF_SKY (TF_SKYSIDE|TF_NOMIPMAP)
|
||||||
@@ -94,11 +99,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;
|
||||||
@@ -120,6 +120,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,
|
||||||
@@ -251,17 +271,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_WORLD_VERSION = -14,
|
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
|
||||||
@@ -304,7 +325,6 @@ typedef struct ref_api_s
|
|||||||
void (*CL_DrawCenterPrint)( void );
|
void (*CL_DrawCenterPrint)( void );
|
||||||
|
|
||||||
// entity management
|
// entity management
|
||||||
struct cl_entity_s *(*GetViewModel)( void );
|
|
||||||
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 );
|
||||||
@@ -312,7 +332,6 @@ typedef struct ref_api_s
|
|||||||
// brushes
|
// brushes
|
||||||
int (*Mod_SampleSizeForFace)( const 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 );
|
||||||
|
|
||||||
@@ -332,7 +351,6 @@ 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 **(*pfnGetModels)( void );
|
|
||||||
|
|
||||||
// remap
|
// remap
|
||||||
qboolean (*CL_EntitySetRemapColors)( cl_entity_t *e, model_t *mod, int top, int bottom );
|
qboolean (*CL_EntitySetRemapColors)( cl_entity_t *e, model_t *mod, int top, int bottom );
|
||||||
@@ -345,8 +363,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 );
|
||||||
void (*GetPredictedOrigin)( vec3_t v );
|
|
||||||
color24 *(*CL_GetPaletteColor)( void ); // 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 );
|
||||||
@@ -389,9 +405,11 @@ typedef struct ref_api_s
|
|||||||
void (*SW_UnlockBuffer)( void );
|
void (*SW_UnlockBuffer)( void );
|
||||||
|
|
||||||
// gamma
|
// gamma
|
||||||
void (*BuildGammaTable)( float lightgamma, float brightness );
|
byte (*LightToTexGamma)( byte ); // software gamma support
|
||||||
byte (*LightToTexGamma)( byte color ); // software gamma support
|
uint (*LightToTexGammaEx)( uint ); // software gamma support
|
||||||
qboolean (*R_DoResetGamma)( void );
|
byte (*TextureToGamma)( byte );
|
||||||
|
uint (*ScreenGammaTable)( uint );
|
||||||
|
uint (*LinearGammaTable)( uint );
|
||||||
|
|
||||||
// renderapi
|
// renderapi
|
||||||
lightstyle_t* (*GetLightStyle)( int number );
|
lightstyle_t* (*GetLightStyle)( int number );
|
||||||
@@ -407,7 +425,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
|
||||||
@@ -449,6 +466,7 @@ typedef struct ref_interface_s
|
|||||||
void (*GL_ClearExtensions)( void );
|
void (*GL_ClearExtensions)( void );
|
||||||
|
|
||||||
// scene rendering
|
// scene rendering
|
||||||
|
void (*R_GammaChanged)( qboolean do_reset_gamma );
|
||||||
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 );
|
||||||
@@ -637,6 +655,8 @@ typedef int (*REFAPI)( int version, ref_interface_t *pFunctionTable, ref_api_t*
|
|||||||
#define ENGINE_SHARED_CVAR_LIST( f ) \
|
#define ENGINE_SHARED_CVAR_LIST( f ) \
|
||||||
ENGINE_SHARED_CVAR_NAME( f, vid_gamma, gamma ) \
|
ENGINE_SHARED_CVAR_NAME( f, vid_gamma, gamma ) \
|
||||||
ENGINE_SHARED_CVAR_NAME( f, vid_brightness, brightness ) \
|
ENGINE_SHARED_CVAR_NAME( f, vid_brightness, brightness ) \
|
||||||
|
ENGINE_SHARED_CVAR_NAME( f, v_lightgamma, lightgamma ) \
|
||||||
|
ENGINE_SHARED_CVAR_NAME( f, v_direct, direct ) \
|
||||||
ENGINE_SHARED_CVAR( f, r_showtextures ) \
|
ENGINE_SHARED_CVAR( f, r_showtextures ) \
|
||||||
ENGINE_SHARED_CVAR( f, r_speeds ) \
|
ENGINE_SHARED_CVAR( f, r_speeds ) \
|
||||||
ENGINE_SHARED_CVAR( f, r_fullbright ) \
|
ENGINE_SHARED_CVAR( f, r_fullbright ) \
|
||||||
@@ -658,7 +678,6 @@ typedef int (*REFAPI)( int version, ref_interface_t *pFunctionTable, ref_api_t*
|
|||||||
ENGINE_SHARED_CVAR( f, r_sprite_lighting ) \
|
ENGINE_SHARED_CVAR( f, r_sprite_lighting ) \
|
||||||
ENGINE_SHARED_CVAR( f, r_drawviewmodel ) \
|
ENGINE_SHARED_CVAR( f, r_drawviewmodel ) \
|
||||||
ENGINE_SHARED_CVAR( f, r_glowshellfreq ) \
|
ENGINE_SHARED_CVAR( f, r_glowshellfreq ) \
|
||||||
ENGINE_SHARED_CVAR( f, r_lighting_modulate ) \
|
|
||||||
|
|
||||||
#define DECLARE_ENGINE_SHARED_CVAR_LIST() \
|
#define DECLARE_ENGINE_SHARED_CVAR_LIST() \
|
||||||
ENGINE_SHARED_CVAR_LIST( DECLARE_ENGINE_SHARED_CVAR )
|
ENGINE_SHARED_CVAR_LIST( DECLARE_ENGINE_SHARED_CVAR )
|
||||||
|
|||||||
@@ -129,7 +129,6 @@ CVAR_DEFINE( public_server, "public", "0", 0, "change server type from private t
|
|||||||
CVAR_DEFINE_AUTO( sv_novis, "0", 0, "force to ignore server visibility" ); // disable server culling entities by vis
|
CVAR_DEFINE_AUTO( sv_novis, "0", 0, "force to ignore server visibility" ); // disable server culling entities by vis
|
||||||
CVAR_DEFINE( sv_pausable, "pausable", "1", FCVAR_SERVER, "allow players to pause or not" );
|
CVAR_DEFINE( sv_pausable, "pausable", "1", FCVAR_SERVER, "allow players to pause or not" );
|
||||||
static CVAR_DEFINE_AUTO( timeout, "125", FCVAR_SERVER, "connection timeout" ); // seconds without any message
|
static CVAR_DEFINE_AUTO( timeout, "125", FCVAR_SERVER, "connection timeout" ); // seconds without any message
|
||||||
CVAR_DEFINE( sv_lighting_modulate, "r_lighting_modulate", "0.6", FCVAR_ARCHIVE, "lightstyles modulate scale" );
|
|
||||||
CVAR_DEFINE( sv_maxclients, "maxplayers", "1", FCVAR_LATCH, "server max capacity" );
|
CVAR_DEFINE( sv_maxclients, "maxplayers", "1", FCVAR_LATCH, "server max capacity" );
|
||||||
CVAR_DEFINE_AUTO( sv_check_errors, "0", FCVAR_ARCHIVE, "check edicts for errors" );
|
CVAR_DEFINE_AUTO( sv_check_errors, "0", FCVAR_ARCHIVE, "check edicts for errors" );
|
||||||
CVAR_DEFINE_AUTO( sv_reconnect_limit, "3", FCVAR_ARCHIVE, "max reconnect attempts" ); // minimum seconds between connect messages
|
CVAR_DEFINE_AUTO( sv_reconnect_limit, "3", FCVAR_ARCHIVE, "max reconnect attempts" ); // minimum seconds between connect messages
|
||||||
@@ -919,7 +918,6 @@ void SV_Init( void )
|
|||||||
Cvar_RegisterVariable( &sv_maxclients );
|
Cvar_RegisterVariable( &sv_maxclients );
|
||||||
Cvar_RegisterVariable( &sv_check_errors );
|
Cvar_RegisterVariable( &sv_check_errors );
|
||||||
Cvar_RegisterVariable( &public_server );
|
Cvar_RegisterVariable( &public_server );
|
||||||
Cvar_RegisterVariable( &sv_lighting_modulate );
|
|
||||||
Cvar_RegisterVariable( &sv_reconnect_limit );
|
Cvar_RegisterVariable( &sv_reconnect_limit );
|
||||||
Cvar_RegisterVariable( &sv_failuretime );
|
Cvar_RegisterVariable( &sv_failuretime );
|
||||||
Cvar_RegisterVariable( &sv_unlag );
|
Cvar_RegisterVariable( &sv_unlag );
|
||||||
|
|||||||
@@ -1784,7 +1784,7 @@ static void SV_RunLightStyles( void )
|
|||||||
lightstyle_t *ls;
|
lightstyle_t *ls;
|
||||||
float scale;
|
float scale;
|
||||||
|
|
||||||
scale = sv_lighting_modulate.value;
|
scale = 1.0f;
|
||||||
|
|
||||||
// run lightstyles animation
|
// run lightstyles animation
|
||||||
for( i = 0, ls = sv.lightstyles; i < MAX_LIGHTSTYLES; i++, ls++ )
|
for( i = 0, ls = sv.lightstyles; i < MAX_LIGHTSTYLES; i++, ls++ )
|
||||||
@@ -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() & ENGINE_FEATURES_MASK;
|
Host_ValidateEngineFeatures( svgame.physFuncs.SV_CheckFeatures( ));
|
||||||
Host_PrintEngineFeatures( host.features );
|
|
||||||
}
|
}
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,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)
|
||||||
@@ -237,7 +237,7 @@ def build(bld):
|
|||||||
app_name = 'xash3d-fwgs'
|
app_name = 'xash3d-fwgs'
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if bld.env.SINGLE_BINARY:
|
if bld.env.DISABLE_LAUNCHER:
|
||||||
install_path = bld.env.BINDIR
|
install_path = bld.env.BINDIR
|
||||||
program = 'cxxprogram' if is_cxx_link else 'cprogram'
|
program = 'cxxprogram' if is_cxx_link else 'cprogram'
|
||||||
if bld.env.STATIC:
|
if bld.env.STATIC:
|
||||||
|
|||||||
@@ -1287,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
|
||||||
@@ -1306,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 );
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -822,9 +822,9 @@ void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight )
|
|||||||
{
|
{
|
||||||
VectorSet( lightDir, mv->skyvec_x, mv->skyvec_y, mv->skyvec_z );
|
VectorSet( lightDir, mv->skyvec_x, mv->skyvec_y, mv->skyvec_z );
|
||||||
|
|
||||||
light.r = gEngfuncs.LightToTexGamma( bound( 0, mv->skycolor_r, 255 ));
|
light.r = mv->skycolor_r;
|
||||||
light.g = gEngfuncs.LightToTexGamma( bound( 0, mv->skycolor_g, 255 ));
|
light.g = mv->skycolor_g;
|
||||||
light.b = gEngfuncs.LightToTexGamma( bound( 0, mv->skycolor_b, 255 ));
|
light.b = mv->skycolor_b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -907,9 +907,9 @@ void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight )
|
|||||||
|
|
||||||
VectorAdd( lightDir, dist, lightDir );
|
VectorAdd( lightDir, dist, lightDir );
|
||||||
|
|
||||||
finalLight[0] += gEngfuncs.LightToTexGamma( dl->color.r ) * ( add / 256.0f ) * 2.0f;
|
finalLight[0] += dl->color.r * ( add / 256.0f );
|
||||||
finalLight[1] += gEngfuncs.LightToTexGamma( dl->color.g ) * ( add / 256.0f ) * 2.0f;
|
finalLight[1] += dl->color.g * ( add / 256.0f );
|
||||||
finalLight[2] += gEngfuncs.LightToTexGamma( dl->color.b ) * ( add / 256.0f ) * 2.0f;
|
finalLight[2] += dl->color.b * ( add / 256.0f );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -991,9 +991,9 @@ void R_AliasLighting( float *lv, const vec3_t normal )
|
|||||||
illum -= g_alias.shadelight * lightcos;
|
illum -= g_alias.shadelight * lightcos;
|
||||||
}
|
}
|
||||||
|
|
||||||
illum = Q_max( illum, 0.0f );
|
illum = bound( 0.0f, illum, 255.0f );
|
||||||
illum = Q_min( illum, 255.0f );
|
|
||||||
*lv = illum * (1.0f / 255.0f);
|
*lv = gEngfuncs.LightToTexGammaEx( illum * 4 ) / 1023.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1332,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;
|
||||||
@@ -1381,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
|
||||||
|
|||||||
@@ -560,8 +560,6 @@ qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qbo
|
|||||||
// use client vieworg
|
// use client vieworg
|
||||||
if( !vieworg ) vieworg = RI.vieworg;
|
if( !vieworg ) vieworg = RI.vieworg;
|
||||||
|
|
||||||
R_CheckGamma();
|
|
||||||
|
|
||||||
for( i = 0; i < 6; i++ )
|
for( i = 0; i < 6; i++ )
|
||||||
{
|
{
|
||||||
// go into 3d mode
|
// go into 3d mode
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -949,7 +945,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
|
|||||||
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;
|
||||||
@@ -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 );
|
||||||
}
|
}
|
||||||
@@ -370,6 +372,7 @@ ref_interface_t gReffuncs =
|
|||||||
GL_InitExtensions,
|
GL_InitExtensions,
|
||||||
GL_ClearExtensions,
|
GL_ClearExtensions,
|
||||||
|
|
||||||
|
R_GammaChanged,
|
||||||
R_BeginFrame,
|
R_BeginFrame,
|
||||||
R_RenderScene,
|
R_RenderScene,
|
||||||
R_EndFrame,
|
R_EndFrame,
|
||||||
@@ -518,5 +521,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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1250,12 +1250,6 @@ APIENTRY_LINKAGE void GL_FUNCTION( glClientActiveTextureARB )( GLenum );
|
|||||||
APIENTRY_LINKAGE void GL_FUNCTION( glGetCompressedTexImage )( GLenum target, GLint lod, const GLvoid* data );
|
APIENTRY_LINKAGE void GL_FUNCTION( glGetCompressedTexImage )( GLenum target, GLint lod, const GLvoid* data );
|
||||||
APIENTRY_LINKAGE void GL_FUNCTION( glDrawRangeElements )( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices );
|
APIENTRY_LINKAGE void GL_FUNCTION( glDrawRangeElements )( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices );
|
||||||
APIENTRY_LINKAGE void GL_FUNCTION( glDrawRangeElementsEXT )( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices );
|
APIENTRY_LINKAGE void GL_FUNCTION( glDrawRangeElementsEXT )( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices );
|
||||||
APIENTRY_LINKAGE void GL_FUNCTION( glDrawElements )(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
|
|
||||||
APIENTRY_LINKAGE void GL_FUNCTION( glVertexPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
|
|
||||||
APIENTRY_LINKAGE void GL_FUNCTION( glNormalPointer )(GLenum type, GLsizei stride, const GLvoid *ptr);
|
|
||||||
APIENTRY_LINKAGE void GL_FUNCTION( glColorPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
|
|
||||||
APIENTRY_LINKAGE void GL_FUNCTION( glTexCoordPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
|
|
||||||
APIENTRY_LINKAGE void GL_FUNCTION( glArrayElement )(GLint i);
|
|
||||||
APIENTRY_LINKAGE void GL_FUNCTION( glMultiTexCoord1f) (GLenum, GLfloat);
|
APIENTRY_LINKAGE void GL_FUNCTION( glMultiTexCoord1f) (GLenum, GLfloat);
|
||||||
APIENTRY_LINKAGE void GL_FUNCTION( glMultiTexCoord2f) (GLenum, GLfloat, GLfloat);
|
APIENTRY_LINKAGE void GL_FUNCTION( glMultiTexCoord2f) (GLenum, GLfloat, GLfloat);
|
||||||
APIENTRY_LINKAGE void GL_FUNCTION( glMultiTexCoord3f) (GLenum, GLfloat, GLfloat, GLfloat);
|
APIENTRY_LINKAGE void GL_FUNCTION( glMultiTexCoord3f) (GLenum, GLfloat, GLfloat, GLfloat);
|
||||||
@@ -1313,7 +1307,6 @@ APIENTRY_LINKAGE void GL_FUNCTION( glGetActiveUniformARB )(GLhandleARB programOb
|
|||||||
APIENTRY_LINKAGE void GL_FUNCTION( glGetUniformfvARB )(GLhandleARB programObj, GLint location, GLfloat *params);
|
APIENTRY_LINKAGE void GL_FUNCTION( glGetUniformfvARB )(GLhandleARB programObj, GLint location, GLfloat *params);
|
||||||
APIENTRY_LINKAGE void GL_FUNCTION( glGetUniformivARB )(GLhandleARB programObj, GLint location, GLint *params);
|
APIENTRY_LINKAGE void GL_FUNCTION( glGetUniformivARB )(GLhandleARB programObj, GLint location, GLint *params);
|
||||||
APIENTRY_LINKAGE void GL_FUNCTION( glGetShaderSourceARB )(GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);
|
APIENTRY_LINKAGE void GL_FUNCTION( glGetShaderSourceARB )(GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);
|
||||||
APIENTRY_LINKAGE void GL_FUNCTION( glPolygonStipple )(const GLubyte *mask);
|
|
||||||
APIENTRY_LINKAGE void GL_FUNCTION( glTexImage3D )( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
|
APIENTRY_LINKAGE void GL_FUNCTION( glTexImage3D )( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
|
||||||
APIENTRY_LINKAGE void GL_FUNCTION( glTexSubImage3D )( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels );
|
APIENTRY_LINKAGE void GL_FUNCTION( glTexSubImage3D )( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels );
|
||||||
APIENTRY_LINKAGE void GL_FUNCTION( glCopyTexSubImage3D )( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
|
APIENTRY_LINKAGE void GL_FUNCTION( glCopyTexSubImage3D )( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
|
||||||
@@ -1737,12 +1730,6 @@ APIENTRY_LINKAGE void GL_FUNCTION( glTexImage2DMultisample )(GLenum target, GLsi
|
|||||||
#define pglGetCompressedTexImage glGetCompressedTexImage
|
#define pglGetCompressedTexImage glGetCompressedTexImage
|
||||||
#define pglDrawRangeElements glDrawRangeElements
|
#define pglDrawRangeElements glDrawRangeElements
|
||||||
#define pglDrawRangeElementsEXT glDrawRangeElementsEXT
|
#define pglDrawRangeElementsEXT glDrawRangeElementsEXT
|
||||||
#define pglDrawElements glDrawElements
|
|
||||||
#define pglVertexPointer glVertexPointer
|
|
||||||
#define pglNormalPointer glNormalPointer
|
|
||||||
#define pglColorPointer glColorPointer
|
|
||||||
#define pglTexCoordPointer glTexCoordPointer
|
|
||||||
#define pglArrayElement glArrayElement
|
|
||||||
#define pglMultiTexCoord1f glMultiTexCoord1f
|
#define pglMultiTexCoord1f glMultiTexCoord1f
|
||||||
#define pglMultiTexCoord2f glMultiTexCoord2f
|
#define pglMultiTexCoord2f glMultiTexCoord2f
|
||||||
#define pglMultiTexCoord3f glMultiTexCoord3f
|
#define pglMultiTexCoord3f glMultiTexCoord3f
|
||||||
@@ -1800,7 +1787,6 @@ APIENTRY_LINKAGE void GL_FUNCTION( glTexImage2DMultisample )(GLenum target, GLsi
|
|||||||
#define pglGetUniformfvARB glGetUniformfvARB
|
#define pglGetUniformfvARB glGetUniformfvARB
|
||||||
#define pglGetUniformivARB glGetUniformivARB
|
#define pglGetUniformivARB glGetUniformivARB
|
||||||
#define pglGetShaderSourceARB glGetShaderSourceARB
|
#define pglGetShaderSourceARB glGetShaderSourceARB
|
||||||
#define pglPolygonStipple glPolygonStipple
|
|
||||||
#define pglTexImage3D glTexImage3D
|
#define pglTexImage3D glTexImage3D
|
||||||
#define pglTexSubImage3D glTexSubImage3D
|
#define pglTexSubImage3D glTexSubImage3D
|
||||||
#define pglCopyTexSubImage3D glCopyTexSubImage3D
|
#define pglCopyTexSubImage3D glCopyTexSubImage3D
|
||||||
|
|||||||
@@ -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 );
|
||||||
@@ -75,7 +76,7 @@ extern poolhandle_t r_temppool;
|
|||||||
#define MAX_DRAW_STACK 2 // normal view and menu view
|
#define MAX_DRAW_STACK 2 // normal view and menu view
|
||||||
|
|
||||||
#define SHADEDOT_QUANT 16 // precalculated dot products for quantized angles
|
#define SHADEDOT_QUANT 16 // precalculated dot products for quantized angles
|
||||||
#define SHADE_LAMBERT 1.495f
|
#define SHADE_LAMBERT 1.4953241
|
||||||
#define DEFAULT_ALPHATEST 0.0f
|
#define DEFAULT_ALPHATEST 0.0f
|
||||||
|
|
||||||
// refparams
|
// refparams
|
||||||
@@ -87,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
|
||||||
@@ -237,7 +238,6 @@ typedef struct
|
|||||||
int realframecount; // not including viewpasses
|
int realframecount; // not including viewpasses
|
||||||
int framecount;
|
int framecount;
|
||||||
|
|
||||||
qboolean ignore_lightgamma;
|
|
||||||
qboolean fCustomRendering;
|
qboolean fCustomRendering;
|
||||||
qboolean fResetVis;
|
qboolean fResetVis;
|
||||||
qboolean fFlipViewModel;
|
qboolean fFlipViewModel;
|
||||||
@@ -252,13 +252,10 @@ typedef struct
|
|||||||
// cull info
|
// cull info
|
||||||
vec3_t modelorg; // relative to viewpoint
|
vec3_t modelorg; // relative to viewpoint
|
||||||
|
|
||||||
qboolean fCustomSkybox;
|
|
||||||
|
|
||||||
// get from engine
|
// get from engine
|
||||||
struct world_static_s *world;
|
world_static_t *world;
|
||||||
cl_entity_t *entities;
|
cl_entity_t *entities;
|
||||||
movevars_t *movevars;
|
movevars_t *movevars;
|
||||||
model_t **models;
|
|
||||||
color24 *palette;
|
color24 *palette;
|
||||||
cl_entity_t *viewent;
|
cl_entity_t *viewent;
|
||||||
|
|
||||||
@@ -401,9 +398,9 @@ 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_PushScene( void );
|
void R_PushScene( void );
|
||||||
void R_PopScene( void );
|
void R_PopScene( void );
|
||||||
void R_DrawFog( void );
|
void R_DrawFog( void );
|
||||||
@@ -530,11 +527,11 @@ void GL_SetupAttributes( int safegl );
|
|||||||
void GL_OnContextCreated( void );
|
void GL_OnContextCreated( void );
|
||||||
void GL_InitExtensions( void );
|
void GL_InitExtensions( void );
|
||||||
void GL_ClearExtensions( void );
|
void GL_ClearExtensions( void );
|
||||||
void VID_CheckChanges( void );
|
|
||||||
int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags );
|
int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags );
|
||||||
void GL_FreeImage( const char *name );
|
void GL_FreeImage( const char *name );
|
||||||
qboolean VID_ScreenShot( const char *filename, int shot_type );
|
qboolean VID_ScreenShot( const char *filename, int shot_type );
|
||||||
qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qboolean skyshot );
|
qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qboolean skyshot );
|
||||||
|
void R_GammaChanged( qboolean do_reset_gamma );
|
||||||
void R_BeginFrame( qboolean clearScene );
|
void R_BeginFrame( qboolean clearScene );
|
||||||
void R_RenderFrame( const struct ref_viewpass_s *vp );
|
void R_RenderFrame( const struct ref_viewpass_s *vp );
|
||||||
void R_EndFrame( void );
|
void R_EndFrame( void );
|
||||||
@@ -725,6 +722,8 @@ 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 )
|
||||||
@@ -734,15 +733,21 @@ extern ref_globals_t *gpGlobals;
|
|||||||
//
|
//
|
||||||
static inline cl_entity_t *CL_GetEntityByIndex( int index )
|
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];
|
return &tr.entities[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline model_t *CL_ModelHandle( int index )
|
static inline model_t *CL_ModelHandle( int index )
|
||||||
{
|
{
|
||||||
return tr.models[index];
|
if( unlikely( index < 0 || index >= gp_cl->nummodels ))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return gp_cl->models[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WORLDMODEL (tr.models[1])
|
#define WORLDMODEL (gp_cl->models[1])
|
||||||
|
|
||||||
//
|
//
|
||||||
// renderer cvars
|
// renderer cvars
|
||||||
@@ -762,6 +767,7 @@ extern convar_t gl_nosort;
|
|||||||
extern convar_t gl_test; // cvar to testify new effects
|
extern convar_t gl_test; // cvar to testify new effects
|
||||||
extern convar_t gl_msaa;
|
extern convar_t gl_msaa;
|
||||||
extern convar_t gl_stencilbits;
|
extern convar_t gl_stencilbits;
|
||||||
|
extern convar_t gl_overbright;
|
||||||
|
|
||||||
extern convar_t r_lighting_extended;
|
extern convar_t r_lighting_extended;
|
||||||
extern convar_t r_lighting_ambient;
|
extern convar_t r_lighting_ambient;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ CVAR_DEFINE_AUTO( gl_nosort, "0", FCVAR_GLCONFIG, "disable sorting of translucen
|
|||||||
CVAR_DEFINE_AUTO( gl_test, "0", 0, "engine developer cvar for quick testing new features" );
|
CVAR_DEFINE_AUTO( gl_test, "0", 0, "engine developer cvar for quick testing new features" );
|
||||||
CVAR_DEFINE_AUTO( gl_msaa, "1", FCVAR_GLCONFIG, "enable or disable multisample anti-aliasing" );
|
CVAR_DEFINE_AUTO( gl_msaa, "1", FCVAR_GLCONFIG, "enable or disable multisample anti-aliasing" );
|
||||||
CVAR_DEFINE_AUTO( gl_stencilbits, "8", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "pixelformat stencil bits (0 - auto)" );
|
CVAR_DEFINE_AUTO( gl_stencilbits, "8", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "pixelformat stencil bits (0 - auto)" );
|
||||||
|
CVAR_DEFINE_AUTO( gl_overbright, "1", FCVAR_GLCONFIG, "overbrights" );
|
||||||
CVAR_DEFINE_AUTO( r_lighting_extended, "1", FCVAR_GLCONFIG, "allow to get lighting from world and bmodels" );
|
CVAR_DEFINE_AUTO( r_lighting_extended, "1", FCVAR_GLCONFIG, "allow to get lighting from world and bmodels" );
|
||||||
CVAR_DEFINE_AUTO( r_lighting_ambient, "0.3", FCVAR_GLCONFIG, "map ambient lighting scale" );
|
CVAR_DEFINE_AUTO( r_lighting_ambient, "0.3", FCVAR_GLCONFIG, "map ambient lighting scale" );
|
||||||
CVAR_DEFINE_AUTO( r_detailtextures, "1", FCVAR_ARCHIVE, "enable detail textures support" );
|
CVAR_DEFINE_AUTO( r_detailtextures, "1", FCVAR_ARCHIVE, "enable detail textures support" );
|
||||||
@@ -1203,6 +1204,7 @@ void GL_InitCommands( void )
|
|||||||
gEngfuncs.Cvar_RegisterVariable( &gl_msaa );
|
gEngfuncs.Cvar_RegisterVariable( &gl_msaa );
|
||||||
gEngfuncs.Cvar_RegisterVariable( &gl_stencilbits );
|
gEngfuncs.Cvar_RegisterVariable( &gl_stencilbits );
|
||||||
gEngfuncs.Cvar_RegisterVariable( &gl_round_down );
|
gEngfuncs.Cvar_RegisterVariable( &gl_round_down );
|
||||||
|
gEngfuncs.Cvar_RegisterVariable( &gl_overbright );
|
||||||
|
|
||||||
// these cvar not used by engine but some mods requires this
|
// these cvar not used by engine but some mods requires this
|
||||||
gEngfuncs.Cvar_RegisterVariable( &gl_polyoffset );
|
gEngfuncs.Cvar_RegisterVariable( &gl_polyoffset );
|
||||||
@@ -1287,11 +1289,10 @@ qboolean R_Init( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// see R_ProcessEntData for tr.entities initialization
|
// see R_ProcessEntData for tr.entities initialization
|
||||||
tr.world = gEngfuncs.GetWorld();
|
tr.world = (struct world_static_s *)ENGINE_GET_PARM( PARM_GET_WORLD_PTR );
|
||||||
tr.models = gEngfuncs.pfnGetModels();
|
tr.movevars = (movevars_t *)ENGINE_GET_PARM( PARM_GET_MOVEVARS_PTR );
|
||||||
tr.movevars = gEngfuncs.pfnGetMoveVars();
|
tr.palette = (color24 *)ENGINE_GET_PARM( PARM_GET_PALETTE_PTR );
|
||||||
tr.palette = gEngfuncs.CL_GetPaletteColor();
|
tr.viewent = (cl_entity_t *)ENGINE_GET_PARM( PARM_GET_VIEWENT_PTR );
|
||||||
tr.viewent = gEngfuncs.GetViewModel();
|
|
||||||
|
|
||||||
GL_SetDefaults();
|
GL_SetDefaults();
|
||||||
R_CheckVBO();
|
R_CheckVBO();
|
||||||
|
|||||||
@@ -36,26 +36,26 @@ 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;
|
|
||||||
lightstyle_t *ls;
|
lightstyle_t *ls;
|
||||||
|
|
||||||
if( !WORLDMODEL ) return;
|
if( !WORLDMODEL )
|
||||||
|
return;
|
||||||
|
|
||||||
scale = r_lighting_modulate->value;
|
if( !WORLDMODEL->lightdata )
|
||||||
|
{
|
||||||
|
for( i = 0; i < MAX_LIGHTSTYLES; i++ )
|
||||||
|
tr.lightstylevalue[i] = 256 * 256;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// light animations
|
// light animations
|
||||||
// 'm' is normal light, 'a' is no light, 'z' is double bright
|
// 'm' is normal light, 'a' is no light, 'z' is double bright
|
||||||
for( i = 0; i < MAX_LIGHTSTYLES; i++ )
|
for( i = 0; i < MAX_LIGHTSTYLES; i++ )
|
||||||
{
|
{
|
||||||
ls = gEngfuncs.GetLightStyle( i );
|
ls = gEngfuncs.GetLightStyle( i );
|
||||||
if( !WORLDMODEL->lightdata )
|
|
||||||
{
|
|
||||||
tr.lightstylevalue[i] = 256 * 256;
|
|
||||||
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 );
|
||||||
@@ -65,18 +65,18 @@ void CL_RunLightStyles( void )
|
|||||||
|
|
||||||
if( !ls->length )
|
if( !ls->length )
|
||||||
{
|
{
|
||||||
tr.lightstylevalue[i] = 256 * scale;
|
tr.lightstylevalue[i] = 256;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if( ls->length == 1 )
|
else if( ls->length == 1 )
|
||||||
{
|
{
|
||||||
// single length style so don't bother interpolating
|
// single length style so don't bother interpolating
|
||||||
tr.lightstylevalue[i] = ls->map[0] * 22 * scale;
|
tr.lightstylevalue[i] = ( ls->pattern[0] - 'a' ) * 22;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if( !ls->interp || !cl_lightstyle_lerping->flags )
|
else if( !ls->interp || !cl_lightstyle_lerping->flags )
|
||||||
{
|
{
|
||||||
tr.lightstylevalue[i] = ls->map[flight%ls->length] * 22 * scale;
|
tr.lightstylevalue[i] = ( ls->pattern[flight%ls->length] - 'a' ) * 22;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ void CL_RunLightStyles( void )
|
|||||||
k = ls->map[clight % ls->length];
|
k = ls->map[clight % ls->length];
|
||||||
l += (float)( k * 22.0f ) * lerpfrac;
|
l += (float)( k * 22.0f ) * lerpfrac;
|
||||||
|
|
||||||
tr.lightstylevalue[i] = (int)l * scale;
|
tr.lightstylevalue[i] = (int)l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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 ))
|
||||||
@@ -320,18 +320,10 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f,
|
|||||||
{
|
{
|
||||||
uint scale = tr.lightstylevalue[surf->styles[map]];
|
uint scale = tr.lightstylevalue[surf->styles[map]];
|
||||||
|
|
||||||
if( tr.ignore_lightgamma )
|
cv->r += lm->r * scale;
|
||||||
{
|
cv->g += lm->g * scale;
|
||||||
cv->r += lm->r * scale;
|
cv->b += lm->b * scale;
|
||||||
cv->g += lm->g * scale;
|
|
||||||
cv->b += lm->b * scale;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cv->r += gEngfuncs.LightToTexGamma( lm->r ) * scale;
|
|
||||||
cv->g += gEngfuncs.LightToTexGamma( lm->g ) * scale;
|
|
||||||
cv->b += gEngfuncs.LightToTexGamma( lm->b ) * scale;
|
|
||||||
}
|
|
||||||
lm += size; // skip to next lightmap
|
lm += size; // skip to next lightmap
|
||||||
|
|
||||||
if( dm != NULL )
|
if( dm != NULL )
|
||||||
@@ -418,9 +410,10 @@ colorVec R_LightVecInternal( const vec3_t start, const vec3_t end, vec3_t lspot,
|
|||||||
{
|
{
|
||||||
if( lspot ) VectorCopy( g_trace_lightspot, lspot );
|
if( lspot ) VectorCopy( g_trace_lightspot, lspot );
|
||||||
if( lvec ) VectorNormalize2( g_trace_lightvec, lvec );
|
if( lvec ) VectorNormalize2( g_trace_lightvec, lvec );
|
||||||
light.r = Q_min(( cv.r >> 7 ), 255 );
|
|
||||||
light.g = Q_min(( cv.g >> 7 ), 255 );
|
light.r = Q_min(( cv.r >> 8 ), 255 );
|
||||||
light.b = Q_min(( cv.b >> 7 ), 255 );
|
light.g = Q_min(( cv.g >> 8 ), 255 );
|
||||||
|
light.b = Q_min(( cv.b >> 8 ), 255 );
|
||||||
last_fraction = g_trace_fraction;
|
last_fraction = g_trace_fraction;
|
||||||
|
|
||||||
if(( light.r + light.g + light.b ) != 0 )
|
if(( light.r + light.g + light.b ) != 0 )
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -985,31 +985,42 @@ void R_RenderScene( void )
|
|||||||
R_EndGL();
|
R_EndGL();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
void R_GammaChanged( qboolean do_reset_gamma )
|
||||||
===============
|
|
||||||
R_CheckGamma
|
|
||||||
===============
|
|
||||||
*/
|
|
||||||
void R_CheckGamma( void )
|
|
||||||
{
|
{
|
||||||
if( gEngfuncs.R_DoResetGamma( ))
|
if( do_reset_gamma )
|
||||||
{
|
{
|
||||||
// paranoia cubemaps uses this
|
|
||||||
gEngfuncs.BuildGammaTable( 1.8f, 0.0f );
|
|
||||||
|
|
||||||
// paranoia cubemap rendering
|
// paranoia cubemap rendering
|
||||||
if( gEngfuncs.drawFuncs->GL_BuildLightmaps )
|
if( gEngfuncs.drawFuncs->GL_BuildLightmaps )
|
||||||
gEngfuncs.drawFuncs->GL_BuildLightmaps( );
|
gEngfuncs.drawFuncs->GL_BuildLightmaps( );
|
||||||
}
|
}
|
||||||
else if( FBitSet( vid_gamma->flags, FCVAR_CHANGED ) || FBitSet( vid_brightness->flags, FCVAR_CHANGED ))
|
else
|
||||||
{
|
{
|
||||||
gEngfuncs.BuildGammaTable( vid_gamma->value, vid_brightness->value );
|
|
||||||
glConfig.softwareGammaUpdate = true;
|
glConfig.softwareGammaUpdate = true;
|
||||||
GL_RebuildLightmaps();
|
GL_RebuildLightmaps();
|
||||||
glConfig.softwareGammaUpdate = false;
|
glConfig.softwareGammaUpdate = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void R_CheckGamma( void )
|
||||||
|
{
|
||||||
|
qboolean rebuild = false;
|
||||||
|
|
||||||
|
if( FBitSet( gl_overbright.flags, FCVAR_CHANGED ))
|
||||||
|
{
|
||||||
|
rebuild = true;
|
||||||
|
ClearBits( gl_overbright.flags, FCVAR_CHANGED );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( gl_overbright.value && FBitSet( r_vbo.flags, FCVAR_CHANGED ))
|
||||||
|
{
|
||||||
|
rebuild = true;
|
||||||
|
ClearBits( r_vbo.flags, FCVAR_CHANGED );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( rebuild )
|
||||||
|
R_GammaChanged( false );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
R_BeginFrame
|
R_BeginFrame
|
||||||
@@ -1181,16 +1192,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 +1240,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;
|
||||||
|
|||||||
@@ -87,13 +87,11 @@ void CL_DrawParticles( double frametime, particle_t *cl_active_particles, float
|
|||||||
p->color = bound( 0, p->color, 255 );
|
p->color = bound( 0, p->color, 255 );
|
||||||
color = tr.palette[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( color.r ),
|
pglColor4ub( color.r, color.g, color.b, alpha );
|
||||||
gEngfuncs.LightToTexGamma( color.g ),
|
|
||||||
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] );
|
||||||
@@ -192,9 +190,11 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
|
|||||||
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;
|
||||||
|
|
||||||
|
pglBegin( GL_QUADS );
|
||||||
|
|
||||||
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 );
|
||||||
@@ -238,7 +238,6 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
|
|||||||
color = gTracerColors[p->color];
|
color = gTracerColors[p->color];
|
||||||
pglColor4ub( color.r, color.g, color.b, p->packedColor );
|
pglColor4ub( color.r, color.g, color.b, p->packedColor );
|
||||||
|
|
||||||
pglBegin( GL_QUADS );
|
|
||||||
pglTexCoord2f( 0.0f, 0.8f );
|
pglTexCoord2f( 0.0f, 0.8f );
|
||||||
pglVertex3fv( verts[2] );
|
pglVertex3fv( verts[2] );
|
||||||
pglTexCoord2f( 1.0f, 0.8f );
|
pglTexCoord2f( 1.0f, 0.8f );
|
||||||
@@ -247,7 +246,6 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
|
|||||||
pglVertex3fv( verts[1] );
|
pglVertex3fv( verts[1] );
|
||||||
pglTexCoord2f( 0.0f, 0.0f );
|
pglTexCoord2f( 0.0f, 0.0f );
|
||||||
pglVertex3fv( verts[0] );
|
pglVertex3fv( verts[0] );
|
||||||
pglEnd();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// evaluate position
|
// evaluate position
|
||||||
@@ -259,7 +257,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 )
|
||||||
@@ -267,6 +265,7 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
|
|||||||
p->vel[2] = gravity * 0.05f;
|
p->vel[2] = gravity * 0.05f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pglEnd();
|
||||||
|
|
||||||
pglDepthMask( GL_TRUE );
|
pglDepthMask( GL_TRUE );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -224,10 +224,9 @@ every render pass applies new fog layer, resulting in wrong fog color
|
|||||||
recalculate fog color for current pass count
|
recalculate fog color for current pass count
|
||||||
===============================
|
===============================
|
||||||
*/
|
*/
|
||||||
|
void GL_SetupFogColorForSurfacesEx( int passes, float density, qboolean blend_lightmaps )
|
||||||
void GL_SetupFogColorForSurfacesEx( int passes, float density )
|
|
||||||
{
|
{
|
||||||
vec3_t fogColor;
|
vec4_t fogColor;
|
||||||
float factor, div;
|
float factor, div;
|
||||||
|
|
||||||
if( !glState.isFogEnabled )
|
if( !glState.isFogEnabled )
|
||||||
@@ -244,6 +243,13 @@ void GL_SetupFogColorForSurfacesEx( int passes, float density )
|
|||||||
fogColor[0] = pow( RI.fogColor[0] / div, ( 1.0f / factor ));
|
fogColor[0] = pow( RI.fogColor[0] / div, ( 1.0f / factor ));
|
||||||
fogColor[1] = pow( RI.fogColor[1] / div, ( 1.0f / factor ));
|
fogColor[1] = pow( RI.fogColor[1] / div, ( 1.0f / factor ));
|
||||||
fogColor[2] = pow( RI.fogColor[2] / div, ( 1.0f / factor ));
|
fogColor[2] = pow( RI.fogColor[2] / div, ( 1.0f / factor ));
|
||||||
|
fogColor[3] = 1.0f; // ignored but GL_FOG_COLOR requires vec4_t
|
||||||
|
|
||||||
|
// because of enabled blending in R_BlendLightmaps, need to scale down fog color
|
||||||
|
// but only during lightmap blending & without VBO (it takes another route)
|
||||||
|
if( blend_lightmaps && gl_overbright.value )
|
||||||
|
VectorScale( fogColor, 0.5f, fogColor );
|
||||||
|
|
||||||
pglFogfv( GL_FOG_COLOR, fogColor );
|
pglFogfv( GL_FOG_COLOR, fogColor );
|
||||||
pglFogf( GL_FOG_DENSITY, RI.fogDensity * density );
|
pglFogf( GL_FOG_DENSITY, RI.fogDensity * density );
|
||||||
}
|
}
|
||||||
@@ -251,7 +257,7 @@ void GL_SetupFogColorForSurfacesEx( int passes, float density )
|
|||||||
|
|
||||||
void GL_SetupFogColorForSurfaces( void )
|
void GL_SetupFogColorForSurfaces( void )
|
||||||
{
|
{
|
||||||
GL_SetupFogColorForSurfacesEx( r_detailtextures.value ? 3 : 2, 1.0f );
|
GL_SetupFogColorForSurfacesEx( r_detailtextures.value ? 3 : 2, 1.0f, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GL_ResetFogColor( void )
|
void GL_ResetFogColor( void )
|
||||||
@@ -408,7 +414,7 @@ texture_t *R_TextureAnim( texture_t *b )
|
|||||||
speed = 10;
|
speed = 10;
|
||||||
else speed = 20;
|
else speed = 20;
|
||||||
|
|
||||||
reletive = (int)(gpGlobals->time * speed) % base->anim_total;
|
reletive = (int)(gp_cl->time * speed) % base->anim_total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -500,7 +506,7 @@ texture_t *R_TextureAnimation( msurface_t *s )
|
|||||||
speed = 10;
|
speed = 10;
|
||||||
else speed = 20;
|
else speed = 20;
|
||||||
|
|
||||||
reletive = (int)(gpGlobals->time * speed) % base->anim_total;
|
reletive = (int)(gp_cl->time * speed) % base->anim_total;
|
||||||
}
|
}
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
@@ -600,9 +606,9 @@ void R_AddDynamicLights( msurface_t *surf )
|
|||||||
|
|
||||||
if( dist < minlight )
|
if( dist < minlight )
|
||||||
{
|
{
|
||||||
bl[0] += ((int)((rad - dist) * 256) * gEngfuncs.LightToTexGamma( dl->color.r )) / 256;
|
bl[0] += ((int)((rad - dist) * 256) * dl->color.r ) / 256;
|
||||||
bl[1] += ((int)((rad - dist) * 256) * gEngfuncs.LightToTexGamma( dl->color.g )) / 256;
|
bl[1] += ((int)((rad - dist) * 256) * dl->color.g ) / 256;
|
||||||
bl[2] += ((int)((rad - dist) * 256) * gEngfuncs.LightToTexGamma( dl->color.b )) / 256;
|
bl[2] += ((int)((rad - dist) * 256) * dl->color.b ) / 256;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -742,11 +748,15 @@ static void R_BuildLightMap( msurface_t *surf, byte *dest, int stride, qboolean
|
|||||||
int sample_size;
|
int sample_size;
|
||||||
mextrasurf_t *info = surf->info;
|
mextrasurf_t *info = surf->info;
|
||||||
color24 *lm;
|
color24 *lm;
|
||||||
|
int lightscale;
|
||||||
|
|
||||||
sample_size = gEngfuncs.Mod_SampleSizeForFace( surf );
|
sample_size = gEngfuncs.Mod_SampleSizeForFace( surf );
|
||||||
smax = ( info->lightextents[0] / sample_size ) + 1;
|
smax = ( info->lightextents[0] / sample_size ) + 1;
|
||||||
tmax = ( info->lightextents[1] / sample_size ) + 1;
|
tmax = ( info->lightextents[1] / sample_size ) + 1;
|
||||||
size = smax * tmax;
|
size = smax * tmax;
|
||||||
|
if( gl_overbright.value )
|
||||||
|
lightscale = r_vbo.value ? 171 : 256;
|
||||||
|
else lightscale = ( pow( 2.0f, 1.0f / v_lightgamma->value ) * 256 ) + 0.5;
|
||||||
|
|
||||||
lm = surf->samples;
|
lm = surf->samples;
|
||||||
|
|
||||||
@@ -759,9 +769,9 @@ static void R_BuildLightMap( msurface_t *surf, byte *dest, int stride, qboolean
|
|||||||
|
|
||||||
for( i = 0, bl = r_blocklights; i < size; i++, bl += 3, lm++ )
|
for( i = 0, bl = r_blocklights; i < size; i++, bl += 3, lm++ )
|
||||||
{
|
{
|
||||||
bl[0] += gEngfuncs.LightToTexGamma( lm->r ) * scale;
|
bl[0] += lm->r * scale;
|
||||||
bl[1] += gEngfuncs.LightToTexGamma( lm->g ) * scale;
|
bl[1] += lm->g * scale;
|
||||||
bl[2] += gEngfuncs.LightToTexGamma( lm->b ) * scale;
|
bl[2] += lm->b * scale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -777,9 +787,16 @@ static void R_BuildLightMap( msurface_t *surf, byte *dest, int stride, qboolean
|
|||||||
{
|
{
|
||||||
for( s = 0; s < smax; s++ )
|
for( s = 0; s < smax; s++ )
|
||||||
{
|
{
|
||||||
dest[0] = Q_min((bl[0] >> 7), 255 );
|
int i;
|
||||||
dest[1] = Q_min((bl[1] >> 7), 255 );
|
for( i = 0; i < 3; i++ )
|
||||||
dest[2] = Q_min((bl[2] >> 7), 255 );
|
{
|
||||||
|
int t = bl[i] * lightscale >> 14;
|
||||||
|
|
||||||
|
if( t > 1023 )
|
||||||
|
t = 1023;
|
||||||
|
|
||||||
|
dest[i] = gEngfuncs.LightToTexGammaEx( t ) >> 2;
|
||||||
|
}
|
||||||
dest[3] = 255;
|
dest[3] = 255;
|
||||||
|
|
||||||
bl += 3;
|
bl += 3;
|
||||||
@@ -828,8 +845,8 @@ void DrawGLPoly( glpoly_t *p, float xScale, float yScale )
|
|||||||
flAngle = ( flConveyorSpeed >= 0 ) ? 180 : 0;
|
flAngle = ( flConveyorSpeed >= 0 ) ? 180 : 0;
|
||||||
|
|
||||||
SinCos( flAngle * ( M_PI_F / 180.0f ), &sy, &cy );
|
SinCos( flAngle * ( M_PI_F / 180.0f ), &sy, &cy );
|
||||||
sOffset = gpGlobals->time * cy * flRate;
|
sOffset = gp_cl->time * cy * flRate;
|
||||||
tOffset = gpGlobals->time * sy * flRate;
|
tOffset = gp_cl->time * sy * flRate;
|
||||||
|
|
||||||
// make sure that we are positive
|
// make sure that we are positive
|
||||||
if( sOffset < 0.0f ) sOffset += 1.0f + -(int)sOffset;
|
if( sOffset < 0.0f ) sOffset += 1.0f + -(int)sOffset;
|
||||||
@@ -933,7 +950,7 @@ void R_BlendLightmaps( void )
|
|||||||
if( !R_HasLightmap() )
|
if( !R_HasLightmap() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GL_SetupFogColorForSurfaces ();
|
GL_SetupFogColorForSurfacesEx( r_detailtextures.value ? 3 : 2, 1.0f, true );
|
||||||
|
|
||||||
if( !r_lightmap->value )
|
if( !r_lightmap->value )
|
||||||
pglEnable( GL_BLEND );
|
pglEnable( GL_BLEND );
|
||||||
@@ -944,7 +961,15 @@ void R_BlendLightmaps( void )
|
|||||||
pglDepthFunc( GL_EQUAL );
|
pglDepthFunc( GL_EQUAL );
|
||||||
|
|
||||||
pglDisable( GL_ALPHA_TEST );
|
pglDisable( GL_ALPHA_TEST );
|
||||||
pglBlendFunc( GL_ZERO, GL_SRC_COLOR );
|
if( gl_overbright.value )
|
||||||
|
{
|
||||||
|
pglBlendFunc( GL_DST_COLOR, GL_SRC_COLOR );
|
||||||
|
pglColor4f( 128.0f / 192.0f, 128.0f / 192.0f, 128.0f / 192.0f, 1.0f );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pglBlendFunc( GL_ZERO, GL_SRC_COLOR );
|
||||||
|
}
|
||||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||||
|
|
||||||
// render static lightmaps first
|
// render static lightmaps first
|
||||||
@@ -1103,7 +1128,7 @@ void R_RenderDetails( int passes )
|
|||||||
if( !draw_details )
|
if( !draw_details )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GL_SetupFogColorForSurfacesEx( passes, passes == 2 ? 0.5f : 1.0f );
|
GL_SetupFogColorForSurfacesEx( passes, passes == 2 ? 0.5f : 1.0f, false );
|
||||||
|
|
||||||
pglEnable( GL_BLEND );
|
pglEnable( GL_BLEND );
|
||||||
pglBlendFunc( GL_DST_COLOR, GL_SRC_COLOR );
|
pglBlendFunc( GL_DST_COLOR, GL_SRC_COLOR );
|
||||||
@@ -1300,7 +1325,7 @@ void R_DrawTextureChains( void )
|
|||||||
RI.currententity = CL_GetEntityByIndex( 0 );
|
RI.currententity = CL_GetEntityByIndex( 0 );
|
||||||
RI.currentmodel = RI.currententity->model;
|
RI.currentmodel = RI.currententity->model;
|
||||||
|
|
||||||
if( ENGINE_GET_PARM( PARM_SKY_SPHERE ) )
|
if( FBitSet( tr.world->flags, FWORLD_SKYSPHERE ) && !FBitSet( tr.world->flags, FWORLD_CUSTOM_SKYBOX ))
|
||||||
{
|
{
|
||||||
pglDisable( GL_TEXTURE_2D );
|
pglDisable( GL_TEXTURE_2D );
|
||||||
pglColor3f( 1.0f, 1.0f, 1.0f );
|
pglColor3f( 1.0f, 1.0f, 1.0f );
|
||||||
@@ -1310,7 +1335,7 @@ void R_DrawTextureChains( void )
|
|||||||
for( s = skychain; s != NULL; s = s->texturechain )
|
for( s = skychain; s != NULL; s = s->texturechain )
|
||||||
R_AddSkyBoxSurface( s );
|
R_AddSkyBoxSurface( s );
|
||||||
|
|
||||||
if( ENGINE_GET_PARM( PARM_SKY_SPHERE ) )
|
if( FBitSet( tr.world->flags, FWORLD_SKYSPHERE ) && !FBitSet( tr.world->flags, FWORLD_CUSTOM_SKYBOX ))
|
||||||
{
|
{
|
||||||
pglEnable( GL_TEXTURE_2D );
|
pglEnable( GL_TEXTURE_2D );
|
||||||
if( skychain )
|
if( skychain )
|
||||||
@@ -1601,7 +1626,7 @@ void R_DrawBrushModel( cl_entity_t *e )
|
|||||||
{
|
{
|
||||||
l = gEngfuncs.GetDynamicLight( k );
|
l = gEngfuncs.GetDynamicLight( k );
|
||||||
|
|
||||||
if( l->die < gpGlobals->time || !l->radius )
|
if( l->die < gp_cl->time || !l->radius )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
VectorCopy( l->origin, oldorigin ); // save lightorigin
|
VectorCopy( l->origin, oldorigin ); // save lightorigin
|
||||||
@@ -2198,17 +2223,22 @@ static void R_SetLightmap( void )
|
|||||||
if( mtst.skiptexture )
|
if( mtst.skiptexture )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*if( gl_overbright->integer )
|
if( gl_overbright.value )
|
||||||
{
|
{
|
||||||
|
// GLfloat color[4] = { 128.0f / 192.0f, 128.0f / 192.0f, 128.0f / 192.0f, 1.0f };
|
||||||
|
|
||||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB );
|
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB );
|
||||||
pglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE );
|
pglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE );
|
||||||
pglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB );
|
pglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB );
|
||||||
pglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE );
|
pglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE );
|
||||||
pglTexEnvi( GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2 );
|
pglTexEnvi( GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2 );
|
||||||
|
// doesn't work here for some reason
|
||||||
|
// pglTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color );
|
||||||
}
|
}
|
||||||
else*/
|
else
|
||||||
|
{
|
||||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||||
|
}
|
||||||
pglTexCoordPointer( 2, GL_FLOAT, sizeof( vbovertex_t ), (void*)offsetof(vbovertex_t, lm_tc ) );
|
pglTexCoordPointer( 2, GL_FLOAT, sizeof( vbovertex_t ), (void*)offsetof(vbovertex_t, lm_tc ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2963,7 +2993,7 @@ void R_ClearVBOState( qboolean drawlightmap, qboolean drawtextures )
|
|||||||
if( drawlightmap )
|
if( drawlightmap )
|
||||||
{
|
{
|
||||||
// reset states
|
// reset states
|
||||||
GL_SelectTexture( XASH_TEXTURE1 );
|
GL_Bind( XASH_TEXTURE1, tr.defaultTexture ); // force reset tmu in case we have only one lightmap
|
||||||
pglDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
pglDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||||
pglDisable( GL_TEXTURE_2D );
|
pglDisable( GL_TEXTURE_2D );
|
||||||
if( drawtextures )
|
if( drawtextures )
|
||||||
@@ -3005,7 +3035,7 @@ void R_DrawVBO( qboolean drawlightmap, qboolean drawtextures )
|
|||||||
if( !r_vbo.value )
|
if( !r_vbo.value )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GL_SetupFogColorForSurfacesEx( 1, 0.5f );
|
GL_SetupFogColorForSurfacesEx( 1, 0.5f, false );
|
||||||
|
|
||||||
R_SetupVBOArrayStatic( vbo, drawlightmap, drawtextures );
|
R_SetupVBOArrayStatic( vbo, drawlightmap, drawtextures );
|
||||||
mtst.skiptexture = !drawtextures;
|
mtst.skiptexture = !drawtextures;
|
||||||
@@ -3756,9 +3786,6 @@ void GL_RebuildLightmaps( void )
|
|||||||
if( !ENGINE_GET_PARM( PARM_CLIENT_ACTIVE ) )
|
if( !ENGINE_GET_PARM( PARM_CLIENT_ACTIVE ) )
|
||||||
return; // wait for worldmodel
|
return; // wait for worldmodel
|
||||||
|
|
||||||
ClearBits( vid_brightness->flags, FCVAR_CHANGED );
|
|
||||||
ClearBits( vid_gamma->flags, FCVAR_CHANGED );
|
|
||||||
|
|
||||||
// release old lightmaps
|
// release old lightmaps
|
||||||
for( i = 0; i < MAX_LIGHTMAPS; i++ )
|
for( i = 0; i < MAX_LIGHTMAPS; i++ )
|
||||||
{
|
{
|
||||||
@@ -3774,7 +3801,7 @@ void GL_RebuildLightmaps( void )
|
|||||||
|
|
||||||
LM_InitBlock();
|
LM_InitBlock();
|
||||||
|
|
||||||
for( i = 0; i < ENGINE_GET_PARM( PARM_NUMMODELS ); i++ )
|
for( i = 0; i < gp_cl->nummodels; i++ )
|
||||||
{
|
{
|
||||||
if(( m = CL_ModelHandle( i + 1 )) == NULL )
|
if(( m = CL_ModelHandle( i + 1 )) == NULL )
|
||||||
continue;
|
continue;
|
||||||
@@ -3818,8 +3845,7 @@ void GL_BuildLightmaps( void )
|
|||||||
memset( &RI, 0, sizeof( RI ));
|
memset( &RI, 0, sizeof( RI ));
|
||||||
|
|
||||||
// update the lightmap blocksize
|
// update the lightmap blocksize
|
||||||
if( FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_LARGE_LIGHTMAPS )
|
if( FBitSet( gp_host->features, ENGINE_LARGE_LIGHTMAPS ) || tr.world->version == QBSP2_VERSION )
|
||||||
|| ENGINE_GET_PARM( PARM_WORLD_VERSION ) == QBSP2_VERSION )
|
|
||||||
tr.block_size = BLOCK_SIZE_MAX;
|
tr.block_size = BLOCK_SIZE_MAX;
|
||||||
else tr.block_size = BLOCK_SIZE_DEFAULT;
|
else tr.block_size = BLOCK_SIZE_DEFAULT;
|
||||||
|
|
||||||
@@ -3839,7 +3865,7 @@ void GL_BuildLightmaps( void )
|
|||||||
|
|
||||||
LM_InitBlock();
|
LM_InitBlock();
|
||||||
|
|
||||||
for( i = 0; i < ENGINE_GET_PARM( PARM_NUMMODELS ); i++ )
|
for( i = 0; i < gp_cl->nummodels; i++ )
|
||||||
{
|
{
|
||||||
if(( m = CL_ModelHandle( i + 1 )) == NULL )
|
if(( m = CL_ModelHandle( i + 1 )) == NULL )
|
||||||
continue;
|
continue;
|
||||||
@@ -3875,10 +3901,6 @@ void GL_BuildLightmaps( void )
|
|||||||
// build lightmaps on the client-side
|
// build lightmaps on the client-side
|
||||||
gEngfuncs.drawFuncs->GL_BuildLightmaps( );
|
gEngfuncs.drawFuncs->GL_BuildLightmaps( );
|
||||||
}
|
}
|
||||||
|
|
||||||
// now gamma and brightness are valid
|
|
||||||
ClearBits( vid_brightness->flags, FCVAR_CHANGED );
|
|
||||||
ClearBits( vid_gamma->flags, FCVAR_CHANGED );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GL_InitRandomTable( void )
|
void GL_InitRandomTable( void )
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ typedef struct
|
|||||||
int numlocallights;
|
int numlocallights;
|
||||||
int lightage[MAXSTUDIOBONES];
|
int lightage[MAXSTUDIOBONES];
|
||||||
dlight_t *locallight[MAX_LOCALLIGHTS];
|
dlight_t *locallight[MAX_LOCALLIGHTS];
|
||||||
color24 locallightcolor[MAX_LOCALLIGHTS];
|
int locallightcolor[MAX_LOCALLIGHTS][3];
|
||||||
vec4_t lightpos[MAXSTUDIOVERTS][MAX_LOCALLIGHTS];
|
vec4_t lightpos[MAXSTUDIOVERTS][MAX_LOCALLIGHTS];
|
||||||
vec3_t lightbonepos[MAXSTUDIOBONES][MAX_LOCALLIGHTS];
|
vec3_t lightbonepos[MAXSTUDIOBONES][MAX_LOCALLIGHTS];
|
||||||
float locallightR2[MAX_LOCALLIGHTS];
|
float locallightR2[MAX_LOCALLIGHTS];
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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;
|
||||||
@@ -1381,13 +1381,13 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
|
|||||||
{
|
{
|
||||||
VectorSet( lightDir, mv->skyvec_x, mv->skyvec_y, mv->skyvec_z );
|
VectorSet( lightDir, mv->skyvec_x, mv->skyvec_y, mv->skyvec_z );
|
||||||
|
|
||||||
light.r = gEngfuncs.LightToTexGamma( bound( 0, mv->skycolor_r, 255 ));
|
light.r = mv->skycolor_r;
|
||||||
light.g = gEngfuncs.LightToTexGamma( bound( 0, mv->skycolor_g, 255 ));
|
light.g = mv->skycolor_g;
|
||||||
light.b = gEngfuncs.LightToTexGamma( bound( 0, mv->skycolor_b, 255 ));
|
light.b = mv->skycolor_b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(( light.r + light.g + light.b ) < 16 ) // TESTTEST
|
if(( light.r + light.g + light.b ) == 0 )
|
||||||
{
|
{
|
||||||
colorVec gcolor;
|
colorVec gcolor;
|
||||||
float grad[4];
|
float grad[4];
|
||||||
@@ -1435,6 +1435,13 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( ent->curstate.renderfx == kRenderFxLightMultiplier && ent->curstate.iuser4 != 10 )
|
||||||
|
{
|
||||||
|
light.r *= ent->curstate.iuser4 / 10.0f;
|
||||||
|
light.g *= ent->curstate.iuser4 / 10.0f;
|
||||||
|
light.b *= ent->curstate.iuser4 / 10.0f;
|
||||||
|
}
|
||||||
|
|
||||||
VectorSet( finalLight, light.r, light.g, light.b );
|
VectorSet( finalLight, light.r, light.g, light.b );
|
||||||
ent->cvFloorColor = light;
|
ent->cvFloorColor = light;
|
||||||
|
|
||||||
@@ -1466,15 +1473,15 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
|
|||||||
|
|
||||||
VectorAdd( lightDir, dist, lightDir );
|
VectorAdd( lightDir, dist, lightDir );
|
||||||
|
|
||||||
finalLight[0] += gEngfuncs.LightToTexGamma( dl->color.r ) * ( add / 256.0f ) * 2.0f;
|
finalLight[0] += dl->color.r * ( add / 256.0f );
|
||||||
finalLight[1] += gEngfuncs.LightToTexGamma( dl->color.g ) * ( add / 256.0f ) * 2.0f;
|
finalLight[1] += dl->color.g * ( add / 256.0f );
|
||||||
finalLight[2] += gEngfuncs.LightToTexGamma( dl->color.b ) * ( add / 256.0f ) * 2.0f;
|
finalLight[2] += dl->color.b * ( add / 256.0f );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( FBitSet( ent->model->flags, STUDIO_AMBIENT_LIGHT ))
|
if( FBitSet( ent->model->flags, STUDIO_AMBIENT_LIGHT ))
|
||||||
add = 0.6f;
|
add = 0.6f;
|
||||||
else add = 0.9f;
|
else add = bound( 0.75f, v_direct->value, 1.0f );
|
||||||
|
|
||||||
VectorScale( lightDir, add, lightDir );
|
VectorScale( lightDir, add, lightDir );
|
||||||
|
|
||||||
@@ -1568,9 +1575,9 @@ void R_StudioEntityLight( alight_t *lightinfo )
|
|||||||
|
|
||||||
if( k != -1 )
|
if( k != -1 )
|
||||||
{
|
{
|
||||||
g_studio.locallightcolor[k].r = gEngfuncs.LightToTexGamma( el->color.r );
|
g_studio.locallightcolor[k][0] = gEngfuncs.LinearGammaTable( el->color.r << 2 );
|
||||||
g_studio.locallightcolor[k].g = gEngfuncs.LightToTexGamma( el->color.g );
|
g_studio.locallightcolor[k][1] = gEngfuncs.LinearGammaTable( el->color.g << 2 );
|
||||||
g_studio.locallightcolor[k].b = gEngfuncs.LightToTexGamma( el->color.b );
|
g_studio.locallightcolor[k][2] = gEngfuncs.LinearGammaTable( el->color.b << 2 );
|
||||||
g_studio.locallightR2[k] = r2;
|
g_studio.locallightR2[k] = r2;
|
||||||
g_studio.locallight[k] = el;
|
g_studio.locallight[k] = el;
|
||||||
lstrength[k] = minstrength;
|
lstrength[k] = minstrength;
|
||||||
@@ -1665,7 +1672,8 @@ void R_StudioLighting( float *lv, int bone, int flags, vec3_t normal )
|
|||||||
}
|
}
|
||||||
|
|
||||||
illum = Q_min( illum, 255.0f );
|
illum = Q_min( illum, 255.0f );
|
||||||
*lv = illum * (1.0f / 255.0f);
|
|
||||||
|
*lv = gEngfuncs.LightToTexGammaEx( illum * 4 ) / 1023.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1685,7 +1693,7 @@ static void R_LightLambert( vec4_t light[MAX_LOCALLIGHTS], const vec3_t normal,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorCopy( color, finalLight );
|
VectorSet( finalLight, 0, 0, 0 );
|
||||||
|
|
||||||
for( i = 0; i < g_studio.numlocallights; i++ )
|
for( i = 0; i < g_studio.numlocallights; i++ )
|
||||||
{
|
{
|
||||||
@@ -1709,21 +1717,29 @@ static void R_LightLambert( vec4_t light[MAX_LOCALLIGHTS], const vec3_t normal,
|
|||||||
else light[i][3] = 0.0001f;
|
else light[i][3] = 0.0001f;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = Q_min( r * light[i][3] / 255.0f, 1.0f );
|
temp = r * light[i][3];
|
||||||
|
|
||||||
localLight[0] = (float)g_studio.locallightcolor[i].r * temp;
|
|
||||||
localLight[1] = (float)g_studio.locallightcolor[i].g * temp;
|
|
||||||
localLight[2] = (float)g_studio.locallightcolor[i].b * temp;
|
|
||||||
|
|
||||||
|
VectorAddScalar( g_studio.locallightcolor[i], temp, localLight );
|
||||||
VectorAdd( finalLight, localLight, finalLight );
|
VectorAdd( finalLight, localLight, finalLight );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorScale( finalLight, 255.0f, finalLight );
|
if( !VectorIsNull( finalLight ))
|
||||||
|
{
|
||||||
|
for( i = 0; i < 3; i++ )
|
||||||
|
{
|
||||||
|
float c = finalLight[i] + gEngfuncs.LinearGammaTable( color[i] * 1023.0f );
|
||||||
|
|
||||||
out[0] = Q_min( (int)( finalLight[0] ), 255 );
|
if( c > 1023.0f )
|
||||||
out[1] = Q_min( (int)( finalLight[1] ), 255 );
|
out[i] = 255;
|
||||||
out[2] = Q_min( (int)( finalLight[2] ), 255 );
|
else
|
||||||
|
out[i] = gEngfuncs.ScreenGammaTable( c ) >> 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VectorScale( color, 255.0f, out );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void R_StudioSetColorArray( short *ptricmds, vec3_t *pstudionorms, byte *color )
|
static void R_StudioSetColorArray( short *ptricmds, vec3_t *pstudionorms, byte *color )
|
||||||
@@ -2242,8 +2258,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 +2268,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 )
|
||||||
{
|
{
|
||||||
@@ -2756,7 +2772,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;
|
||||||
@@ -2772,7 +2788,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 )
|
||||||
@@ -3297,7 +3313,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 );
|
||||||
@@ -3379,7 +3395,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;
|
||||||
@@ -3442,7 +3458,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
|
||||||
@@ -3527,7 +3543,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 )
|
||||||
{
|
{
|
||||||
@@ -3560,22 +3576,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 = CL_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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3607,7 +3643,7 @@ void R_RunViewmodelEvents( void )
|
|||||||
|
|
||||||
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;
|
||||||
@@ -3625,9 +3661,7 @@ void R_GatherPlayerLight( void )
|
|||||||
cl_entity_t *view = tr.viewent;
|
cl_entity_t *view = tr.viewent;
|
||||||
colorVec c;
|
colorVec c;
|
||||||
|
|
||||||
tr.ignore_lightgamma = true;
|
|
||||||
c = R_LightPoint( view->origin );
|
c = R_LightPoint( view->origin );
|
||||||
tr.ignore_lightgamma = false;
|
|
||||||
gEngfuncs.SetLocalLightLevel( ( c.r + c.g + c.b ) / 3 );
|
gEngfuncs.SetLocalLightLevel( ( c.r + c.g + c.b ) / 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3756,7 +3790,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
|
||||||
|
|||||||
@@ -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 ));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -883,6 +883,10 @@ void R_InitRipples( void )
|
|||||||
memset( pic.buffer, 0, pic.size );
|
memset( pic.buffer, 0, pic.size );
|
||||||
|
|
||||||
g_ripple.rippletexturenum = GL_LoadTextureInternal( "*rippletex", &pic, TF_NOMIPMAP );
|
g_ripple.rippletexturenum = GL_LoadTextureInternal( "*rippletex", &pic, TF_NOMIPMAP );
|
||||||
|
|
||||||
|
// need to set proper tex params for TF_NOMIPMAP texture,
|
||||||
|
// as during upload it fails TF_NEAREST check and gets blurry even with gl_texture_nearest 1
|
||||||
|
R_UpdateRippleTexParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void R_SwapBufs( void )
|
static void R_SwapBufs( void )
|
||||||
@@ -936,14 +940,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
|
||||||
@@ -962,7 +958,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
|
|||||||
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;
|
||||||
@@ -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 );
|
||||||
|
|||||||
@@ -950,7 +950,7 @@ void R_RenderWorld (void)
|
|||||||
|
|
||||||
// auto cycle the world frame for texture animation
|
// auto cycle the world frame for texture animation
|
||||||
RI.currententity = CL_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 );
|
||||||
}
|
}
|
||||||
@@ -416,6 +418,7 @@ ref_interface_t gReffuncs =
|
|||||||
GL_InitExtensions,
|
GL_InitExtensions,
|
||||||
GL_ClearExtensions,
|
GL_ClearExtensions,
|
||||||
|
|
||||||
|
R_GammaChanged,
|
||||||
R_BeginFrame,
|
R_BeginFrame,
|
||||||
R_RenderScene,
|
R_RenderScene,
|
||||||
R_EndFrame,
|
R_EndFrame,
|
||||||
@@ -564,5 +567,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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -39,26 +39,26 @@ 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;
|
|
||||||
lightstyle_t *ls;
|
lightstyle_t *ls;
|
||||||
|
|
||||||
if( !WORLDMODEL ) return;
|
if( !WORLDMODEL )
|
||||||
|
return;
|
||||||
|
|
||||||
scale = 1; //r_lighting_modulate->value;
|
if( !WORLDMODEL->lightdata )
|
||||||
|
{
|
||||||
|
for( i = 0; i < MAX_LIGHTSTYLES; i++ )
|
||||||
|
tr.lightstylevalue[i] = 256 * 256;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// light animations
|
// light animations
|
||||||
// 'm' is normal light, 'a' is no light, 'z' is double bright
|
// 'm' is normal light, 'a' is no light, 'z' is double bright
|
||||||
for( i = 0; i < MAX_LIGHTSTYLES; i++ )
|
for( i = 0; i < MAX_LIGHTSTYLES; i++ )
|
||||||
{
|
{
|
||||||
ls = gEngfuncs.GetLightStyle( i );
|
ls = gEngfuncs.GetLightStyle( i );
|
||||||
if( !WORLDMODEL->lightdata )
|
|
||||||
{
|
|
||||||
tr.lightstylevalue[i] = 256 * 256;
|
|
||||||
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 );
|
||||||
@@ -68,18 +68,18 @@ void GAME_EXPORT CL_RunLightStyles( void )
|
|||||||
|
|
||||||
if( !ls->length )
|
if( !ls->length )
|
||||||
{
|
{
|
||||||
tr.lightstylevalue[i] = 256 * scale;
|
tr.lightstylevalue[i] = 256;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if( ls->length == 1 )
|
else if( ls->length == 1 )
|
||||||
{
|
{
|
||||||
// single length style so don't bother interpolating
|
// single length style so don't bother interpolating
|
||||||
tr.lightstylevalue[i] = ls->map[0] * 22 * scale;
|
tr.lightstylevalue[i] = ( ls->pattern[0] - 'a' ) * 22;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if( !ls->interp ) // || !CVAR_TO_BOOL( cl_lightstyle_lerping ))
|
else if( !ls->interp ) // || !CVAR_TO_BOOL( cl_lightstyle_lerping ))
|
||||||
{
|
{
|
||||||
tr.lightstylevalue[i] = ls->map[flight%ls->length] * 22 * scale;
|
tr.lightstylevalue[i] = ( ls->pattern[flight%ls->length] - 'a' ) * 22;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ void GAME_EXPORT CL_RunLightStyles( void )
|
|||||||
k = ls->map[clight % ls->length];
|
k = ls->map[clight % ls->length];
|
||||||
l += (float)( k * 22.0f ) * lerpfrac;
|
l += (float)( k * 22.0f ) * lerpfrac;
|
||||||
|
|
||||||
tr.lightstylevalue[i] = (int)l * scale;
|
tr.lightstylevalue[i] = (int)l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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 ))
|
||||||
@@ -323,18 +323,10 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f,
|
|||||||
{
|
{
|
||||||
uint scale = tr.lightstylevalue[surf->styles[map]];
|
uint scale = tr.lightstylevalue[surf->styles[map]];
|
||||||
|
|
||||||
if( tr.ignore_lightgamma )
|
cv->r += lm->r * scale;
|
||||||
{
|
cv->g += lm->g * scale;
|
||||||
cv->r += lm->r * scale * 2.5; // scale;
|
cv->b += lm->b * scale;
|
||||||
cv->g += lm->g * scale * 2.5; // scale;
|
|
||||||
cv->b += lm->b * scale * 2.5; // scale;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cv->r += gEngfuncs.LightToTexGamma( lm->r ) * scale;
|
|
||||||
cv->g += gEngfuncs.LightToTexGamma( lm->g ) * scale;
|
|
||||||
cv->b += gEngfuncs.LightToTexGamma( lm->b ) * scale;
|
|
||||||
}
|
|
||||||
lm += size; // skip to next lightmap
|
lm += size; // skip to next lightmap
|
||||||
|
|
||||||
if( dm != NULL )
|
if( dm != NULL )
|
||||||
@@ -421,9 +413,9 @@ colorVec R_LightVecInternal( const vec3_t start, const vec3_t end, vec3_t lspot,
|
|||||||
{
|
{
|
||||||
if( lspot ) VectorCopy( g_trace_lightspot, lspot );
|
if( lspot ) VectorCopy( g_trace_lightspot, lspot );
|
||||||
if( lvec ) VectorNormalize2( g_trace_lightvec, lvec );
|
if( lvec ) VectorNormalize2( g_trace_lightvec, lvec );
|
||||||
light.r = Q_min(( cv.r >> 7 ), 255 );
|
light.r = Q_min(( cv.r >> 8 ), 255 );
|
||||||
light.g = Q_min(( cv.g >> 7 ), 255 );
|
light.g = Q_min(( cv.g >> 8 ), 255 );
|
||||||
light.b = Q_min(( cv.b >> 7 ), 255 );
|
light.b = Q_min(( cv.b >> 8 ), 255 );
|
||||||
last_fraction = g_trace_fraction;
|
last_fraction = g_trace_fraction;
|
||||||
|
|
||||||
if(( light.r + light.g + light.b ) != 0 )
|
if(( light.r + light.g + light.b ) != 0 )
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ extern poolhandle_t r_temppool;
|
|||||||
#define MAX_DRAW_STACK 2 // normal view and menu view
|
#define MAX_DRAW_STACK 2 // normal view and menu view
|
||||||
|
|
||||||
#define SHADEDOT_QUANT 16 // precalculated dot products for quantized angles
|
#define SHADEDOT_QUANT 16 // precalculated dot products for quantized angles
|
||||||
#define SHADE_LAMBERT 1.495f
|
#define SHADE_LAMBERT 1.4953241
|
||||||
#define DEFAULT_ALPHATEST 0.0f
|
#define DEFAULT_ALPHATEST 0.0f
|
||||||
|
|
||||||
// refparams
|
// refparams
|
||||||
@@ -78,10 +78,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 == gEngfuncs.GetPlayerIndex() && 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
|
||||||
@@ -270,7 +270,6 @@ typedef struct
|
|||||||
int realframecount; // not including viewpasses
|
int realframecount; // not including viewpasses
|
||||||
int framecount;
|
int framecount;
|
||||||
|
|
||||||
qboolean ignore_lightgamma;
|
|
||||||
qboolean fCustomRendering;
|
qboolean fCustomRendering;
|
||||||
qboolean fResetVis;
|
qboolean fResetVis;
|
||||||
qboolean fFlipViewModel;
|
qboolean fFlipViewModel;
|
||||||
@@ -289,7 +288,6 @@ typedef struct
|
|||||||
// cull info
|
// cull info
|
||||||
vec3_t modelorg; // relative to viewpoint
|
vec3_t modelorg; // relative to viewpoint
|
||||||
|
|
||||||
qboolean fCustomSkybox;
|
|
||||||
int sample_size;
|
int sample_size;
|
||||||
uint sample_bits;
|
uint sample_bits;
|
||||||
qboolean map_unload;
|
qboolean map_unload;
|
||||||
@@ -297,7 +295,6 @@ typedef struct
|
|||||||
// get from engine
|
// get from engine
|
||||||
cl_entity_t *entities;
|
cl_entity_t *entities;
|
||||||
movevars_t *movevars;
|
movevars_t *movevars;
|
||||||
model_t **models;
|
|
||||||
color24 *palette;
|
color24 *palette;
|
||||||
cl_entity_t *viewent;
|
cl_entity_t *viewent;
|
||||||
|
|
||||||
@@ -478,6 +475,7 @@ void R_SetupRefParams( const struct ref_viewpass_s *rvp );
|
|||||||
void R_TranslateForEntity( cl_entity_t *e );
|
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 );
|
||||||
|
qboolean R_OpaqueEntity( cl_entity_t *ent );
|
||||||
void R_AllowFog( qboolean allowed );
|
void R_AllowFog( qboolean allowed );
|
||||||
void R_SetupFrustum( void );
|
void R_SetupFrustum( void );
|
||||||
void R_FindViewLeaf( void );
|
void R_FindViewLeaf( void );
|
||||||
@@ -608,6 +606,7 @@ int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags );
|
|||||||
void GL_FreeImage( const char *name );
|
void GL_FreeImage( const char *name );
|
||||||
qboolean VID_ScreenShot( const char *filename, int shot_type );
|
qboolean VID_ScreenShot( const char *filename, int shot_type );
|
||||||
qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qboolean skyshot );
|
qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qboolean skyshot );
|
||||||
|
void R_GammaChanged( qboolean do_reset_gamma );
|
||||||
void R_BeginFrame( qboolean clearScene );
|
void R_BeginFrame( qboolean clearScene );
|
||||||
void R_RenderFrame( const struct ref_viewpass_s *vp );
|
void R_RenderFrame( const struct ref_viewpass_s *vp );
|
||||||
void R_EndFrame( void );
|
void R_EndFrame( void );
|
||||||
@@ -676,25 +675,33 @@ void TriBrightness( float brightness );
|
|||||||
#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 )
|
||||||
|
|
||||||
|
extern ref_api_t gEngfuncs;
|
||||||
|
extern ref_globals_t *gpGlobals;
|
||||||
|
extern ref_client_t *gp_cl;
|
||||||
|
extern ref_host_t *gp_host;
|
||||||
|
|
||||||
|
DECLARE_ENGINE_SHARED_CVAR_LIST()
|
||||||
|
|
||||||
//
|
//
|
||||||
// helper funcs
|
// helper funcs
|
||||||
//
|
//
|
||||||
static inline cl_entity_t *CL_GetEntityByIndex( int index )
|
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];
|
return &tr.entities[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline model_t *CL_ModelHandle( int index )
|
static inline model_t *CL_ModelHandle( int index )
|
||||||
{
|
{
|
||||||
return tr.models[index];
|
if( unlikely( index < 0 || index >= gp_cl->nummodels ))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return gp_cl->models[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WORLDMODEL (tr.models[1])
|
#define WORLDMODEL (gp_cl->models[1])
|
||||||
|
|
||||||
extern ref_api_t gEngfuncs;
|
|
||||||
extern ref_globals_t *gpGlobals;
|
|
||||||
|
|
||||||
DECLARE_ENGINE_SHARED_CVAR_LIST()
|
|
||||||
|
|
||||||
// todo: gl_cull.c
|
// todo: gl_cull.c
|
||||||
#define R_CullModel(...) 0
|
#define R_CullModel(...) 0
|
||||||
|
|||||||
@@ -145,7 +145,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 )
|
||||||
{
|
{
|
||||||
int rendermode = R_GetEntityRenderMode( ent );
|
int rendermode = R_GetEntityRenderMode( ent );
|
||||||
|
|
||||||
@@ -441,8 +441,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.97 + sin( gpGlobals->time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0);
|
RI.fov_x = atan( tan( DEG2RAD( RI.fov_x ) / 2 ) * ( 0.97 + sin( gp_cl->time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0);
|
||||||
RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03 - sin( gpGlobals->time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0);
|
RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03 - sin( gp_cl->time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// build the transformation matrix for the given view angles
|
// build the transformation matrix for the given view angles
|
||||||
@@ -1171,7 +1171,7 @@ void R_DrawBEntitiesOnList (void)
|
|||||||
dlight_t *l = gEngfuncs.GetDynamicLight( k );
|
dlight_t *l = gEngfuncs.GetDynamicLight( k );
|
||||||
vec3_t origin_l, oldorigin;
|
vec3_t origin_l, oldorigin;
|
||||||
|
|
||||||
if( l->die < gpGlobals->time || !l->radius )
|
if( l->die < gp_cl->time || !l->radius )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
VectorCopy( l->origin, oldorigin ); // save lightorigin
|
VectorCopy( l->origin, oldorigin ); // save lightorigin
|
||||||
@@ -1326,7 +1326,7 @@ void R_DrawBrushModel(cl_entity_t *pent)
|
|||||||
dlight_t *l = gEngfuncs.GetDynamicLight( k );
|
dlight_t *l = gEngfuncs.GetDynamicLight( k );
|
||||||
vec3_t origin_l, oldorigin;
|
vec3_t origin_l, oldorigin;
|
||||||
|
|
||||||
if( l->die < gpGlobals->time || !l->radius )
|
if( l->die < gp_cl->time || !l->radius )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
VectorCopy( l->origin, oldorigin ); // save lightorigin
|
VectorCopy( l->origin, oldorigin ); // save lightorigin
|
||||||
@@ -1561,7 +1561,7 @@ void GAME_EXPORT 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
|
||||||
@@ -1636,6 +1636,14 @@ qboolean R_DoResetGamma( void )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void R_GammaChanged( qboolean do_reset_gamma )
|
||||||
|
{
|
||||||
|
if( do_reset_gamma ) // unused
|
||||||
|
return;
|
||||||
|
|
||||||
|
D_FlushCaches( );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
R_BeginFrame
|
R_BeginFrame
|
||||||
@@ -1643,28 +1651,6 @@ R_BeginFrame
|
|||||||
*/
|
*/
|
||||||
void GAME_EXPORT R_BeginFrame( qboolean clearScene )
|
void GAME_EXPORT R_BeginFrame( qboolean clearScene )
|
||||||
{
|
{
|
||||||
#if 0 // unused
|
|
||||||
if( R_DoResetGamma( ))
|
|
||||||
{
|
|
||||||
gEngfuncs.BuildGammaTable( 1.8f, 0.0f );
|
|
||||||
D_FlushCaches( );
|
|
||||||
|
|
||||||
// next frame will be restored gamma
|
|
||||||
SetBits( vid_brightness->flags, FCVAR_CHANGED );
|
|
||||||
SetBits( vid_gamma->flags, FCVAR_CHANGED );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
if( FBitSet( vid_gamma->flags, FCVAR_CHANGED ) || FBitSet( vid_brightness->flags, FCVAR_CHANGED ))
|
|
||||||
{
|
|
||||||
gEngfuncs.BuildGammaTable( vid_gamma->value, vid_brightness->value );
|
|
||||||
|
|
||||||
D_FlushCaches( );
|
|
||||||
// next frame will be restored gamma
|
|
||||||
ClearBits( vid_brightness->flags, FCVAR_CHANGED );
|
|
||||||
ClearBits( vid_gamma->flags, FCVAR_CHANGED );
|
|
||||||
}
|
|
||||||
|
|
||||||
R_Set2DMode( true );
|
R_Set2DMode( true );
|
||||||
|
|
||||||
// draw buffer stuff
|
// draw buffer stuff
|
||||||
@@ -1939,10 +1925,9 @@ qboolean GAME_EXPORT R_Init( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// see R_ProcessEntData for tr.entities initialization
|
// see R_ProcessEntData for tr.entities initialization
|
||||||
tr.models = gEngfuncs.pfnGetModels();
|
tr.movevars = (movevars_t *)ENGINE_GET_PARM( PARM_GET_MOVEVARS_PTR );
|
||||||
tr.movevars = gEngfuncs.pfnGetMoveVars();
|
tr.palette = (color24 *)ENGINE_GET_PARM( PARM_GET_PALETTE_PTR );
|
||||||
tr.palette = gEngfuncs.CL_GetPaletteColor();
|
tr.viewent = (cl_entity_t *)ENGINE_GET_PARM( PARM_GET_VIEWENT_PTR );
|
||||||
tr.viewent = gEngfuncs.GetViewModel();
|
|
||||||
|
|
||||||
R_InitBlit( glblit );
|
R_InitBlit( glblit );
|
||||||
|
|
||||||
@@ -1985,16 +1970,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( ))
|
||||||
@@ -2033,27 +2018,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;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ void GAME_EXPORT CL_DrawParticles( double frametime, particle_t *cl_active_parti
|
|||||||
p->color = bound( 0, p->color, 255 );
|
p->color = bound( 0, p->color, 255 );
|
||||||
color = tr.palette[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;
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ void GAME_EXPORT CL_DrawTracers( double frametime, particle_t *cl_active_tracers
|
|||||||
|
|
||||||
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 );
|
||||||
@@ -268,7 +268,7 @@ void GAME_EXPORT 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 )
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ void Turbulent8 (espan_t *pspan)
|
|||||||
float sdivz, tdivz, zi, z, du, dv, spancountminus1;
|
float sdivz, tdivz, zi, z, du, dv, spancountminus1;
|
||||||
float sdivz16stepu, tdivz16stepu, zi16stepu;
|
float sdivz16stepu, tdivz16stepu, zi16stepu;
|
||||||
|
|
||||||
r_turb_turb = sintable + ((int)(gpGlobals->time*SPEED)&(CYCLE-1));
|
r_turb_turb = sintable + ((int)(gp_cl->time*SPEED)&(CYCLE-1));
|
||||||
|
|
||||||
r_turb_sstep = 0; // keep compiler happy
|
r_turb_sstep = 0; // keep compiler happy
|
||||||
r_turb_tstep = 0; // ditto
|
r_turb_tstep = 0; // ditto
|
||||||
@@ -239,7 +239,7 @@ void TurbulentZ8 (espan_t *pspan, int alpha1)
|
|||||||
if( alpha == 0 )
|
if( alpha == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
r_turb_turb = sintable + ((int)(gpGlobals->time*SPEED)&(CYCLE-1));
|
r_turb_turb = sintable + ((int)(gp_cl->time*SPEED)&(CYCLE-1));
|
||||||
|
|
||||||
r_turb_sstep = 0; // keep compiler happy
|
r_turb_sstep = 0; // keep compiler happy
|
||||||
r_turb_tstep = 0; // ditto
|
r_turb_tstep = 0; // ditto
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ typedef struct
|
|||||||
int numlocallights;
|
int numlocallights;
|
||||||
int lightage[MAXSTUDIOBONES];
|
int lightage[MAXSTUDIOBONES];
|
||||||
dlight_t *locallight[MAX_LOCALLIGHTS];
|
dlight_t *locallight[MAX_LOCALLIGHTS];
|
||||||
color24 locallightcolor[MAX_LOCALLIGHTS];
|
uint locallightcolor[MAX_LOCALLIGHTS][3];
|
||||||
vec4_t lightpos[MAXSTUDIOVERTS][MAX_LOCALLIGHTS];
|
vec4_t lightpos[MAXSTUDIOVERTS][MAX_LOCALLIGHTS];
|
||||||
vec3_t lightbonepos[MAXSTUDIOBONES][MAX_LOCALLIGHTS];
|
vec3_t lightbonepos[MAXSTUDIOBONES][MAX_LOCALLIGHTS];
|
||||||
float locallightR2[MAX_LOCALLIGHTS];
|
float locallightR2[MAX_LOCALLIGHTS];
|
||||||
@@ -163,14 +163,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,8 +413,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -585,12 +585,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
|
||||||
@@ -1320,7 +1320,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;
|
||||||
@@ -1356,7 +1356,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;
|
||||||
@@ -1377,13 +1377,13 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
|
|||||||
{
|
{
|
||||||
VectorSet( lightDir, mv->skyvec_x, mv->skyvec_y, mv->skyvec_z );
|
VectorSet( lightDir, mv->skyvec_x, mv->skyvec_y, mv->skyvec_z );
|
||||||
|
|
||||||
light.r = gEngfuncs.LightToTexGamma( bound( 0, mv->skycolor_r, 255 ));
|
light.r = mv->skycolor_r;
|
||||||
light.g = gEngfuncs.LightToTexGamma( bound( 0, mv->skycolor_g, 255 ));
|
light.g = mv->skycolor_g;
|
||||||
light.b = gEngfuncs.LightToTexGamma( bound( 0, mv->skycolor_b, 255 ));
|
light.b = mv->skycolor_b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(( light.r + light.g + light.b ) < 16 ) // TESTTEST
|
if(( light.r + light.g + light.b ) == 0 )
|
||||||
{
|
{
|
||||||
colorVec gcolor;
|
colorVec gcolor;
|
||||||
float grad[4];
|
float grad[4];
|
||||||
@@ -1431,6 +1431,13 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( ent->curstate.renderfx == kRenderFxLightMultiplier && ent->curstate.iuser4 != 10 )
|
||||||
|
{
|
||||||
|
light.r *= ent->curstate.iuser4 / 10.0f;
|
||||||
|
light.g *= ent->curstate.iuser4 / 10.0f;
|
||||||
|
light.b *= ent->curstate.iuser4 / 10.0f;
|
||||||
|
}
|
||||||
|
|
||||||
VectorSet( finalLight, light.r, light.g, light.b );
|
VectorSet( finalLight, light.r, light.g, light.b );
|
||||||
ent->cvFloorColor = light;
|
ent->cvFloorColor = light;
|
||||||
|
|
||||||
@@ -1462,15 +1469,15 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
|
|||||||
|
|
||||||
VectorAdd( lightDir, dist, lightDir );
|
VectorAdd( lightDir, dist, lightDir );
|
||||||
|
|
||||||
finalLight[0] += gEngfuncs.LightToTexGamma( dl->color.r ) * ( add / 256.0f ) * 2.0f;
|
finalLight[0] += dl->color.r * ( add / 256.0f );
|
||||||
finalLight[1] += gEngfuncs.LightToTexGamma( dl->color.g ) * ( add / 256.0f ) * 2.0f;
|
finalLight[1] += dl->color.g * ( add / 256.0f );
|
||||||
finalLight[2] += gEngfuncs.LightToTexGamma( dl->color.b ) * ( add / 256.0f ) * 2.0f;
|
finalLight[2] += dl->color.b * ( add / 256.0f );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( FBitSet( ent->model->flags, STUDIO_AMBIENT_LIGHT ))
|
if( FBitSet( ent->model->flags, STUDIO_AMBIENT_LIGHT ))
|
||||||
add = 0.6f;
|
add = 0.6f;
|
||||||
else add = 0.9f;
|
else add = bound( 0.75f, v_direct->value, 1.0f );
|
||||||
|
|
||||||
VectorScale( lightDir, add, lightDir );
|
VectorScale( lightDir, add, lightDir );
|
||||||
|
|
||||||
@@ -1564,9 +1571,9 @@ void R_StudioEntityLight( alight_t *lightinfo )
|
|||||||
|
|
||||||
if( k != -1 )
|
if( k != -1 )
|
||||||
{
|
{
|
||||||
g_studio.locallightcolor[k].r = gEngfuncs.LightToTexGamma( el->color.r );
|
g_studio.locallightcolor[k][0] = gEngfuncs.LinearGammaTable( el->color.r << 2 );
|
||||||
g_studio.locallightcolor[k].g = gEngfuncs.LightToTexGamma( el->color.g );
|
g_studio.locallightcolor[k][1] = gEngfuncs.LinearGammaTable( el->color.g << 2 );
|
||||||
g_studio.locallightcolor[k].b = gEngfuncs.LightToTexGamma( el->color.b );
|
g_studio.locallightcolor[k][2] = gEngfuncs.LinearGammaTable( el->color.b << 2 );
|
||||||
g_studio.locallightR2[k] = r2;
|
g_studio.locallightR2[k] = r2;
|
||||||
g_studio.locallight[k] = el;
|
g_studio.locallight[k] = el;
|
||||||
lstrength[k] = minstrength;
|
lstrength[k] = minstrength;
|
||||||
@@ -1642,7 +1649,7 @@ void R_StudioLighting( float *lv, int bone, int flags, vec3_t normal )
|
|||||||
|
|
||||||
r = SHADE_LAMBERT;
|
r = SHADE_LAMBERT;
|
||||||
|
|
||||||
// do modified hemispherical lighting
|
// do modified hemispherical lighting
|
||||||
if( r <= 1.0f )
|
if( r <= 1.0f )
|
||||||
{
|
{
|
||||||
r += 1.0f;
|
r += 1.0f;
|
||||||
@@ -1661,7 +1668,8 @@ void R_StudioLighting( float *lv, int bone, int flags, vec3_t normal )
|
|||||||
}
|
}
|
||||||
|
|
||||||
illum = Q_min( illum, 255.0f );
|
illum = Q_min( illum, 255.0f );
|
||||||
*lv = illum * (1.0f / 255.0f);
|
|
||||||
|
*lv = gEngfuncs.LightToTexGammaEx( illum * 4 ) / 1023.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1681,11 +1689,11 @@ static void R_LightLambert( vec4_t light[MAX_LOCALLIGHTS], const vec3_t normal,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorCopy( color, finalLight );
|
VectorSet( finalLight, 0, 0, 0 );
|
||||||
|
|
||||||
for( i = 0; i < g_studio.numlocallights; i++ )
|
for( i = 0; i < g_studio.numlocallights; i++ )
|
||||||
{
|
{
|
||||||
float r;
|
float r;
|
||||||
|
|
||||||
r = DotProduct( normal, light[i] );
|
r = DotProduct( normal, light[i] );
|
||||||
if( likely( !tr.fFlipViewModel ))
|
if( likely( !tr.fFlipViewModel ))
|
||||||
@@ -1705,21 +1713,29 @@ static void R_LightLambert( vec4_t light[MAX_LOCALLIGHTS], const vec3_t normal,
|
|||||||
else light[i][3] = 0.0001f;
|
else light[i][3] = 0.0001f;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = Q_min( r * light[i][3] / 255.0f, 1.0f );
|
temp = r * light[i][3];
|
||||||
|
|
||||||
localLight[0] = (float)g_studio.locallightcolor[i].r * temp;
|
|
||||||
localLight[1] = (float)g_studio.locallightcolor[i].g * temp;
|
|
||||||
localLight[2] = (float)g_studio.locallightcolor[i].b * temp;
|
|
||||||
|
|
||||||
|
VectorAddScalar( g_studio.locallightcolor[i], temp, localLight );
|
||||||
VectorAdd( finalLight, localLight, finalLight );
|
VectorAdd( finalLight, localLight, finalLight );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorScale( finalLight, 255.0f, finalLight );
|
if( !VectorIsNull( finalLight ))
|
||||||
|
{
|
||||||
|
for( i = 0; i < 3; i++ )
|
||||||
|
{
|
||||||
|
float c = finalLight[i] + gEngfuncs.LinearGammaTable( color[i] * 1023.0f );
|
||||||
|
|
||||||
out[0] = Q_min( (int)( finalLight[0] ), 255 );
|
if( c > 1023.0f )
|
||||||
out[1] = Q_min( (int)( finalLight[1] ), 255 );
|
out[i] = 255;
|
||||||
out[2] = Q_min( (int)( finalLight[2] ), 255 );
|
else
|
||||||
|
out[i] = gEngfuncs.ScreenGammaTable( c ) >> 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VectorScale( color, 255.0f, out );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void R_StudioSetColorBegin(short *ptricmds, vec3_t *pstudionorms )
|
static void R_StudioSetColorBegin(short *ptricmds, vec3_t *pstudionorms )
|
||||||
@@ -2023,8 +2039,7 @@ static void R_StudioDrawPoints( void )
|
|||||||
|
|
||||||
if( !m_pStudioHeader ) return;
|
if( !m_pStudioHeader ) return;
|
||||||
|
|
||||||
// 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);
|
||||||
@@ -2034,7 +2049,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 )
|
||||||
{
|
{
|
||||||
@@ -2516,7 +2532,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;
|
||||||
@@ -2532,7 +2548,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 )
|
||||||
@@ -3063,7 +3079,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 );
|
||||||
@@ -3145,7 +3161,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;
|
||||||
@@ -3208,7 +3224,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
|
||||||
@@ -3293,7 +3309,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 )
|
||||||
{
|
{
|
||||||
@@ -3326,26 +3342,47 @@ 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 = CL_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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
R_RunViewmodelEvents
|
R_RunViewmodelEvents
|
||||||
@@ -3373,7 +3410,7 @@ void R_RunViewmodelEvents( void )
|
|||||||
|
|
||||||
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;
|
||||||
@@ -3391,9 +3428,7 @@ void R_GatherPlayerLight( void )
|
|||||||
cl_entity_t *view = tr.viewent;
|
cl_entity_t *view = tr.viewent;
|
||||||
colorVec c;
|
colorVec c;
|
||||||
|
|
||||||
tr.ignore_lightgamma = true;
|
|
||||||
c = R_LightPoint( view->origin );
|
c = R_LightPoint( view->origin );
|
||||||
tr.ignore_lightgamma = false;
|
|
||||||
gEngfuncs.SetLocalLightLevel( ( c.r + c.g + c.b ) / 3 );
|
gEngfuncs.SetLocalLightLevel( ( c.r + c.g + c.b ) / 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3538,7 +3573,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_LOAD_DELUXEDATA ) && FBitSet( ptexture->flags, STUDIO_NF_MASKED ))
|
if( FBitSet( gp_host->features, ENGINE_LOAD_DELUXEDATA ) && 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
|
||||||
|
|||||||
@@ -211,13 +211,9 @@ static void R_BuildLightMap( void )
|
|||||||
|
|
||||||
for( i = 0, bl = blocklights; i < size; i++, bl += 1, lm++ )
|
for( i = 0, bl = blocklights; i < size; i++, bl += 1, lm++ )
|
||||||
{
|
{
|
||||||
bl[0] += gEngfuncs.LightToTexGamma( lm->r ) * scale;
|
bl[0] += lm->r * scale;
|
||||||
bl[0] += gEngfuncs.LightToTexGamma( lm->g ) * scale;
|
bl[1] += lm->g * scale;
|
||||||
bl[0] += gEngfuncs.LightToTexGamma( lm->b ) * scale;
|
bl[2] += lm->b * scale;
|
||||||
|
|
||||||
//printf("test\n");
|
|
||||||
//bl[1] += gEngfuncs.LightToTexGamma( lm->g ) * scale;
|
|
||||||
//bl[2] += gEngfuncs.LightToTexGamma( lm->b ) * scale;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,7 +241,10 @@ static void R_BuildLightMap( void )
|
|||||||
// bound, invert, and shift
|
// bound, invert, and shift
|
||||||
for (i=0 ; i<size ; i++)
|
for (i=0 ; i<size ; i++)
|
||||||
{
|
{
|
||||||
t = (int)blocklights[i];
|
if( blocklights[i] < 65280 )
|
||||||
|
t = gEngfuncs.LightToTexGammaEx( blocklights[i] >> 6 ) << 6;
|
||||||
|
else t = (int)blocklights[i];
|
||||||
|
|
||||||
if (t < 0)
|
if (t < 0)
|
||||||
t = 0;
|
t = 0;
|
||||||
if( t > 65535 * 3 )
|
if( t > 65535 * 3 )
|
||||||
@@ -401,7 +400,7 @@ texture_t *R_TextureAnim( texture_t *b )
|
|||||||
speed = 10;
|
speed = 10;
|
||||||
else speed = 20;
|
else speed = 20;
|
||||||
|
|
||||||
reletive = (int)(gpGlobals->time * speed) % base->anim_total;
|
reletive = (int)(gp_cl->time * speed) % base->anim_total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -455,7 +454,7 @@ texture_t *R_TextureAnimation( msurface_t *s )
|
|||||||
speed = 10;
|
speed = 10;
|
||||||
else speed = 20;
|
else speed = 20;
|
||||||
|
|
||||||
reletive = (int)(gpGlobals->time * speed) % base->anim_total;
|
reletive = (int)(gp_cl->time * speed) % base->anim_total;
|
||||||
}
|
}
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ build_hlsdk()
|
|||||||
./waf build install --destdir=../pkgtemp/xash3d || die
|
./waf build install --destdir=../pkgtemp/xash3d || die
|
||||||
}
|
}
|
||||||
|
|
||||||
|
git config --global --add safe.directory '*'
|
||||||
|
|
||||||
echo "Setting up environment..."
|
echo "Setting up environment..."
|
||||||
|
|
||||||
# we can't actually download dkp-toolchain-vars even from here, so
|
# we can't actually download dkp-toolchain-vars even from here, so
|
||||||
|
|||||||
@@ -75,29 +75,3 @@ ACT_FLINCH_LEFTARM
|
|||||||
ACT_FLINCH_RIGHTARM
|
ACT_FLINCH_RIGHTARM
|
||||||
ACT_FLINCH_LEFTLEG
|
ACT_FLINCH_LEFTLEG
|
||||||
ACT_FLINCH_RIGHTLEG
|
ACT_FLINCH_RIGHTLEG
|
||||||
ACT_VM_NONE
|
|
||||||
ACT_VM_DEPLOY
|
|
||||||
ACT_VM_DEPLOY_EMPTY
|
|
||||||
ACT_VM_HOLSTER
|
|
||||||
ACT_VM_HOLSTER_EMPTY
|
|
||||||
ACT_VM_IDLE1
|
|
||||||
ACT_VM_IDLE2
|
|
||||||
ACT_VM_IDLE3
|
|
||||||
ACT_VM_RANGE_ATTACK1
|
|
||||||
ACT_VM_RANGE_ATTACK2
|
|
||||||
ACT_VM_RANGE_ATTACK3
|
|
||||||
ACT_VM_MELEE_ATTACK1
|
|
||||||
ACT_VM_MELEE_ATTACK2
|
|
||||||
ACT_VM_MELEE_ATTACK3
|
|
||||||
ACT_VM_SHOOT_EMPTY
|
|
||||||
ACT_VM_START_RELOAD
|
|
||||||
ACT_VM_RELOAD
|
|
||||||
ACT_VM_RELOAD_EMPTY
|
|
||||||
ACT_VM_TURNON
|
|
||||||
ACT_VM_TURNOFF
|
|
||||||
ACT_VM_PUMP
|
|
||||||
ACT_VM_PUMP_EMPTY
|
|
||||||
ACT_VM_START_CHARGE
|
|
||||||
ACT_VM_CHARGE
|
|
||||||
ACT_VM_OVERLOAD
|
|
||||||
ACT_VM_IDLE_EMPTY
|
|
||||||
|
|||||||
17
wscript
17
wscript
@@ -78,7 +78,7 @@ SUBDIRS = [
|
|||||||
Subproject('3rdparty/mainui', lambda x: not x.env.DEDICATED),
|
Subproject('3rdparty/mainui', lambda x: not x.env.DEDICATED),
|
||||||
Subproject('3rdparty/vgui_support', lambda x: not x.env.DEDICATED),
|
Subproject('3rdparty/vgui_support', lambda x: not x.env.DEDICATED),
|
||||||
Subproject('stub/client', lambda x: not x.env.DEDICATED),
|
Subproject('stub/client', lambda x: not x.env.DEDICATED),
|
||||||
Subproject('game_launch', lambda x: not x.env.SINGLE_BINARY and x.env.DEST_OS != 'android'),
|
Subproject('game_launch', lambda x: not x.env.DISABLE_LAUNCHER),
|
||||||
|
|
||||||
# disable only by external dependency presense
|
# disable only by external dependency presense
|
||||||
Subproject('3rdparty/opus', lambda x: not x.env.HAVE_SYSTEM_OPUS and not x.env.DEDICATED),
|
Subproject('3rdparty/opus', lambda x: not x.env.HAVE_SYSTEM_OPUS and not x.env.DEDICATED),
|
||||||
@@ -113,9 +113,6 @@ def options(opt):
|
|||||||
grp.add_option('--gamedir', action = 'store', dest = 'GAMEDIR', default = 'valve',
|
grp.add_option('--gamedir', action = 'store', dest = 'GAMEDIR', default = 'valve',
|
||||||
help = 'engine default game directory [default: %default]')
|
help = 'engine default game directory [default: %default]')
|
||||||
|
|
||||||
grp.add_option('--single-binary', action = 'store_true', dest = 'SINGLE_BINARY', default = False,
|
|
||||||
help = 'build single "xash" binary (always enabled for dedicated) [default: %default]')
|
|
||||||
|
|
||||||
grp.add_option('-8', '--64bits', action = 'store_true', dest = 'ALLOW64', default = False,
|
grp.add_option('-8', '--64bits', action = 'store_true', dest = 'ALLOW64', default = False,
|
||||||
help = 'allow targetting 64-bit engine(Linux/Windows/OSX x86 only) [default: %default]')
|
help = 'allow targetting 64-bit engine(Linux/Windows/OSX x86 only) [default: %default]')
|
||||||
|
|
||||||
@@ -167,7 +164,7 @@ def configure(conf):
|
|||||||
conf.env.MSVC_TARGETS = ['x86' if not conf.options.ALLOW64 else 'x64']
|
conf.env.MSVC_TARGETS = ['x86' if not conf.options.ALLOW64 else 'x64']
|
||||||
|
|
||||||
# Load compilers early
|
# Load compilers early
|
||||||
conf.load('xshlib xcompile compiler_c compiler_cxx cmake gccdeps msvcdeps')
|
conf.load('xshlib xcompile compiler_c compiler_cxx cmake gccdeps')
|
||||||
|
|
||||||
if conf.options.NSWITCH:
|
if conf.options.NSWITCH:
|
||||||
conf.load('nswitch')
|
conf.load('nswitch')
|
||||||
@@ -202,29 +199,23 @@ def configure(conf):
|
|||||||
conf.options.GL4ES = True
|
conf.options.GL4ES = True
|
||||||
conf.options.GLES3COMPAT = True
|
conf.options.GLES3COMPAT = True
|
||||||
conf.options.GL = False
|
conf.options.GL = False
|
||||||
conf.options.SINGLE_BINARY = True
|
|
||||||
conf.define('XASH_SDLMAIN', 1)
|
conf.define('XASH_SDLMAIN', 1)
|
||||||
elif conf.env.MAGX:
|
elif conf.env.MAGX:
|
||||||
conf.options.SDL12 = True
|
conf.options.SDL12 = True
|
||||||
conf.options.NO_VGUI = True
|
conf.options.NO_VGUI = True
|
||||||
conf.options.GL = False
|
conf.options.GL = False
|
||||||
conf.options.LOW_MEMORY = 1
|
conf.options.LOW_MEMORY = 1
|
||||||
conf.options.SINGLE_BINARY = True
|
|
||||||
conf.options.NO_ASYNC_RESOLVE = True
|
conf.options.NO_ASYNC_RESOLVE = True
|
||||||
conf.define('XASH_SDLMAIN', 1)
|
conf.define('XASH_SDLMAIN', 1)
|
||||||
enforce_pic = False
|
enforce_pic = False
|
||||||
elif conf.env.DEST_OS == 'dos':
|
|
||||||
conf.options.SINGLE_BINARY = True
|
|
||||||
elif conf.env.DEST_OS == 'nswitch':
|
elif conf.env.DEST_OS == 'nswitch':
|
||||||
conf.options.NO_VGUI = True
|
conf.options.NO_VGUI = True
|
||||||
conf.options.GL = True
|
conf.options.GL = True
|
||||||
conf.options.SINGLE_BINARY = True
|
|
||||||
conf.options.NO_ASYNC_RESOLVE = True
|
conf.options.NO_ASYNC_RESOLVE = True
|
||||||
conf.options.USE_STBTT = True
|
conf.options.USE_STBTT = True
|
||||||
elif conf.env.DEST_OS == 'psvita':
|
elif conf.env.DEST_OS == 'psvita':
|
||||||
conf.options.NO_VGUI = True
|
conf.options.NO_VGUI = True
|
||||||
conf.options.GL = True
|
conf.options.GL = True
|
||||||
conf.options.SINGLE_BINARY = True
|
|
||||||
conf.options.NO_ASYNC_RESOLVE = True
|
conf.options.NO_ASYNC_RESOLVE = True
|
||||||
conf.options.USE_STBTT = True
|
conf.options.USE_STBTT = True
|
||||||
# we'll specify -fPIC by hand for shared libraries only
|
# we'll specify -fPIC by hand for shared libraries only
|
||||||
@@ -357,9 +348,11 @@ def configure(conf):
|
|||||||
conf.env.ENABLE_UTILS = conf.options.ENABLE_UTILS
|
conf.env.ENABLE_UTILS = conf.options.ENABLE_UTILS
|
||||||
conf.env.ENABLE_FUZZER = conf.options.ENABLE_FUZZER
|
conf.env.ENABLE_FUZZER = conf.options.ENABLE_FUZZER
|
||||||
conf.env.DEDICATED = conf.options.DEDICATED
|
conf.env.DEDICATED = conf.options.DEDICATED
|
||||||
conf.env.SINGLE_BINARY = conf.options.SINGLE_BINARY or conf.env.DEDICATED
|
|
||||||
conf.env.SUPPORT_BSP2_FORMAT = conf.options.SUPPORT_BSP2_FORMAT
|
conf.env.SUPPORT_BSP2_FORMAT = conf.options.SUPPORT_BSP2_FORMAT
|
||||||
|
|
||||||
|
# disable game_launch compiling on platform where it's not needed
|
||||||
|
conf.env.DISABLE_LAUNCHER = conf.env.DEST_OS in ['android', 'nswitch', 'psvita', 'dos'] or conf.env.MAGX or conf.env.DEDICATED
|
||||||
|
|
||||||
if conf.env.SAILFISH == 'aurora':
|
if conf.env.SAILFISH == 'aurora':
|
||||||
conf.env.DEFAULT_RPATH = '/usr/share/su.xash.Engine/lib'
|
conf.env.DEFAULT_RPATH = '/usr/share/su.xash.Engine/lib'
|
||||||
elif conf.env.DEST_OS == 'darwin':
|
elif conf.env.DEST_OS == 'darwin':
|
||||||
|
|||||||
Reference in New Issue
Block a user