mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-06 04:05:11 +08:00
Compare commits
88 Commits
continuous
...
psp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8044646a2b | ||
|
|
cae351f7b1 | ||
|
|
9812a9104b | ||
|
|
d419921ca3 | ||
|
|
3ccb156554 | ||
|
|
15ea61ea34 | ||
|
|
e6a9724d7c | ||
|
|
28723b01a9 | ||
|
|
0dc1c13b83 | ||
|
|
1704712650 | ||
|
|
066d87f546 | ||
|
|
0b500168a7 | ||
|
|
e3e5fe8e18 | ||
|
|
da161103b1 | ||
|
|
d6d8ee3e57 | ||
|
|
89ee68d5d0 | ||
|
|
f5ca0175a5 | ||
|
|
5559f728b7 | ||
|
|
238687affa | ||
|
|
5832d017c7 | ||
|
|
4e78898c6f | ||
|
|
c6520b83b2 | ||
|
|
a440d1ff7a | ||
|
|
3889ed8c52 | ||
|
|
53d44f4c0e | ||
|
|
bdc2009683 | ||
|
|
a375adb9ea | ||
|
|
122a11005b | ||
|
|
f70938d2b0 | ||
|
|
40dca1ea1f | ||
|
|
f8452b8490 | ||
|
|
3b50fded8b | ||
|
|
5ad4f43a7e | ||
|
|
ef117ffbb3 | ||
|
|
8850d2ae52 | ||
|
|
e66400ca39 | ||
|
|
01affdcbbd | ||
|
|
ed2ba1f226 | ||
|
|
1abec2620a | ||
|
|
f4ae5cf8e0 | ||
|
|
57ddff5457 | ||
|
|
d98330adca | ||
|
|
21ed285da7 | ||
|
|
b517019750 | ||
|
|
b567531cdb | ||
|
|
9c61941e52 | ||
|
|
3afc7134ab | ||
|
|
bcf838c42f | ||
|
|
91d6fdd190 | ||
|
|
b8ff41eac9 | ||
|
|
0277700977 | ||
|
|
da68591f03 | ||
|
|
da695b75c4 | ||
|
|
1b4bc7f5ec | ||
|
|
cbfb43f05b | ||
|
|
db9e82cdec | ||
|
|
12889494e0 | ||
|
|
f2d59eb7f8 | ||
|
|
3a3b8e2c4a | ||
|
|
1e132bf29e | ||
|
|
d35330cd55 | ||
|
|
c07c1357e5 | ||
|
|
8071355d68 | ||
|
|
6073e35bfc | ||
|
|
8e8a0e4908 | ||
|
|
1d7176751c | ||
|
|
07e29771a1 | ||
|
|
89ec7122fe | ||
|
|
fe8fea742d | ||
|
|
2ab8bce924 | ||
|
|
90faeb231f | ||
|
|
2885d44593 | ||
|
|
4dfdbdd6aa | ||
|
|
5eb19c1478 | ||
|
|
13a9c41b0c | ||
|
|
2eef2cec49 | ||
|
|
7be87a913d | ||
|
|
dc22f5cbaf | ||
|
|
5c244b4140 | ||
|
|
e7e10ac8b9 | ||
|
|
a308ce2f48 | ||
|
|
eea17a4e32 | ||
|
|
cab187618d | ||
|
|
32e175311b | ||
|
|
190279c117 | ||
|
|
f5aaa58ff9 | ||
|
|
cd37d866c2 | ||
|
|
64020b2902 |
@@ -1,27 +0,0 @@
|
|||||||
image: alpine/latest
|
|
||||||
packages:
|
|
||||||
- build-base
|
|
||||||
- sdl2-dev
|
|
||||||
- freetype-dev
|
|
||||||
- fontconfig-dev
|
|
||||||
- opus-dev
|
|
||||||
sources:
|
|
||||||
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
|
||||||
tasks:
|
|
||||||
- client: |
|
|
||||||
cd xash3d-fwgs
|
|
||||||
./waf configure -8 --enable-tests --enable-engine-tests build install --destdir=bin
|
|
||||||
- server: |
|
|
||||||
cd xash3d-fwgs
|
|
||||||
./waf configure --reconfigure --dedicated build install --destdir=bin
|
|
||||||
- run-tests: |
|
|
||||||
cd xash3d-fwgs/bin
|
|
||||||
export SDL_VIDEODRIVER=wayland
|
|
||||||
./xash3d -runtests
|
|
||||||
./xash -runtests
|
|
||||||
rm -rf valve/gameinfo.txt test_*
|
|
||||||
- package: |
|
|
||||||
cd xash3d-fwgs/bin
|
|
||||||
tar -cjvf xash3d-fwgs-alpine-amd64.tar.bz2 *
|
|
||||||
artifacts:
|
|
||||||
- xash3d-fwgs/bin/xash3d-fwgs-alpine-amd64.tar.bz2
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
image: debian/sid
|
|
||||||
arch: amd64
|
|
||||||
packages:
|
|
||||||
- build-essential
|
|
||||||
- python-is-python3
|
|
||||||
- libsdl2-dev
|
|
||||||
- libfreetype-dev
|
|
||||||
- libfontconfig-dev
|
|
||||||
- libopus-dev
|
|
||||||
sources:
|
|
||||||
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
|
||||||
tasks:
|
|
||||||
- client: |
|
|
||||||
cd xash3d-fwgs
|
|
||||||
./waf configure -8 --enable-tests --enable-engine-tests build install --destdir=bin
|
|
||||||
- server: |
|
|
||||||
cd xash3d-fwgs
|
|
||||||
./waf configure --reconfigure --dedicated build install --destdir=bin
|
|
||||||
- run-tests: |
|
|
||||||
cd xash3d-fwgs/bin
|
|
||||||
export SDL_VIDEODRIVER=wayland
|
|
||||||
./xash3d -runtests
|
|
||||||
./xash -runtests
|
|
||||||
rm -rf valve/gameinfo.txt test_*
|
|
||||||
- package: |
|
|
||||||
cd xash3d-fwgs/bin
|
|
||||||
tar -cjvf xash3d-fwgs-debian-arm64.tar.bz2 *
|
|
||||||
artifacts:
|
|
||||||
- xash3d-fwgs/bin/xash3d-fwgs-debian-arm64.tar.bz2
|
|
||||||
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
image: debian/sid
|
|
||||||
packages:
|
|
||||||
- build-essential
|
|
||||||
- python-is-python3
|
|
||||||
- libsdl2-dev
|
|
||||||
- libfreetype-dev
|
|
||||||
- libfontconfig-dev
|
|
||||||
- libopus-dev
|
|
||||||
sources:
|
|
||||||
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
|
||||||
tasks:
|
|
||||||
- client: |
|
|
||||||
cd xash3d-fwgs
|
|
||||||
./waf configure -8 --enable-tests --enable-engine-tests build install --destdir=bin
|
|
||||||
- server: |
|
|
||||||
cd xash3d-fwgs
|
|
||||||
./waf configure --reconfigure --dedicated build install --destdir=bin
|
|
||||||
- run-tests: |
|
|
||||||
cd xash3d-fwgs/bin
|
|
||||||
export SDL_VIDEODRIVER=wayland
|
|
||||||
./xash3d -runtests
|
|
||||||
./xash -runtests
|
|
||||||
rm -rf valve/gameinfo.txt test_*
|
|
||||||
- package: |
|
|
||||||
cd xash3d-fwgs/bin
|
|
||||||
tar -cjvf xash3d-fwgs-debian-amd64.tar.bz2 *
|
|
||||||
artifacts:
|
|
||||||
- xash3d-fwgs/bin/xash3d-fwgs-debian-amd64.tar.bz2
|
|
||||||
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
image: freebsd/latest
|
|
||||||
packages:
|
|
||||||
- lang/python
|
|
||||||
- devel/pkgconf
|
|
||||||
- devel/sdl20
|
|
||||||
- print/freetype2
|
|
||||||
- x11-fonts/fontconfig
|
|
||||||
- audio/opus
|
|
||||||
sources:
|
|
||||||
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
|
||||||
tasks:
|
|
||||||
- client: |
|
|
||||||
cd xash3d-fwgs
|
|
||||||
./waf configure --enable-tests --enable-engine-tests build install --destdir=bin
|
|
||||||
- server: |
|
|
||||||
cd xash3d-fwgs
|
|
||||||
./waf configure --reconfigure --dedicated build install --destdir=bin
|
|
||||||
- run-tests: |
|
|
||||||
cd xash3d-fwgs/bin
|
|
||||||
export SDL_VIDEODRIVER=wayland
|
|
||||||
./xash3d -runtests
|
|
||||||
./xash -runtests
|
|
||||||
rm -rf valve/gameinfo.txt test_*
|
|
||||||
- package: |
|
|
||||||
cd xash3d-fwgs/bin
|
|
||||||
tar -cjvf xash3d-fwgs-freebsd-amd64.tar.bz2 *
|
|
||||||
artifacts:
|
|
||||||
- xash3d-fwgs/bin/xash3d-fwgs-freebsd-amd64.tar.bz2
|
|
||||||
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
image: netbsd/latest
|
|
||||||
packages:
|
|
||||||
- python311
|
|
||||||
- SDL2
|
|
||||||
- freetype2
|
|
||||||
- fontconfig
|
|
||||||
- libopus
|
|
||||||
- pkgconf
|
|
||||||
sources:
|
|
||||||
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
|
||||||
tasks:
|
|
||||||
- client: |
|
|
||||||
cd xash3d-fwgs
|
|
||||||
python3.11 waf configure --enable-tests --enable-engine-tests build install --destdir=bin
|
|
||||||
- server: |
|
|
||||||
cd xash3d-fwgs
|
|
||||||
python3.11 waf configure --reconfigure --dedicated build install --destdir=bin
|
|
||||||
- run-tests: |
|
|
||||||
cd xash3d-fwgs/bin
|
|
||||||
export SDL_VIDEODRIVER=wayland
|
|
||||||
./xash3d -runtests
|
|
||||||
./xash -runtests
|
|
||||||
rm -rf valve/gameinfo.txt test_*
|
|
||||||
- package: |
|
|
||||||
cd xash3d-fwgs/bin
|
|
||||||
tar -cjvf xash3d-fwgs-netbsd-amd64.tar.bz2 *
|
|
||||||
artifacts:
|
|
||||||
- xash3d-fwgs/bin/xash3d-fwgs-netbsd-amd64.tar.bz2
|
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
image: openbsd/latest
|
|
||||||
packages:
|
|
||||||
- python3
|
|
||||||
- sdl2
|
|
||||||
- opus
|
|
||||||
sources:
|
|
||||||
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
|
||||||
tasks:
|
|
||||||
- client: |
|
|
||||||
cd xash3d-fwgs
|
|
||||||
python3 waf configure --enable-tests --enable-engine-tests build install --destdir=bin
|
|
||||||
- server: |
|
|
||||||
cd xash3d-fwgs
|
|
||||||
python3 waf configure --reconfigure --dedicated build install --destdir=bin
|
|
||||||
- run-tests: |
|
|
||||||
cd xash3d-fwgs/bin
|
|
||||||
export SDL_VIDEODRIVER=wayland
|
|
||||||
./xash3d -runtests
|
|
||||||
./xash -runtests
|
|
||||||
rm -rf valve/gameinfo.txt test_*
|
|
||||||
- package: |
|
|
||||||
cd xash3d-fwgs/bin
|
|
||||||
tar -cjvf xash3d-fwgs-openbsd-amd64.tar.bz2 *
|
|
||||||
artifacts:
|
|
||||||
- xash3d-fwgs/bin/xash3d-fwgs-openbsd-amd64.tar.bz2
|
|
||||||
|
|
||||||
2
3rdparty/gl-wes-v2
vendored
2
3rdparty/gl-wes-v2
vendored
Submodule 3rdparty/gl-wes-v2 updated: 2d9b5afe10...7ba4631bf5
2
3rdparty/gl4es/wscript
vendored
2
3rdparty/gl4es/wscript
vendored
@@ -18,7 +18,7 @@ def build(bld):
|
|||||||
target = 'gl4es',
|
target = 'gl4es',
|
||||||
features = 'c',
|
features = 'c',
|
||||||
includes = ['gl4es/src', 'gl4es/src/gl', 'gl4es/src/glx', 'gl4es/include'],
|
includes = ['gl4es/src', 'gl4es/src/gl', 'gl4es/src/glx', 'gl4es/include'],
|
||||||
defines = ['NOX11', 'NO_GBM', 'NO_INIT_CONSTRUCTOR', 'DEFAULT_ES=2', 'NOEGL', 'NO_LOADER', 'STATICLIB'],
|
defines = ['NOX11', 'NO_GBM', 'NO_INIT_CONSTRUCTOR', 'DEFAULT_ES=2', 'NOEGL', 'EXTERNAL_GETPROCADDRESS=GL4ES_GetProcAddress', 'NO_LOADER', 'STATICLIB'],
|
||||||
cflags = ['-w', '-fvisibility=hidden', '-std=gnu99'],
|
cflags = ['-w', '-fvisibility=hidden', '-std=gnu99'],
|
||||||
subsystem = bld.env.MSVC_SUBSYSTEM,
|
subsystem = bld.env.MSVC_SUBSYSTEM,
|
||||||
export_includes = '.')
|
export_includes = '.')
|
||||||
|
|||||||
2
3rdparty/mainui
vendored
2
3rdparty/mainui
vendored
Submodule 3rdparty/mainui updated: 46d05f9ff5...7223589d60
2
3rdparty/nanogl
vendored
2
3rdparty/nanogl
vendored
Submodule 3rdparty/nanogl updated: 76393a8fde...6b6a947ee0
2
3rdparty/vgui_support
vendored
2
3rdparty/vgui_support
vendored
Submodule 3rdparty/vgui_support updated: a2a7b9073f...f85d64c149
@@ -1,65 +0,0 @@
|
|||||||
# sounds.lst.md
|
|
||||||
|
|
||||||
Using sounds.lst located in scripts folder, modder can override some of the hardcoded sounds in temp entities and server physics.
|
|
||||||
|
|
||||||
File format:
|
|
||||||
```
|
|
||||||
<group name>
|
|
||||||
{
|
|
||||||
<path1>
|
|
||||||
<path2>
|
|
||||||
<path3>
|
|
||||||
}
|
|
||||||
|
|
||||||
<group2 name> <path with %d> <min number> <max number>
|
|
||||||
```
|
|
||||||
|
|
||||||
* Sounds can use any supported sound format (WAV or MP3).
|
|
||||||
* The path must be relative to the sounds/ folder in the game or base directory root, addon folder, or archive root.
|
|
||||||
* Groups can be empty or omitted from the file to load no sound.
|
|
||||||
* Groups can either list a set of files or specify a format string and a range.
|
|
||||||
* Anything after // will be considered a comment and ignored.
|
|
||||||
* Behavior is undefined if the group was listed multiple times.
|
|
||||||
|
|
||||||
Currently supported groups are:
|
|
||||||
|Group name|Usage|
|
|
||||||
|----------|-----|
|
|
||||||
|`BouncePlayerShell`|Used for BOUNCE_SHELL tempentity hitsound|
|
|
||||||
|`BounceWeaponShell`|Used for BOUCNE_SHOTSHELL tempentity hitsound|
|
|
||||||
|`BounceConcrete`|Used for BOUNCE_CONCRETE tempentity hitsound|
|
|
||||||
|`BounceGlass`|Used for BOUCNE_GLASS|
|
|
||||||
|`BounceMetal`|Used for BOUNCE_METAL|
|
|
||||||
|`BounceFlesh`|Used for BOUNCE_FLESH|
|
|
||||||
|`BounceWood`|Used for BOUNCE_WOOD|
|
|
||||||
|`Ricochet`|Used for BOUNCE_SHRAP and ricochet tempentities|
|
|
||||||
|`Explode`|Used for tempentity explosions|
|
|
||||||
|`EntityWaterEnter`|Used for entity entering water|
|
|
||||||
|`EntityWaterExit`|Used for entity exiting water|
|
|
||||||
|`PlayerWaterEnter`|Used for player entering water|
|
|
||||||
|`PlayerWaterExit`|Used for player exiting water|
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
This example is based on defaults sounds used in Half-Life:
|
|
||||||
|
|
||||||
```
|
|
||||||
BouncePlayerShell "player/pl_shell%d.wav" 1 3
|
|
||||||
BounceWeaponShell "weapons/sshell%d.wav" 1 3
|
|
||||||
BounceConcrete "debris/concrete%d.wav" 1 3
|
|
||||||
BounceGlass "debris/glass%d.wav" 1 4
|
|
||||||
BounceMetal "debris/metal%d.wav" 1 6
|
|
||||||
BounceFlesh "debris/flesh%d.wav" 1 7
|
|
||||||
BounceWood "debris/wood%d.wav" 1 4
|
|
||||||
Ricochet "weapons/ric%d.wav" 1 5
|
|
||||||
Explode "weapons/explode%d.wav" 3 5
|
|
||||||
EntityWaterEnter "player/pl_wade%d.wav" 1 4
|
|
||||||
EntityWaterExit "player/pl_wade%d.wav" 1 4
|
|
||||||
PlayerWaterEnter
|
|
||||||
{
|
|
||||||
"player/pl_wade1.wav"
|
|
||||||
}
|
|
||||||
PlayerWaterExit
|
|
||||||
{
|
|
||||||
"player/pl_wade2.wav"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
# Xash3D FWGS on `musl`
|
|
||||||
|
|
||||||
Xash3D FWGS works on `musl` out of the box. However, the engine doesn't try to differentiate glibc and musl anymore. If you see error similar to:
|
|
||||||
|
|
||||||
```
|
|
||||||
Host_InitError: can't initialize cl_dlls/client.so: Error relocating valve/cl_dlls/client.so: __sprintf_chk: symbol not found
|
|
||||||
```
|
|
||||||
|
|
||||||
... or you know that the game you're running is linked against glibc, you can try using `libgcompat`, like this:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ LD_PRELOAD=/lib/libgcompat.so.0 ./xash3d ...
|
|
||||||
```
|
|
||||||
|
|
||||||
It will automatically add the missing symbols that glibc binaries usually need. In the future we might automatically link engine against `libgcompat` for better compatibility with prebuilt or closed-source games, if there will be any use for this.
|
|
||||||
23
README.md
23
README.md
@@ -1,5 +1,5 @@
|
|||||||
# Xash3D FWGS Engine <img align="right" width="128" height="128" src="https://github.com/FWGS/xash3d-fwgs/raw/master/game_launch/icon-xash-material.png" alt="Xash3D FWGS icon" />
|
# Xash3D FWGS Engine <img align="right" width="128" height="128" src="https://github.com/FWGS/xash3d-fwgs/raw/master/game_launch/icon-xash-material.png" alt="Xash3D FWGS icon" />
|
||||||
[](https://builds.sr.ht/~a1batross/xash3d-fwgs?) [](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) [](http://fwgsdiscord.mentality.rip/) \
|
[](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) [](http://fwgsdiscord.mentality.rip/) \
|
||||||
[](https://github.com/FWGS/xash3d-fwgs/releases/latest) [](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous)
|
[](https://github.com/FWGS/xash3d-fwgs/releases/latest) [](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous)
|
||||||
|
|
||||||
Xash3D FWGS is a game engine, aimed to provide compatibility with Half-Life Engine and extend it, as well as to give game developers well known workflow.
|
Xash3D FWGS is a game engine, aimed to provide compatibility with Half-Life Engine and extend it, as well as to give game developers well known workflow.
|
||||||
@@ -73,6 +73,10 @@ This repository contains our fork of HLSDK and restored source code for some of
|
|||||||
* Clone this repostory:
|
* Clone this repostory:
|
||||||
`$ git clone --recursive https://github.com/FWGS/xash3d-fwgs`
|
`$ git clone --recursive https://github.com/FWGS/xash3d-fwgs`
|
||||||
|
|
||||||
|
#### PSP
|
||||||
|
* Build pspsdk(GCC 9.3) from https://github.com/pspdev
|
||||||
|
* Clone this repository: `git clone --recursive https://github.com/Crow-bar/xash3d-fwgs`.
|
||||||
|
|
||||||
### Building
|
### Building
|
||||||
#### Windows (Visual Studio)
|
#### Windows (Visual Studio)
|
||||||
0) Open command line
|
0) Open command line
|
||||||
@@ -90,3 +94,20 @@ If compiling 32-bit on amd64, you may need to supply `export PKG_CONFIG_PATH=/us
|
|||||||
(You need to pass `-8` to compile 64-bit engine on 64-bit x86 processor)
|
(You need to pass `-8` to compile 64-bit engine on 64-bit x86 processor)
|
||||||
2) Compile: `./waf build`
|
2) Compile: `./waf build`
|
||||||
3) Install(optional): `./waf install --destdir=/path/to/any/output/directory`
|
3) Install(optional): `./waf install --destdir=/path/to/any/output/directory`
|
||||||
|
|
||||||
|
#### PSP
|
||||||
|
0) Navigate to `xash3d-fwgs` directory.
|
||||||
|
1) Examine which build options are available: `./waf --help`
|
||||||
|
2) Configure build:
|
||||||
|
Normal: `./waf configure -T fast --psp=prx,660,HW --prefix=/path/to/any/output/directory`
|
||||||
|
Profiling: `./waf configure -T debug --psp=elf,660,HW --enable-profiling --prefix=/path/to/any/output/directory`
|
||||||
|
3) Compile: `./waf build`
|
||||||
|
4) Install(optional): `./waf install`
|
||||||
|
|
||||||
|
|
||||||
|
## Running
|
||||||
|
0) Copy libraries and main executable somewhere, if you're skipped installation stage.
|
||||||
|
1) Copy game files to same directory
|
||||||
|
2) Run `xash3d.exe`/`xash3d.sh`/`xash3d` depending on which platform you're using.
|
||||||
|
|
||||||
|
For additional info, run Xash3D with `-help` command line key.
|
||||||
|
|||||||
@@ -20,16 +20,19 @@ GNU General Public License for more details.
|
|||||||
#define VIDEO_SDL 1
|
#define VIDEO_SDL 1
|
||||||
#define VIDEO_FBDEV 3
|
#define VIDEO_FBDEV 3
|
||||||
#define VIDEO_DOS 4
|
#define VIDEO_DOS 4
|
||||||
|
#define VIDEO_PSP 5
|
||||||
|
|
||||||
// audio backends (XASH_SOUND)
|
// audio backends (XASH_SOUND)
|
||||||
#define SOUND_NULL 0
|
#define SOUND_NULL 0
|
||||||
#define SOUND_SDL 1
|
#define SOUND_SDL 1
|
||||||
#define SOUND_ALSA 3
|
#define SOUND_ALSA 3
|
||||||
|
#define SOUND_PSP 4
|
||||||
|
|
||||||
// input (XASH_INPUT)
|
// input (XASH_INPUT)
|
||||||
#define INPUT_NULL 0
|
#define INPUT_NULL 0
|
||||||
#define INPUT_SDL 1
|
#define INPUT_SDL 1
|
||||||
#define INPUT_EVDEV 3
|
#define INPUT_EVDEV 3
|
||||||
|
#define INPUT_PSP 4
|
||||||
|
|
||||||
// timer (XASH_TIMER)
|
// timer (XASH_TIMER)
|
||||||
#define TIMER_NULL 0 // not used
|
#define TIMER_NULL 0 // not used
|
||||||
@@ -37,17 +40,20 @@ GNU General Public License for more details.
|
|||||||
#define TIMER_POSIX 2
|
#define TIMER_POSIX 2
|
||||||
#define TIMER_WIN32 3
|
#define TIMER_WIN32 3
|
||||||
#define TIMER_DOS 4
|
#define TIMER_DOS 4
|
||||||
|
#define TIMER_PSP 5
|
||||||
|
|
||||||
// messageboxes (XASH_MESSAGEBOX)
|
// messageboxes (XASH_MESSAGEBOX)
|
||||||
#define MSGBOX_STDERR 0
|
#define MSGBOX_STDERR 0
|
||||||
#define MSGBOX_SDL 1
|
#define MSGBOX_SDL 1
|
||||||
#define MSGBOX_WIN32 3
|
#define MSGBOX_WIN32 3
|
||||||
#define MSGBOX_NSWITCH 4
|
#define MSGBOX_NSWITCH 4
|
||||||
|
#define MSGBOX_PSP 5
|
||||||
|
|
||||||
// library loading (XASH_LIB)
|
// library loading (XASH_LIB)
|
||||||
#define LIB_NULL 0
|
#define LIB_NULL 0
|
||||||
#define LIB_POSIX 1
|
#define LIB_POSIX 1
|
||||||
#define LIB_WIN32 2
|
#define LIB_WIN32 2
|
||||||
#define LIB_STATIC 3
|
#define LIB_STATIC 3
|
||||||
|
#define LIB_PSP 4
|
||||||
|
|
||||||
#endif /* BACKENDS_H */
|
#endif /* BACKENDS_H */
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ NOTE: number at end of pixelformat name it's a total bitscount e.g. PF_RGB_24 ==
|
|||||||
|| type == PF_BC7_UNORM \
|
|| type == PF_BC7_UNORM \
|
||||||
|| type == PF_BC7_SRGB \
|
|| type == PF_BC7_SRGB \
|
||||||
|| type == PF_KTX2_RAW )
|
|| type == PF_KTX2_RAW )
|
||||||
|
#define ImageIND( type ) (type == PF_INDEXED_32 || type == PF_INDEXED_24)
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@@ -33,6 +34,10 @@ typedef enum
|
|||||||
PF_BGRA_32, // big endian RGBA (MacOS)
|
PF_BGRA_32, // big endian RGBA (MacOS)
|
||||||
PF_RGB_24, // uncompressed dds or another 24-bit image
|
PF_RGB_24, // uncompressed dds or another 24-bit image
|
||||||
PF_BGR_24, // big-endian RGB (MacOS)
|
PF_BGR_24, // big-endian RGB (MacOS)
|
||||||
|
PF_RGB_332, // 8-bit R3 G3 B2
|
||||||
|
PF_RGB_5650, // 16-bit R5 G6 B5
|
||||||
|
PF_RGBA_5551, // 16-bit R5 G5 B5 A1
|
||||||
|
PF_RGBA_4444, // 16-bit R4 G4 B4 A4
|
||||||
PF_LUMINANCE,
|
PF_LUMINANCE,
|
||||||
PF_DXT1, // s3tc DXT1/BC1 format
|
PF_DXT1, // s3tc DXT1/BC1 format
|
||||||
PF_DXT3, // s3tc DXT3/BC2 format
|
PF_DXT3, // s3tc DXT3/BC2 format
|
||||||
|
|||||||
@@ -127,6 +127,21 @@ typedef struct
|
|||||||
int flags; // sky or slime, no lightmap or 256 subdivision
|
int flags; // sky or slime, no lightmap or 256 subdivision
|
||||||
} mtexinfo_t;
|
} mtexinfo_t;
|
||||||
|
|
||||||
|
#if XASH_PSP
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float uv[2];
|
||||||
|
float xyz[3];
|
||||||
|
}gu_vert_t;
|
||||||
|
typedef struct glpoly_s
|
||||||
|
{
|
||||||
|
struct glpoly_s *next;
|
||||||
|
struct glpoly_s *chain;
|
||||||
|
int numverts;
|
||||||
|
int flags; // for SURF_UNDERWATER
|
||||||
|
gu_vert_t verts[1]; // variable sized (xyz s1t1 + lm(xyz s2t2))
|
||||||
|
} glpoly_t;
|
||||||
|
#else
|
||||||
typedef struct glpoly_s
|
typedef struct glpoly_s
|
||||||
{
|
{
|
||||||
struct glpoly_s *next;
|
struct glpoly_s *next;
|
||||||
@@ -135,7 +150,7 @@ typedef struct glpoly_s
|
|||||||
int flags; // for SURF_UNDERWATER
|
int flags; // for SURF_UNDERWATER
|
||||||
float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
|
float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
|
||||||
} glpoly_t;
|
} glpoly_t;
|
||||||
|
#endif
|
||||||
typedef struct mnode_s
|
typedef struct mnode_s
|
||||||
{
|
{
|
||||||
// common with leaf
|
// common with leaf
|
||||||
|
|||||||
@@ -77,6 +77,30 @@ SETUP BACKENDS DEFINITIONS
|
|||||||
|
|
||||||
// usually only 10-20 fds availiable
|
// usually only 10-20 fds availiable
|
||||||
#define XASH_REDUCE_FD
|
#define XASH_REDUCE_FD
|
||||||
|
#elif XASH_PSP
|
||||||
|
#ifndef XASH_VIDEO
|
||||||
|
#define XASH_VIDEO VIDEO_PSP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef XASH_TIMER
|
||||||
|
#define XASH_TIMER TIMER_PSP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef XASH_INPUT
|
||||||
|
#define XASH_INPUT INPUT_PSP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef XASH_SOUND
|
||||||
|
#define XASH_SOUND SOUND_PSP
|
||||||
|
#endif // XASH_SOUND
|
||||||
|
|
||||||
|
#ifndef XASH_MESSAGEBOX
|
||||||
|
#define XASH_MESSAGEBOX MSGBOX_PSP
|
||||||
|
#endif // XASH_MESSAGEBOX
|
||||||
|
|
||||||
|
#define XASH_REDUCE_FD
|
||||||
|
#define XASH_NO_TOUCH
|
||||||
|
#define XASH_NO_ZIP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // XASH_DEDICATED
|
#endif // XASH_DEDICATED
|
||||||
@@ -105,7 +129,7 @@ SETUP BACKENDS DEFINITIONS
|
|||||||
#endif // !XASH_WIN32
|
#endif // !XASH_WIN32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XASH_STATIC_LIBS
|
#if defined(XASH_STATIC_LIBS) && !XASH_PSP
|
||||||
#define XASH_LIB LIB_STATIC
|
#define XASH_LIB LIB_STATIC
|
||||||
#define XASH_INTERNAL_GAMELIBS
|
#define XASH_INTERNAL_GAMELIBS
|
||||||
#define XASH_ALLOW_SAVERESTORE_OFFSETS
|
#define XASH_ALLOW_SAVERESTORE_OFFSETS
|
||||||
@@ -113,6 +137,8 @@ SETUP BACKENDS DEFINITIONS
|
|||||||
#define XASH_LIB LIB_WIN32
|
#define XASH_LIB LIB_WIN32
|
||||||
#elif XASH_POSIX
|
#elif XASH_POSIX
|
||||||
#define XASH_LIB LIB_POSIX
|
#define XASH_LIB LIB_POSIX
|
||||||
|
#elif XASH_PSP
|
||||||
|
#define XASH_LIB LIB_PSP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -193,4 +219,20 @@ Default build-depended cvar and constant values
|
|||||||
#define DEFAULT_MAX_EDICTS 1200 // was 900 before HL25
|
#define DEFAULT_MAX_EDICTS 1200 // was 900 before HL25
|
||||||
#endif // DEFAULT_MAX_EDICTS
|
#endif // DEFAULT_MAX_EDICTS
|
||||||
|
|
||||||
|
#ifndef DEFAULT_ACCELERATED_RENDERER
|
||||||
|
#ifdef XASH_PSP
|
||||||
|
#define DEFAULT_ACCELERATED_RENDERER "gu"
|
||||||
|
#else
|
||||||
|
#if XASH_MOBILE_PLATFORM
|
||||||
|
#define DEFAULT_ACCELERATED_RENDERER "gles1"
|
||||||
|
#else // !XASH_MOBILE_PLATFORM
|
||||||
|
#define DEFAULT_ACCELERATED_RENDERER "gl"
|
||||||
|
#endif // !XASH_MOBILE_PLATFORM
|
||||||
|
#endif
|
||||||
|
#endif // DEFAULT_ACCELERATED_RENDERER
|
||||||
|
|
||||||
|
#ifndef DEFAULT_SOFTWARE_RENDERER
|
||||||
|
#define DEFAULT_SOFTWARE_RENDERER "soft" // mittorn's ref_soft
|
||||||
|
#endif // DEFAULT_SOFTWARE_RENDERER
|
||||||
|
|
||||||
#endif // DEFAULTS_H
|
#endif // DEFAULTS_H
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ GNU General Public License for more details.
|
|||||||
#include <sys/syslimits.h>
|
#include <sys/syslimits.h>
|
||||||
#define OS_LIB_EXT "dylib"
|
#define OS_LIB_EXT "dylib"
|
||||||
#define OPEN_COMMAND "open"
|
#define OPEN_COMMAND "open"
|
||||||
#else
|
#elif XASH_PSP
|
||||||
|
#define OS_LIB_EXT "prx"
|
||||||
|
#else
|
||||||
#define OS_LIB_EXT "so"
|
#define OS_LIB_EXT "so"
|
||||||
#define OPEN_COMMAND "xdg-open"
|
#define OPEN_COMMAND "xdg-open"
|
||||||
#endif
|
#endif
|
||||||
@@ -35,6 +37,7 @@ GNU General Public License for more details.
|
|||||||
#define __cdecl
|
#define __cdecl
|
||||||
#define __stdcall
|
#define __stdcall
|
||||||
#define _inline static inline
|
#define _inline static inline
|
||||||
|
#define FORCEINLINE inline __attribute__((always_inline))
|
||||||
|
|
||||||
#if XASH_POSIX
|
#if XASH_POSIX
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -54,6 +57,16 @@ GNU General Public License for more details.
|
|||||||
#define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH )
|
#define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if XASH_PSP
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <pspiofilemgr.h>
|
||||||
|
|
||||||
|
#define O_BINARY 0
|
||||||
|
#define O_TEXT 0
|
||||||
|
|
||||||
|
#define _mkdir( x ) sceIoMkdir( x, FIO_S_IRWXU | FIO_S_IRWXG | FIO_S_IROTH | FIO_S_IXOTH )
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void* HANDLE;
|
typedef void* HANDLE;
|
||||||
typedef void* HINSTANCE;
|
typedef void* HINSTANCE;
|
||||||
|
|
||||||
@@ -62,6 +75,13 @@ GNU General Public License for more details.
|
|||||||
int x, y;
|
int x, y;
|
||||||
} POINT;
|
} POINT;
|
||||||
#else // WIN32
|
#else // WIN32
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
#define _inline static inline
|
||||||
|
#define FORCEINLINE inline __attribute__((always_inline))
|
||||||
|
#else
|
||||||
|
#define FORCEINLINE __forceinline
|
||||||
|
#endif
|
||||||
|
|
||||||
#define open _open
|
#define open _open
|
||||||
#define read _read
|
#define read _read
|
||||||
#define alloca _alloca
|
#define alloca _alloca
|
||||||
|
|||||||
@@ -101,14 +101,18 @@ typedef enum
|
|||||||
TF_TEXTURE_3D = (1<<20), // this is GL_TEXTURE_3D
|
TF_TEXTURE_3D = (1<<20), // this is GL_TEXTURE_3D
|
||||||
TF_ATLAS_PAGE = (1<<21), // bit who indicate lightmap page or deluxemap page
|
TF_ATLAS_PAGE = (1<<21), // bit who indicate lightmap page or deluxemap page
|
||||||
TF_ALPHACONTRAST = (1<<22), // special texture mode for A2C
|
TF_ALPHACONTRAST = (1<<22), // special texture mode for A2C
|
||||||
|
#if XASH_PSP
|
||||||
|
TF_IMG_SWIZZLED = (1<<23),
|
||||||
|
TF_IMG_INVRAM = (1<<24),
|
||||||
|
#else
|
||||||
// reserved
|
// reserved
|
||||||
// reserved
|
// reserved
|
||||||
|
#endif
|
||||||
TF_IMG_UPLOADED = (1<<25), // this is set for first time when called glTexImage, otherwise it will be call glTexSubImage
|
TF_IMG_UPLOADED = (1<<25), // this is set for first time when called glTexImage, otherwise it will be call glTexSubImage
|
||||||
TF_ARB_FLOAT = (1<<26), // float textures
|
TF_ARB_FLOAT = (1<<26), // float textures
|
||||||
TF_NOCOMPARE = (1<<27), // disable comparing for depth textures
|
TF_NOCOMPARE = (1<<27), // disable comparing for depth textures
|
||||||
TF_ARB_16BIT = (1<<28), // keep image as 16-bit (not 24)
|
TF_ARB_16BIT = (1<<28), // keep image as 16-bit (not 24)
|
||||||
TF_MULTISAMPLE = (1<<29), // multisampling texture
|
TF_MULTISAMPLE = (1<<29) // multisampling texture
|
||||||
TF_ALLOW_NEAREST = (1<<30), // allows toggling nearest filtering for TF_NOMIPMAP textures
|
|
||||||
} texFlags_t;
|
} texFlags_t;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
|||||||
@@ -21,12 +21,22 @@ typedef int sound_t;
|
|||||||
typedef float vec_t;
|
typedef float vec_t;
|
||||||
typedef vec_t vec2_t[2];
|
typedef vec_t vec2_t[2];
|
||||||
typedef vec_t vec3_t[3];
|
typedef vec_t vec3_t[3];
|
||||||
|
#if XASH_PSP
|
||||||
|
typedef vec_t vec4_t[4] __attribute__( ( aligned( 16 ) ) );
|
||||||
|
typedef vec_t quat_t[4] __attribute__( ( aligned( 16 ) ) );
|
||||||
|
#else
|
||||||
typedef vec_t vec4_t[4];
|
typedef vec_t vec4_t[4];
|
||||||
typedef vec_t quat_t[4];
|
typedef vec_t quat_t[4];
|
||||||
|
#endif
|
||||||
typedef byte rgba_t[4]; // unsigned byte colorpack
|
typedef byte rgba_t[4]; // unsigned byte colorpack
|
||||||
typedef byte rgb_t[3]; // unsigned byte colorpack
|
typedef byte rgb_t[3]; // unsigned byte colorpack
|
||||||
|
#if XASH_PSP
|
||||||
|
typedef vec_t matrix3x4[3][4] __attribute__( ( aligned( 16 ) ) );
|
||||||
|
typedef vec_t matrix4x4[4][4] __attribute__( ( aligned( 16 ) ) );
|
||||||
|
#else
|
||||||
typedef vec_t matrix3x4[3][4];
|
typedef vec_t matrix3x4[3][4];
|
||||||
typedef vec_t matrix4x4[4][4];
|
typedef vec_t matrix4x4[4][4];
|
||||||
|
#endif
|
||||||
|
|
||||||
#if XASH_64BIT
|
#if XASH_64BIT
|
||||||
typedef uint32_t poolhandle_t;
|
typedef uint32_t poolhandle_t;
|
||||||
@@ -86,8 +96,6 @@ typedef uint64_t longtime_t;
|
|||||||
#define NORETURN __attribute__((noreturn))
|
#define NORETURN __attribute__((noreturn))
|
||||||
#define NONNULL __attribute__((nonnull))
|
#define NONNULL __attribute__((nonnull))
|
||||||
#define ALLOC_CHECK(x) __attribute__((alloc_size(x)))
|
#define ALLOC_CHECK(x) __attribute__((alloc_size(x)))
|
||||||
#define FORCEINLINE inline __attribute__((always_inline))
|
|
||||||
#define NOINLINE __attribute__((noinline))
|
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
#define EXPORT __declspec( dllexport )
|
#define EXPORT __declspec( dllexport )
|
||||||
#define GAME_EXPORT
|
#define GAME_EXPORT
|
||||||
@@ -95,8 +103,6 @@ typedef uint64_t longtime_t;
|
|||||||
#define NORETURN
|
#define NORETURN
|
||||||
#define NONNULL
|
#define NONNULL
|
||||||
#define ALLOC_CHECK(x)
|
#define ALLOC_CHECK(x)
|
||||||
#define FORCEINLINE __forceinline
|
|
||||||
#define NOINLINE __declspec( noinline )
|
|
||||||
#else
|
#else
|
||||||
#define EXPORT
|
#define EXPORT
|
||||||
#define GAME_EXPORT
|
#define GAME_EXPORT
|
||||||
@@ -104,8 +110,6 @@ typedef uint64_t longtime_t;
|
|||||||
#define NORETURN
|
#define NORETURN
|
||||||
#define NONNULL
|
#define NONNULL
|
||||||
#define ALLOC_CHECK(x)
|
#define ALLOC_CHECK(x)
|
||||||
#define FORCEINLINE
|
|
||||||
#define NOINLINE
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ( __GNUC__ >= 3 )
|
#if ( __GNUC__ >= 3 )
|
||||||
@@ -200,6 +204,9 @@ typedef void *(*pfnCreateInterface_t)( const char *, int * );
|
|||||||
// config strings are a general means of communication from
|
// config strings are a general means of communication from
|
||||||
// the server to all connected clients.
|
// the server to all connected clients.
|
||||||
// each config string can be at most CS_SIZE characters.
|
// each config string can be at most CS_SIZE characters.
|
||||||
|
#if XASH_PSP
|
||||||
|
#define MAX_QPATH 48
|
||||||
|
#else
|
||||||
#if XASH_LOW_MEMORY == 0
|
#if XASH_LOW_MEMORY == 0
|
||||||
#define MAX_QPATH 64 // max length of a game pathname
|
#define MAX_QPATH 64 // max length of a game pathname
|
||||||
#elif XASH_LOW_MEMORY == 2
|
#elif XASH_LOW_MEMORY == 2
|
||||||
@@ -207,6 +214,7 @@ typedef void *(*pfnCreateInterface_t)( const char *, int * );
|
|||||||
#elif XASH_LOW_MEMORY == 1
|
#elif XASH_LOW_MEMORY == 1
|
||||||
#define MAX_QPATH 48
|
#define MAX_QPATH 48
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#define MAX_OSPATH 260 // max length of a filesystem pathname
|
#define MAX_OSPATH 260 // max length of a filesystem pathname
|
||||||
#define CS_SIZE 64 // size of one config string
|
#define CS_SIZE 64 // size of one config string
|
||||||
#define CS_TIME 16 // size of time string
|
#define CS_TIME 16 // size of time string
|
||||||
|
|||||||
@@ -157,12 +157,32 @@ void CL_PlayCDTrack_f( void )
|
|||||||
CL_ScreenshotGetName
|
CL_ScreenshotGetName
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static qboolean CL_ScreenshotGetName( const char *fmt, int lastnum, char *filename, size_t size )
|
static qboolean CL_ScreenshotGetName( int lastnum, char *filename, size_t size )
|
||||||
{
|
{
|
||||||
if( lastnum < 0 || lastnum > 9999 )
|
if( lastnum < 0 || lastnum > 9999 )
|
||||||
|
{
|
||||||
|
Con_Printf( S_ERROR "unable to write screenshot\n" );
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return Q_snprintf( filename, size, fmt, clgame.mapname, lastnum ) > 0;
|
return Q_snprintf( filename, size, "scrshots/%s_shot%04d.png", clgame.mapname, lastnum ) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==================
|
||||||
|
CL_SnapshotGetName
|
||||||
|
==================
|
||||||
|
*/
|
||||||
|
static qboolean CL_SnapshotGetName( int lastnum, char *filename, size_t size )
|
||||||
|
{
|
||||||
|
if( lastnum < 0 || lastnum > 9999 )
|
||||||
|
{
|
||||||
|
Con_Printf( S_ERROR "unable to write snapshot\n" );
|
||||||
|
FS_AllowDirectPaths( false );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Q_snprintf( filename, size, "../%s_%04d.png", clgame.mapname, lastnum ) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -172,6 +192,127 @@ static qboolean CL_ScreenshotGetName( const char *fmt, int lastnum, char *filena
|
|||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
|
==================
|
||||||
|
CL_ScreenShot_f
|
||||||
|
|
||||||
|
normal screenshot
|
||||||
|
==================
|
||||||
|
*/
|
||||||
|
void CL_ScreenShot_f( void )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
string checkname;
|
||||||
|
|
||||||
|
if( CL_IsDevOverviewMode() == 1 )
|
||||||
|
{
|
||||||
|
// special case for write overview image and script file
|
||||||
|
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "overviews/%s.bmp", clgame.mapname );
|
||||||
|
cls.scrshot_action = scrshot_mapshot; // build new frame for mapshot
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// scan for a free filename
|
||||||
|
for( i = 0; i < 9999; i++ )
|
||||||
|
{
|
||||||
|
if( !CL_ScreenshotGetName( i, checkname, sizeof( checkname )))
|
||||||
|
return; // no namespace
|
||||||
|
|
||||||
|
if( !FS_FileExists( checkname, true ))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_strncpy( cls.shotname, checkname, sizeof( cls.shotname ));
|
||||||
|
cls.scrshot_action = scrshot_normal; // build new frame for screenshot
|
||||||
|
}
|
||||||
|
|
||||||
|
cls.envshot_vieworg = NULL; // no custom view
|
||||||
|
cls.envshot_viewsize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==================
|
||||||
|
CL_SnapShot_f
|
||||||
|
|
||||||
|
save screenshots into root dir
|
||||||
|
==================
|
||||||
|
*/
|
||||||
|
void CL_SnapShot_f( void )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
string checkname;
|
||||||
|
|
||||||
|
if( CL_IsDevOverviewMode() == 1 )
|
||||||
|
{
|
||||||
|
// special case for write overview image and script file
|
||||||
|
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "overviews/%s.bmp", clgame.mapname );
|
||||||
|
cls.scrshot_action = scrshot_mapshot; // build new frame for mapshot
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FS_AllowDirectPaths( true );
|
||||||
|
|
||||||
|
// scan for a free filename
|
||||||
|
for( i = 0; i < 9999; i++ )
|
||||||
|
{
|
||||||
|
if( !CL_SnapshotGetName( i, checkname, sizeof( checkname )))
|
||||||
|
return; // no namespace
|
||||||
|
|
||||||
|
if( !FS_FileExists( checkname, true ))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
FS_AllowDirectPaths( false );
|
||||||
|
Q_strncpy( cls.shotname, checkname, sizeof( cls.shotname ));
|
||||||
|
cls.scrshot_action = scrshot_snapshot; // build new frame for screenshot
|
||||||
|
}
|
||||||
|
|
||||||
|
cls.envshot_vieworg = NULL; // no custom view
|
||||||
|
cls.envshot_viewsize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==================
|
||||||
|
CL_EnvShot_f
|
||||||
|
|
||||||
|
cubemap view
|
||||||
|
==================
|
||||||
|
*/
|
||||||
|
void CL_EnvShot_f( void )
|
||||||
|
{
|
||||||
|
if( Cmd_Argc() < 2 )
|
||||||
|
{
|
||||||
|
Con_Printf( S_USAGE "envshot <shotname>\n" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "gfx/env/%s", Cmd_Argv( 1 ));
|
||||||
|
cls.scrshot_action = scrshot_envshot; // build new frame for envshot
|
||||||
|
cls.envshot_vieworg = NULL; // no custom view
|
||||||
|
cls.envshot_viewsize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==================
|
||||||
|
CL_SkyShot_f
|
||||||
|
|
||||||
|
skybox view
|
||||||
|
==================
|
||||||
|
*/
|
||||||
|
void CL_SkyShot_f( void )
|
||||||
|
{
|
||||||
|
if( Cmd_Argc() < 2 )
|
||||||
|
{
|
||||||
|
Con_Printf( S_USAGE "skyshot <shotname>\n" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_snprintf( cls.shotname, sizeof( cls.shotname ),"gfx/env/%s", Cmd_Argv( 1 ));
|
||||||
|
cls.scrshot_action = scrshot_skyshot; // build new frame for skyshot
|
||||||
|
cls.envshot_vieworg = NULL; // no custom view
|
||||||
|
cls.envshot_viewsize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==================
|
==================
|
||||||
CL_LevelShot_f
|
CL_LevelShot_f
|
||||||
@@ -214,100 +355,23 @@ void CL_LevelShot_f( void )
|
|||||||
else cls.scrshot_action = scrshot_inactive; // disable - not needs
|
else cls.scrshot_action = scrshot_inactive; // disable - not needs
|
||||||
}
|
}
|
||||||
|
|
||||||
static scrshot_t CL_GetScreenshotTypeFromString( const char *string )
|
/*
|
||||||
|
==================
|
||||||
|
CL_SaveShot_f
|
||||||
|
|
||||||
|
mini-pic in loadgame menu
|
||||||
|
==================
|
||||||
|
*/
|
||||||
|
void CL_SaveShot_f( void )
|
||||||
{
|
{
|
||||||
if( !Q_stricmp( string, "snapshot" ))
|
if( Cmd_Argc() < 2 )
|
||||||
return scrshot_snapshot;
|
|
||||||
|
|
||||||
if( !Q_stricmp( string, "screenshot" ))
|
|
||||||
return scrshot_normal;
|
|
||||||
|
|
||||||
if( !Q_stricmp( string, "saveshot" ))
|
|
||||||
return scrshot_savegame;
|
|
||||||
|
|
||||||
if( !Q_stricmp( string, "envshot" ))
|
|
||||||
return scrshot_envshot;
|
|
||||||
|
|
||||||
if( !Q_stricmp( string, "skyshot" ))
|
|
||||||
return scrshot_skyshot;
|
|
||||||
|
|
||||||
return scrshot_inactive;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CL_GenericShot_f( void )
|
|
||||||
{
|
|
||||||
const char *argv0 = Cmd_Argv( 0 );
|
|
||||||
scrshot_t type;
|
|
||||||
|
|
||||||
type = CL_GetScreenshotTypeFromString( argv0 );
|
|
||||||
|
|
||||||
if( type == scrshot_normal || type == scrshot_snapshot )
|
|
||||||
{
|
{
|
||||||
if( CL_IsDevOverviewMode() == 1 )
|
Con_Printf( S_USAGE "saveshot <savename>\n" );
|
||||||
type = scrshot_mapshot;
|
return;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( Cmd_Argc() < 2 )
|
|
||||||
{
|
|
||||||
Con_Printf( S_USAGE "%s <shotname>\n", argv0 );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( type )
|
Q_snprintf( cls.shotname, sizeof( cls.shotname ), DEFAULT_SAVE_DIRECTORY "%s.bmp", Cmd_Argv( 1 ));
|
||||||
{
|
cls.scrshot_action = scrshot_savegame; // build new frame for saveshot
|
||||||
case scrshot_envshot:
|
|
||||||
case scrshot_skyshot:
|
|
||||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "gfx/env/%s", Cmd_Argv( 1 ));
|
|
||||||
break;
|
|
||||||
case scrshot_savegame:
|
|
||||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), DEFAULT_SAVE_DIRECTORY "%s.bmp", Cmd_Argv( 1 ));
|
|
||||||
break;
|
|
||||||
case scrshot_mapshot:
|
|
||||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "overviews/%s.bmp", clgame.mapname );
|
|
||||||
break;
|
|
||||||
case scrshot_normal:
|
|
||||||
case scrshot_snapshot:
|
|
||||||
{
|
|
||||||
const char *fmt;
|
|
||||||
string checkname;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if( type == scrshot_snapshot )
|
|
||||||
{
|
|
||||||
fmt = "../%s_%04d.png";
|
|
||||||
FS_AllowDirectPaths( true );
|
|
||||||
}
|
|
||||||
else fmt = "scrshots/%s_shot%04d.png";
|
|
||||||
|
|
||||||
for( i = 0; i < 9999; i++ )
|
|
||||||
{
|
|
||||||
if( !CL_ScreenshotGetName( fmt, i, checkname, sizeof( checkname )))
|
|
||||||
{
|
|
||||||
Con_Printf( S_ERROR "unable to write %s\n", argv0 );
|
|
||||||
FS_AllowDirectPaths( false );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !FS_FileExists( checkname, true ))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
FS_AllowDirectPaths( false );
|
|
||||||
|
|
||||||
Q_strncpy( cls.shotname, checkname, sizeof( cls.shotname ));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case scrshot_inactive:
|
|
||||||
case scrshot_plaque:
|
|
||||||
default:
|
|
||||||
return; // shouldn't happen
|
|
||||||
}
|
|
||||||
|
|
||||||
cls.scrshot_action = type; // build new frame for saveshot
|
|
||||||
cls.envshot_vieworg = NULL;
|
|
||||||
cls.envshot_viewsize = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ void CL_MoveToOnHandList( resource_t *pResource )
|
|||||||
CL_AddToResourceList( pResource, &cl.resourcesonhand );
|
CL_AddToResourceList( pResource, &cl.resourcesonhand );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CL_ClearResourceList( resource_t *pList )
|
void CL_ClearResourceList( resource_t *pList )
|
||||||
{
|
{
|
||||||
resource_t *p, *n;
|
resource_t *p, *n;
|
||||||
|
|
||||||
|
|||||||
@@ -107,8 +107,6 @@ struct
|
|||||||
int angle_position;
|
int angle_position;
|
||||||
} demo;
|
} demo;
|
||||||
|
|
||||||
static qboolean CL_NextDemo( void );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
CL_StartupDemoHeader
|
CL_StartupDemoHeader
|
||||||
@@ -158,7 +156,7 @@ CL_GetDemoRecordClock
|
|||||||
write time while demo is recording
|
write time while demo is recording
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static float CL_GetDemoRecordClock( void )
|
float CL_GetDemoRecordClock( void )
|
||||||
{
|
{
|
||||||
return cl.mtime[0];
|
return cl.mtime[0];
|
||||||
}
|
}
|
||||||
@@ -170,7 +168,7 @@ CL_GetDemoPlaybackClock
|
|||||||
overwrite host.realtime
|
overwrite host.realtime
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static float CL_GetDemoPlaybackClock( void )
|
float CL_GetDemoPlaybackClock( void )
|
||||||
{
|
{
|
||||||
return host.realtime + host.frametime;
|
return host.realtime + host.frametime;
|
||||||
}
|
}
|
||||||
@@ -196,7 +194,7 @@ CL_WriteDemoCmdHeader
|
|||||||
Writes the demo command header and time-delta
|
Writes the demo command header and time-delta
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static void CL_WriteDemoCmdHeader( byte cmd, file_t *file )
|
void CL_WriteDemoCmdHeader( byte cmd, file_t *file )
|
||||||
{
|
{
|
||||||
float dt;
|
float dt;
|
||||||
|
|
||||||
@@ -269,7 +267,7 @@ Save state of cls.netchan sequences
|
|||||||
so that we can play the demo correctly.
|
so that we can play the demo correctly.
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static void CL_WriteDemoSequence( file_t *file )
|
void CL_WriteDemoSequence( file_t *file )
|
||||||
{
|
{
|
||||||
Assert( file != NULL );
|
Assert( file != NULL );
|
||||||
|
|
||||||
@@ -350,7 +348,7 @@ CL_WriteDemoHeader
|
|||||||
Write demo header
|
Write demo header
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static void CL_WriteDemoHeader( const char *name )
|
void CL_WriteDemoHeader( const char *name )
|
||||||
{
|
{
|
||||||
int copysize;
|
int copysize;
|
||||||
int savepos;
|
int savepos;
|
||||||
@@ -438,7 +436,7 @@ CL_StopRecord
|
|||||||
finish recording demo
|
finish recording demo
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_StopRecord( void )
|
void CL_StopRecord( void )
|
||||||
{
|
{
|
||||||
int i, curpos;
|
int i, curpos;
|
||||||
float stoptime;
|
float stoptime;
|
||||||
@@ -520,7 +518,7 @@ CL_ReadDemoCmdHeader
|
|||||||
read the demo command
|
read the demo command
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static qboolean CL_ReadDemoCmdHeader( byte *cmd, float *dt )
|
qboolean CL_ReadDemoCmdHeader( byte *cmd, float *dt )
|
||||||
{
|
{
|
||||||
// read the command
|
// read the command
|
||||||
// HACKHACK: skip NOPs
|
// HACKHACK: skip NOPs
|
||||||
@@ -550,7 +548,7 @@ read the demo usercmd for predicting
|
|||||||
and smooth movement during playback the demo
|
and smooth movement during playback the demo
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_ReadDemoUserCmd( qboolean discard )
|
void CL_ReadDemoUserCmd( qboolean discard )
|
||||||
{
|
{
|
||||||
byte data[1024];
|
byte data[1024];
|
||||||
int cmdnumber;
|
int cmdnumber;
|
||||||
@@ -615,7 +613,7 @@ CL_ReadDemoSequence
|
|||||||
read netchan sequences
|
read netchan sequences
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_ReadDemoSequence( qboolean discard )
|
void CL_ReadDemoSequence( qboolean discard )
|
||||||
{
|
{
|
||||||
int incoming_sequence;
|
int incoming_sequence;
|
||||||
int incoming_acknowledged;
|
int incoming_acknowledged;
|
||||||
@@ -649,7 +647,7 @@ static void CL_ReadDemoSequence( qboolean discard )
|
|||||||
CL_DemoStartPlayback
|
CL_DemoStartPlayback
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_DemoStartPlayback( int mode )
|
void CL_DemoStartPlayback( int mode )
|
||||||
{
|
{
|
||||||
if( cls.changedemo )
|
if( cls.changedemo )
|
||||||
{
|
{
|
||||||
@@ -694,7 +692,7 @@ static void CL_DemoStartPlayback( int mode )
|
|||||||
CL_DemoAborted
|
CL_DemoAborted
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_DemoAborted( void )
|
void CL_DemoAborted( void )
|
||||||
{
|
{
|
||||||
if( cls.demofile )
|
if( cls.demofile )
|
||||||
FS_Close( cls.demofile );
|
FS_Close( cls.demofile );
|
||||||
@@ -734,7 +732,7 @@ returns true on success, false on failure
|
|||||||
g-cont. probably captain obvious mode is ON
|
g-cont. probably captain obvious mode is ON
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static qboolean CL_DemoMoveToNextSection( void )
|
qboolean CL_DemoMoveToNextSection( void )
|
||||||
{
|
{
|
||||||
if( ++demo.entryIndex >= demo.directory.numentries )
|
if( ++demo.entryIndex >= demo.directory.numentries )
|
||||||
{
|
{
|
||||||
@@ -756,7 +754,7 @@ static qboolean CL_DemoMoveToNextSection( void )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static qboolean CL_ReadRawNetworkData( byte *buffer, size_t *length )
|
qboolean CL_ReadRawNetworkData( byte *buffer, size_t *length )
|
||||||
{
|
{
|
||||||
int msglen = 0;
|
int msglen = 0;
|
||||||
|
|
||||||
@@ -807,7 +805,7 @@ CL_DemoReadMessageQuake
|
|||||||
reads demo data and write it to client
|
reads demo data and write it to client
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static qboolean CL_DemoReadMessageQuake( byte *buffer, size_t *length )
|
qboolean CL_DemoReadMessageQuake( byte *buffer, size_t *length )
|
||||||
{
|
{
|
||||||
vec3_t viewangles;
|
vec3_t viewangles;
|
||||||
int msglen = 0;
|
int msglen = 0;
|
||||||
@@ -1022,7 +1020,7 @@ qboolean CL_DemoReadMessage( byte *buffer, size_t *length )
|
|||||||
return CL_ReadRawNetworkData( buffer, length );
|
return CL_ReadRawNetworkData( buffer, length );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CL_DemoFindInterpolatedViewAngles( float t, float *frac, demoangle_t **prev, demoangle_t **next )
|
void CL_DemoFindInterpolatedViewAngles( float t, float *frac, demoangle_t **prev, demoangle_t **next )
|
||||||
{
|
{
|
||||||
int i, i0, i1, imod;
|
int i, i0, i1, imod;
|
||||||
float at;
|
float at;
|
||||||
@@ -1117,7 +1115,7 @@ CL_FinishTimeDemo
|
|||||||
show stats
|
show stats
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static void CL_FinishTimeDemo( void )
|
void CL_FinishTimeDemo( void )
|
||||||
{
|
{
|
||||||
int frames;
|
int frames;
|
||||||
double time;
|
double time;
|
||||||
@@ -1266,7 +1264,7 @@ CL_NextDemo
|
|||||||
Called when a demo finishes
|
Called when a demo finishes
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static qboolean CL_NextDemo( void )
|
qboolean CL_NextDemo( void )
|
||||||
{
|
{
|
||||||
char str[MAX_QPATH];
|
char str[MAX_QPATH];
|
||||||
|
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ R_AllocTracer
|
|||||||
can return NULL if particles is out
|
can return NULL if particles is out
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static particle_t *R_AllocTracer( const vec3_t org, const vec3_t vel, float life )
|
particle_t *R_AllocTracer( const vec3_t org, const vec3_t vel, float life )
|
||||||
{
|
{
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
|
|
||||||
@@ -300,7 +300,7 @@ R_BeamAlloc
|
|||||||
|
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static BEAM *R_BeamAlloc( void )
|
BEAM *R_BeamAlloc( void )
|
||||||
{
|
{
|
||||||
BEAM *pBeam;
|
BEAM *pBeam;
|
||||||
|
|
||||||
@@ -323,7 +323,7 @@ R_BeamFree
|
|||||||
|
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static void R_BeamFree( BEAM *pBeam )
|
void R_BeamFree( BEAM *pBeam )
|
||||||
{
|
{
|
||||||
// free particles that have died off.
|
// free particles that have died off.
|
||||||
R_FreeDeadParticles( &pBeam->particles );
|
R_FreeDeadParticles( &pBeam->particles );
|
||||||
@@ -605,7 +605,7 @@ CL_BeamAttemptToDie
|
|||||||
Check for expired beams
|
Check for expired beams
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static qboolean CL_BeamAttemptToDie( BEAM *pBeam )
|
qboolean CL_BeamAttemptToDie( BEAM *pBeam )
|
||||||
{
|
{
|
||||||
Assert( pBeam != NULL );
|
Assert( pBeam != NULL );
|
||||||
|
|
||||||
@@ -2040,7 +2040,7 @@ void CL_ReadPointFile_f( void )
|
|||||||
else Con_Printf( "map %s has no leaks!\n", clgame.mapname );
|
else Con_Printf( "map %s has no leaks!\n", clgame.mapname );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CL_FreeDeadBeams( void )
|
void CL_FreeDeadBeams( void )
|
||||||
{
|
{
|
||||||
BEAM *pBeam, *pNext, *pPrev = NULL;
|
BEAM *pBeam, *pNext, *pPrev = NULL;
|
||||||
// draw temporary entity beams
|
// draw temporary entity beams
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ CL_CalcPlayerVelocity
|
|||||||
compute velocity for a given client
|
compute velocity for a given client
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void CL_CalcPlayerVelocity( int idx, vec3_t velocity )
|
void CL_CalcPlayerVelocity( int idx, vec3_t velocity )
|
||||||
{
|
{
|
||||||
clientdata_t *pcd;
|
clientdata_t *pcd;
|
||||||
vec3_t delta;
|
vec3_t delta;
|
||||||
@@ -78,7 +78,7 @@ CL_DescribeEvent
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void CL_DescribeEvent( event_info_t *ei, int slot )
|
void CL_DescribeEvent( event_info_t *ei, int slot )
|
||||||
{
|
{
|
||||||
int idx = (slot & 63) * 2;
|
int idx = (slot & 63) * 2;
|
||||||
con_nprint_t info;
|
con_nprint_t info;
|
||||||
@@ -202,7 +202,7 @@ CL_FireEvent
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static qboolean CL_FireEvent( event_info_t *ei, int slot )
|
qboolean CL_FireEvent( event_info_t *ei, int slot )
|
||||||
{
|
{
|
||||||
cl_user_event_t *ev;
|
cl_user_event_t *ev;
|
||||||
const char *name;
|
const char *name;
|
||||||
@@ -292,7 +292,7 @@ CL_FindEvent
|
|||||||
find first empty event
|
find first empty event
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static event_info_t *CL_FindEmptyEvent( void )
|
event_info_t *CL_FindEmptyEvent( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
event_state_t *es;
|
event_state_t *es;
|
||||||
@@ -320,7 +320,7 @@ CL_FindEvent
|
|||||||
replace only unreliable events
|
replace only unreliable events
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static event_info_t *CL_FindUnreliableEvent( void )
|
event_info_t *CL_FindUnreliableEvent( void )
|
||||||
{
|
{
|
||||||
event_state_t *es;
|
event_state_t *es;
|
||||||
event_info_t *ei;
|
event_info_t *ei;
|
||||||
@@ -350,7 +350,7 @@ CL_QueueEvent
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void CL_QueueEvent( int flags, int index, float delay, event_args_t *args )
|
void CL_QueueEvent( int flags, int index, float delay, event_args_t *args )
|
||||||
{
|
{
|
||||||
event_info_t *ei;
|
event_info_t *ei;
|
||||||
|
|
||||||
|
|||||||
@@ -46,35 +46,10 @@ static int CL_LoadFontTexture( const char *fontname, uint texFlags, int *width )
|
|||||||
return tex;
|
return tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int CL_FontRenderMode( convar_t *fontrender )
|
qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float scale, int rendermode, uint texFlags )
|
||||||
{
|
|
||||||
switch((int)fontrender->value )
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
return kRenderTransAdd;
|
|
||||||
case 1:
|
|
||||||
return kRenderTransAlpha;
|
|
||||||
case 2:
|
|
||||||
return kRenderTransTexture;
|
|
||||||
default:
|
|
||||||
Cvar_DirectSet( fontrender, fontrender->def_string );
|
|
||||||
}
|
|
||||||
|
|
||||||
return kRenderTransTexture;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CL_SetFontRendermode( cl_font_t *font )
|
|
||||||
{
|
|
||||||
ref.dllFuncs.GL_SetRenderMode( CL_FontRenderMode( font->rendermode ));
|
|
||||||
}
|
|
||||||
|
|
||||||
qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags )
|
|
||||||
{
|
{
|
||||||
int font_width, i;
|
int font_width, i;
|
||||||
|
|
||||||
if( !rendermode )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( font->valid )
|
if( font->valid )
|
||||||
return true; // already loaded
|
return true; // already loaded
|
||||||
|
|
||||||
@@ -85,6 +60,7 @@ qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float sc
|
|||||||
font->type = FONT_FIXED;
|
font->type = FONT_FIXED;
|
||||||
font->valid = true;
|
font->valid = true;
|
||||||
font->scale = scale;
|
font->scale = scale;
|
||||||
|
font->nearest = FBitSet( texFlags, TF_NEAREST );
|
||||||
font->rendermode = rendermode;
|
font->rendermode = rendermode;
|
||||||
font->charHeight = Q_rint( font_width / 16 * scale );
|
font->charHeight = Q_rint( font_width / 16 * scale );
|
||||||
|
|
||||||
@@ -101,16 +77,13 @@ qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float sc
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags )
|
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, int rendermode, uint texFlags )
|
||||||
{
|
{
|
||||||
fs_offset_t length;
|
fs_offset_t length;
|
||||||
qfont_t src;
|
qfont_t src;
|
||||||
byte *pfile;
|
byte *pfile;
|
||||||
int font_width, i;
|
int font_width, i;
|
||||||
|
|
||||||
if( !rendermode )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( font->valid )
|
if( font->valid )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -133,7 +106,8 @@ qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float
|
|||||||
|
|
||||||
font->type = FONT_VARIABLE;
|
font->type = FONT_VARIABLE;
|
||||||
font->valid = true;
|
font->valid = true;
|
||||||
font->scale = scale ? scale : 1.0f;
|
font->scale = scale;
|
||||||
|
font->nearest = FBitSet( texFlags, TF_NEAREST );
|
||||||
font->rendermode = rendermode;
|
font->rendermode = rendermode;
|
||||||
font->charHeight = Q_rint( src.rowheight * scale );
|
font->charHeight = Q_rint( src.rowheight * scale );
|
||||||
|
|
||||||
@@ -205,8 +179,7 @@ int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *fon
|
|||||||
return font->charWidths[number];
|
return font->charWidths[number];
|
||||||
|
|
||||||
rc = &font->fontRc[number];
|
rc = &font->fontRc[number];
|
||||||
|
if( font->nearest || font->scale <= 1.0f )
|
||||||
if( font->scale <= 1.f || !REF_GET_PARM( PARM_TEX_FILTERING, font->hFontTexture ))
|
|
||||||
half = 0;
|
half = 0;
|
||||||
|
|
||||||
s1 = ((float)rc->left + half ) / texw;
|
s1 = ((float)rc->left + half ) / texw;
|
||||||
@@ -220,7 +193,7 @@ int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *fon
|
|||||||
SPR_AdjustSize( &x, &y, &w, &h );
|
SPR_AdjustSize( &x, &y, &w, &h );
|
||||||
|
|
||||||
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
||||||
CL_SetFontRendermode( font );
|
ref.dllFuncs.GL_SetRenderMode( font->rendermode );
|
||||||
|
|
||||||
// don't apply color to fixed fonts it's already colored
|
// don't apply color to fixed fonts it's already colored
|
||||||
if( font->type != FONT_FIXED || REF_GET_PARM( PARM_TEX_GLFORMAT, font->hFontTexture ) == 0x8045 ) // GL_LUMINANCE8_ALPHA8
|
if( font->type != FONT_FIXED || REF_GET_PARM( PARM_TEX_GLFORMAT, font->hFontTexture ) == 0x8045 ) // GL_LUMINANCE8_ALPHA8
|
||||||
@@ -243,7 +216,7 @@ int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *fon
|
|||||||
Con_UtfProcessChar( 0 ); // clear utf state
|
Con_UtfProcessChar( 0 ); // clear utf state
|
||||||
|
|
||||||
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
||||||
CL_SetFontRendermode( font );
|
ref.dllFuncs.GL_SetRenderMode( font->rendermode );
|
||||||
|
|
||||||
Vector4Copy( color, current_color );
|
Vector4Copy( color, current_color );
|
||||||
|
|
||||||
|
|||||||
@@ -26,18 +26,6 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
// #define STUDIO_INTERPOLATION_FIX
|
// #define STUDIO_INTERPOLATION_FIX
|
||||||
|
|
||||||
/*
|
|
||||||
==================
|
|
||||||
CL_IsPlayerIndex
|
|
||||||
|
|
||||||
detect player entity
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
qboolean CL_IsPlayerIndex( int idx )
|
|
||||||
{
|
|
||||||
return ( idx >= 1 && idx <= cl.maxclients );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=========================================================================
|
=========================================================================
|
||||||
|
|
||||||
@@ -52,7 +40,7 @@ CL_UpdatePositions
|
|||||||
Store another position into interpolation circular buffer
|
Store another position into interpolation circular buffer
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void CL_UpdatePositions( cl_entity_t *ent )
|
void CL_UpdatePositions( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
position_history_t *ph, *prev;
|
position_history_t *ph, *prev;
|
||||||
|
|
||||||
@@ -85,7 +73,7 @@ CL_ResetPositions
|
|||||||
Interpolation init or reset after teleporting
|
Interpolation init or reset after teleporting
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void CL_ResetPositions( cl_entity_t *ent )
|
void CL_ResetPositions( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
position_history_t store;
|
position_history_t store;
|
||||||
|
|
||||||
@@ -107,7 +95,7 @@ check for instant movement in case
|
|||||||
we don't want interpolate this
|
we don't want interpolate this
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static qboolean CL_EntityTeleported( cl_entity_t *ent )
|
qboolean CL_EntityTeleported( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
float len, maxlen;
|
float len, maxlen;
|
||||||
vec3_t delta;
|
vec3_t delta;
|
||||||
@@ -128,7 +116,7 @@ CL_CompareTimestamps
|
|||||||
round-off floating errors
|
round-off floating errors
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static qboolean CL_CompareTimestamps( float t1, float t2 )
|
qboolean CL_CompareTimestamps( float t1, float t2 )
|
||||||
{
|
{
|
||||||
int iTime1 = t1 * 1000;
|
int iTime1 = t1 * 1000;
|
||||||
int iTime2 = t2 * 1000;
|
int iTime2 = t2 * 1000;
|
||||||
@@ -143,7 +131,7 @@ CL_EntityIgnoreLerp
|
|||||||
some ents will be ignore lerping
|
some ents will be ignore lerping
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static qboolean CL_EntityIgnoreLerp( cl_entity_t *e )
|
qboolean CL_EntityIgnoreLerp( cl_entity_t *e )
|
||||||
{
|
{
|
||||||
if( cl_nointerp.value > 0.f )
|
if( cl_nointerp.value > 0.f )
|
||||||
return true;
|
return true;
|
||||||
@@ -160,7 +148,7 @@ CL_EntityCustomLerp
|
|||||||
|
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static qboolean CL_EntityCustomLerp( cl_entity_t *e )
|
qboolean CL_EntityCustomLerp( cl_entity_t *e )
|
||||||
{
|
{
|
||||||
switch( e->curstate.movetype )
|
switch( e->curstate.movetype )
|
||||||
{
|
{
|
||||||
@@ -226,7 +214,7 @@ CL_UpdateLatchedVars
|
|||||||
|
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static void CL_UpdateLatchedVars( cl_entity_t *ent )
|
void CL_UpdateLatchedVars( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
if( !ent->model || ( ent->model->type != mod_alias && ent->model->type != mod_studio ))
|
if( !ent->model || ( ent->model->type != mod_alias && ent->model->type != mod_studio ))
|
||||||
return; // below fields used only for alias and studio interpolation
|
return; // below fields used only for alias and studio interpolation
|
||||||
@@ -321,7 +309,7 @@ CL_ProcessEntityUpdate
|
|||||||
apply changes since new frame received
|
apply changes since new frame received
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void CL_ProcessEntityUpdate( cl_entity_t *ent )
|
void CL_ProcessEntityUpdate( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
qboolean parametric;
|
qboolean parametric;
|
||||||
|
|
||||||
@@ -585,7 +573,7 @@ CL_ProcessPlayerState
|
|||||||
process player states after the new packet has received
|
process player states after the new packet has received
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_ProcessPlayerState( int playerindex, entity_state_t *state )
|
void CL_ProcessPlayerState( int playerindex, entity_state_t *state )
|
||||||
{
|
{
|
||||||
entity_state_t *ps;
|
entity_state_t *ps;
|
||||||
|
|
||||||
@@ -605,7 +593,7 @@ reset latched state if this frame entity was teleported
|
|||||||
or just EF_NOINTERP was set
|
or just EF_NOINTERP was set
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_ResetLatchedState( int pnum, frame_t *frame, cl_entity_t *ent )
|
void CL_ResetLatchedState( int pnum, frame_t *frame, cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
if( CHECKVISBIT( frame->flags, pnum ))
|
if( CHECKVISBIT( frame->flags, pnum ))
|
||||||
{
|
{
|
||||||
@@ -695,7 +683,7 @@ CL_FlushEntityPacket
|
|||||||
Read and ignore whole entity packet.
|
Read and ignore whole entity packet.
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_FlushEntityPacket( sizebuf_t *msg )
|
void CL_FlushEntityPacket( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int newnum;
|
int newnum;
|
||||||
entity_state_t from, to;
|
entity_state_t from, to;
|
||||||
@@ -725,7 +713,7 @@ CL_DeltaEntity
|
|||||||
processing delta update
|
processing delta update
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t *old, qboolean has_update )
|
void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t *old, qboolean has_update )
|
||||||
{
|
{
|
||||||
cl_entity_t *ent;
|
cl_entity_t *ent;
|
||||||
entity_state_t *state;
|
entity_state_t *state;
|
||||||
@@ -1057,7 +1045,7 @@ CL_LinkCustomEntity
|
|||||||
Add server beam to draw list
|
Add server beam to draw list
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void CL_LinkCustomEntity( cl_entity_t *ent, entity_state_t *state )
|
void CL_LinkCustomEntity( cl_entity_t *ent, entity_state_t *state )
|
||||||
{
|
{
|
||||||
ent->curstate.movetype = state->modelindex; // !!!
|
ent->curstate.movetype = state->modelindex; // !!!
|
||||||
|
|
||||||
@@ -1080,7 +1068,7 @@ Create visible entities in the correct position
|
|||||||
for all current players
|
for all current players
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void CL_LinkPlayers( frame_t *frame )
|
void CL_LinkPlayers( frame_t *frame )
|
||||||
{
|
{
|
||||||
entity_state_t *state;
|
entity_state_t *state;
|
||||||
cl_entity_t *ent;
|
cl_entity_t *ent;
|
||||||
@@ -1163,7 +1151,7 @@ CL_LinkPacketEntities
|
|||||||
|
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static void CL_LinkPacketEntities( frame_t *frame )
|
void CL_LinkPacketEntities( frame_t *frame )
|
||||||
{
|
{
|
||||||
cl_entity_t *ent;
|
cl_entity_t *ent;
|
||||||
entity_state_t *state;
|
entity_state_t *state;
|
||||||
@@ -1492,3 +1480,9 @@ qboolean CL_GetMovieSpatialization( rawchan_t *ch )
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CL_ExtraUpdate( void )
|
||||||
|
{
|
||||||
|
clgame.dllFuncs.IN_Accumulate();
|
||||||
|
S_ExtraUpdate();
|
||||||
|
}
|
||||||
|
|||||||
@@ -96,41 +96,6 @@ static dllfunc_t cdll_new_exports[] = // allowed only in SDK 2.3 and higher
|
|||||||
|
|
||||||
static void pfnSPR_DrawHoles( int frame, int x, int y, const wrect_t *prc );
|
static void pfnSPR_DrawHoles( int frame, int x, int y, const wrect_t *prc );
|
||||||
|
|
||||||
/*
|
|
||||||
====================
|
|
||||||
CL_GetEntityByIndex
|
|
||||||
|
|
||||||
Render callback for studio models
|
|
||||||
====================
|
|
||||||
*/
|
|
||||||
cl_entity_t *CL_GetEntityByIndex( int index )
|
|
||||||
{
|
|
||||||
if( !clgame.entities ) // not in game yet
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if( index < 0 || index >= clgame.maxEntities )
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if( index == 0 )
|
|
||||||
return clgame.entities;
|
|
||||||
|
|
||||||
return CL_EDICT_NUM( index );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
================
|
|
||||||
CL_ModelHandle
|
|
||||||
|
|
||||||
get model handle by index
|
|
||||||
================
|
|
||||||
*/
|
|
||||||
model_t *CL_ModelHandle( int modelindex )
|
|
||||||
{
|
|
||||||
if( modelindex < 0 || modelindex >= MAX_MODELS )
|
|
||||||
return NULL;
|
|
||||||
return cl.models[modelindex];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
CL_IsThirdPerson
|
CL_IsThirdPerson
|
||||||
@@ -357,23 +322,20 @@ void SPR_AdjustSize( float *x, float *y, float *w, float *h )
|
|||||||
*h *= yscale;
|
*h *= yscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SPR_AdjustTexCoords( int texnum, float width, float height, float *s1, float *t1, float *s2, float *t2 )
|
void SPR_AdjustTexCoords( float width, float height, float *s1, float *t1, float *s2, float *t2 )
|
||||||
{
|
{
|
||||||
if( REF_GET_PARM( PARM_TEX_FILTERING, texnum ))
|
if( refState.width != clgame.scrInfo.iWidth )
|
||||||
{
|
{
|
||||||
if( refState.width != clgame.scrInfo.iWidth )
|
// align to texel if scaling
|
||||||
{
|
*s1 += 0.5f;
|
||||||
// align to texel if scaling
|
*s2 -= 0.5f;
|
||||||
*s1 += 0.5f;
|
}
|
||||||
*s2 -= 0.5f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( refState.height != clgame.scrInfo.iHeight )
|
if( refState.height != clgame.scrInfo.iHeight )
|
||||||
{
|
{
|
||||||
// align to texel if scaling
|
// align to texel if scaling
|
||||||
*t1 += 0.5f;
|
*t1 += 0.5f;
|
||||||
*t2 -= 0.5f;
|
*t2 -= 0.5f;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*s1 /= width;
|
*s1 /= width;
|
||||||
@@ -405,8 +367,6 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei
|
|||||||
height = h;
|
height = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
texnum = ref.dllFuncs.R_GetSpriteTexture( clgame.ds.pSprite, frame );
|
|
||||||
|
|
||||||
if( prc )
|
if( prc )
|
||||||
{
|
{
|
||||||
wrect_t rc = *prc;
|
wrect_t rc = *prc;
|
||||||
@@ -423,7 +383,7 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei
|
|||||||
t2 = rc.bottom;
|
t2 = rc.bottom;
|
||||||
|
|
||||||
// calc user-defined rectangle
|
// calc user-defined rectangle
|
||||||
SPR_AdjustTexCoords( texnum, width, height, &s1, &t1, &s2, &t2 );
|
SPR_AdjustTexCoords( width, height, &s1, &t1, &s2, &t2 );
|
||||||
width = rc.right - rc.left;
|
width = rc.right - rc.left;
|
||||||
height = rc.bottom - rc.top;
|
height = rc.bottom - rc.top;
|
||||||
}
|
}
|
||||||
@@ -439,6 +399,7 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei
|
|||||||
|
|
||||||
// scale for screen sizes
|
// scale for screen sizes
|
||||||
SPR_AdjustSize( &x, &y, &width, &height );
|
SPR_AdjustSize( &x, &y, &width, &height );
|
||||||
|
texnum = ref.dllFuncs.R_GetSpriteTexture( clgame.ds.pSprite, frame );
|
||||||
ref.dllFuncs.Color4ub( clgame.ds.spriteColor[0], clgame.ds.spriteColor[1], clgame.ds.spriteColor[2], clgame.ds.spriteColor[3] );
|
ref.dllFuncs.Color4ub( clgame.ds.spriteColor[0], clgame.ds.spriteColor[1], clgame.ds.spriteColor[2], clgame.ds.spriteColor[3] );
|
||||||
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, texnum );
|
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, texnum );
|
||||||
}
|
}
|
||||||
@@ -474,7 +435,8 @@ void CL_DrawCenterPrint( void )
|
|||||||
pText = clgame.centerPrint.message;
|
pText = clgame.centerPrint.message;
|
||||||
|
|
||||||
CL_DrawCharacterLen( font, 0, NULL, &charHeight );
|
CL_DrawCharacterLen( font, 0, NULL, &charHeight );
|
||||||
CL_SetFontRendermode( font );
|
|
||||||
|
ref.dllFuncs.GL_SetRenderMode( font->rendermode );
|
||||||
for( i = 0; i < clgame.centerPrint.lines; i++ )
|
for( i = 0; i < clgame.centerPrint.lines; i++ )
|
||||||
{
|
{
|
||||||
lineLength = 0;
|
lineLength = 0;
|
||||||
@@ -550,7 +512,7 @@ fill screen with specfied color
|
|||||||
can be modulated
|
can be modulated
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void CL_DrawScreenFade( void )
|
void CL_DrawScreenFade( void )
|
||||||
{
|
{
|
||||||
screenfade_t *sf = &clgame.fade;
|
screenfade_t *sf = &clgame.fade;
|
||||||
int alpha;
|
int alpha;
|
||||||
@@ -766,7 +728,7 @@ CL_SoundFromIndex
|
|||||||
return soundname from index
|
return soundname from index
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static const char *CL_SoundFromIndex( int index )
|
const char *CL_SoundFromIndex( int index )
|
||||||
{
|
{
|
||||||
sfx_t *sfx = NULL;
|
sfx_t *sfx = NULL;
|
||||||
int hSound;
|
int hSound;
|
||||||
@@ -912,7 +874,7 @@ CL_DrawCrosshair
|
|||||||
Render crosshair
|
Render crosshair
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static void CL_DrawCrosshair( void )
|
void CL_DrawCrosshair( void )
|
||||||
{
|
{
|
||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
float xscale, yscale;
|
float xscale, yscale;
|
||||||
@@ -942,7 +904,7 @@ static void CL_DrawCrosshair( void )
|
|||||||
VectorAdd( refState.viewangles, cl.crosshairangle, angles );
|
VectorAdd( refState.viewangles, cl.crosshairangle, angles );
|
||||||
AngleVectors( angles, forward, NULL, NULL );
|
AngleVectors( angles, forward, NULL, NULL );
|
||||||
VectorAdd( refState.vieworg, forward, point );
|
VectorAdd( refState.vieworg, forward, point );
|
||||||
ref.dllFuncs.WorldToScreen( point, screen );
|
gTriApi.WorldToScreen( point, screen );
|
||||||
|
|
||||||
x += ( clgame.viewport[2] >> 1 ) * screen[0] + 0.5f;
|
x += ( clgame.viewport[2] >> 1 ) * screen[0] + 0.5f;
|
||||||
y += ( clgame.viewport[3] >> 1 ) * screen[1] + 0.5f;
|
y += ( clgame.viewport[3] >> 1 ) * screen[1] + 0.5f;
|
||||||
@@ -1087,7 +1049,6 @@ void CL_ClearWorld( void )
|
|||||||
|
|
||||||
world.max_recursion = 0;
|
world.max_recursion = 0;
|
||||||
|
|
||||||
clgame.ds.cullMode = TRI_FRONT;
|
|
||||||
clgame.numStatics = 0;
|
clgame.numStatics = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1329,7 +1290,6 @@ pfnSPR_Load
|
|||||||
function exported for support GoldSrc Monitor utility
|
function exported for support GoldSrc Monitor utility
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
HSPRITE EXPORT pfnSPR_Load( const char *szPicName );
|
|
||||||
HSPRITE EXPORT pfnSPR_Load( const char *szPicName )
|
HSPRITE EXPORT pfnSPR_Load( const char *szPicName )
|
||||||
{
|
{
|
||||||
model_t *spr;
|
model_t *spr;
|
||||||
@@ -1379,7 +1339,6 @@ pfnSPR_Frames
|
|||||||
function exported for support GoldSrc Monitor utility
|
function exported for support GoldSrc Monitor utility
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
int EXPORT pfnSPR_Frames( HSPRITE hPic );
|
|
||||||
int EXPORT pfnSPR_Frames( HSPRITE hPic )
|
int EXPORT pfnSPR_Frames( HSPRITE hPic )
|
||||||
{
|
{
|
||||||
int numFrames = 0;
|
int numFrames = 0;
|
||||||
@@ -1598,7 +1557,7 @@ CL_FillRGBA
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void GAME_EXPORT CL_FillRGBA( int x, int y, int w, int h, int r, int g, int b, int a )
|
void GAME_EXPORT CL_FillRGBA( int x, int y, int w, int h, int r, int g, int b, int a )
|
||||||
{
|
{
|
||||||
float _x = x, _y = y, _w = w, _h = h;
|
float _x = x, _y = y, _w = w, _h = h;
|
||||||
|
|
||||||
@@ -1640,7 +1599,6 @@ get actual screen info
|
|||||||
*/
|
*/
|
||||||
int GAME_EXPORT CL_GetScreenInfo( SCREENINFO *pscrinfo )
|
int GAME_EXPORT CL_GetScreenInfo( SCREENINFO *pscrinfo )
|
||||||
{
|
{
|
||||||
qboolean apply_scale_factor = false;
|
|
||||||
float scale_factor = hud_scale.value;
|
float scale_factor = hud_scale.value;
|
||||||
|
|
||||||
if( FBitSet( hud_fontscale.flags, FCVAR_CHANGED ))
|
if( FBitSet( hud_fontscale.flags, FCVAR_CHANGED ))
|
||||||
@@ -1655,24 +1613,17 @@ int GAME_EXPORT CL_GetScreenInfo( SCREENINFO *pscrinfo )
|
|||||||
clgame.scrInfo.iSize = sizeof( clgame.scrInfo );
|
clgame.scrInfo.iSize = sizeof( clgame.scrInfo );
|
||||||
clgame.scrInfo.iFlags = SCRINFO_SCREENFLASH;
|
clgame.scrInfo.iFlags = SCRINFO_SCREENFLASH;
|
||||||
|
|
||||||
if( scale_factor && scale_factor != 1.0f )
|
if( scale_factor && scale_factor != 1.0f)
|
||||||
{
|
|
||||||
float scaled_width = (float)refState.width / scale_factor;
|
|
||||||
if( scaled_width >= hud_scale_minimal_width.value )
|
|
||||||
apply_scale_factor = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( apply_scale_factor )
|
|
||||||
{
|
{
|
||||||
clgame.scrInfo.iWidth = (float)refState.width / scale_factor;
|
clgame.scrInfo.iWidth = (float)refState.width / scale_factor;
|
||||||
clgame.scrInfo.iHeight = (float)refState.height / scale_factor;
|
clgame.scrInfo.iHeight = (float)refState.height / scale_factor;
|
||||||
SetBits( clgame.scrInfo.iFlags, SCRINFO_STRETCHED );
|
clgame.scrInfo.iFlags |= SCRINFO_STRETCHED;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
clgame.scrInfo.iWidth = refState.width;
|
clgame.scrInfo.iWidth = refState.width;
|
||||||
clgame.scrInfo.iHeight = refState.height;
|
clgame.scrInfo.iHeight = refState.height;
|
||||||
ClearBits( clgame.scrInfo.iFlags, SCRINFO_STRETCHED );
|
clgame.scrInfo.iFlags &= ~SCRINFO_STRETCHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !pscrinfo ) return 0;
|
if( !pscrinfo ) return 0;
|
||||||
@@ -2134,7 +2085,7 @@ pfnGetViewModel
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static cl_entity_t* GAME_EXPORT CL_GetViewModel( void )
|
cl_entity_t* GAME_EXPORT CL_GetViewModel( void )
|
||||||
{
|
{
|
||||||
return &clgame.viewent;
|
return &clgame.viewent;
|
||||||
}
|
}
|
||||||
@@ -2483,36 +2434,6 @@ static physent_t *pfnGetVisent( int idx )
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GAME_EXPORT CL_TestLine( const vec3_t start, const vec3_t end, int flags )
|
|
||||||
{
|
|
||||||
return PM_TestLineExt( clgame.pmove, clgame.pmove->physents, clgame.pmove->numphysent, start, end, flags );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
CL_PushTraceBounds
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
static void GAME_EXPORT CL_PushTraceBounds( int hullnum, const float *mins, const float *maxs )
|
|
||||||
{
|
|
||||||
hullnum = bound( 0, hullnum, 3 );
|
|
||||||
VectorCopy( mins, clgame.pmove->player_mins[hullnum] );
|
|
||||||
VectorCopy( maxs, clgame.pmove->player_maxs[hullnum] );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
CL_PopTraceBounds
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
static void GAME_EXPORT CL_PopTraceBounds( void )
|
|
||||||
{
|
|
||||||
memcpy( clgame.pmove->player_mins, host.player_mins, sizeof( host.player_mins ));
|
|
||||||
memcpy( clgame.pmove->player_maxs, host.player_maxs, sizeof( host.player_maxs ));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
pfnSetTraceHull
|
pfnSetTraceHull
|
||||||
@@ -2708,48 +2629,6 @@ static model_t *pfnLoadMapSprite( const char *filename )
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
COM_AddAppDirectoryToSearchPath
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
static void GAME_EXPORT COM_AddAppDirectoryToSearchPath( const char *pszBaseDir, const char *appName )
|
|
||||||
{
|
|
||||||
FS_AddGameHierarchy( pszBaseDir, FS_NOWRITE_PATH );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
===========
|
|
||||||
COM_ExpandFilename
|
|
||||||
|
|
||||||
Finds the file in the search path, copies over the name with the full path name.
|
|
||||||
This doesn't search in the pak file.
|
|
||||||
===========
|
|
||||||
*/
|
|
||||||
static int GAME_EXPORT COM_ExpandFilename( const char *fileName, char *nameOutBuffer, int nameOutBufferSize )
|
|
||||||
{
|
|
||||||
char result[MAX_SYSPATH];
|
|
||||||
|
|
||||||
if( !COM_CheckString( fileName ) || !nameOutBuffer || nameOutBufferSize <= 0 )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// filename examples:
|
|
||||||
// media\sierra.avi - D:\Xash3D\valve\media\sierra.avi
|
|
||||||
// models\barney.mdl - D:\Xash3D\bshift\models\barney.mdl
|
|
||||||
if( g_fsapi.GetFullDiskPath( result, sizeof( result ), fileName, false ))
|
|
||||||
{
|
|
||||||
// check for enough room
|
|
||||||
if( Q_strlen( result ) > nameOutBufferSize )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
Q_strncpy( nameOutBuffer, result, nameOutBufferSize );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
PlayerInfo_ValueForKey
|
PlayerInfo_ValueForKey
|
||||||
|
|||||||
@@ -542,7 +542,7 @@ pfnPIC_Set
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static void GAME_EXPORT pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a )
|
void GAME_EXPORT pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a )
|
||||||
{
|
{
|
||||||
gameui.ds.gl_texturenum = hPic;
|
gameui.ds.gl_texturenum = hPic;
|
||||||
r = bound( 0, r, 255 );
|
r = bound( 0, r, 255 );
|
||||||
@@ -558,7 +558,7 @@ pfnPIC_Draw
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static void GAME_EXPORT pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc )
|
void GAME_EXPORT pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
|
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
|
||||||
PIC_DrawGeneric( x, y, width, height, prc );
|
PIC_DrawGeneric( x, y, width, height, prc );
|
||||||
@@ -570,7 +570,7 @@ pfnPIC_DrawTrans
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static void GAME_EXPORT pfnPIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc )
|
void GAME_EXPORT pfnPIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
||||||
PIC_DrawGeneric( x, y, width, height, prc );
|
PIC_DrawGeneric( x, y, width, height, prc );
|
||||||
@@ -582,7 +582,7 @@ pfnPIC_DrawHoles
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static void GAME_EXPORT pfnPIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc )
|
void GAME_EXPORT pfnPIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransAlpha );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransAlpha );
|
||||||
PIC_DrawGeneric( x, y, width, height, prc );
|
PIC_DrawGeneric( x, y, width, height, prc );
|
||||||
@@ -594,7 +594,7 @@ pfnPIC_DrawAdditive
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static void GAME_EXPORT pfnPIC_DrawAdditive( int x, int y, int width, int height, const wrect_t *prc )
|
void GAME_EXPORT pfnPIC_DrawAdditive( int x, int y, int width, int height, const wrect_t *prc )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
||||||
PIC_DrawGeneric( x, y, width, height, prc );
|
PIC_DrawGeneric( x, y, width, height, prc );
|
||||||
@@ -984,7 +984,7 @@ pfnCheckGameDll
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static int GAME_EXPORT pfnCheckGameDll( void )
|
int GAME_EXPORT pfnCheckGameDll( void )
|
||||||
{
|
{
|
||||||
#ifdef XASH_INTERNAL_GAMELIBS
|
#ifdef XASH_INTERNAL_GAMELIBS
|
||||||
return true;
|
return true;
|
||||||
@@ -1092,11 +1092,6 @@ static int pfnDelete( const char *path )
|
|||||||
return FS_Delete( path );
|
return FS_Delete( path );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GAME_EXPORT pfnCon_DefaultColor( int r, int g, int b )
|
|
||||||
{
|
|
||||||
Con_DefaultColor( r, g, b, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
// engine callbacks
|
// engine callbacks
|
||||||
static ui_enginefuncs_t gEngfuncs =
|
static ui_enginefuncs_t gEngfuncs =
|
||||||
{
|
{
|
||||||
@@ -1136,7 +1131,7 @@ static ui_enginefuncs_t gEngfuncs =
|
|||||||
UI_DrawConsoleString,
|
UI_DrawConsoleString,
|
||||||
UI_DrawSetTextColor,
|
UI_DrawSetTextColor,
|
||||||
Con_DrawStringLen,
|
Con_DrawStringLen,
|
||||||
pfnCon_DefaultColor,
|
Con_DefaultColor,
|
||||||
pfnGetPlayerModel,
|
pfnGetPlayerModel,
|
||||||
pfnSetPlayerModel,
|
pfnSetPlayerModel,
|
||||||
pfnClearScene,
|
pfnClearScene,
|
||||||
|
|||||||
@@ -61,9 +61,7 @@ CVAR_DEFINE_AUTO( cl_smoothtime, "0.1", FCVAR_ARCHIVE, "time to smooth up" );
|
|||||||
CVAR_DEFINE_AUTO( cl_clockreset, "0.1", FCVAR_ARCHIVE, "frametime delta maximum value before reset" );
|
CVAR_DEFINE_AUTO( cl_clockreset, "0.1", FCVAR_ARCHIVE, "frametime delta maximum value before reset" );
|
||||||
CVAR_DEFINE_AUTO( cl_fixtimerate, "7.5", FCVAR_ARCHIVE, "time in msec to client clock adjusting" );
|
CVAR_DEFINE_AUTO( cl_fixtimerate, "7.5", FCVAR_ARCHIVE, "time in msec to client clock adjusting" );
|
||||||
CVAR_DEFINE_AUTO( hud_fontscale, "1.0", FCVAR_ARCHIVE|FCVAR_LATCH, "scale hud font texture" );
|
CVAR_DEFINE_AUTO( hud_fontscale, "1.0", FCVAR_ARCHIVE|FCVAR_LATCH, "scale hud font texture" );
|
||||||
CVAR_DEFINE_AUTO( hud_fontrender, "0", FCVAR_ARCHIVE, "hud font render mode (0: additive, 1: holes, 2: trans)" );
|
|
||||||
CVAR_DEFINE_AUTO( hud_scale, "0", FCVAR_ARCHIVE|FCVAR_LATCH, "scale hud at current resolution" );
|
CVAR_DEFINE_AUTO( hud_scale, "0", FCVAR_ARCHIVE|FCVAR_LATCH, "scale hud at current resolution" );
|
||||||
CVAR_DEFINE_AUTO( hud_scale_minimal_width, "640", FCVAR_ARCHIVE|FCVAR_LATCH, "if hud_scale results in a HUD virtual screen smaller than this value, it won't be applied" );
|
|
||||||
CVAR_DEFINE_AUTO( cl_solid_players, "1", 0, "Make all players not solid (can't traceline them)" );
|
CVAR_DEFINE_AUTO( cl_solid_players, "1", 0, "Make all players not solid (can't traceline them)" );
|
||||||
CVAR_DEFINE_AUTO( cl_updaterate, "20", FCVAR_USERINFO|FCVAR_ARCHIVE, "refresh rate of server messages" );
|
CVAR_DEFINE_AUTO( cl_updaterate, "20", FCVAR_USERINFO|FCVAR_ARCHIVE, "refresh rate of server messages" );
|
||||||
CVAR_DEFINE_AUTO( cl_showevents, "0", FCVAR_ARCHIVE, "show events playback" );
|
CVAR_DEFINE_AUTO( cl_showevents, "0", FCVAR_ARCHIVE, "show events playback" );
|
||||||
@@ -75,9 +73,8 @@ static CVAR_DEFINE_AUTO( cl_upmax, "1200", FCVAR_ARCHIVE, "max allowed incoming
|
|||||||
|
|
||||||
CVAR_DEFINE_AUTO( cl_lw, "1", FCVAR_ARCHIVE|FCVAR_USERINFO, "enable client weapon predicting" );
|
CVAR_DEFINE_AUTO( cl_lw, "1", FCVAR_ARCHIVE|FCVAR_USERINFO, "enable client weapon predicting" );
|
||||||
CVAR_DEFINE_AUTO( cl_charset, "utf-8", FCVAR_ARCHIVE, "1-byte charset to use (iconv style)" );
|
CVAR_DEFINE_AUTO( cl_charset, "utf-8", FCVAR_ARCHIVE, "1-byte charset to use (iconv style)" );
|
||||||
CVAR_DEFINE_AUTO( cl_trace_stufftext, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable stufftext (server-to-client console commands) tracing (good for developers)" );
|
CVAR_DEFINE_AUTO( cl_trace_messages, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable message names tracing (good for developers)");
|
||||||
CVAR_DEFINE_AUTO( cl_trace_messages, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable message names tracing (good for developers)" );
|
CVAR_DEFINE_AUTO( cl_trace_events, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable events tracing (good for developers)");
|
||||||
CVAR_DEFINE_AUTO( cl_trace_events, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable events tracing (good for developers)" );
|
|
||||||
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" );
|
||||||
@@ -181,7 +178,7 @@ finalize connection process and begin new frame
|
|||||||
with new cls.state
|
with new cls.state
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static void CL_CheckClientState( void )
|
void CL_CheckClientState( void )
|
||||||
{
|
{
|
||||||
// first update is the pre-final signon stage
|
// first update is the pre-final signon stage
|
||||||
if(( cls.state == ca_connected || cls.state == ca_validate ) && ( cls.signon == SIGNONS ))
|
if(( cls.state == ca_connected || cls.state == ca_validate ) && ( cls.signon == SIGNONS ))
|
||||||
@@ -281,7 +278,7 @@ CL_DriftInterpolationAmount
|
|||||||
Drift interpolation value (this is used for server unlag system)
|
Drift interpolation value (this is used for server unlag system)
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static int CL_DriftInterpolationAmount( int goal )
|
int CL_DriftInterpolationAmount( int goal )
|
||||||
{
|
{
|
||||||
float fgoal, maxmove, diff;
|
float fgoal, maxmove, diff;
|
||||||
int msec;
|
int msec;
|
||||||
@@ -309,7 +306,7 @@ CL_ComputeClientInterpolationAmount
|
|||||||
Validate interpolation cvars, calc interpolation window
|
Validate interpolation cvars, calc interpolation window
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static void CL_ComputeClientInterpolationAmount( usercmd_t *cmd )
|
void CL_ComputeClientInterpolationAmount( usercmd_t *cmd )
|
||||||
{
|
{
|
||||||
const float epsilon = 0.001f; // to avoid float invalid comparision
|
const float epsilon = 0.001f; // to avoid float invalid comparision
|
||||||
float min_interp;
|
float min_interp;
|
||||||
@@ -355,7 +352,7 @@ CL_ComputePacketLoss
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_ComputePacketLoss( void )
|
void CL_ComputePacketLoss( void )
|
||||||
{
|
{
|
||||||
int i, frm;
|
int i, frm;
|
||||||
frame_t *frame;
|
frame_t *frame;
|
||||||
@@ -400,7 +397,7 @@ void CL_UpdateFrameLerp( void )
|
|||||||
cl.commands[(cls.netchan.outgoing_sequence - 1) & CL_UPDATE_MASK].frame_lerp = cl.lerpFrac;
|
cl.commands[(cls.netchan.outgoing_sequence - 1) & CL_UPDATE_MASK].frame_lerp = cl.lerpFrac;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CL_FindInterpolatedAddAngle( float t, float *frac, pred_viewangle_t **prev, pred_viewangle_t **next )
|
void CL_FindInterpolatedAddAngle( float t, float *frac, pred_viewangle_t **prev, pred_viewangle_t **next )
|
||||||
{
|
{
|
||||||
int i, i0, i1, imod;
|
int i, i0, i1, imod;
|
||||||
float at;
|
float at;
|
||||||
@@ -442,7 +439,7 @@ static void CL_FindInterpolatedAddAngle( float t, float *frac, pred_viewangle_t
|
|||||||
*frac = bound( 0.0f, *frac, 1.0f );
|
*frac = bound( 0.0f, *frac, 1.0f );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CL_ApplyAddAngle( void )
|
void CL_ApplyAddAngle( void )
|
||||||
{
|
{
|
||||||
pred_viewangle_t *prev = NULL, *next = NULL;
|
pred_viewangle_t *prev = NULL, *next = NULL;
|
||||||
float addangletotal = 0.0f;
|
float addangletotal = 0.0f;
|
||||||
@@ -478,7 +475,7 @@ CL_ProcessShowTexturesCmds
|
|||||||
navigate around texture atlas
|
navigate around texture atlas
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static qboolean CL_ProcessShowTexturesCmds( usercmd_t *cmd )
|
qboolean CL_ProcessShowTexturesCmds( usercmd_t *cmd )
|
||||||
{
|
{
|
||||||
static int oldbuttons;
|
static int oldbuttons;
|
||||||
int changed;
|
int changed;
|
||||||
@@ -507,7 +504,7 @@ CL_ProcessOverviewCmds
|
|||||||
Transform user movement into overview adjust
|
Transform user movement into overview adjust
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static qboolean CL_ProcessOverviewCmds( usercmd_t *cmd )
|
qboolean CL_ProcessOverviewCmds( usercmd_t *cmd )
|
||||||
{
|
{
|
||||||
ref_overview_t *ov = &clgame.overView;
|
ref_overview_t *ov = &clgame.overView;
|
||||||
int sign = 1;
|
int sign = 1;
|
||||||
@@ -559,7 +556,7 @@ CL_UpdateClientData
|
|||||||
tell the client.dll about player origin, angles, fov, etc
|
tell the client.dll about player origin, angles, fov, etc
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_UpdateClientData( void )
|
void CL_UpdateClientData( void )
|
||||||
{
|
{
|
||||||
client_data_t cdat;
|
client_data_t cdat;
|
||||||
|
|
||||||
@@ -586,7 +583,7 @@ static void CL_UpdateClientData( void )
|
|||||||
CL_CreateCmd
|
CL_CreateCmd
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_CreateCmd( void )
|
void CL_CreateCmd( void )
|
||||||
{
|
{
|
||||||
usercmd_t nullcmd, *cmd;
|
usercmd_t nullcmd, *cmd;
|
||||||
runcmd_t *pcmd;
|
runcmd_t *pcmd;
|
||||||
@@ -690,7 +687,7 @@ Create and send the command packet to the server
|
|||||||
Including both the reliable commands and the usercmds
|
Including both the reliable commands and the usercmds
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
static void CL_WritePacket( void )
|
void CL_WritePacket( void )
|
||||||
{
|
{
|
||||||
sizebuf_t buf;
|
sizebuf_t buf;
|
||||||
qboolean send_command = false;
|
qboolean send_command = false;
|
||||||
@@ -882,7 +879,7 @@ CL_SendCommand
|
|||||||
Called every frame to builds and sends a command packet to the server.
|
Called every frame to builds and sends a command packet to the server.
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_SendCommand( void )
|
void CL_SendCommand( void )
|
||||||
{
|
{
|
||||||
// we create commands even if a demo is playing,
|
// we create commands even if a demo is playing,
|
||||||
CL_CreateCmd();
|
CL_CreateCmd();
|
||||||
@@ -896,7 +893,7 @@ static void CL_SendCommand( void )
|
|||||||
CL_BeginUpload_f
|
CL_BeginUpload_f
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void CL_BeginUpload_f( void )
|
void CL_BeginUpload_f( void )
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
resource_t custResource;
|
resource_t custResource;
|
||||||
@@ -993,7 +990,7 @@ We have gotten a challenge from the server, so try and
|
|||||||
connect.
|
connect.
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
static void CL_SendConnectPacket( void )
|
void CL_SendConnectPacket( void )
|
||||||
{
|
{
|
||||||
char protinfo[MAX_INFO_STRING];
|
char protinfo[MAX_INFO_STRING];
|
||||||
const char *qport;
|
const char *qport;
|
||||||
@@ -1079,7 +1076,7 @@ CL_CheckForResend
|
|||||||
Resend a connect message if the last one has timed out
|
Resend a connect message if the last one has timed out
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_CheckForResend( void )
|
void CL_CheckForResend( void )
|
||||||
{
|
{
|
||||||
netadr_t adr;
|
netadr_t adr;
|
||||||
net_gai_state_t res;
|
net_gai_state_t res;
|
||||||
@@ -1165,7 +1162,7 @@ static void CL_CheckForResend( void )
|
|||||||
Netchan_OutOfBandPrint( NS_CLIENT, adr, "getchallenge\n" );
|
Netchan_OutOfBandPrint( NS_CLIENT, adr, "getchallenge\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
static resource_t *CL_AddResource( resourcetype_t type, const char *name, int size, qboolean bFatalIfMissing, int index )
|
resource_t *CL_AddResource( resourcetype_t type, const char *name, int size, qboolean bFatalIfMissing, int index )
|
||||||
{
|
{
|
||||||
resource_t *r = &cl.resourcelist[cl.num_resources];
|
resource_t *r = &cl.resourcelist[cl.num_resources];
|
||||||
|
|
||||||
@@ -1182,7 +1179,7 @@ static resource_t *CL_AddResource( resourcetype_t type, const char *name, int si
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CL_CreateResourceList( void )
|
void CL_CreateResourceList( void )
|
||||||
{
|
{
|
||||||
char szFileName[MAX_OSPATH];
|
char szFileName[MAX_OSPATH];
|
||||||
byte rgucMD5_hash[16];
|
byte rgucMD5_hash[16];
|
||||||
@@ -1230,7 +1227,7 @@ CL_Connect_f
|
|||||||
|
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void CL_Connect_f( void )
|
void CL_Connect_f( void )
|
||||||
{
|
{
|
||||||
string server;
|
string server;
|
||||||
qboolean legacyconnect = false;
|
qboolean legacyconnect = false;
|
||||||
@@ -1277,7 +1274,7 @@ Send the rest of the command line over as
|
|||||||
an unconnected command.
|
an unconnected command.
|
||||||
=====================
|
=====================
|
||||||
*/
|
*/
|
||||||
static void CL_Rcon_f( void )
|
void CL_Rcon_f( void )
|
||||||
{
|
{
|
||||||
char message[1024];
|
char message[1024];
|
||||||
netadr_t to;
|
netadr_t to;
|
||||||
@@ -1384,7 +1381,7 @@ CL_SendDisconnectMessage
|
|||||||
Sends a disconnect message to the server
|
Sends a disconnect message to the server
|
||||||
=====================
|
=====================
|
||||||
*/
|
*/
|
||||||
static void CL_SendDisconnectMessage( void )
|
void CL_SendDisconnectMessage( void )
|
||||||
{
|
{
|
||||||
sizebuf_t buf;
|
sizebuf_t buf;
|
||||||
byte data[32];
|
byte data[32];
|
||||||
@@ -1429,7 +1426,7 @@ CL_Reconnect
|
|||||||
build a request to reconnect client
|
build a request to reconnect client
|
||||||
=====================
|
=====================
|
||||||
*/
|
*/
|
||||||
static void CL_Reconnect( qboolean setup_netchan )
|
void CL_Reconnect( qboolean setup_netchan )
|
||||||
{
|
{
|
||||||
if( setup_netchan )
|
if( setup_netchan )
|
||||||
{
|
{
|
||||||
@@ -1556,7 +1553,7 @@ void CL_Crashed( void )
|
|||||||
CL_LocalServers_f
|
CL_LocalServers_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_LocalServers_f( void )
|
void CL_LocalServers_f( void )
|
||||||
{
|
{
|
||||||
netadr_t adr;
|
netadr_t adr;
|
||||||
|
|
||||||
@@ -1625,7 +1622,7 @@ static void CL_SendMasterServerScanRequest( void )
|
|||||||
CL_InternetServers_f
|
CL_InternetServers_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_InternetServers_f( void )
|
void CL_InternetServers_f( void )
|
||||||
{
|
{
|
||||||
qboolean nat = cl_nat.value != 0.0f;
|
qboolean nat = cl_nat.value != 0.0f;
|
||||||
uint32_t key;
|
uint32_t key;
|
||||||
@@ -1654,7 +1651,7 @@ CL_Reconnect_f
|
|||||||
The server is changing levels
|
The server is changing levels
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_Reconnect_f( void )
|
void CL_Reconnect_f( void )
|
||||||
{
|
{
|
||||||
if( cls.state == ca_disconnected )
|
if( cls.state == ca_disconnected )
|
||||||
return;
|
return;
|
||||||
@@ -1691,7 +1688,7 @@ CL_FixupColorStringsForInfoString
|
|||||||
all the keys and values must be ends with ^7
|
all the keys and values must be ends with ^7
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_FixupColorStringsForInfoString( const char *in, char *out )
|
void CL_FixupColorStringsForInfoString( const char *in, char *out )
|
||||||
{
|
{
|
||||||
qboolean hasPrefix = false;
|
qboolean hasPrefix = false;
|
||||||
qboolean endOfKeyVal = false;
|
qboolean endOfKeyVal = false;
|
||||||
@@ -1755,7 +1752,7 @@ CL_ParseStatusMessage
|
|||||||
Handle a reply from a info
|
Handle a reply from a info
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_ParseStatusMessage( netadr_t from, sizebuf_t *msg )
|
void CL_ParseStatusMessage( netadr_t from, sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
static char infostring[MAX_INFO_STRING+8];
|
static char infostring[MAX_INFO_STRING+8];
|
||||||
char *s = MSG_ReadString( msg );
|
char *s = MSG_ReadString( msg );
|
||||||
@@ -1804,7 +1801,7 @@ CL_ParseNETInfoMessage
|
|||||||
Handle a reply from a netinfo
|
Handle a reply from a netinfo
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_ParseNETInfoMessage( netadr_t from, sizebuf_t *msg, const char *s )
|
void CL_ParseNETInfoMessage( netadr_t from, sizebuf_t *msg, const char *s )
|
||||||
{
|
{
|
||||||
net_request_t *nr;
|
net_request_t *nr;
|
||||||
static char infostring[MAX_INFO_STRING+8];
|
static char infostring[MAX_INFO_STRING+8];
|
||||||
@@ -1859,7 +1856,7 @@ CL_ProcessNetRequests
|
|||||||
check for timeouts
|
check for timeouts
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_ProcessNetRequests( void )
|
void CL_ProcessNetRequests( void )
|
||||||
{
|
{
|
||||||
net_request_t *nr;
|
net_request_t *nr;
|
||||||
int i;
|
int i;
|
||||||
@@ -1941,7 +1938,7 @@ CL_ConnectionlessPacket
|
|||||||
Responses to broadcasts, etc
|
Responses to broadcasts, etc
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
char *args;
|
char *args;
|
||||||
const char *c;
|
const char *c;
|
||||||
@@ -2238,7 +2235,7 @@ CL_GetMessage
|
|||||||
Handles recording and playback of demos, on top of NET_ code
|
Handles recording and playback of demos, on top of NET_ code
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static int CL_GetMessage( byte *data, size_t *length )
|
int CL_GetMessage( byte *data, size_t *length )
|
||||||
{
|
{
|
||||||
if( cls.demoplayback )
|
if( cls.demoplayback )
|
||||||
{
|
{
|
||||||
@@ -2257,7 +2254,7 @@ static int CL_GetMessage( byte *data, size_t *length )
|
|||||||
CL_ReadNetMessage
|
CL_ReadNetMessage
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_ReadNetMessage( void )
|
void CL_ReadNetMessage( void )
|
||||||
{
|
{
|
||||||
size_t curSize;
|
size_t curSize;
|
||||||
|
|
||||||
@@ -2341,7 +2338,7 @@ Updates the local time and reads/handles messages
|
|||||||
on client net connection.
|
on client net connection.
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_ReadPackets( void )
|
void CL_ReadPackets( void )
|
||||||
{
|
{
|
||||||
// decide the simulation time
|
// decide the simulation time
|
||||||
cl.oldtime = cl.time;
|
cl.oldtime = cl.time;
|
||||||
@@ -2405,7 +2402,7 @@ CL_CleanFileName
|
|||||||
Replace the displayed name for some resources
|
Replace the displayed name for some resources
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static const char *CL_CleanFileName( const char *filename )
|
const char *CL_CleanFileName( const char *filename )
|
||||||
{
|
{
|
||||||
if( COM_CheckString( filename ) && filename[0] == '!' )
|
if( COM_CheckString( filename ) && filename[0] == '!' )
|
||||||
return "customization";
|
return "customization";
|
||||||
@@ -2421,7 +2418,7 @@ CL_RegisterCustomization
|
|||||||
register custom resource for player
|
register custom resource for player
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static void CL_RegisterCustomization( resource_t *resource )
|
void CL_RegisterCustomization( resource_t *resource )
|
||||||
{
|
{
|
||||||
qboolean bFound = false;
|
qboolean bFound = false;
|
||||||
customization_t *pList;
|
customization_t *pList;
|
||||||
@@ -2627,7 +2624,7 @@ void CL_ServerCommand( qboolean reliable, const char *fmt, ... )
|
|||||||
CL_SetInfo_f
|
CL_SetInfo_f
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static void CL_SetInfo_f( void )
|
void CL_SetInfo_f( void )
|
||||||
{
|
{
|
||||||
convar_t *var;
|
convar_t *var;
|
||||||
|
|
||||||
@@ -2667,7 +2664,7 @@ static void CL_SetInfo_f( void )
|
|||||||
CL_Physinfo_f
|
CL_Physinfo_f
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static void CL_Physinfo_f( void )
|
void CL_Physinfo_f( void )
|
||||||
{
|
{
|
||||||
Con_Printf( "Phys info settings:\n" );
|
Con_Printf( "Phys info settings:\n" );
|
||||||
Info_Print( cls.physinfo );
|
Info_Print( cls.physinfo );
|
||||||
@@ -2822,7 +2819,7 @@ CL_FullServerinfo_f
|
|||||||
Sent by server when serverinfo changes
|
Sent by server when serverinfo changes
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void CL_FullServerinfo_f( void )
|
void CL_FullServerinfo_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() != 2 )
|
if( Cmd_Argc() != 2 )
|
||||||
{
|
{
|
||||||
@@ -2840,7 +2837,7 @@ CL_Escape_f
|
|||||||
Escape to menu from game
|
Escape to menu from game
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_Escape_f( void )
|
void CL_Escape_f( void )
|
||||||
{
|
{
|
||||||
if( cls.key_dest == key_menu )
|
if( cls.key_dest == key_menu )
|
||||||
return;
|
return;
|
||||||
@@ -2858,7 +2855,7 @@ static void CL_Escape_f( void )
|
|||||||
CL_InitLocal
|
CL_InitLocal
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_InitLocal( void )
|
void CL_InitLocal( void )
|
||||||
{
|
{
|
||||||
cls.state = ca_disconnected;
|
cls.state = ca_disconnected;
|
||||||
cls.signon = 0;
|
cls.signon = 0;
|
||||||
@@ -2893,7 +2890,6 @@ static void CL_InitLocal( void )
|
|||||||
|
|
||||||
Cvar_RegisterVariable( &rcon_address );
|
Cvar_RegisterVariable( &rcon_address );
|
||||||
|
|
||||||
Cvar_RegisterVariable( &cl_trace_stufftext );
|
|
||||||
Cvar_RegisterVariable( &cl_trace_messages );
|
Cvar_RegisterVariable( &cl_trace_messages );
|
||||||
Cvar_RegisterVariable( &cl_trace_events );
|
Cvar_RegisterVariable( &cl_trace_events );
|
||||||
|
|
||||||
@@ -2929,9 +2925,7 @@ static void CL_InitLocal( void )
|
|||||||
Cvar_RegisterVariable( &cl_clockreset );
|
Cvar_RegisterVariable( &cl_clockreset );
|
||||||
Cvar_RegisterVariable( &cl_fixtimerate );
|
Cvar_RegisterVariable( &cl_fixtimerate );
|
||||||
Cvar_RegisterVariable( &hud_fontscale );
|
Cvar_RegisterVariable( &hud_fontscale );
|
||||||
Cvar_RegisterVariable( &hud_fontrender );
|
|
||||||
Cvar_RegisterVariable( &hud_scale );
|
Cvar_RegisterVariable( &hud_scale );
|
||||||
Cvar_RegisterVariable( &hud_scale_minimal_width );
|
|
||||||
Cvar_Get( "cl_background", "0", FCVAR_READ_ONLY, "indicate what background map is running" );
|
Cvar_Get( "cl_background", "0", FCVAR_READ_ONLY, "indicate what background map is running" );
|
||||||
Cvar_RegisterVariable( &cl_showevents );
|
Cvar_RegisterVariable( &cl_showevents );
|
||||||
Cvar_Get( "lastdemo", "", FCVAR_ARCHIVE, "last played demo" );
|
Cvar_Get( "lastdemo", "", FCVAR_ARCHIVE, "last played demo" );
|
||||||
@@ -2987,12 +2981,12 @@ static void CL_InitLocal( void )
|
|||||||
Cmd_AddRestrictedCommand ("quit", CL_Quit_f, "quit from game" );
|
Cmd_AddRestrictedCommand ("quit", CL_Quit_f, "quit from game" );
|
||||||
Cmd_AddRestrictedCommand ("exit", CL_Quit_f, "quit from game" );
|
Cmd_AddRestrictedCommand ("exit", CL_Quit_f, "quit from game" );
|
||||||
|
|
||||||
Cmd_AddCommand ("screenshot", CL_GenericShot_f, "takes a screenshot of the next rendered frame" );
|
Cmd_AddCommand ("screenshot", CL_ScreenShot_f, "takes a screenshot of the next rendered frame" );
|
||||||
Cmd_AddCommand ("snapshot", CL_GenericShot_f, "takes a snapshot of the next rendered frame" );
|
Cmd_AddCommand ("snapshot", CL_SnapShot_f, "takes a snapshot of the next rendered frame" );
|
||||||
Cmd_AddCommand ("envshot", CL_GenericShot_f, "takes a six-sides cubemap shot with specified name" );
|
Cmd_AddCommand ("envshot", CL_EnvShot_f, "takes a six-sides cubemap shot with specified name" );
|
||||||
Cmd_AddCommand ("skyshot", CL_GenericShot_f, "takes a six-sides envmap (skybox) shot with specified name" );
|
Cmd_AddCommand ("skyshot", CL_SkyShot_f, "takes a six-sides envmap (skybox) shot with specified name" );
|
||||||
Cmd_AddCommand ("levelshot", CL_LevelShot_f, "same as \"screenshot\", used for create plaque images" );
|
Cmd_AddCommand ("levelshot", CL_LevelShot_f, "same as \"screenshot\", used for create plaque images" );
|
||||||
Cmd_AddCommand ("saveshot", CL_GenericShot_f, "used for create save previews with LoadGame menu" );
|
Cmd_AddCommand ("saveshot", CL_SaveShot_f, "used for create save previews with LoadGame menu" );
|
||||||
|
|
||||||
Cmd_AddCommand ("connect", CL_Connect_f, "connect to a server by hostname" );
|
Cmd_AddCommand ("connect", CL_Connect_f, "connect to a server by hostname" );
|
||||||
Cmd_AddCommand ("reconnect", CL_Reconnect_f, "reconnect to current level" );
|
Cmd_AddCommand ("reconnect", CL_Reconnect_f, "reconnect to current level" );
|
||||||
@@ -3011,7 +3005,7 @@ slowly adjuct client clock
|
|||||||
to smooth lag effect
|
to smooth lag effect
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void CL_AdjustClock( void )
|
void CL_AdjustClock( void )
|
||||||
{
|
{
|
||||||
if( cl.timedelta == 0.0f || !cl_fixtimerate.value )
|
if( cl.timedelta == 0.0f || !cl_fixtimerate.value )
|
||||||
return;
|
return;
|
||||||
@@ -3145,7 +3139,7 @@ void CL_Init( void )
|
|||||||
|
|
||||||
VID_Init(); // init video
|
VID_Init(); // init video
|
||||||
S_Init(); // init sound
|
S_Init(); // init sound
|
||||||
Voice_Init( VOICE_DEFAULT_CODEC, 3, true ); // init voice (do not open the device)
|
Voice_Init( VOICE_DEFAULT_CODEC, 3 ); // init voice
|
||||||
|
|
||||||
// unreliable buffer. unsed for unreliable commands and voice stream
|
// unreliable buffer. unsed for unreliable commands and voice stream
|
||||||
MSG_Init( &cls.datagram, "cls.datagram", cls.datagram_buf, sizeof( cls.datagram_buf ));
|
MSG_Init( &cls.datagram, "cls.datagram", cls.datagram_buf, sizeof( cls.datagram_buf ));
|
||||||
|
|||||||
@@ -81,12 +81,12 @@ NetGraph_FillRGBA shortcut
|
|||||||
*/
|
*/
|
||||||
static void NetGraph_DrawRect( wrect_t *rect, byte colors[4] )
|
static void NetGraph_DrawRect( wrect_t *rect, byte colors[4] )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.Color4ub( colors[0], colors[1], colors[2], colors[3] ); // color for this quad
|
gTriApi.Color4ub( colors[0], colors[1], colors[2], colors[3] ); // color for this quad
|
||||||
|
|
||||||
ref.dllFuncs.Vertex3f( rect->left, rect->top, 0 );
|
gTriApi.Vertex3f( rect->left, rect->top, 0 );
|
||||||
ref.dllFuncs.Vertex3f( rect->left + rect->right, rect->top, 0 );
|
gTriApi.Vertex3f( rect->left + rect->right, rect->top, 0 );
|
||||||
ref.dllFuncs.Vertex3f( rect->left + rect->right, rect->top + rect->bottom, 0 );
|
gTriApi.Vertex3f( rect->left + rect->right, rect->top + rect->bottom, 0 );
|
||||||
ref.dllFuncs.Vertex3f( rect->left, rect->top + rect->bottom, 0 );
|
gTriApi.Vertex3f( rect->left, rect->top + rect->bottom, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -387,7 +387,7 @@ static void NetGraph_DrawTextFields( int x, int y, int w, wrect_t rect, int coun
|
|||||||
// move rolling average
|
// move rolling average
|
||||||
framerate = FRAMERATE_AVG_FRAC * host.frametime + ( 1.0f - FRAMERATE_AVG_FRAC ) * framerate;
|
framerate = FRAMERATE_AVG_FRAC * host.frametime + ( 1.0f - FRAMERATE_AVG_FRAC ) * framerate;
|
||||||
|
|
||||||
CL_SetFontRendermode( font );
|
ref.dllFuncs.GL_SetRenderMode( font->rendermode );
|
||||||
|
|
||||||
if( framerate > 0.0f )
|
if( framerate > 0.0f )
|
||||||
{
|
{
|
||||||
@@ -691,7 +691,7 @@ void SCR_DrawNetGraph( void )
|
|||||||
|
|
||||||
ref.dllFuncs.End();
|
ref.dllFuncs.End();
|
||||||
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
|
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
|
ref.dllFuncs.RenderMode( kRenderNormal );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ GNU General Public License for more details.
|
|||||||
#include "shake.h"
|
#include "shake.h"
|
||||||
#include "hltv.h"
|
#include "hltv.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
#include "server.h"
|
||||||
#if XASH_LOW_MEMORY != 2
|
#if XASH_LOW_MEMORY != 2
|
||||||
int CL_UPDATE_BACKUP = SINGLEPLAYER_BACKUP;
|
int CL_UPDATE_BACKUP = SINGLEPLAYER_BACKUP;
|
||||||
#endif
|
#endif
|
||||||
@@ -31,7 +32,7 @@ CL_UserMsgStub
|
|||||||
Default stub for missed callbacks
|
Default stub for missed callbacks
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static int CL_UserMsgStub( const char *pszName, int iSize, void *pbuf )
|
int CL_UserMsgStub( const char *pszName, int iSize, void *pbuf )
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -57,7 +58,7 @@ CL_ParseSoundPacket
|
|||||||
|
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void CL_ParseSoundPacket( sizebuf_t *msg )
|
void CL_ParseSoundPacket( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
vec3_t pos;
|
vec3_t pos;
|
||||||
int chan, sound;
|
int chan, sound;
|
||||||
@@ -304,7 +305,7 @@ CL_ParseStaticEntity
|
|||||||
static client entity
|
static client entity
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void CL_ParseStaticEntity( sizebuf_t *msg )
|
void CL_ParseStaticEntity( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int i, newnum;
|
int i, newnum;
|
||||||
entity_state_t from, to;
|
entity_state_t from, to;
|
||||||
@@ -618,7 +619,7 @@ static void CL_StartResourceDownloading( const char *pszMessage, qboolean bCusto
|
|||||||
CL_BatchResourceRequest( !bCustom );
|
CL_BatchResourceRequest( !bCustom );
|
||||||
}
|
}
|
||||||
|
|
||||||
static customization_t *CL_PlayerHasCustomization( int nPlayerNum, resourcetype_t type )
|
customization_t *CL_PlayerHasCustomization( int nPlayerNum, resourcetype_t type )
|
||||||
{
|
{
|
||||||
customization_t *pList;
|
customization_t *pList;
|
||||||
|
|
||||||
@@ -630,7 +631,7 @@ static customization_t *CL_PlayerHasCustomization( int nPlayerNum, resourcetype_
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CL_RemoveCustomization( int nPlayerNum, customization_t *pRemove )
|
void CL_RemoveCustomization( int nPlayerNum, customization_t *pRemove )
|
||||||
{
|
{
|
||||||
customization_t *pList;
|
customization_t *pList;
|
||||||
customization_t *pNext;
|
customization_t *pNext;
|
||||||
@@ -801,7 +802,7 @@ CL_CreateCustomizationList
|
|||||||
loading custom decal for self
|
loading custom decal for self
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void CL_CreateCustomizationList( void )
|
void CL_CreateCustomizationList( void )
|
||||||
{
|
{
|
||||||
resource_t *pResource;
|
resource_t *pResource;
|
||||||
player_info_t *pPlayer;
|
player_info_t *pPlayer;
|
||||||
@@ -1382,13 +1383,9 @@ void CL_UpdateUserinfo( sizebuf_t *msg, qboolean legacy )
|
|||||||
if( slot >= MAX_CLIENTS )
|
if( slot >= MAX_CLIENTS )
|
||||||
Host_Error( "CL_ParseServerMessage: svc_updateuserinfo >= MAX_CLIENTS\n" );
|
Host_Error( "CL_ParseServerMessage: svc_updateuserinfo >= MAX_CLIENTS\n" );
|
||||||
|
|
||||||
player = &cl.players[slot];
|
|
||||||
|
|
||||||
if( !legacy )
|
if( !legacy )
|
||||||
id = MSG_ReadLong( msg ); // unique user ID
|
id = MSG_ReadLong( msg ); // unique user ID
|
||||||
else
|
player = &cl.players[slot];
|
||||||
id = 0; // bogus
|
|
||||||
|
|
||||||
active = MSG_ReadOneBit( msg ) ? true : false;
|
active = MSG_ReadOneBit( msg ) ? true : false;
|
||||||
|
|
||||||
if( active )
|
if( active )
|
||||||
@@ -1410,10 +1407,6 @@ void CL_UpdateUserinfo( sizebuf_t *msg, qboolean legacy )
|
|||||||
|
|
||||||
memset( player, 0, sizeof( *player ));
|
memset( player, 0, sizeof( *player ));
|
||||||
}
|
}
|
||||||
|
|
||||||
// in GoldSrc userinfo might be empty but userid is always sent as separate value
|
|
||||||
// thus avoids clean up even after client disconnect
|
|
||||||
player->userid = id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1501,7 +1494,7 @@ void CL_UpdateUserPings( sizebuf_t *msg )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CL_SendConsistencyInfo( sizebuf_t *msg )
|
void CL_SendConsistencyInfo( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
qboolean user_changed_diskfile;
|
qboolean user_changed_diskfile;
|
||||||
vec3_t mins, maxs;
|
vec3_t mins, maxs;
|
||||||
@@ -1678,7 +1671,7 @@ void CL_RegisterResources( sizebuf_t *msg )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CL_ParseConsistencyInfo( sizebuf_t *msg )
|
void CL_ParseConsistencyInfo( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int lastcheck;
|
int lastcheck;
|
||||||
int delta;
|
int delta;
|
||||||
@@ -1743,7 +1736,7 @@ CL_ParseResourceList
|
|||||||
|
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static void CL_ParseResourceList( sizebuf_t *msg )
|
void CL_ParseResourceList( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
resource_t *pResource;
|
resource_t *pResource;
|
||||||
int i, total;
|
int i, total;
|
||||||
@@ -1780,12 +1773,12 @@ CL_ParseVoiceInit
|
|||||||
|
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void CL_ParseVoiceInit( sizebuf_t *msg )
|
void CL_ParseVoiceInit( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
char *pszCodec = MSG_ReadString( msg );
|
char *pszCodec = MSG_ReadString( msg );
|
||||||
int quality = MSG_ReadByte( msg );
|
int quality = MSG_ReadByte( msg );
|
||||||
|
|
||||||
Voice_Init( pszCodec, quality, false ); // init requested codec and the device
|
Voice_Init( pszCodec, quality );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1794,7 +1787,7 @@ CL_ParseVoiceData
|
|||||||
|
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void CL_ParseVoiceData( sizebuf_t *msg )
|
void CL_ParseVoiceData( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int size, idx, frames;
|
int size, idx, frames;
|
||||||
byte received[8192];
|
byte received[8192];
|
||||||
@@ -1911,7 +1904,7 @@ CL_ParseScreenShake
|
|||||||
Set screen shake
|
Set screen shake
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static void CL_ParseScreenShake( sizebuf_t *msg )
|
void CL_ParseScreenShake( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
float amplitude = (float)(word)MSG_ReadShort( msg ) * ( 1.0f / (float)( 1 << 12 ));
|
float amplitude = (float)(word)MSG_ReadShort( msg ) * ( 1.0f / (float)( 1 << 12 ));
|
||||||
float duration = (float)(word)MSG_ReadShort( msg ) * ( 1.0f / (float)( 1 << 12 ));
|
float duration = (float)(word)MSG_ReadShort( msg ) * ( 1.0f / (float)( 1 << 12 ));
|
||||||
@@ -1934,7 +1927,7 @@ CL_ParseScreenFade
|
|||||||
Set screen fade
|
Set screen fade
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static void CL_ParseScreenFade( sizebuf_t *msg )
|
void CL_ParseScreenFade( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
float duration, holdTime;
|
float duration, holdTime;
|
||||||
screenfade_t *sf = &clgame.fade;
|
screenfade_t *sf = &clgame.fade;
|
||||||
@@ -2033,7 +2026,7 @@ CL_ParseExec
|
|||||||
Exec map/class specific configs
|
Exec map/class specific configs
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static void CL_ParseExec( sizebuf_t *msg )
|
void CL_ParseExec( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
qboolean is_class;
|
qboolean is_class;
|
||||||
int class_idx;
|
int class_idx;
|
||||||
@@ -2329,18 +2322,11 @@ void CL_ParseServerMessage( sizebuf_t *msg, qboolean normal_message )
|
|||||||
break;
|
break;
|
||||||
case svc_stufftext:
|
case svc_stufftext:
|
||||||
s = MSG_ReadString( msg );
|
s = MSG_ReadString( msg );
|
||||||
if( cl_trace_stufftext.value )
|
|
||||||
{
|
|
||||||
size_t len = Q_strlen( s );
|
|
||||||
Con_Printf( "Stufftext: %s%c", s, len && s[len-1] == '\n' ? '\0' : '\n' );
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HACKS_RELATED_HLMODS
|
#ifdef HACKS_RELATED_HLMODS
|
||||||
// disable Cry Of Fear antisave protection
|
// disable Cry Of Fear antisave protection
|
||||||
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
||||||
break; // too early
|
break; // too early
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Cbuf_AddFilteredText( s );
|
Cbuf_AddFilteredText( s );
|
||||||
break;
|
break;
|
||||||
case svc_setangle:
|
case svc_setangle:
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ CL_ParseStaticEntity
|
|||||||
static client entity
|
static client entity
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void CL_LegacyParseStaticEntity( sizebuf_t *msg )
|
void CL_LegacyParseStaticEntity( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
entity_state_t state;
|
entity_state_t state;
|
||||||
@@ -98,7 +98,7 @@ static void CL_LegacyParseStaticEntity( sizebuf_t *msg )
|
|||||||
R_AddEfrags( ent ); // add link
|
R_AddEfrags( ent ); // add link
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CL_LegacyParseSoundPacket( sizebuf_t *msg, qboolean is_ambient )
|
void CL_LegacyParseSoundPacket( sizebuf_t *msg, qboolean is_ambient )
|
||||||
{
|
{
|
||||||
vec3_t pos;
|
vec3_t pos;
|
||||||
int chan, sound;
|
int chan, sound;
|
||||||
@@ -167,7 +167,7 @@ CL_PrecacheSound
|
|||||||
prceache sound from server
|
prceache sound from server
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void CL_LegacyPrecacheSound( sizebuf_t *msg )
|
void CL_LegacyPrecacheSound( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int soundIndex;
|
int soundIndex;
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ static void CL_LegacyPrecacheSound( sizebuf_t *msg )
|
|||||||
cl.sound_index[soundIndex] = S_RegisterSound( cl.sound_precache[soundIndex] );
|
cl.sound_index[soundIndex] = S_RegisterSound( cl.sound_precache[soundIndex] );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CL_LegacyPrecacheModel( sizebuf_t *msg )
|
void CL_LegacyPrecacheModel( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int modelIndex;
|
int modelIndex;
|
||||||
string model;
|
string model;
|
||||||
@@ -214,7 +214,7 @@ static void CL_LegacyPrecacheModel( sizebuf_t *msg )
|
|||||||
cl.nummodels = Q_max( cl.nummodels, modelIndex );
|
cl.nummodels = Q_max( cl.nummodels, modelIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CL_LegacyPrecacheEvent( sizebuf_t *msg )
|
void CL_LegacyPrecacheEvent( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int eventIndex;
|
int eventIndex;
|
||||||
|
|
||||||
@@ -242,7 +242,7 @@ CL_ParseResourceList
|
|||||||
|
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static void CL_LegacyParseResourceList( sizebuf_t *msg )
|
void CL_LegacyParseResourceList( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
static struct
|
static struct
|
||||||
@@ -443,17 +443,13 @@ void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message )
|
|||||||
break;
|
break;
|
||||||
case svc_stufftext:
|
case svc_stufftext:
|
||||||
s = MSG_ReadString( msg );
|
s = MSG_ReadString( msg );
|
||||||
if( cl_trace_stufftext.value )
|
|
||||||
{
|
|
||||||
size_t len = Q_strlen( s );
|
|
||||||
Con_Printf( "Stufftext: %s%c", s, len && s[len-1] == '\n' ? '\0' : '\n' );
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HACKS_RELATED_HLMODS
|
#ifdef HACKS_RELATED_HLMODS
|
||||||
// disable Cry Of Fear antisave protection
|
// disable Cry Of Fear antisave protection
|
||||||
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
||||||
break; // too early
|
break; // too early
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Con_Reportf( "Stufftext: %s", s );
|
||||||
Cbuf_AddFilteredText( s );
|
Cbuf_AddFilteredText( s );
|
||||||
break;
|
break;
|
||||||
case svc_setangle:
|
case svc_setangle:
|
||||||
|
|||||||
@@ -54,6 +54,31 @@ void GAME_EXPORT CL_PopPMStates( void )
|
|||||||
clgame.pushed = false;
|
clgame.pushed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
CL_PushTraceBounds
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
void GAME_EXPORT CL_PushTraceBounds( int hullnum, const float *mins, const float *maxs )
|
||||||
|
{
|
||||||
|
hullnum = bound( 0, hullnum, 3 );
|
||||||
|
VectorCopy( mins, clgame.pmove->player_mins[hullnum] );
|
||||||
|
VectorCopy( maxs, clgame.pmove->player_maxs[hullnum] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
CL_PopTraceBounds
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
void GAME_EXPORT CL_PopTraceBounds( void )
|
||||||
|
{
|
||||||
|
memcpy( clgame.pmove->player_mins, host.player_mins, sizeof( host.player_mins ));
|
||||||
|
memcpy( clgame.pmove->player_maxs, host.player_maxs, sizeof( host.player_maxs ));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
CL_IsPredicted
|
CL_IsPredicted
|
||||||
@@ -392,7 +417,7 @@ CL_AddLinksToPmove
|
|||||||
collect solid entities
|
collect solid entities
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static void CL_AddLinksToPmove( frame_t *frame )
|
void CL_AddLinksToPmove( frame_t *frame )
|
||||||
{
|
{
|
||||||
entity_state_t *state;
|
entity_state_t *state;
|
||||||
model_t *model;
|
model_t *model;
|
||||||
@@ -662,6 +687,11 @@ cl_entity_t *CL_GetWaterEntity( const float *rgflPos )
|
|||||||
return CL_GetEntityByIndex( entnum );
|
return CL_GetEntityByIndex( entnum );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GAME_EXPORT CL_TestLine( const vec3_t start, const vec3_t end, int flags )
|
||||||
|
{
|
||||||
|
return PM_TestLineExt( clgame.pmove, clgame.pmove->physents, clgame.pmove->numphysent, start, end, flags );
|
||||||
|
}
|
||||||
|
|
||||||
static int GAME_EXPORT pfnTestPlayerPosition( float *pos, pmtrace_t *ptrace )
|
static int GAME_EXPORT pfnTestPlayerPosition( float *pos, pmtrace_t *ptrace )
|
||||||
{
|
{
|
||||||
return PM_TestPlayerPosition( clgame.pmove, pos, ptrace, NULL );
|
return PM_TestPlayerPosition( clgame.pmove, pos, ptrace, NULL );
|
||||||
@@ -867,7 +897,7 @@ static void CL_SetupPMove( playermove_t *pmove, const local_state_t *from, const
|
|||||||
Q_strncpy( pmove->physinfo, cls.physinfo, MAX_INFO_STRING );
|
Q_strncpy( pmove->physinfo, cls.physinfo, MAX_INFO_STRING );
|
||||||
}
|
}
|
||||||
|
|
||||||
static const void CL_FinishPMove( const playermove_t *pmove, local_state_t *to )
|
const void CL_FinishPMove( const playermove_t *pmove, local_state_t *to )
|
||||||
{
|
{
|
||||||
entity_state_t *ps;
|
entity_state_t *ps;
|
||||||
clientdata_t *cd;
|
clientdata_t *cd;
|
||||||
@@ -920,7 +950,7 @@ CL_RunUsercmd
|
|||||||
Runs prediction code for user cmd
|
Runs prediction code for user cmd
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void CL_RunUsercmd( local_state_t *from, local_state_t *to, usercmd_t *u, qboolean runfuncs, double *time, unsigned int random_seed )
|
void CL_RunUsercmd( local_state_t *from, local_state_t *to, usercmd_t *u, qboolean runfuncs, double *time, unsigned int random_seed )
|
||||||
{
|
{
|
||||||
usercmd_t cmd;
|
usercmd_t cmd;
|
||||||
|
|
||||||
|
|||||||
@@ -414,7 +414,7 @@ If an entities model or origin changes from frame to frame, it must be
|
|||||||
relinked. Other attributes can change without relinking.
|
relinked. Other attributes can change without relinking.
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void CL_ParseQuakeEntityData( sizebuf_t *msg, int bits )
|
void CL_ParseQuakeEntityData( sizebuf_t *msg, int bits )
|
||||||
{
|
{
|
||||||
int i, newnum, pack;
|
int i, newnum, pack;
|
||||||
qboolean forcelink;
|
qboolean forcelink;
|
||||||
@@ -565,7 +565,7 @@ CL_ParseQuakeParticles
|
|||||||
|
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void CL_ParseQuakeParticle( sizebuf_t *msg )
|
void CL_ParseQuakeParticle( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int count, color;
|
int count, color;
|
||||||
vec3_t org, dir;
|
vec3_t org, dir;
|
||||||
@@ -587,7 +587,7 @@ CL_ParseQuakeStaticSound
|
|||||||
|
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
static void CL_ParseQuakeStaticSound( sizebuf_t *msg )
|
void CL_ParseQuakeStaticSound( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int sound_num;
|
int sound_num;
|
||||||
float vol, attn;
|
float vol, attn;
|
||||||
@@ -816,7 +816,7 @@ CL_QuakeStuffText
|
|||||||
|
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void CL_QuakeStuffText( const char *text )
|
void CL_QuakeStuffText( const char *text )
|
||||||
{
|
{
|
||||||
Q_strncat( cmd_buf, text, sizeof( cmd_buf ));
|
Q_strncat( cmd_buf, text, sizeof( cmd_buf ));
|
||||||
|
|
||||||
@@ -831,7 +831,7 @@ CL_QuakeExecStuff
|
|||||||
|
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void CL_QuakeExecStuff( void )
|
void CL_QuakeExecStuff( void )
|
||||||
{
|
{
|
||||||
char *text = cmd_buf;
|
char *text = cmd_buf;
|
||||||
char token[256];
|
char token[256];
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ CL_GenericHandle
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static const char *CL_GenericHandle( int fileindex )
|
const char *CL_GenericHandle( int fileindex )
|
||||||
{
|
{
|
||||||
if( fileindex < 0 || fileindex >= MAX_CUSTOM )
|
if( fileindex < 0 || fileindex >= MAX_CUSTOM )
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ VID_WriteOverviewScript
|
|||||||
Create overview script file
|
Create overview script file
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static void VID_WriteOverviewScript( void )
|
void VID_WriteOverviewScript( void )
|
||||||
{
|
{
|
||||||
ref_overview_t *ov = &clgame.overView;
|
ref_overview_t *ov = &clgame.overView;
|
||||||
string filename;
|
string filename;
|
||||||
@@ -288,9 +288,6 @@ void SCR_MakeScreenShot( void )
|
|||||||
qboolean iRet = false;
|
qboolean iRet = false;
|
||||||
int viewsize;
|
int viewsize;
|
||||||
|
|
||||||
if( cls.scrshot_action == scrshot_inactive )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( cls.envshot_viewsize > 0 )
|
if( cls.envshot_viewsize > 0 )
|
||||||
viewsize = cls.envshot_viewsize;
|
viewsize = cls.envshot_viewsize;
|
||||||
else viewsize = cl_envshot_size.value;
|
else viewsize = cl_envshot_size.value;
|
||||||
@@ -322,6 +319,8 @@ void SCR_MakeScreenShot( void )
|
|||||||
if( iRet )
|
if( iRet )
|
||||||
VID_WriteOverviewScript(); // store overview script too
|
VID_WriteOverviewScript(); // store overview script too
|
||||||
break;
|
break;
|
||||||
|
case scrshot_inactive:
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// report
|
// report
|
||||||
@@ -345,7 +344,7 @@ void SCR_MakeScreenShot( void )
|
|||||||
SCR_DrawPlaque
|
SCR_DrawPlaque
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void SCR_DrawPlaque( void )
|
void SCR_DrawPlaque( void )
|
||||||
{
|
{
|
||||||
if(( cl_allow_levelshots.value && !cls.changelevel ) || cl.background )
|
if(( cl_allow_levelshots.value && !cls.changelevel ) || cl.background )
|
||||||
{
|
{
|
||||||
@@ -416,7 +415,7 @@ void SCR_EndLoadingPlaque( void )
|
|||||||
SCR_AddDirtyPoint
|
SCR_AddDirtyPoint
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void SCR_AddDirtyPoint( int x, int y )
|
void SCR_AddDirtyPoint( int x, int y )
|
||||||
{
|
{
|
||||||
if( x < scr_dirty.x1 ) scr_dirty.x1 = x;
|
if( x < scr_dirty.x1 ) scr_dirty.x1 = x;
|
||||||
if( x > scr_dirty.x2 ) scr_dirty.x2 = x;
|
if( x > scr_dirty.x2 ) scr_dirty.x2 = x;
|
||||||
@@ -573,15 +572,15 @@ void SCR_LoadCreditsFont( void )
|
|||||||
"creditsfont_%s.fnt", Cvar_VariableString( "con_charset" )) > 0 )
|
"creditsfont_%s.fnt", Cvar_VariableString( "con_charset" )) > 0 )
|
||||||
{
|
{
|
||||||
if( FS_FileExists( charsetFnt, false ))
|
if( FS_FileExists( charsetFnt, false ))
|
||||||
success = Con_LoadVariableWidthFont( charsetFnt, font, scale, &hud_fontrender, TF_FONT );
|
success = Con_LoadVariableWidthFont( charsetFnt, font, scale, kRenderTransAdd, TF_FONT );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !success )
|
if( !success )
|
||||||
success = Con_LoadVariableWidthFont( "gfx/creditsfont.fnt", font, scale, &hud_fontrender, TF_FONT );
|
success = Con_LoadVariableWidthFont( "gfx/creditsfont.fnt", font, scale, kRenderTransAdd, TF_FONT );
|
||||||
|
|
||||||
if( !success )
|
if( !success )
|
||||||
success = Con_LoadFixedWidthFont( "gfx/conchars", font, scale, &hud_fontrender, TF_FONT );
|
success = Con_LoadFixedWidthFont( "gfx/conchars", font, scale, kRenderTransAdd, TF_FONT );
|
||||||
|
|
||||||
// copy font size for client.dll
|
// copy font size for client.dll
|
||||||
if( success )
|
if( success )
|
||||||
@@ -603,7 +602,7 @@ SCR_InstallParticlePalette
|
|||||||
INTERNAL RESOURCE
|
INTERNAL RESOURCE
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void SCR_InstallParticlePalette( void )
|
void SCR_InstallParticlePalette( void )
|
||||||
{
|
{
|
||||||
rgbdata_t *pic;
|
rgbdata_t *pic;
|
||||||
int i;
|
int i;
|
||||||
@@ -649,21 +648,21 @@ void SCR_RegisterTextures( void )
|
|||||||
// register gfx.wad images
|
// register gfx.wad images
|
||||||
|
|
||||||
if( FS_FileExists( "gfx/paused.lmp", false ))
|
if( FS_FileExists( "gfx/paused.lmp", false ))
|
||||||
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/paused.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST );
|
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/paused.lmp", NULL, 0, TF_IMAGE );
|
||||||
else if( FS_FileExists( "gfx/pause.lmp", false ))
|
else if( FS_FileExists( "gfx/pause.lmp", false ))
|
||||||
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/pause.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST );
|
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/pause.lmp", NULL, 0, TF_IMAGE );
|
||||||
|
|
||||||
if( FS_FileExists( "gfx/lambda.lmp", false ))
|
if( FS_FileExists( "gfx/lambda.lmp", false ))
|
||||||
{
|
{
|
||||||
if( cl_allow_levelshots.value )
|
if( cl_allow_levelshots.value )
|
||||||
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE|TF_ALLOW_NEAREST );
|
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE );
|
||||||
else cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST );
|
else cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE );
|
||||||
}
|
}
|
||||||
else if( FS_FileExists( "gfx/loading.lmp", false ))
|
else if( FS_FileExists( "gfx/loading.lmp", false ))
|
||||||
{
|
{
|
||||||
if( cl_allow_levelshots.value )
|
if( cl_allow_levelshots.value )
|
||||||
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE|TF_ALLOW_NEAREST );
|
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE );
|
||||||
else cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST );
|
else cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE );
|
||||||
}
|
}
|
||||||
|
|
||||||
cls.tileImage = ref.dllFuncs.GL_LoadTexture( "gfx/backtile.lmp", NULL, 0, TF_NOMIPMAP );
|
cls.tileImage = ref.dllFuncs.GL_LoadTexture( "gfx/backtile.lmp", NULL, 0, TF_NOMIPMAP );
|
||||||
@@ -676,7 +675,7 @@ SCR_SizeUp_f
|
|||||||
Keybinding command
|
Keybinding command
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void SCR_SizeUp_f( void )
|
void SCR_SizeUp_f( void )
|
||||||
{
|
{
|
||||||
Cvar_SetValue( "viewsize", Q_min( scr_viewsize.value + 10, 120 ));
|
Cvar_SetValue( "viewsize", Q_min( scr_viewsize.value + 10, 120 ));
|
||||||
}
|
}
|
||||||
@@ -689,7 +688,7 @@ SCR_SizeDown_f
|
|||||||
Keybinding command
|
Keybinding command
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void SCR_SizeDown_f( void )
|
void SCR_SizeDown_f( void )
|
||||||
{
|
{
|
||||||
Cvar_SetValue( "viewsize", Q_max( scr_viewsize.value - 10, 30 ));
|
Cvar_SetValue( "viewsize", Q_max( scr_viewsize.value - 10, 30 ));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,35 @@ const char *cl_default_sprites[] =
|
|||||||
"sprites/shellchrome.spr",
|
"sprites/shellchrome.spr",
|
||||||
};
|
};
|
||||||
|
|
||||||
static void CL_PlayerDecal( int playerIndex, int textureIndex, int entityIndex, float *pos );
|
const char *cl_player_shell_sounds[] =
|
||||||
|
{
|
||||||
|
"player/pl_shell1.wav",
|
||||||
|
"player/pl_shell2.wav",
|
||||||
|
"player/pl_shell3.wav",
|
||||||
|
};
|
||||||
|
|
||||||
|
const char *cl_weapon_shell_sounds[] =
|
||||||
|
{
|
||||||
|
"weapons/sshell1.wav",
|
||||||
|
"weapons/sshell2.wav",
|
||||||
|
"weapons/sshell3.wav",
|
||||||
|
};
|
||||||
|
|
||||||
|
const char *cl_ricochet_sounds[] =
|
||||||
|
{
|
||||||
|
"weapons/ric1.wav",
|
||||||
|
"weapons/ric2.wav",
|
||||||
|
"weapons/ric3.wav",
|
||||||
|
"weapons/ric4.wav",
|
||||||
|
"weapons/ric5.wav",
|
||||||
|
};
|
||||||
|
|
||||||
|
const char *cl_explode_sounds[] =
|
||||||
|
{
|
||||||
|
"weapons/explode3.wav",
|
||||||
|
"weapons/explode4.wav",
|
||||||
|
"weapons/explode5.wav",
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
@@ -118,7 +146,6 @@ client resources not precached by server
|
|||||||
*/
|
*/
|
||||||
void CL_AddClientResources( void )
|
void CL_AddClientResources( void )
|
||||||
{
|
{
|
||||||
const char *snd;
|
|
||||||
char filepath[MAX_QPATH];
|
char filepath[MAX_QPATH];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -134,37 +161,37 @@ void CL_AddClientResources( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// then check sounds
|
// then check sounds
|
||||||
for( i = 0; ( snd = SoundList_Get( BouncePlayerShell, i )); i++ )
|
for( i = 0; i < ARRAYSIZE( cl_player_shell_sounds ); i++ )
|
||||||
{
|
{
|
||||||
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", snd );
|
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", cl_player_shell_sounds[i] );
|
||||||
|
|
||||||
if( !FS_FileExists( filepath, false ))
|
if( !FS_FileExists( filepath, false ))
|
||||||
CL_AddClientResource( snd, t_sound );
|
CL_AddClientResource( cl_player_shell_sounds[i], t_sound );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i = 0; ( snd = SoundList_Get( BounceWeaponShell, i )); i++ )
|
for( i = 0; i < ARRAYSIZE( cl_weapon_shell_sounds ); i++ )
|
||||||
{
|
{
|
||||||
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", snd );
|
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", cl_weapon_shell_sounds[i] );
|
||||||
|
|
||||||
if( !FS_FileExists( filepath, false ))
|
if( !FS_FileExists( filepath, false ))
|
||||||
CL_AddClientResource( snd, t_sound );
|
CL_AddClientResource( cl_weapon_shell_sounds[i], t_sound );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i = 0; ( snd = SoundList_Get( Explode, i )); i++ )
|
for( i = 0; i < ARRAYSIZE( cl_explode_sounds ); i++ )
|
||||||
{
|
{
|
||||||
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", snd );
|
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", cl_explode_sounds[i] );
|
||||||
|
|
||||||
if( !FS_FileExists( filepath, false ))
|
if( !FS_FileExists( filepath, false ))
|
||||||
CL_AddClientResource( snd, t_sound );
|
CL_AddClientResource( cl_explode_sounds[i], t_sound );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 // ric sounds was precached by server-side
|
#if 0 // ric sounds was precached by server-side
|
||||||
for( i = 0; ( snd = SoundList_Get( Ricochet, i )); i++ )
|
for( i = 0; i < ARRAYSIZE( cl_ricochet_sounds ); i++ )
|
||||||
{
|
{
|
||||||
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", snd );
|
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", cl_ricochet_sounds[i] );
|
||||||
|
|
||||||
if( !FS_FileExists( filepath, false ))
|
if( !FS_FileExists( filepath, false ))
|
||||||
CL_AddClientResource( snd, t_sound );
|
CL_AddClientResource( cl_ricochet_sounds[i], t_sound );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -228,7 +255,7 @@ CL_PrepareTEnt
|
|||||||
set default values
|
set default values
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static void CL_PrepareTEnt( TEMPENTITY *pTemp, model_t *pmodel )
|
void CL_PrepareTEnt( TEMPENTITY *pTemp, model_t *pmodel )
|
||||||
{
|
{
|
||||||
int frameCount = 0;
|
int frameCount = 0;
|
||||||
int modelIndex = 0;
|
int modelIndex = 0;
|
||||||
@@ -269,10 +296,10 @@ CL_TempEntPlaySound
|
|||||||
play collide sound
|
play collide sound
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp )
|
void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp )
|
||||||
{
|
{
|
||||||
float fvol;
|
float fvol;
|
||||||
const char *soundname = NULL;
|
char soundname[32];
|
||||||
qboolean isshellcasing = false;
|
qboolean isshellcasing = false;
|
||||||
int zvel;
|
int zvel;
|
||||||
|
|
||||||
@@ -283,39 +310,36 @@ static void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp )
|
|||||||
switch( pTemp->hitSound )
|
switch( pTemp->hitSound )
|
||||||
{
|
{
|
||||||
case BOUNCE_GLASS:
|
case BOUNCE_GLASS:
|
||||||
soundname = SoundList_GetRandom( BounceGlass );
|
Q_snprintf( soundname, sizeof( soundname ), "debris/glass%i.wav", COM_RandomLong( 1, 4 ));
|
||||||
break;
|
break;
|
||||||
case BOUNCE_METAL:
|
case BOUNCE_METAL:
|
||||||
soundname = SoundList_GetRandom( BounceMetal );
|
Q_snprintf( soundname, sizeof( soundname ), "debris/metal%i.wav", COM_RandomLong( 1, 6 ));
|
||||||
break;
|
break;
|
||||||
case BOUNCE_FLESH:
|
case BOUNCE_FLESH:
|
||||||
soundname = SoundList_GetRandom( BounceFlesh );
|
Q_snprintf( soundname, sizeof( soundname ), "debris/flesh%i.wav", COM_RandomLong( 1, 7 ));
|
||||||
break;
|
break;
|
||||||
case BOUNCE_WOOD:
|
case BOUNCE_WOOD:
|
||||||
soundname = SoundList_GetRandom( BounceWood );
|
Q_snprintf( soundname, sizeof( soundname ), "debris/wood%i.wav", COM_RandomLong( 1, 4 ));
|
||||||
break;
|
break;
|
||||||
case BOUNCE_SHRAP:
|
case BOUNCE_SHRAP:
|
||||||
soundname = SoundList_GetRandom( Ricochet );
|
Q_strncpy( soundname, cl_ricochet_sounds[COM_RandomLong( 0, 4 )], sizeof( soundname ) );
|
||||||
break;
|
break;
|
||||||
case BOUNCE_SHOTSHELL:
|
case BOUNCE_SHOTSHELL:
|
||||||
soundname = SoundList_GetRandom( BounceWeaponShell );
|
Q_strncpy( soundname, cl_weapon_shell_sounds[COM_RandomLong( 0, 2 )], sizeof( soundname ) );
|
||||||
isshellcasing = true; // shell casings have different playback parameters
|
isshellcasing = true; // shell casings have different playback parameters
|
||||||
fvol = 0.5f;
|
fvol = 0.5f;
|
||||||
break;
|
break;
|
||||||
case BOUNCE_SHELL:
|
case BOUNCE_SHELL:
|
||||||
soundname = SoundList_GetRandom( BouncePlayerShell );
|
Q_strncpy( soundname, cl_player_shell_sounds[COM_RandomLong( 0, 2 )], sizeof( soundname ) );
|
||||||
isshellcasing = true; // shell casings have different playback parameters
|
isshellcasing = true; // shell casings have different playback parameters
|
||||||
break;
|
break;
|
||||||
case BOUNCE_CONCRETE:
|
case BOUNCE_CONCRETE:
|
||||||
soundname = SoundList_GetRandom( BounceConcrete );
|
Q_snprintf( soundname, sizeof( soundname ), "debris/concrete%i.wav", COM_RandomLong( 1, 3 ));
|
||||||
break;
|
break;
|
||||||
default: // null sound
|
default: // null sound
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !soundname )
|
|
||||||
return;
|
|
||||||
|
|
||||||
zvel = abs( pTemp->entity.baseline.origin[2] );
|
zvel = abs( pTemp->entity.baseline.origin[2] );
|
||||||
|
|
||||||
// only play one out of every n
|
// only play one out of every n
|
||||||
@@ -356,7 +380,7 @@ CL_TEntAddEntity
|
|||||||
add entity to renderlist
|
add entity to renderlist
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static int CL_TempEntAddEntity( cl_entity_t *pEntity )
|
int CL_TempEntAddEntity( cl_entity_t *pEntity )
|
||||||
{
|
{
|
||||||
vec3_t mins, maxs;
|
vec3_t mins, maxs;
|
||||||
|
|
||||||
@@ -369,7 +393,7 @@ static int CL_TempEntAddEntity( cl_entity_t *pEntity )
|
|||||||
VectorAdd( pEntity->origin, pEntity->model->maxs, maxs );
|
VectorAdd( pEntity->origin, pEntity->model->maxs, maxs );
|
||||||
|
|
||||||
// g-cont. just use PVS from previous frame
|
// g-cont. just use PVS from previous frame
|
||||||
if( TriBoxInPVS( mins, maxs ))
|
if( Mod_BoxVisible( mins, maxs, ref.dllFuncs.Mod_GetCurrentVis( )))
|
||||||
{
|
{
|
||||||
VectorCopy( pEntity->angles, pEntity->curstate.angles );
|
VectorCopy( pEntity->angles, pEntity->curstate.angles );
|
||||||
VectorCopy( pEntity->origin, pEntity->curstate.origin );
|
VectorCopy( pEntity->origin, pEntity->curstate.origin );
|
||||||
@@ -408,7 +432,7 @@ CL_TEntAddEntity
|
|||||||
free the first low priority tempent it finds.
|
free the first low priority tempent it finds.
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static qboolean CL_FreeLowPriorityTempEnt( void )
|
qboolean CL_FreeLowPriorityTempEnt( void )
|
||||||
{
|
{
|
||||||
TEMPENTITY *pActive = cl_active_tents;
|
TEMPENTITY *pActive = cl_active_tents;
|
||||||
TEMPENTITY *pPrev = NULL;
|
TEMPENTITY *pPrev = NULL;
|
||||||
@@ -999,8 +1023,12 @@ void GAME_EXPORT R_BreakModel( const vec3_t pos, const vec3_t size, const vec3_t
|
|||||||
count = (size[0] * size[1] + size[1] * size[2] + size[2] * size[0]) / (3 * SHARD_VOLUME * SHARD_VOLUME);
|
count = (size[0] * size[1] + size[1] * size[2] + size[2] * size[0]) / (3 * SHARD_VOLUME * SHARD_VOLUME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if XASH_PSP
|
||||||
|
if( count > 15 ) count = 15;
|
||||||
|
#else
|
||||||
// limit to 100 pieces
|
// limit to 100 pieces
|
||||||
if( count > 100 ) count = 100;
|
if( count > 100 ) count = 100;
|
||||||
|
#endif
|
||||||
|
|
||||||
for( i = 0; i < count; i++ )
|
for( i = 0; i < count; i++ )
|
||||||
{
|
{
|
||||||
@@ -1465,7 +1493,7 @@ void GAME_EXPORT R_FunnelSprite( const vec3_t org, int modelIndex, int reverse )
|
|||||||
===============
|
===============
|
||||||
R_SparkEffect
|
R_SparkEffect
|
||||||
|
|
||||||
Create a streaks + ricochet sprite
|
Create a streaks + richochet sprite
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void GAME_EXPORT R_SparkEffect( const vec3_t pos, int count, int velocityMin, int velocityMax )
|
void GAME_EXPORT R_SparkEffect( const vec3_t pos, int count, int velocityMin, int velocityMax )
|
||||||
@@ -1481,25 +1509,18 @@ R_RicochetSound
|
|||||||
Make a random ricochet sound
|
Make a random ricochet sound
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static void R_RicochetSoundByName( const vec3_t pos, const char *name )
|
static void R_RicochetSound_( const vec3_t pos, int sound )
|
||||||
{
|
{
|
||||||
sound_t handle;
|
sound_t handle;
|
||||||
handle = S_RegisterSound( name );
|
|
||||||
S_StartSound( pos, 0, CHAN_AUTO, handle, VOL_NORM, 1.0, 100, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
static void R_RicochetSoundByIndex( const vec3_t pos, int idx )
|
handle = S_RegisterSound( cl_ricochet_sounds[sound] );
|
||||||
{
|
|
||||||
const char *name = SoundList_Get( Ricochet, idx );
|
S_StartSound( pos, 0, CHAN_AUTO, handle, VOL_NORM, 1.0, 100, 0 );
|
||||||
if( name )
|
|
||||||
R_RicochetSoundByName( pos, name );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GAME_EXPORT R_RicochetSound( const vec3_t pos )
|
void GAME_EXPORT R_RicochetSound( const vec3_t pos )
|
||||||
{
|
{
|
||||||
const char *name = SoundList_GetRandom( Ricochet );
|
R_RicochetSound_( pos, COM_RandomLong( 0, 4 ));
|
||||||
if( name )
|
|
||||||
R_RicochetSoundByName( pos, name );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1646,12 +1667,8 @@ void GAME_EXPORT R_Explosion( vec3_t pos, int model, float scale, float framerat
|
|||||||
|
|
||||||
if( !FBitSet( flags, TE_EXPLFLAG_NOSOUND ))
|
if( !FBitSet( flags, TE_EXPLFLAG_NOSOUND ))
|
||||||
{
|
{
|
||||||
const char *name = SoundList_GetRandom( Explode );
|
hSound = S_RegisterSound( cl_explode_sounds[COM_RandomLong( 0, 2 )] );
|
||||||
if( name )
|
S_StartSound( pos, 0, CHAN_STATIC, hSound, VOL_NORM, 0.3f, PITCH_NORM, 0 );
|
||||||
{
|
|
||||||
hSound = S_RegisterSound( name );
|
|
||||||
S_StartSound( pos, 0, CHAN_STATIC, hSound, VOL_NORM, 0.3f, PITCH_NORM, 0 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1894,7 +1911,6 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||||||
cl_entity_t *pEnt;
|
cl_entity_t *pEnt;
|
||||||
dlight_t *dl;
|
dlight_t *dl;
|
||||||
sound_t hSound;
|
sound_t hSound;
|
||||||
const char *name;
|
|
||||||
|
|
||||||
if( cls.legacymode )
|
if( cls.legacymode )
|
||||||
iSize = MSG_ReadByte( msg );
|
iSize = MSG_ReadByte( msg );
|
||||||
@@ -1954,11 +1970,8 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||||||
pos[2] = MSG_ReadCoord( &buf );
|
pos[2] = MSG_ReadCoord( &buf );
|
||||||
R_BlobExplosion( pos );
|
R_BlobExplosion( pos );
|
||||||
|
|
||||||
if(( name = SoundList_Get( Explode, 0 )))
|
hSound = S_RegisterSound( cl_explode_sounds[0] );
|
||||||
{
|
S_StartSound( pos, -1, CHAN_AUTO, hSound, VOL_NORM, 1.0f, PITCH_NORM, 0 );
|
||||||
hSound = S_RegisterSound( name );
|
|
||||||
S_StartSound( pos, -1, CHAN_AUTO, hSound, VOL_NORM, 1.0f, PITCH_NORM, 0 );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case TE_SMOKE:
|
case TE_SMOKE:
|
||||||
pos[0] = MSG_ReadCoord( &buf );
|
pos[0] = MSG_ReadCoord( &buf );
|
||||||
@@ -2011,11 +2024,8 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||||||
dl->die = cl.time + 0.5;
|
dl->die = cl.time + 0.5;
|
||||||
dl->decay = 300;
|
dl->decay = 300;
|
||||||
|
|
||||||
if(( name = SoundList_Get( Explode, 0 )))
|
hSound = S_RegisterSound( cl_explode_sounds[0] );
|
||||||
{
|
S_StartSound( pos, -1, CHAN_AUTO, hSound, VOL_NORM, 0.6f, PITCH_NORM, 0 );
|
||||||
hSound = S_RegisterSound( name );
|
|
||||||
S_StartSound( pos, -1, CHAN_AUTO, hSound, VOL_NORM, 1.0f, PITCH_NORM, 0 );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case TE_BSPDECAL:
|
case TE_BSPDECAL:
|
||||||
case TE_DECAL:
|
case TE_DECAL:
|
||||||
@@ -2243,8 +2253,8 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||||||
CL_DecalShoot( CL_DecalIndex( decalIndex ), entityIndex, 0, pos, 0 );
|
CL_DecalShoot( CL_DecalIndex( decalIndex ), entityIndex, 0, pos, 0 );
|
||||||
R_BulletImpactParticles( pos );
|
R_BulletImpactParticles( pos );
|
||||||
flags = COM_RandomLong( 0, 0x7fff );
|
flags = COM_RandomLong( 0, 0x7fff );
|
||||||
if( flags < 0x3fff && ( count = SoundList_Count( Ricochet )))
|
if( flags < 0x3fff )
|
||||||
R_RicochetSoundByIndex( pos, flags % count );
|
R_RicochetSound_( pos, flags % 5 );
|
||||||
break;
|
break;
|
||||||
case TE_SPRAY:
|
case TE_SPRAY:
|
||||||
case TE_SPRITE_SPRAY:
|
case TE_SPRITE_SPRAY:
|
||||||
@@ -2408,7 +2418,7 @@ LIGHT STYLE MANAGEMENT
|
|||||||
CL_ClearLightStyles
|
CL_ClearLightStyles
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void CL_ClearLightStyles( void )
|
void CL_ClearLightStyles( void )
|
||||||
{
|
{
|
||||||
memset( cl.lightstyles, 0, sizeof( cl.lightstyles ));
|
memset( cl.lightstyles, 0, sizeof( cl.lightstyles ));
|
||||||
}
|
}
|
||||||
@@ -2466,7 +2476,7 @@ dlight_t cl_elights[MAX_ELIGHTS];
|
|||||||
CL_ClearDlights
|
CL_ClearDlights
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void CL_ClearDlights( void )
|
void CL_ClearDlights( void )
|
||||||
{
|
{
|
||||||
memset( cl_dlights, 0, sizeof( cl_dlights ));
|
memset( cl_dlights, 0, sizeof( cl_dlights ));
|
||||||
memset( cl_elights, 0, sizeof( cl_elights ));
|
memset( cl_elights, 0, sizeof( cl_elights ));
|
||||||
@@ -2913,7 +2923,7 @@ CL_PlayerDecal
|
|||||||
spray custom colored decal (clan logo etc)
|
spray custom colored decal (clan logo etc)
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static void CL_PlayerDecal( int playernum, int customIndex, int entityIndex, float *pos )
|
void CL_PlayerDecal( int playernum, int customIndex, int entityIndex, float *pos )
|
||||||
{
|
{
|
||||||
int textureIndex = 0;
|
int textureIndex = 0;
|
||||||
customization_t *pCust = NULL;
|
customization_t *pCust = NULL;
|
||||||
|
|||||||
@@ -101,19 +101,6 @@ struct beam_s *R_BeamRing( int startEnt, int endEnt, int modelIndex, float life,
|
|||||||
struct beam_s *R_BeamFollow( int startEnt, int modelIndex, float life, float width, float r, float g, float b, float brightness );
|
struct beam_s *R_BeamFollow( int startEnt, int modelIndex, float life, float width, float r, float g, float b, float brightness );
|
||||||
void R_BeamKill( int deadEntity );
|
void R_BeamKill( int deadEntity );
|
||||||
|
|
||||||
|
|
||||||
// TriAPI
|
|
||||||
void TriRenderMode( int mode );
|
|
||||||
void TriColor4f( float r, float g, float b, float a );
|
|
||||||
void TriColor4ub( byte r, byte g, byte b, byte a );
|
|
||||||
void TriBrightness( float brightness );
|
|
||||||
void TriCullFace( TRICULLSTYLE mode );
|
|
||||||
int TriWorldToScreen( const float *world, float *screen );
|
|
||||||
int TriBoxInPVS( float *mins, float *maxs );
|
|
||||||
void TriLightAtPoint( float *pos, float *value );
|
|
||||||
void TriColor4fRendermode( float r, float g, float b, float a, int rendermode );
|
|
||||||
int TriSpriteTexture( model_t *pSpriteModel, int frame );
|
|
||||||
|
|
||||||
extern model_t *cl_sprite_dot;
|
extern model_t *cl_sprite_dot;
|
||||||
extern model_t *cl_sprite_shell;
|
extern model_t *cl_sprite_shell;
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ qboolean SCR_NextMovie( void )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SCR_CreateStartupVids( void )
|
void SCR_CreateStartupVids( void )
|
||||||
{
|
{
|
||||||
file_t *f;
|
file_t *f;
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ V_CalcViewRect
|
|||||||
calc frame rectangle (Quake1 style)
|
calc frame rectangle (Quake1 style)
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static void V_CalcViewRect( void )
|
void V_CalcViewRect( void )
|
||||||
{
|
{
|
||||||
qboolean full = false;
|
qboolean full = false;
|
||||||
int sb_lines;
|
int sb_lines;
|
||||||
@@ -88,7 +88,7 @@ static void V_CalcViewRect( void )
|
|||||||
V_SetupViewModel
|
V_SetupViewModel
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static void V_SetupViewModel( void )
|
void V_SetupViewModel( void )
|
||||||
{
|
{
|
||||||
cl_entity_t *view = &clgame.viewent;
|
cl_entity_t *view = &clgame.viewent;
|
||||||
player_info_t *info = &cl.players[cl.playernum];
|
player_info_t *info = &cl.players[cl.playernum];
|
||||||
@@ -118,7 +118,7 @@ static void V_SetupViewModel( void )
|
|||||||
V_SetRefParams
|
V_SetRefParams
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static void V_SetRefParams( ref_params_t *fd )
|
void V_SetRefParams( ref_params_t *fd )
|
||||||
{
|
{
|
||||||
memset( fd, 0, sizeof( ref_params_t ));
|
memset( fd, 0, sizeof( ref_params_t ));
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ V_MergeOverviewRefdef
|
|||||||
merge refdef with overview settings
|
merge refdef with overview settings
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static void V_RefApplyOverview( ref_viewpass_t *rvp )
|
void V_RefApplyOverview( ref_viewpass_t *rvp )
|
||||||
{
|
{
|
||||||
ref_overview_t *ov = &clgame.overView;
|
ref_overview_t *ov = &clgame.overView;
|
||||||
float aspect;
|
float aspect;
|
||||||
@@ -281,7 +281,7 @@ static void V_AdjustFov( float *fov_x, float *fov_y, float width, float height,
|
|||||||
V_GetRefParams
|
V_GetRefParams
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void V_GetRefParams( ref_params_t *fd, ref_viewpass_t *rvp )
|
void V_GetRefParams( ref_params_t *fd, ref_viewpass_t *rvp )
|
||||||
{
|
{
|
||||||
// part1: deniable updates
|
// part1: deniable updates
|
||||||
VectorCopy( fd->simvel, cl.simvel );
|
VectorCopy( fd->simvel, cl.simvel );
|
||||||
@@ -408,22 +408,22 @@ void V_RenderView( void )
|
|||||||
#define NODE_INTERVAL_X(x) (x * 16.0f)
|
#define NODE_INTERVAL_X(x) (x * 16.0f)
|
||||||
#define NODE_INTERVAL_Y(x) (x * 16.0f)
|
#define NODE_INTERVAL_Y(x) (x * 16.0f)
|
||||||
|
|
||||||
static void R_DrawLeafNode( float x, float y, float scale )
|
void R_DrawLeafNode( float x, float y, float scale )
|
||||||
{
|
{
|
||||||
float downScale = scale * 0.25f;// * POINT_SIZE;
|
float downScale = scale * 0.25f;// * POINT_SIZE;
|
||||||
|
|
||||||
ref.dllFuncs.R_DrawStretchPic( x - downScale * 0.5f, y - downScale * 0.5f, downScale, downScale, 0, 0, 1, 1, R_GetBuiltinTexture( REF_PARTICLE_TEXTURE ) );
|
ref.dllFuncs.R_DrawStretchPic( x - downScale * 0.5f, y - downScale * 0.5f, downScale, downScale, 0, 0, 1, 1, R_GetBuiltinTexture( REF_PARTICLE_TEXTURE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void R_DrawNodeConnection( float x, float y, float x2, float y2 )
|
void R_DrawNodeConnection( float x, float y, float x2, float y2 )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.Begin( TRI_LINES );
|
gTriApi.Begin( TRI_LINES );
|
||||||
ref.dllFuncs.Vertex3f( x, y, 0 );
|
gTriApi.Vertex3f( x, y, 0 );
|
||||||
ref.dllFuncs.Vertex3f( x2, y2, 0 );
|
gTriApi.Vertex3f( x2, y2, 0 );
|
||||||
ref.dllFuncs.End( );
|
gTriApi.End( );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void R_ShowTree_r( mnode_t *node, float x, float y, float scale, int shownodes, mleaf_t *viewleaf )
|
void R_ShowTree_r( mnode_t *node, float x, float y, float scale, int shownodes, mleaf_t *viewleaf )
|
||||||
{
|
{
|
||||||
float downScale = scale * 0.8f;
|
float downScale = scale * 0.8f;
|
||||||
|
|
||||||
@@ -443,10 +443,10 @@ static void R_ShowTree_r( mnode_t *node, float x, float y, float scale, int show
|
|||||||
if( shownodes == 1 )
|
if( shownodes == 1 )
|
||||||
{
|
{
|
||||||
if( cl.worldmodel->leafs == leaf )
|
if( cl.worldmodel->leafs == leaf )
|
||||||
ref.dllFuncs.Color4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
gTriApi.Color4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||||
else if( viewleaf && viewleaf == leaf )
|
else if( viewleaf && viewleaf == leaf )
|
||||||
ref.dllFuncs.Color4f( 1.0f, 0.0f, 0.0f, 1.0f );
|
gTriApi.Color4f( 1.0f, 0.0f, 0.0f, 1.0f );
|
||||||
else ref.dllFuncs.Color4f( 0.0f, 1.0f, 0.0f, 1.0f );
|
else gTriApi.Color4f( 0.0f, 1.0f, 0.0f, 1.0f );
|
||||||
R_DrawLeafNode( x, y, scale );
|
R_DrawLeafNode( x, y, scale );
|
||||||
}
|
}
|
||||||
world.recursion_level--;
|
world.recursion_level--;
|
||||||
@@ -455,7 +455,7 @@ static void R_ShowTree_r( mnode_t *node, float x, float y, float scale, int show
|
|||||||
|
|
||||||
if( shownodes == 1 )
|
if( shownodes == 1 )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.Color4f( 0.0f, 0.0f, 1.0f, 1.0f );
|
gTriApi.Color4f( 0.0f, 0.0f, 1.0f, 1.0f );
|
||||||
R_DrawLeafNode( x, y, scale );
|
R_DrawLeafNode( x, y, scale );
|
||||||
}
|
}
|
||||||
else if( shownodes == 2 )
|
else if( shownodes == 2 )
|
||||||
@@ -470,7 +470,7 @@ static void R_ShowTree_r( mnode_t *node, float x, float y, float scale, int show
|
|||||||
world.recursion_level--;
|
world.recursion_level--;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void R_ShowTree( void )
|
void R_ShowTree( void )
|
||||||
{
|
{
|
||||||
float x = (float)((refState.width - (int)POINT_SIZE) >> 1);
|
float x = (float)((refState.width - (int)POINT_SIZE) >> 1);
|
||||||
float y = NODE_INTERVAL_Y(1.0f);
|
float y = NODE_INTERVAL_Y(1.0f);
|
||||||
@@ -487,7 +487,7 @@ static void R_ShowTree( void )
|
|||||||
//pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
//pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||||
|
|
||||||
//pglLineWidth( 2.0f );
|
//pglLineWidth( 2.0f );
|
||||||
ref.dllFuncs.Color4f( 1, 0.7f, 0, 1.0f );
|
gTriApi.Color4f( 1, 0.7f, 0, 1.0f );
|
||||||
//pglDisable( GL_TEXTURE_2D );
|
//pglDisable( GL_TEXTURE_2D );
|
||||||
R_ShowTree_r( cl.worldmodel->nodes, x, y, world.max_recursion * 3.5f, 2, viewleaf );
|
R_ShowTree_r( cl.worldmodel->nodes, x, y, world.max_recursion * 3.5f, 2, viewleaf );
|
||||||
//pglEnable( GL_TEXTURE_2D );
|
//pglEnable( GL_TEXTURE_2D );
|
||||||
@@ -553,6 +553,4 @@ void V_PostRender( void )
|
|||||||
ref.dllFuncs.R_AllowFog( true );
|
ref.dllFuncs.R_AllowFog( true );
|
||||||
Platform_SetTimer( 0.0f );
|
Platform_SetTimer( 0.0f );
|
||||||
ref.dllFuncs.R_EndFrame();
|
ref.dllFuncs.R_EndFrame();
|
||||||
|
|
||||||
V_CheckGammaEnd();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -342,7 +342,8 @@ typedef struct
|
|||||||
byte charWidths[256]; // scaled widths
|
byte charWidths[256]; // scaled widths
|
||||||
int charHeight; // scaled height
|
int charHeight; // scaled height
|
||||||
int type; // fixed width font or variable
|
int type; // fixed width font or variable
|
||||||
convar_t *rendermode; // user-defined default rendermode
|
int rendermode; // default rendermode
|
||||||
|
qboolean nearest; // nearest filtering enabled
|
||||||
qboolean valid; // all rectangles are valid
|
qboolean valid; // all rectangles are valid
|
||||||
} cl_font_t;
|
} cl_font_t;
|
||||||
|
|
||||||
@@ -369,7 +370,6 @@ typedef struct
|
|||||||
// holds text color
|
// holds text color
|
||||||
rgba_t textColor;
|
rgba_t textColor;
|
||||||
rgba_t spriteColor;
|
rgba_t spriteColor;
|
||||||
vec4_t triRGBA;
|
|
||||||
|
|
||||||
// crosshair members
|
// crosshair members
|
||||||
const model_t *pCrosshair;
|
const model_t *pCrosshair;
|
||||||
@@ -681,14 +681,11 @@ extern convar_t cl_draw_beams;
|
|||||||
extern convar_t cl_clockreset;
|
extern convar_t cl_clockreset;
|
||||||
extern convar_t cl_fixtimerate;
|
extern convar_t cl_fixtimerate;
|
||||||
extern convar_t hud_fontscale;
|
extern convar_t hud_fontscale;
|
||||||
extern convar_t hud_fontrender;
|
|
||||||
extern convar_t hud_scale;
|
extern convar_t hud_scale;
|
||||||
extern convar_t hud_scale_minimal_width;
|
|
||||||
extern convar_t r_showtextures;
|
extern convar_t r_showtextures;
|
||||||
extern convar_t cl_bmodelinterp;
|
extern convar_t cl_bmodelinterp;
|
||||||
extern convar_t cl_lw; // local weapons
|
extern convar_t cl_lw; // local weapons
|
||||||
extern convar_t cl_charset;
|
extern convar_t cl_charset;
|
||||||
extern convar_t cl_trace_stufftext;
|
|
||||||
extern convar_t cl_trace_messages;
|
extern convar_t cl_trace_messages;
|
||||||
extern convar_t cl_trace_events;
|
extern convar_t cl_trace_events;
|
||||||
extern convar_t hud_utf8;
|
extern convar_t hud_utf8;
|
||||||
@@ -707,6 +704,7 @@ extern convar_t cl_fixmodelinterpolationartifacts;
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
void CL_SetLightstyle( int style, const char* s, float f );
|
void CL_SetLightstyle( int style, const char* s, float f );
|
||||||
|
void CL_RunLightStyles( void );
|
||||||
void CL_DecayLights( void );
|
void CL_DecayLights( void );
|
||||||
dlight_t *CL_GetDynamicLight( int number );
|
dlight_t *CL_GetDynamicLight( int number );
|
||||||
dlight_t *CL_GetEntityLight( int number );
|
dlight_t *CL_GetEntityLight( int number );
|
||||||
@@ -717,8 +715,12 @@ dlight_t *CL_GetEntityLight( int number );
|
|||||||
// cl_cmds.c
|
// cl_cmds.c
|
||||||
//
|
//
|
||||||
void CL_Quit_f( void );
|
void CL_Quit_f( void );
|
||||||
void CL_GenericShot_f( void );
|
void CL_ScreenShot_f( void );
|
||||||
|
void CL_SnapShot_f( void );
|
||||||
void CL_PlayCDTrack_f( void );
|
void CL_PlayCDTrack_f( void );
|
||||||
|
void CL_EnvShot_f( void );
|
||||||
|
void CL_SkyShot_f( void );
|
||||||
|
void CL_SaveShot_f( void );
|
||||||
void CL_LevelShot_f( void );
|
void CL_LevelShot_f( void );
|
||||||
void CL_SetSky_f( void );
|
void CL_SetSky_f( void );
|
||||||
void SCR_Viewpos_f( void );
|
void SCR_Viewpos_f( void );
|
||||||
@@ -739,6 +741,8 @@ void CL_ClearResourceLists( void );
|
|||||||
void CL_Parse_Debug( qboolean enable );
|
void CL_Parse_Debug( qboolean enable );
|
||||||
void CL_Parse_RecordCommand( int cmd, int startoffset );
|
void CL_Parse_RecordCommand( int cmd, int startoffset );
|
||||||
void CL_ResetFrame( frame_t *frame );
|
void CL_ResetFrame( frame_t *frame );
|
||||||
|
void CL_WriteMessageHistory( void );
|
||||||
|
const char *CL_MsgInfo( int cmd );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_efx.c
|
// cl_efx.c
|
||||||
@@ -749,6 +753,7 @@ void CL_Particle( const vec3_t org, int color, float life, int zpos, int zvel );
|
|||||||
// cl_main.c
|
// cl_main.c
|
||||||
//
|
//
|
||||||
void CL_Init( void );
|
void CL_Init( void );
|
||||||
|
void CL_SendCommand( void );
|
||||||
void CL_Disconnect_f( void );
|
void CL_Disconnect_f( void );
|
||||||
void CL_ProcessFile( qboolean successfully_received, const char *filename );
|
void CL_ProcessFile( qboolean successfully_received, const char *filename );
|
||||||
void CL_WriteUsercmd( sizebuf_t *msg, int from, int to );
|
void CL_WriteUsercmd( sizebuf_t *msg, int from, int to );
|
||||||
@@ -757,6 +762,7 @@ qboolean CL_PrecacheResources( void );
|
|||||||
void CL_SetupOverviewParams( void );
|
void CL_SetupOverviewParams( void );
|
||||||
void CL_UpdateFrameLerp( void );
|
void CL_UpdateFrameLerp( void );
|
||||||
int CL_IsDevOverviewMode( void );
|
int CL_IsDevOverviewMode( void );
|
||||||
|
void CL_PingServers_f( void );
|
||||||
void CL_SignonReply( void );
|
void CL_SignonReply( void );
|
||||||
void CL_ClearState( void );
|
void CL_ClearState( void );
|
||||||
|
|
||||||
@@ -774,6 +780,8 @@ void CL_CheckStartupDemos( void );
|
|||||||
void CL_WriteDemoJumpTime( void );
|
void CL_WriteDemoJumpTime( void );
|
||||||
void CL_CloseDemoHeader( void );
|
void CL_CloseDemoHeader( void );
|
||||||
void CL_DemoCompleted( void );
|
void CL_DemoCompleted( void );
|
||||||
|
void CL_StopPlayback( void );
|
||||||
|
void CL_StopRecord( void );
|
||||||
void CL_PlayDemo_f( void );
|
void CL_PlayDemo_f( void );
|
||||||
void CL_TimeDemo_f( void );
|
void CL_TimeDemo_f( void );
|
||||||
void CL_StartDemos_f( void );
|
void CL_StartDemos_f( void );
|
||||||
@@ -781,7 +789,6 @@ void CL_Demos_f( void );
|
|||||||
void CL_DeleteDemo_f( void );
|
void CL_DeleteDemo_f( void );
|
||||||
void CL_Record_f( void );
|
void CL_Record_f( void );
|
||||||
void CL_Stop_f( void );
|
void CL_Stop_f( void );
|
||||||
int CL_GetDemoComment( const char *demoname, char *comment );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_events.c
|
// cl_events.c
|
||||||
@@ -789,9 +796,12 @@ int CL_GetDemoComment( const char *demoname, char *comment );
|
|||||||
void CL_ParseEvent( sizebuf_t *msg );
|
void CL_ParseEvent( sizebuf_t *msg );
|
||||||
void CL_ParseReliableEvent( sizebuf_t *msg );
|
void CL_ParseReliableEvent( sizebuf_t *msg );
|
||||||
void CL_SetEventIndex( const char *szEvName, int ev_index );
|
void CL_SetEventIndex( const char *szEvName, int ev_index );
|
||||||
|
void CL_QueueEvent( int flags, int index, float delay, event_args_t *args );
|
||||||
void CL_PlaybackEvent( int flags, const edict_t *pInvoker, word eventindex, float delay, float *origin,
|
void CL_PlaybackEvent( int flags, const edict_t *pInvoker, word eventindex, float delay, float *origin,
|
||||||
float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
|
float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
|
||||||
void CL_RegisterEvent( int lastnum, const char *szEvName, pfnEventHook func );
|
void CL_RegisterEvent( int lastnum, const char *szEvName, pfnEventHook func );
|
||||||
|
void CL_BatchResourceRequest( qboolean initialize );
|
||||||
|
int CL_EstimateNeededResources( void );
|
||||||
void CL_ResetEvent( event_info_t *ei );
|
void CL_ResetEvent( event_info_t *ei );
|
||||||
word CL_EventIndex( const char *name );
|
word CL_EventIndex( const char *name );
|
||||||
void CL_FireEvents( void );
|
void CL_FireEvents( void );
|
||||||
@@ -800,10 +810,9 @@ void CL_FireEvents( void );
|
|||||||
// cl_font.c
|
// cl_font.c
|
||||||
//
|
//
|
||||||
qboolean CL_FixedFont( cl_font_t *font );
|
qboolean CL_FixedFont( cl_font_t *font );
|
||||||
qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags );
|
qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float scale, int rendermode, uint texFlags );
|
||||||
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags );
|
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, int rendermode, uint texFlags );
|
||||||
void CL_FreeFont( cl_font_t *font );
|
void CL_FreeFont( cl_font_t *font );
|
||||||
void CL_SetFontRendermode( cl_font_t *font );
|
|
||||||
int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *font, int flags );
|
int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *font, int flags );
|
||||||
int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *font, int flags );
|
int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *font, int flags );
|
||||||
void CL_DrawCharacterLen( cl_font_t *font, int number, int *width, int *height );
|
void CL_DrawCharacterLen( cl_font_t *font, int number, int *width, int *height );
|
||||||
@@ -816,7 +825,10 @@ int CL_DrawStringf( cl_font_t *font, float x, float y, rgba_t color, int flags,
|
|||||||
//
|
//
|
||||||
void CL_UnloadProgs( void );
|
void CL_UnloadProgs( void );
|
||||||
qboolean CL_LoadProgs( const char *name );
|
qboolean CL_LoadProgs( const char *name );
|
||||||
|
void CL_ParseUserMessage( sizebuf_t *msg, int svc_num );
|
||||||
void CL_LinkUserMessage( char *pszName, const int svc_num, int iSize );
|
void CL_LinkUserMessage( char *pszName, const int svc_num, int iSize );
|
||||||
|
void CL_ParseFinaleCutscene( sizebuf_t *msg, int level );
|
||||||
|
void CL_ParseTextMessage( sizebuf_t *msg );
|
||||||
void CL_DrawHUD( int state );
|
void CL_DrawHUD( int state );
|
||||||
void CL_InitEdicts( int maxclients );
|
void CL_InitEdicts( int maxclients );
|
||||||
void CL_FreeEdicts( void );
|
void CL_FreeEdicts( void );
|
||||||
@@ -826,38 +838,66 @@ void CL_ClearSpriteTextures( void );
|
|||||||
void CL_CenterPrint( const char *text, float y );
|
void CL_CenterPrint( const char *text, float y );
|
||||||
void CL_TextMessageParse( byte *pMemFile, int fileSize );
|
void CL_TextMessageParse( byte *pMemFile, int fileSize );
|
||||||
client_textmessage_t *CL_TextMessageGet( const char *pName );
|
client_textmessage_t *CL_TextMessageGet( const char *pName );
|
||||||
model_t *CL_ModelHandle( int modelindex );
|
|
||||||
void NetAPI_CancelAllRequests( void );
|
void NetAPI_CancelAllRequests( void );
|
||||||
cl_entity_t *CL_GetLocalPlayer( void );
|
cl_entity_t *CL_GetLocalPlayer( void );
|
||||||
model_t *CL_LoadClientSprite( const char *filename );
|
model_t *CL_LoadClientSprite( const char *filename );
|
||||||
model_t *CL_LoadModel( const char *modelname, int *index );
|
model_t *CL_LoadModel( const char *modelname, int *index );
|
||||||
HSPRITE pfnSPR_LoadExt( const char *szPicName, uint texFlags );
|
HSPRITE pfnSPR_LoadExt( const char *szPicName, uint texFlags );
|
||||||
void SPR_AdjustSize( float *x, float *y, float *w, float *h );
|
void SPR_AdjustSize( float *x, float *y, float *w, float *h );
|
||||||
|
void SPR_AdjustTexCoords( float width, float height, float *s1, float *t1, float *s2, float *t2 );
|
||||||
int CL_GetScreenInfo( SCREENINFO *pscrinfo );
|
int CL_GetScreenInfo( SCREENINFO *pscrinfo );
|
||||||
|
void CL_FillRGBA( int x, int y, int width, int height, int r, int g, int b, int a );
|
||||||
pmtrace_t *PM_CL_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe );
|
pmtrace_t *PM_CL_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe );
|
||||||
const char *PM_CL_TraceTexture( int ground, float *vstart, float *vend );
|
const char *PM_CL_TraceTexture( int ground, float *vstart, float *vend );
|
||||||
int PM_CL_PointContents( const float *p, int *truecontents );
|
int PM_CL_PointContents( const float *p, int *truecontents );
|
||||||
|
void CL_GetMousePosition( int *mx, int *my ); // TODO: move to input
|
||||||
|
cl_entity_t* CL_GetViewModel( void );
|
||||||
physent_t *pfnGetPhysent( int idx );
|
physent_t *pfnGetPhysent( int idx );
|
||||||
struct msurface_s *pfnTraceSurface( int ground, float *vstart, float *vend );
|
struct msurface_s *pfnTraceSurface( int ground, float *vstart, float *vend );
|
||||||
movevars_t *pfnGetMoveVars( void );
|
movevars_t *pfnGetMoveVars( void );
|
||||||
void CL_EnableScissor( scissor_state_t *scissor, int x, int y, int width, int height );
|
void CL_EnableScissor( scissor_state_t *scissor, int x, int y, int width, int height );
|
||||||
void CL_DisableScissor( scissor_state_t *scissor );
|
void CL_DisableScissor( scissor_state_t *scissor );
|
||||||
qboolean CL_Scissor( const scissor_state_t *scissor, float *x, float *y, float *width, float *height, float *u0, float *v0, float *u1, float *v1 );
|
qboolean CL_Scissor( const scissor_state_t *scissor, float *x, float *y, float *width, float *height, float *u0, float *v0, float *u1, float *v1 );
|
||||||
struct cl_entity_s *CL_GetEntityByIndex( int index );
|
|
||||||
|
|
||||||
_inline cl_entity_t *CL_EDICT_NUM( int n )
|
static inline cl_entity_t *CL_EDICT_NUM( int n )
|
||||||
{
|
{
|
||||||
if( !clgame.entities )
|
if( unlikely( !clgame.entities )) // not in game yet
|
||||||
{
|
{
|
||||||
Host_Error( "CL_EDICT_NUM: clgame.entities is NULL\n");
|
Host_Error( "CL_EDICT_NUM: clgame.entities is NULL\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(( n >= 0 ) && ( n < clgame.maxEntities ))
|
if( unlikely( n < 0 || n >= clgame.maxEntities ))
|
||||||
return clgame.entities + n;
|
{
|
||||||
|
Host_Error( "CL_EDICT_NUM: bad number %i\n", n );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
Host_Error( "CL_EDICT_NUM: bad number %i\n", n );
|
return &clgame.entities[n];
|
||||||
return NULL;
|
}
|
||||||
|
|
||||||
|
static inline cl_entity_t *CL_GetEntityByIndex( int n )
|
||||||
|
{
|
||||||
|
if( unlikely( !clgame.entities )) // not in game yet
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if( unlikely( n < 0 || n >= clgame.maxEntities ))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return &clgame.entities[n];
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline model_t *CL_ModelHandle( int modelindex )
|
||||||
|
{
|
||||||
|
if( unlikely( modelindex < 0 || modelindex >= MAX_MODELS ))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return cl.models[modelindex];
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline qboolean CL_IsPlayerIndex( int idx )
|
||||||
|
{
|
||||||
|
return ( idx >= 1 && idx <= cl.maxclients );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -895,11 +935,6 @@ qboolean CL_RequestMissingResources( void );
|
|||||||
void CL_RegisterResources ( sizebuf_t *msg );
|
void CL_RegisterResources ( sizebuf_t *msg );
|
||||||
void CL_ParseViewEntity( sizebuf_t *msg );
|
void CL_ParseViewEntity( sizebuf_t *msg );
|
||||||
void CL_ParseServerTime( sizebuf_t *msg );
|
void CL_ParseServerTime( sizebuf_t *msg );
|
||||||
void CL_ParseUserMessage( sizebuf_t *msg, int svc_num );
|
|
||||||
void CL_ParseFinaleCutscene( sizebuf_t *msg, int level );
|
|
||||||
void CL_ParseTextMessage( sizebuf_t *msg );
|
|
||||||
void CL_BatchResourceRequest( qboolean initialize );
|
|
||||||
int CL_EstimateNeededResources( void );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_parse_48.c
|
// cl_parse_48.c
|
||||||
@@ -913,6 +948,8 @@ void CL_LegacyPrecache_f( void );
|
|||||||
void SCR_VidInit( void );
|
void SCR_VidInit( void );
|
||||||
void SCR_TileClear( void );
|
void SCR_TileClear( void );
|
||||||
void SCR_DirtyScreen( void );
|
void SCR_DirtyScreen( void );
|
||||||
|
void SCR_AddDirtyPoint( int x, int y );
|
||||||
|
void SCR_InstallParticlePalette( void );
|
||||||
void SCR_EndLoadingPlaque( void );
|
void SCR_EndLoadingPlaque( void );
|
||||||
void SCR_RegisterTextures( void );
|
void SCR_RegisterTextures( void );
|
||||||
void SCR_LoadCreditsFont( void );
|
void SCR_LoadCreditsFont( void );
|
||||||
@@ -948,17 +985,20 @@ void CL_InitClientMove( void );
|
|||||||
void CL_PredictMovement( qboolean repredicting );
|
void CL_PredictMovement( qboolean repredicting );
|
||||||
void CL_CheckPredictionError( void );
|
void CL_CheckPredictionError( void );
|
||||||
qboolean CL_IsPredicted( void );
|
qboolean CL_IsPredicted( void );
|
||||||
|
int CL_TruePointContents( const vec3_t p );
|
||||||
int CL_WaterEntity( const float *rgflPos );
|
int CL_WaterEntity( const float *rgflPos );
|
||||||
cl_entity_t *CL_GetWaterEntity( const float *rgflPos );
|
cl_entity_t *CL_GetWaterEntity( const float *rgflPos );
|
||||||
|
int CL_TestLine( const vec3_t start, const vec3_t end, int flags );
|
||||||
pmtrace_t *CL_VisTraceLine( vec3_t start, vec3_t end, int flags );
|
pmtrace_t *CL_VisTraceLine( vec3_t start, vec3_t end, int flags );
|
||||||
pmtrace_t CL_TraceLine( vec3_t start, vec3_t end, int flags );
|
pmtrace_t CL_TraceLine( vec3_t start, vec3_t end, int flags );
|
||||||
|
void CL_PushTraceBounds( int hullnum, const float *mins, const float *maxs );
|
||||||
|
void CL_PopTraceBounds( void );
|
||||||
void CL_MoveSpectatorCamera( void );
|
void CL_MoveSpectatorCamera( void );
|
||||||
void CL_SetLastUpdate( void );
|
void CL_SetLastUpdate( void );
|
||||||
void CL_RedoPrediction( void );
|
void CL_RedoPrediction( void );
|
||||||
void CL_PushPMStates( void );
|
void CL_PushPMStates( void );
|
||||||
void CL_PopPMStates( void );
|
void CL_PopPMStates( void );
|
||||||
void CL_SetUpPlayerPrediction( int dopred, int bIncludeLocalClient );
|
void CL_SetUpPlayerPrediction( int dopred, int bIncludeLocalClient );
|
||||||
void CL_SetIdealPitch( void );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_qparse.c
|
// cl_qparse.c
|
||||||
@@ -975,10 +1015,11 @@ qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType );
|
|||||||
void CL_ResetLatchedVars( cl_entity_t *ent, qboolean full_reset );
|
void CL_ResetLatchedVars( cl_entity_t *ent, qboolean full_reset );
|
||||||
qboolean CL_GetEntitySpatialization( struct channel_s *ch );
|
qboolean CL_GetEntitySpatialization( struct channel_s *ch );
|
||||||
qboolean CL_GetMovieSpatialization( struct rawchan_s *ch );
|
qboolean CL_GetMovieSpatialization( struct rawchan_s *ch );
|
||||||
|
void CL_ProcessPlayerState( int playerindex, entity_state_t *state );
|
||||||
void CL_ComputePlayerOrigin( cl_entity_t *clent );
|
void CL_ComputePlayerOrigin( cl_entity_t *clent );
|
||||||
void CL_ProcessPacket( frame_t *frame );
|
void CL_ProcessPacket( frame_t *frame );
|
||||||
void CL_MoveThirdpersonCamera( void );
|
void CL_MoveThirdpersonCamera( void );
|
||||||
qboolean CL_IsPlayerIndex( int idx );
|
void CL_SetIdealPitch( void );
|
||||||
void CL_EmitEntities( void );
|
void CL_EmitEntities( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1002,7 +1043,6 @@ const ref_overview_t *GL_GetOverviewParms( void );
|
|||||||
//
|
//
|
||||||
void R_StoreEfrags( efrag_t **ppefrag, int framecount );
|
void R_StoreEfrags( efrag_t **ppefrag, int framecount );
|
||||||
void R_AddEfrags( cl_entity_t *ent );
|
void R_AddEfrags( cl_entity_t *ent );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_tent.c
|
// cl_tent.c
|
||||||
//
|
//
|
||||||
@@ -1013,6 +1053,7 @@ void CL_ClearEfrags( void );
|
|||||||
void CL_TestLights( void );
|
void CL_TestLights( void );
|
||||||
void CL_FireCustomDecal( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags, float scale );
|
void CL_FireCustomDecal( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags, float scale );
|
||||||
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 );
|
||||||
|
void CL_PlayerDecal( int playerIndex, int textureIndex, int entityIndex, float *pos );
|
||||||
void R_FreeDeadParticles( struct particle_s **ppparticles );
|
void R_FreeDeadParticles( struct particle_s **ppparticles );
|
||||||
void CL_AddClientResource( const char *filename, int type );
|
void CL_AddClientResource( const char *filename, int type );
|
||||||
void CL_AddClientResources( void );
|
void CL_AddClientResources( void );
|
||||||
@@ -1034,6 +1075,7 @@ void CL_ReadPointFile_f( void );
|
|||||||
void CL_DrawEFX( float time, qboolean fTrans );
|
void CL_DrawEFX( float time, qboolean fTrans );
|
||||||
void CL_ThinkParticle( double frametime, particle_t *p );
|
void CL_ThinkParticle( double frametime, particle_t *p );
|
||||||
void CL_ReadLineFile_f( void );
|
void CL_ReadLineFile_f( void );
|
||||||
|
void CL_RunLightStyles( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
// console.c
|
// console.c
|
||||||
@@ -1053,23 +1095,27 @@ int Con_UtfProcessChar( int in );
|
|||||||
int Con_UtfProcessCharForce( int in );
|
int Con_UtfProcessCharForce( int in );
|
||||||
int Con_UtfMoveLeft( char *str, int pos );
|
int Con_UtfMoveLeft( char *str, int pos );
|
||||||
int Con_UtfMoveRight( char *str, int pos, int length );
|
int Con_UtfMoveRight( char *str, int pos, int length );
|
||||||
void Con_DefaultColor( int r, int g, int b, qboolean gameui );
|
void Con_DefaultColor( int r, int g, int b );
|
||||||
|
void Con_InvalidateFonts( void );
|
||||||
cl_font_t *Con_GetCurFont( void );
|
cl_font_t *Con_GetCurFont( void );
|
||||||
cl_font_t *Con_GetFont( int num );
|
cl_font_t *Con_GetFont( int num );
|
||||||
void Con_DrawCharacterLen( int number, int *width, int *height );
|
void Con_DrawCharacterLen( int number, int *width, int *height );
|
||||||
int Con_DrawString( int x, int y, const char *string, rgba_t setColor ); // legacy, use cl_font.c
|
int Con_DrawString( int x, int y, const char *string, rgba_t setColor ); // legacy, use cl_font.c
|
||||||
void GAME_EXPORT Con_DrawStringLen( const char *pText, int *length, int *height ); // legacy, use cl_font.c
|
void GAME_EXPORT Con_DrawStringLen( const char *pText, int *length, int *height ); // legacy, use cl_font.c
|
||||||
void Con_CharEvent( int key );
|
void Con_CharEvent( int key );
|
||||||
|
void Con_RestoreFont( void );
|
||||||
void Key_Console( int key );
|
void Key_Console( int key );
|
||||||
void Key_Message( int key );
|
void Key_Message( int key );
|
||||||
void Con_FastClose( void );
|
void Con_FastClose( void );
|
||||||
void Con_Bottom( void );
|
void Con_Bottom( void );
|
||||||
|
void Con_Top( void );
|
||||||
void Con_PageDown( int lines );
|
void Con_PageDown( int lines );
|
||||||
void Con_PageUp( int lines );
|
void Con_PageUp( int lines );
|
||||||
|
|
||||||
//
|
//
|
||||||
// s_main.c
|
// s_main.c
|
||||||
//
|
//
|
||||||
|
void S_StreamRawSamples( int samples, int rate, int width, int channels, const byte *data );
|
||||||
void S_StreamAviSamples( void *Avi, int entnum, float fvol, float attn, float synctime );
|
void S_StreamAviSamples( void *Avi, int entnum, float fvol, float attn, float synctime );
|
||||||
void S_StartBackgroundTrack( const char *intro, const char *loop, int position, qboolean fullpath );
|
void S_StartBackgroundTrack( const char *intro, const char *loop, int position, qboolean fullpath );
|
||||||
void S_StopBackgroundTrack( void );
|
void S_StopBackgroundTrack( void );
|
||||||
@@ -1116,6 +1162,11 @@ void UI_ConnectionProgress_Precache( void );
|
|||||||
void UI_ConnectionProgress_Connect( const char *server );
|
void UI_ConnectionProgress_Connect( const char *server );
|
||||||
void UI_ConnectionProgress_ChangeLevel( void );
|
void UI_ConnectionProgress_ChangeLevel( void );
|
||||||
void UI_ConnectionProgress_ParseServerInfo( const char *server );
|
void UI_ConnectionProgress_ParseServerInfo( const char *server );
|
||||||
|
void pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a );
|
||||||
|
void pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc );
|
||||||
|
void pfnPIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc );
|
||||||
|
void pfnPIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc );
|
||||||
|
void pfnPIC_DrawAdditive( int x, int y, int width, int height, const wrect_t *prc );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_mobile.c
|
// cl_mobile.c
|
||||||
@@ -1161,5 +1212,6 @@ int Key_ToUpper( int key );
|
|||||||
void OSK_Draw( void );
|
void OSK_Draw( void );
|
||||||
|
|
||||||
extern rgba_t g_color_table[8];
|
extern rgba_t g_color_table[8];
|
||||||
|
extern triangleapi_t gTriApi;
|
||||||
|
|
||||||
#endif//CLIENT_H
|
#endif//CLIENT_H
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ GNU General Public License for more details.
|
|||||||
static CVAR_DEFINE_AUTO( scr_conspeed, "600", FCVAR_ARCHIVE, "console moving speed" );
|
static CVAR_DEFINE_AUTO( scr_conspeed, "600", FCVAR_ARCHIVE, "console moving speed" );
|
||||||
static CVAR_DEFINE_AUTO( con_notifytime, "3", FCVAR_ARCHIVE, "notify time to live" );
|
static CVAR_DEFINE_AUTO( con_notifytime, "3", FCVAR_ARCHIVE, "notify time to live" );
|
||||||
CVAR_DEFINE_AUTO( con_fontsize, "1", FCVAR_ARCHIVE, "console font number (0, 1 or 2)" );
|
CVAR_DEFINE_AUTO( con_fontsize, "1", FCVAR_ARCHIVE, "console font number (0, 1 or 2)" );
|
||||||
static CVAR_DEFINE_AUTO( con_fontrender, "2", FCVAR_ARCHIVE, "console font render mode (0: additive, 1: holes, 2: trans)" );
|
|
||||||
static CVAR_DEFINE_AUTO( con_charset, "cp1251", FCVAR_ARCHIVE, "console font charset (only cp1251 supported now)" );
|
static CVAR_DEFINE_AUTO( con_charset, "cp1251", FCVAR_ARCHIVE, "console font charset (only cp1251 supported now)" );
|
||||||
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" );
|
||||||
@@ -141,9 +140,8 @@ typedef struct
|
|||||||
|
|
||||||
static console_t con;
|
static console_t con;
|
||||||
|
|
||||||
static void Con_ClearField( field_t *edit );
|
void Con_ClearField( field_t *edit );
|
||||||
static void Field_CharEvent( field_t *edit, int ch );
|
void Field_CharEvent( field_t *edit, int ch );
|
||||||
static void Con_InvalidateFonts( void );
|
|
||||||
|
|
||||||
static void Con_LoadHistory( con_history_t *self );
|
static void Con_LoadHistory( con_history_t *self );
|
||||||
static void Con_SaveHistory( con_history_t *self );
|
static void Con_SaveHistory( con_history_t *self );
|
||||||
@@ -153,7 +151,7 @@ static void Con_SaveHistory( con_history_t *self );
|
|||||||
Con_Clear_f
|
Con_Clear_f
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void Con_Clear_f( void )
|
void Con_Clear_f( void )
|
||||||
{
|
{
|
||||||
con.lines_count = 0;
|
con.lines_count = 0;
|
||||||
con.backscroll = 0; // go to end
|
con.backscroll = 0; // go to end
|
||||||
@@ -177,10 +175,10 @@ static void Con_SetColor( void )
|
|||||||
switch( num )
|
switch( num )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
Con_DefaultColor( r, r, r, false );
|
Con_DefaultColor( r, r, r );
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
Con_DefaultColor( r, g, b, false );
|
Con_DefaultColor( r, g, b );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Cvar_DirectSet( &con_color, con_color.def_string );
|
Cvar_DirectSet( &con_color, con_color.def_string );
|
||||||
@@ -208,7 +206,7 @@ void Con_ClearNotify( void )
|
|||||||
Con_ClearTyping
|
Con_ClearTyping
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void Con_ClearTyping( void )
|
void Con_ClearTyping( void )
|
||||||
{
|
{
|
||||||
Con_ClearField( &con.input );
|
Con_ClearField( &con.input );
|
||||||
con.input.widthInChars = con.linewidth;
|
con.input.widthInChars = con.linewidth;
|
||||||
@@ -221,7 +219,7 @@ static void Con_ClearTyping( void )
|
|||||||
Con_MessageMode_f
|
Con_MessageMode_f
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void Con_MessageMode_f( void )
|
void Con_MessageMode_f( void )
|
||||||
{
|
{
|
||||||
g_messagemode_privileged = Cmd_CurrentCommandIsPrivileged();
|
g_messagemode_privileged = Cmd_CurrentCommandIsPrivileged();
|
||||||
|
|
||||||
@@ -237,7 +235,7 @@ static void Con_MessageMode_f( void )
|
|||||||
Con_MessageMode2_f
|
Con_MessageMode2_f
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void Con_MessageMode2_f( void )
|
void Con_MessageMode2_f( void )
|
||||||
{
|
{
|
||||||
g_messagemode_privileged = Cmd_CurrentCommandIsPrivileged();
|
g_messagemode_privileged = Cmd_CurrentCommandIsPrivileged();
|
||||||
|
|
||||||
@@ -282,7 +280,7 @@ void Con_ToggleConsole_f( void )
|
|||||||
Con_SetTimes_f
|
Con_SetTimes_f
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void Con_SetTimes_f( void )
|
void Con_SetTimes_f( void )
|
||||||
{
|
{
|
||||||
int newtimes;
|
int newtimes;
|
||||||
|
|
||||||
@@ -305,7 +303,7 @@ Notifies the console code about the current time
|
|||||||
went backwards)
|
went backwards)
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void Con_FixTimes( void )
|
void Con_FixTimes( void )
|
||||||
{
|
{
|
||||||
double diff;
|
double diff;
|
||||||
int i;
|
int i;
|
||||||
@@ -326,7 +324,7 @@ Con_DeleteLine
|
|||||||
Deletes the first line from the console history.
|
Deletes the first line from the console history.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void Con_DeleteLine( void )
|
void Con_DeleteLine( void )
|
||||||
{
|
{
|
||||||
if( con.lines_count == 0 )
|
if( con.lines_count == 0 )
|
||||||
return;
|
return;
|
||||||
@@ -341,7 +339,7 @@ Con_DeleteLastLine
|
|||||||
Deletes the last line from the console history.
|
Deletes the last line from the console history.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void Con_DeleteLastLine( void )
|
void Con_DeleteLastLine( void )
|
||||||
{
|
{
|
||||||
if( con.lines_count == 0 )
|
if( con.lines_count == 0 )
|
||||||
return;
|
return;
|
||||||
@@ -400,7 +398,7 @@ Con_AddLine
|
|||||||
Appends a given string as a new line to the console.
|
Appends a given string as a new line to the console.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void Con_AddLine( const char *line, int length, qboolean newline )
|
void Con_AddLine( const char *line, int length, qboolean newline )
|
||||||
{
|
{
|
||||||
char *putpos;
|
char *putpos;
|
||||||
con_lineinfo_t *p;
|
con_lineinfo_t *p;
|
||||||
@@ -446,7 +444,7 @@ Con_CheckResize
|
|||||||
If the line width has changed, reformat the buffer.
|
If the line width has changed, reformat the buffer.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void Con_CheckResize( void )
|
void Con_CheckResize( void )
|
||||||
{
|
{
|
||||||
int charWidth = 8;
|
int charWidth = 8;
|
||||||
int i, width;
|
int i, width;
|
||||||
@@ -495,7 +493,7 @@ void Con_PageDown( int lines )
|
|||||||
Con_Top
|
Con_Top
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void Con_Top( void )
|
void Con_Top( void )
|
||||||
{
|
{
|
||||||
con.backscroll = CON_MAXLINES;
|
con.backscroll = CON_MAXLINES;
|
||||||
}
|
}
|
||||||
@@ -548,7 +546,7 @@ static void Con_LoadConsoleFont( int fontNumber, cl_font_t *font )
|
|||||||
|
|
||||||
if( con_oldfont.value )
|
if( con_oldfont.value )
|
||||||
{
|
{
|
||||||
success = Con_LoadVariableWidthFont( "gfx/conchars.fnt", font, scale, &con_fontrender, TF_FONT|TF_NEAREST );
|
success = Con_LoadVariableWidthFont( "gfx/conchars.fnt", font, scale, kRenderTransTexture, TF_FONT|TF_NEAREST );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -561,14 +559,14 @@ static void Con_LoadConsoleFont( int fontNumber, cl_font_t *font )
|
|||||||
if( Q_snprintf( path, sizeof( path ),
|
if( Q_snprintf( path, sizeof( path ),
|
||||||
"font%i_%s.fnt", fontNumber, Cvar_VariableString( "con_charset" )) > 0 )
|
"font%i_%s.fnt", fontNumber, Cvar_VariableString( "con_charset" )) > 0 )
|
||||||
{
|
{
|
||||||
success = Con_LoadVariableWidthFont( path, font, scale, &con_fontrender, TF_FONT|TF_NEAREST );
|
success = Con_LoadVariableWidthFont( path, font, scale, kRenderTransTexture, TF_FONT|TF_NEAREST );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !success )
|
if( !success )
|
||||||
{
|
{
|
||||||
Q_snprintf( path, sizeof( path ), "fonts/font%i", fontNumber );
|
Q_snprintf( path, sizeof( path ), "fonts/font%i", fontNumber );
|
||||||
success = Con_LoadVariableWidthFont( path, font, scale, &con_fontrender, TF_FONT|TF_NEAREST );
|
success = Con_LoadVariableWidthFont( path, font, scale, kRenderTransTexture, TF_FONT|TF_NEAREST );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -576,7 +574,7 @@ static void Con_LoadConsoleFont( int fontNumber, cl_font_t *font )
|
|||||||
{
|
{
|
||||||
// quake fixed font as fallback
|
// quake fixed font as fallback
|
||||||
// keep source to print directly into conback image
|
// keep source to print directly into conback image
|
||||||
if( !Con_LoadFixedWidthFont( "gfx/conchars", font, scale, &con_fontrender, TF_FONT|TF_NEAREST|TF_KEEP_SOURCE ))
|
if( !Con_LoadFixedWidthFont( "gfx/conchars", font, scale, kRenderTransTexture, TF_FONT|TF_KEEP_SOURCE ))
|
||||||
Con_DPrintf( S_ERROR "failed to load console font\n" );
|
Con_DPrintf( S_ERROR "failed to load console font\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -841,7 +839,6 @@ void Con_Init( void )
|
|||||||
Cvar_RegisterVariable( &con_fontsize );
|
Cvar_RegisterVariable( &con_fontsize );
|
||||||
Cvar_RegisterVariable( &con_charset );
|
Cvar_RegisterVariable( &con_charset );
|
||||||
Cvar_RegisterVariable( &con_fontscale );
|
Cvar_RegisterVariable( &con_fontscale );
|
||||||
Cvar_RegisterVariable( &con_fontrender );
|
|
||||||
Cvar_RegisterVariable( &con_fontnum );
|
Cvar_RegisterVariable( &con_fontnum );
|
||||||
Cvar_RegisterVariable( &con_color );
|
Cvar_RegisterVariable( &con_color );
|
||||||
Cvar_RegisterVariable( &scr_drawversion );
|
Cvar_RegisterVariable( &scr_drawversion );
|
||||||
@@ -1123,7 +1120,7 @@ EDIT FIELDS
|
|||||||
Con_ClearField
|
Con_ClearField
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void Con_ClearField( field_t *edit )
|
void Con_ClearField( field_t *edit )
|
||||||
{
|
{
|
||||||
memset( edit->buffer, 0, MAX_STRING );
|
memset( edit->buffer, 0, MAX_STRING );
|
||||||
edit->cursor = 0;
|
edit->cursor = 0;
|
||||||
@@ -1146,7 +1143,7 @@ static void Field_Set( field_t *f, const char *string )
|
|||||||
Field_Paste
|
Field_Paste
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void Field_Paste( field_t *edit )
|
void Field_Paste( field_t *edit )
|
||||||
{
|
{
|
||||||
char *cbd;
|
char *cbd;
|
||||||
int i, pasteLen;
|
int i, pasteLen;
|
||||||
@@ -1182,7 +1179,7 @@ in-game talk, and menu fields
|
|||||||
Key events are used for non-printable characters, others are gotten from char events.
|
Key events are used for non-printable characters, others are gotten from char events.
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void Field_KeyDownEvent( field_t *edit, int key )
|
void Field_KeyDownEvent( field_t *edit, int key )
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
@@ -1253,7 +1250,7 @@ static void Field_KeyDownEvent( field_t *edit, int key )
|
|||||||
Field_CharEvent
|
Field_CharEvent
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void Field_CharEvent( field_t *edit, int ch )
|
void Field_CharEvent( field_t *edit, int ch )
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
@@ -1314,7 +1311,7 @@ static void Field_CharEvent( field_t *edit, int ch )
|
|||||||
Field_DrawInputLine
|
Field_DrawInputLine
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void Field_DrawInputLine( int x, int y, field_t *edit )
|
void Field_DrawInputLine( int x, int y, field_t *edit )
|
||||||
{
|
{
|
||||||
int len, cursorChar;
|
int len, cursorChar;
|
||||||
int drawLen;
|
int drawLen;
|
||||||
@@ -1686,7 +1683,7 @@ Con_DrawInput
|
|||||||
The input line scrolls horizontally if typing goes beyond the right edge
|
The input line scrolls horizontally if typing goes beyond the right edge
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void Con_DrawInput( int lines )
|
void Con_DrawInput( int lines )
|
||||||
{
|
{
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
@@ -1706,7 +1703,7 @@ Con_DrawDebugLines
|
|||||||
Custom debug messages
|
Custom debug messages
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static int Con_DrawDebugLines( void )
|
int Con_DrawDebugLines( void )
|
||||||
{
|
{
|
||||||
notify_t *notify = con.notify;
|
notify_t *notify = con.notify;
|
||||||
int i, count = 0;
|
int i, count = 0;
|
||||||
@@ -1791,7 +1788,7 @@ Con_DrawNotify
|
|||||||
Draws the last few lines of output transparently over the game top
|
Draws the last few lines of output transparently over the game top
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void Con_DrawNotify( void )
|
void Con_DrawNotify( void )
|
||||||
{
|
{
|
||||||
double time = cl.time;
|
double time = cl.time;
|
||||||
int i, x, y = 0;
|
int i, x, y = 0;
|
||||||
@@ -1843,7 +1840,7 @@ If alpha is 0, the line is not drawn, but still wrapped and its height
|
|||||||
returned.
|
returned.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static int Con_DrawConsoleLine( int y, int lineno )
|
int Con_DrawConsoleLine( int y, int lineno )
|
||||||
{
|
{
|
||||||
con_lineinfo_t *li = &CON_LINES( lineno );
|
con_lineinfo_t *li = &CON_LINES( lineno );
|
||||||
|
|
||||||
@@ -1898,7 +1895,7 @@ Con_DrawConsole
|
|||||||
Draws the console with the solid background
|
Draws the console with the solid background
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void Con_DrawSolidConsole( int lines )
|
void Con_DrawSolidConsole( int lines )
|
||||||
{
|
{
|
||||||
int i, x, y;
|
int i, x, y;
|
||||||
float fraction;
|
float fraction;
|
||||||
@@ -2187,8 +2184,6 @@ INTERNAL RESOURCE
|
|||||||
*/
|
*/
|
||||||
void Con_VidInit( void )
|
void Con_VidInit( void )
|
||||||
{
|
{
|
||||||
const uint flags = TF_IMAGE|TF_ALLOW_NEAREST;
|
|
||||||
|
|
||||||
if( !con.historyLoaded )
|
if( !con.historyLoaded )
|
||||||
{
|
{
|
||||||
Con_LoadHistory( &con.history );
|
Con_LoadHistory( &con.history );
|
||||||
@@ -2200,7 +2195,7 @@ void Con_VidInit( void )
|
|||||||
|
|
||||||
Con_LoadConchars();
|
Con_LoadConchars();
|
||||||
Con_CheckResize();
|
Con_CheckResize();
|
||||||
#if XASH_LOW_MEMORY
|
#if XASH_LOW_MEMORY && !XASH_PSP
|
||||||
con.background = R_GetBuiltinTexture( REF_BLACK_TEXTURE );
|
con.background = R_GetBuiltinTexture( REF_BLACK_TEXTURE );
|
||||||
#else
|
#else
|
||||||
// loading console image
|
// loading console image
|
||||||
@@ -2208,28 +2203,28 @@ void Con_VidInit( void )
|
|||||||
{
|
{
|
||||||
// trying to load truecolor image first
|
// trying to load truecolor image first
|
||||||
if( FS_FileExists( "gfx/shell/conback.bmp", false ) || FS_FileExists( "gfx/shell/conback.tga", false ))
|
if( FS_FileExists( "gfx/shell/conback.bmp", false ) || FS_FileExists( "gfx/shell/conback.tga", false ))
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "gfx/shell/conback", NULL, 0, flags );
|
con.background = ref.dllFuncs.GL_LoadTexture( "gfx/shell/conback", NULL, 0, TF_IMAGE );
|
||||||
|
|
||||||
if( !con.background )
|
if( !con.background )
|
||||||
{
|
{
|
||||||
if( FS_FileExists( "cached/conback640", false ))
|
if( FS_FileExists( "cached/conback640", false ))
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/conback640", NULL, 0, flags );
|
con.background = ref.dllFuncs.GL_LoadTexture( "cached/conback640", NULL, 0, TF_IMAGE );
|
||||||
else if( FS_FileExists( "cached/conback", false ))
|
else if( FS_FileExists( "cached/conback", false ))
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/conback", NULL, 0, flags );
|
con.background = ref.dllFuncs.GL_LoadTexture( "cached/conback", NULL, 0, TF_IMAGE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// trying to load truecolor image first
|
// trying to load truecolor image first
|
||||||
if( FS_FileExists( "gfx/shell/loading.bmp", false ) || FS_FileExists( "gfx/shell/loading.tga", false ))
|
if( FS_FileExists( "gfx/shell/loading.bmp", false ) || FS_FileExists( "gfx/shell/loading.tga", false ))
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "gfx/shell/loading", NULL, 0, flags );
|
con.background = ref.dllFuncs.GL_LoadTexture( "gfx/shell/loading", NULL, 0, TF_IMAGE );
|
||||||
|
|
||||||
if( !con.background )
|
if( !con.background )
|
||||||
{
|
{
|
||||||
if( FS_FileExists( "cached/loading640", false ))
|
if( FS_FileExists( "cached/loading640", false ))
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/loading640", NULL, 0, flags );
|
con.background = ref.dllFuncs.GL_LoadTexture( "cached/loading640", NULL, 0, TF_IMAGE );
|
||||||
else if( FS_FileExists( "cached/loading", false ))
|
else if( FS_FileExists( "cached/loading", false ))
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/loading", NULL, 0, flags );
|
con.background = ref.dllFuncs.GL_LoadTexture( "cached/loading", NULL, 0, TF_IMAGE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2315,20 +2310,11 @@ Con_DefaultColor
|
|||||||
called from MainUI
|
called from MainUI
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
void Con_DefaultColor( int r, int g, int b, qboolean gameui )
|
void GAME_EXPORT Con_DefaultColor( int r, int g, int b )
|
||||||
{
|
{
|
||||||
r = bound( 0, r, 255 );
|
r = bound( 0, r, 255 );
|
||||||
g = bound( 0, g, 255 );
|
g = bound( 0, g, 255 );
|
||||||
b = bound( 0, b, 255 );
|
b = bound( 0, b, 255 );
|
||||||
|
|
||||||
// gameui wants to override console color... check if it's not default
|
|
||||||
if( gameui && ( g_color_table[7][0] != r || g_color_table[7][1] != g || g_color_table[7][2] != b ))
|
|
||||||
{
|
|
||||||
// yes, different from default orange, disable con_color
|
|
||||||
SetBits( con_color.flags, FCVAR_READ_ONLY );
|
|
||||||
ClearBits( con_color.flags, FCVAR_CHANGED );
|
|
||||||
}
|
|
||||||
|
|
||||||
MakeRGBA( g_color_table[7], r, g, b, 255 );
|
MakeRGBA( g_color_table[7], r, g, b, 255 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ GNU General Public License for more details.
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Gamma conversion support
|
// Gamma conversion support
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
static qboolean gamma_rebuilt;
|
|
||||||
static byte texgammatable[256];
|
static byte texgammatable[256];
|
||||||
static uint lightgammatable[1024];
|
static uint lightgammatable[1024];
|
||||||
static uint lineargammatable[1024];
|
static uint lineargammatable[1024];
|
||||||
@@ -83,6 +82,9 @@ static void BuildGammaTable( const float gamma, const float brightness, const fl
|
|||||||
|
|
||||||
static void V_ValidateGammaCvars( void )
|
static void V_ValidateGammaCvars( void )
|
||||||
{
|
{
|
||||||
|
if( Host_IsLocalGame( ))
|
||||||
|
return;
|
||||||
|
|
||||||
if( v_gamma.value < 1.8f )
|
if( v_gamma.value < 1.8f )
|
||||||
Cvar_DirectSet( &v_gamma, "1.8" );
|
Cvar_DirectSet( &v_gamma, "1.8" );
|
||||||
else if( v_gamma.value > 3.0f )
|
else if( v_gamma.value > 3.0f )
|
||||||
@@ -100,13 +102,14 @@ static void V_ValidateGammaCvars( void )
|
|||||||
|
|
||||||
if( v_brightness.value < 0.0f )
|
if( v_brightness.value < 0.0f )
|
||||||
Cvar_DirectSet( &v_brightness, "0" );
|
Cvar_DirectSet( &v_brightness, "0" );
|
||||||
else if( v_brightness.value > 3.0f )
|
else if( v_brightness.value > 2.0f )
|
||||||
Cvar_DirectSet( &v_brightness, "3" );
|
Cvar_DirectSet( &v_brightness, "2" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void V_CheckGamma( void )
|
void V_CheckGamma( void )
|
||||||
{
|
{
|
||||||
static qboolean dirty = false;
|
static qboolean dirty = false;
|
||||||
|
qboolean notify_refdll = false;
|
||||||
|
|
||||||
// because these cvars were defined as archive
|
// because these cvars were defined as archive
|
||||||
// but wasn't doing anything useful
|
// but wasn't doing anything useful
|
||||||
@@ -132,33 +135,20 @@ void V_CheckGamma( void )
|
|||||||
V_ValidateGammaCvars();
|
V_ValidateGammaCvars();
|
||||||
|
|
||||||
dirty = false;
|
dirty = false;
|
||||||
gamma_rebuilt = true;
|
|
||||||
|
|
||||||
BuildGammaTable( v_gamma.value, v_brightness.value, v_texgamma.value, v_lightgamma.value );
|
BuildGammaTable( v_gamma.value, v_brightness.value, v_texgamma.value, v_lightgamma.value );
|
||||||
|
|
||||||
// force refdll to recalculate lightmaps
|
// force refdll to recalculate lightmaps
|
||||||
if( ref.initialized )
|
notify_refdll = true;
|
||||||
ref.dllFuncs.R_GammaChanged( false );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void V_CheckGammaEnd( void )
|
// unfortunately, recalculating textures isn't possible yet
|
||||||
{
|
|
||||||
// don't reset changed flag if it was set during frame
|
|
||||||
// keep it for next frame
|
|
||||||
if( !gamma_rebuilt )
|
|
||||||
return;
|
|
||||||
|
|
||||||
gamma_rebuilt = false;
|
|
||||||
|
|
||||||
// keep the flags until the end of frame so client.dll will catch these changes
|
|
||||||
if( FBitSet( v_texgamma.flags|v_lightgamma.flags|v_brightness.flags|v_gamma.flags, FCVAR_CHANGED ))
|
|
||||||
{
|
|
||||||
ClearBits( v_texgamma.flags, FCVAR_CHANGED );
|
ClearBits( v_texgamma.flags, FCVAR_CHANGED );
|
||||||
ClearBits( v_lightgamma.flags, FCVAR_CHANGED );
|
ClearBits( v_lightgamma.flags, FCVAR_CHANGED );
|
||||||
ClearBits( v_brightness.flags, FCVAR_CHANGED );
|
ClearBits( v_brightness.flags, FCVAR_CHANGED );
|
||||||
ClearBits( v_gamma.flags, FCVAR_CHANGED );
|
ClearBits( v_gamma.flags, FCVAR_CHANGED );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( notify_refdll && ref.initialized )
|
||||||
|
ref.dllFuncs.R_GammaChanged( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void V_Init( void )
|
void V_Init( void )
|
||||||
|
|||||||
@@ -19,6 +19,24 @@ GNU General Public License for more details.
|
|||||||
#include "vgui_draw.h"
|
#include "vgui_draw.h"
|
||||||
#include "mobility_int.h"
|
#include "mobility_int.h"
|
||||||
|
|
||||||
|
#ifdef XASH_NO_TOUCH
|
||||||
|
|
||||||
|
void Touch_WriteConfig( void ) {}
|
||||||
|
void Touch_SetClientOnly( qboolean state ) {}
|
||||||
|
void Touch_RemoveButton( const char *name ) {}
|
||||||
|
void Touch_HideButtons( const char *name, byte hide ) {}
|
||||||
|
void Touch_AddClientButton( const char *name, const char *texture, const char *command, float x1, float y1, float x2, float y2, byte *color, int round, float aspect, int flags ) {}
|
||||||
|
void Touch_AddDefaultButton( const char *name, const char *texturefile, const char *command, float x1, float y1, float x2, float y2, byte *color, int round, float aspect, int flags ) {}
|
||||||
|
void Touch_ResetDefaultButtons( void ){}
|
||||||
|
void Touch_Init( void ) {}
|
||||||
|
void Touch_Draw( void ) {}
|
||||||
|
int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx, float dy ) { return 0; }
|
||||||
|
void Touch_GetMove( float *forward, float *side, float *yaw, float *pitch ) {}
|
||||||
|
void Touch_KeyEvent( int key, int down ) {}
|
||||||
|
void Touch_Shutdown( void ) {}
|
||||||
|
|
||||||
|
#else /* XASH_NO_TOUCH */
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
touch_command, // just tap a button
|
touch_command, // just tap a button
|
||||||
@@ -252,7 +270,7 @@ Touch_DumpConfig
|
|||||||
Dump config to file
|
Dump config to file
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static qboolean Touch_DumpConfig( const char *name, const char *profilename )
|
qboolean Touch_DumpConfig( const char *name, const char *profilename )
|
||||||
{
|
{
|
||||||
file_t *f;
|
file_t *f;
|
||||||
touch_button_t *button;
|
touch_button_t *button;
|
||||||
@@ -1529,7 +1547,6 @@ void Touch_Draw( void )
|
|||||||
ref.dllFuncs.R_DrawStretchPic( TO_SCRN_X( touch.move_start_x + touch.side * width - GRID_X * touch_move_indicator.value ),
|
ref.dllFuncs.R_DrawStretchPic( TO_SCRN_X( touch.move_start_x + touch.side * width - GRID_X * touch_move_indicator.value ),
|
||||||
TO_SCRN_Y( touch.move_start_y - touch.forward * height - GRID_Y * touch_move_indicator.value ),
|
TO_SCRN_Y( touch.move_start_y - touch.forward * height - GRID_Y * touch_move_indicator.value ),
|
||||||
TO_SCRN_X( GRID_X * 2 * touch_move_indicator.value ), TO_SCRN_Y( GRID_Y * 2 * touch_move_indicator.value ), 0, 0, 1, 1, touch.joytexture );
|
TO_SCRN_X( GRID_X * 2 * touch_move_indicator.value ), TO_SCRN_Y( GRID_Y * 2 * touch_move_indicator.value ), 0, 0, 1, 1, touch.joytexture );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2191,3 +2208,5 @@ void Touch_Shutdown( void )
|
|||||||
touch.initialized = false;
|
touch.initialized = false;
|
||||||
Mem_FreePool( &touch.mempool );
|
Mem_FreePool( &touch.mempool );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* XASH_NO_TOUCH */
|
||||||
|
|||||||
@@ -60,8 +60,10 @@ uint IN_CollectInputDevices( void )
|
|||||||
if( !m_ignore.value ) // no way to check is mouse connected, so use cvar only
|
if( !m_ignore.value ) // no way to check is mouse connected, so use cvar only
|
||||||
ret |= INPUT_DEVICE_MOUSE;
|
ret |= INPUT_DEVICE_MOUSE;
|
||||||
|
|
||||||
|
#ifndef XASH_NO_TOUCH
|
||||||
if( touch_enable.value )
|
if( touch_enable.value )
|
||||||
ret |= INPUT_DEVICE_TOUCH;
|
ret |= INPUT_DEVICE_TOUCH;
|
||||||
|
#endif
|
||||||
|
|
||||||
if( Joy_IsActive() ) // connected or enabled
|
if( Joy_IsActive() ) // connected or enabled
|
||||||
ret |= INPUT_DEVICE_JOYSTICK;
|
ret |= INPUT_DEVICE_JOYSTICK;
|
||||||
@@ -91,13 +93,17 @@ void IN_LockInputDevices( qboolean lock )
|
|||||||
{
|
{
|
||||||
SetBits( m_ignore.flags, FCVAR_READ_ONLY );
|
SetBits( m_ignore.flags, FCVAR_READ_ONLY );
|
||||||
SetBits( joy_enable.flags, FCVAR_READ_ONLY );
|
SetBits( joy_enable.flags, FCVAR_READ_ONLY );
|
||||||
|
#ifndef XASH_NO_TOUCH
|
||||||
SetBits( touch_enable.flags, FCVAR_READ_ONLY );
|
SetBits( touch_enable.flags, FCVAR_READ_ONLY );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ClearBits( m_ignore.flags, FCVAR_READ_ONLY );
|
ClearBits( m_ignore.flags, FCVAR_READ_ONLY );
|
||||||
ClearBits( joy_enable.flags, FCVAR_READ_ONLY );
|
ClearBits( joy_enable.flags, FCVAR_READ_ONLY );
|
||||||
|
#ifndef XASH_NO_TOUCH
|
||||||
ClearBits( touch_enable.flags, FCVAR_READ_ONLY );
|
ClearBits( touch_enable.flags, FCVAR_READ_ONLY );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +113,7 @@ void IN_LockInputDevices( qboolean lock )
|
|||||||
IN_StartupMouse
|
IN_StartupMouse
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
static void IN_StartupMouse( void )
|
void IN_StartupMouse( void )
|
||||||
{
|
{
|
||||||
Cvar_RegisterVariable( &m_ignore );
|
Cvar_RegisterVariable( &m_ignore );
|
||||||
|
|
||||||
@@ -206,7 +212,7 @@ void IN_ToggleClientMouse( int newstate, int oldstate )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void IN_CheckMouseState( qboolean active )
|
void IN_CheckMouseState( qboolean active )
|
||||||
{
|
{
|
||||||
static qboolean s_bRawInput, s_bMouseGrab;
|
static qboolean s_bRawInput, s_bMouseGrab;
|
||||||
|
|
||||||
@@ -313,7 +319,7 @@ void IN_DeactivateMouse( void )
|
|||||||
IN_MouseMove
|
IN_MouseMove
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void IN_MouseMove( void )
|
void IN_MouseMove( void )
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
@@ -351,11 +357,14 @@ void IN_MouseEvent( int key, int down )
|
|||||||
else ClearBits( in_mstate, BIT( key ));
|
else ClearBits( in_mstate, BIT( key ));
|
||||||
|
|
||||||
// touch emulation overrides all input
|
// touch emulation overrides all input
|
||||||
|
#if XASH_NO_TOUCH
|
||||||
if( touch_emulate.value )
|
if( touch_emulate.value )
|
||||||
{
|
{
|
||||||
Touch_KeyEvent( K_MOUSE1 + key, down );
|
Touch_KeyEvent( K_MOUSE1 + key, down );
|
||||||
}
|
}
|
||||||
else if( cls.key_dest == key_game )
|
else
|
||||||
|
#endif
|
||||||
|
if( cls.key_dest == key_game )
|
||||||
{
|
{
|
||||||
// perform button actions
|
// perform button actions
|
||||||
VGui_MouseEvent( K_MOUSE1 + key, down );
|
VGui_MouseEvent( K_MOUSE1 + key, down );
|
||||||
@@ -364,8 +373,7 @@ void IN_MouseEvent( int key, int down )
|
|||||||
// client may override IN_MouseEvent
|
// client may override IN_MouseEvent
|
||||||
// but by default it calls back to Key_Event anyway
|
// but by default it calls back to Key_Event anyway
|
||||||
if( in_mouseactive )
|
if( in_mouseactive )
|
||||||
clgame.dllFuncs.IN_MouseEvent( in_mstate );
|
clgame.dllFuncs.IN_MouseEvent( in_mstate ); }
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// perform button actions
|
// perform button actions
|
||||||
@@ -588,7 +596,7 @@ void IN_EngineAppendMove( float frametime, void *cmd1, qboolean active )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void IN_Commands( void )
|
void IN_Commands( void )
|
||||||
{
|
{
|
||||||
#if XASH_USE_EVDEV
|
#if XASH_USE_EVDEV
|
||||||
IN_EvdevFrame();
|
IN_EvdevFrame();
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ int Key_GetKey( const char *pBinding )
|
|||||||
Key_Unbind_f
|
Key_Unbind_f
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
static void Key_Unbind_f( void )
|
void Key_Unbind_f( void )
|
||||||
{
|
{
|
||||||
int b;
|
int b;
|
||||||
|
|
||||||
@@ -358,7 +358,7 @@ static void Key_Unbind_f( void )
|
|||||||
Key_Unbindall_f
|
Key_Unbindall_f
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
static void Key_Unbindall_f( void )
|
void Key_Unbindall_f( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -378,7 +378,7 @@ static void Key_Unbindall_f( void )
|
|||||||
Key_Reset_f
|
Key_Reset_f
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
static void Key_Reset_f( void )
|
void Key_Reset_f( void )
|
||||||
{
|
{
|
||||||
keyname_t *kn;
|
keyname_t *kn;
|
||||||
int i;
|
int i;
|
||||||
@@ -400,7 +400,7 @@ static void Key_Reset_f( void )
|
|||||||
Key_Bind_f
|
Key_Bind_f
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
static void Key_Bind_f( void )
|
void Key_Bind_f( void )
|
||||||
{
|
{
|
||||||
char cmd[1024];
|
char cmd[1024];
|
||||||
int i, c, b;
|
int i, c, b;
|
||||||
@@ -473,7 +473,7 @@ Key_Bindlist_f
|
|||||||
|
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
static void Key_Bindlist_f( void )
|
void Key_Bindlist_f( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -515,7 +515,6 @@ void Key_Init( void )
|
|||||||
|
|
||||||
Cvar_RegisterVariable( &osk_enable );
|
Cvar_RegisterVariable( &osk_enable );
|
||||||
Cvar_RegisterVariable( &key_rotate );
|
Cvar_RegisterVariable( &key_rotate );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -523,7 +522,7 @@ void Key_Init( void )
|
|||||||
Key_AddKeyCommands
|
Key_AddKeyCommands
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
static void Key_AddKeyCommands( int key, const char *kb, qboolean down )
|
void Key_AddKeyCommands( int key, const char *kb, qboolean down )
|
||||||
{
|
{
|
||||||
char button[1024];
|
char button[1024];
|
||||||
char *buttonPtr;
|
char *buttonPtr;
|
||||||
@@ -703,7 +702,11 @@ void GAME_EXPORT Key_Event( int key, int down )
|
|||||||
VGui_KeyEvent( key, down );
|
VGui_KeyEvent( key, down );
|
||||||
|
|
||||||
// console key is hardcoded, so the user can never unbind it
|
// console key is hardcoded, so the user can never unbind it
|
||||||
|
#if XASH_PSP
|
||||||
|
if( key == '`' || key == '~' || key == K_MODE_BUTTON )
|
||||||
|
#else
|
||||||
if( key == '`' || key == '~' )
|
if( key == '`' || key == '~' )
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// we are in typing mode, so don't switch to console
|
// we are in typing mode, so don't switch to console
|
||||||
if( cls.key_dest == key_message || !down )
|
if( cls.key_dest == key_message || !down )
|
||||||
@@ -714,7 +717,11 @@ void GAME_EXPORT Key_Event( int key, int down )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// escape is always handled special
|
// escape is always handled special
|
||||||
|
#if XASH_PSP
|
||||||
|
if( ( key == K_ESCAPE || key == K_START_BUTTON ) && down )
|
||||||
|
#else
|
||||||
if( key == K_ESCAPE && down )
|
if( key == K_ESCAPE && down )
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
switch( cls.key_dest )
|
switch( cls.key_dest )
|
||||||
{
|
{
|
||||||
@@ -881,7 +888,11 @@ Normal keyboard characters, already shifted / capslocked / etc
|
|||||||
void CL_CharEvent( int key )
|
void CL_CharEvent( int key )
|
||||||
{
|
{
|
||||||
// the console key should never be used as a char
|
// the console key should never be used as a char
|
||||||
|
#if XASH_PSP
|
||||||
|
if( key == '`' || key == '~' || key == K_MODE_BUTTON ) return;
|
||||||
|
#else
|
||||||
if( key == '`' || key == '~' ) return;
|
if( key == '`' || key == '~' ) return;
|
||||||
|
#endif
|
||||||
|
|
||||||
if( cls.key_dest == key_console && !Con_Visible( ))
|
if( cls.key_dest == key_console && !Con_Visible( ))
|
||||||
{
|
{
|
||||||
@@ -1006,7 +1017,11 @@ static qboolean OSK_KeyEvent( int key, int down )
|
|||||||
|
|
||||||
if( osk.curbutton.val == 0 )
|
if( osk.curbutton.val == 0 )
|
||||||
{
|
{
|
||||||
|
#if XASH_PSP
|
||||||
|
if( key == K_ENTER || key == K_A_BUTTON )
|
||||||
|
#else
|
||||||
if( key == K_ENTER )
|
if( key == K_ENTER )
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
osk.curbutton.val = osk_keylayout[osk.curlayout][osk.curbutton.y][osk.curbutton.x];
|
osk.curbutton.val = osk_keylayout[osk.curlayout][osk.curbutton.y][osk.curbutton.x];
|
||||||
return true;
|
return true;
|
||||||
@@ -1017,6 +1032,9 @@ static qboolean OSK_KeyEvent( int key, int down )
|
|||||||
|
|
||||||
switch ( key )
|
switch ( key )
|
||||||
{
|
{
|
||||||
|
#if XASH_PSP
|
||||||
|
case K_A_BUTTON:
|
||||||
|
#endif
|
||||||
case K_ENTER:
|
case K_ENTER:
|
||||||
switch( osk.curbutton.val )
|
switch( osk.curbutton.val )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -109,12 +109,6 @@ static void *pfnMod_Extradata( int type, model_t *m )
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CL_ExtraUpdate( void )
|
|
||||||
{
|
|
||||||
clgame.dllFuncs.IN_Accumulate();
|
|
||||||
S_ExtraUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
||||||
@@ -329,6 +323,10 @@ static ref_api_t gEngfuncs =
|
|||||||
&clgame.drawFuncs,
|
&clgame.drawFuncs,
|
||||||
|
|
||||||
&g_fsapi,
|
&g_fsapi,
|
||||||
|
#if XASH_PSP
|
||||||
|
P5Ram_Alloc,
|
||||||
|
P5Ram_Free,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static void R_UnloadProgs( void )
|
static void R_UnloadProgs( void )
|
||||||
@@ -350,33 +348,8 @@ static void R_UnloadProgs( void )
|
|||||||
memset( &ref.dllFuncs, 0, sizeof( ref.dllFuncs ));
|
memset( &ref.dllFuncs, 0, sizeof( ref.dllFuncs ));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CL_FillTriAPIFromRef( triangleapi_t *dst, const ref_interface_t *src )
|
|
||||||
{
|
|
||||||
dst->version = TRI_API_VERSION;
|
|
||||||
dst->Begin = src->Begin;
|
|
||||||
dst->RenderMode = TriRenderMode;
|
|
||||||
dst->End = src->End;
|
|
||||||
dst->Color4f = TriColor4f;
|
|
||||||
dst->Color4ub = TriColor4ub;
|
|
||||||
dst->TexCoord2f = src->TexCoord2f;
|
|
||||||
dst->Vertex3f = src->Vertex3f;
|
|
||||||
dst->Vertex3fv = src->Vertex3fv;
|
|
||||||
dst->Brightness = TriBrightness;
|
|
||||||
dst->CullFace = TriCullFace;
|
|
||||||
dst->SpriteTexture = TriSpriteTexture;
|
|
||||||
dst->WorldToScreen = TriWorldToScreen;
|
|
||||||
dst->Fog = src->Fog;
|
|
||||||
dst->ScreenToWorld = src->ScreenToWorld;
|
|
||||||
dst->GetMatrix = src->GetMatrix;
|
|
||||||
dst->BoxInPVS = TriBoxInPVS;
|
|
||||||
dst->LightAtPoint = TriLightAtPoint;
|
|
||||||
dst->Color4fRendermode = TriColor4fRendermode;
|
|
||||||
dst->FogParams = src->FogParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qboolean R_LoadProgs( const char *name )
|
static qboolean R_LoadProgs( const char *name )
|
||||||
{
|
{
|
||||||
extern triangleapi_t gTriApi;
|
|
||||||
static ref_api_t gpEngfuncs;
|
static ref_api_t gpEngfuncs;
|
||||||
REFAPI GetRefAPI; // single export
|
REFAPI GetRefAPI; // single export
|
||||||
|
|
||||||
@@ -421,12 +394,18 @@ static qboolean R_LoadProgs( const char *name )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initialize TriAPI callbacks
|
||||||
|
if( !ref.dllFuncs.getTriAPI( TRI_API_VERSION, &gTriApi ))
|
||||||
|
{
|
||||||
|
COM_FreeLibrary( ref.hInstance );
|
||||||
|
Con_Reportf( "R_LoadProgs: can't init TriAPI Interface: wrong version, %i must be %i\n", gTriApi.version, TRI_API_VERSION );
|
||||||
|
ref.hInstance = NULL;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Cvar_FullSet( "host_refloaded", "1", FCVAR_READ_ONLY );
|
Cvar_FullSet( "host_refloaded", "1", FCVAR_READ_ONLY );
|
||||||
ref.initialized = true;
|
ref.initialized = true;
|
||||||
|
|
||||||
// initialize TriAPI callbacks
|
|
||||||
CL_FillTriAPIFromRef( &gTriApi, &ref.dllFuncs );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -611,7 +590,6 @@ qboolean R_Init( void )
|
|||||||
|
|
||||||
// cvars that are expected to exist by client.dll
|
// cvars that are expected to exist by client.dll
|
||||||
// refdll should just get pointer to them
|
// refdll should just get pointer to them
|
||||||
Cvar_Get( "r_lighting_modulate", "0.6", FCVAR_ARCHIVE, "compatibility cvar, does nothing" );
|
|
||||||
Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT, "render entities" );
|
Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT, "render entities" );
|
||||||
Cvar_Get( "cl_himodels", "1", FCVAR_ARCHIVE, "draw high-resolution player models in multiplayer" );
|
Cvar_Get( "cl_himodels", "1", FCVAR_ARCHIVE, "draw high-resolution player models in multiplayer" );
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,11 @@ GNU General Public License for more details.
|
|||||||
// than could actually be referenced during gameplay,
|
// than could actually be referenced during gameplay,
|
||||||
// because we don't want to free anything until we are
|
// because we don't want to free anything until we are
|
||||||
// sure we won't need it.
|
// sure we won't need it.
|
||||||
|
#if XASH_PSP
|
||||||
|
#define MAX_SFX 2048
|
||||||
|
#else
|
||||||
#define MAX_SFX 8192
|
#define MAX_SFX 8192
|
||||||
|
#endif
|
||||||
#define MAX_SFX_HASH (MAX_SFX/4)
|
#define MAX_SFX_HASH (MAX_SFX/4)
|
||||||
|
|
||||||
static int s_numSfx = 0;
|
static int s_numSfx = 0;
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ void S_FadeClientVolume( float fadePercent, float fadeOutSeconds, float holdTime
|
|||||||
S_IsClient
|
S_IsClient
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static qboolean S_IsClient( int entnum )
|
qboolean S_IsClient( int entnum )
|
||||||
{
|
{
|
||||||
return ( entnum == s_listener.entnum );
|
return ( entnum == s_listener.entnum );
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ void S_FreeChannel( channel_t *ch )
|
|||||||
S_UpdateSoundFade
|
S_UpdateSoundFade
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void S_UpdateSoundFade( void )
|
void S_UpdateSoundFade( void )
|
||||||
{
|
{
|
||||||
float f, totaltime, elapsed;
|
float f, totaltime, elapsed;
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ override any other sound playing on the same channel (see code comments below fo
|
|||||||
exceptions).
|
exceptions).
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static qboolean SND_FStreamIsPlaying( sfx_t *sfx )
|
qboolean SND_FStreamIsPlaying( sfx_t *sfx )
|
||||||
{
|
{
|
||||||
int ch_idx;
|
int ch_idx;
|
||||||
|
|
||||||
@@ -399,7 +399,7 @@ returns TRUE if sound was altered,
|
|||||||
returns FALSE if sound was not found (sound is not playing)
|
returns FALSE if sound was not found (sound is not playing)
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static int S_AlterChannel( int entnum, int channel, sfx_t *sfx, int vol, int pitch, int flags )
|
int S_AlterChannel( int entnum, int channel, sfx_t *sfx, int vol, int pitch, int flags )
|
||||||
{
|
{
|
||||||
channel_t *ch;
|
channel_t *ch;
|
||||||
int i;
|
int i;
|
||||||
@@ -457,7 +457,7 @@ static int S_AlterChannel( int entnum, int channel, sfx_t *sfx, int vol, int pit
|
|||||||
S_SpatializeChannel
|
S_SpatializeChannel
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void S_SpatializeChannel( int *left_vol, int *right_vol, int master_vol, float gain, float dot, float dist )
|
void S_SpatializeChannel( int *left_vol, int *right_vol, int master_vol, float gain, float dot, float dist )
|
||||||
{
|
{
|
||||||
float lscale, rscale, scale;
|
float lscale, rscale, scale;
|
||||||
|
|
||||||
@@ -480,7 +480,7 @@ static void S_SpatializeChannel( int *left_vol, int *right_vol, int master_vol,
|
|||||||
SND_Spatialize
|
SND_Spatialize
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void SND_Spatialize( channel_t *ch )
|
void SND_Spatialize( channel_t *ch )
|
||||||
{
|
{
|
||||||
vec3_t source_vec;
|
vec3_t source_vec;
|
||||||
float dist, dot, gain = 1.0f;
|
float dist, dot, gain = 1.0f;
|
||||||
@@ -953,7 +953,7 @@ int S_GetCurrentDynamicSounds( soundlist_t *pout, int size )
|
|||||||
S_InitAmbientChannels
|
S_InitAmbientChannels
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
static void S_InitAmbientChannels( void )
|
void S_InitAmbientChannels( void )
|
||||||
{
|
{
|
||||||
int ambient_channel;
|
int ambient_channel;
|
||||||
channel_t *chan;
|
channel_t *chan;
|
||||||
@@ -975,7 +975,7 @@ static void S_InitAmbientChannels( void )
|
|||||||
S_UpdateAmbientSounds
|
S_UpdateAmbientSounds
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
static void S_UpdateAmbientSounds( void )
|
void S_UpdateAmbientSounds( void )
|
||||||
{
|
{
|
||||||
mleaf_t *leaf;
|
mleaf_t *leaf;
|
||||||
float vol;
|
float vol;
|
||||||
@@ -1407,7 +1407,7 @@ static void S_FreeRawChannels( void )
|
|||||||
S_ClearBuffer
|
S_ClearBuffer
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void S_ClearBuffer( void )
|
void S_ClearBuffer( void )
|
||||||
{
|
{
|
||||||
S_ClearRawChannels();
|
S_ClearRawChannels();
|
||||||
|
|
||||||
@@ -1506,7 +1506,7 @@ static int S_GetSoundtime( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
static void S_UpdateChannels( void )
|
void S_UpdateChannels( void )
|
||||||
{
|
{
|
||||||
uint endtime;
|
uint endtime;
|
||||||
int samps;
|
int samps;
|
||||||
@@ -1695,7 +1695,7 @@ console functions
|
|||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
*/
|
*/
|
||||||
static void S_Play_f( void )
|
void S_Play_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() == 1 )
|
if( Cmd_Argc() == 1 )
|
||||||
{
|
{
|
||||||
@@ -1706,7 +1706,7 @@ static void S_Play_f( void )
|
|||||||
S_StartLocalSound( Cmd_Argv( 1 ), VOL_NORM, false );
|
S_StartLocalSound( Cmd_Argv( 1 ), VOL_NORM, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void S_Play2_f( void )
|
void S_Play2_f( void )
|
||||||
{
|
{
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
||||||
@@ -1723,7 +1723,7 @@ static void S_Play2_f( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void S_PlayVol_f( void )
|
void S_PlayVol_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() == 1 )
|
if( Cmd_Argc() == 1 )
|
||||||
{
|
{
|
||||||
@@ -1749,7 +1749,7 @@ static void S_Say( const char *name, qboolean reliable )
|
|||||||
S_StartLocalSound( sentence, 1.0f, reliable );
|
S_StartLocalSound( sentence, 1.0f, reliable );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void S_Say_f( void )
|
void S_Say_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() == 1 )
|
if( Cmd_Argc() == 1 )
|
||||||
{
|
{
|
||||||
@@ -1760,7 +1760,7 @@ static void S_Say_f( void )
|
|||||||
S_Say( Cmd_Argv( 1 ), false );
|
S_Say( Cmd_Argv( 1 ), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void S_SayReliable_f( void )
|
void S_SayReliable_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() == 1 )
|
if( Cmd_Argc() == 1 )
|
||||||
{
|
{
|
||||||
@@ -1776,7 +1776,7 @@ static void S_SayReliable_f( void )
|
|||||||
S_Music_f
|
S_Music_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void S_Music_f( void )
|
void S_Music_f( void )
|
||||||
{
|
{
|
||||||
int c = Cmd_Argc();
|
int c = Cmd_Argc();
|
||||||
|
|
||||||
@@ -1840,7 +1840,7 @@ static void S_Music_f( void )
|
|||||||
S_StopSound_f
|
S_StopSound_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void S_StopSound_f( void )
|
void S_StopSound_f( void )
|
||||||
{
|
{
|
||||||
S_StopAllSounds( true );
|
S_StopAllSounds( true );
|
||||||
}
|
}
|
||||||
@@ -1850,7 +1850,7 @@ static void S_StopSound_f( void )
|
|||||||
S_SoundFade_f
|
S_SoundFade_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void S_SoundFade_f( void )
|
void S_SoundFade_f( void )
|
||||||
{
|
{
|
||||||
int c = Cmd_Argc();
|
int c = Cmd_Argc();
|
||||||
float fadeTime = 5.0f;
|
float fadeTime = 5.0f;
|
||||||
@@ -1884,7 +1884,7 @@ void S_SoundInfo_f( void )
|
|||||||
S_VoiceRecordStart_f
|
S_VoiceRecordStart_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void S_VoiceRecordStart_f( void )
|
void S_VoiceRecordStart_f( void )
|
||||||
{
|
{
|
||||||
if( cls.state != ca_active || cls.legacymode )
|
if( cls.state != ca_active || cls.legacymode )
|
||||||
return;
|
return;
|
||||||
@@ -1897,7 +1897,7 @@ static void S_VoiceRecordStart_f( void )
|
|||||||
S_VoiceRecordStop_f
|
S_VoiceRecordStop_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void S_VoiceRecordStop_f( void )
|
void S_VoiceRecordStop_f( void )
|
||||||
{
|
{
|
||||||
if( cls.state != ca_active || !Voice_IsRecording() )
|
if( cls.state != ca_active || !Voice_IsRecording() )
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ S_TransferPaintBuffer
|
|||||||
|
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
static void S_TransferPaintBuffer( int endtime )
|
void S_TransferPaintBuffer( int endtime )
|
||||||
{
|
{
|
||||||
int *snd_p, snd_linear_count;
|
int *snd_p, snd_linear_count;
|
||||||
int lpos, lpaintedtime;
|
int lpos, lpaintedtime;
|
||||||
@@ -201,7 +201,7 @@ CHANNEL MIXING
|
|||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
*/
|
*/
|
||||||
static void S_PaintMonoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pData, int outCount )
|
void S_PaintMonoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pData, int outCount )
|
||||||
{
|
{
|
||||||
int *lscale, *rscale;
|
int *lscale, *rscale;
|
||||||
int i, data;
|
int i, data;
|
||||||
@@ -217,7 +217,7 @@ static void S_PaintMonoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void S_PaintStereoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pData, int outCount )
|
void S_PaintStereoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pData, int outCount )
|
||||||
{
|
{
|
||||||
int *lscale, *rscale;
|
int *lscale, *rscale;
|
||||||
uint left, right;
|
uint left, right;
|
||||||
@@ -237,7 +237,7 @@ static void S_PaintStereoFrom8( portable_samplepair_t *pbuf, int *volume, byte *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void S_PaintMonoFrom16( portable_samplepair_t *pbuf, int *volume, short *pData, int outCount )
|
void S_PaintMonoFrom16( portable_samplepair_t *pbuf, int *volume, short *pData, int outCount )
|
||||||
{
|
{
|
||||||
int left, right;
|
int left, right;
|
||||||
int i, data;
|
int i, data;
|
||||||
@@ -252,7 +252,7 @@ static void S_PaintMonoFrom16( portable_samplepair_t *pbuf, int *volume, short *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void S_PaintStereoFrom16( portable_samplepair_t *pbuf, int *volume, short *pData, int outCount )
|
void S_PaintStereoFrom16( portable_samplepair_t *pbuf, int *volume, short *pData, int outCount )
|
||||||
{
|
{
|
||||||
uint *data;
|
uint *data;
|
||||||
int left, right;
|
int left, right;
|
||||||
@@ -273,11 +273,11 @@ static void S_PaintStereoFrom16( portable_samplepair_t *pbuf, int *volume, short
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void S_Mix8MonoTimeCompress( portable_samplepair_t *pbuf, int *volume, byte *pData, int inputOffset, uint rateScale, int outCount, int timecompress )
|
void S_Mix8MonoTimeCompress( portable_samplepair_t *pbuf, int *volume, byte *pData, int inputOffset, uint rateScale, int outCount, int timecompress )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void S_Mix8Mono( portable_samplepair_t *pbuf, int *volume, byte *pData, int inputOffset, uint rateScale, int outCount, int timecompress )
|
void S_Mix8Mono( portable_samplepair_t *pbuf, int *volume, byte *pData, int inputOffset, uint rateScale, int outCount, int timecompress )
|
||||||
{
|
{
|
||||||
int i, sampleIndex = 0;
|
int i, sampleIndex = 0;
|
||||||
uint sampleFrac = inputOffset;
|
uint sampleFrac = inputOffset;
|
||||||
@@ -309,7 +309,7 @@ static void S_Mix8Mono( portable_samplepair_t *pbuf, int *volume, byte *pData, i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void S_Mix8Stereo( portable_samplepair_t *pbuf, int *volume, byte *pData, int inputOffset, uint rateScale, int outCount )
|
void S_Mix8Stereo( portable_samplepair_t *pbuf, int *volume, byte *pData, int inputOffset, uint rateScale, int outCount )
|
||||||
{
|
{
|
||||||
int i, sampleIndex = 0;
|
int i, sampleIndex = 0;
|
||||||
uint sampleFrac = inputOffset;
|
uint sampleFrac = inputOffset;
|
||||||
@@ -335,7 +335,7 @@ static void S_Mix8Stereo( portable_samplepair_t *pbuf, int *volume, byte *pData,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void S_Mix16Mono( portable_samplepair_t *pbuf, int *volume, short *pData, int inputOffset, uint rateScale, int outCount )
|
void S_Mix16Mono( portable_samplepair_t *pbuf, int *volume, short *pData, int inputOffset, uint rateScale, int outCount )
|
||||||
{
|
{
|
||||||
int i, sampleIndex = 0;
|
int i, sampleIndex = 0;
|
||||||
uint sampleFrac = inputOffset;
|
uint sampleFrac = inputOffset;
|
||||||
@@ -357,7 +357,7 @@ static void S_Mix16Mono( portable_samplepair_t *pbuf, int *volume, short *pData,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void S_Mix16Stereo( portable_samplepair_t *pbuf, int *volume, short *pData, int inputOffset, uint rateScale, int outCount )
|
void S_Mix16Stereo( portable_samplepair_t *pbuf, int *volume, short *pData, int inputOffset, uint rateScale, int outCount )
|
||||||
{
|
{
|
||||||
int i, sampleIndex = 0;
|
int i, sampleIndex = 0;
|
||||||
uint sampleFrac = inputOffset;
|
uint sampleFrac = inputOffset;
|
||||||
@@ -379,7 +379,7 @@ static void S_Mix16Stereo( portable_samplepair_t *pbuf, int *volume, short *pDat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void S_MixChannel( channel_t *pChannel, void *pData, int outputOffset, int inputOffset, uint fracRate, int outCount, int timecompress )
|
void S_MixChannel( channel_t *pChannel, void *pData, int outputOffset, int inputOffset, uint fracRate, int outCount, int timecompress )
|
||||||
{
|
{
|
||||||
int pvol[CCHANVOLUMES];
|
int pvol[CCHANVOLUMES];
|
||||||
paintbuffer_t *ppaint = MIX_GetCurrentPaintbufferPtr();
|
paintbuffer_t *ppaint = MIX_GetCurrentPaintbufferPtr();
|
||||||
@@ -496,7 +496,7 @@ int S_MixDataToDevice( channel_t *pChannel, int sampleCount, int outRate, int ou
|
|||||||
return outOffset - startingOffset;
|
return outOffset - startingOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static qboolean S_ShouldContinueMixing( channel_t *ch )
|
qboolean S_ShouldContinueMixing( channel_t *ch )
|
||||||
{
|
{
|
||||||
if( ch->isSentence )
|
if( ch->isSentence )
|
||||||
{
|
{
|
||||||
@@ -517,7 +517,7 @@ static qboolean S_ShouldContinueMixing( channel_t *ch )
|
|||||||
// this routine will fill the paintbuffer to endtime. Otherwise, fewer samples are mixed.
|
// this routine will fill the paintbuffer to endtime. Otherwise, fewer samples are mixed.
|
||||||
// if( endtime - paintedtime ) is not aligned on boundaries of 4,
|
// if( endtime - paintedtime ) is not aligned on boundaries of 4,
|
||||||
// we'll miss data if outputRate < SOUND_DMA_SPEED!
|
// we'll miss data if outputRate < SOUND_DMA_SPEED!
|
||||||
static void MIX_MixChannelsToPaintbuffer( int endtime, int rate, int outputRate )
|
void MIX_MixChannelsToPaintbuffer( int endtime, int rate, int outputRate )
|
||||||
{
|
{
|
||||||
channel_t *ch;
|
channel_t *ch;
|
||||||
wavdata_t *pSource;
|
wavdata_t *pSource;
|
||||||
@@ -647,7 +647,7 @@ _inline portable_samplepair_t *S_GetNextpFilter( int i, portable_samplepair_t *p
|
|||||||
// if NULL then perform no filtering.
|
// if NULL then perform no filtering.
|
||||||
// count: how many samples to upsample. will become count*2 samples in buffer, in place.
|
// count: how many samples to upsample. will become count*2 samples in buffer, in place.
|
||||||
|
|
||||||
static void S_Interpolate2xCubic( portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int count )
|
void S_Interpolate2xCubic( portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int count )
|
||||||
{
|
{
|
||||||
|
|
||||||
// implement cubic interpolation on 2x upsampled buffer. Effectively delays buffer contents by 2 samples.
|
// implement cubic interpolation on 2x upsampled buffer. Effectively delays buffer contents by 2 samples.
|
||||||
@@ -740,7 +740,7 @@ static void S_Interpolate2xCubic( portable_samplepair_t *pbuffer, portable_sampl
|
|||||||
// prevfilter: filter memory. NOTE: this must match the filtertype ie: filterlinear[] for FILTERTYPE_LINEAR
|
// prevfilter: filter memory. NOTE: this must match the filtertype ie: filterlinear[] for FILTERTYPE_LINEAR
|
||||||
// if NULL then perform no filtering.
|
// if NULL then perform no filtering.
|
||||||
// count: how many samples to upsample. will become count*2 samples in buffer, in place.
|
// count: how many samples to upsample. will become count*2 samples in buffer, in place.
|
||||||
static void S_Interpolate2xLinear( portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int count )
|
void S_Interpolate2xLinear( portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int count )
|
||||||
{
|
{
|
||||||
int i, upCount = count<<1;
|
int i, upCount = count<<1;
|
||||||
|
|
||||||
@@ -769,7 +769,7 @@ static void S_Interpolate2xLinear( portable_samplepair_t *pbuffer, portable_samp
|
|||||||
// if NULL then perform no filtering.
|
// if NULL then perform no filtering.
|
||||||
// cfltmem: max number of sample pairs filter can use
|
// cfltmem: max number of sample pairs filter can use
|
||||||
// filtertype: FILTERTYPE_NONE, _LINEAR, _CUBIC etc. Must match prevfilter.
|
// filtertype: FILTERTYPE_NONE, _LINEAR, _CUBIC etc. Must match prevfilter.
|
||||||
static void S_MixBufferUpsample2x( int count, portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int filtertype )
|
void S_MixBufferUpsample2x( int count, portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int filtertype )
|
||||||
{
|
{
|
||||||
int upCount = count<<1;
|
int upCount = count<<1;
|
||||||
int i, j;
|
int i, j;
|
||||||
@@ -822,7 +822,7 @@ void MIX_ClearAllPaintBuffers( int SampleCount, qboolean clearFilters )
|
|||||||
// mixes pbuf1 + pbuf2 into pbuf3, count samples
|
// mixes pbuf1 + pbuf2 into pbuf3, count samples
|
||||||
// fgain is output gain 0-1.0
|
// fgain is output gain 0-1.0
|
||||||
// NOTE: pbuf3 may equal pbuf1 or pbuf2!
|
// NOTE: pbuf3 may equal pbuf1 or pbuf2!
|
||||||
static void MIX_MixPaintbuffers( int ibuf1, int ibuf2, int ibuf3, int count, float fgain )
|
void MIX_MixPaintbuffers( int ibuf1, int ibuf2, int ibuf3, int count, float fgain )
|
||||||
{
|
{
|
||||||
portable_samplepair_t *pbuf1, *pbuf2, *pbuf3;
|
portable_samplepair_t *pbuf1, *pbuf2, *pbuf3;
|
||||||
int i, gain;
|
int i, gain;
|
||||||
@@ -855,7 +855,7 @@ static void MIX_MixPaintbuffers( int ibuf1, int ibuf2, int ibuf3, int count, flo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MIX_CompressPaintbuffer( int ipaint, int count )
|
void MIX_CompressPaintbuffer( int ipaint, int count )
|
||||||
{
|
{
|
||||||
portable_samplepair_t *pbuf;
|
portable_samplepair_t *pbuf;
|
||||||
paintbuffer_t *ppaint;
|
paintbuffer_t *ppaint;
|
||||||
@@ -871,7 +871,7 @@ static void MIX_CompressPaintbuffer( int ipaint, int count )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void S_MixUpsample( int sampleCount, int filtertype )
|
void S_MixUpsample( int sampleCount, int filtertype )
|
||||||
{
|
{
|
||||||
paintbuffer_t *ppaint = MIX_GetCurrentPaintbufferPtr();
|
paintbuffer_t *ppaint = MIX_GetCurrentPaintbufferPtr();
|
||||||
int ifilter = ppaint->ifilter;
|
int ifilter = ppaint->ifilter;
|
||||||
@@ -884,7 +884,7 @@ static void S_MixUpsample( int sampleCount, int filtertype )
|
|||||||
ppaint->ifilter++;
|
ppaint->ifilter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MIX_MixRawSamplesBuffer( int end )
|
void MIX_MixRawSamplesBuffer( int end )
|
||||||
{
|
{
|
||||||
portable_samplepair_t *pbuf, *roombuf, *streambuf;
|
portable_samplepair_t *pbuf, *roombuf, *streambuf;
|
||||||
uint i, j, stop;
|
uint i, j, stop;
|
||||||
@@ -928,7 +928,7 @@ static void MIX_MixRawSamplesBuffer( int end )
|
|||||||
// IROOMBUFFER, IFACINGBUFFER, IFACINGAWAY
|
// IROOMBUFFER, IFACINGBUFFER, IFACINGAWAY
|
||||||
// dsp fx are then applied to these buffers by the caller.
|
// dsp fx are then applied to these buffers by the caller.
|
||||||
// caller also remixes all into final IPAINTBUFFER output.
|
// caller also remixes all into final IPAINTBUFFER output.
|
||||||
static void MIX_UpsampleAllPaintbuffers( int end, int count )
|
void MIX_UpsampleAllPaintbuffers( int end, int count )
|
||||||
{
|
{
|
||||||
// 11khz sounds are mixed into 3 buffers based on distance from listener, and facing direction
|
// 11khz sounds are mixed into 3 buffers based on distance from listener, and facing direction
|
||||||
// These buffers are facing, facingaway, room
|
// These buffers are facing, facingaway, room
|
||||||
|
|||||||
@@ -201,9 +201,15 @@ typedef struct
|
|||||||
|
|
||||||
//====================================================================
|
//====================================================================
|
||||||
|
|
||||||
|
#if XASH_PSP
|
||||||
|
#define MAX_DYNAMIC_CHANNELS (20 + NUM_AMBIENTS)
|
||||||
|
#define MAX_CHANNELS (128 + MAX_DYNAMIC_CHANNELS)
|
||||||
|
#define MAX_RAW_CHANNELS 16
|
||||||
|
#else
|
||||||
#define MAX_DYNAMIC_CHANNELS (60 + NUM_AMBIENTS)
|
#define MAX_DYNAMIC_CHANNELS (60 + NUM_AMBIENTS)
|
||||||
#define MAX_CHANNELS (256 + MAX_DYNAMIC_CHANNELS) // Scourge Of Armagon has too many static sounds on hip2m4.bsp
|
#define MAX_CHANNELS (256 + MAX_DYNAMIC_CHANNELS) // Scourge Of Armagon has too many static sounds on hip2m4.bsp
|
||||||
#define MAX_RAW_CHANNELS 48
|
#define MAX_RAW_CHANNELS 48
|
||||||
|
#endif
|
||||||
#define MAX_RAW_SAMPLES 8192
|
#define MAX_RAW_SAMPLES 8192
|
||||||
|
|
||||||
extern sound_t ambient_sfx[NUM_AMBIENTS];
|
extern sound_t ambient_sfx[NUM_AMBIENTS];
|
||||||
|
|||||||
@@ -428,9 +428,6 @@ void Voice_Disconnect( void )
|
|||||||
voice.players_status[i].talking_ack = false;
|
voice.players_status[i].talking_ack = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VoiceCapture_Shutdown();
|
|
||||||
voice.device_opened = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -591,53 +588,48 @@ Voice_Init
|
|||||||
Initialize the voice subsystem
|
Initialize the voice subsystem
|
||||||
=========================
|
=========================
|
||||||
*/
|
*/
|
||||||
qboolean Voice_Init( const char *pszCodecName, int quality, qboolean preinit )
|
qboolean Voice_Init( const char *pszCodecName, int quality )
|
||||||
{
|
{
|
||||||
if( !voice_enable.value )
|
if( !voice_enable.value )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if( Q_strcmp( pszCodecName, VOICE_OPUS_CUSTOM_CODEC ))
|
||||||
|
{
|
||||||
|
Con_Printf( S_ERROR "Server requested unsupported codec: %s\n", pszCodecName );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// reinitialize only if codec parameters are different
|
// reinitialize only if codec parameters are different
|
||||||
if( Q_strcmp( pszCodecName, voice.codec ) || voice.quality != quality )
|
if( !Q_strcmp( voice.codec, pszCodecName ) && voice.quality == quality )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
Voice_Shutdown();
|
||||||
|
|
||||||
|
voice.autogain.block_size = 128;
|
||||||
|
|
||||||
|
if( !Voice_InitOpusDecoder( ))
|
||||||
{
|
{
|
||||||
|
// no reason to init encoder and open audio device
|
||||||
|
// if we can't hear other players
|
||||||
|
Con_Printf( S_ERROR "Voice chat disabled.\n" );
|
||||||
Voice_Shutdown();
|
Voice_Shutdown();
|
||||||
|
return false;
|
||||||
if( Q_strcmp( pszCodecName, VOICE_OPUS_CUSTOM_CODEC ))
|
|
||||||
{
|
|
||||||
Con_Printf( S_ERROR "Server requested unsupported codec: %s\n", pszCodecName );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
voice.autogain.block_size = 128;
|
|
||||||
|
|
||||||
if( !Voice_InitOpusDecoder( ))
|
|
||||||
{
|
|
||||||
// no reason to init encoder and open audio device
|
|
||||||
// if we can't hear other players
|
|
||||||
Con_Printf( S_ERROR "Voice chat disabled.\n" );
|
|
||||||
Voice_Shutdown();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we can hear others players, so it's fine to fail now
|
|
||||||
voice.initialized = true;
|
|
||||||
Q_strncpy( voice.codec, pszCodecName, sizeof( voice.codec ));
|
|
||||||
|
|
||||||
if( !Voice_InitOpusEncoder( quality ))
|
|
||||||
{
|
|
||||||
Con_Printf( S_WARN "Other players will not be able to hear you.\n" );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
voice.quality = quality;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !preinit )
|
// we can hear others players, so it's fine to fail now
|
||||||
|
voice.initialized = true;
|
||||||
|
Q_strncpy( voice.codec, pszCodecName, sizeof( voice.codec ));
|
||||||
|
|
||||||
|
if( !Voice_InitOpusEncoder( quality ))
|
||||||
{
|
{
|
||||||
voice.device_opened = VoiceCapture_Init();
|
Con_Printf( S_WARN "Other players will not be able to hear you.\n" );
|
||||||
|
return false;
|
||||||
if( !voice.device_opened )
|
|
||||||
Con_Printf( S_WARN "No microphone is available.\n" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
voice.quality = quality;
|
||||||
|
|
||||||
|
if( !VoiceCapture_Init( ))
|
||||||
|
Con_Printf( S_WARN "No microphone is available.\n" );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ typedef struct voice_state_s
|
|||||||
|
|
||||||
qboolean initialized;
|
qboolean initialized;
|
||||||
qboolean is_recording;
|
qboolean is_recording;
|
||||||
qboolean device_opened;
|
|
||||||
double start_time;
|
double start_time;
|
||||||
|
|
||||||
voice_status_t local;
|
voice_status_t local;
|
||||||
@@ -93,7 +92,7 @@ extern voice_state_t voice;
|
|||||||
void CL_AddVoiceToDatagram( void );
|
void CL_AddVoiceToDatagram( void );
|
||||||
|
|
||||||
void Voice_RegisterCvars( void );
|
void Voice_RegisterCvars( void );
|
||||||
qboolean Voice_Init( const char *pszCodecName, int quality, qboolean preinit );
|
qboolean Voice_Init( const char *pszCodecName, int quality );
|
||||||
void Voice_Idle( double frametime );
|
void Voice_Idle( double frametime );
|
||||||
qboolean Voice_IsRecording( void );
|
qboolean Voice_IsRecording( void );
|
||||||
void Voice_RecordStop( void );
|
void Voice_RecordStop( void );
|
||||||
|
|||||||
175
engine/common/build.c
Normal file
175
engine/common/build.c
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
/*
|
||||||
|
build.c - returns a engine build number
|
||||||
|
Copyright (C) 2010 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"
|
||||||
|
|
||||||
|
static char *date = __DATE__ ;
|
||||||
|
static char *mon[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
|
||||||
|
static char mond[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||||
|
|
||||||
|
// returns days since Apr 1 2015
|
||||||
|
int Q_buildnum( void )
|
||||||
|
{
|
||||||
|
int m = 0, d = 0, y = 0;
|
||||||
|
static int b = 0;
|
||||||
|
|
||||||
|
if( b != 0 ) return b;
|
||||||
|
|
||||||
|
for( m = 0; m < 11; m++ )
|
||||||
|
{
|
||||||
|
if( !Q_strnicmp( &date[0], mon[m], 3 ))
|
||||||
|
break;
|
||||||
|
d += mond[m];
|
||||||
|
}
|
||||||
|
|
||||||
|
d += Q_atoi( &date[4] ) - 1;
|
||||||
|
y = Q_atoi( &date[7] ) - 1900;
|
||||||
|
b = d + (int)((y - 1) * 365.25f );
|
||||||
|
|
||||||
|
if((( y % 4 ) == 0 ) && m > 1 )
|
||||||
|
{
|
||||||
|
b += 1;
|
||||||
|
}
|
||||||
|
b -= 41728; // Apr 1 2015
|
||||||
|
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
Q_buildnum_compat
|
||||||
|
|
||||||
|
Returns a Xash3D build number. This is left for compability with original Xash3D.
|
||||||
|
IMPORTANT: this value must be changed ONLY after updating to newer Xash3D
|
||||||
|
IMPORTANT: this value must be acquired through "build" cvar.
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
int Q_buildnum_compat( void )
|
||||||
|
{
|
||||||
|
// do not touch this! Only author of Xash3D can increase buildnumbers!
|
||||||
|
return 4529;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
============
|
||||||
|
Q_buildos
|
||||||
|
|
||||||
|
Returns current name of operating system. Without any spaces.
|
||||||
|
============
|
||||||
|
*/
|
||||||
|
const char *Q_buildos( void )
|
||||||
|
{
|
||||||
|
const char *osname;
|
||||||
|
|
||||||
|
#if XASH_MINGW
|
||||||
|
osname = "win32-mingw";
|
||||||
|
#elif XASH_WIN32
|
||||||
|
osname = "win32";
|
||||||
|
#elif XASH_ANDROID
|
||||||
|
osname = "android";
|
||||||
|
#elif XASH_LINUX
|
||||||
|
osname = "linux";
|
||||||
|
#elif XASH_APPLE
|
||||||
|
osname = "apple";
|
||||||
|
#elif XASH_FREEBSD
|
||||||
|
osname = "freebsd";
|
||||||
|
#elif XASH_NETBSD
|
||||||
|
osname = "netbsd";
|
||||||
|
#elif XASH_OPENBSD
|
||||||
|
osname = "openbsd";
|
||||||
|
#elif XASH_EMSCRIPTEN
|
||||||
|
osname = "emscripten";
|
||||||
|
#elif XASH_DOS4GW
|
||||||
|
osname = "DOS4GW";
|
||||||
|
#elif XASH_PSP
|
||||||
|
osname = "psp";
|
||||||
|
#else
|
||||||
|
#error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return osname;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
============
|
||||||
|
Q_buildos
|
||||||
|
|
||||||
|
Returns current name of operating system. Without any spaces.
|
||||||
|
============
|
||||||
|
*/
|
||||||
|
const char *Q_buildarch( void )
|
||||||
|
{
|
||||||
|
const char *archname;
|
||||||
|
|
||||||
|
#if XASH_AMD64
|
||||||
|
archname = "amd64";
|
||||||
|
#elif XASH_X86
|
||||||
|
archname = "i386";
|
||||||
|
#elif XASH_ARM && XASH_64BIT
|
||||||
|
archname = "arm64";
|
||||||
|
#elif XASH_ARM
|
||||||
|
archname = "armv"
|
||||||
|
#if XASH_ARM == 8
|
||||||
|
"8_32" // for those who (mis)using 32-bit OS on 64-bit CPU
|
||||||
|
#elif XASH_ARM == 7
|
||||||
|
"7"
|
||||||
|
#elif XASH_ARM == 6
|
||||||
|
"6"
|
||||||
|
#elif XASH_ARM == 5
|
||||||
|
"5"
|
||||||
|
#elif XASH_ARM == 4
|
||||||
|
"4"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if XASH_ARM_HARDFP
|
||||||
|
"hf";
|
||||||
|
#else
|
||||||
|
"l";
|
||||||
|
#endif
|
||||||
|
#elif XASH_MIPS && defined XASH_BIG_ENDIAN
|
||||||
|
archname = "mips";
|
||||||
|
#elif XASH_MIPS && defined XASH_LITTLE_ENDIAN
|
||||||
|
archname = "mipsel";
|
||||||
|
#elif XASH_JS
|
||||||
|
archname = "javascript";
|
||||||
|
#elif XASH_E2K
|
||||||
|
archname = "e2k";
|
||||||
|
#else
|
||||||
|
#error "Place your architecture name here! If this is a mistake, try to fix conditions above and report a bug"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return archname;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
Q_buildcommit
|
||||||
|
|
||||||
|
Returns a short hash of current commit in VCS as string.
|
||||||
|
XASH_BUILD_COMMIT must be passed in quotes
|
||||||
|
|
||||||
|
if XASH_BUILD_COMMIT is not defined,
|
||||||
|
Q_buildcommit will identify this build as "notset"
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
const char *Q_buildcommit( void )
|
||||||
|
{
|
||||||
|
#ifdef XASH_BUILD_COMMIT
|
||||||
|
return XASH_BUILD_COMMIT;
|
||||||
|
#else
|
||||||
|
return "notset";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ CSCR_ExpectString
|
|||||||
Return true if next token is pExpext and skip it
|
Return true if next token is pExpext and skip it
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
static qboolean CSCR_ExpectString( parserstate_t *ps, const char *pExpect, qboolean skip, qboolean error )
|
qboolean CSCR_ExpectString( parserstate_t *ps, const char *pExpect, qboolean skip, qboolean error )
|
||||||
{
|
{
|
||||||
char *tmp = COM_ParseFile( ps->buf, ps->token, sizeof( ps->token ));
|
char *tmp = COM_ParseFile( ps->buf, ps->token, sizeof( ps->token ));
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ CSCR_ParseType
|
|||||||
Determine script variable type
|
Determine script variable type
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
static cvartype_t CSCR_ParseType( parserstate_t *ps )
|
cvartype_t CSCR_ParseType( parserstate_t *ps )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ static cvartype_t CSCR_ParseType( parserstate_t *ps )
|
|||||||
CSCR_ParseSingleCvar
|
CSCR_ParseSingleCvar
|
||||||
=========================
|
=========================
|
||||||
*/
|
*/
|
||||||
static qboolean CSCR_ParseSingleCvar( parserstate_t *ps, scrvardef_t *result )
|
qboolean CSCR_ParseSingleCvar( parserstate_t *ps, scrvardef_t *result )
|
||||||
{
|
{
|
||||||
// read the name
|
// read the name
|
||||||
ps->buf = COM_ParseFile( ps->buf, result->name, sizeof( result->name ));
|
ps->buf = COM_ParseFile( ps->buf, result->name, sizeof( result->name ));
|
||||||
@@ -170,7 +170,7 @@ CSCR_ParseHeader
|
|||||||
Check version and seek to first cvar name
|
Check version and seek to first cvar name
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
static qboolean CSCR_ParseHeader( parserstate_t *ps )
|
qboolean CSCR_ParseHeader( parserstate_t *ps )
|
||||||
{
|
{
|
||||||
if( !CSCR_ExpectString( ps, "VERSION", false, true ))
|
if( !CSCR_ExpectString( ps, "VERSION", false, true ))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ static void Cmd_ExecuteStringWithPrivilegeCheck( const char *text, qboolean isPr
|
|||||||
Cbuf_Init
|
Cbuf_Init
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
static void Cbuf_Init( void )
|
void Cbuf_Init( void )
|
||||||
{
|
{
|
||||||
cmd_text.data = cmd_text_buf;
|
cmd_text.data = cmd_text_buf;
|
||||||
filteredcmd_text.data = filteredcmd_text_buf;
|
filteredcmd_text.data = filteredcmd_text_buf;
|
||||||
@@ -79,7 +79,7 @@ void Cbuf_Clear( void )
|
|||||||
Cbuf_GetSpace
|
Cbuf_GetSpace
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
static void *Cbuf_GetSpace( cmdbuf_t *buf, int length )
|
void *Cbuf_GetSpace( cmdbuf_t *buf, int length )
|
||||||
{
|
{
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ void Cbuf_InsertText( const char *text )
|
|||||||
Cbuf_Execute
|
Cbuf_Execute
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
static void Cbuf_ExecuteCommandsFromBuffer( cmdbuf_t *buf, qboolean isPrivileged, int cmdsToExecute )
|
void Cbuf_ExecuteCommandsFromBuffer( cmdbuf_t *buf, qboolean isPrivileged, int cmdsToExecute )
|
||||||
{
|
{
|
||||||
char *text;
|
char *text;
|
||||||
char line[MAX_CMD_LINE];
|
char line[MAX_CMD_LINE];
|
||||||
@@ -356,7 +356,7 @@ hl.exe -dev 3 +map c1a0d
|
|||||||
hl.exe -nosound -game bshift
|
hl.exe -nosound -game bshift
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static void Cmd_StuffCmds_f( void )
|
void Cmd_StuffCmds_f( void )
|
||||||
{
|
{
|
||||||
host.stuffcmds_pending = true;
|
host.stuffcmds_pending = true;
|
||||||
}
|
}
|
||||||
@@ -370,7 +370,7 @@ next frame. This allows commands like:
|
|||||||
bind g "cmd use rocket ; +attack ; wait ; -attack ; cmd use blaster"
|
bind g "cmd use rocket ; +attack ; wait ; -attack ; cmd use blaster"
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
static void Cmd_Wait_f( void )
|
void Cmd_Wait_f( void )
|
||||||
{
|
{
|
||||||
cmd_wait = true;
|
cmd_wait = true;
|
||||||
}
|
}
|
||||||
@@ -382,7 +382,7 @@ Cmd_Echo_f
|
|||||||
Just prints the rest of the line to the console
|
Just prints the rest of the line to the console
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static void Cmd_Echo_f( void )
|
void Cmd_Echo_f( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -398,7 +398,7 @@ Cmd_Alias_f
|
|||||||
Creates a new command that executes a command string (possibly ; seperated)
|
Creates a new command that executes a command string (possibly ; seperated)
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static void Cmd_Alias_f( void )
|
void Cmd_Alias_f( void )
|
||||||
{
|
{
|
||||||
cmdalias_t *a;
|
cmdalias_t *a;
|
||||||
char cmd[MAX_CMD_LINE];
|
char cmd[MAX_CMD_LINE];
|
||||||
@@ -529,6 +529,7 @@ typedef struct cmd_s
|
|||||||
static int cmd_argc;
|
static int cmd_argc;
|
||||||
static const char *cmd_args = NULL;
|
static const char *cmd_args = NULL;
|
||||||
static char *cmd_argv[MAX_CMD_TOKENS];
|
static char *cmd_argv[MAX_CMD_TOKENS];
|
||||||
|
static char cmd_tokenized[MAX_CMD_BUFFER]; // will have 0 bytes inserted
|
||||||
static cmd_t *cmd_functions; // possible commands to execute
|
static cmd_t *cmd_functions; // possible commands to execute
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -881,7 +882,7 @@ Cmd_If_f
|
|||||||
Compare and et condition bit if true
|
Compare and et condition bit if true
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
static void Cmd_If_f( void )
|
void Cmd_If_f( void )
|
||||||
{
|
{
|
||||||
// reset bit first
|
// reset bit first
|
||||||
cmd_condition &= ~BIT( cmd_condlevel );
|
cmd_condition &= ~BIT( cmd_condlevel );
|
||||||
@@ -942,7 +943,7 @@ Cmd_Else_f
|
|||||||
Invert condition bit
|
Invert condition bit
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
static void Cmd_Else_f( void )
|
void Cmd_Else_f( void )
|
||||||
{
|
{
|
||||||
cmd_condition ^= BIT( cmd_condlevel );
|
cmd_condition ^= BIT( cmd_condlevel );
|
||||||
}
|
}
|
||||||
@@ -1178,7 +1179,7 @@ void Cmd_ForwardToServer( void )
|
|||||||
Cmd_List_f
|
Cmd_List_f
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
static void Cmd_List_f( void )
|
void Cmd_List_f( void )
|
||||||
{
|
{
|
||||||
cmd_t *cmd;
|
cmd_t *cmd;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|||||||
@@ -17,24 +17,15 @@ GNU General Public License for more details.
|
|||||||
#define COM_STRINGS_H
|
#define COM_STRINGS_H
|
||||||
|
|
||||||
// default colored message headers
|
// default colored message headers
|
||||||
#define S_BLACK "^0"
|
#define S_NOTE "^2Note:^7 "
|
||||||
#define S_RED "^1"
|
#define S_WARN "^3Warning:^7 "
|
||||||
#define S_GREEN "^2"
|
#define S_ERROR "^1Error:^7 "
|
||||||
#define S_YELLOW "^3"
|
#define S_USAGE "Usage: "
|
||||||
#define S_BLUE "^4"
|
#define S_USAGE_INDENT " "
|
||||||
#define S_CYAN "^5"
|
|
||||||
#define S_MAGENTA "^6"
|
|
||||||
#define S_DEFAULT "^7"
|
|
||||||
|
|
||||||
#define S_NOTE S_GREEN "Note: " S_DEFAULT
|
#define S_OPENGL_NOTE "^2OpenGL Note:^7 "
|
||||||
#define S_WARN S_YELLOW "Warning: " S_DEFAULT
|
#define S_OPENGL_WARN "^3OpenGL Warning:^7 "
|
||||||
#define S_ERROR S_RED "Error: " S_DEFAULT
|
#define S_OPENGL_ERROR "^3OpenGL Error:^7 "
|
||||||
#define S_USAGE "Usage: "
|
|
||||||
#define S_USAGE_INDENT "\t"
|
|
||||||
|
|
||||||
#define S_OPENGL_NOTE S_GREEN "OpenGL Note: " S_DEFAULT
|
|
||||||
#define S_OPENGL_WARN S_YELLOW "OpenGL Warning: " S_DEFAULT
|
|
||||||
#define S_OPENGL_ERROR S_RED "OpenGL Error: " S_DEFAULT
|
|
||||||
|
|
||||||
// end game final default message
|
// end game final default message
|
||||||
#define DEFAULT_ENDGAME_MESSAGE "The End"
|
#define DEFAULT_ENDGAME_MESSAGE "The End"
|
||||||
|
|||||||
@@ -531,6 +531,47 @@ int GAME_EXPORT COM_FileSize( const char *filename )
|
|||||||
return FS_FileSize( filename, false );
|
return FS_FileSize( filename, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
COM_AddAppDirectoryToSearchPath
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
void GAME_EXPORT COM_AddAppDirectoryToSearchPath( const char *pszBaseDir, const char *appName )
|
||||||
|
{
|
||||||
|
FS_AddGameHierarchy( pszBaseDir, FS_NOWRITE_PATH );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
===========
|
||||||
|
COM_ExpandFilename
|
||||||
|
|
||||||
|
Finds the file in the search path, copies over the name with the full path name.
|
||||||
|
This doesn't search in the pak file.
|
||||||
|
===========
|
||||||
|
*/
|
||||||
|
int GAME_EXPORT COM_ExpandFilename( const char *fileName, char *nameOutBuffer, int nameOutBufferSize )
|
||||||
|
{
|
||||||
|
char result[MAX_SYSPATH];
|
||||||
|
|
||||||
|
if( !COM_CheckString( fileName ) || !nameOutBuffer || nameOutBufferSize <= 0 )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// filename examples:
|
||||||
|
// media\sierra.avi - D:\Xash3D\valve\media\sierra.avi
|
||||||
|
// models\barney.mdl - D:\Xash3D\bshift\models\barney.mdl
|
||||||
|
if( g_fsapi.GetFullDiskPath( result, sizeof( result ), fileName, false ))
|
||||||
|
{
|
||||||
|
// check for enough room
|
||||||
|
if( Q_strlen( result ) > nameOutBufferSize )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
Q_strncpy( nameOutBuffer, result, nameOutBufferSize );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
COM_TrimSpace
|
COM_TrimSpace
|
||||||
@@ -693,7 +734,7 @@ COM_LoadFileForMe
|
|||||||
byte *GAME_EXPORT COM_LoadFileForMe( const char *filename, int *pLength )
|
byte *GAME_EXPORT COM_LoadFileForMe( const char *filename, int *pLength )
|
||||||
{
|
{
|
||||||
string name;
|
string name;
|
||||||
byte *pfile;
|
byte *file, *pfile;
|
||||||
fs_offset_t iLength;
|
fs_offset_t iLength;
|
||||||
|
|
||||||
if( !COM_CheckString( filename ))
|
if( !COM_CheckString( filename ))
|
||||||
@@ -706,9 +747,21 @@ byte *GAME_EXPORT COM_LoadFileForMe( const char *filename, int *pLength )
|
|||||||
Q_strncpy( name, filename, sizeof( name ));
|
Q_strncpy( name, filename, sizeof( name ));
|
||||||
COM_FixSlashes( name );
|
COM_FixSlashes( name );
|
||||||
|
|
||||||
pfile = g_fsapi.LoadFileMalloc( name, &iLength, false );
|
pfile = FS_LoadFile( name, &iLength, false );
|
||||||
if( pLength ) *pLength = (int)iLength;
|
if( pLength ) *pLength = (int)iLength;
|
||||||
|
|
||||||
|
if( pfile )
|
||||||
|
{
|
||||||
|
file = malloc( iLength + 1 );
|
||||||
|
if( file != NULL )
|
||||||
|
{
|
||||||
|
memcpy( file, pfile, iLength );
|
||||||
|
file[iLength] = '\0';
|
||||||
|
}
|
||||||
|
Mem_Free( pfile );
|
||||||
|
pfile = file;
|
||||||
|
}
|
||||||
|
|
||||||
return pfile;
|
return pfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -816,6 +869,18 @@ cvar_t *GAME_EXPORT pfnCVarGetPointer( const char *szVarName )
|
|||||||
return (cvar_t *)Cvar_FindVar( szVarName );
|
return (cvar_t *)Cvar_FindVar( szVarName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnCVarDirectSet
|
||||||
|
|
||||||
|
allow to set cvar directly
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
void GAME_EXPORT pfnCVarDirectSet( cvar_t *var, const char *szValue )
|
||||||
|
{
|
||||||
|
Cvar_DirectSet( (convar_t *)var, szValue );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
COM_CompareFileTime
|
COM_CompareFileTime
|
||||||
@@ -931,6 +996,21 @@ qboolean COM_IsSafeFileToDownload( const char *filename )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *COM_GetResourceTypeName( resourcetype_t restype )
|
||||||
|
{
|
||||||
|
switch( restype )
|
||||||
|
{
|
||||||
|
case t_decal: return "decal";
|
||||||
|
case t_eventscript: return "eventscript";
|
||||||
|
case t_generic: return "generic";
|
||||||
|
case t_model: return "model";
|
||||||
|
case t_skin: return "skin";
|
||||||
|
case t_sound: return "sound";
|
||||||
|
case t_world: return "world";
|
||||||
|
default: return "unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char *_copystring( poolhandle_t mempool, const char *s, const char *filename, int fileline )
|
char *_copystring( poolhandle_t mempool, const char *s, const char *filename, int fileline )
|
||||||
{
|
{
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ typedef enum
|
|||||||
#define MAX_DECALS 256 // touching TE_DECAL messages, etc
|
#define MAX_DECALS 256 // touching TE_DECAL messages, etc
|
||||||
#define MAX_STATIC_ENTITIES 32 // static entities that moved on the client when level is spawn
|
#define MAX_STATIC_ENTITIES 32 // static entities that moved on the client when level is spawn
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#define GameState (&host.game)
|
#define GameState (&host.game)
|
||||||
|
|
||||||
@@ -388,6 +389,7 @@ void *FS_GetNativeObject( const char *obj );
|
|||||||
//
|
//
|
||||||
// cmd.c
|
// cmd.c
|
||||||
//
|
//
|
||||||
|
void Cbuf_Init( void );
|
||||||
void Cbuf_Clear( void );
|
void Cbuf_Clear( void );
|
||||||
void Cbuf_AddText( const char *text );
|
void Cbuf_AddText( const char *text );
|
||||||
void Cbuf_AddTextf( const char *text, ... ) _format( 1 );
|
void Cbuf_AddTextf( const char *text, ... ) _format( 1 );
|
||||||
@@ -411,6 +413,9 @@ void Cmd_RemoveCommand( const char *cmd_name );
|
|||||||
qboolean Cmd_Exists( const char *cmd_name );
|
qboolean Cmd_Exists( const char *cmd_name );
|
||||||
void Cmd_LookupCmds( void *buffer, void *ptr, setpair_t callback );
|
void Cmd_LookupCmds( void *buffer, void *ptr, setpair_t callback );
|
||||||
int Cmd_ListMaps( search_t *t , char *lastmapname, size_t len );
|
int Cmd_ListMaps( search_t *t , char *lastmapname, size_t len );
|
||||||
|
qboolean Cmd_GetMapList( const char *s, char *completedname, int length );
|
||||||
|
qboolean Cmd_GetDemoList( const char *s, char *completedname, int length );
|
||||||
|
qboolean Cmd_GetMovieList( const char *s, char *completedname, int length );
|
||||||
void Cmd_TokenizeString( const char *text );
|
void Cmd_TokenizeString( const char *text );
|
||||||
void Cmd_ExecuteString( const char *text );
|
void Cmd_ExecuteString( const char *text );
|
||||||
void Cmd_ForwardToServer( void );
|
void Cmd_ForwardToServer( void );
|
||||||
@@ -457,12 +462,13 @@ void FS_FreeImage( rgbdata_t *pack );
|
|||||||
extern const bpc_desc_t PFDesc[]; // image get pixelformat
|
extern const bpc_desc_t PFDesc[]; // image get pixelformat
|
||||||
qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, float reserved );
|
qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, float reserved );
|
||||||
void Image_PaletteHueReplace( byte *palSrc, int newHue, int start, int end, int pal_size );
|
void Image_PaletteHueReplace( byte *palSrc, int newHue, int start, int end, int pal_size );
|
||||||
|
void Image_PaletteTranslate( byte *palSrc, int top, int bottom, int pal_size );
|
||||||
void Image_SetForceFlags( uint flags ); // set image force flags on loading
|
void Image_SetForceFlags( uint flags ); // set image force flags on loading
|
||||||
|
size_t Image_DXTGetLinearSize( int type, int width, int height, int depth );
|
||||||
qboolean Image_CustomPalette( void );
|
qboolean Image_CustomPalette( void );
|
||||||
void Image_ClearForceFlags( void );
|
void Image_ClearForceFlags( void );
|
||||||
void Image_SetMDLPointer( byte *p );
|
void Image_SetMDLPointer( byte *p );
|
||||||
void Image_CheckPaletteQ1( void );
|
void Image_CheckPaletteQ1( void );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================================================================
|
========================================================================
|
||||||
|
|
||||||
@@ -538,6 +544,7 @@ qboolean Host_IsQuakeCompatible( void );
|
|||||||
void EXPORT Host_Shutdown( void );
|
void EXPORT Host_Shutdown( void );
|
||||||
int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGame, pfnChangeGame func );
|
int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGame, pfnChangeGame func );
|
||||||
int Host_CompareFileTime( int ft1, int ft2 );
|
int Host_CompareFileTime( int ft1, int ft2 );
|
||||||
|
void Host_NewInstance( const char *name, const char *finalmsg );
|
||||||
void Host_EndGame( qboolean abort, const char *message, ... ) _format( 2 );
|
void Host_EndGame( qboolean abort, const char *message, ... ) _format( 2 );
|
||||||
void Host_AbortCurrentFrame( void ) NORETURN;
|
void Host_AbortCurrentFrame( void ) NORETURN;
|
||||||
void Host_WriteServerConfig( const char *name );
|
void Host_WriteServerConfig( const char *name );
|
||||||
@@ -550,6 +557,7 @@ void Host_ShutdownServer( void );
|
|||||||
void Host_Error( const char *error, ... ) _format( 1 );
|
void Host_Error( const char *error, ... ) _format( 1 );
|
||||||
void Host_ValidateEngineFeatures( uint32_t features );
|
void Host_ValidateEngineFeatures( uint32_t features );
|
||||||
void Host_Frame( float time );
|
void Host_Frame( float time );
|
||||||
|
void Host_InitDecals( void );
|
||||||
void Host_Credits( void );
|
void Host_Credits( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -593,6 +601,7 @@ void COM_HexConvert( const char *pszInput, int nInputLength, byte *pOutput );
|
|||||||
int COM_SaveFile( const char *filename, const void *data, int len );
|
int COM_SaveFile( const char *filename, const void *data, int len );
|
||||||
byte* COM_LoadFileForMe( const char *filename, int *pLength );
|
byte* COM_LoadFileForMe( const char *filename, int *pLength );
|
||||||
qboolean COM_IsSafeFileToDownload( const char *filename );
|
qboolean COM_IsSafeFileToDownload( const char *filename );
|
||||||
|
const char *COM_GetResourceTypeName( resourcetype_t restype );
|
||||||
cvar_t *pfnCVarGetPointer( const char *szVarName );
|
cvar_t *pfnCVarGetPointer( const char *szVarName );
|
||||||
int pfnDrawConsoleString( int x, int y, char *string );
|
int pfnDrawConsoleString( int x, int y, char *string );
|
||||||
void pfnDrawSetTextColor( float r, float g, float b );
|
void pfnDrawSetTextColor( float r, float g, float b );
|
||||||
@@ -600,6 +609,7 @@ void pfnDrawConsoleStringLen( const char *pText, int *length, int *height );
|
|||||||
void *Cache_Check( poolhandle_t mempool, struct cache_user_s *c );
|
void *Cache_Check( poolhandle_t mempool, struct cache_user_s *c );
|
||||||
void COM_TrimSpace( const char *source, char *dest );
|
void COM_TrimSpace( const char *source, char *dest );
|
||||||
void pfnGetModelBounds( model_t *mod, float *mins, float *maxs );
|
void pfnGetModelBounds( model_t *mod, float *mins, float *maxs );
|
||||||
|
void pfnCVarDirectSet( cvar_t *var, const char *szValue );
|
||||||
int COM_CheckParm( char *parm, char **ppnext );
|
int COM_CheckParm( char *parm, char **ppnext );
|
||||||
void pfnGetGameDir( char *szGetGameDir );
|
void pfnGetGameDir( char *szGetGameDir );
|
||||||
int pfnGetModelType( model_t *mod );
|
int pfnGetModelType( model_t *mod );
|
||||||
@@ -641,6 +651,7 @@ void pfnResetTutorMessageDecayData( void );
|
|||||||
//
|
//
|
||||||
// con_utils.c
|
// con_utils.c
|
||||||
//
|
//
|
||||||
|
qboolean Cmd_AutocompleteName( const char *source, int arg, char *buffer, size_t bufsize );
|
||||||
void Con_CompleteCommand( field_t *field );
|
void Con_CompleteCommand( field_t *field );
|
||||||
void Cmd_AutoComplete( char *complete_string );
|
void Cmd_AutoComplete( char *complete_string );
|
||||||
void Cmd_AutoCompleteClear( void );
|
void Cmd_AutoCompleteClear( void );
|
||||||
@@ -696,13 +707,21 @@ void CL_LegacyUpdateInfo( void );
|
|||||||
void CL_CharEvent( int key );
|
void CL_CharEvent( int key );
|
||||||
qboolean CL_DisableVisibility( void );
|
qboolean CL_DisableVisibility( void );
|
||||||
byte *COM_LoadFile( const char *filename, int usehunk, int *pLength );
|
byte *COM_LoadFile( const char *filename, int usehunk, int *pLength );
|
||||||
|
int CL_GetDemoComment( const char *demoname, char *comment );
|
||||||
|
void COM_AddAppDirectoryToSearchPath( const char *pszBaseDir, const char *appName );
|
||||||
|
int COM_ExpandFilename( const char *fileName, char *nameOutBuffer, int nameOutBufferSize );
|
||||||
struct cmd_s *Cmd_GetFirstFunctionHandle( void );
|
struct cmd_s *Cmd_GetFirstFunctionHandle( void );
|
||||||
struct cmd_s *Cmd_GetNextFunctionHandle( struct cmd_s *cmd );
|
struct cmd_s *Cmd_GetNextFunctionHandle( struct cmd_s *cmd );
|
||||||
struct cmdalias_s *Cmd_AliasGetList( void );
|
struct cmdalias_s *Cmd_AliasGetList( void );
|
||||||
const char *Cmd_GetName( struct cmd_s *cmd );
|
const char *Cmd_GetName( struct cmd_s *cmd );
|
||||||
|
void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float attn, int flags, int pitch );
|
||||||
|
void SV_CreateDecal( sizebuf_t *msg, const float *origin, int decalIndex, int entityIndex, int modelIndex, int flags, float scale );
|
||||||
void Log_Printf( const char *fmt, ... ) _format( 1 );
|
void Log_Printf( const char *fmt, ... ) _format( 1 );
|
||||||
void SV_BroadcastCommand( const char *fmt, ... ) _format( 1 );
|
void SV_BroadcastCommand( const char *fmt, ... ) _format( 1 );
|
||||||
|
qboolean SV_RestoreCustomDecal( struct decallist_s *entry, edict_t *pEdict, qboolean adjacent );
|
||||||
void SV_BroadcastPrintf( struct sv_client_s *ignore, const char *fmt, ... ) _format( 2 );
|
void SV_BroadcastPrintf( struct sv_client_s *ignore, const char *fmt, ... ) _format( 2 );
|
||||||
|
int R_CreateDecalList( struct decallist_s *pList );
|
||||||
|
void R_ClearAllDecals( void );
|
||||||
void CL_ClearStaticEntities( void );
|
void CL_ClearStaticEntities( void );
|
||||||
qboolean S_StreamGetCurrentState( char *currentTrack, char *loopTrack, int *position );
|
qboolean S_StreamGetCurrentState( char *currentTrack, char *loopTrack, int *position );
|
||||||
void CL_ServerCommand( qboolean reliable, const char *fmt, ... ) _format( 2 );
|
void CL_ServerCommand( qboolean reliable, const char *fmt, ... ) _format( 2 );
|
||||||
@@ -713,14 +732,17 @@ void SV_DrawOrthoTriangles( void );
|
|||||||
double CL_GetDemoFramerate( void );
|
double CL_GetDemoFramerate( void );
|
||||||
qboolean UI_CreditsActive( void );
|
qboolean UI_CreditsActive( void );
|
||||||
void CL_StopPlayback( void );
|
void CL_StopPlayback( void );
|
||||||
|
void CL_ExtraUpdate( void );
|
||||||
int CL_GetMaxClients( void );
|
int CL_GetMaxClients( void );
|
||||||
int SV_GetMaxClients( void );
|
int SV_GetMaxClients( void );
|
||||||
qboolean CL_IsRecordDemo( void );
|
qboolean CL_IsRecordDemo( void );
|
||||||
qboolean CL_IsTimeDemo( void );
|
qboolean CL_IsTimeDemo( void );
|
||||||
qboolean CL_IsPlaybackDemo( void );
|
qboolean CL_IsPlaybackDemo( void );
|
||||||
qboolean SV_Initialized( void );
|
qboolean SV_Initialized( void );
|
||||||
|
qboolean CL_LoadProgs( const char *name );
|
||||||
void CL_ProcessFile( qboolean successfully_received, const char *filename );
|
void CL_ProcessFile( qboolean successfully_received, const char *filename );
|
||||||
int SV_GetSaveComment( const char *savename, char *comment );
|
int SV_GetSaveComment( const char *savename, char *comment );
|
||||||
|
qboolean SV_NewGame( const char *mapName, qboolean loadGame );
|
||||||
void SV_ClipPMoveToEntity( struct physent_s *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, struct pmtrace_s *tr );
|
void SV_ClipPMoveToEntity( struct physent_s *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, struct pmtrace_s *tr );
|
||||||
void CL_ClipPMoveToEntity( struct physent_s *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, struct pmtrace_s *tr );
|
void CL_ClipPMoveToEntity( struct physent_s *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, struct pmtrace_s *tr );
|
||||||
void SV_SysError( const char *error_string );
|
void SV_SysError( const char *error_string );
|
||||||
@@ -729,9 +751,11 @@ void SV_ExecLoadLevel( void );
|
|||||||
void SV_ExecLoadGame( void );
|
void SV_ExecLoadGame( void );
|
||||||
void SV_ExecChangeLevel( void );
|
void SV_ExecChangeLevel( void );
|
||||||
void CL_WriteMessageHistory( void );
|
void CL_WriteMessageHistory( void );
|
||||||
|
void CL_SendCmd( void );
|
||||||
void CL_Disconnect( void );
|
void CL_Disconnect( void );
|
||||||
void CL_ClearEdicts( void );
|
void CL_ClearEdicts( void );
|
||||||
void CL_Crashed( void );
|
void CL_Crashed( void );
|
||||||
|
qboolean CL_NextDemo( void );
|
||||||
char *SV_Serverinfo( void );
|
char *SV_Serverinfo( void );
|
||||||
void CL_Drop( void );
|
void CL_Drop( void );
|
||||||
void Con_Init( void );
|
void Con_Init( void );
|
||||||
@@ -756,6 +780,7 @@ qboolean Info_SetValueForStarKey( char *s, const char *key, const char *value, i
|
|||||||
qboolean Info_IsValid( const char *s );
|
qboolean Info_IsValid( const char *s );
|
||||||
void Info_WriteVars( file_t *f );
|
void Info_WriteVars( file_t *f );
|
||||||
void Info_Print( const char *s );
|
void Info_Print( const char *s );
|
||||||
|
void Cmd_WriteVariables( file_t *f );
|
||||||
int Cmd_CheckMapsList( int fRefresh );
|
int Cmd_CheckMapsList( int fRefresh );
|
||||||
void COM_SetRandomSeed( int lSeed );
|
void COM_SetRandomSeed( int lSeed );
|
||||||
int COM_RandomLong( int lMin, int lMax );
|
int COM_RandomLong( int lMin, int lMax );
|
||||||
@@ -777,7 +802,6 @@ int COM_FileSize( const char *filename );
|
|||||||
void COM_FreeFile( void *buffer );
|
void COM_FreeFile( void *buffer );
|
||||||
int COM_CompareFileTime( const char *filename1, const char *filename2, int *iCompare );
|
int COM_CompareFileTime( const char *filename1, const char *filename2, int *iCompare );
|
||||||
char *va( const char *format, ... ) _format( 1 );
|
char *va( const char *format, ... ) _format( 1 );
|
||||||
qboolean CRC32_MapFile( dword *crcvalue, const char *filename, qboolean multiplayer );
|
|
||||||
|
|
||||||
// soundlib shared exports
|
// soundlib shared exports
|
||||||
qboolean S_Init( void );
|
qboolean S_Init( void );
|
||||||
@@ -795,7 +819,6 @@ uint ScreenGammaTable( uint );
|
|||||||
uint LinearGammaTable( uint );
|
uint LinearGammaTable( uint );
|
||||||
void V_Init( void );
|
void V_Init( void );
|
||||||
void V_CheckGamma( void );
|
void V_CheckGamma( void );
|
||||||
void V_CheckGammaEnd( void );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// identification.c
|
// identification.c
|
||||||
@@ -816,34 +839,6 @@ void NET_MasterClear( void );
|
|||||||
void NET_MasterShutdown( void );
|
void NET_MasterShutdown( void );
|
||||||
qboolean NET_GetMaster( netadr_t from, uint *challenge, double *last_heartbeat );
|
qboolean NET_GetMaster( netadr_t from, uint *challenge, double *last_heartbeat );
|
||||||
|
|
||||||
//
|
|
||||||
// sounds.c
|
|
||||||
//
|
|
||||||
typedef enum soundlst_group_e
|
|
||||||
{
|
|
||||||
BouncePlayerShell = 0,
|
|
||||||
BounceWeaponShell,
|
|
||||||
BounceConcrete,
|
|
||||||
BounceGlass,
|
|
||||||
BounceMetal,
|
|
||||||
BounceFlesh,
|
|
||||||
BounceWood,
|
|
||||||
Ricochet,
|
|
||||||
Explode,
|
|
||||||
PlayerWaterEnter,
|
|
||||||
PlayerWaterExit,
|
|
||||||
EntityWaterEnter,
|
|
||||||
EntityWaterExit,
|
|
||||||
|
|
||||||
SoundList_Groups // must be last
|
|
||||||
} soundlst_group_t;
|
|
||||||
|
|
||||||
int SoundList_Count( soundlst_group_t group );
|
|
||||||
const char *SoundList_GetRandom( soundlst_group_t group );
|
|
||||||
const char *SoundList_Get( soundlst_group_t group, int idx );
|
|
||||||
void SoundList_Init( void );
|
|
||||||
void SoundList_Shutdown( void );
|
|
||||||
|
|
||||||
#ifdef REF_DLL
|
#ifdef REF_DLL
|
||||||
#error "common.h in ref_dll"
|
#error "common.h in ref_dll"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ Cmd_GetMapList
|
|||||||
Prints or complete map filename
|
Prints or complete map filename
|
||||||
=====================================
|
=====================================
|
||||||
*/
|
*/
|
||||||
static qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
||||||
{
|
{
|
||||||
search_t *t;
|
search_t *t;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -220,7 +220,7 @@ Cmd_GetDemoList
|
|||||||
Prints or complete demo filename
|
Prints or complete demo filename
|
||||||
=====================================
|
=====================================
|
||||||
*/
|
*/
|
||||||
static qboolean Cmd_GetDemoList( const char *s, char *completedname, int length )
|
qboolean Cmd_GetDemoList( const char *s, char *completedname, int length )
|
||||||
{
|
{
|
||||||
search_t *t;
|
search_t *t;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -267,7 +267,7 @@ Cmd_GetMovieList
|
|||||||
Prints or complete movie filename
|
Prints or complete movie filename
|
||||||
=====================================
|
=====================================
|
||||||
*/
|
*/
|
||||||
static qboolean Cmd_GetMovieList( const char *s, char *completedname, int length )
|
qboolean Cmd_GetMovieList( const char *s, char *completedname, int length )
|
||||||
{
|
{
|
||||||
search_t *t;
|
search_t *t;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -314,7 +314,7 @@ Cmd_GetMusicList
|
|||||||
Prints or complete background track filename
|
Prints or complete background track filename
|
||||||
=====================================
|
=====================================
|
||||||
*/
|
*/
|
||||||
static qboolean Cmd_GetMusicList( const char *s, char *completedname, int length )
|
qboolean Cmd_GetMusicList( const char *s, char *completedname, int length )
|
||||||
{
|
{
|
||||||
search_t *t;
|
search_t *t;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -362,7 +362,7 @@ Cmd_GetSavesList
|
|||||||
Prints or complete savegame filename
|
Prints or complete savegame filename
|
||||||
=====================================
|
=====================================
|
||||||
*/
|
*/
|
||||||
static qboolean Cmd_GetSavesList( const char *s, char *completedname, int length )
|
qboolean Cmd_GetSavesList( const char *s, char *completedname, int length )
|
||||||
{
|
{
|
||||||
search_t *t;
|
search_t *t;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -409,7 +409,7 @@ Cmd_GetConfigList
|
|||||||
Prints or complete .cfg filename
|
Prints or complete .cfg filename
|
||||||
=====================================
|
=====================================
|
||||||
*/
|
*/
|
||||||
static qboolean Cmd_GetConfigList( const char *s, char *completedname, int length )
|
qboolean Cmd_GetConfigList( const char *s, char *completedname, int length )
|
||||||
{
|
{
|
||||||
search_t *t;
|
search_t *t;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -456,7 +456,7 @@ Cmd_GetSoundList
|
|||||||
Prints or complete sound filename
|
Prints or complete sound filename
|
||||||
=====================================
|
=====================================
|
||||||
*/
|
*/
|
||||||
static qboolean Cmd_GetSoundList( const char *s, char *completedname, int length )
|
qboolean Cmd_GetSoundList( const char *s, char *completedname, int length )
|
||||||
{
|
{
|
||||||
search_t *t;
|
search_t *t;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -508,7 +508,7 @@ Cmd_GetItemsList
|
|||||||
Prints or complete item classname (weapons only)
|
Prints or complete item classname (weapons only)
|
||||||
=====================================
|
=====================================
|
||||||
*/
|
*/
|
||||||
static qboolean Cmd_GetItemsList( const char *s, char *completedname, int length )
|
qboolean Cmd_GetItemsList( const char *s, char *completedname, int length )
|
||||||
{
|
{
|
||||||
search_t *t;
|
search_t *t;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -555,7 +555,7 @@ Cmd_GetKeysList
|
|||||||
Autocomplete for bind command
|
Autocomplete for bind command
|
||||||
=====================================
|
=====================================
|
||||||
*/
|
*/
|
||||||
static qboolean Cmd_GetKeysList( const char *s, char *completedname, int length )
|
qboolean Cmd_GetKeysList( const char *s, char *completedname, int length )
|
||||||
{
|
{
|
||||||
size_t i, numkeys;
|
size_t i, numkeys;
|
||||||
string keys[256];
|
string keys[256];
|
||||||
@@ -636,7 +636,7 @@ Cmd_GetCommandsList
|
|||||||
Autocomplete for bind command
|
Autocomplete for bind command
|
||||||
=====================================
|
=====================================
|
||||||
*/
|
*/
|
||||||
static qboolean Cmd_GetCommandsList( const char *s, char *completedname, int length )
|
qboolean Cmd_GetCommandsList( const char *s, char *completedname, int length )
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -701,7 +701,7 @@ Cmd_GetCustomList
|
|||||||
Prints or complete .HPK filenames
|
Prints or complete .HPK filenames
|
||||||
=====================================
|
=====================================
|
||||||
*/
|
*/
|
||||||
static qboolean Cmd_GetCustomList( const char *s, char *completedname, int length )
|
qboolean Cmd_GetCustomList( const char *s, char *completedname, int length )
|
||||||
{
|
{
|
||||||
search_t *t;
|
search_t *t;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -747,13 +747,17 @@ Cmd_GetGameList
|
|||||||
Prints or complete gamedir name
|
Prints or complete gamedir name
|
||||||
=====================================
|
=====================================
|
||||||
*/
|
*/
|
||||||
static qboolean Cmd_GetGamesList( const char *s, char *completedname, int length )
|
qboolean Cmd_GetGamesList( const char *s, char *completedname, int length )
|
||||||
{
|
{
|
||||||
int i, numgamedirs;
|
int i, numgamedirs;
|
||||||
string gamedirs[MAX_MODS];
|
string gamedirs[MAX_MODS];
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
// stand-alone games doesn't have cmd "game"
|
||||||
|
if( !Cmd_Exists( "game" ))
|
||||||
|
return false;
|
||||||
|
|
||||||
// compare gamelist with current keyword
|
// compare gamelist with current keyword
|
||||||
len = Q_strlen( s );
|
len = Q_strlen( s );
|
||||||
|
|
||||||
@@ -796,7 +800,7 @@ Cmd_GetCDList
|
|||||||
Prints or complete CD command name
|
Prints or complete CD command name
|
||||||
=====================================
|
=====================================
|
||||||
*/
|
*/
|
||||||
static qboolean Cmd_GetCDList( const char *s, char *completedname, int length )
|
qboolean Cmd_GetCDList( const char *s, char *completedname, int length )
|
||||||
{
|
{
|
||||||
int i, numcdcommands;
|
int i, numcdcommands;
|
||||||
string cdcommands[8];
|
string cdcommands[8];
|
||||||
@@ -850,7 +854,7 @@ static qboolean Cmd_GetCDList( const char *s, char *completedname, int length )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
||||||
{
|
{
|
||||||
qboolean use_filter = false;
|
qboolean use_filter = false;
|
||||||
byte buf[MAX_SYSPATH];
|
byte buf[MAX_SYSPATH];
|
||||||
@@ -1057,7 +1061,7 @@ Autocomplete filename
|
|||||||
for various cmds
|
for various cmds
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
static qboolean Cmd_AutocompleteName( const char *source, int arg, char *buffer, size_t bufsize )
|
qboolean Cmd_AutocompleteName( const char *source, int arg, char *buffer, size_t bufsize )
|
||||||
{
|
{
|
||||||
autocomplete_list_t *list;
|
autocomplete_list_t *list;
|
||||||
|
|
||||||
@@ -1341,13 +1345,13 @@ static void Cmd_WriteHelp(const char *name, const char *unused, const char *desc
|
|||||||
if( length == 0 ) FS_Printf( f, "%s \"%s\"\n", name, desc );
|
if( length == 0 ) FS_Printf( f, "%s \"%s\"\n", name, desc );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Cmd_WriteOpenGLVariables( file_t *f )
|
void Cmd_WriteOpenGLVariables( file_t *f )
|
||||||
{
|
{
|
||||||
Cvar_LookupVars( FCVAR_GLCONFIG, NULL, f, (setpair_t)Cmd_WriteOpenGLCvar );
|
Cvar_LookupVars( FCVAR_GLCONFIG, NULL, f, (setpair_t)Cmd_WriteOpenGLCvar );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
static void Host_FinalizeConfig( file_t *f, const char *config )
|
void Host_FinalizeConfig( file_t *f, const char *config )
|
||||||
{
|
{
|
||||||
string backup, newcfg;
|
string backup, newcfg;
|
||||||
|
|
||||||
|
|||||||
@@ -372,9 +372,9 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
|
|||||||
bp = (void**)ucontext->uc_mcontext.mc_rbp;
|
bp = (void**)ucontext->uc_mcontext.mc_rbp;
|
||||||
sp = (void**)ucontext->uc_mcontext.mc_rsp;
|
sp = (void**)ucontext->uc_mcontext.mc_rsp;
|
||||||
#elif XASH_NETBSD
|
#elif XASH_NETBSD
|
||||||
pc = (void*)ucontext->uc_mcontext.__gregs[_REG_RIP];
|
pc = (void*)ucontext->uc_mcontext.__gregs[REG_RIP];
|
||||||
bp = (void**)ucontext->uc_mcontext.__gregs[_REG_RBP];
|
bp = (void**)ucontext->uc_mcontext.__gregs[REG_RBP];
|
||||||
sp = (void**)ucontext->uc_mcontext.__gregs[_REG_RSP];
|
sp = (void**)ucontext->uc_mcontext.__gregs[REG_RSP];
|
||||||
#elif XASH_OPENBSD
|
#elif XASH_OPENBSD
|
||||||
pc = (void*)ucontext->sc_rip;
|
pc = (void*)ucontext->sc_rip;
|
||||||
bp = (void**)ucontext->sc_rbp;
|
bp = (void**)ucontext->sc_rbp;
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ Cvar_ValidateString
|
|||||||
deal with userinfo etc
|
deal with userinfo etc
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
static const char *Cvar_ValidateString( convar_t *var, const char *value )
|
const char *Cvar_ValidateString( convar_t *var, const char *value )
|
||||||
{
|
{
|
||||||
const char *pszValue;
|
const char *pszValue;
|
||||||
static char szNew[MAX_STRING];
|
static char szNew[MAX_STRING];
|
||||||
@@ -278,7 +278,7 @@ Cvar_UnlinkVar
|
|||||||
unlink the variable
|
unlink the variable
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
static int Cvar_UnlinkVar( const char *var_name, int group )
|
int Cvar_UnlinkVar( const char *var_name, int group )
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
convar_t **prev;
|
convar_t **prev;
|
||||||
@@ -685,7 +685,7 @@ Cvar_DirectSet
|
|||||||
way to change value for many cvars
|
way to change value for many cvars
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void GAME_EXPORT Cvar_DirectSet( convar_t *var, const char *value )
|
void Cvar_DirectSet( convar_t *var, const char *value )
|
||||||
{
|
{
|
||||||
const char *pszValue;
|
const char *pszValue;
|
||||||
|
|
||||||
@@ -1091,7 +1091,7 @@ Cvar_Toggle_f
|
|||||||
Toggles a cvar for easy single key binding
|
Toggles a cvar for easy single key binding
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
static void Cvar_Toggle_f( void )
|
void Cvar_Toggle_f( void )
|
||||||
{
|
{
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
@@ -1114,7 +1114,7 @@ Allows setting and defining of arbitrary cvars from console, even if they
|
|||||||
weren't declared in C code.
|
weren't declared in C code.
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
static void Cvar_Set_f( void )
|
void Cvar_Set_f( void )
|
||||||
{
|
{
|
||||||
int i, c, l = 0, len;
|
int i, c, l = 0, len;
|
||||||
char combined[MAX_CMD_TOKENS];
|
char combined[MAX_CMD_TOKENS];
|
||||||
@@ -1147,7 +1147,7 @@ Cvar_SetGL_f
|
|||||||
As Cvar_Set, but also flags it as glconfig
|
As Cvar_Set, but also flags it as glconfig
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
static void Cvar_SetGL_f( void )
|
void Cvar_SetGL_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() != 3 )
|
if( Cmd_Argc() != 3 )
|
||||||
{
|
{
|
||||||
@@ -1163,7 +1163,7 @@ static void Cvar_SetGL_f( void )
|
|||||||
Cvar_Reset_f
|
Cvar_Reset_f
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
static void Cvar_Reset_f( void )
|
void Cvar_Reset_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() != 2 )
|
if( Cmd_Argc() != 2 )
|
||||||
{
|
{
|
||||||
@@ -1179,7 +1179,7 @@ static void Cvar_Reset_f( void )
|
|||||||
Cvar_List_f
|
Cvar_List_f
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
static void Cvar_List_f( void )
|
void Cvar_List_f( void )
|
||||||
{
|
{
|
||||||
convar_t *var;
|
convar_t *var;
|
||||||
const char *match = NULL;
|
const char *match = NULL;
|
||||||
|
|||||||
@@ -134,6 +134,15 @@ void Con_Init( void )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void R_ClearAllDecals( void )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
int R_CreateDecalList( struct decallist_s *pList )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void GAME_EXPORT S_StopSound(int entnum, int channel, const char *soundname)
|
void GAME_EXPORT S_StopSound(int entnum, int channel, const char *soundname)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
4556
engine/common/filesystem.c
Normal file
4556
engine/common/filesystem.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -65,7 +65,7 @@ static CVAR_DEFINE( host_sleeptime, "sleeptime", "1", FCVAR_ARCHIVE|FCVAR_FILTER
|
|||||||
static CVAR_DEFINE_AUTO( host_sleeptime_debug, "0", 0, "print sleeps between frames" );
|
static CVAR_DEFINE_AUTO( host_sleeptime_debug, "0", 0, "print sleeps between frames" );
|
||||||
CVAR_DEFINE( con_gamemaps, "con_mapfilter", "1", FCVAR_ARCHIVE, "when true show only maps in game folder" );
|
CVAR_DEFINE( con_gamemaps, "con_mapfilter", "1", FCVAR_ARCHIVE, "when true show only maps in game folder" );
|
||||||
|
|
||||||
static void Sys_PrintUsage( void )
|
void Sys_PrintUsage( void )
|
||||||
{
|
{
|
||||||
string version_str;
|
string version_str;
|
||||||
const char *usage_str;
|
const char *usage_str;
|
||||||
@@ -109,7 +109,6 @@ static void Sys_PrintUsage( void )
|
|||||||
O("-clockwindow <cw>", "adjust clockwindow used to ignore client commands to prevent speed hacks")
|
O("-clockwindow <cw>", "adjust clockwindow used to ignore client commands to prevent speed hacks")
|
||||||
|
|
||||||
"\nGame options:\n"
|
"\nGame options:\n"
|
||||||
O("-game <directory>", "set game directory to start engine with")
|
|
||||||
O("-dll <path> ", "override server DLL path")
|
O("-dll <path> ", "override server DLL path")
|
||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
O("-clientlib <path>", "override client DLL path")
|
O("-clientlib <path>", "override client DLL path")
|
||||||
@@ -349,7 +348,7 @@ static int Host_CalcSleep( void )
|
|||||||
return host_sleeptime.value;
|
return host_sleeptime.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Host_NewInstance( const char *name, const char *finalmsg )
|
void Host_NewInstance( const char *name, const char *finalmsg )
|
||||||
{
|
{
|
||||||
if( !pChangeGame ) return;
|
if( !pChangeGame ) return;
|
||||||
|
|
||||||
@@ -367,7 +366,7 @@ Host_ChangeGame_f
|
|||||||
Change game modification
|
Change game modification
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void Host_ChangeGame_f( void )
|
void Host_ChangeGame_f( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -406,7 +405,7 @@ static void Host_ChangeGame_f( void )
|
|||||||
Host_Exec_f
|
Host_Exec_f
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static void Host_Exec_f( void )
|
void Host_Exec_f( void )
|
||||||
{
|
{
|
||||||
string cfgpath;
|
string cfgpath;
|
||||||
byte *f;
|
byte *f;
|
||||||
@@ -492,7 +491,7 @@ static void Host_Exec_f( void )
|
|||||||
Host_MemStats_f
|
Host_MemStats_f
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static void Host_MemStats_f( void )
|
void Host_MemStats_f( void )
|
||||||
{
|
{
|
||||||
switch( Cmd_Argc( ))
|
switch( Cmd_Argc( ))
|
||||||
{
|
{
|
||||||
@@ -510,7 +509,7 @@ static void Host_MemStats_f( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Host_Minimize_f( void )
|
void Host_Minimize_f( void )
|
||||||
{
|
{
|
||||||
#ifdef XASH_SDL
|
#ifdef XASH_SDL
|
||||||
if( host.hWnd ) SDL_MinimizeWindow( host.hWnd );
|
if( host.hWnd ) SDL_MinimizeWindow( host.hWnd );
|
||||||
@@ -549,7 +548,7 @@ qboolean Host_IsLocalClient( void )
|
|||||||
Host_RegisterDecal
|
Host_RegisterDecal
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static qboolean Host_RegisterDecal( const char *name, int *count )
|
qboolean Host_RegisterDecal( const char *name, int *count )
|
||||||
{
|
{
|
||||||
char shortname[MAX_QPATH];
|
char shortname[MAX_QPATH];
|
||||||
int i;
|
int i;
|
||||||
@@ -583,7 +582,7 @@ static qboolean Host_RegisterDecal( const char *name, int *count )
|
|||||||
Host_InitDecals
|
Host_InitDecals
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void Host_InitDecals( void )
|
void Host_InitDecals( void )
|
||||||
{
|
{
|
||||||
int i, num_decals = 0;
|
int i, num_decals = 0;
|
||||||
search_t *t;
|
search_t *t;
|
||||||
@@ -614,7 +613,7 @@ Host_GetCommands
|
|||||||
Add them exactly as if they had been typed at the console
|
Add them exactly as if they had been typed at the console
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
static void Host_GetCommands( void )
|
void Host_GetCommands( void )
|
||||||
{
|
{
|
||||||
char *cmd;
|
char *cmd;
|
||||||
|
|
||||||
@@ -632,7 +631,7 @@ Host_CalcFPS
|
|||||||
compute actual FPS for various modes
|
compute actual FPS for various modes
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
static double Host_CalcFPS( void )
|
double Host_CalcFPS( void )
|
||||||
{
|
{
|
||||||
double fps = 0.0;
|
double fps = 0.0;
|
||||||
|
|
||||||
@@ -749,7 +748,7 @@ Host_FilterTime
|
|||||||
Returns false if the time is too short to run a frame
|
Returns false if the time is too short to run a frame
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
static qboolean Host_FilterTime( float time )
|
qboolean Host_FilterTime( float time )
|
||||||
{
|
{
|
||||||
static double oldtime;
|
static double oldtime;
|
||||||
double dt;
|
double dt;
|
||||||
@@ -874,7 +873,7 @@ void GAME_EXPORT Host_Error( const char *error, ... )
|
|||||||
Host_AbortCurrentFrame();
|
Host_AbortCurrentFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Host_Error_f( void )
|
void Host_Error_f( void )
|
||||||
{
|
{
|
||||||
const char *error = Cmd_Argv( 1 );
|
const char *error = Cmd_Argv( 1 );
|
||||||
|
|
||||||
@@ -882,7 +881,7 @@ static void Host_Error_f( void )
|
|||||||
Host_Error( "%s\n", error );
|
Host_Error( "%s\n", error );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Sys_Error_f( void )
|
void Sys_Error_f( void )
|
||||||
{
|
{
|
||||||
const char *error = Cmd_Argv( 1 );
|
const char *error = Cmd_Argv( 1 );
|
||||||
|
|
||||||
@@ -905,7 +904,7 @@ static void Host_Crash_f( void )
|
|||||||
Host_Userconfigd_f
|
Host_Userconfigd_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void Host_Userconfigd_f( void )
|
void Host_Userconfigd_f( void )
|
||||||
{
|
{
|
||||||
search_t *t;
|
search_t *t;
|
||||||
int i;
|
int i;
|
||||||
@@ -949,7 +948,7 @@ static void Host_RunTests( int stage )
|
|||||||
Host_InitCommon
|
Host_InitCommon
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bChangeGame )
|
void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bChangeGame )
|
||||||
{
|
{
|
||||||
char dev_level[4];
|
char dev_level[4];
|
||||||
int developer = DEFAULT_DEV;
|
int developer = DEFAULT_DEV;
|
||||||
@@ -1065,10 +1064,10 @@ static void Host_InitCommon( int argc, char **argv, const char *progname, qboole
|
|||||||
|
|
||||||
// init host state machine
|
// init host state machine
|
||||||
COM_InitHostState();
|
COM_InitHostState();
|
||||||
|
#ifdef XASH_HASHED_VARS
|
||||||
// init hashed commands
|
// init hashed commands
|
||||||
BaseCmd_Init();
|
BaseCmd_Init();
|
||||||
|
#endif
|
||||||
// startup cmds and cvars subsystem
|
// startup cmds and cvars subsystem
|
||||||
Cmd_Init();
|
Cmd_Init();
|
||||||
Cvar_Init();
|
Cvar_Init();
|
||||||
@@ -1111,6 +1110,8 @@ static void Host_InitCommon( int argc, char **argv, const char *progname, qboole
|
|||||||
Sys_Error( "couldn't find xash3d data directory" );
|
Sys_Error( "couldn't find xash3d data directory" );
|
||||||
host.rootdir[0] = 0;
|
host.rootdir[0] = 0;
|
||||||
}
|
}
|
||||||
|
#elif XASH_PSP
|
||||||
|
COM_ExtractFilePath( argv[0], host.rootdir );
|
||||||
#elif (XASH_SDL == 2) && !XASH_NSWITCH // GetBasePath not impl'd in switch-sdl2
|
#elif (XASH_SDL == 2) && !XASH_NSWITCH // GetBasePath not impl'd in switch-sdl2
|
||||||
char *szBasePath = SDL_GetBasePath();
|
char *szBasePath = SDL_GetBasePath();
|
||||||
if( szBasePath )
|
if( szBasePath )
|
||||||
@@ -1241,7 +1242,7 @@ static void Host_InitCommon( int argc, char **argv, const char *progname, qboole
|
|||||||
Key_Init();
|
Key_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Host_FreeCommon( void )
|
void Host_FreeCommon( void )
|
||||||
{
|
{
|
||||||
Image_Shutdown();
|
Image_Shutdown();
|
||||||
Sound_Shutdown();
|
Sound_Shutdown();
|
||||||
@@ -1311,7 +1312,6 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
|||||||
|
|
||||||
HTTP_Init();
|
HTTP_Init();
|
||||||
ID_Init();
|
ID_Init();
|
||||||
SoundList_Init();
|
|
||||||
|
|
||||||
if( Host_IsDedicated() )
|
if( Host_IsDedicated() )
|
||||||
{
|
{
|
||||||
@@ -1414,7 +1414,6 @@ void EXPORT Host_Shutdown( void )
|
|||||||
SV_ShutdownFilter();
|
SV_ShutdownFilter();
|
||||||
CL_Shutdown();
|
CL_Shutdown();
|
||||||
|
|
||||||
SoundList_Shutdown();
|
|
||||||
Mod_Shutdown();
|
Mod_Shutdown();
|
||||||
NET_Shutdown();
|
NET_Shutdown();
|
||||||
HTTP_Shutdown();
|
HTTP_Shutdown();
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ void COM_ChangeLevel( char const *pNewLevel, char const *pLandmarkName, qboolean
|
|||||||
GameState->newGame = false;
|
GameState->newGame = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Host_ShutdownGame( void )
|
void Host_ShutdownGame( void )
|
||||||
{
|
{
|
||||||
SV_ShutdownGame();
|
SV_ShutdownGame();
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ static void Host_ShutdownGame( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Host_RunFrame( float time )
|
void Host_RunFrame( float time )
|
||||||
{
|
{
|
||||||
// at this time, we don't need to get events from OS on dedicated
|
// at this time, we don't need to get events from OS on dedicated
|
||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ static hash_pack_queue_t *gp_hpak_queue = NULL;
|
|||||||
static hpak_header_t hash_pack_header;
|
static hpak_header_t hash_pack_header;
|
||||||
static hpak_info_t hash_pack_info;
|
static hpak_info_t hash_pack_info;
|
||||||
|
|
||||||
static const char *HPAK_TypeFromIndex( int type )
|
const char *HPAK_TypeFromIndex( int type )
|
||||||
{
|
{
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
@@ -94,7 +94,7 @@ void HPAK_FlushHostQueue( void )
|
|||||||
gp_hpak_queue = NULL;
|
gp_hpak_queue = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *pData, file_t *fin )
|
void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *pData, file_t *fin )
|
||||||
{
|
{
|
||||||
int filelocation;
|
int filelocation;
|
||||||
string pakname;
|
string pakname;
|
||||||
@@ -872,7 +872,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
|
|||||||
FS_Rename( save_path, read_path );
|
FS_Rename( save_path, read_path );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HPAK_List_f( void )
|
void HPAK_List_f( void )
|
||||||
{
|
{
|
||||||
int nCurrent;
|
int nCurrent;
|
||||||
hpak_header_t header;
|
hpak_header_t header;
|
||||||
@@ -950,7 +950,7 @@ static void HPAK_List_f( void )
|
|||||||
FS_Close( f );
|
FS_Close( f );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HPAK_Extract_f( void )
|
void HPAK_Extract_f( void )
|
||||||
{
|
{
|
||||||
int nCurrent;
|
int nCurrent;
|
||||||
hpak_header_t header;
|
hpak_header_t header;
|
||||||
@@ -1061,7 +1061,7 @@ static void HPAK_Extract_f( void )
|
|||||||
FS_Close( f );
|
FS_Close( f );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HPAK_Remove_f( void )
|
void HPAK_Remove_f( void )
|
||||||
{
|
{
|
||||||
resource_t resource;
|
resource_t resource;
|
||||||
|
|
||||||
@@ -1083,7 +1083,7 @@ static void HPAK_Remove_f( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HPAK_Validate_f( void )
|
void HPAK_Validate_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() != 2 )
|
if( Cmd_Argc() != 2 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
rgba_t palette[256] = { 0 };
|
rgba_t palette[256] = { 0 };
|
||||||
int i, columns, column, rows, row, bpp = 1;
|
int i, columns, column, rows, row, bpp = 1;
|
||||||
int cbPalBytes = 0, padSize = 0, bps = 0;
|
int cbPalBytes = 0, padSize = 0, bps = 0;
|
||||||
uint reflectivity[3] = { 0, 0, 0 };
|
int reflectivity[3] = { 0, 0, 0 };
|
||||||
qboolean load_qfont = false;
|
qboolean load_qfont = false;
|
||||||
bmp_t bhdr;
|
bmp_t bhdr;
|
||||||
fs_offset_t estimatedSize;
|
fs_offset_t estimatedSize;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ GNU General Public License for more details.
|
|||||||
#include "xash3d_mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
#include "img_dds.h"
|
#include "img_dds.h"
|
||||||
|
|
||||||
static qboolean Image_CheckDXT3Alpha( dds_t *hdr, byte *fin )
|
qboolean Image_CheckDXT3Alpha( dds_t *hdr, byte *fin )
|
||||||
{
|
{
|
||||||
word sAlpha;
|
word sAlpha;
|
||||||
byte *alpha;
|
byte *alpha;
|
||||||
@@ -50,7 +50,7 @@ static qboolean Image_CheckDXT3Alpha( dds_t *hdr, byte *fin )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static qboolean Image_CheckDXT5Alpha( dds_t *hdr, byte *fin )
|
qboolean Image_CheckDXT5Alpha( dds_t *hdr, byte *fin )
|
||||||
{
|
{
|
||||||
uint bits, bitmask;
|
uint bits, bitmask;
|
||||||
byte *alphamask;
|
byte *alphamask;
|
||||||
@@ -91,7 +91,7 @@ static qboolean Image_CheckDXT5Alpha( dds_t *hdr, byte *fin )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Image_DXTGetPixelFormat( dds_t *hdr, dds_header_dxt10_t *headerExt )
|
void Image_DXTGetPixelFormat( dds_t *hdr, dds_header_dxt10_t *headerExt )
|
||||||
{
|
{
|
||||||
uint bits = hdr->dsPixelFormat.dwRGBBitCount;
|
uint bits = hdr->dsPixelFormat.dwRGBBitCount;
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ static void Image_DXTGetPixelFormat( dds_t *hdr, dds_header_dxt10_t *headerExt )
|
|||||||
image.num_mips = hdr->dwMipMapCount; // get actual mip count
|
image.num_mips = hdr->dwMipMapCount; // get actual mip count
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t Image_DXTCalcMipmapSize( dds_t *hdr )
|
size_t Image_DXTCalcMipmapSize( dds_t *hdr )
|
||||||
{
|
{
|
||||||
size_t buffsize = 0;
|
size_t buffsize = 0;
|
||||||
int i, width, height;
|
int i, width, height;
|
||||||
@@ -231,7 +231,7 @@ static size_t Image_DXTCalcMipmapSize( dds_t *hdr )
|
|||||||
return buffsize;
|
return buffsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint Image_DXTCalcSize( const char *name, dds_t *hdr, size_t filesize )
|
uint Image_DXTCalcSize( const char *name, dds_t *hdr, size_t filesize )
|
||||||
{
|
{
|
||||||
size_t buffsize = 0;
|
size_t buffsize = 0;
|
||||||
int w = image.width;
|
int w = image.width;
|
||||||
@@ -269,7 +269,7 @@ static uint Image_DXTCalcSize( const char *name, dds_t *hdr, size_t filesize )
|
|||||||
return buffsize;
|
return buffsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Image_DXTAdjustVolume( dds_t *hdr )
|
void Image_DXTAdjustVolume( dds_t *hdr )
|
||||||
{
|
{
|
||||||
if( hdr->dwDepth <= 1 )
|
if( hdr->dwDepth <= 1 )
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -597,7 +597,6 @@ void Test_RunImagelib( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define IMPLEMENT_IMAGELIB_FUZZ_TARGET( export, target ) \
|
#define IMPLEMENT_IMAGELIB_FUZZ_TARGET( export, target ) \
|
||||||
int export( const uint8_t *Data, size_t Size ); \
|
|
||||||
int EXPORT export( const uint8_t *Data, size_t Size ) \
|
int EXPORT export( const uint8_t *Data, size_t Size ) \
|
||||||
{ \
|
{ \
|
||||||
rgbdata_t *rgb; \
|
rgbdata_t *rgb; \
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ static int bias[netsize]; // bias and freq arrays for learning
|
|||||||
static int freq[netsize];
|
static int freq[netsize];
|
||||||
static int radpower[initrad]; // radpower for precomputation
|
static int radpower[initrad]; // radpower for precomputation
|
||||||
|
|
||||||
static void initnet( byte *thepic, int len, int sample )
|
void initnet( byte *thepic, int len, int sample )
|
||||||
{
|
{
|
||||||
register int i, *p;
|
register int i, *p;
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ static void initnet( byte *thepic, int len, int sample )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unbias network to give byte values 0..255 and record position i to prepare for sort
|
// Unbias network to give byte values 0..255 and record position i to prepare for sort
|
||||||
static void unbiasnet( void )
|
void unbiasnet( void )
|
||||||
{
|
{
|
||||||
int i, j, temp;
|
int i, j, temp;
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ static void unbiasnet( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insertion sort of network and building of netindex[0..255] (to do after unbias)
|
// Insertion sort of network and building of netindex[0..255] (to do after unbias)
|
||||||
static void inxbuild( void )
|
void inxbuild( void )
|
||||||
{
|
{
|
||||||
register int *p, *q;
|
register int *p, *q;
|
||||||
register int i, j, smallpos, smallval;
|
register int i, j, smallpos, smallval;
|
||||||
@@ -162,7 +162,7 @@ static void inxbuild( void )
|
|||||||
|
|
||||||
|
|
||||||
// Search for BGR values 0..255 (after net is unbiased) and return colour index
|
// Search for BGR values 0..255 (after net is unbiased) and return colour index
|
||||||
static int inxsearch( int r, int g, int b )
|
int inxsearch( int r, int g, int b )
|
||||||
{
|
{
|
||||||
register int i, j, dist, a, bestd;
|
register int i, j, dist, a, bestd;
|
||||||
register int *p;
|
register int *p;
|
||||||
@@ -243,7 +243,7 @@ static int inxsearch( int r, int g, int b )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Search for biased BGR values
|
// Search for biased BGR values
|
||||||
static int contest( int r, int g, int b )
|
int contest( int r, int g, int b )
|
||||||
{
|
{
|
||||||
register int *p, *f, *n;
|
register int *p, *f, *n;
|
||||||
register int i, dist, a, biasdist, betafreq;
|
register int i, dist, a, biasdist, betafreq;
|
||||||
@@ -298,7 +298,7 @@ static int contest( int r, int g, int b )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Move neuron i towards biased (b,g,r) by factor alpha
|
// Move neuron i towards biased (b,g,r) by factor alpha
|
||||||
static void altersingle( int alpha, int i, int r, int g, int b )
|
void altersingle( int alpha, int i, int r, int g, int b )
|
||||||
{
|
{
|
||||||
register int *n;
|
register int *n;
|
||||||
|
|
||||||
@@ -311,7 +311,7 @@ static void altersingle( int alpha, int i, int r, int g, int b )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2)) in radpower[|i-j|]
|
// Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2)) in radpower[|i-j|]
|
||||||
static void alterneigh( int rad, int i, int r, int g, int b )
|
void alterneigh( int rad, int i, int r, int g, int b )
|
||||||
{
|
{
|
||||||
register int j, k, lo, hi, a;
|
register int j, k, lo, hi, a;
|
||||||
register int *p, *q;
|
register int *p, *q;
|
||||||
@@ -354,7 +354,7 @@ static void alterneigh( int rad, int i, int r, int g, int b )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Main Learning Loop
|
// Main Learning Loop
|
||||||
static void learn( void )
|
void learn( void )
|
||||||
{
|
{
|
||||||
register byte *p;
|
register byte *p;
|
||||||
register int i, j, r, g, b;
|
register int i, j, r, g, b;
|
||||||
|
|||||||
@@ -24,14 +24,15 @@ Image_LoadTGA
|
|||||||
*/
|
*/
|
||||||
qboolean Image_LoadTGA( const char *name, const byte *buffer, fs_offset_t filesize )
|
qboolean Image_LoadTGA( const char *name, const byte *buffer, fs_offset_t filesize )
|
||||||
{
|
{
|
||||||
int i, columns, rows, row_inc, row, col;
|
int i, columns, rows, row_inc, row, col, bpp = 1;
|
||||||
byte *buf_p, *pixbuf, *targa_rgba;
|
byte *buf_p, *pixbuf, *targa_rgba;
|
||||||
rgba_t palette[256];
|
rgba_t palette[256];
|
||||||
byte red = 0, green = 0, blue = 0, alpha = 0;
|
byte red = 0, green = 0, blue = 0, alpha = 0;
|
||||||
int readpixelcount, pixelcount;
|
int readpixelcount, pixelcount;
|
||||||
uint reflectivity[3] = { 0, 0, 0 };
|
int reflectivity[3] = { 0, 0, 0 };
|
||||||
qboolean compressed;
|
qboolean compressed;
|
||||||
tga_t targa_header;
|
tga_t targa_header;
|
||||||
|
int palIndex = 0;
|
||||||
|
|
||||||
if( filesize < sizeof( tga_t ))
|
if( filesize < sizeof( tga_t ))
|
||||||
return false;
|
return false;
|
||||||
@@ -55,8 +56,6 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
// check for tga file
|
// check for tga file
|
||||||
if( !Image_ValidSize( name )) return false;
|
if( !Image_ValidSize( name )) return false;
|
||||||
|
|
||||||
image.type = PF_RGBA_32; // always exctracted to 32-bit buffer
|
|
||||||
|
|
||||||
if( targa_header.image_type == 1 || targa_header.image_type == 9 )
|
if( targa_header.image_type == 1 || targa_header.image_type == 9 )
|
||||||
{
|
{
|
||||||
// uncompressed colormapped image
|
// uncompressed colormapped image
|
||||||
@@ -119,11 +118,35 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) Type %i not supported\n", name, targa_header.image_type );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
columns = targa_header.width;
|
columns = targa_header.width;
|
||||||
rows = targa_header.height;
|
rows = targa_header.height;
|
||||||
|
|
||||||
image.size = image.width * image.height * 4;
|
if( Image_CheckFlag( IL_KEEP_8BIT ) && ( targa_header.image_type == 1 || targa_header.image_type == 9 ))
|
||||||
|
{
|
||||||
|
pixbuf = image.palette = Mem_Malloc( host.imagepool, 1024 );
|
||||||
|
for( i = 0; i < targa_header.colormap_length; i++ )
|
||||||
|
{
|
||||||
|
*pixbuf++ = palette[i][0];
|
||||||
|
*pixbuf++ = palette[i][1];
|
||||||
|
*pixbuf++ = palette[i][2];
|
||||||
|
*pixbuf++ = palette[i][3];
|
||||||
|
}
|
||||||
|
image.type = PF_INDEXED_32;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
image.palette = NULL;
|
||||||
|
image.type = PF_RGBA_32;
|
||||||
|
bpp = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
image.size = image.width * image.height * bpp;
|
||||||
targa_rgba = image.rgba = Mem_Malloc( host.imagepool, image.size );
|
targa_rgba = image.rgba = Mem_Malloc( host.imagepool, image.size );
|
||||||
|
|
||||||
// if bit 5 of attributes isn't set, the image has been stored from bottom to top
|
// if bit 5 of attributes isn't set, the image has been stored from bottom to top
|
||||||
@@ -134,8 +157,8 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pixbuf = targa_rgba + ( rows - 1 ) * columns * 4;
|
pixbuf = targa_rgba + ( rows - 1 ) * columns * bpp;
|
||||||
row_inc = -columns * 4 * 2;
|
row_inc = -columns * bpp * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
compressed = ( targa_header.image_type == 9 || targa_header.image_type == 10 || targa_header.image_type == 11 );
|
compressed = ( targa_header.image_type == 9 || targa_header.image_type == 10 || targa_header.image_type == 11 );
|
||||||
@@ -161,13 +184,13 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
case 1:
|
case 1:
|
||||||
case 9:
|
case 9:
|
||||||
// colormapped image
|
// colormapped image
|
||||||
blue = *buf_p++;
|
palIndex = *buf_p++;
|
||||||
if( blue < targa_header.colormap_length )
|
if( palIndex < targa_header.colormap_length )
|
||||||
{
|
{
|
||||||
red = palette[blue][0];
|
red = palette[palIndex][0];
|
||||||
green = palette[blue][1];
|
green = palette[palIndex][1];
|
||||||
alpha = palette[blue][3];
|
blue = palette[palIndex][2];
|
||||||
blue = palette[blue][2];
|
alpha = palette[palIndex][3];
|
||||||
if( alpha != 255 ) image.flags |= IMAGE_HAS_ALPHA;
|
if( alpha != 255 ) image.flags |= IMAGE_HAS_ALPHA;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -208,10 +231,18 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
reflectivity[1] += green;
|
reflectivity[1] += green;
|
||||||
reflectivity[2] += blue;
|
reflectivity[2] += blue;
|
||||||
|
|
||||||
*pixbuf++ = red;
|
if( image.type == PF_INDEXED_32 || image.type == PF_INDEXED_24 )
|
||||||
*pixbuf++ = green;
|
{
|
||||||
*pixbuf++ = blue;
|
*pixbuf++ = palIndex;
|
||||||
*pixbuf++ = alpha;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*pixbuf++ = red;
|
||||||
|
*pixbuf++ = green;
|
||||||
|
*pixbuf++ = blue;
|
||||||
|
*pixbuf++ = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
if( ++col == columns )
|
if( ++col == columns )
|
||||||
{
|
{
|
||||||
// run spans across rows
|
// run spans across rows
|
||||||
@@ -223,6 +254,7 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
}
|
}
|
||||||
|
|
||||||
VectorDivide( reflectivity, ( image.width * image.height ), image.fogParams );
|
VectorDivide( reflectivity, ( image.width * image.height ), image.fogParams );
|
||||||
|
if( image.palette ) Image_GetPaletteBMP( image.palette );
|
||||||
image.depth = 1;
|
image.depth = 1;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -93,6 +93,23 @@ static const loadpixformat_t load_null[] =
|
|||||||
{ NULL, NULL, NULL, IL_HINT_NO }
|
{ NULL, NULL, NULL, IL_HINT_NO }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// a1ba: that's weird, better debug
|
||||||
|
#if XASH_PSP
|
||||||
|
static const loadpixformat_t load_game[] =
|
||||||
|
{
|
||||||
|
{ "%s%s.%s", "mip", Image_LoadMIP, IL_HINT_NO }, // hl textures from wad or buffer
|
||||||
|
{ "%s%s.%s", "mdl", Image_LoadMDL, IL_HINT_HL }, // hl studio model skins
|
||||||
|
{ "%s%s.%s", "spr", Image_LoadSPR, IL_HINT_HL }, // hl sprite frames
|
||||||
|
{ "%s%s.%s", "lmp", Image_LoadLMP, IL_HINT_NO }, // hl menu images (cached.wad etc)
|
||||||
|
{ "%s%s.%s", "fnt", Image_LoadFNT, IL_HINT_HL }, // hl console font (fonts.wad etc)
|
||||||
|
{ "%s%s.%s", "pal", Image_LoadPAL, IL_HINT_NO }, // install studio\sprite palette
|
||||||
|
{ "%s%s.%s", "dds", Image_LoadDDS, IL_HINT_NO }, // dds for world and studio models
|
||||||
|
{ "%s%s.%s", "tga", Image_LoadTGA, IL_HINT_NO }, // hl vgui menus
|
||||||
|
{ "%s%s.%s", "bmp", Image_LoadBMP, IL_HINT_NO }, // WON menu images
|
||||||
|
{ "%s%s.%s", "png", Image_LoadPNG, IL_HINT_NO }, // NightFire 007 menus
|
||||||
|
{ NULL, NULL, NULL, IL_HINT_NO }
|
||||||
|
};
|
||||||
|
#else
|
||||||
static const loadpixformat_t load_game[] =
|
static const loadpixformat_t load_game[] =
|
||||||
{
|
{
|
||||||
{ "%s%s.%s", "dds", Image_LoadDDS, IL_HINT_NO }, // dds for world and studio models
|
{ "%s%s.%s", "dds", Image_LoadDDS, IL_HINT_NO }, // dds for world and studio models
|
||||||
@@ -108,7 +125,7 @@ static const loadpixformat_t load_game[] =
|
|||||||
{ "%s%s.%s", "ktx2", Image_LoadKTX2, IL_HINT_NO }, // ktx2 for world and studio models
|
{ "%s%s.%s", "ktx2", Image_LoadKTX2, IL_HINT_NO }, // ktx2 for world and studio models
|
||||||
{ NULL, NULL, NULL, IL_HINT_NO }
|
{ NULL, NULL, NULL, IL_HINT_NO }
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
=============================================================================
|
=============================================================================
|
||||||
|
|
||||||
@@ -281,7 +298,7 @@ int Image_ComparePalette( const byte *pal )
|
|||||||
return PAL_CUSTOM;
|
return PAL_CUSTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Image_SetPalette( const byte *pal, uint *d_table )
|
void Image_SetPalette( const byte *pal, uint *d_table )
|
||||||
{
|
{
|
||||||
byte rgba[4];
|
byte rgba[4];
|
||||||
uint uirgba; // TODO: palette looks byte-swapped on big-endian
|
uint uirgba; // TODO: palette looks byte-swapped on big-endian
|
||||||
@@ -530,7 +547,7 @@ void Image_PaletteHueReplace( byte *palSrc, int newHue, int start, int end, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Image_PaletteTranslate( byte *palSrc, int top, int bottom, int pal_size )
|
void Image_PaletteTranslate( byte *palSrc, int top, int bottom, int pal_size )
|
||||||
{
|
{
|
||||||
byte dst[256], src[256];
|
byte dst[256], src[256];
|
||||||
int i;
|
int i;
|
||||||
@@ -726,7 +743,7 @@ static void Image_Resample24LerpLine( const byte *in, byte *out, int inwidth, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Image_Resample32Lerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
void Image_Resample32Lerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
||||||
{
|
{
|
||||||
const byte *inrow;
|
const byte *inrow;
|
||||||
int i, j, r, yi, oldy = 0, f, fstep, lerp, endy = (inheight - 1);
|
int i, j, r, yi, oldy = 0, f, fstep, lerp, endy = (inheight - 1);
|
||||||
@@ -834,7 +851,7 @@ static void Image_Resample32Lerp( const void *indata, int inwidth, int inheight,
|
|||||||
Mem_Free( resamplerow1 );
|
Mem_Free( resamplerow1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Image_Resample32Nolerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
void Image_Resample32Nolerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
uint frac, fracstep;
|
uint frac, fracstep;
|
||||||
@@ -873,7 +890,7 @@ static void Image_Resample32Nolerp( const void *indata, int inwidth, int inheigh
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Image_Resample24Lerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
void Image_Resample24Lerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
||||||
{
|
{
|
||||||
const byte *inrow;
|
const byte *inrow;
|
||||||
int i, j, r, yi, oldy, f, fstep, lerp, endy = (inheight - 1);
|
int i, j, r, yi, oldy, f, fstep, lerp, endy = (inheight - 1);
|
||||||
@@ -974,7 +991,7 @@ static void Image_Resample24Lerp( const void *indata, int inwidth, int inheight,
|
|||||||
Mem_Free( resamplerow1 );
|
Mem_Free( resamplerow1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Image_Resample24Nolerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
void Image_Resample24Nolerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
||||||
{
|
{
|
||||||
uint frac, fracstep;
|
uint frac, fracstep;
|
||||||
int i, j, f, inwidth3 = inwidth * 3;
|
int i, j, f, inwidth3 = inwidth * 3;
|
||||||
@@ -1040,7 +1057,7 @@ static void Image_Resample24Nolerp( const void *indata, int inwidth, int inheigh
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Image_Resample8Nolerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
void Image_Resample8Nolerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
byte *in, *inrow;
|
byte *in, *inrow;
|
||||||
@@ -1179,7 +1196,7 @@ byte *Image_FlipInternal( const byte *in, word *srcwidth, word *srcheight, int t
|
|||||||
return image.tempbuffer;
|
return image.tempbuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static byte *Image_CreateLumaInternal( byte *fin, int width, int height, int type, int flags )
|
byte *Image_CreateLumaInternal( byte *fin, int width, int height, int type, int flags )
|
||||||
{
|
{
|
||||||
byte *out;
|
byte *out;
|
||||||
int i;
|
int i;
|
||||||
@@ -1235,7 +1252,7 @@ Image_Decompress
|
|||||||
force to unpack any image to 32-bit buffer
|
force to unpack any image to 32-bit buffer
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static qboolean Image_Decompress( const byte *data )
|
qboolean Image_Decompress( const byte *data )
|
||||||
{
|
{
|
||||||
byte *fin, *fout;
|
byte *fin, *fout;
|
||||||
int i, size;
|
int i, size;
|
||||||
@@ -1303,7 +1320,7 @@ static qboolean Image_Decompress( const byte *data )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static rgbdata_t *Image_DecompressInternal( rgbdata_t *pic )
|
rgbdata_t *Image_DecompressInternal( rgbdata_t *pic )
|
||||||
{
|
{
|
||||||
// quick case to reject unneeded conversions
|
// quick case to reject unneeded conversions
|
||||||
if( pic->type == PF_RGBA_32 )
|
if( pic->type == PF_RGBA_32 )
|
||||||
@@ -1326,7 +1343,7 @@ static rgbdata_t *Image_DecompressInternal( rgbdata_t *pic )
|
|||||||
return pic;
|
return pic;
|
||||||
}
|
}
|
||||||
|
|
||||||
static rgbdata_t *Image_LightGamma( rgbdata_t *pic )
|
rgbdata_t *Image_LightGamma( rgbdata_t *pic )
|
||||||
{
|
{
|
||||||
byte *in = (byte *)pic->buffer;
|
byte *in = (byte *)pic->buffer;
|
||||||
int i;
|
int i;
|
||||||
@@ -1344,7 +1361,7 @@ static rgbdata_t *Image_LightGamma( rgbdata_t *pic )
|
|||||||
return pic;
|
return pic;
|
||||||
}
|
}
|
||||||
|
|
||||||
static qboolean Image_RemapInternal( rgbdata_t *pic, int topColor, int bottomColor )
|
qboolean Image_RemapInternal( rgbdata_t *pic, int topColor, int bottomColor )
|
||||||
{
|
{
|
||||||
if( !pic->palette )
|
if( !pic->palette )
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
byte *fin, *pal;
|
byte *fin, *pal;
|
||||||
int ofs[4], rendermode;
|
int ofs[4], rendermode;
|
||||||
int i, pixels, numcolors;
|
int i, pixels, numcolors;
|
||||||
uint reflectivity[3] = { 0, 0, 0 };
|
int reflectivity[3] = { 0, 0, 0 };
|
||||||
|
|
||||||
if( filesize < sizeof( mip ))
|
if( filesize < sizeof( mip ))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ void Info_RemovePrefixedKeys( char *start, char prefix )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static qboolean Info_IsKeyImportant( const char *key )
|
qboolean Info_IsKeyImportant( const char *key )
|
||||||
{
|
{
|
||||||
if( key[0] == '*' )
|
if( key[0] == '*' )
|
||||||
return true;
|
return true;
|
||||||
@@ -358,7 +358,7 @@ static qboolean Info_IsKeyImportant( const char *key )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *Info_FindLargestKey( char *s )
|
char *Info_FindLargestKey( char *s )
|
||||||
{
|
{
|
||||||
char key[MAX_KV_SIZE];
|
char key[MAX_KV_SIZE];
|
||||||
char value[MAX_KV_SIZE];
|
char value[MAX_KV_SIZE];
|
||||||
|
|||||||
@@ -34,7 +34,13 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
static char szGameDir[128]; // safe place to keep gamedir
|
static char szGameDir[128]; // safe place to keep gamedir
|
||||||
static int szArgc;
|
static int szArgc;
|
||||||
|
|
||||||
|
#if XASH_PSP
|
||||||
|
#define MAX_NARGVS 50
|
||||||
|
static char *szArgv[MAX_NARGVS];
|
||||||
|
#else
|
||||||
static char **szArgv;
|
static char **szArgv;
|
||||||
|
#endif
|
||||||
|
|
||||||
static void Sys_ChangeGame( const char *progname )
|
static void Sys_ChangeGame( const char *progname )
|
||||||
{
|
{
|
||||||
@@ -71,20 +77,23 @@ static int Sys_Start( void )
|
|||||||
#endif
|
#endif
|
||||||
#elif XASH_IOS
|
#elif XASH_IOS
|
||||||
IOS_LaunchDialog();
|
IOS_LaunchDialog();
|
||||||
#endif
|
#elif XASH_PSP
|
||||||
|
|
||||||
return Host_Main( szArgc, szArgv, game, 0, Sys_ChangeGame );
|
return Host_Main( szArgc, szArgv, game, 0, Sys_ChangeGame );
|
||||||
}
|
}
|
||||||
|
|
||||||
int main( int argc, char **argv )
|
int main( int argc, char **argv )
|
||||||
{
|
{
|
||||||
#if XASH_PSVITA
|
#if XASH_PSP
|
||||||
|
Platform_ReadCmd( "start.cmd", &szArgc, szArgv );
|
||||||
|
#elif XASH_PSVITA
|
||||||
// inject -dev -console into args if required
|
// inject -dev -console into args if required
|
||||||
szArgc = PSVita_GetArgv( argc, argv, &szArgv );
|
szArgc = PSVita_GetArgv( argc, argv, &szArgv );
|
||||||
#else
|
#else
|
||||||
szArgc = argc;
|
szArgc = argc;
|
||||||
szArgv = argv;
|
szArgv = argv;
|
||||||
#endif // XASH_PSVITA
|
#endif // XASH_PSVITA
|
||||||
|
|
||||||
return Sys_Start();
|
return Sys_Start();
|
||||||
}
|
}
|
||||||
#endif // XASH_ENABLE_MAIN
|
#endif // XASH_ENABLE_MAIN
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ void COM_PushLibraryError( const char *error )
|
|||||||
Q_strncat( s_szLastError, error, sizeof( s_szLastError ) );
|
Q_strncat( s_szLastError, error, sizeof( s_szLastError ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !XASH_PSP
|
||||||
void *COM_FunctionFromName_SR( void *hInstance, const char *pName )
|
void *COM_FunctionFromName_SR( void *hInstance, const char *pName )
|
||||||
{
|
{
|
||||||
char **funcs = NULL;
|
char **funcs = NULL;
|
||||||
@@ -85,6 +86,7 @@ const char *COM_OffsetNameForFunction( void *function )
|
|||||||
Con_Reportf( "COM_OffsetNameForFunction %s\n", sname );
|
Con_Reportf( "COM_OffsetNameForFunction %s\n", sname );
|
||||||
return sname;
|
return sname;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
dll_user_t *FS_FindLibrary( const char *dllname, qboolean directpath )
|
dll_user_t *FS_FindLibrary( const char *dllname, qboolean directpath )
|
||||||
{
|
{
|
||||||
@@ -128,7 +130,7 @@ dll_user_t *FS_FindLibrary( const char *dllname, qboolean directpath )
|
|||||||
|
|
||||||
static void COM_GenerateCommonLibraryName( const char *name, const char *ext, char *out, size_t size )
|
static void COM_GenerateCommonLibraryName( const char *name, const char *ext, char *out, size_t size )
|
||||||
{
|
{
|
||||||
#if ( XASH_WIN32 || XASH_LINUX || XASH_APPLE ) && XASH_X86
|
#if (( XASH_WIN32 || XASH_LINUX || XASH_APPLE ) && XASH_X86) || XASH_PSP
|
||||||
Q_snprintf( out, size, "%s.%s", name, ext );
|
Q_snprintf( out, size, "%s.%s", name, ext );
|
||||||
#elif ( XASH_WIN32 || XASH_LINUX || XASH_APPLE )
|
#elif ( XASH_WIN32 || XASH_LINUX || XASH_APPLE )
|
||||||
Q_snprintf( out, size, "%s_%s.%s", name, Q_buildarch(), ext );
|
Q_snprintf( out, size, "%s_%s.%s", name, Q_buildarch(), ext );
|
||||||
@@ -166,7 +168,7 @@ Some modders use _i?86 suffix in game library name
|
|||||||
So strip it to follow library naming for non-Intel CPUs
|
So strip it to follow library naming for non-Intel CPUs
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static inline void COM_StripIntelSuffix( char *out )
|
static void COM_StripIntelSuffix( char *out )
|
||||||
{
|
{
|
||||||
char *suffix = Q_strrchr( out, '_' );
|
char *suffix = Q_strrchr( out, '_' );
|
||||||
|
|
||||||
@@ -191,6 +193,8 @@ static void COM_GenerateServerLibraryPath( char *out, size_t size )
|
|||||||
Q_strncpy( out, GI->game_dll, size );
|
Q_strncpy( out, GI->game_dll, size );
|
||||||
#elif XASH_APPLE
|
#elif XASH_APPLE
|
||||||
Q_strncpy( out, GI->game_dll_osx, size );
|
Q_strncpy( out, GI->game_dll_osx, size );
|
||||||
|
#elif XASH_PSP
|
||||||
|
Q_strncpy( out, GI->game_dll_psp, size );
|
||||||
#else // XASH_LINUX
|
#else // XASH_LINUX
|
||||||
Q_strncpy( out, GI->game_dll_linux, size );
|
Q_strncpy( out, GI->game_dll_linux, size );
|
||||||
#endif
|
#endif
|
||||||
@@ -203,6 +207,8 @@ static void COM_GenerateServerLibraryPath( char *out, size_t size )
|
|||||||
Q_strncpy( dllpath, GI->game_dll, sizeof( dllpath ) );
|
Q_strncpy( dllpath, GI->game_dll, sizeof( dllpath ) );
|
||||||
#elif XASH_APPLE
|
#elif XASH_APPLE
|
||||||
Q_strncpy( dllpath, GI->game_dll_osx, sizeof( dllpath ) );
|
Q_strncpy( dllpath, GI->game_dll_osx, sizeof( dllpath ) );
|
||||||
|
#elif XASH_PSP
|
||||||
|
Q_strncpy( dllpath, GI->game_dll_psp, sizeof( dllpath ) );
|
||||||
#else // XASH_APPLE
|
#else // XASH_APPLE
|
||||||
Q_strncpy( dllpath, GI->game_dll_linux, sizeof( dllpath ) );
|
Q_strncpy( dllpath, GI->game_dll_linux, sizeof( dllpath ) );
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -583,7 +583,7 @@ void Mod_PrintWorldStats_f( void )
|
|||||||
Mod_DecompressPVS
|
Mod_DecompressPVS
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
static byte *Mod_DecompressPVS( const byte *in, int visbytes )
|
byte *Mod_DecompressPVS( const byte *in, int visbytes )
|
||||||
{
|
{
|
||||||
byte *out;
|
byte *out;
|
||||||
int c;
|
int c;
|
||||||
@@ -1735,12 +1735,16 @@ static void Mod_LoadSubmodels( model_t *mod, dbspmodel_t *bmod )
|
|||||||
oldmaxfaces = Q_max( oldmaxfaces, out->numfaces );
|
oldmaxfaces = Q_max( oldmaxfaces, out->numfaces );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if XASH_PSP
|
||||||
|
refState.max_surfaces = 0; // sorting disabled
|
||||||
|
#else
|
||||||
// these array used to sort translucent faces in bmodels
|
// these array used to sort translucent faces in bmodels
|
||||||
if( oldmaxfaces > refState.max_surfaces )
|
if( oldmaxfaces > refState.max_surfaces )
|
||||||
{
|
{
|
||||||
refState.draw_surfaces = (sortedface_t *)Z_Realloc( refState.draw_surfaces, oldmaxfaces * sizeof( sortedface_t ));
|
refState.draw_surfaces = (sortedface_t *)Z_Realloc( refState.draw_surfaces, oldmaxfaces * sizeof( sortedface_t ));
|
||||||
refState.max_surfaces = oldmaxfaces;
|
refState.max_surfaces = oldmaxfaces;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ GNU General Public License for more details.
|
|||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
#include "ref_common.h"
|
#include "ref_common.h"
|
||||||
#endif // XASH_DEDICATED
|
#endif // XASH_DEDICATED
|
||||||
#include "mod_local.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -151,17 +151,6 @@ void MSG_Clear( sizebuf_t *sb )
|
|||||||
sb->bOverflow = false;
|
sb->bOverflow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static qboolean MSG_Overflow( sizebuf_t *sb, int nBits )
|
|
||||||
{
|
|
||||||
if( sb->iCurBit + nBits > sb->nDataBits )
|
|
||||||
sb->bOverflow = true;
|
|
||||||
return sb->bOverflow;
|
|
||||||
}
|
|
||||||
|
|
||||||
qboolean MSG_CheckOverflow( sizebuf_t *sb )
|
|
||||||
{
|
|
||||||
return MSG_Overflow( sb, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
int MSG_SeekToBit( sizebuf_t *sb, int bitPos, int whence )
|
int MSG_SeekToBit( sizebuf_t *sb, int bitPos, int whence )
|
||||||
{
|
{
|
||||||
@@ -188,15 +177,9 @@ int MSG_SeekToBit( sizebuf_t *sb, int bitPos, int whence )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSG_WriteOneBit( sizebuf_t *sb, int nValue )
|
void MSG_SeekToByte( sizebuf_t *sb, int bytePos )
|
||||||
{
|
{
|
||||||
if( !MSG_Overflow( sb, 1 ))
|
sb->iCurBit = bytePos << 3;
|
||||||
{
|
|
||||||
if( nValue ) sb->pData[sb->iCurBit>>3] |= BIT( sb->iCurBit & 7 );
|
|
||||||
else sb->pData[sb->iCurBit>>3] &= ~BIT( sb->iCurBit & 7 );
|
|
||||||
|
|
||||||
sb->iCurBit++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSG_WriteUBitLong( sizebuf_t *sb, uint curData, int numbits )
|
void MSG_WriteUBitLong( sizebuf_t *sb, uint curData, int numbits )
|
||||||
|
|||||||
@@ -64,6 +64,19 @@ _inline int MSG_TellBit( sizebuf_t *sb ) { return sb->iCurBit; }
|
|||||||
_inline const char *MSG_GetName( sizebuf_t *sb ) { return sb->pDebugName; }
|
_inline const char *MSG_GetName( sizebuf_t *sb ) { return sb->pDebugName; }
|
||||||
qboolean MSG_CheckOverflow( sizebuf_t *sb );
|
qboolean MSG_CheckOverflow( sizebuf_t *sb );
|
||||||
|
|
||||||
|
static inline qboolean MSG_Overflow( sizebuf_t *sb, int nBits )
|
||||||
|
{
|
||||||
|
if( sb->iCurBit + nBits > sb->nDataBits )
|
||||||
|
sb->bOverflow = true;
|
||||||
|
return sb->bOverflow;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline MSG_CheckOverflow( sizebuf_t *sb )
|
||||||
|
{
|
||||||
|
return MSG_Overflow( sb, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#if XASH_BIG_ENDIAN
|
#if XASH_BIG_ENDIAN
|
||||||
#define MSG_BigShort( x ) ( x )
|
#define MSG_BigShort( x ) ( x )
|
||||||
#else
|
#else
|
||||||
@@ -78,7 +91,16 @@ void MSG_StartWriting( sizebuf_t *sb, void *pData, int nBytes, int iStartBit, in
|
|||||||
void MSG_Clear( sizebuf_t *sb );
|
void MSG_Clear( sizebuf_t *sb );
|
||||||
|
|
||||||
// Bit-write functions
|
// Bit-write functions
|
||||||
void MSG_WriteOneBit( sizebuf_t *sb, int nValue );
|
static inline void MSG_WriteOneBit( sizebuf_t *sb, int nValue )
|
||||||
|
{
|
||||||
|
if( likely( !MSG_Overflow( sb, 1 )))
|
||||||
|
{
|
||||||
|
if( nValue ) sb->pData[sb->iCurBit>>3] |= BIT( sb->iCurBit & 7 );
|
||||||
|
else sb->pData[sb->iCurBit>>3] &= ~BIT( sb->iCurBit & 7 );
|
||||||
|
|
||||||
|
sb->iCurBit++;
|
||||||
|
}
|
||||||
|
}
|
||||||
void MSG_WriteUBitLong( sizebuf_t *sb, uint curData, int numbits );
|
void MSG_WriteUBitLong( sizebuf_t *sb, uint curData, int numbits );
|
||||||
void MSG_WriteSBitLong( sizebuf_t *sb, int data, int numbits );
|
void MSG_WriteSBitLong( sizebuf_t *sb, int data, int numbits );
|
||||||
void MSG_WriteBitLong( sizebuf_t *sb, uint data, int numbits, qboolean bSigned );
|
void MSG_WriteBitLong( sizebuf_t *sb, uint data, int numbits, qboolean bSigned );
|
||||||
|
|||||||
@@ -198,6 +198,44 @@ qboolean NetSplit_GetLong( netsplit_t *ns, netadr_t *from, byte *data, size_t *l
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
======================
|
||||||
|
NetSplit_SendLong
|
||||||
|
|
||||||
|
Send parts that are less or equal maxpacket
|
||||||
|
======================
|
||||||
|
*/
|
||||||
|
void NetSplit_SendLong( netsrc_t sock, size_t length, void *data, netadr_t to, unsigned int maxpacket, unsigned int id)
|
||||||
|
{
|
||||||
|
netsplit_packet_t packet = {0};
|
||||||
|
unsigned int part = maxpacket - NETSPLIT_HEADER_SIZE;
|
||||||
|
|
||||||
|
packet.signature = LittleLong(0xFFFFFFFE);
|
||||||
|
packet.id = LittleLong(id);
|
||||||
|
packet.length = LittleLong(length);
|
||||||
|
packet.part = LittleLong(part);
|
||||||
|
packet.count = ( length - 1 ) / part + 1;
|
||||||
|
|
||||||
|
//Con_Reportf( S_NOTE "NetSplit_SendLong: packet to %s, count %d, length %d\n", NET_AdrToString( to ), (int)packet.count, (int)packet.length );
|
||||||
|
|
||||||
|
while( packet.index < packet.count )
|
||||||
|
{
|
||||||
|
unsigned int size = part;
|
||||||
|
|
||||||
|
if( size > length )
|
||||||
|
size = length;
|
||||||
|
|
||||||
|
length -= size;
|
||||||
|
|
||||||
|
memcpy( packet.data, (const byte*)data + packet.index * part, size );
|
||||||
|
//Con_Reportf( S_NOTE "NetSplit_SendLong: packet to %s, id %d, index %d\n", NET_AdrToString( to ), (int)packet.id, (int)packet.index );
|
||||||
|
|
||||||
|
NET_SendPacket( sock, size + NETSPLIT_HEADER_SIZE, &packet, to );
|
||||||
|
packet.index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
Netchan_Init
|
Netchan_Init
|
||||||
@@ -329,7 +367,7 @@ Netchan_UnlinkFragment
|
|||||||
|
|
||||||
==============================
|
==============================
|
||||||
*/
|
*/
|
||||||
static void Netchan_UnlinkFragment( fragbuf_t *buf, fragbuf_t **list )
|
void Netchan_UnlinkFragment( fragbuf_t *buf, fragbuf_t **list )
|
||||||
{
|
{
|
||||||
fragbuf_t *search;
|
fragbuf_t *search;
|
||||||
|
|
||||||
@@ -367,7 +405,7 @@ Netchan_ClearFragbufs
|
|||||||
|
|
||||||
==============================
|
==============================
|
||||||
*/
|
*/
|
||||||
static void Netchan_ClearFragbufs( fragbuf_t **ppbuf )
|
void Netchan_ClearFragbufs( fragbuf_t **ppbuf )
|
||||||
{
|
{
|
||||||
fragbuf_t *buf, *n;
|
fragbuf_t *buf, *n;
|
||||||
|
|
||||||
@@ -393,7 +431,7 @@ Netchan_ClearFragments
|
|||||||
|
|
||||||
==============================
|
==============================
|
||||||
*/
|
*/
|
||||||
static void Netchan_ClearFragments( netchan_t *chan )
|
void Netchan_ClearFragments( netchan_t *chan )
|
||||||
{
|
{
|
||||||
fragbufwaiting_t *wait, *next;
|
fragbufwaiting_t *wait, *next;
|
||||||
int i;
|
int i;
|
||||||
@@ -501,7 +539,7 @@ Netchan_AllocFragbuf
|
|||||||
|
|
||||||
==============================
|
==============================
|
||||||
*/
|
*/
|
||||||
static fragbuf_t *Netchan_AllocFragbuf( int fragment_size )
|
fragbuf_t *Netchan_AllocFragbuf( int fragment_size )
|
||||||
{
|
{
|
||||||
fragbuf_t *buf;
|
fragbuf_t *buf;
|
||||||
|
|
||||||
@@ -518,7 +556,7 @@ Netchan_AddFragbufToTail
|
|||||||
|
|
||||||
==============================
|
==============================
|
||||||
*/
|
*/
|
||||||
static void Netchan_AddFragbufToTail( fragbufwaiting_t *wait, fragbuf_t *buf )
|
void Netchan_AddFragbufToTail( fragbufwaiting_t *wait, fragbuf_t *buf )
|
||||||
{
|
{
|
||||||
fragbuf_t *p;
|
fragbuf_t *p;
|
||||||
|
|
||||||
@@ -541,7 +579,7 @@ Netchan_UpdateFlow
|
|||||||
|
|
||||||
==============================
|
==============================
|
||||||
*/
|
*/
|
||||||
static void Netchan_UpdateFlow( netchan_t *chan )
|
void Netchan_UpdateFlow( netchan_t *chan )
|
||||||
{
|
{
|
||||||
float faccumulatedtime = 0.0;
|
float faccumulatedtime = 0.0;
|
||||||
int i, bytes = 0;
|
int i, bytes = 0;
|
||||||
@@ -753,7 +791,7 @@ Netchan_FindBufferById
|
|||||||
|
|
||||||
==============================
|
==============================
|
||||||
*/
|
*/
|
||||||
static fragbuf_t *Netchan_FindBufferById( fragbuf_t **pplist, int id, qboolean allocate )
|
fragbuf_t *Netchan_FindBufferById( fragbuf_t **pplist, int id, qboolean allocate )
|
||||||
{
|
{
|
||||||
fragbuf_t *list = *pplist;
|
fragbuf_t *list = *pplist;
|
||||||
fragbuf_t *pnewbuf;
|
fragbuf_t *pnewbuf;
|
||||||
@@ -783,7 +821,7 @@ Netchan_CheckForCompletion
|
|||||||
|
|
||||||
==============================
|
==============================
|
||||||
*/
|
*/
|
||||||
static void Netchan_CheckForCompletion( netchan_t *chan, int stream, int intotalbuffers )
|
void Netchan_CheckForCompletion( netchan_t *chan, int stream, int intotalbuffers )
|
||||||
{
|
{
|
||||||
int c, id;
|
int c, id;
|
||||||
int size;
|
int size;
|
||||||
@@ -1249,7 +1287,7 @@ qboolean Netchan_CopyFileFragments( netchan_t *chan, sizebuf_t *msg )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static qboolean Netchan_Validate( netchan_t *chan, sizebuf_t *sb, qboolean *frag_message, uint *fragid, int *frag_offset, int *frag_length )
|
qboolean Netchan_Validate( netchan_t *chan, sizebuf_t *sb, qboolean *frag_message, uint *fragid, int *frag_offset, int *frag_length )
|
||||||
{
|
{
|
||||||
int i, buffer, offset;
|
int i, buffer, offset;
|
||||||
int count, length;
|
int count, length;
|
||||||
|
|||||||
@@ -1095,7 +1095,6 @@ int Delta_TestBaseline( entity_state_t *from, entity_state_t *to, qboolean playe
|
|||||||
if( from == NULL ) return 0;
|
if( from == NULL ) return 0;
|
||||||
return countBits;
|
return countBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( FBitSet( to->entityType, ENTITY_BEAM ))
|
if( FBitSet( to->entityType, ENTITY_BEAM ))
|
||||||
dt = Delta_FindStructByIndex( DT_CUSTOM_ENTITY_STATE_T );
|
dt = Delta_FindStructByIndex( DT_CUSTOM_ENTITY_STATE_T );
|
||||||
else if( player )
|
else if( player )
|
||||||
@@ -1793,7 +1792,6 @@ void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, sizebuf_t *
|
|||||||
numChanges++;
|
numChanges++;
|
||||||
}
|
}
|
||||||
else MSG_WriteOneBit( msg, 0 );
|
else MSG_WriteOneBit( msg, 0 );
|
||||||
|
|
||||||
if( FBitSet( to->entityType, ENTITY_BEAM ))
|
if( FBitSet( to->entityType, ENTITY_BEAM ))
|
||||||
{
|
{
|
||||||
dt = Delta_FindStructByIndex( DT_CUSTOM_ENTITY_STATE_T );
|
dt = Delta_FindStructByIndex( DT_CUSTOM_ENTITY_STATE_T );
|
||||||
@@ -1806,7 +1804,6 @@ void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, sizebuf_t *
|
|||||||
{
|
{
|
||||||
dt = Delta_FindStructByIndex( DT_ENTITY_STATE_T );
|
dt = Delta_FindStructByIndex( DT_ENTITY_STATE_T );
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert( dt && dt->bInitialized );
|
Assert( dt && dt->bInitialized );
|
||||||
|
|
||||||
pField = dt->pFields;
|
pField = dt->pFields;
|
||||||
@@ -1924,7 +1921,6 @@ qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, entity_state_t *from, entity_state
|
|||||||
{
|
{
|
||||||
dt = Delta_FindStructByIndex( DT_ENTITY_STATE_T );
|
dt = Delta_FindStructByIndex( DT_ENTITY_STATE_T );
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert( dt && dt->bInitialized );
|
Assert( dt && dt->bInitialized );
|
||||||
|
|
||||||
pField = dt->pFields;
|
pField = dt->pFields;
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ static void NET_SockadrToNetadr( const struct sockaddr_storage *s, netadr_t *a )
|
|||||||
NET_GetHostByName
|
NET_GetHostByName
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
static qboolean NET_GetHostByName( const char *hostname, int family, struct sockaddr_storage *addr )
|
qboolean NET_GetHostByName( const char *hostname, int family, struct sockaddr_storage *addr )
|
||||||
{
|
{
|
||||||
#if defined HAVE_GETADDRINFO
|
#if defined HAVE_GETADDRINFO
|
||||||
struct addrinfo *ai = NULL, *cur;
|
struct addrinfo *ai = NULL, *cur;
|
||||||
@@ -356,7 +356,7 @@ static qboolean NET_GetHostByName( const char *hostname, int family, struct sock
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !XASH_EMSCRIPTEN && !XASH_DOS4GW && !defined XASH_NO_ASYNC_NS_RESOLVE
|
#if !XASH_EMSCRIPTEN && !XASH_DOS4GW && !XASH_PSP && !defined XASH_NO_ASYNC_NS_RESOLVE
|
||||||
#define CAN_ASYNC_NS_RESOLVE
|
#define CAN_ASYNC_NS_RESOLVE
|
||||||
#endif // !XASH_EMSCRIPTEN && !XASH_DOS4GW && !defined XASH_NO_ASYNC_NS_RESOLVE
|
#endif // !XASH_EMSCRIPTEN && !XASH_DOS4GW && !defined XASH_NO_ASYNC_NS_RESOLVE
|
||||||
|
|
||||||
@@ -372,7 +372,7 @@ static void NET_ResolveThread( void );
|
|||||||
#define detach_thread( x ) pthread_detach(x)
|
#define detach_thread( x ) pthread_detach(x)
|
||||||
#define mutex_t pthread_mutex_t
|
#define mutex_t pthread_mutex_t
|
||||||
#define thread_t pthread_t
|
#define thread_t pthread_t
|
||||||
static void *NET_ThreadStart( void *unused )
|
void *NET_ThreadStart( void *unused )
|
||||||
{
|
{
|
||||||
NET_ResolveThread();
|
NET_ResolveThread();
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1018,7 +1018,7 @@ idnewt
|
|||||||
192.246.40.70
|
192.246.40.70
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static qboolean NET_StringToAdrEx( const char *string, netadr_t *adr, int family )
|
qboolean NET_StringToAdrEx( const char *string, netadr_t *adr, int family )
|
||||||
{
|
{
|
||||||
struct sockaddr_storage s;
|
struct sockaddr_storage s;
|
||||||
|
|
||||||
@@ -1339,7 +1339,7 @@ NET_GetLong
|
|||||||
receive long packet from network
|
receive long packet from network
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static qboolean NET_GetLong( byte *pData, int size, size_t *outSize, int splitsize )
|
qboolean NET_GetLong( byte *pData, int size, size_t *outSize, int splitsize )
|
||||||
{
|
{
|
||||||
int i, sequence_number, offset;
|
int i, sequence_number, offset;
|
||||||
SPLITPACKET *pHeader = (SPLITPACKET *)pData;
|
SPLITPACKET *pHeader = (SPLITPACKET *)pData;
|
||||||
@@ -1534,7 +1534,7 @@ NET_SendLong
|
|||||||
Fragment long packets, send short directly
|
Fragment long packets, send short directly
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static int NET_SendLong( netsrc_t sock, int net_socket, const char *buf, size_t len, int flags, const struct sockaddr_storage *to, size_t tolen, size_t splitsize )
|
int NET_SendLong( netsrc_t sock, int net_socket, const char *buf, size_t len, int flags, const struct sockaddr_storage *to, size_t tolen, size_t splitsize )
|
||||||
{
|
{
|
||||||
#ifdef NET_USE_FRAGMENTS
|
#ifdef NET_USE_FRAGMENTS
|
||||||
// do we need to break this packet up?
|
// do we need to break this packet up?
|
||||||
@@ -1864,7 +1864,7 @@ NET_GetLocalAddress
|
|||||||
Returns the servers' ip address as a string.
|
Returns the servers' ip address as a string.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void NET_GetLocalAddress( void )
|
void NET_GetLocalAddress( void )
|
||||||
{
|
{
|
||||||
char hostname[512];
|
char hostname[512];
|
||||||
char buff[512];
|
char buff[512];
|
||||||
|
|||||||
@@ -86,7 +86,18 @@ GNU General Public License for more details.
|
|||||||
#define NETSPLIT_BACKUP 8
|
#define NETSPLIT_BACKUP 8
|
||||||
#define NETSPLIT_BACKUP_MASK (NETSPLIT_BACKUP - 1)
|
#define NETSPLIT_BACKUP_MASK (NETSPLIT_BACKUP - 1)
|
||||||
#define NETSPLIT_HEADER_SIZE 18
|
#define NETSPLIT_HEADER_SIZE 18
|
||||||
|
#if XASH_PSP
|
||||||
|
#undef MULTIPLAYER_BACKUP
|
||||||
|
#undef SINGLEPLAYER_BACKUP
|
||||||
|
#undef NUM_PACKET_ENTITIES
|
||||||
|
#undef MAX_CUSTOM_BASELINES
|
||||||
|
#undef NET_MAX_FRAGMENT
|
||||||
|
#define MULTIPLAYER_BACKUP 16
|
||||||
|
#define SINGLEPLAYER_BACKUP 16
|
||||||
|
#define NUM_PACKET_ENTITIES 32
|
||||||
|
#define MAX_CUSTOM_BASELINES 8
|
||||||
|
#define NET_MAX_FRAGMENT 32768
|
||||||
|
#else
|
||||||
#if XASH_LOW_MEMORY == 2
|
#if XASH_LOW_MEMORY == 2
|
||||||
#undef MULTIPLAYER_BACKUP
|
#undef MULTIPLAYER_BACKUP
|
||||||
#undef SINGLEPLAYER_BACKUP
|
#undef SINGLEPLAYER_BACKUP
|
||||||
@@ -108,7 +119,7 @@ GNU General Public License for more details.
|
|||||||
#define MAX_CUSTOM_BASELINES 8
|
#define MAX_CUSTOM_BASELINES 8
|
||||||
#define NET_MAX_FRAGMENT 32768
|
#define NET_MAX_FRAGMENT 32768
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* XASH_PSP */
|
||||||
typedef struct netsplit_chain_packet_s
|
typedef struct netsplit_chain_packet_s
|
||||||
{
|
{
|
||||||
// bool vector
|
// bool vector
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ SampleMiptex
|
|||||||
fence texture testing
|
fence texture testing
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static int PM_SampleMiptex( const msurface_t *surf, const vec3_t point )
|
int PM_SampleMiptex( const msurface_t *surf, const vec3_t point )
|
||||||
{
|
{
|
||||||
mextrasurf_t *info = surf->info;
|
mextrasurf_t *info = surf->info;
|
||||||
mfacebevel_t *fb = info->bevel;
|
mfacebevel_t *fb = info->bevel;
|
||||||
@@ -221,7 +221,7 @@ PM_TestLine_r
|
|||||||
optimized trace for light gathering
|
optimized trace for light gathering
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static int PM_TestLine_r( model_t *mod, mnode_t *node, vec_t p1f, vec_t p2f, const vec3_t start, const vec3_t stop, linetrace_t *trace )
|
int PM_TestLine_r( model_t *mod, mnode_t *node, vec_t p1f, vec_t p2f, const vec3_t start, const vec3_t stop, linetrace_t *trace )
|
||||||
{
|
{
|
||||||
float front, back;
|
float front, back;
|
||||||
float frac, midf;
|
float frac, midf;
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ To keep everything totally uniform, bounding boxes are turned into small
|
|||||||
BSP trees instead of being compared directly.
|
BSP trees instead of being compared directly.
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
static hull_t *PM_HullForBox( const vec3_t mins, const vec3_t maxs )
|
hull_t *PM_HullForBox( const vec3_t mins, const vec3_t maxs )
|
||||||
{
|
{
|
||||||
pm_boxplanes[0].dist = maxs[0];
|
pm_boxplanes[0].dist = maxs[0];
|
||||||
pm_boxplanes[1].dist = mins[0];
|
pm_boxplanes[1].dist = mins[0];
|
||||||
@@ -199,7 +199,7 @@ PM_HullForStudio
|
|||||||
generate multiple hulls as hitboxes
|
generate multiple hulls as hitboxes
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static hull_t *PM_HullForStudio( physent_t *pe, playermove_t *pmove, int *numhitboxes )
|
hull_t *PM_HullForStudio( physent_t *pe, playermove_t *pmove, int *numhitboxes )
|
||||||
{
|
{
|
||||||
vec3_t size;
|
vec3_t size;
|
||||||
|
|
||||||
|
|||||||
@@ -177,6 +177,29 @@ GNU General Public License for more details.
|
|||||||
#define FRAGMENT_MAX_SIZE 64000 // maximal fragment size
|
#define FRAGMENT_MAX_SIZE 64000 // maximal fragment size
|
||||||
#define FRAGMENT_LOCAL_SIZE FRAGMENT_MAX_SIZE // local connection
|
#define FRAGMENT_LOCAL_SIZE FRAGMENT_MAX_SIZE // local connection
|
||||||
|
|
||||||
|
#if XASH_PSP
|
||||||
|
|
||||||
|
#undef MAX_VISIBLE_PACKET
|
||||||
|
#undef MAX_VISIBLE_PACKET_VIS_BYTES
|
||||||
|
#undef MAX_EVENTS
|
||||||
|
#undef MAX_SUPPORTED_MODELS
|
||||||
|
#undef MAX_MODELS
|
||||||
|
#undef MAX_SOUNDS
|
||||||
|
#undef MAX_CUSTOM
|
||||||
|
#undef MAX_RENDER_DECALS
|
||||||
|
#undef MAX_RESOURCES
|
||||||
|
|
||||||
|
#define MAX_VISIBLE_PACKET 256
|
||||||
|
#define MAX_VISIBLE_PACKET_VIS_BYTES ((MAX_VISIBLE_PACKET + 7) / 8)
|
||||||
|
#define MAX_EVENTS 256
|
||||||
|
#define MAX_SUPPORTED_MODELS 512
|
||||||
|
#define MAX_MODELS MAX_SUPPORTED_MODELS
|
||||||
|
#define MAX_SOUNDS 512
|
||||||
|
#define MAX_CUSTOM 32
|
||||||
|
#define MAX_RENDER_DECALS 256
|
||||||
|
#define MAX_RESOURCES (MAX_MODELS+MAX_SOUNDS+MAX_CUSTOM+MAX_EVENTS)
|
||||||
|
|
||||||
|
#else
|
||||||
#if XASH_LOW_MEMORY == 2
|
#if XASH_LOW_MEMORY == 2
|
||||||
#undef MAX_VISIBLE_PACKET
|
#undef MAX_VISIBLE_PACKET
|
||||||
#undef MAX_VISIBLE_PACKET_VIS_BYTES
|
#undef MAX_VISIBLE_PACKET_VIS_BYTES
|
||||||
@@ -215,7 +238,7 @@ GNU General Public License for more details.
|
|||||||
#define MAX_RENDER_DECALS 128
|
#define MAX_RENDER_DECALS 128
|
||||||
#define MAX_RESOURCES 1024
|
#define MAX_RESOURCES 1024
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* XASH_PSP */
|
||||||
// Quake1 Protocol
|
// Quake1 Protocol
|
||||||
#define PROTOCOL_VERSION_QUAKE 15
|
#define PROTOCOL_VERSION_QUAKE 15
|
||||||
|
|
||||||
|
|||||||
@@ -56,20 +56,20 @@ static int good_enc( const int enc )
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mpg123_rates( const long **list, size_t *number )
|
void mpg123_rates( const long **list, size_t *number )
|
||||||
{
|
{
|
||||||
if( number != NULL ) *number = sizeof( my_rates ) / sizeof( long );
|
if( number != NULL ) *number = sizeof( my_rates ) / sizeof( long );
|
||||||
if( list != NULL ) *list = my_rates;
|
if( list != NULL ) *list = my_rates;
|
||||||
}
|
}
|
||||||
|
|
||||||
// now that's a bit tricky... One build of the library knows only a subset of the encodings.
|
// now that's a bit tricky... One build of the library knows only a subset of the encodings.
|
||||||
static void mpg123_encodings( const int **list, size_t *number )
|
void mpg123_encodings( const int **list, size_t *number )
|
||||||
{
|
{
|
||||||
if( number != NULL ) *number = sizeof( good_encodings ) / sizeof( int );
|
if( number != NULL ) *number = sizeof( good_encodings ) / sizeof( int );
|
||||||
if( list != NULL ) *list = good_encodings;
|
if( list != NULL ) *list = good_encodings;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mpg123_encsize( int encoding )
|
int mpg123_encsize( int encoding )
|
||||||
{
|
{
|
||||||
return sizeof( short );
|
return sizeof( short );
|
||||||
}
|
}
|
||||||
@@ -364,7 +364,7 @@ int mpg123_format( mpg123_handle_t *mh, long rate, int channels, int encodings )
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mpg123_format_support( mpg123_handle_t *mh, long rate, int encoding )
|
int mpg123_format_support( mpg123_handle_t *mh, long rate, int encoding )
|
||||||
{
|
{
|
||||||
if( mh == NULL )
|
if( mh == NULL )
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ void frame_exit( mpg123_handle_t *fr )
|
|||||||
bc_cleanup( &fr->rdat.buffer );
|
bc_cleanup( &fr->rdat.buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mpg123_framedata( mpg123_handle_t *mh, ulong *header, byte **bodydata, size_t *bodybytes )
|
int mpg123_framedata( mpg123_handle_t *mh, ulong *header, byte **bodydata, size_t *bodybytes )
|
||||||
{
|
{
|
||||||
if( mh == NULL )
|
if( mh == NULL )
|
||||||
return MPG123_BAD_HANDLE;
|
return MPG123_BAD_HANDLE;
|
||||||
@@ -512,7 +512,7 @@ mpg_off_t frame_index_find( mpg123_handle_t *fr, mpg_off_t want_frame, mpg_off_t
|
|||||||
return gopos;
|
return gopos;
|
||||||
}
|
}
|
||||||
|
|
||||||
static mpg_off_t frame_ins2outs( mpg123_handle_t *fr, mpg_off_t ins )
|
mpg_off_t frame_ins2outs( mpg123_handle_t *fr, mpg_off_t ins )
|
||||||
{
|
{
|
||||||
mpg_off_t outs = 0;
|
mpg_off_t outs = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
#include "mpg123.h"
|
#include "mpg123.h"
|
||||||
#include "sample.h"
|
#include "sample.h"
|
||||||
#include "libmpg.h"
|
|
||||||
|
|
||||||
static int initialized = 0;
|
static int initialized = 0;
|
||||||
|
|
||||||
@@ -84,7 +83,7 @@ mpg123_handle_t *mpg123_parnew( mpg123_parm_t *mp, int *error )
|
|||||||
return fr;
|
return fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mpg123_par( mpg123_parm_t *mp, enum mpg123_parms key, long val )
|
int mpg123_par( mpg123_parm_t *mp, enum mpg123_parms key, long val )
|
||||||
{
|
{
|
||||||
int ret = MPG123_OK;
|
int ret = MPG123_OK;
|
||||||
|
|
||||||
@@ -190,7 +189,7 @@ int mpg123_param( mpg123_handle_t *mh, enum mpg123_parms key, long val )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mpg123_close( mpg123_handle_t *mh )
|
int mpg123_close( mpg123_handle_t *mh )
|
||||||
{
|
{
|
||||||
if( mh == NULL )
|
if( mh == NULL )
|
||||||
return MPG123_BAD_HANDLE;
|
return MPG123_BAD_HANDLE;
|
||||||
@@ -264,7 +263,7 @@ int mpg123_replace_reader_handle( mpg123_handle_t *mh, mpg_ssize_t (*fread)( voi
|
|||||||
// a) a new choice of decoder
|
// a) a new choice of decoder
|
||||||
// b) a changed native format of the MPEG stream
|
// b) a changed native format of the MPEG stream
|
||||||
// ... calls are only valid after parsing some MPEG frame!
|
// ... calls are only valid after parsing some MPEG frame!
|
||||||
static int decode_update( mpg123_handle_t *mh )
|
int decode_update( mpg123_handle_t *mh )
|
||||||
{
|
{
|
||||||
long native_rate;
|
long native_rate;
|
||||||
int b;
|
int b;
|
||||||
@@ -321,13 +320,13 @@ static int decode_update( mpg123_handle_t *mh )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t mpg123_safe_buffer( void )
|
size_t mpg123_safe_buffer( void )
|
||||||
{
|
{
|
||||||
// real is the largest possible output
|
// real is the largest possible output
|
||||||
return sizeof( float ) * 2 * 1152;
|
return sizeof( float ) * 2 * 1152;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t mpg123_outblock( mpg123_handle_t *mh )
|
size_t mpg123_outblock( mpg123_handle_t *mh )
|
||||||
{
|
{
|
||||||
// try to be helpful and never return zero output block size.
|
// try to be helpful and never return zero output block size.
|
||||||
if( mh != NULL && mh->outblock > 0 )
|
if( mh != NULL && mh->outblock > 0 )
|
||||||
@@ -698,7 +697,7 @@ int mpg123_getformat( mpg123_handle_t *mh, int *rate, int *channels, int *encodi
|
|||||||
return MPG123_OK;
|
return MPG123_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mpg123_scan( mpg123_handle_t *mh )
|
int mpg123_scan( mpg123_handle_t *mh )
|
||||||
{
|
{
|
||||||
mpg_off_t track_frames = 0;
|
mpg_off_t track_frames = 0;
|
||||||
mpg_off_t track_samples = 0;
|
mpg_off_t track_samples = 0;
|
||||||
@@ -964,10 +963,8 @@ const char *mpg123_plain_strerror( int errcode )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *get_error( void *handle )
|
const char *get_error( mpg123_handle_t *mh )
|
||||||
{
|
{
|
||||||
mpg123_handle_t *mh = handle;
|
|
||||||
|
|
||||||
if( !mh ) return mpg123_plain_strerror( MPG123_BAD_HANDLE );
|
if( !mh ) return mpg123_plain_strerror( MPG123_BAD_HANDLE );
|
||||||
return mpg123_plain_strerror( mh->err );
|
return mpg123_plain_strerror( mh->err );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ void set_pointer( mpg123_handle_t *fr, long backstep )
|
|||||||
fr->bitindex = 0;
|
fr->bitindex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int frame_bitrate( mpg123_handle_t *fr )
|
int frame_bitrate( mpg123_handle_t *fr )
|
||||||
{
|
{
|
||||||
return tabsel_123[fr->lsf][fr->lay-1][fr->bitrate_index];
|
return tabsel_123[fr->lsf][fr->lay-1][fr->bitrate_index];
|
||||||
}
|
}
|
||||||
@@ -643,7 +643,7 @@ static int forget_head_shift( mpg123_handle_t *fr, ulong *newheadp, int forget )
|
|||||||
// returns: 0: bad or just unparseable tag
|
// returns: 0: bad or just unparseable tag
|
||||||
// 1: good, (possibly) new tag info
|
// 1: good, (possibly) new tag info
|
||||||
// <0: reader error (may need more data feed, try again)
|
// <0: reader error (may need more data feed, try again)
|
||||||
static int parse_new_id3( mpg123_handle_t *fr, ulong first4bytes )
|
int parse_new_id3( mpg123_handle_t *fr, ulong first4bytes )
|
||||||
{
|
{
|
||||||
byte buf[6];
|
byte buf[6];
|
||||||
ulong length=0;
|
ulong length=0;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ GNU General Public License for more details.
|
|||||||
else { *(samples) = REAL_TO_SHORT( sum ); }
|
else { *(samples) = REAL_TO_SHORT( sum ); }
|
||||||
|
|
||||||
// main synth function, uses the plain dct64
|
// main synth function, uses the plain dct64
|
||||||
static int synth_1to1( float *bandPtr, int channel, mpg123_handle_t *fr, int final )
|
int synth_1to1( float *bandPtr, int channel, mpg123_handle_t *fr, int final )
|
||||||
{
|
{
|
||||||
static const int step = 2;
|
static const int step = 2;
|
||||||
short *samples = (short *) (fr->buffer.data + fr->buffer.fill);
|
short *samples = (short *) (fr->buffer.data + fr->buffer.fill);
|
||||||
@@ -147,7 +147,7 @@ static int synth_stereo( float *bandPtr_l, float *bandPtr_r, mpg123_handle_t *fr
|
|||||||
}
|
}
|
||||||
|
|
||||||
// mono to stereo synth, wrapping over synth_1to1
|
// mono to stereo synth, wrapping over synth_1to1
|
||||||
static int synth_1to1_m2s(float *bandPtr, mpg123_handle_t *fr )
|
int synth_1to1_m2s(float *bandPtr, mpg123_handle_t *fr )
|
||||||
{
|
{
|
||||||
byte *samples = fr->buffer.data;
|
byte *samples = fr->buffer.data;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
@@ -165,7 +165,7 @@ static int synth_1to1_m2s(float *bandPtr, mpg123_handle_t *fr )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// mono synth, wrapping over synth_1to1
|
// mono synth, wrapping over synth_1to1
|
||||||
static int synth_1to1_mono( float *bandPtr, mpg123_handle_t *fr )
|
int synth_1to1_mono( float *bandPtr, mpg123_handle_t *fr )
|
||||||
{
|
{
|
||||||
short samples_tmp[BLOCK];
|
short samples_tmp[BLOCK];
|
||||||
short *tmp1 = samples_tmp;
|
short *tmp1 = samples_tmp;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ GNU General Public License for more details.
|
|||||||
// global sound variables
|
// global sound variables
|
||||||
sndlib_t sound;
|
sndlib_t sound;
|
||||||
|
|
||||||
static void Sound_Reset( void )
|
void Sound_Reset( void )
|
||||||
{
|
{
|
||||||
// reset global variables
|
// reset global variables
|
||||||
sound.width = sound.rate = 0;
|
sound.width = sound.rate = 0;
|
||||||
@@ -30,7 +30,7 @@ static void Sound_Reset( void )
|
|||||||
sound.size = 0;
|
sound.size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static wavdata_t *SoundPack( void )
|
wavdata_t *SoundPack( void )
|
||||||
{
|
{
|
||||||
wavdata_t *pack = Mem_Calloc( host.soundpool, sizeof( wavdata_t ));
|
wavdata_t *pack = Mem_Calloc( host.soundpool, sizeof( wavdata_t ));
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ wavdata_t *FS_LoadSound( const char *filename, const byte *buffer, size_t size )
|
|||||||
fs_offset_t filesize = 0;
|
fs_offset_t filesize = 0;
|
||||||
const loadwavfmt_t *format;
|
const loadwavfmt_t *format;
|
||||||
byte *f;
|
byte *f;
|
||||||
|
|
||||||
Sound_Reset(); // clear old sounddata
|
Sound_Reset(); // clear old sounddata
|
||||||
Q_strncpy( loadname, filename, sizeof( loadname ));
|
Q_strncpy( loadname, filename, sizeof( loadname ));
|
||||||
|
|
||||||
@@ -294,7 +294,6 @@ void FS_FreeStream( stream_t *stream )
|
|||||||
|
|
||||||
#if XASH_ENGINE_TESTS
|
#if XASH_ENGINE_TESTS
|
||||||
#define IMPLEMENT_SOUNDLIB_FUZZ_TARGET( export, target ) \
|
#define IMPLEMENT_SOUNDLIB_FUZZ_TARGET( export, target ) \
|
||||||
int EXPORT export( const uint8_t *Data, size_t Size ); \
|
|
||||||
int EXPORT export( const uint8_t *Data, size_t Size ) \
|
int EXPORT export( const uint8_t *Data, size_t Size ) \
|
||||||
{ \
|
{ \
|
||||||
wavdata_t *wav; \
|
wavdata_t *wav; \
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "soundlib.h"
|
#include "soundlib.h"
|
||||||
|
#if !XASH_PSP
|
||||||
#include "libmpg/libmpg.h"
|
#include "libmpg/libmpg.h"
|
||||||
|
|
||||||
#pragma pack( push, 1 )
|
#pragma pack( push, 1 )
|
||||||
@@ -186,7 +186,6 @@ static qboolean Sound_ParseID3Tag( const byte *buffer, fs_offset_t filesize )
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if XASH_ENGINE_TESTS
|
#if XASH_ENGINE_TESTS
|
||||||
int EXPORT Fuzz_Sound_ParseID3Tag( const uint8_t *Data, size_t Size );
|
|
||||||
int EXPORT Fuzz_Sound_ParseID3Tag( const uint8_t *Data, size_t Size )
|
int EXPORT Fuzz_Sound_ParseID3Tag( const uint8_t *Data, size_t Size )
|
||||||
{
|
{
|
||||||
memset( &sound, 0, sizeof( sound ));
|
memset( &sound, 0, sizeof( sound ));
|
||||||
@@ -295,7 +294,7 @@ qboolean Sound_LoadMPG( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
FS_SeekEx
|
FS_SeekEx
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static fs_offset_t FS_SeekEx( file_t *file, fs_offset_t offset, int whence )
|
fs_offset_t FS_SeekEx( file_t *file, fs_offset_t offset, int whence )
|
||||||
{
|
{
|
||||||
return FS_Seek( file, offset, whence ) == -1 ? -1 : FS_Tell( file );
|
return FS_Seek( file, offset, whence ) == -1 ? -1 : FS_Tell( file );
|
||||||
}
|
}
|
||||||
@@ -456,3 +455,485 @@ void Stream_FreeMPG( stream_t *stream )
|
|||||||
|
|
||||||
Mem_Free( stream );
|
Mem_Free( stream );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else // XASH_PSP
|
||||||
|
#include "platform/psp/scemp3/pspmp3.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================================================================
|
||||||
|
|
||||||
|
PSP MPEG decoding
|
||||||
|
|
||||||
|
=================================================================
|
||||||
|
*/
|
||||||
|
#define MP3_ID3V1_ID "TAG"
|
||||||
|
#define MP3_ID3V1_ID_SZ 3
|
||||||
|
#define MP3_ID3V1_SZ 128
|
||||||
|
|
||||||
|
#define MP3_ID3V2_ID "ID3"
|
||||||
|
#define MP3_ID3V2_ID_SZ 3
|
||||||
|
#define MP3_ID3V2_SIZE_OFF 6
|
||||||
|
#define MP3_ID3V2_SIZE_SZ 4
|
||||||
|
#define MP3_ID3V2_HEADER_SZ 10
|
||||||
|
|
||||||
|
#define MP3_ERRORS_MAX 3
|
||||||
|
|
||||||
|
#define PCM_WIDTH 2 // always 16-bit PCM
|
||||||
|
#define PCM_CHANNELS 2 // always 2
|
||||||
|
|
||||||
|
#define MP3_BUFFER_SIZE ( 128 * 1024 )
|
||||||
|
#define PCM_BUFFER_SIZE (( 1152 * PCM_WIDTH * PCM_CHANNELS ) * 2 ) // framesample * width * channels * 2(double buffer)
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int handle;
|
||||||
|
int cachePos;
|
||||||
|
int frameCount;
|
||||||
|
byte *pcmTempPtr;
|
||||||
|
} mp3_decoder_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
Sound_GetID3V2SizeMPG
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
__inline int Sound_GetID3V2SizeMPG( const byte *tagSize )
|
||||||
|
{
|
||||||
|
int size;
|
||||||
|
byte *sizePtr = (byte*)&size;
|
||||||
|
|
||||||
|
// 7 bit per byte, invert endian
|
||||||
|
sizePtr[0] = (( tagSize[3] >> 0 ) & 0x7F ) | (( tagSize[2] & 0x01 ) << 7 );
|
||||||
|
sizePtr[1] = (( tagSize[2] >> 1 ) & 0x3F ) | (( tagSize[1] & 0x03 ) << 6 );
|
||||||
|
sizePtr[2] = (( tagSize[1] >> 2 ) & 0x1F ) | (( tagSize[0] & 0x07 ) << 5 );
|
||||||
|
sizePtr[3] = (( tagSize[0] >> 3 ) & 0x0F );
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
Sound_FindHeadMPG
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
fs_offset_t Sound_FindHeadMPG( const byte *buffer, fs_offset_t filesize )
|
||||||
|
{
|
||||||
|
fs_offset_t result;
|
||||||
|
|
||||||
|
result = 0;
|
||||||
|
if( filesize >= MP3_ID3V2_HEADER_SZ )
|
||||||
|
{
|
||||||
|
if( !memcmp( buffer, MP3_ID3V2_ID, MP3_ID3V2_ID_SZ ))
|
||||||
|
result = Sound_GetID3V2SizeMPG( &buffer[MP3_ID3V2_SIZE_OFF] ) + MP3_ID3V2_HEADER_SZ;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
Sound_FindTailMPG
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
fs_offset_t Sound_FindTailMPG( const byte *buffer, fs_offset_t filesize )
|
||||||
|
{
|
||||||
|
fs_offset_t result;
|
||||||
|
|
||||||
|
result = filesize;
|
||||||
|
if( filesize >= MP3_ID3V1_SZ )
|
||||||
|
{
|
||||||
|
if( !memcmp( &buffer[filesize - MP3_ID3V1_SZ], MP3_ID3V1_ID, MP3_ID3V1_ID_SZ ))
|
||||||
|
result -= MP3_ID3V1_SZ;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
qboolean Sound_LoadMPG( const char *name, const byte *buffer, fs_offset_t filesize )
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
int status;
|
||||||
|
int handle;
|
||||||
|
size_t bytesWrite = 0;
|
||||||
|
byte out[PCM_BUFFER_SIZE] __attribute__((aligned(64)));
|
||||||
|
fs_offset_t headOffset;
|
||||||
|
fs_offset_t tailOffset;
|
||||||
|
fs_offset_t contentSize;
|
||||||
|
int frameSample;
|
||||||
|
uint bps;
|
||||||
|
int frameLen;
|
||||||
|
int frameSize;
|
||||||
|
int frameCount;
|
||||||
|
|
||||||
|
headOffset = Sound_FindHeadMPG( buffer, filesize );
|
||||||
|
tailOffset = Sound_FindTailMPG( buffer, filesize );
|
||||||
|
contentSize = tailOffset - headOffset;
|
||||||
|
// TODO: read Xing header
|
||||||
|
|
||||||
|
handle = sceMp3ReserveMp3Handle( NULL );
|
||||||
|
if ( handle < 0 )
|
||||||
|
{
|
||||||
|
Con_DPrintf( S_ERROR "sceMp3ReserveMp3Handle returned 0x%08X\n", handle );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = sceMp3LowLevelInit( handle, &buffer[headOffset] );
|
||||||
|
if ( status < 0 )
|
||||||
|
{
|
||||||
|
Con_DPrintf( S_ERROR "sceMp3LowLevelInit returned 0x%08X\n", status );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
frameSample = sceMp3GetMaxOutputSample( handle );
|
||||||
|
frameSize = (( frameSample / 8 ) * sceMp3GetBitRate( handle ) * 1000 ) / sceMp3GetSamplingRate( handle );
|
||||||
|
frameCount = contentSize / frameSize;
|
||||||
|
|
||||||
|
sound.channels = sceMp3GetMp3ChannelNum( handle );
|
||||||
|
sound.rate = sceMp3GetSamplingRate( handle );
|
||||||
|
sound.width = PCM_WIDTH; // always 16-bit PCM
|
||||||
|
sound.loopstart = -1;
|
||||||
|
sound.size = (frameCount * frameSample) * sound.channels * sound.width; // invalid for VBR
|
||||||
|
/*
|
||||||
|
status = sceMp3LowLevelDecode(handle, &buffer[headOffset + mp3usedsize], &mp3usedsize, pcm, &pcmoutsize);
|
||||||
|
if(status < 0)
|
||||||
|
{
|
||||||
|
Con_DPrintf( S_ERROR "sceMp3LowLevelDecode returned 0x%08X\n", status);
|
||||||
|
}
|
||||||
|
sceMp3ReleaseMp3Handle( handle );
|
||||||
|
*/
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
Con_DPrintf( S_ERROR "Sound_LoadMPG unimplemented function!\n");
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
Stream_FindHeadMPG
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
SceOff Stream_FindHeadMPG( file_t *file )
|
||||||
|
{
|
||||||
|
SceOff result;
|
||||||
|
byte tagId[MP3_ID3V2_ID_SZ];
|
||||||
|
byte tagSize[MP3_ID3V2_SIZE_SZ];
|
||||||
|
|
||||||
|
result = 0;
|
||||||
|
|
||||||
|
FS_Seek( file, 0, SEEK_SET );
|
||||||
|
|
||||||
|
if( FS_Read( file, tagId, MP3_ID3V2_ID_SZ) < MP3_ID3V2_ID_SZ )
|
||||||
|
{
|
||||||
|
Con_DPrintf( S_ERROR "Sound_Mp3FindHead: ID3V2 ID read error\n");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !memcmp( tagId, MP3_ID3V2_ID, MP3_ID3V2_ID_SZ ))
|
||||||
|
{
|
||||||
|
FS_Seek( file, MP3_ID3V2_SIZE_OFF, SEEK_SET );
|
||||||
|
if( FS_Read( file, tagSize, MP3_ID3V2_SIZE_SZ ) < MP3_ID3V2_SIZE_SZ )
|
||||||
|
Con_DPrintf( S_ERROR "Sound_Mp3FindHead: ID3V2 SIZE read error\n");
|
||||||
|
else result = Sound_GetID3V2SizeMPG( tagSize ) + MP3_ID3V2_HEADER_SZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
Stream_FindTailMPG
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
SceOff Stream_FindTailMPG( file_t *file )
|
||||||
|
{
|
||||||
|
SceOff result;
|
||||||
|
byte tagId[MP3_ID3V1_ID_SZ];
|
||||||
|
|
||||||
|
result = FS_FileLength( file );
|
||||||
|
|
||||||
|
FS_Seek( file, result - MP3_ID3V1_SZ, SEEK_SET );
|
||||||
|
|
||||||
|
if( FS_Read( file, tagId, MP3_ID3V1_ID_SZ ) < MP3_ID3V1_ID_SZ )
|
||||||
|
{
|
||||||
|
Con_DPrintf( S_ERROR "Sound_Mp3FindTail: ID3V1 ID read error\n");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !memcmp( tagId, MP3_ID3V1_ID, MP3_ID3V1_ID_SZ ))
|
||||||
|
result -= MP3_ID3V1_SZ;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
Stream_FillBufferMPG
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
int Stream_FillBufferMPG( file_t *file, mp3_decoder_t *desc )
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
byte *dstPtr;
|
||||||
|
int dstSize;
|
||||||
|
int dstPos;
|
||||||
|
fs_offset_t readSize;
|
||||||
|
|
||||||
|
if( sceMp3CheckStreamDataNeeded( desc->handle ) <= 0 )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// get Info on the stream (where to fill to, how much to fill, where to fill from)
|
||||||
|
status = sceMp3GetInfoToAddStreamData( desc->handle, &dstPtr, &dstSize, &dstPos );
|
||||||
|
if( status < 0 )
|
||||||
|
{
|
||||||
|
Con_DPrintf( S_ERROR "sceMp3GetInfoToAddStreamData returned 0x%08X\n", status);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
// seek file to position requested
|
||||||
|
if( desc->cachePos != dstPos )
|
||||||
|
{
|
||||||
|
FS_Seek( file, dstPos, SEEK_SET );
|
||||||
|
desc->cachePos = dstPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
// read the amount of data
|
||||||
|
readSize = FS_Read( file, dstPtr, dstSize );
|
||||||
|
desc->cachePos += ( int )readSize;
|
||||||
|
|
||||||
|
// notify mp3 library about how much we really wrote to the stream buffer
|
||||||
|
status = sceMp3NotifyAddStreamData( desc->handle, ( int )readSize );
|
||||||
|
if ( status < 0 )
|
||||||
|
Con_DPrintf( S_ERROR "sceMp3NotifyAddStreamData returned 0x%08X\n", status);
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
Stream_OpenMPG
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
stream_t *Stream_OpenMPG( const char *filename )
|
||||||
|
{
|
||||||
|
stream_t *stream;
|
||||||
|
mp3_decoder_t *desc;
|
||||||
|
file_t *file;
|
||||||
|
int status;
|
||||||
|
void *bufferBase;
|
||||||
|
|
||||||
|
file = FS_Open( filename, "rbh", false ); // hold mode
|
||||||
|
if( !file ) return NULL;
|
||||||
|
|
||||||
|
// at this point we have valid stream
|
||||||
|
stream = Mem_Calloc( host.soundpool, sizeof( stream_t ));
|
||||||
|
stream->file = file;
|
||||||
|
stream->pos = 0;
|
||||||
|
|
||||||
|
desc = Mem_Calloc( host.soundpool, sizeof( mp3_decoder_t ) + MP3_BUFFER_SIZE + PCM_BUFFER_SIZE + 63 );
|
||||||
|
bufferBase = (void *)(((( uintptr_t )desc + sizeof( mp3_decoder_t )) & (~( 64 - 1 ))) + 64 );
|
||||||
|
|
||||||
|
// reserve a mp3 handle
|
||||||
|
SceMp3InitArg mp3Init;
|
||||||
|
mp3Init.mp3StreamStart = Stream_FindHeadMPG( file );
|
||||||
|
mp3Init.mp3StreamEnd = Stream_FindTailMPG( file );
|
||||||
|
mp3Init.mp3Buf = bufferBase;
|
||||||
|
mp3Init.mp3BufSize = MP3_BUFFER_SIZE;
|
||||||
|
mp3Init.pcmBuf = (void *)(( uintptr_t )bufferBase + MP3_BUFFER_SIZE );
|
||||||
|
mp3Init.pcmBufSize = PCM_BUFFER_SIZE;
|
||||||
|
|
||||||
|
desc->cachePos = 0;
|
||||||
|
desc->pcmTempPtr = mp3Init.pcmBuf;
|
||||||
|
desc->handle = sceMp3ReserveMp3Handle( &mp3Init );
|
||||||
|
if ( desc->handle < 0 )
|
||||||
|
{
|
||||||
|
Con_DPrintf( S_ERROR "sceMp3ReserveMp3Handle returned 0x%08X\n", desc->handle );
|
||||||
|
Mem_Free( stream );
|
||||||
|
Mem_Free( desc );
|
||||||
|
FS_Close( file );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fill the stream buffer with some data so that sceMp3Init has something to work with
|
||||||
|
if( Stream_FillBufferMPG( file, desc ) != 0 )
|
||||||
|
{
|
||||||
|
Mem_Free( stream );
|
||||||
|
Mem_Free( desc );
|
||||||
|
FS_Close( file );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = sceMp3Init( desc->handle );
|
||||||
|
if ( status < 0 )
|
||||||
|
{
|
||||||
|
Con_DPrintf( S_ERROR "sceMp3Init returned 0x%08X\n", status );
|
||||||
|
Mem_Free( stream );
|
||||||
|
Mem_Free( desc );
|
||||||
|
FS_Close( file );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
desc->frameCount = sceMp3GetFrameNum( desc->handle );
|
||||||
|
|
||||||
|
stream->buffsize = 0; // how many samples left from previous frame
|
||||||
|
stream->channels = PCM_CHANNELS; // always 2 PCM channels
|
||||||
|
stream->rate = sceMp3GetSamplingRate( desc->handle );
|
||||||
|
stream->width = PCM_WIDTH; // always 16 bit PCM
|
||||||
|
stream->ptr = (void *)desc;
|
||||||
|
stream->type = WF_MPGDATA;
|
||||||
|
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
Stream_ReadMPG
|
||||||
|
|
||||||
|
assume stream is valid
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
int Stream_ReadMPG( stream_t *stream, int needBytes, void *buffer )
|
||||||
|
{
|
||||||
|
// buffer handling
|
||||||
|
int bytesWritten = 0;
|
||||||
|
mp3_decoder_t *desc;
|
||||||
|
int errdec;
|
||||||
|
|
||||||
|
desc = ( mp3_decoder_t* )stream->ptr;
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
byte *data;
|
||||||
|
int outsize;
|
||||||
|
|
||||||
|
if( !stream->buffsize )
|
||||||
|
{
|
||||||
|
// Check if we need to fill our stream buffer
|
||||||
|
if( Stream_FillBufferMPG( stream->file, desc ) != 0 )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for( errdec = 0; errdec < MP3_ERRORS_MAX; errdec++ )
|
||||||
|
{
|
||||||
|
stream->pos = sceMp3Decode( desc->handle, (SceShort16**)&desc->pcmTempPtr );
|
||||||
|
if(( int )stream->pos >= 0 ) // decoding successful
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if( stream->pos == 0x80671402 ) // next frame header
|
||||||
|
{
|
||||||
|
if( Stream_FillBufferMPG( stream->file, desc ) != 0 )
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(( int )stream->pos < 0 )
|
||||||
|
{
|
||||||
|
if( stream->pos != 0x80671402 )
|
||||||
|
Con_DPrintf( S_ERROR "sceMp3Decode returned 0x%08X\n", stream->pos );
|
||||||
|
return 0; // ???
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check remaining size
|
||||||
|
if( bytesWritten + stream->pos > needBytes )
|
||||||
|
outsize = ( needBytes - bytesWritten );
|
||||||
|
else outsize = stream->pos;
|
||||||
|
|
||||||
|
// copy raw sample to output buffer
|
||||||
|
data = (byte *)buffer + bytesWritten;
|
||||||
|
memcpy( data, &desc->pcmTempPtr[stream->buffsize], outsize );
|
||||||
|
bytesWritten += outsize;
|
||||||
|
stream->pos -= outsize;
|
||||||
|
stream->buffsize += outsize;
|
||||||
|
|
||||||
|
// continue from this sample on a next call
|
||||||
|
if( bytesWritten >= needBytes )
|
||||||
|
return bytesWritten;
|
||||||
|
|
||||||
|
stream->buffsize = 0; // no bytes remaining
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
Stream_SetPosMPG
|
||||||
|
|
||||||
|
assume stream is valid
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
int Stream_SetPosMPG( stream_t *stream, int newpos )
|
||||||
|
{
|
||||||
|
mp3_decoder_t *desc;
|
||||||
|
int frame;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
desc = ( mp3_decoder_t* )stream->ptr;
|
||||||
|
|
||||||
|
// get frame num
|
||||||
|
frame = newpos / sceMp3GetMaxOutputSample( desc->handle ); // VBR?
|
||||||
|
|
||||||
|
if( frame < 1 || frame >= desc->frameCount - 1 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
status = sceMp3ResetPlayPositionByFrame( desc->handle, frame );
|
||||||
|
if( status < 0 )
|
||||||
|
{
|
||||||
|
Con_DPrintf( S_ERROR "sceMp3ResetPlayPositionByFrame returned 0x%08X\n", status );
|
||||||
|
|
||||||
|
// failed to seek for some reasons
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// flush any previous data
|
||||||
|
stream->buffsize = 0;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
Stream_GetPosMPG
|
||||||
|
|
||||||
|
assume stream is valid
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
int Stream_GetPosMPG( stream_t *stream )
|
||||||
|
{
|
||||||
|
mp3_decoder_t *desc;
|
||||||
|
|
||||||
|
desc = ( mp3_decoder_t * )stream->ptr;
|
||||||
|
|
||||||
|
return sceMp3GetSumDecodedSample( desc->handle );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
Stream_FreeMPG
|
||||||
|
|
||||||
|
assume stream is valid
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
void Stream_FreeMPG( stream_t *stream )
|
||||||
|
{
|
||||||
|
mp3_decoder_t *desc;
|
||||||
|
|
||||||
|
desc = ( mp3_decoder_t * )stream->ptr;
|
||||||
|
if( desc )
|
||||||
|
{
|
||||||
|
sceMp3ReleaseMp3Handle( desc->handle );
|
||||||
|
Mem_Free( desc );
|
||||||
|
stream->ptr = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( stream->file )
|
||||||
|
{
|
||||||
|
FS_Close( stream->file );
|
||||||
|
stream->file = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Mem_Free( stream );
|
||||||
|
}
|
||||||
|
#endif // XASH_PSP
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ void Sound_Shutdown( void )
|
|||||||
Mem_FreePool( &host.soundpool );
|
Mem_FreePool( &host.soundpool );
|
||||||
}
|
}
|
||||||
|
|
||||||
static byte *Sound_Copy( size_t size )
|
byte *Sound_Copy( size_t size )
|
||||||
{
|
{
|
||||||
byte *out;
|
byte *out;
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ Sound_ResampleInternal
|
|||||||
We need convert sound to signed even if nothing to resample
|
We need convert sound to signed even if nothing to resample
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static qboolean Sound_ResampleInternal( wavdata_t *sc, int inrate, int inwidth, int outrate, int outwidth )
|
qboolean Sound_ResampleInternal( wavdata_t *sc, int inrate, int inwidth, int outrate, int outwidth )
|
||||||
{
|
{
|
||||||
double stepscale, j;
|
double stepscale, j;
|
||||||
int outcount;
|
int outcount;
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ static void FindChunk( const char *filename, const char *name )
|
|||||||
StreamFindNextChunk
|
StreamFindNextChunk
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
static qboolean StreamFindNextChunk( file_t *file, const char *name, int *last_chunk )
|
qboolean StreamFindNextChunk( file_t *file, const char *name, int *last_chunk )
|
||||||
{
|
{
|
||||||
char chunkName[4];
|
char chunkName[4];
|
||||||
int iff_chunk_len;
|
int iff_chunk_len;
|
||||||
@@ -331,7 +331,8 @@ stream_t *Stream_OpenWAV( const char *filename )
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// open
|
// open
|
||||||
file = FS_Open( filename, "rb", false );
|
// h - hold mode
|
||||||
|
file = FS_Open( filename, "rbh", false );
|
||||||
if( !file ) return NULL;
|
if( !file ) return NULL;
|
||||||
|
|
||||||
// find "RIFF" chunk
|
// find "RIFF" chunk
|
||||||
|
|||||||
@@ -74,7 +74,9 @@ struct stream_s
|
|||||||
|
|
||||||
// current stream state
|
// current stream state
|
||||||
void *ptr; // internal decoder state
|
void *ptr; // internal decoder state
|
||||||
|
#if !XASH_PSP
|
||||||
char temp[OUTBUF_SIZE]; // mpeg decoder stuff
|
char temp[OUTBUF_SIZE]; // mpeg decoder stuff
|
||||||
|
#endif
|
||||||
size_t pos; // actual track position (or actual buffer remains)
|
size_t pos; // actual track position (or actual buffer remains)
|
||||||
int buffsize; // cached buffer size
|
int buffsize; // cached buffer size
|
||||||
};
|
};
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user