Compare commits

...

998 Commits

Author SHA1 Message Date
Alibek Omarov
da65cc99d9 travis: don't upload dead APKs [ci skip] 2019-12-03 04:00:11 +03:00
Alibek Omarov
7dde4c03a7 scripts: enable mobile_hacks HLSDK branch for MotoMAGX 2019-12-03 03:49:47 +03:00
Alibek Omarov
326a7d79f0 mainui: update 2019-12-03 03:47:28 +03:00
Alibek Omarov
dd3fcb6461 scripts: fix android travis build 2019-12-03 02:58:03 +03:00
Alibek Omarov
fa90dbbd5e wscript: fix sanitize build 2019-12-03 02:35:23 +03:00
Alibek Omarov
dd1daa5bff engine: correctly validate blueshift maps 2019-12-03 02:27:08 +03:00
Alibek Omarov
154dd5c9ae engine: console: temporarily disable updating screen when something is printed to console, because it can mess up with textures 2019-12-03 02:17:12 +03:00
Alibek Omarov
2ee7367567 scripts: don't symlink engine and hlsdk sources on Android as -sl 2019-12-02 02:15:25 +03:00
Alibek Omarov
3da10f28c4 engine: restored BShift maps support 2019-12-02 02:14:02 +03:00
Alibek Omarov
612e7560ae engine: client: fix r_showtextures 2019-12-02 02:13:41 +03:00
Alibek Omarov
fe362a1ab5 wscript: add incompatible-pointer-types only for C 2019-12-02 02:13:23 +03:00
Alibek Omarov
8399107826 engine: platform: android: remake video backend to use EGL through Java code 2019-12-02 01:01:39 +03:00
Alibek Omarov
077bc7323c engine: host: fix crash 2019-12-02 01:01:39 +03:00
Andrey Akhmichin
6f2b559c5a engine: common: cfgscript.c: change wrong variable type to fix compilation. 2019-12-01 17:30:48 +03:00
Alibek Omarov
fec0a6baf6 engine: platform: android: change package name 2019-12-01 02:17:51 +03:00
Alibek Omarov
ac75bdf2d4 ref_gl: update gl-wes-v2 submodule 2019-12-01 01:42:27 +03:00
Alibek Omarov
56859e03c3 travis: disable hardfp finally, it mostly useless with newer NDK updates 2019-11-29 14:44:24 +03:00
Alibek Omarov
959e10f720 mainui: update 2019-11-28 23:05:17 +03:00
Alibek Omarov
0991255534 engine: dedicated: fix dedicated build 2019-11-28 19:23:34 +03:00
Alibek Omarov
199d3fd422 contrib: remove my personal qtcreator project, as I'm using compile_commands.json support now 2019-11-28 19:21:53 +03:00
Alibek Omarov
c07109e69c engine: fix -Wincompatible-pointer-types, add it to Werror list 2019-11-28 19:18:50 +03:00
Alibek Omarov
08e7bb1bf4 engine: common: enable our own build number counter, move legacy to Q_buildnum_compat 2019-11-28 17:49:14 +03:00
Alibek Omarov
d0010cf9cb engine: don't call SCR_VidInit too soon 2019-11-28 17:43:06 +03:00
Alibek Omarov
ecd675926a engine: cvar: add null checks as these functions are passed to user's DLL 2019-11-26 02:48:16 +03:00
Alibek Omarov
0c3be639c5 engine: reliably tell client.dll about vid mode changes 2019-11-26 02:47:48 +03:00
Alibek Omarov
3a9801853d engine: client: detailed message if menu failed to load 2019-11-26 02:47:25 +03:00
Alibek Omarov
3907be3c8f mainui: update 2019-11-26 02:47:04 +03:00
Alibek Omarov
9421457b3a engine: big refactoring commit, instead of using platform-specific platform-specific macros, use appropriate macros set by public/build.h 2019-11-24 03:52:08 +03:00
Alibek Omarov
ac4a14ef6c engine: host: support DEFAULT_DEV macro 2019-11-24 03:02:12 +03:00
Alibek Omarov
c613118199 defaults: refactoring, remove XASH_FBDEV macro, remove dead macros(DEFAULT_CON_MAXFRAC and DEFAULT_SV_FORCESIMULATING) 2019-11-24 03:01:50 +03:00
Alibek Omarov
755db4d56b backends: reformat 2019-11-24 03:00:35 +03:00
Alibek Omarov
2e180d5548 Documentation: engine-porting-guide: finalize document 2019-11-24 02:31:48 +03:00
Alibek Omarov
bf9840c2a8 mainui: update 2019-11-24 02:12:27 +03:00
Alibek Omarov
f56887bde9 engine: fix rodir, now it always creates gamefolder in rwdir. Fixes #87 2019-11-24 02:12:17 +03:00
Alibek Omarov
23fe1c0985 engine: use appropriate path array length 2019-11-24 02:10:52 +03:00
Alibek Omarov
5266f17d56 Documentation: extensions: library-naming: proper line breaks and links to buildsystem integration for HLSDK 2019-11-20 19:58:43 +03:00
Alibek Omarov
744f75d4a3 engine: linux: simplify Platform_DoubleTime 2019-11-20 16:45:55 +03:00
Alibek Omarov
09203dc512 ref_gl: temporarily fix water drawing on GLES 2019-11-17 18:51:39 +03:00
Alibek Omarov
3c3d5d472e ref_gl: bring back glDrawRangeElements support 2019-11-17 18:51:03 +03:00
Alibek Omarov
4c6e64c89b mainui: update 2019-11-17 18:05:12 +03:00
Alibek Omarov
7afee98f99 engine: ref: check if refdll was initialized before freeing texture 2019-11-17 18:05:05 +03:00
Alibek Omarov
f562926aaa Documentation: Xash3D FWGS Engine porting guide, not finished 2019-11-15 17:25:24 +03:00
Alibek Omarov
b25c83edc4 Documentation: ports: define MotoMAGX port as supported 2019-11-15 17:23:55 +03:00
Alibek Omarov
c42b5e043d Documentation: input-interface: split Russian translation to new file 2019-11-15 14:48:29 +03:00
Alibek Omarov
1e5921d33f Documentation: move FWGS engine extensions to appropriate folder [ci skip] 2019-11-15 14:42:52 +03:00
Alibek Omarov
663344eeaa Create supported-mod-list.md [ci skip] 2019-11-15 14:38:04 +03:00
Alibek Omarov
e4e34cc835 Create input-interface.md [ci skip] 2019-11-15 14:08:40 +03:00
Alibek Omarov
b36fc0e2ae Create console-scripting.md [ci skip] 2019-11-15 14:07:35 +03:00
Alibek Omarov
924d6ada60 Create public-server-rules-and-recommendations.md [ci skip] 2019-11-15 14:06:26 +03:00
Alibek Omarov
8343cadd30 Create mod-porting-guide.md 2019-11-15 14:01:14 +03:00
Alibek Omarov
0636dc45bd engine: sdl: fix resizing event handling 2019-11-12 02:04:18 +03:00
Alibek Omarov
611ee64cd9 scripts: build_motomagx_engine: use waf install now, as HLSDK now supports library naming scheme 2019-11-11 04:14:18 +03:00
Alibek Omarov
5a17e7f425 build: add XASH_ARMvX defines(buildsystem integration), add oneliner to generate #undef list 2019-11-11 00:38:40 +03:00
Alibek Omarov
db39f0cc88 engine: client: combine loading or paused icon drawing 2019-11-08 01:28:01 +03:00
Alibek Omarov
3f48bce7da engine: client: fix #79 2019-11-08 01:09:55 +03:00
Alibek Omarov
936b491248 engine: dedicated: remove unused stub 2019-11-08 01:09:55 +03:00
Alibek Omarov
428e8ef427 engine: server: simplify game saving code, hide GL_FreeImage under XASH_DEDICATED macro 2019-11-08 01:09:55 +03:00
tyabus
934dffd273 engine: common: fix message formating 2019-11-07 23:26:11 +03:00
Andrey Akhmichin
0c34a5081c engine: client: make the code that generates screenshots and demos names simpler. 2019-11-07 23:12:34 +03:00
Alibek Omarov
f09682131f travis: fix magx deploy 2019-11-07 08:41:10 +03:00
Alibek Omarov
32ddc2a47f waifulib: xcompile: we need to disable builtins even on armeabi with host compiler and NDK r10e 2019-11-07 07:30:41 +03:00
Alibek Omarov
729f534614 waf: third msvc test 2019-11-07 07:19:08 +03:00
Alibek Omarov
6937d0c17e travis: fix unpacking r10e, add clang-9 2019-11-07 07:13:28 +03:00
Alibek Omarov
4dba8219ca waf: another msvc test 2019-11-07 07:05:31 +03:00
Alibek Omarov
f8b0ec8c4b wscript: tune-up options for magx 2019-11-07 06:56:07 +03:00
Alibek Omarov
ce20da28e1 travis: reorder tasks depending on their breakability. Use r10e for Android and host toolchain 2019-11-07 06:55:40 +03:00
Alibek Omarov
40ed87d8de waf: msvc test 2019-11-07 06:54:42 +03:00
Alibek Omarov
5bae732818 scripts: build ref_soft for magx 2019-11-07 05:15:45 +03:00
Alibek Omarov
08b3de08e7 wscript: use SINGLE_BINARY on motomagx 2019-11-07 05:07:28 +03:00
Alibek Omarov
a51c5d93fc Revert "game_launch: check for Platform_Main before Host_Main"
This reverts commit 6aa61657e0.
2019-11-07 05:06:51 +03:00
Alibek Omarov
55dbb2ca3f Revert "game_launch: fix start up"
This reverts commit a46e459124.
2019-11-07 05:06:43 +03:00
Alibek Omarov
4b930c7854 Revert "engine: platform: magx: add pre-init platform-specific hook"
This reverts commit 2958b14cc2.
2019-11-07 05:06:24 +03:00
Alibek Omarov
d68823708f scripts: include run.sh script for magx 2019-11-07 05:01:16 +03:00
Alibek Omarov
4b5d09a968 travis: rename build 2019-11-07 04:52:13 +03:00
Alibek Omarov
7e4a7ac23d wscript: workaround bug when CC_VERSION is not set for msvc 2019-11-07 04:49:49 +03:00
Alibek Omarov
62cdf2ae5b engine: input: hide SDL_ functions under XASH_SDL macro 2019-11-07 04:44:24 +03:00
Alibek Omarov
94c42160b7 travis: enable CI for motomagx 2019-11-07 02:46:04 +03:00
Alibek Omarov
18bbfebc5d mainui: update 2019-11-07 02:22:35 +03:00
Alibek Omarov
d18cb1f74c wscript: add special options for fast build type for gcc3 2019-11-07 02:20:17 +03:00
Alibek Omarov
2807841511 waf: update to latest waifu revision 2019-11-07 02:19:21 +03:00
Alibek Omarov
13ed8d4529 wscript: move motomagx options to root wscript, disable PIC for this old machine, set default options 2019-11-06 23:14:20 +03:00
Alibek Omarov
1ff06c2c1e mainui: update 2019-11-06 22:32:30 +03:00
Alibek Omarov
0cb591821a Merge sdl12-port into master 2019-11-06 22:29:04 +03:00
Alibek Omarov
8700f44175 public: unittest: use static everywhere to prevent collision when tests may be linked into engine 2019-11-05 11:35:39 +03:00
Alibek Omarov
6ba73a732a mainui: update 2019-11-05 11:23:56 +03:00
Alibek Omarov
4b97d8bcda public: add simple C89-compatible testing framework (wip) 2019-11-05 11:22:16 +03:00
Alibek Omarov
0dc6f1674f mainui: updatr 2019-11-05 09:50:01 +03:00
Alibek Omarov
6bc6f0dd70 scripts: run windows builds verbose 2019-11-05 09:41:58 +03:00
Alibek Omarov
39abd82e5d wscript: silence MSVC tgmath nonsense 2019-11-05 09:41:26 +03:00
Alibek Omarov
15924aebaa xash3d-fwgs: check if HAVE_TGMATH_H is set to positive value rather it's just defined 2019-11-05 01:41:35 +03:00
Alibek Omarov
b79c95d295 engine: wscript: fix typo, use pthreads.py tool 2019-11-05 01:40:06 +03:00
Alibek Omarov
453c0d890d engine: wscript: rename fbdev to enable-fbdev for great consistency, check definition instead of putting vars into env 2019-11-05 01:35:20 +03:00
Alibek Omarov
60f0f68e68 Merge remote-tracking branch 'origin/master' 2019-11-05 01:16:39 +03:00
Alibek Omarov
79adaa11e0 lowmemory: merge 2019-11-05 01:15:31 +03:00
Alibek Omarov
6819050d91 waf: upgrade to latest waifu revision 2019-11-05 01:15:03 +03:00
Alibek Omarov
d2740f78c1 wscript: refactoring, add waf_unit_test, disable -Wdouble-promotion, rename fast as fastnative and leave fast without -march=native for x-compiling 2019-11-05 01:01:33 +03:00
mittorn
6953e829c4 lowmemory: prevent redefines 2019-11-04 22:34:08 +07:00
mittorn
1365020302 ref: add enum for screen rotation 2019-11-04 20:27:46 +07:00
mittorn
0e7013eeb0 lowmemory: tune XASH_LOW_MEMORY=1 not breaking multiplayer 2019-11-04 19:58:45 +07:00
Alibek Omarov
a46e459124 game_launch: fix start up 2019-11-02 08:56:07 +03:00
Alibek Omarov
dfed24c290 public: build: add new ARMv6 detect macro 2019-11-02 08:56:07 +03:00
Alibek Omarov
1f308a43c8 engine: fix build after lowmemory rebase 2019-11-02 08:56:07 +03:00
Alibek Omarov
2062e55c6a lowmemory: cut up netgraph buffers 2019-11-02 08:56:07 +03:00
Alibek Omarov
90038d2924 common: fix broken build 2019-11-02 08:56:07 +03:00
Alibek Omarov
9aff6ca633 engine: wscript: support building for MotoMAGX 2019-11-02 08:56:07 +03:00
Alibek Omarov
6aa61657e0 game_launch: check for Platform_Main before Host_Main 2019-11-02 08:56:07 +03:00
Alibek Omarov
2958b14cc2 engine: platform: magx: add pre-init platform-specific hook 2019-11-02 08:56:07 +03:00
Alibek Omarov
aa6674b032 engine: support compiling with gcc3 2019-11-02 08:56:07 +03:00
Alibek Omarov
7a7bca2991 engine: wscript: always add librt on linux if it was checked before 2019-11-02 08:56:07 +03:00
Alibek Omarov
7e9f90a09d public: fix detecting ARM on gcc3 2019-11-02 08:56:07 +03:00
Alibek Omarov
5e8373fa46 engine: slightly update RefAPI 2019-11-02 08:56:07 +03:00
Alibek Omarov
9d826016b0 engine: finish sdl1.2 port 2019-11-02 08:56:07 +03:00
Alibek Omarov
7f1dd248c2 backends: add XASH_MESSAGEBOX to specify messagebox platform implementation 2019-11-02 08:56:07 +03:00
Alibek Omarov
4d5e7c0557 platform: minify changes, use SDL_VERSION_ATLEAST macro(left unfinished) 2019-11-02 08:56:07 +03:00
Alibek Omarov
9e99a2bc37 engine: dirty sdl1.2 port 2019-11-02 08:56:07 +03:00
Alibek Omarov
8dafbaeda2 engine: platform: sdl: dirty wip sdl1.2 port 2019-11-02 08:56:07 +03:00
Alibek Omarov
ae35f15f15 engine: wscript: add option to build against sdl1.2 2019-11-02 08:56:07 +03:00
Alibek Omarov
0dd91ceda2 xash3d-fwgs: append missing new line at the end of file 2019-11-02 08:56:07 +03:00
mittorn
d6f8112860 gameinfo: add MIN_EDICTS constant instead of magic number 600, low it to 64 2019-11-02 12:46:11 +07:00
mittorn
a1db6c6a9b lowmemory: remove datagram limit 2019-11-01 13:49:53 +07:00
mittorn
271d15f989 client: prevent precache overflow 2019-11-01 13:41:30 +07:00
Aimless-Wanderer
00e5d42459 platform: android: fix macros 2019-10-31 18:42:34 +03:00
mittorn
291fdfac68 platform/evdev: add some keys, add keyevent debug 2019-10-31 13:22:58 +07:00
mittorn
5e31e3fad0 keys: rotation support 2019-10-31 13:22:58 +07:00
mittorn
7f6395fa7d ref: display transformation API 2019-10-31 01:36:07 +07:00
Alibek Omarov
aee9f454fc Documentation: update ports.md, include @masterfeizz 3DS port, add new ports, stabilize ARM and Android ports although we aren't released yet 2019-10-30 17:10:55 +03:00
Alibek Omarov
e3c3b05396 engine: platform: android: don't check if XASH_ENGLIBDIR and XASH_GAMELIBDIR are null. Load library by direct path if PATH_SPLITTER was found. Partially fixes #74 2019-10-30 16:55:00 +03:00
Alibek Omarov
6e637456ef platform: define platform-specific posix-compatible library loaders as macros to reduce macros hell in lib_posix.c 2019-10-30 16:46:18 +03:00
mittorn
5e5ffec67d lowmemory: tweak some protocol limits for HL1, restore bit counts (maybe even restore multiplayer compatibility) 2019-10-29 11:35:02 +07:00
mittorn
06cadacb59 lowmemory: cut resources array for legacy mode, only related to downloads 2019-10-29 11:32:32 +07:00
mittorn
cb8e0a50bc lowmemory: reduce MAX_QPATH 2019-10-29 11:30:57 +07:00
mittorn
b3a5283517 lowmemory: rename waf options 2019-10-28 12:31:29 +07:00
mittorn
5348046109 lowmemory: increase decals limit 2019-10-28 12:29:44 +07:00
mittorn
57d48b64eb keys: add OSK 2019-10-28 12:28:52 +07:00
mittorn
5145b1956c zone; revert removing clean check 2019-10-28 12:25:20 +07:00
mittorn
bb48e5209e console: fix wrong line width on start, remove some hard-coded sizes 2019-10-28 12:14:19 +07:00
mittorn
37cba10c14 lowmemory: fix sentences 2019-10-28 12:07:15 +07:00
Alibek Omarov
1decb1c7fb xash3d-fwgs: append missing new line at the end of file 2019-10-27 22:29:03 +03:00
mittorn
ba1347a8ce wscript: add options for low memory, async ns resolve and swap allocator 2019-10-26 12:12:59 +07:00
mittorn
feb01b270e zone, platform: add swap allocator 2019-10-26 12:10:50 +07:00
mittorn
114a256675 Implement XASH_LOW_MEMORY, memory-reduced configuration 2019-10-26 07:06:26 +07:00
mittorn
2897e5f17e input: fix evdev macro 2019-10-26 06:53:24 +07:00
mittorn
6723758edc platform/alsa: fix case when buffer size is POT, improve latency, calculate sample count 2019-10-26 05:49:23 +07:00
mittorn
23956a0b82 platform: alsa support 2019-10-25 09:04:52 +07:00
Alibek Omarov
93a43ae9a5 mainui: update 2019-10-24 12:45:27 +03:00
Alibek Omarov
8905e7cbb7 wscript: fix stdin input wasn't enabled for dedicated. Fix single-binary help string 2019-10-23 20:47:49 +03:00
iZarif
bf8b87c29d engine: client/common: fix a few more format warnings 2019-10-22 17:56:08 +03:00
mittorn
803c396fa2 platform: new fbdev bakend, move in_evdev to bakends 2019-10-22 01:42:02 +07:00
Alibek Omarov
0933261898 wscript: oops, remove trailing colon 2019-10-18 16:46:54 +03:00
Alibek Omarov
e93d362391 wscript: explicitly undefine HAVE_TGMATH_H if tests are failed 2019-10-18 16:46:54 +03:00
Alibek Omarov
2b13de80bf wscript: check if tgmath actually compiles, should fix building under freebsd 2019-10-18 16:46:54 +03:00
Alibek Omarov
2c67f4cb39 wscript: fix wrong object method call 2019-10-18 16:46:54 +03:00
Alibek Omarov
4705683ebc wscript: conf.define instead of directly appending to DEFINES 2019-10-18 16:46:54 +03:00
Alibek Omarov
78baf568ae engine: more double promotion fixes 2019-10-18 16:46:54 +03:00
Alibek Omarov
1218f4aeb6 ref_gl: explicitly cast literals to floats 2019-10-18 16:46:54 +03:00
Alibek Omarov
531c6cc375 engine: server: explicitly cast literals to floats 2019-10-18 16:46:54 +03:00
Alibek Omarov
edf3fcd398 engine: common: explicitly cast literals to floats, include tgmath when needed 2019-10-18 16:46:54 +03:00
Alibek Omarov
c67f065d90 engine: client: explicitly cast literals to floats 2019-10-18 16:46:54 +03:00
Alibek Omarov
148846c02d common: explicitly cast literals to floats 2019-10-18 16:46:54 +03:00
Alibek Omarov
8afb2dbdec wscript: better tgmath check, make double-promotion not an error 2019-10-18 16:46:54 +03:00
Alibek Omarov
14be566401 public: include tgmath in mathlib.h, so macros will be used inside Vector macros 2019-10-18 16:46:54 +03:00
Alibek Omarov
0577ecbccf public: initial fix of double promotion 2019-10-18 16:46:54 +03:00
Alibek Omarov
880dd2546f engine: client: fix wrong type in DSP 2019-10-18 08:11:05 +03:00
Alibek Omarov
c2063c869d engine: client: fix demoplayback type from qboolean to int(can exceed false and true) 2019-10-18 08:04:00 +03:00
Alibek Omarov
49a133514a ref_gl: fix wrong type 2019-10-18 07:51:11 +03:00
Alibek Omarov
94dc801150 scripts: remove single-binary for xashds, as it already set implicitly. 2019-10-18 07:45:05 +03:00
Alibek Omarov
fe118e9683 ci: disable dedicated build for freebsd at now 2019-10-18 07:36:03 +03:00
Alibek Omarov
e0d993a5a8 public: fix tautological-compare 2019-10-18 07:23:34 +03:00
Alibek Omarov
cf35943f51 scripts: build_freebsd_engine: remove building SDL2, as it will be installed from ports, use /bin/sh as interpreter 2019-10-18 07:13:48 +03:00
Alibek Omarov
cd715178d2 scripts: set executable flags when needed 2019-10-18 07:05:16 +03:00
Alibek Omarov
869b684536 wscript: remove multicheck for win32 libs, remove sdl2 checking from main wscript 2019-10-18 06:35:05 +03:00
Alibek Omarov
bc56ce754b wscript: move C only flags from common flags, correct multicheck again 2019-10-18 06:20:27 +03:00
Alibek Omarov
32897450fc wscript: declare uselib_store for multicheck 2019-10-18 05:41:56 +03:00
Alibek Omarov
e0e9942bd5 waifulib: remove modules that now part of waifu distribution 2019-10-18 05:14:01 +03:00
Alibek Omarov
fdbd1c5658 wscript: check win32 libraries in parallel 2019-10-18 05:11:18 +03:00
Alibek Omarov
eaf983c054 wscript: remove BIT32_ALLOW 2019-10-18 05:06:10 +03:00
Alibek Omarov
e11eeb24fc waf: upgrade to waifu 1.0.0 2019-10-18 05:05:29 +03:00
Alibek Omarov
6dcd8c3af8 travis: fix amd64 linux build 2019-10-18 05:05:11 +03:00
Alibek Omarov
d68eab6b65 ci: autoconfirm for pkg installg 2019-10-16 02:35:35 +03:00
Alibek Omarov
8ec6eaa49a ci: try to install needed dependencies for freebsd 2019-10-16 02:27:24 +03:00
Alibek Omarov
a38f561d7c ci: use SDL2 zip source archive 2019-10-16 02:18:12 +03:00
Alibek Omarov
cb404b2730 cI: borrow image names from rust-lang/libc 2019-10-16 02:11:26 +03:00
Alibek Omarov
83d3c02e53 ci: add Cirrus CI support with FreeBSD 2019-10-16 02:09:47 +03:00
Alibek Omarov
8be58bcd21 engine: android: fix EGL context create error condition 2019-10-11 17:36:56 +03:00
Alibek Omarov
06e38b45c8 engine: android: don't throw host error when initializing software renderer on Android 2019-10-11 11:53:52 +03:00
Alibek Omarov
d3dd671759 engine: android: quick hack to load libraries on aarch64 until we don't symlinking lib folder 2019-10-11 11:50:21 +03:00
Alibek Omarov
e0b8c338a8 engine: ref: more verbose refdll loading 2019-10-11 11:46:59 +03:00
Alibek Omarov
ee363ebb74 waifulib: fix including system includes 2019-10-11 10:04:32 +03:00
Alibek Omarov
e4bb3ecd12 travis: use r20 for softfp build 2019-10-11 09:38:44 +03:00
Alibek Omarov
d05bfb55c5 travis: forgot to upload softfp test 2019-10-11 09:22:28 +03:00
Alibek Omarov
9c26983136 travis: enable softfp build with poly opt 2019-10-11 09:16:21 +03:00
Alibek Omarov
fa622168a0 engine: fix style, disable XASH_USE_SELECT 2019-10-11 08:51:30 +03:00
Alibek Omarov
eff814b148 engine: ref: remove redutant continue, return false in case of failed renderer initialization 2019-10-11 07:57:59 +03:00
Alibek Omarov
11c373a183 waf: upgrade to latest waifu 2019-10-11 07:40:40 +03:00
Alibek Omarov
898b697b70 engine: ref: allow to set r_refdll or -ref with ref_ prefix 2019-10-11 05:36:17 +03:00
Alibek Omarov
6d8026cd81 engine: ref: fix spamming in console when getting human readable renderer names 2019-10-11 05:11:45 +03:00
Alibek Omarov
1e7abdc144 wscript: fix ref_gl linking 2019-10-11 04:21:35 +03:00
Alibek Omarov
ff1b28244b engine: client: port ui_renderworld from old engine 2019-10-11 04:12:52 +03:00
Alibek Omarov
7782fa09ac wscript: refactor cflags appending, add optional polyhedral optimizations 2019-10-11 04:12:07 +03:00
Alibek Omarov
ae624801ac wscript: proper default showing in help 2019-10-11 03:46:17 +03:00
Alibek Omarov
8889bda261 wscript: use ConfigurationContext.define instead of appending to env['DEFINES'] 2019-10-11 03:42:20 +03:00
Alibek Omarov
a5fa4df37c ref_gl: fix wrong texture resampling condition 2019-10-10 06:02:26 +03:00
Alibek Omarov
2183240221 waifulib: xcompile: fix aarch64 binary installation 2019-10-09 05:52:43 +03:00
Alibek Omarov
33800954ec travis: fix mistyped ARCHS for Android 64 2019-10-09 05:21:09 +03:00
Alibek Omarov
67cb5a4dde travis: fix mistyped ARCHS 2019-10-09 04:47:11 +03:00
Alibek Omarov
9fd7e333df travis: another blind try to fix r10e unpack 2019-10-09 04:37:38 +03:00
Alibek Omarov
a9628cc0f0 travis: install lld-8 also 2019-10-09 04:10:34 +03:00
Alibek Omarov
f33de46508 travis: verbose 7z x for r10e ndk 2019-10-09 04:08:34 +03:00
Alibek Omarov
595d452c23 travis: s/p7zip/p7zip-full/g 2019-10-09 04:00:13 +03:00
Alibek Omarov
911e670be6 travis: install p7zip to be able to unpack r10e ndk 2019-10-09 03:51:58 +03:00
Alibek Omarov
9ea973dad6 waifulib: xcompile: fix C++ with host toolchain 2019-10-09 03:48:51 +03:00
Alibek Omarov
fcdd45341c travis: switch to clang-8 for android host build 2019-10-09 02:52:59 +03:00
Alibek Omarov
53d2d10932 travis: add Android 64 and Android hardfp experimental builds 2019-10-09 02:34:30 +03:00
Wei Mingzhi
88772a1c34 engine: GetGameDir should return gamedir only. Add proper stub functions for some engine APIs. 2019-10-07 16:08:10 +03:00
Alibek Omarov
1c21590e96 travis: set android autobuilds as release to have high optimization 2019-10-06 09:23:14 +03:00
Alibek Omarov
d2a8cfe614 Revert "engine: client: implement connectionprogress partially"
This reverts commit cb417a3d51.

This commit breaks demo playback. Figure out why, then revert it back.
2019-10-06 07:45:32 +03:00
Alibek Omarov
39ff3b199a wscript: fix LTO check scope 2019-10-06 06:58:45 +03:00
Alibek Omarov
ddf070b63d ref_gl: fix build 2019-10-06 06:55:16 +03:00
iZarif
4c559a4a08 wscript: add --enable-lto option 2019-10-06 06:10:06 +03:00
Alibek Omarov
fa16c49246 readme: sligthly update contributing guidelines 2019-10-06 03:49:46 +03:00
Alibek Omarov
d382f6886d engine: fix build 2019-10-05 04:02:25 +03:00
Alibek Omarov
02e111c5e1 waifulib: xcompile: fix clang detection 2019-10-05 03:35:11 +03:00
Alibek Omarov
73516eea4c ref_gl: update glwesv2 submodule 2019-10-05 03:34:52 +03:00
Alibek Omarov
6e2dbd4e1c engine: android: get rid of VLA 2019-10-05 03:33:13 +03:00
Alibek Omarov
67cdbef833 engine: fix signed char in studio 2019-10-05 03:33:00 +03:00
Alibek Omarov
d6bb72f772 engine: dedicated: fix old-style-definitions 2019-10-05 03:17:38 +03:00
Alibek Omarov
e6dd4882cc wscript: more paranoic Werrors 2019-10-05 03:06:51 +03:00
Alibek Omarov
cb62e65f9f public: fix implicit fallthrough 2019-10-05 02:49:04 +03:00
Alibek Omarov
cb5e282af4 engine: sequence: fix condition 2019-10-05 02:22:46 +03:00
Alibek Omarov
b175d8a0cb engine: net_encode: due to bug in GCC <9, disable duplicated-branches here 2019-10-05 02:22:10 +03:00
Alibek Omarov
fbb88a55cb engine: linux: fix C89 2019-10-05 02:10:46 +03:00
Alibek Omarov
f3a40ac794 engine: cfgscript: fix userinfo cvars wrong dump to config 2019-10-05 02:10:09 +03:00
Alibek Omarov
dc207a449c engine: fix -Werror=strict-prototypes 2019-10-05 02:09:45 +03:00
Alibek Omarov
5a8de90918 waifulib: xcompile: light refactoring 2019-10-05 01:16:20 +03:00
Alibek Omarov
2d6b770e7c waifulib: xcompile: allow building with host Clang and NDK r10e sysroot 2019-10-04 22:21:11 +03:00
Aimless Wanderer
409eee3bb4 engine: fix gameinfo parsing 2019-10-04 11:58:14 +03:00
Alibek Omarov
ac5bb86301 travis: nah, I don't have wish to experiment with yaml trash 2019-09-29 19:02:11 +03:00
Alibek Omarov
530d376c44 travis: push newengine branch at deploy higher 2019-09-29 18:43:53 +03:00
Alibek Omarov
b777ba9549 scripts: comment out github releases deployment until github fixes itself 2019-09-29 18:39:33 +03:00
Alibek Omarov
bc39b707d4 Revert github repository deploy removal 2019-09-29 18:38:31 +03:00
mittorn
cb0791c915 http: do not continue after HTTP_Free, fix potential buffer overflow 2019-09-29 01:42:17 +07:00
mittorn
03c73f56d2 waf: add linkflags before filtering cflags 2019-09-29 01:42:17 +07:00
Alibek Omarov
94d0c78913 ref_gl: update gles2 wrapper 2019-09-28 21:17:16 +03:00
mittorn
34463dcddc ref_gl: fix glConfig.max_texture_units when GL_MAX_TEXTURE_UNITS_ARB query not supported 2019-09-28 21:13:38 +07:00
mittorn
da11da97ad android: enable touch support 2019-09-28 20:09:26 +07:00
mittorn
c0043a5467 touch: implement wheel 2019-09-28 19:35:30 +07:00
mittorn
7770b1a82b input: improve touch emulation 2019-09-28 19:33:57 +07:00
mittorn
faf592adb4 waf: filter_cflags does not work with msvc 2019-09-28 04:59:09 +07:00
mittorn
0aa57854ca waf: fix unwanted required_flags modification 2019-09-28 04:36:08 +07:00
mittorn
fd8c1becec waifulib: gcc-6 support for android 2019-09-28 04:26:19 +07:00
mittorn
0afc3d83c6 android: add stub for Platform_PreCreateMove 2019-09-28 04:26:19 +07:00
mittorn
d633fe5deb waf: add cflags detection, make some warning flags optional 2019-09-28 04:26:19 +07:00
Alibek Omarov
5040cb83d0 engine: win32: lib: oops, fix wrong sizeof 2019-09-27 17:02:04 +03:00
Alibek Omarov
2b385ff1f4 engine: win32: lib: try to fix crash when checking dependencies 2019-09-27 16:56:20 +03:00
Alibek Omarov
cd5028eed1 ci: move signing to android project, don't call it here 2019-09-27 05:35:16 +03:00
mittorn
3ce014d5f5 ci: sign apk and fix filename 2019-09-27 02:58:17 +07:00
mittorn
75aaf1c66d ci: try fix upload 2019-09-27 02:47:44 +07:00
mittorn
26401a4fbf ci: enable android build upload 2019-09-27 02:33:00 +07:00
mittorn
dba757f0c2 touch: fix wrong dx/dy sign 2019-09-27 02:25:38 +07:00
mittorn
7f3ee9ca71 input: merge touch support again. Fix m_ignore, fix EngineAppendMove 2019-09-27 02:19:03 +07:00
mittorn
9a1414505a imagelib: support for 16-bit transparent tga 2019-09-27 02:12:35 +07:00
Alibek Omarov
13c1e807ad engine: s_mouth: fix another signed char 2019-09-25 04:10:47 +03:00
Alibek Omarov
6e95e19589 submodules: update 2019-09-25 04:09:48 +03:00
Alibek Omarov
8f47596ad0 waifulib: xcompile: append SONAME to shared libraries, experimental support for host compiling with NDK r10e(don't work), replace exceptions with fatal messages 2019-09-21 03:52:47 +03:00
Alibek Omarov
4f4c63b1dd waifulib: xcompile: enhance compiling using host clang, refactoring 2019-09-20 18:49:37 +03:00
Alibek Omarov
66323fe9ca waifulib: xcompile: preserve order of MACROS_TO_DESTOS, add -stdlib=libstdc++ to use system provided C++ standard library 2019-09-20 16:30:17 +03:00
Alibek Omarov
16e60bbb5f waifulib: xcompile: use llvm-strip on host 2019-09-19 18:18:42 +03:00
Alibek Omarov
0389d2495f waifulib: strip_on_install: add changed bytes counter 2019-09-19 18:18:25 +03:00
Alibek Omarov
4049c54511 engine: android: fix video backend not compiled 2019-09-19 18:17:56 +03:00
Alibek Omarov
e8006c3253 engine: move ShellExecute to client, as it cannot be used in dedicated 2019-09-19 17:09:18 +03:00
Alibek Omarov
07aa9595c0 engine: android: allow building dedicated on Android 2019-09-19 17:09:18 +03:00
Alibek Omarov
b91e97ca53 wscript: remove DEST_OS2 2019-09-19 17:09:18 +03:00
Alibek Omarov
cd0f7af38a waifulib: xcompile: get rid of DEST_OS2 2019-09-19 17:09:18 +03:00
Alibek Omarov
ac1bf4a9f8 waifulib: strip_on_install: fix typo 2019-09-12 17:00:08 +03:00
Alibek Omarov
af0046f401 waifulib: strip_on_install: don't strip on PE and unknown binaries [ci skip] 2019-09-11 20:37:47 +03:00
Alibek Omarov
43575b485d wscript: add an option to not strip binaries 2019-09-11 20:26:34 +03:00
Alibek Omarov
67c6cfce71 waf: strip installed binaries to reduce size 2019-09-11 18:47:44 +03:00
Alibek Omarov
5986874be2 wscript: enable clang_compilation_database in options 2019-09-10 10:30:03 +03:00
Alibek Omarov
cf17b4f63c waf: update binary waf 2019-09-10 10:27:42 +03:00
Alibek Omarov
d1ac48b2a1 waifulib: allow compiling using host clang and NDK sysroots, thus enabling building engine from any environment that has clang(termux as example) 2019-09-10 11:24:11 +06:00
Alibek Omarov
3032ce3bee engine: android: fix building dlsym_weak on latest NDK 2019-09-10 11:15:48 +06:00
Alibek Omarov
ba69f9e62a travis: comment osx autobuilds #61 2019-08-10 14:47:35 +03:00
Alibek Omarov
8323df240b engine: implement menu extensions to allow choosing renderers from GUI 2019-08-09 04:44:50 +03:00
Alibek Omarov
a1ae770f70 engine: ref: add optional export to determine actual human readable renderer name 2019-08-09 03:39:24 +03:00
Alibek Omarov
56938344b8 engine: win32: include shellapi.h 2019-08-09 03:07:56 +03:00
Alibek Omarov
a862e641f1 game_launch: fix build on windows 2019-08-09 02:59:40 +03:00
Alibek Omarov
00b9ac676e engine: win32: fix inconsistent dll linkage 2019-08-09 02:51:15 +03:00
Alibek Omarov
8bb6aa2c51 engine: don't include windows headers, as they globally included by port.h already 2019-08-09 02:46:29 +03:00
Alibek Omarov
505392c2f8 imagelib: png: include correct winsock 2019-08-09 02:35:53 +03:00
Alibek Omarov
37f9c25212 port: include winsock2 explicitly, so winsock1 would not be included with windows.h 2019-08-09 02:28:28 +03:00
Alibek Omarov
ee2c1ad8fa engine: net_ws: include engine headers first 2019-08-08 16:09:32 +03:00
Alibek Omarov
7771356e66 engine: net_ws: fix dedicated build 2019-08-08 07:33:47 +03:00
Alibek Omarov
cb417a3d51 engine: client: implement connectionprogress partially 2019-08-08 07:19:08 +03:00
Alibek Omarov
01dcb52b4c mainui: update submodule, add connectionprogress calls to engine 2019-08-08 07:18:02 +03:00
Alibek Omarov
24adb6e3e0 ref_gl: update wrappers 2019-08-08 05:57:33 +03:00
Alibek Omarov
d992f8525b ref_gl: enable VBO for GLES targets, slightly refactor extensions checking, fix UB when initializing glwes 2019-08-08 05:53:34 +03:00
Alibek Omarov
7be094b563 sdl: vid: prevent infinite recursion if SDL failed create window with selected GL attributes 2019-08-03 19:01:35 +03:00
Alibek Omarov
386a68e334 engine: fix wrong function called on closing socket on Win32 2019-07-30 18:41:24 +03:00
Alibek Omarov
ca57c8424d filesystem: follow C89 2019-07-30 18:20:54 +03:00
Jonathan Poncelet
214f53b8a7 SV_DropClient: Prevented transmission to fake clients 2019-07-30 15:46:10 +03:00
Alibek Omarov
143310bdb7 travis: android: make it more quiet 2019-07-29 08:31:38 +03:00
Alibek Omarov
dc8b8ccab3 travis: android: accept all licenses 2019-07-29 08:27:11 +03:00
Alibek Omarov
e3c095a3fa travis: specify android version 2019-07-29 08:20:05 +03:00
Alibek Omarov
61f49938e5 travis: build for android, not publish until touch controls are not done 2019-07-29 08:10:04 +03:00
Alibek Omarov
d697421d81 scripts: waifulib: add ndk r20 support 2019-07-29 06:54:05 +03:00
Alibek Omarov
f71619d541 public: build: fix wrong hardfp abi detection 2019-07-29 06:53:42 +03:00
Alibek Omarov
0eb1d4c7c0 engine: build: fix armhf compiling 2019-07-29 06:53:18 +03:00
Alibek Omarov
5cfe9ef181 ref_gl: update gles1 and gles2 wrappers 2019-07-29 05:35:34 +03:00
Alibek Omarov
d790292829 engine: replace CFG_END macro with function, add saving support for R_GetConfigName 2019-07-28 00:27:35 +03:00
Alibek Omarov
fce0ef6ad2 ref_gl: change gl_round_down flag, remove executing configs, implement GetConfigName call 2019-07-28 00:26:56 +03:00
Alibek Omarov
f9269dcc1c engine: ref: implement executing renderer config before creating context from engine and video config before loading refdll, update api, add r_refdll cvar to video.cfg 2019-07-28 00:23:22 +03:00
Alibek Omarov
4b163e6d30 engine: hide FCVAR_RENDERINFO from renderdll, remove OpenGLConfigHack from engine functions, add GetConfigName to renderdll functions 2019-07-28 00:13:40 +03:00
Alibek Omarov
147c702f2f defaults: specify two default renderers, one is accelerated, second is software 2019-07-28 00:10:55 +03:00
Alibek Omarov
b1f23f9ff6 engine: patch dedicated to build 2019-07-27 15:40:57 +03:00
Alibek Omarov
53eb569216 scripts: fix linux build again 2019-07-27 15:33:03 +03:00
Alibek Omarov
7c8105247c scripts: allow building dedicated, rename appimage to lower-case, fix warnings found by shellcheck 2019-07-27 14:49:01 +03:00
Alibek Omarov
35ae421ac1 wscript: add shortened option for win-style-install 2019-07-27 14:34:59 +03:00
Alibek Omarov
e3e161f281 scripts: explicitly name appimage 2019-07-27 13:49:37 +03:00
Alibek Omarov
8f9800eb3c ref: move R_DrawTree from refdll to engine, implement using ref's triapi 2019-07-27 13:27:40 +03:00
Alibek Omarov
a5593963c5 scripts: fix amd64 build 2019-07-26 17:25:46 +03:00
Alibek Omarov
e308281b0b engine: fix buffer overflow in COM_ParseFile 2019-07-26 17:24:09 +03:00
Alibek Omarov
0ce8d92f27 wscript: ease debugging with sanitizers under Clang 2019-07-26 17:10:47 +03:00
Alibek Omarov
938a9f372f engine: add stub function for new undocumented function in clientdll api 2019-07-26 14:51:21 +03:00
Alibek Omarov
a0514c242b travis: fix-up arch name from amd64 to x86_64 2019-07-25 20:11:25 +03:00
Alibek Omarov
b96eb14cf7 travis: restore accidentally removed zlib for i686 build 2019-07-25 20:10:05 +03:00
Alibek Omarov
1636d36dc2 travis: try to fix linux builds #2 2019-07-25 04:56:59 +03:00
Alibek Omarov
9bb2870e38 travis: try to fix travis 2019-07-21 12:40:47 +03:00
Alibek Omarov
d9545e5e78 cl_game: fix missing } 2019-07-20 05:09:24 +03:00
Alibek Omarov
827105405f travis: enable building and publishing for AMD64. Use at your own risk! 2019-07-20 05:07:22 +03:00
Alibek Omarov
2f8fec6b70 Remove trailing spaces, convert mistakenly put spaces to tabs. The most useful commit ever. 2019-07-19 20:23:08 +03:00
Alibek Omarov
20ecfcd8e0 mainui: update 2019-07-19 17:24:25 +03:00
Alibek Omarov
b539ed5a3d engine: remove write_to_clipboard, as there was no way to enable it for a long time and no one even asked for this 2019-07-19 17:24:25 +03:00
Alibek Omarov
4eab7d6503 engine: fix build 2019-07-19 17:17:12 +03:00
Alibek Omarov
8a4239d48d wscript: disallow -Wparentheses 2019-07-13 23:26:19 +03:00
Alibek Omarov
cedc1e0eb2 engine: soundlib: show mpg123 errors in console 2019-07-13 23:25:55 +03:00
Alibek Omarov
4beba75159 engine: fix various compiler warnings 2019-07-13 23:25:03 +03:00
Alibek Omarov
a0cbac4fc7 engine: server: use generic SV_RejectConnection instead of directly sending errormsg 2019-07-13 20:59:43 +03:00
Alibek Omarov
9662ab106f engine: client: implement errormsg, secure client by checking server IP address we're connected to 2019-07-13 20:54:16 +03:00
Alibek Omarov
4e4a9827b1 defaults: remove dead macro 2019-07-13 19:49:27 +03:00
Alibek Omarov
04ee7c3a55 engine: fix build 2019-07-12 22:43:58 +03:00
Alibek Omarov
a85a856215 engine: implement connection warning dialog showing up, update menu 2019-07-12 22:42:13 +03:00
Alibek Omarov
9e30fc253f engine: gameui: add new extended API and declare old engine menu extensions deprecated 2019-07-12 22:42:13 +03:00
Alibek Omarov
b2895770b8 platform: remove unneeded argument from SNDDMA_Init 2019-07-12 22:42:13 +03:00
Jonathan Poncelet
37255354d4 Various: Fixed obscure crashes on Mac
There were a couple of out-of-range/post-free accesses going on, which caused the Mac
build to crash when optimisations were turned on.
2019-07-12 18:18:42 +03:00
Alibek Omarov
661b53d0b3 mainui: update to fix build 2019-07-11 20:55:07 +03:00
Alibek Omarov
56e256fc86 mainui: update 2019-07-11 04:00:42 +03:00
Alibek Omarov
1f7dfecf89 platform: posix: library: properly use directpath argument 2019-07-11 04:00:25 +03:00
Alibek Omarov
6f121b90c1 public: wscript: skip installation 2019-07-11 03:59:56 +03:00
Alibek Omarov
2d48e73f9d ref_gl: fix compiler warning, most useful commit 2019-07-11 03:59:39 +03:00
Alibek Omarov
58a747e8ac wscript: proper activation of sanitizer on Clang 2019-07-11 03:59:20 +03:00
Alibek Omarov
3bf5f19446 keys: fix default binding of ESC button after unbindall command 2019-07-11 03:57:09 +03:00
Alibek Omarov
da4062ede9 engine: cmd: add apropos command from old engine 2019-07-09 16:36:34 +03:00
Alibek Omarov
e700a7498e engine: move matchpattern from old engine 2019-07-09 16:36:15 +03:00
Alibek Omarov
6f27d05361 travis: ignore continuous branches [ci skip] 2019-07-09 16:04:45 +03:00
Alibek Omarov
baefab7e3d travis: remove repository deployment 2019-07-09 15:43:30 +03:00
Alibek Omarov
7dda1c28f4 engine: console: add missing hpk commands autocomplete 2019-07-09 15:23:55 +03:00
Alibek Omarov
364c96f45c engine: console: sort output in commmand autocomplete for bind 2019-07-09 15:11:50 +03:00
Alibek Omarov
7aa163f713 engine: console: implement autocomplete for any arg count, add autocomplete for bind for both keys and commands 2019-07-09 15:08:00 +03:00
Alibek Omarov
62fb743a20 engine: sound: clear leftovers from previous commit 2019-07-09 13:24:24 +03:00
Alibek Omarov
40211efa9a engine: sound: remove s_cull and s_phs, because they never worked. It's better to write our own occluder in future or use any opensource library 2019-07-09 13:17:10 +03:00
Alibek Omarov
be98a228a7 wscript: enforce hidden visibility 2019-07-09 04:53:25 +03:00
Alibek Omarov
1f7171462b vgui_support: properly EXPORT main entry point 2019-07-09 04:53:05 +03:00
Alibek Omarov
511d728337 ref_gl: remove unused static function 2019-07-09 04:52:40 +03:00
Alibek Omarov
61b39f4257 mainui: update 2019-07-09 03:48:09 +03:00
Alibek Omarov
3e4bd20919 engine: client: implement sending input devices list to server, using protinfo 2019-07-09 03:48:09 +03:00
Alibek Omarov
7d10660b87 engine: keys: give gamepad keys names 2019-07-09 03:48:09 +03:00
Alibek Omarov
6aa4765c3e engine: input: implement input devices collecting 2019-07-09 03:48:09 +03:00
Alibek Omarov
fa68108907 engine: input: adapt gamepad code for new engine, remove gamepad ids, as it was never used and probably will never be, small optimizations 2019-07-09 03:48:09 +03:00
Alibek Omarov
771c09226e ref_gl: patched to compile 2019-07-09 03:48:09 +03:00
Alibek Omarov
8d0ea1d03e wscript: disallow int-conversion 2019-07-09 03:48:09 +03:00
Andrey Akhmichin
83953c7fb3 Port ip filter and partially useragent from old engine. 2019-07-09 03:48:09 +03:00
Alibek Omarov
8b94443ba2 scripts: travis: make PRs succeed, add a note about moving to GitHub Releases 2019-07-08 19:10:49 +03:00
Alibek Omarov
5e8d3acc51 engine: build: fix ARM64 macro 2019-07-08 19:10:49 +03:00
Alibek Omarov
d347096396 engine: sound: allow cubic sound interpolation 2019-07-07 02:48:19 +03:00
Alibek Omarov
54920f13df engine: rename library naming function, as it returns a full path and not just library name 2019-07-07 02:47:45 +03:00
Alibek Omarov
d01a33814c readme: wording 2019-07-07 02:46:16 +03:00
Alibek Omarov
efd2e434b4 engine: fix build on non-x86 archs 2019-07-07 00:20:38 +03:00
Alibek Omarov
2202e13a61 ref_gl: fix #52 2019-07-07 00:17:03 +03:00
Alibek Omarov
7702a7a8d0 wscript: force /MT for msvc explicitly 2019-07-07 00:15:52 +03:00
Alibek Omarov
8320f0598f Merge 4529 update 2019-07-02 23:44:42 +03:00
Alibek Omarov
165c1622f8 mainui: update 2019-07-01 05:51:19 +03:00
Alibek Omarov
b8c0d7f59e port: clean-up old port header 2019-07-01 05:50:54 +03:00
Alibek Omarov
6197ba8af6 engine: ref: remove redutant LoadLibrary call 2019-07-01 05:50:31 +03:00
Alibek Omarov
89a3fd6323 engine: make use of platform-unique library naming scheme 2019-07-01 05:50:04 +03:00
Alibek Omarov
ec18dd9535 engine: implement platform-unique library naming 2019-07-01 05:48:53 +03:00
Alibek Omarov
bb4c73b25c engine: build: lower case operating system names 2019-07-01 05:47:38 +03:00
Alibek Omarov
90e0c070ac engine: network: refactor net_ws.c since winsock2 is linked directly to engine DLL, correct some signness 2019-07-01 04:03:18 +03:00
Alibek Omarov
83b7f795c1 travis: missed an OSX upload script 2019-07-01 00:51:25 +03:00
Alibek Omarov
0366035237 travis: add github releases uploader (#47) 2019-07-01 00:40:52 +03:00
Alibek Omarov
a8f7b4fc5c win32: lib: remove unused variable, fix error message may be not printed 2019-06-30 17:26:57 +03:00
Alibek Omarov
f2d588574c sdl: vid: fix engine window being restored immediately after being maximized 2019-06-30 16:19:34 +03:00
Alibek Omarov
0579ecd30f engine: check if client.dll linked to SDL2.dll (#37) 2019-06-29 23:56:50 +03:00
Alibek Omarov
b5d9bf5dc8 engine: add a function to determine if library has direct dependency on chosen DLL(Win32 only) 2019-06-29 23:25:50 +03:00
Alibek Omarov
413882a8d5 sdl: fix typos 2019-06-29 23:25:00 +03:00
Alibek Omarov
c92f8f71a7 sdl: vid: allow to build with earlier versions of SDL2 2019-06-29 22:59:13 +03:00
Alibek Omarov
a378379ac5 engine: network: link to Winsock2 directly 2019-06-29 22:01:32 +03:00
Alibek Omarov
bcb4c9a722 Merge remote-tracking branch 'nekonomicon/png' 2019-06-29 20:41:53 +03:00
Alibek Omarov
eb22ff53c4 sdl: vid: fix washed out screen on Windows and probably other platforms(#50) 2019-06-29 20:40:23 +03:00
Alibek Omarov
b1406e8ecd waf: fix multiprocess compilation with msvc 2019-06-26 16:41:58 +03:00
Night Owl
4eee187f1b engine: common: imagelib: add simple decoder/encoder for 8-bit RGB/RGBA PNG images. 2019-06-22 16:06:44 +05:00
Alibek Omarov
76a8fe4873 engine: use build.h for printing architecture and operating system, also implement architecture names from library naming scheme proposal (#39) 2019-06-21 17:25:43 +03:00
Alibek Omarov
f010e2be12 public: build: add a header that defines some build-time information, like target OS or platform 2019-06-21 17:20:57 +03:00
Alibek Omarov
7484c51490 appimage: fix packaging 2019-06-17 18:29:31 +03:00
Alibek Omarov
96c4044a6c appimage: use APPDIR enviroment variable to determine application directory 2019-06-17 15:45:28 +03:00
Alibek Omarov
3d9a97348e readme: update 2019-06-17 09:09:15 +03:00
Alibek Omarov
81b6c1c333 Documentation: move pages from GitHub Wiki here, GitHub Wiki now will be disabled 2019-06-17 09:05:20 +03:00
Alibek Omarov
a62cb2a93f readme: add note for debian/ubuntu prerequisites, add vgui-dev as submodule, update mainui 2019-06-17 09:04:39 +03:00
Alibek Omarov
e9f26fe29d port: don't define XASH_64BIT, as it defined by waf 2019-06-17 08:37:51 +03:00
Alibek Omarov
3ae7ecaeb3 engine: patched to compile, moved gl_clear to engine 2019-06-17 08:37:34 +03:00
Alibek Omarov
75e690791d vgui_support: wscript: don't test if current platform supports VGUI if one of checks has failed already 2019-06-17 08:21:56 +03:00
Alibek Omarov
f2c927906f Merge 4511 update 2019-06-17 07:36:46 +03:00
Alibek Omarov
61751cc306 readme: fix url to development builds 2019-06-13 01:25:21 +03:00
Alibek Omarov
ba11b849ed wscript: disable thread-safe local static initialization for C++11 code, as it cause crashes on Windows XP 2019-06-13 00:49:27 +03:00
Alibek Omarov
014a09e222 appimage: fix AppRun shell-script POSIX compatibility 2019-06-12 22:14:12 +03:00
Alibek Omarov
b535c24edb editorconfig: initial add 2019-06-11 03:07:02 +03:00
Alibek Omarov
8d2bea03e0 filesystem: disable netpath code
This code was used in ancient approach, where executables and game files may have different path.
And this code was working only on Win32 with case-insensitive `getenv()`
2019-06-10 00:21:41 +03:00
mittorn
497ae6d269 Remove optimizations on mingw until game exports is marked 2019-06-08 20:36:29 +07:00
Alibek Omarov
e7eeba1de0 waf: update 2019-06-07 02:21:22 +03:00
Jonathan Poncelet
d14ce5ac39 SV_LoadProgs: Fixed potential memory leak if function failed (#46)
SV_LoadProgs: Fixed potential memory leak if function failed
2019-06-06 15:02:22 +03:00
Alibek Omarov
76dae35955 ref: remove COM_HashKey API call 2019-06-06 04:34:28 +03:00
Alibek Omarov
70d45f23de public: crclib now is part of public library 2019-06-06 04:33:57 +03:00
Alibek Omarov
9735dedf2f contrib: generate me an IDE project instead of updating it manually everytime 2019-06-06 04:02:06 +03:00
Alibek Omarov
a8cc5b7cef waf: update to 2.0.17, rename module dir to waifulib, remove some modules, as they moved to waf binary itself(see waifu project) 2019-06-06 03:26:45 +03:00
Alibek Omarov
003bbea358 engine: common: remove unneeded REF_DLL ifdef, keep #error anyway 2019-06-06 01:28:59 +03:00
Alibek Omarov
5be28ce93d readme: multirenderer is supported, so move it from planned 2019-06-03 16:53:23 +03:00
Alibek Omarov
647b2658d1 mainui: update 2019-06-02 12:28:10 +03:00
Alibek Omarov
85240f0145 filesystem: zip: use miniz header only library instead of zlib, add miniz generated header(stripped ZIP reading/writing code) 2019-06-02 12:27:58 +03:00
Alibek Omarov
9119635ed3 engine: wscript: fix broken wscript after revert, oops 2019-06-02 12:26:58 +03:00
Alibek Omarov
ab16867f6b Revert "wscript: add zlib library"
This reverts commit 9b68b0c1e2.
2019-06-02 11:22:18 +03:00
Mr0maks
73cf465ce4 Merge https://github.com/FWGS/xash3d-fwgs 2019-06-01 21:06:34 +05:00
Andrey Akhmichin
37181e410f waflib: fix wrong identation. 2019-06-01 18:59:24 +03:00
Alibek Omarov
1ffc593993 wscript: check for 64-bit only for Win/Linux/Mac and only on amd64
It's useless to force 32-bit code for everything, as GoldSrc exists only for Intel CPUs and Windows, Linux or OSX
2019-05-31 02:59:45 +03:00
Mr0maks
8ef383a4d3 wscript: fix spaces 2019-05-30 22:18:53 +05:00
Mr0maks
3023c8a72b Merge branch 'master' into master 2019-05-30 21:25:56 +05:00
Mr0maks
9b68b0c1e2 wscript: add zlib library 2019-05-30 09:38:53 +05:00
Mr0maks
01a33dcf7e filesystem: zip: remove 'big' block 2019-05-30 00:51:52 +05:00
Alibek Omarov
4000654deb engine: port: disable ARCH_SUFFIX set to "64" for 64-bit platforms, it would replaced with new library naming scheme in near future 2019-05-29 19:53:48 +03:00
Alibek Omarov
90ff7f24b3 sdl: vid: fix building with older SDL2 2019-05-29 18:41:43 +03:00
Mr0maks
b42f020ad5 filesystem: zip: warning else zip file is empty 2019-05-29 20:04:14 +05:00
Mr0maks
6422005716 filesystem: zip: remove commented code 2019-05-29 13:05:19 +05:00
Mr0maks
efc9048b43 filesystem: zip: zlib error code 2019-05-29 13:01:33 +05:00
Mr0maks
12bc507156 filesystem: zip: working unpack code 2019-05-28 18:51:44 +05:00
Mr0maks
f9a7ffa5e8 filesystem: zip: remove malloc 2019-05-28 15:04:08 +05:00
Alibek Omarov
b9a2f58e23 mainui: update 2019-05-28 04:15:44 +03:00
Alibek Omarov
b146f495fc Add gl-wes-v2 and nanogl submodules 2019-05-28 04:15:23 +03:00
Alibek Omarov
4a1f441151 waflib: xcompile: Android NDK r19c support 2019-05-28 04:13:19 +03:00
Alibek Omarov
94ec8cb997 wscript: add -fPIC for static libraries globally 2019-05-28 04:12:02 +03:00
Alibek Omarov
621e33fde2 engine: wscript: define XASH_64BIT on non-32 bits targets 2019-05-28 04:10:22 +03:00
Alibek Omarov
db72378806 engine: android: fix building custom dlsym with NDK r19c, clean-up 2019-05-28 04:09:47 +03:00
Alibek Omarov
d596f4ea52 engine: android: vid: fix building with NDK r19c 2019-05-28 03:55:54 +03:00
Alibek Omarov
6f2016db06 engine: imagelib: bmp: fix unaligned access 2019-05-28 03:55:22 +03:00
Alibek Omarov
27e742df12 engine: crclib: fix unaligned access 2019-05-28 03:55:04 +03:00
Alibek Omarov
86d823b877 engine: client: fix demo playback on ARM 2019-05-28 03:45:02 +03:00
Alibek Omarov
82697ca2a9 waflib: force_32bit: fix wrong DEST_SIZEOF_VOID_P when 64-bit build is allowed 2019-05-28 03:44:46 +03:00
Alibek Omarov
4606a18b25 wscript: add useful flags for clang also 2019-05-28 00:30:52 +03:00
Alibek Omarov
9145589414 waflib: xcompile: fix hardfp linking 2019-05-28 00:29:26 +03:00
Alibek Omarov
1d78d7c720 filesystem: fix even more char signness 2019-05-27 23:27:20 +03:00
Mr0maks
1cc2ec9095 filesystem: zip: codestyle 2 2019-05-27 23:02:38 +05:00
Mr0maks
5cf4e34607 filesystem: zip: codestyle 2019-05-27 20:44:14 +05:00
Mr0maks
b32de42ab7 filesystem: zip: fix memory leak (not freed info) 2019-05-26 23:04:17 +05:00
Mr0maks
b04a48f126 filesystem: zip: remove XASH_ZLIB macro 2019-05-26 20:12:41 +05:00
Mr0maks
3c0a34926a filesystem: zip: pk3 support 2019-05-26 00:38:21 +05:00
Mr0maks
039b42868d filesystem: zip: add FS_AddFileToZip 2019-05-25 23:24:34 +05:00
Mr0maks
671c247381 Merge branch 'master' of https://github.com/FWGS/xash3d-fwgs 2019-05-25 22:54:42 +05:00
Alibek Omarov
9048c108c4 engine: fix char default signness 2019-05-25 03:12:17 +03:00
Alibek Omarov
b797e0af1a Merge 4483 update 2019-05-25 02:44:24 +03:00
Mr0maks
85b5b4e965 filesystem: add support for zip files 2019-05-24 21:13:03 +05:00
Alibek Omarov
74062fab12 waf.bat: fix strange ERRORLEVEL bug 2019-05-23 22:28:35 +03:00
Alibek Omarov
67ce4cfbef travis: windows: die if waf has failed 2019-05-23 22:13:00 +03:00
Alibek Omarov
fe464af3ff ref_gl: fix msvc build 2019-05-23 22:10:35 +03:00
Alibek Omarov
45b091028b travis: comment mingw build until it's not stable 2019-05-23 22:01:06 +03:00
Alibek Omarov
00619d5795 travis: remove allow_failures, looks like it was copypasted from somewhere by mistake 2019-05-23 21:56:47 +03:00
Alibek Omarov
2e953bd1a9 ref_api: remove GL_OnContextCreated, remove return value of GL_RenderFrame 2019-05-12 18:02:59 +03:00
Alibek Omarov
57f9e7dda6 sdl: vid: fix forgotten return, slightly refactor SW_UnlockBuffer 2019-05-12 17:49:20 +03:00
Alibek Omarov
d14ce61520 engine: no return type for RenderFrame 2019-05-12 03:09:40 +03:00
Alibek Omarov
5af6506d86 engine: ensure that we loading same client library 2019-05-12 03:08:51 +03:00
Alibek Omarov
e9e4a1296d engine: android: fix possible crash in custom dlsym 2019-05-12 03:07:28 +03:00
Alibek Omarov
85c2126775 engine: android: implement egl context management 2019-05-12 03:06:55 +03:00
Alibek Omarov
a1391f3d0b engine: ref_api: comment unused opengl attributes 2019-05-12 03:06:01 +03:00
Alibek Omarov
bb8ba4225c ref_gl: show r_info after loading extensions, add GL_GetProcAddress call 2019-05-12 03:04:26 +03:00
Alibek Omarov
7d3e8c0a57 wscript: error on return-type, some android related changes 2019-05-12 03:03:34 +03:00
Alibek Omarov
55c3040db1 ref_gl: fix unaligned access in sprites 2019-05-12 03:02:01 +03:00
Alibek Omarov
90e4fbed31 port.h: temporarily disable hardfp postfix 2019-05-12 03:00:50 +03:00
Alibek Omarov
4819790272 engine: console: fix invalid REF_GET_PARM call 2019-05-11 18:52:32 +03:00
Alibek Omarov
f904ba53e2 wscript: fix typo 2019-05-06 19:25:10 +03:00
Alibek Omarov
e06b7412ac engine: wscript: don't build external launcher for Android and disable main() 2019-05-06 04:40:46 +03:00
Alibek Omarov
dec1b8dfb4 waflib: xcompile: even if hardfloat ABI is selected, force architecture name as armeabi-v7a, as armeabi-v7a-hard is completely virtual. Move options defines to main wscript 2019-05-06 04:11:12 +03:00
Alibek Omarov
c9b5332d16 waflib: subproject: preserve IGNORED_SUBDIRS between contexts, fix broken logic 2019-05-05 00:22:03 +03:00
Alibek Omarov
fe14a360b4 engine: fix fs_offset_t/size_t conversion, const qualifiers 2019-05-02 19:12:23 +03:00
Alibek Omarov
ab7a67464b engine: fix long<->int conversion UBs 2019-05-02 19:05:09 +03:00
Alibek Omarov
29a48cb34c sdl: vid: fix disabling vsync when loading a level 2019-05-02 18:07:27 +03:00
Alibek Omarov
3fef353291 android: initial port 2019-05-02 18:07:03 +03:00
Alibek Omarov
1a700fd06b platform: move MSGBOX implementation to platform backends 2019-05-01 19:44:48 +03:00
Alibek Omarov
e3e2f3afe5 platform: move Sys_ShellExecute implementation to platform backends 2019-05-01 19:21:47 +03:00
Alibek Omarov
87f380b90c waflib: xcompile: define both __ANDROID__ and ANDROID for compatibility 2019-05-01 19:03:23 +03:00
Alibek Omarov
3ebb4d0ea3 waflib: xcompile: check arch, configure 'M' uselib to m_hard on hardfp, remove linker select 2019-05-01 01:58:27 +03:00
Alibek Omarov
d4b4a4a864 waflib: xcompile: add support for ANDROID_NDK environment variable, as well as ANDROID_NDK_HOME. Fix help message. 2019-04-27 13:01:05 +03:00
mittorn
bd6532fae4 wscript: Add shared lib flags to public 2019-04-17 06:42:34 +07:00
mittorn
25235b5296 ref_gl: remove Mod_SetCurrentLoadingModel call 2019-04-17 06:42:34 +07:00
Alibek Omarov
2c17af4850 engine: ref: fix possible null dereference, if client doesn't export studio renderer 2019-04-16 23:39:37 +03:00
Alibek Omarov
7d8b63fd88 ref: get rid of R_IncrementSpeedsCounter 2019-04-15 02:17:43 +03:00
Alibek Omarov
5be982cc72 ref: remove shared textures enum, instead use hardcoded texture names 2019-04-15 01:43:43 +03:00
Alibek Omarov
2d968cf328 ref: remove unused GL_BuildLightmaps export 2019-04-15 01:20:15 +03:00
Alibek Omarov
4d9563ea03 ref: make api thinner by removing IsNormalPass and moving CL_FxBlend to refdll 2019-04-15 01:19:05 +03:00
Alibek Omarov
d62a12dd9a ref: allow to use shortened name when specifying -ref in command line 2019-04-14 22:04:32 +03:00
Alibek Omarov
99478ba9bd sdl: vid: fix unitialized variables, better warning report 2019-04-13 21:49:01 +03:00
Alibek Omarov
211d3c5213 sdl: vid: refactor context creation, fix crash on exit on REF_SOFTWARE 2019-04-13 20:34:32 +03:00
Alibek Omarov
20c7c36996 ref_gl: remove dead WGL extensions 2019-04-13 19:39:49 +03:00
Alibek Omarov
228dab5965 ref_gl: move GLES and GL_STATIC defintions to gl_export.h. Add REF_GL_KEEP_MANGLED_FUNCTIONS, to keep use pgl instead of re-defining everything to gl. Used in conjuction with GL_STATIC 2019-04-13 19:39:22 +03:00
Alibek Omarov
4b955a320b ref_gl: allow gldebug for GL_STATIC. Rewrite extension querying for GLES. Allow gldebug for GLES(using GL_KHR_debug). ref_gles1 through nanogl now works 2019-04-13 19:38:41 +03:00
mittorn
d5911b33b1 msvc8 support 2019-04-12 14:33:57 +07:00
mittorn
f1638b09c5 waf: implement 'reconfigure' module 2019-04-12 02:45:23 +07:00
mittorn
741fcfb202 Add new build types, fix gcc colors 2019-04-12 00:19:40 +07:00
mittorn
54d54b1457 waf: fix python3 2019-04-12 00:19:12 +07:00
mittorn
d5b6ccb3e2 ref: REF_SOFTWARE support with SDL_Surface/SDL_Renderer 2019-04-11 22:19:08 +07:00
Alibek Omarov
6448964c37 vgui_support: remove miniutl submodule 2019-04-11 01:51:54 +03:00
Alibek Omarov
46378e3738 ref_gl: fix build 2019-04-11 01:41:52 +03:00
Alibek Omarov
b2038e76d3 waflib: subproject: carefully restore previous enviroment in configuration context 2019-04-11 01:38:00 +03:00
Alibek Omarov
eb650b71ad waflib: subproject: restore environment in build context 2019-04-11 01:32:19 +03:00
Alibek Omarov
968994bba5 ref_gl: add an option to disable ref_gl building 2019-04-11 01:26:33 +03:00
Alibek Omarov
3c1c13850e vgui_support: remove utl dependency, by porting new vgui support code from original engine, remove dead function definitions, remove dead vgui_main.h header from engine 2019-04-11 01:12:52 +03:00
Alibek Omarov
459f4a9788 scripts: waflib: introduce new waf plugin -- subproject, which makes easier use of standalone envs for each subdirectory 2019-04-11 00:15:48 +03:00
Alibek Omarov
d17fdea884 waflib: remove get_subproject_name function 2019-04-11 00:13:59 +03:00
mittorn
b20efff57c msdev: add line breaks to lines 2019-04-10 01:55:43 +03:00
mittorn
36159e6622 msdev: convert solution to list 2019-04-10 01:55:43 +03:00
mittorn
c953ba0852 msdev: add line breaks to solution 2019-04-10 01:55:43 +03:00
mittorn
b38ef43260 msdev: include solution file 2019-04-10 01:55:43 +03:00
mittorn
fea2395a80 msdev: fix 2019-04-10 01:55:43 +03:00
mittorn
ffaab11da9 msdev: add relative library paths 2019-04-10 01:55:43 +03:00
mittorn
f6b3603934 msdev: fix 2019-04-10 01:55:43 +03:00
mittorn
9421963b29 msdev: print abspath 2019-04-10 01:55:43 +03:00
mittorn
239c13da28 msdev: remove printing bld.root 2019-04-10 01:55:43 +03:00
mittorn
eb6f67ed07 msdev: print include paths 2019-04-10 01:55:43 +03:00
mittorn
c206e72f7b msdev: fix 2019-04-10 01:55:43 +03:00
mittorn
79e6ebbe23 msdev: fix 2019-04-10 01:55:43 +03:00
mittorn
d4638a9cf4 msdev: find relative include path 2019-04-10 01:55:43 +03:00
mittorn
7ccc9b0795 Revert "waf: try relative SDL2 path"
This reverts commit 50f0ae5234.
2019-04-10 01:55:43 +03:00
mittorn
6c1d911193 waf: try relative SDL2 path 2019-04-10 01:55:43 +03:00
Alibek Omarov
9587aacee3 mainui: update 2019-04-10 01:55:24 +03:00
Alibek Omarov
777562aea8 Revert "Revert "scripts: try to avoid race condition when MSVC writes to same pdb file in multiple threads""
This reverts commit a40d64d3a6.
2019-04-08 21:46:59 +03:00
Alibek Omarov
a40d64d3a6 Revert "scripts: try to avoid race condition when MSVC writes to same pdb file in multiple threads"
This reverts commit d87dd2a60a.
2019-04-08 21:36:48 +03:00
Alibek Omarov
7704d9b2ef wscript: add /FS to avoid race condition on PDB file(second try) 2019-04-08 21:34:41 +03:00
Alibek Omarov
d87dd2a60a scripts: try to avoid race condition when MSVC writes to same pdb file in multiple threads 2019-04-08 21:31:57 +03:00
mittorn
6403a265de Try fix python encoding again 2019-04-08 21:16:29 +03:00
mittorn
3fa4a36983 wscript: specifiy psapi version on win32 2019-04-08 21:15:05 +03:00
Alibek Omarov
8b16c30fb8 wscript: always optimize on MSVC(temporary) and always generate PDB using /Zi 2019-04-08 21:10:36 +03:00
Alibek Omarov
20a177c783 wscript: enable msvs.py, as it's handy for those who can actually install Python 2019-04-08 21:09:23 +03:00
Alibek Omarov
0840d9ec25 scripts: fix deploying vc2008 solution and empty vc2008 folder 2019-04-08 21:09:23 +03:00
Alibek Omarov
4124e01d65 scripts: enable deploying vc2008 project 2019-04-08 21:09:21 +03:00
Alibek Omarov
129325f3a4 scripts: waflib: add msdev.py tool by Michel Mooij, patched to support uselib, separate envs and so 2019-04-08 21:08:52 +03:00
Alibek Omarov
9cd22a98bd wscript: fix mistyped msvc flag 2019-04-08 21:08:50 +03:00
Alibek Omarov
6a6d21ed32 vgui_support: wscript: don't continue configuration if vgui_supoport can't be built 2019-04-08 21:08:17 +03:00
Alibek Omarov
041315da44 scripts: use waf install to generate packages 2019-04-08 21:08:15 +03:00
Alibek Omarov
aa30661c26 vgui_support: wscript: disable build on mingw 2019-04-08 21:07:02 +03:00
Alibek Omarov
031bac8d13 wscript: move msvc.py initialization BEFORE compiler_c, so we can set compiler with --msvc_version command line switch 2019-04-08 21:07:02 +03:00
Alibek Omarov
0cf1e3b1da ref: add REF_D3D placeholder for compatibiltiy(not planned anyway) 2019-04-04 23:13:55 +03:00
Alibek Omarov
441795943b ref_gl: move gl specific defines out from defaults.h, remove VIDEO_DONTCARE hack, automatically set XASH_GLES if wrapper is set 2019-04-04 23:13:17 +03:00
Alibek Omarov
a9cf3357c7 ref: move GLES driver hint to SetAttribute as we don't choose GLES renderer in compile-time anymore 2019-04-04 22:43:33 +03:00
Alibek Omarov
84761e62ff Merge pull request #34 from x6herbius/netcode-reduce-failures
Prevented net send errors from triggering an entire host error
2019-04-01 23:04:00 +03:00
Jonathan Poncelet
60a1c4f0cc Prevented net send errors from triggering an entire host error 2019-04-01 20:17:13 +01:00
Alibek Omarov
77b23eec9f ref_gl: add options for linking-in nanogl and glwes(thus getting GLES1 and GLES2 renderers) and static gl 2019-03-30 03:10:43 +03:00
Alibek Omarov
f4bcea6182 ref_gl: don't use dxt on gles 2019-03-30 03:09:07 +03:00
Alibek Omarov
ea6a86a83d ref_gl: bring back GL_STATIC option 2019-03-30 03:08:44 +03:00
Alibek Omarov
47879942bb ref_gl: remove dead extensions from GLES code 2019-03-30 03:07:52 +03:00
Alibek Omarov
6c006e087d common: don't use SDL headers and types in refdll, if for some reason dll wants it 2019-03-30 03:06:23 +03:00
Alibek Omarov
8385563bef engine: fix possible crash during exit 2019-03-30 01:29:40 +03:00
Alibek Omarov
f9f96552b7 travis: move mingw engine build to standalone VM 2019-03-30 01:29:40 +03:00
mittorn
ca3913cd88 fix windows build 2019-03-30 00:43:49 +03:00
Alibek Omarov
8b07916598 scripts: travis: fix deployment, finally 2019-03-29 23:57:44 +03:00
Alibek Omarov
5f122a7435 travis: experiment to move apt addons under stage 2019-03-29 23:49:33 +03:00
Alibek Omarov
50c656df94 scripts: travis: fix upload to yadisk 2019-03-29 23:48:34 +03:00
Alibek Omarov
5436658ce7 scripts: travis: accept everything when installing python from choco 2019-03-29 23:40:25 +03:00
Alibek Omarov
d7ea40d850 scripts: remove waf jobs, as waf smart enough to get CPU number, fix upload archive name for osx, install newer python in windows 2019-03-29 23:32:06 +03:00
Alibek Omarov
184ca6517c travis: oops, forgot to set OSes 2019-03-29 23:22:47 +03:00
Alibek Omarov
f4c36f49db travis: another try to fix matrices 2019-03-29 23:21:40 +03:00
Alibek Omarov
ae26783902 scripts: travis: yet another workaround for mingw... 2019-03-29 23:11:39 +03:00
Alibek Omarov
45fdd74dd2 travis: fix matrices 2019-03-29 23:11:20 +03:00
Alibek Omarov
880a9651d8 scripts: travis: use stages, use yandex disk as temporary place for build artifacts 2019-03-29 22:51:31 +03:00
Alibek Omarov
db30358d06 travis: fix osx archive name, remove unneeded envvars on osx, try to fix windows python 2019-03-29 06:08:41 +03:00
Alibek Omarov
ebbe22b09a travis: force newer python for windows 2019-03-29 05:52:55 +03:00
Alibek Omarov
752dd13c04 scripts: travis: uncomment osx packaging 2019-03-29 05:44:36 +03:00
Alibek Omarov
469a080000 travis: add windows, test commit up 2019-03-29 05:42:20 +03:00
Alibek Omarov
efc12f1045 scripts: travis: test windows scripts 2019-03-29 05:39:41 +03:00
Alibek Omarov
becb58223a scripts: travis: rewrite deploy script with commit up support 2019-03-29 05:26:01 +03:00
Alibek Omarov
f48335f2f2 ref: get rid of fov in globals, add RenderFrame wrapper, which correctly initialize shared global values 2019-03-28 18:17:58 +03:00
Alibek Omarov
8b5926f9b1 ref_gl: fix alpha in menu (and anywhere else where triColor4ub is used) 2019-03-28 18:17:58 +03:00
Alibek Omarov
0b13bf393f vgui_support: wscript: set default vgui-dev repo path, check OS in configuration stage 2019-03-26 16:28:40 +03:00
Alibek Omarov
58b5e1a9df wscript: introduce shortened frequently used configuration options 2019-03-26 16:26:02 +03:00
Alibek Omarov
17f719558c wscript: move build env setup to main wscript 2019-03-25 01:25:44 +03:00
Alibek Omarov
70abee3e28 Merge pull request #32 from iZarif/cf749c8c
vgui_support/wscript fix indentation
2019-03-24 19:14:21 +03:00
iZarif
37defbbd14 vgui_support/wscript fix indentation 2019-03-24 20:00:49 +04:00
Alibek Omarov
62f04137a5 engine: hide ref calls under Host_IsDedicated checks, replace ref function ptr checks by \!Host_IsDedicated 2019-03-22 18:41:57 +03:00
Alibek Omarov
5f849c4823 engine: bring back XASH_USE_SELECT. I need somehow disable this only on my work PC 2019-03-22 18:29:42 +03:00
Alibek Omarov
b09242e41c engine: fix dedicated check 2019-03-22 18:26:44 +03:00
Alibek Omarov
1538bc609d vgui_support: wscript: automatically disable vgui_support build on unsupported CPU type 2019-03-22 18:22:49 +03:00
Alibek Omarov
26616314f8 engine: add initial support for MCST Elbrus 2019-03-22 18:21:47 +03:00
Alibek Omarov
1483b21f00 Merge branch '0.20-renderdll' 2019-03-22 18:19:13 +03:00
Alibek Omarov
743c5ca8d5 engine: make dedicated work again 2019-03-22 16:47:52 +03:00
Alibek Omarov
92b89936b3 ref: make API thinner by moving simple calls into EngineGetParm(RenderGetParm with ref extensions), fix some UBs 2019-03-22 16:36:46 +03:00
Alibek Omarov
8abbef8dbd scripts: try to workaround mingw bug by adding sse2 2019-03-21 17:47:16 +03:00
Alibek Omarov
59f3b63e0a ref_gl: wscript: fix libm linking 2019-03-21 17:31:18 +03:00
Alibek Omarov
6a6f341c07 Merge pull request #22 from FWGS/netsplit
Extended netsplit, network extensions
2019-03-21 17:23:49 +03:00
Alibek Omarov
402a596415 ref: add EXPORT to GetRefAPI, so MSVC will create *.lib file and not confuse waf or dynamic linker 2019-03-20 02:42:44 +03:00
Alibek Omarov
52eb84d34b mainui: update 2019-03-20 02:41:44 +03:00
Alibek Omarov
f3a2f46fb3 wscript: remove libm linking to static public, it's useless. Correct include path order 2019-03-20 02:40:47 +03:00
Alibek Omarov
4880ca3ca2 engine: move EXPORT definition to xash3d_types 2019-03-20 02:38:37 +03:00
Alibek Omarov
121c72c9e0 Merge origin/master into ref_dll 2019-03-20 02:38:13 +03:00
Alibek Omarov
e20e114643 miniutl: update 2019-03-20 01:21:10 +03:00
Alibek Omarov
7e08104631 ref_gl: fixes for MSVC 2019-03-20 01:20:58 +03:00
Alibek Omarov
7aa7f4dbbd engine: fix broken win32 types after moving more definitions to xash3d_types.h 2019-03-20 01:18:26 +03:00
Alibek Omarov
fb6fd61cd9 public: initial moving some common code into static public library, that can be linked to any engine part 2019-03-20 01:17:46 +03:00
mittorn
34da3e0ccd ref: clear draw entities when clearing edicts 2019-03-18 00:56:38 +07:00
mittorn
0a22040c6e Fix SpriteTexture 2019-03-17 23:41:11 +07:00
mittorn
c55b7dcda7 ref: simplify efx api, move efrags to engine 2019-03-17 23:14:53 +07:00
mittorn
78f8932313 Fill client RenderAPI 2019-03-17 21:58:26 +07:00
mittorn
f00181223f Remove duplicate R_ClearScene 2019-03-17 21:56:29 +07:00
mittorn
bf2f829382 Disable Mod_ClearUserData in SV_UnloadProgs (it is still called on restart) 2019-03-17 21:26:38 +07:00
mittorn
297ca08e81 ref: replace model (un)loading by Mod_ProcessRenderData 2019-03-17 21:19:24 +07:00
mittorn
8339096ad8 ref: Improve model unloading, fix texture leak 2019-03-17 18:26:57 +07:00
mittorn
3d39d78e53 ref: fix hud sprites 2019-03-16 19:21:32 +07:00
mittorn
00ce909fc8 Setup renderer time 2019-03-16 18:51:30 +07:00
mittorn
aabf5f5621 ref: remove convar_t from renderer, disable engine-related definitions in mod_local 2019-03-16 18:15:05 +07:00
mittorn
9c6352ec57 ref: move tracer color cvars to ref 2019-03-16 17:49:07 +07:00
mittorn
7382fc7c49 mobility: add stub for touch (hlsdk-xash3d compatibility 2019-03-16 17:48:12 +07:00
mittorn
5fa9632ec0 fix studiomodel textures 2019-03-16 17:24:32 +07:00
mittorn
db78726656 ref: implement ASSERT macro 2019-03-16 17:23:41 +07:00
mittorn
57320c0c25 ref: get rid of vidState, add GL_SwapBuffers to engine exports 2019-03-16 11:58:44 +07:00
mittorn
31ab710485 Fix sprite loading 2019-03-16 11:27:15 +07:00
mittorn
4247af8fa8 Reduce engine dependencies. crtlib/mathlib/matrixlib now can be built standalone 2019-03-16 11:18:43 +07:00
Alibek Omarov
e5000742f1 ref: context creating prototype, not working yet 2019-03-16 05:15:32 +03:00
Alibek Omarov
971f9b6de5 ref: fix compiling errors 2019-03-16 04:24:27 +03:00
Alibek Omarov
199ebfed48 ref: implement engine ref API 2019-03-16 04:17:56 +03:00
Alibek Omarov
97aba69ed0 ref: implement API interface for ref_gl, get rid of RenderAPI, RenderInterface and vgui_support API references 2019-03-15 21:23:59 +03:00
Alibek Omarov
234507b7f1 ref: fix all undefined references 2019-03-11 17:37:58 +03:00
Alibek Omarov
d0d5fd1a3f ref: fix some undefined references, compile-in mathlib and crtlib to refdll 2019-03-06 17:14:25 +03:00
Alibek Omarov
e7234bada2 ref: now it compiles, not linking yet. ref_api header moved to engine/ to clarify, that it's sort of engine internals 2019-03-06 16:23:33 +03:00
Alibek Omarov
94cbb4e1e0 wscript: fix wrong dedicated skip subproject check 2019-03-03 03:38:02 +03:00
mittorn
437ba6d7a2 ref:Fix some clgame, world and renderapi usages, import renderapi funcs from engine 2019-02-27 06:23:03 +07:00
Alibek Omarov
574f03c139 ref: initial engine to ref API draft, not compiling, work in progress [ci skip] 2019-02-24 18:45:44 +03:00
Alibek Omarov
c3abec5127 readme: add missed newlines 2019-02-24 01:11:23 +03:00
Alibek Omarov
a69bda0b9b readme: add note about commit tags 2019-02-24 01:09:35 +03:00
mittorn
576b78799e readme: fix links 2019-02-24 05:47:57 +07:00
Gianluca Boiano
faee030740 Updated instructions for Arch Linux 2019-02-24 00:19:52 +03:00
mittorn
8b5c5826a8 legacymode: prevent dropping from server when fps too high 2019-02-24 02:48:53 +07:00
Alibek Omarov
e193ac2c04 ref: more @mittorn's changes on RefAPI 2019-02-23 21:49:46 +03:00
Alibek Omarov
ee4744e7cd Merge pull request #25 from M0Rf30/master
fixed taberror: inconsistent use of tabs and spaces in indentation
2019-02-23 19:22:08 +03:00
Gianluca Boiano
142a38f3dc fixed taberror: inconsistent use of tabs and spaces in indentation 2019-02-23 15:51:03 +01:00
Alibek Omarov
e50b91b559 Update note on 64-bit engine [ci skip] 2019-02-23 13:46:16 +03:00
Alibek Omarov
2bf2b95b3a Correct & simplify CONTRIBUTING.md 2019-02-23 13:46:16 +03:00
Alibek Omarov
94cfe1217a Create CONTRIBUTING.md 2019-02-23 13:46:16 +03:00
Alibek Omarov
dbb4b2c1f9 Fix some mistypes [ci skip] 2019-02-23 13:46:16 +03:00
Alibek Omarov
6ede01ea05 Fix italic to bold [ci skip] 2019-02-23 13:46:16 +03:00
Alibek Omarov
2ecfa20f94 Fix formatting [ci skip] 2019-02-23 13:46:16 +03:00
Alibek Omarov
48808e4ede Update readme [ci skip] 2019-02-23 13:46:16 +03:00
Alibek Omarov
955dde6d5f Create README.md 2019-02-23 13:46:16 +03:00
mittorn
7299ee9f11 Try fix mingw linking 2019-02-23 18:32:49 +07:00
Alibek Omarov
5e17b4bf17 wscript: remove useless option type specifier 2019-02-19 17:55:45 +03:00
Alibek Omarov
2c17dce25b wscript: check for dedicated or singlebinary before recurse into subdirectory, add a chance to skip some subprojects on configuration stage 2019-02-19 17:49:09 +03:00
Alibek Omarov
1b372115a5 wscript: move options to subgroups, reorder option plugins loading 2019-02-19 16:33:14 +03:00
Alibek Omarov
99bd7c81da ref: render code moved out of engine, doesn't compile, first API prototype 2019-02-18 21:25:26 +03:00
mittorn
2b1ed2b20a Merge branch 'master' into netsplit 2019-02-08 07:59:52 +00:00
mittorn
f7c60ea9d1 vbo: Fix return value 2019-02-07 04:58:18 +07:00
mittorn
119b458b0f vbo: optimize buffer usage, fix some rendermodes 2019-02-07 04:35:42 +07:00
mittorn
d913ef0fc4 Port r_studio_drawelements render 2019-02-07 02:36:34 +07:00
mittorn
bccc0e63d5 Port VBO world renderer 2019-02-07 00:40:38 +07:00
mittorn
23d0f33ad1 Refactor extension detection, add VBO detection 2019-02-07 00:36:15 +07:00
mittorn
ddd17fe238 client: clear usermessages 2019-02-05 01:28:39 +07:00
mittorn
b1e3fa5f4d http: fix uninitialized progress value 2019-02-05 01:11:12 +07:00
mittorn
e99ca5947b legacymode: resource list support 2019-02-05 01:10:26 +07:00
mittorn
932cf03a29 mainui: update 2019-02-04 23:54:12 +07:00
mittorn
c09190f66e legacymode: add legacy infokey for legacy servers 2019-02-04 23:53:46 +07:00
mittorn
1d9b5d4611 http: remove unneeded platform-depended macros 2019-02-03 16:37:58 +07:00
mittorn
e05c1ed912 HTTP download support 2019-02-02 05:15:59 +07:00
mittorn
7b36796f41 Merge pull request #20 from x6herbius/improve-logging
Made various log messages more informative
2019-02-01 05:59:35 +00:00
Jonathan Poncelet
69bb25bb18 Updated a couple of messages as per pull request 2019-01-31 13:31:27 +00:00
Alibek Omarov
398d6007be Merge branch 'master' into resource 2019-01-30 22:14:13 +03:00
Alibek Omarov
4d63eb4413 sv_game: fix pfnSetModel theoretically may ignore precached models 2019-01-30 21:55:53 +03:00
Alibek Omarov
8770bdc694 keys: allow autorepeat for menu and console for any keys 2019-01-30 21:47:05 +03:00
Alibek Omarov
74f935d94f common: fix COM_IsSafeFileToDownload extension check 2019-01-30 21:39:50 +03:00
Alibek Omarov
cd30812607 sv_frame: fakeclients must be kicked on changelevel(GoldSrc compatibity) (port from Old Engine #b5b493) 2019-01-30 20:09:43 +03:00
mittorn
8b30a7631d Merge branch 'master' into resource 2019-01-30 13:38:36 +00:00
mittorn
a169f93b9f legacymode: fix netsplit settings 2019-01-30 18:56:52 +07:00
mittorn
f786ea65f5 Fix default splitsize 2019-01-30 18:41:45 +07:00
mittorn
b578d44ea2 Fix NET_EXT_SPLITSIZE console reporting 2019-01-30 16:15:57 +07:00
mittorn
40574d9be0 Network extensions 2019-01-30 16:06:32 +07:00
mittorn
7bb8124b69 legacymode: Mark old netsplit extension legacy, fix magic number 2019-01-30 15:14:43 +07:00
mittorn
2b1d4f4377 Fix zero maxsize for reliable 2019-01-30 14:48:43 +07:00
mittorn
31a53f4842 Fix cl_dlmax bounds 2019-01-30 14:11:49 +07:00
mittorn
f3468c0321 Fix Netchan_Setup arguments 2019-01-30 14:04:29 +07:00
mittorn
23af5dcaf1 In-game fragment size setting 2019-01-30 13:56:08 +07:00
mittorn
097974bde2 Check cl_dlmax sizes on client 2019-01-30 13:38:32 +07:00
mittorn
a97d8c119b network: enable new netsplit, netsplit size settings 2019-01-30 03:44:48 +07:00
mittorn
480ef0a468 legacymode: add netsplit support (incoming only) 2019-01-29 19:01:21 +07:00
mittorn
f044a59984 Port old netsplit implementation 2019-01-29 17:29:31 +07:00
mittorn
f3ae5159cb Add endian conversion macros 2019-01-29 17:27:36 +07:00
mittorn
52fca4ac0c legacymode: send identification 2019-01-29 17:00:40 +07:00
mittorn
98bf05b948 identification: fix network device detection 2019-01-29 16:38:19 +07:00
mittorn
bbd4c1315e legacymode: implement clc_userinfo 2019-01-29 02:33:30 +07:00
Jonathan Poncelet
35869586c9 Made various log messages more informative 2019-01-28 18:32:29 +00:00
mittorn
ed049ea539 Implement --single-binary and --stdin-input options 2019-01-28 14:09:06 +00:00
Alibek Omarov
6ba406be7d legacymode: some codestyle fixes 2019-01-27 03:02:16 +03:00
Alibek Omarov
860d3be42d demo: draw recording message a bit higher 2019-01-27 02:42:28 +03:00
Alibek Omarov
0801922466 cvar: don't change cvars without FCVAR_GLCONFIG variable during opengl.cfg reading 2019-01-27 02:27:12 +03:00
Alibek Omarov
103a2fccaa sdl: vid: rework safegl option 2019-01-27 02:26:23 +03:00
Alibek Omarov
cb7820b45b mainui: update 2019-01-26 23:54:11 +03:00
mittorn
1a6fd72d19 legacymode: fix choke counter 2019-01-27 02:48:09 +07:00
mittorn
5e65df3c2a legacymode: fix numFields for movevars_t 2019-01-27 02:47:43 +07:00
mittorn
b534422aed Clean delta when getting delta from server 2019-01-27 02:06:21 +07:00
mittorn
1866c00789 legacymode: fix dedicated server build 2019-01-26 17:53:38 +00:00
Alibek Omarov
1162e5a65b legacymode: retry connecting using legacy protocol automatically 2019-01-26 20:47:19 +03:00
Alibek Omarov
5da11291a2 legacymode: support server scanning 2019-01-26 18:54:23 +03:00
Alibek Omarov
042d2e436c mainui: update 2019-01-26 14:31:02 +03:00
Alibek Omarov
2da65ab122 Update submodules 2019-01-26 14:31:02 +03:00
Alibek Omarov
8c668b29c6 mainui: update 2019-01-26 14:31:02 +03:00
Alibek Omarov
75643895ef vgui_support: switch to free miniutl 2019-01-26 14:31:02 +03:00
mittorn
6a02a571c1 Legacy protocol compatibility (cl_legacymode) 2019-01-25 20:54:05 +07:00
mittorn
1e5f12a0ae Fix crash on broken model 2019-01-25 20:54:05 +07:00
Alibek Omarov
a297a0b5ad wscript: fix git commit hash 2019-01-13 16:46:50 +03:00
Alibek Omarov
9da413b2cc waf: add clang compilation database support 2019-01-13 16:46:12 +03:00
Alibek Omarov
0ca0dc9731 travis: fix packaging mingw build 2019-01-13 18:26:00 +05:00
Alibek Omarov
7205f2d4fa sound: sdl: use SDL_setenv for crossplatform 2019-01-13 18:19:35 +05:00
Alibek Omarov
196c311113 wcon: fix implicit declaration 2019-01-12 03:13:03 +03:00
Alibek Omarov
0409107ee2 scripts: appimage: fix generating extras.pak 2019-01-12 03:01:50 +03:00
Alibek Omarov
c8035c1adf host: fix implicit declaration on Win32 builds 2019-01-12 02:53:41 +03:00
Alibek Omarov
5fda638edf host: fix compiling error 2019-01-12 02:48:56 +03:00
Alibek Omarov
ed05519c60 host: rearrange conditionals in Host_CalcFPS for better readability 2019-01-11 23:20:35 +03:00
Alibek Omarov
ac77bab967 sound: opensles: same fix applied for OpenSLES/Android backend 2019-01-07 04:17:40 +03:00
Alibek Omarov
9935e2c8d3 sound: sdl: set pulseaudio environment variables regardless of target OS, because PA is crossplatform 2019-01-07 04:09:55 +03:00
Alibek Omarov
80fc7209ed sound: move related function declarations to platform header. Remove unused. 2019-01-07 04:07:06 +03:00
Alibek Omarov
908082097f wscript: error on implicit function declaration by default on any build type. Remove redutant Options import. 2019-01-07 03:59:56 +03:00
iZarif
245533defa wscript: SUBDIRS loop refactor 2018-12-30 20:39:17 +03:00
Alibek Omarov
b8c4c31e02 Merge 4344 update 2018-12-30 01:51:02 +03:00
Alibek Omarov
626df3673c Fix missing newline after exec userconfig.cfg 2018-12-25 06:12:01 +03:00
Alibek Omarov
3a288ffe4a Merge pull request #12 from Slipyx/misc
Add the 'sleeptime' cvar and behavior from the 'Old Engine'.
2018-12-23 16:32:48 +03:00
Josh K
422e511aac Added the 'sleeptime' cvar and behavior from the 'Old Engine'. 2018-12-23 07:32:13 -05:00
Alibek Omarov
621cdba53c engine: android: restore OpenSL ES audio 2018-12-20 10:22:04 +03:00
Alibek Omarov
e7ddc6d6c5 engine: android: restore dlsym hack for old Android(<5.0) 2018-12-20 10:15:44 +03:00
Alibek Omarov
b1a06baf83 wscript: link -llog on Android 2018-12-20 10:15:08 +03:00
Alibek Omarov
c3c0954613 mainui: update 2018-12-20 10:14:45 +03:00
Alibek Omarov
463a339a09 wscript: initial support for building on Android 2018-12-20 09:48:22 +03:00
Alibek Omarov
71cae6b02b waflib: add xcompile helper plugin intended to integrate with platform SDKs, like Android NDK 2018-12-20 09:44:51 +03:00
Alibek Omarov
ccac3e9cfc wscript: try to fix linking vgui on osx 2018-12-19 07:12:45 +03:00
Alibek Omarov
aac44ef866 waflib: try to fix sdl2 searching on osx again 2018-12-19 06:57:54 +03:00
Alibek Omarov
5d6d6c766e scripts: sdl2: fix finding sdl2 on osx 2018-12-17 03:11:41 +03:00
Alibek Omarov
28e6dec4b0 scripts: osx: fix path to SDL2 framework 2018-12-17 02:59:57 +03:00
Alibek Omarov
e2606cf97f scripts: stop executing script and print config.log, if waf was failed. 2018-12-17 02:53:00 +03:00
Alibek Omarov
cfea381c84 vgui_support: wscript: fix finding VGUI on osx, simplify sanity check 2018-12-17 02:36:14 +03:00
Alibek Omarov
bd7e2fe88d wscript: use no-undefined only on gcc 2018-12-17 02:35:37 +03:00
Alibek Omarov
30c32b0088 waflib: sdl2: fix finding sdl2 on osx 2018-12-17 02:34:49 +03:00
Alibek Omarov
95ce9fc00f wscript: explicitly set language when checking library 2018-12-16 17:10:01 +03:00
Alibek Omarov
a580e98f28 waflib: force_32bit: try to fix passing additional flags to generate 32bit code on MacOSX 2018-12-16 17:01:12 +03:00
Alibek Omarov
2072f5c276 scripts: fix travis scripts after refactoring wscript 2018-12-13 18:44:13 +03:00
Alibek Omarov
28c47a5c86 scripts: fix travis scripts after refactoring wscripts 2018-12-13 18:43:33 +03:00
Alibek Omarov
08dd632d87 wscript: fix git version definition 2018-12-13 08:13:27 +03:00
Alibek Omarov
bbde1394e1 wscript: move some code to our waflib, remove --no-gcc-colors, as newer GCC colorize output automatically, so there is no need in -fdisagnostic-colors=aloways flag, move common win32 libraries check here, better output for subprojects 2018-12-13 08:08:33 +03:00
Alibek Omarov
ede52d7808 mainui: update 2018-12-13 08:05:56 +03:00
Alibek Omarov
9ce9fa8cb5 vgui_support: wscript: refactor, use shared get_subproject_name, rename no-vgui to disable-vgui to follow automake-style convention, add vGUI library sanity check 2018-12-13 08:05:31 +03:00
Alibek Omarov
6debd84a2e game_launch: wscript: refactor, use shared get_subproject_name 2018-12-13 08:03:51 +03:00
Alibek Omarov
62995b0769 engine: wscript: refactor, use sdl2.py to get configure SDL2, use shared get_subproject_name 2018-12-13 08:03:26 +03:00
Alibek Omarov
ec50c4571c waflib: add some waf plugins by FWGS 2018-12-13 08:00:22 +03:00
Alibek Omarov
09938b978b gitignore: allow waflib directory, hide pyc and pycache 2018-12-13 07:48:51 +03:00
Alibek Omarov
6eb327eac2 scripts: enable verbose build, fix including SDL2 2018-12-13 03:25:46 +03:00
Alibek Omarov
cbb8db0089 travis: add mingw build deployment 2018-12-12 04:50:24 +03:00
Alibek Omarov
154ef82719 scripts: add mingw build archive creation 2018-12-12 04:49:11 +03:00
Alibek Omarov
ec80b0884f travis: deploy at least appimage now 2018-12-12 04:33:36 +03:00
Alibek Omarov
6a78b4ed1f scripts: fix appimagetool warning 2018-12-12 04:33:18 +03:00
Alibek Omarov
239c6759cb scripts: add travis deploy script 2018-12-12 04:32:58 +03:00
Alibek Omarov
017714f3a0 scripts: give build_appimage.sh +x 2018-12-12 04:24:47 +03:00
Alibek Omarov
16aa5a78fe travis: building appimage requires libfuse2 library 2018-12-12 04:21:10 +03:00
Alibek Omarov
baa94e2064 mainui: update 2018-12-12 04:19:47 +03:00
Alibek Omarov
f9b13472b5 scripts: autobuild appimage on travis 2018-12-12 04:19:17 +03:00
Alibek Omarov
2922267ae1 scripts: add xash-extras to travis common deps 2018-12-12 04:18:58 +03:00
Alibek Omarov
3c4e75f1b2 scripts: add script building AppImage based on portable build for Linux 2018-12-12 04:18:09 +03:00
Alibek Omarov
130a7b3c42 scripts: move makepak.py from android project repo to engine main repo, port to python3, replace spaces by tabs 2018-12-12 04:16:23 +03:00
mittorn
17b0c23f2e Show engine arch in version 2018-12-06 04:28:19 +07:00
mittorn
4b58b0b168 Fix console background aspect ratio 2018-12-06 03:00:39 +07:00
mittorn
298393b653 Initial amd64 port 2018-12-05 23:57:05 +07:00
mittorn
aed53c4fda Do not spam in console if vsync not availiable 2018-12-05 23:56:41 +07:00
a1batross
7ad7af76dd render: register r_showtree cvar 2018-11-30 22:56:20 +03:00
a1batross
0964fb11e4 sdl: partially fix maximizing window on Windows 2018-11-29 21:43:51 +03:00
a1batross
f173ce11f7 console: fix version drawn all the time which engine runs 2018-11-29 20:43:53 +03:00
a1batross
3046c9e68e gitignore: update 2018-11-29 20:24:39 +03:00
a1batross
137836348b client: fix GetCenterWindow engine call 2018-11-29 20:24:25 +03:00
a1batross
05eab0b5b0 system: fix win32 build 2018-11-29 19:48:16 +03:00
Alibek Omarov
a1edbaced4 mainui: update submodule 2018-11-29 01:54:45 +03:00
Alibek Omarov
3fe737058f buildinfo: add host_ver cvar 2018-11-29 01:54:25 +03:00
Alibek Omarov
9c3e8f7e48 buildinfo: remove XASH_RELEASE 2018-11-29 01:54:09 +03:00
Alibek Omarov
dcf64c6b33 Fix build, update menu 2018-11-27 16:38:22 +03:00
Alibek Omarov
b9945d62a3 Apply 4312 update 2018-11-27 16:15:24 +03:00
Alibek Omarov
776d1cb52c wscript: try to fix windres searching for game_launch, fix osx 32 bit compiling 2018-11-19 01:58:40 +03:00
Alibek Omarov
81e142936d wscript: use lower-case win32 libraries names for crosscompiling from Linux 2018-11-19 00:46:29 +03:00
Alibek Omarov
a6fba0cb96 travis: scripts: try to fix mingw and osx build 2018-11-18 23:16:12 +03:00
Alibek Omarov
1b9bfd8906 platform: sdl: fix compiling 2018-11-18 23:04:47 +03:00
Alibek Omarov
e9d988f5d6 wscript: spaces to tabs 2018-11-18 23:04:30 +03:00
Alibek Omarov
7852192fc4 wscript: replace include/SDL by include/SDL2 2018-11-18 22:56:30 +03:00
Alibek Omarov
4db01487ba travis: scripts: install python for osx 2018-11-18 22:55:47 +03:00
Alibek Omarov
7b806add63 wscript: fix SDL2 include path 2018-11-18 22:48:52 +03:00
Alibek Omarov
d3c310628f travis: scripts: enable stb font renderer for linux 2018-11-18 22:41:16 +03:00
Alibek Omarov
62af116654 travis: scripts: set SDL2 prefix 2018-11-18 22:37:06 +03:00
Alibek Omarov
2b085cb69e game_launch: remove SDL for simplicity 2018-11-18 22:34:16 +03:00
Alibek Omarov
27ee4337fe travis: fix building sdl2, fix libpath in wscript 2018-11-18 18:52:57 +03:00
Alibek Omarov
f0297fc448 travis: initial support 2018-11-18 18:33:32 +03:00
Alibek Omarov
d74743ac1d mainui: update 2018-11-18 18:19:45 +03:00
Alibek Omarov
28471aee97 cl_game: get rid of int* to float* conversion 2018-11-18 18:19:31 +03:00
Alibek Omarov
deb537c1bb common: fix NULL redefine(do we really need NULL definition?) 2018-11-18 17:52:01 +03:00
Alibek Omarov
9d93eca572 platform: linux: fix descriptor leak 2018-11-18 17:50:15 +03:00
Alibek Omarov
66d1a632a7 net_ws: fix possible garabe in return value due to uninitialized value 2018-11-18 17:14:38 +03:00
Alibek Omarov
847be54457 wscript: refactor adding compiler flags, remove --release flag, instead add mandatory --build-type flag 2018-11-18 17:02:40 +03:00
Alibek Omarov
9d156b4285 crclib: md5: fix memset call 2018-11-17 01:40:35 +03:00
Alibek Omarov
edde871eb5 console: fix console font scale for Quake I fonts, fix drawing arrows in console for Quake I 2018-11-17 01:26:57 +03:00
Alibek Omarov
7c772d6bfd engine: rework timer stuff, move to platform. Move debugger present checks to platform 2018-11-16 16:32:16 +03:00
Alibek Omarov
f0d0861160 PhysicAPI: fix callback list initialization 2018-11-16 15:34:33 +03:00
Alibek Omarov
1ef0b44a41 filesystem: allow setting extras.pak by env-var for everyone 2018-11-16 15:34:02 +03:00
Alibek Omarov
25d8a94c1c engine: fix implicit declaration, remove dead MsgDev now, fix const modifier loss in host.c 2018-11-16 15:25:04 +03:00
Alibek Omarov
b60b3f7d18 GameUI: avoid const modifier loss 2018-11-16 15:12:43 +03:00
Alibek Omarov
b1db062fbc Merge pull request #3 from nekonomicon/bsd
*BSD-related fixes.
2018-11-05 18:25:05 +03:00
Night Owl
d4e5e609af Do not break video subsystem initialization. 2018-11-05 15:39:00 +05:00
Night Owl
f36d1f5621 Use execv instead of execve, because environ symbol breaks compilation with -Wl,--no-undefined flag under FreeBSD via Waf. 2018-11-05 15:39:00 +05:00
Night Owl
f350683e83 wscript: avoid linuxisms and gccisms. 2018-11-05 15:38:48 +05:00
Alibek Omarov
3c5f7de747 vgui_support: wscript: forgot to set MSVC_SUBSYSTEM for WinXP compatibility 2018-11-02 01:35:45 +03:00
Alibek Omarov
d81288d281 wscript: remove no-download-deps, autodownloading of dependencies not done yet 2018-11-02 01:35:10 +03:00
Alibek Omarov
d18708acf5 keys: fix indentation 2018-11-02 01:09:09 +03:00
Alibek Omarov
18353d9ae6 net_ws: allow to set custom IP address, use Q_strncpy instead of Q_strcpy 2018-11-02 01:06:23 +03:00
Alibek Omarov
ef39f9c9cf engine: dedicated: fix build 2018-11-01 23:31:16 +03:00
Alibek Omarov
a03aa3ddb3 Merge 4281 update 2018-10-28 00:39:29 +03:00
Alibek Omarov
c09aff8bd7 mainui: update 2018-10-27 23:29:10 +03:00
Alibek Omarov
70518a873c update my Qt Creator project 2018-10-27 23:28:29 +03:00
Alibek Omarov
95e64f3997 vgui: remove dead vgui_surf.cpp file 2018-10-27 23:28:29 +03:00
Alibek Omarov
2fab2d9f7e wscript: update 2018-10-27 23:28:29 +03:00
Alibek Omarov
de838ec5e8 rename backend files for great justice and consistency 2018-10-27 23:28:29 +03:00
Alibek Omarov
90d2434bb0 platform: add Set/GetClipboardText calls. Remove unneeded SDL_SetHint call on Android, because Android does not use SDL anymore 2018-10-27 23:28:29 +03:00
Alibek Omarov
96e0167e47 platform: add GetMousePos, SetMousePos calls, fix typo 2018-10-27 23:28:29 +03:00
a1batross
68ed732928 win_con: fix version in title, change title for dedicated server 2018-10-24 20:55:00 +03:00
a1batross
c603abfebf crashhandler: fix developer mode check 2018-10-24 20:18:06 +03:00
a1batross
85960b2c90 wscript: enable DBGHELP for Win32 2018-10-24 20:17:44 +03:00
a1batross
ca501c0378 wscript: add possibility to select windows subsystem during link, add define to use WinXP SDK. This commit forces WinXP compability on latest Visual Studio 2018-10-24 20:12:32 +03:00
Alibek Omarov
e9e364f054 wscript: move sdl path to root wscript 2018-10-22 01:01:22 +03:00
Alibek Omarov
7c9af89620 input: remove unneeded joy_found extern 2018-10-22 00:36:58 +03:00
Alibek Omarov
f4567b2c9d sound: make snd_mute_losefocus accessible outside 2018-10-22 00:36:38 +03:00
Alibek Omarov
7390d11505 platform_sdl: adapt SDL backend code to new platform backends system 2018-10-22 00:28:24 +03:00
Alibek Omarov
960e46c564 engine: adapt engine code to new platform backends system 2018-10-22 00:27:52 +03:00
Alibek Omarov
265f79fc72 platform: add GetNativeObject call 2018-10-22 00:21:05 +03:00
Alibek Omarov
a5258bea65 library: move win32 definitions to win_lib.c 2018-10-22 00:13:56 +03:00
Alibek Omarov
25f07ddb97 platform: introduce common header for platform-dependent functions. To keep clean code and engine platform-agnostic, now including headers from platform folder, except this one, is strictly prohibited. 2018-10-21 23:52:14 +03:00
Alibek Omarov
6ba7781a61 input: various fixes: fix mistyped pitch/yaw, replace SDL_GetMouseState by SDL_GetRelativeMouseState, fix disabling mouse with -nomouse argument 2018-10-21 22:13:58 +03:00
Alibek Omarov
23a7dce3be mainui: update 2018-10-21 22:06:17 +03:00
Alibek Omarov
880d3de53a input: move evdev under m_ignore 2018-10-21 22:04:24 +03:00
Alibek Omarov
5af7a19b40 Rename contib to contrib 2018-10-21 14:17:36 +03:00
Alibek Omarov
da094fa04e input: provide a common function for collecting input from different sources 2018-10-11 00:04:23 +03:00
Alibek Omarov
bff9ca8438 console: fix double printed console messages on Win32 2018-10-10 23:43:03 +03:00
Alibek Omarov
e50d22bce7 mainui: update 2018-10-10 23:38:58 +03:00
Alibek Omarov
216b4f4147 vid_sdl: fix incorrect video modes list length 2018-10-10 23:36:34 +03:00
Alibek Omarov
4ced29ee8f vid_common: fix window_center_x/y initialization 2018-10-10 20:22:11 +03:00
Alibek Omarov
844b3a39a7 vid_sdl: fix GL_UpdateContext, fix window created outside screen if positions were negative 2018-10-10 20:01:54 +03:00
Alibek Omarov
9e618ce3e1 cmd: base_cmd: fix inconsistency between linked list and hash map 2018-10-10 00:42:06 +03:00
Alibek Omarov
abda3b52ab game_launch: remove two different names for engine DLLs 2018-10-10 00:41:18 +03:00
Alibek Omarov
649f32a185 wscript: fix install 2018-10-08 22:39:33 +03:00
Alibek Omarov
8710922a61 waf: update 2018-10-08 22:39:33 +03:00
Alibek Omarov
8ea5536b42 wscript: fix win32 build 2018-10-08 22:39:33 +03:00
Alibek Omarov
48d1aa5115 engine: fix warnings 2018-10-06 03:42:09 +03:00
Alibek Omarov
eafe5d6c68 mainui: update 2018-10-06 03:30:38 +03:00
Alibek Omarov
f1d9034546 GameUI: fix menu APIs loading order 2018-10-06 03:28:40 +03:00
mittorn
b0c077ccf8 Persistent console history 2018-10-04 18:10:12 +07:00
mittorn
a0f0eca77c Backup console input when using history 2018-10-04 16:38:39 +07:00
mittorn
e74513556a Fix gcc colors 2018-10-04 16:09:03 +07:00
mittorn
891c984c56 Port some config changes 2018-10-04 16:08:49 +07:00
mittorn
491188a0f3 Merge branch 'original' 2018-10-04 14:27:14 +07:00
mittorn
9dadc0de93 Make vgui build dependence optional as it does not have opensource license 2018-10-04 12:28:25 +07:00
mittorn
1dedf0e208 Fix tab in wscript 2018-10-04 12:15:05 +07:00
Alibek Omarov
e123499e23 Fix build 2018-07-12 23:22:06 +03:00
Alibek Omarov
7601a4cd29 Revert 64257ef to not break C++ header compability 2018-07-12 23:13:30 +03:00
Alibek Omarov
c8b78b4124 Update mainui 2018-07-10 23:05:57 +03:00
Alibek Omarov
fdb2055b62 Add RoDir support 2018-07-10 23:03:27 +03:00
Alibek Omarov
2c0a03704c Update mainui. Add --enable-bsp2 switch into wscript 2018-07-10 17:29:05 +03:00
Alibek Omarov
2edbcb996d Merge 4150 update. Fix some mistypings. Rename CL_IsQuakeCompatible to Host_IsQuakeCompatible, as it may be used in whole engine and even in dedicated builds. IN_RecalcCenter was not added, window center positions should be updated by backends. 2018-06-19 16:59:53 +03:00
Alibek Omarov
76e01f490c Update mainui. Make VGUI search message more friendly. Update gitignore 2018-06-19 16:17:27 +03:00
Alibek Omarov
f23029efe0 Refactoring wscript. Add execute flag on waf 2018-06-17 14:30:59 +03:00
Alibek Omarov
e70dea54c0 Add waf itself(with included wurf and msvs.py) and waf.bat launcher for Windows 2018-06-14 21:23:38 +03:00
Alibek Omarov
ca28332c6c Use msvs.py to generate Visual Studio project. Add debug flags for Visual Studio 2018-06-14 21:22:17 +03:00
Alibek Omarov
f15e2c2dcf Move command autocomplete to common engine files, as it used by Wcon and may be used by curses console in future 2018-06-14 21:19:04 +03:00
Alibek Omarov
572705bc08 MSVC & Win32 wscript fixes 2018-06-14 20:34:51 +03:00
Alibek Omarov
473810fc0c MSVC & Win32 related fixes 2018-06-14 20:32:40 +03:00
Alibek Omarov
d0ff201da2 Fix dedicated compiling errors 2018-06-14 20:31:46 +03:00
Alibek Omarov
b5c621ae36 Fix mainui submodule 2018-06-14 19:27:06 +03:00
Alibek Omarov
7cdead7bac Merge 4143 update 2018-06-12 12:18:14 +03:00
Alibek Omarov
f26ac52102 Merge 4140 update 2018-06-11 14:04:50 +03:00
Alibek Omarov
5d48708615 Forgot to add cvars into basecmd. Add basecmd_test to check is basecmd valid 2018-06-01 22:11:22 +03:00
Alibek Omarov
0561ac2076 Add basecmd from old engine. Add basecmd_stats command 2018-06-01 21:28:25 +03:00
Alibek Omarov
ae5257c654 Add masterlist from engine. Use non-blocking network name resolution 2018-06-01 20:44:16 +03:00
Alibek Omarov
5a449a56ea Port restricted cmds and cvars from old engine. TODO: implement better stufftext filter 2018-06-01 19:57:54 +03:00
Alibek Omarov
69549787bc net_ws refactoring, fix minor bugs 2018-06-01 19:29:47 +03:00
Alibek Omarov
0db8d95bc9 Update mainui. Add possibility to install engine ignoring *nix file hierarchy in wscript. Fix debugging. 2018-05-29 01:02:32 +03:00
Alibek Omarov
236c16e35f Update QtCreator project 2018-05-29 00:58:45 +03:00
Alibek Omarov
79d8bc2cdd Get rid of accidentally added CMakeLists 2018-05-29 00:20:07 +03:00
Alibek Omarov
fac536f8c4 Add mainui_cpp. Use appropriate message in vgui_support's wscript. 2018-05-28 23:47:38 +03:00
Alibek Omarov
aa5d52cebc Change libxashmenu to libmenu to keep same names between different OSes 2018-05-28 23:44:52 +03:00
Alibek Omarov
7e372645da Add my personal IDE settings to contrib. Add QtCreator generated files to gitignore. 2018-05-28 23:13:50 +03:00
Alibek Omarov
0c058f2eca Add waf buildscripts, add updated game_launch 2018-05-28 23:13:50 +03:00
Alibek Omarov
d9320f964e Crashhandler refactoring for POSIX systems. Shows engine version now. 2018-05-28 23:13:50 +03:00
Alibek Omarov
b29adf752c Merge pull request #1 from lewa-j/master
Fix MinGW build
2018-05-13 23:39:36 +03:00
lewa_j
43b746d2f8 Fix MinGW build 2018-05-13 23:25:51 +03:00
mittorn
817206815d reslist.txt support 2018-05-05 02:24:55 +07:00
mittorn
37aa201ed7 Fix memory leak 2018-05-05 01:20:46 +07:00
mittorn
d3a0146b5a Fix sound downloading 2018-05-05 00:12:30 +07:00
mittorn
30771fefa6 Forbid download not precached files 2018-05-05 00:01:32 +07:00
mittorn
6ae44d7577 Fix downloading models with zero res->ucFlags 2018-05-04 23:16:47 +07:00
mittorn
42b4e456a2 Fix log 2018-05-03 23:51:23 +07:00
mittorn
290b9cae0b Restore utf-8 support 2018-05-03 23:31:03 +07:00
Alibek Omarov
ec6bfa2421 Let server physics simulate even when there is no players(GoldSrc behaviour) 2018-05-03 17:53:49 +03:00
Alibek Omarov
46a3e729db Fix collision being calculated on unlagged value for both players and bots. 2018-05-03 17:43:26 +03:00
Alibek Omarov
5ca7bb5f12 Fix noise index for not sine beams 2018-05-03 17:42:21 +03:00
Alibek Omarov
86dfaf9930 Fix too loud entities in multiplayer 2018-05-03 17:41:39 +03:00
Alibek Omarov
7d37ff33aa Fix high CPU load on Linux 2018-05-01 21:52:17 +03:00
Alibek Omarov
415e517107 Library loader refactoring. Not tested for platforms other than Linux 2018-05-01 21:52:00 +03:00
Alibek Omarov
0b0ec876a5 Oops, this isn't supposed to be commited 2018-05-01 17:53:25 +03:00
Alibek Omarov
34f6f6d539 Fix implicit declaration on dedicated 2018-05-01 17:37:25 +03:00
Alibek Omarov
0681209114 Remove useless host.type set, replace HOST_DEDICATED checks by Host_IsDedicated 2018-05-01 17:30:33 +03:00
Alibek Omarov
becd0eba03 Possibility to use dedicated version with SDL(it's used only by internal timer) 2018-05-01 17:30:33 +03:00
mittorn
063eb151c4 waf options for dedicated server and 64-bits 2018-05-01 03:04:30 +07:00
Alibek Omarov
3f2a8f7704 Remove vid_mode. VID_GetModeString now returns only supported modes from SDL2 2018-04-29 09:21:23 +03:00
Alibek Omarov
c8b83385df Add waf related files to gitignore. Restore cl_trace_messages 2018-04-29 04:25:41 +03:00
mittorn
ac1c8594b7 Add waf build script and legacy makefile to contrib 2018-04-28 23:32:55 +00:00
mittorn
0c903c1e56 Fix dedicated server build 2018-04-26 14:11:01 +00:00
Alibek Omarov
dcc19aeafb Merge 4097 2018-04-26 03:23:00 +03:00
Alibek Omarov
faf15df62f Correct max_particles clamping 2018-04-26 02:53:24 +03:00
Alibek Omarov
a3c90248a7 Remove unneeded argument in SDLash_KeyEvent. Remove copypasted code 2018-04-26 02:52:49 +03:00
Alibek Omarov
78365d2bc6 Add new two functions to Menu API 2018-04-24 05:54:57 +03:00
Alibek Omarov
176b31b4a2 Fix wrong max edicts clamp. Add game_dll_linux and game_dll_osx to gameinfo.txt. Fix crash in R_ChangeVideoSettings 2018-04-24 05:50:10 +03:00
Alibek Omarov
efe8ddf151 Fix missing const-qualifiers in engine code. Fix qboolean/int mixing in interface implementations(int is preferred). Replace long by int in COM_RandomLong. 2018-04-23 23:07:54 +03:00
Alibek Omarov
e1f80fba3d Add forgotten const-qualifiers in interface headers. Remove unneeded PM headers 2018-04-23 23:06:18 +03:00
Alibek Omarov
fd649905ea Fix some format warnings 2018-04-23 21:49:37 +03:00
Alibek Omarov
bd4988e588 More _format() attribute 2018-04-23 21:37:35 +03:00
Alibek Omarov
4ef527a92d Print version by _sv_build_info server command 2018-04-23 21:36:59 +03:00
Alibek Omarov
e8d13cd0d5 Rebrand from Xash3D to Xash3D FWGS. Add _format() attrubute to print-like functions 2018-04-23 21:36:33 +03:00
Alibek Omarov
501985be48 Remove accidentally left debug 2018-04-22 17:19:54 +03:00
Alibek Omarov
ebe3a203ba Always fragment upload data, this fixes some cases when upload must be fragmented, but download test shown no fragmentation requirement 2018-04-22 17:17:35 +03:00
Alibek Omarov
63513ec475 Small refactoring of EnableTextInput 2018-04-22 14:01:56 +03:00
Alibek Omarov
545b781934 Restore hud_utf8 2018-04-22 14:01:22 +03:00
Alibek Omarov
0d035746d5 Remove lowercase-ing in listdirectory() 2018-04-22 13:10:16 +03:00
Alibek Omarov
ec41db7ef8 Prepend USE_SELECT and COLORIZE_CONSOLE with XASH_ 2018-04-22 13:07:40 +03:00
Alibek Omarov
362217935f Don't increase server library reference counter, free it pfnCheckGameDll 2018-04-22 13:01:06 +03:00
mittorn
8704c07e4b Merge branch 'original' 2018-04-21 13:44:06 +00:00
mittorn
7d1df4c097 Add string.h, fix decals with unsigned char 2018-04-21 13:39:55 +00:00
Alibek Omarov
2c755778f4 Deprecate secure parameter 2018-04-21 11:16:33 +03:00
Alibek Omarov
9ab3300b76 Rename allow_console to developer in menu_int.h. Define NEW_ENGINE_INTERFACE. 2018-04-21 11:16:11 +03:00
Alibek Omarov
535b00d98f Fix GameInfo parsing 2018-04-21 02:51:14 +03:00
Alibek Omarov
de35262a3b Fix network send packet 2018-04-21 02:50:50 +03:00
Alibek Omarov
314a6deba9 Remove gamedir[] from engine-side gameinfo_t 2018-04-21 01:22:00 +03:00
Alibek Omarov
d3990e03e6 Add text input mode calls where they should be. Disable text input mode at initialization 2018-04-21 00:37:16 +03:00
Alibek Omarov
cec7bf8488 Fix server library sanity checking 2018-04-21 00:36:14 +03:00
Alibek Omarov
32aa9a9f54 Implement Mobility API support. Add missing IN_TouchShutdown and Joy_Shutdown calls. Don't save video and opengl configs if engine crashed. 2018-04-21 00:13:20 +03:00
Alibek Omarov
b7622e6009 Fix implicit function declaration. Fix struct declaration in parameter list 2018-04-21 00:05:08 +03:00
Alibek Omarov
fd1f0e685a Restore con_fontscale functionality 2018-04-21 00:03:59 +03:00
Alibek Omarov
a015d6b915 Revert fork's hud_scale behaviour 2018-04-21 00:03:19 +03:00
mittorn
7350be6e7f Fix build after update 2018-04-20 21:48:12 +00:00
mittorn
926b909f3d Merge branch 'original' 2018-04-20 12:38:53 +00:00
mittorn
c1076f43f7 Update client engine interface 2018-04-19 21:51:17 +00:00
mittorn
af7123f7dd Merge branch 'original' (except gldebug, msaa) 2018-04-19 20:47:41 +00:00
Alibek Omarov
5d13112e25 Dedicated build 2018-04-18 18:32:30 +03:00
Alibek Omarov
40094f2867 Move client-only parts to client 2018-04-18 18:10:32 +03:00
Alibek Omarov
6db7c191eb Add fork's mobility_int.h(no support yet, just header) 2018-04-17 03:57:21 +03:00
Alibek Omarov
a2e2dd5bdf Add libmpg source 2018-04-17 03:57:04 +03:00
Alibek Omarov
7fdabb73a8 Add identification support from fork 2018-04-17 03:56:49 +03:00
Alibek Omarov
86337db5b3 Use fork's keydefs.h 2018-04-17 03:56:13 +03:00
Alibek Omarov
8e3c748f12 Adapt vgui_support support to newer engine 2018-04-17 03:56:01 +03:00
Alibek Omarov
b825e584f3 Replace GL_TEXTURE by XASH_TEXTURE because it's used internally by GL.h 2018-04-17 03:55:36 +03:00
Alibek Omarov
13fe097318 Merge fork's unicode changes(partial) 2018-04-17 03:54:07 +03:00
Alibek Omarov
5af7eb6c18 Add support for TextAPI in menu 2018-04-17 03:53:18 +03:00
Alibek Omarov
be4b885254 Merge common SDL port changes 2018-04-17 03:53:01 +03:00
Alibek Omarov
b70fab5384 Add Sys_GetIntFromCmdLine 2018-04-17 03:49:30 +03:00
Alibek Omarov
92c321848d Adapt input code to newer engine 2018-04-17 03:48:02 +03:00
Alibek Omarov
2de6d00a82 Update filesystem. Use fork's gameinfo/liblistgam parser, use PATH_SPLITTER to avoid errors 2018-04-17 03:46:30 +03:00
Alibek Omarov
5744aa8d9e Add SDL sound backend 2018-04-17 03:44:53 +03:00
Alibek Omarov
fc7ed1ab75 Add SDL video backend 2018-04-17 03:44:17 +03:00
Alibek Omarov
7c9b724531 Implement dynamic library loading and symbol resolving 2018-04-17 03:43:27 +03:00
Alibek Omarov
64257ef428 Avoid some struct declaration in parameter list 2018-04-14 04:26:12 +03:00
Alibek Omarov
4a0add4063 Move Win32 console into separate file(second commit), hide Win32 console code under _WIN32 macro. Add some fork-specific macros. Add sys_con.c for generic log file implementation. 2018-04-14 04:08:28 +03:00
Alibek Omarov
45c0eaa26c Move Win32 console and library loader to platform/win32 folder. 2018-04-14 03:31:43 +03:00
Alibek Omarov
15096aa15a net_ws port. Port non-blocking NS resolution also. 2018-04-14 03:27:52 +03:00
Alibek Omarov
36f756feeb Avoid some struct declarations inside paramater list, it makes even GCC7 confusing 2018-04-14 02:51:00 +03:00
Alibek Omarov
4d4a7d49d5 mathlib.c port 2018-04-14 02:45:48 +03:00
Alibek Omarov
4189af8b50 Engine input port. Incomplete integration of touch, gamepad, evdev input 2018-04-14 02:42:41 +03:00
Alibek Omarov
990d526a07 Add crashhandler.c file 2018-04-14 01:50:19 +03:00
Alibek Omarov
5a1b03ac20 Integrate FWGS vgui_support 2018-04-14 01:49:14 +03:00
Alibek Omarov
158db1c454 img_bmp.c port 2018-04-14 01:26:52 +03:00
Alibek Omarov
7ace83eeab Add Sys_Warn 2018-04-14 01:26:25 +03:00
Alibek Omarov
b940a62f02 host.c port 2018-04-13 21:28:46 +03:00
Alibek Omarov
d564a062ce Filesystem port 2018-04-13 20:44:39 +03:00
Alibek Omarov
7671365c92 Rename _alloca back to alloca 2018-04-13 20:22:12 +03:00
Alibek Omarov
f7a58ec04d Remove MSVC-specific try-except for C in Q_vsnprintf 2018-04-13 20:14:20 +03:00
Alibek Omarov
8e508cf065 Remove WGL function pointers, remove HDC 2018-04-13 20:13:54 +03:00
Alibek Omarov
e5b0473e4a Fix conflicting types on NXPrintf function family 2018-04-13 20:08:50 +03:00
Alibek Omarov
136123eeb3 SV_BroadcastPrintf already defined in common.h. Remove definition from server.h. 2018-04-13 19:58:47 +03:00
Alibek Omarov
32b07cda86 Add kbutton.h, fix includes 2018-04-13 19:58:17 +03:00
Alibek Omarov
25325e6150 Port common.h and system.h. Add backends.h, defaults.h, port.h, xash3d_types.h from fork 2018-04-13 19:56:43 +03:00
Alibek Omarov
a639b72e90 AVI stub for non-Windows 2018-04-13 19:42:17 +03:00
Alibek Omarov
08984bd549 Rename features.h to enginefeatures.h because this name used internally by glibc 2018-04-13 19:26:48 +03:00
Alibek Omarov
bf08a8261b Add .gitignore 2018-04-13 19:25:39 +03:00
363 changed files with 61719 additions and 17490 deletions

32
.cirrus.yml Normal file
View File

@@ -0,0 +1,32 @@
task:
name: freebsd-10-amd64
freebsd_instance:
image_family: freebsd-10-4
setup_script:
- pkg install -y git sdl2 python
- git submodule update --init --recursive
test_script:
# - ./scripts/build_freebsd_engine.sh dedicated
- ./scripts/build_freebsd_engine.sh
task:
name: freebsd-11-amd64
freebsd_instance:
image_family: freebsd-11-3
setup_script:
- pkg install -y git sdl2 python
- git submodule update --init --recursive
test_script:
# - ./scripts/build_freebsd_engine.sh dedicated
- ./scripts/build_freebsd_engine.sh
task:
name: freebsd-12-amd64
freebsd_instance:
image_family: freebsd-12-0
setup_script:
- pkg install -y git sdl2 python
- git submodule update --init --recursive
test_script:
# - ./scripts/build_freebsd_engine.sh dedicated
- ./scripts/build_freebsd_engine.sh

9
.editorconfig Normal file
View File

@@ -0,0 +1,9 @@
# EditorConfig is awesome: https://EditorConfig.org
root = true
[*]
charset = latin1
end_of_line = lf
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true

329
.gitignore vendored Normal file
View File

@@ -0,0 +1,329 @@
# Binaries
*.o
*.so
*.a
*.framework
# Other
*.save
# Qt Creator for some reason creates *.user.$version files, so exclude it too
*.user*
*~
### Xcode ###
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.xcuserstate
### OSX ###
.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### CMake ###
CMakeCache.txt
CMakeFiles
Makefile
cmake_install.cmake
install_manifest.txt
# makedepend
Makefile.dep
*.bak
ALL_BUILD.*
INSTALL.*
ZERO_CHECK.*
# Visual Studio
*.obj
*.dll
*.exp
*.lib
*.suo
*.sdf
Debug/
Release/
ipch/
*.opensdf
# Use CMake for generating projects
*.vcxproj.filters
*.vcxproj
*.sln
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# PVS Studio for Linux output
*.cl.cfg
# Kate
*.kate-swp
*.swp
# QtCreator
build-*
# Android
*.apk
*.config
*.creator
*.includes
*.files
# Waf
build_current
.waf-*
waf-*/
waf3-*/
.lock-waf*
*.lastbuildstate
*.unsuccessfulbuild
__pycache__
*.pyc
# MSVC projects
*.vcproj
*.sln
*.vcxproj

12
.gitmodules vendored Normal file
View File

@@ -0,0 +1,12 @@
[submodule "mainui"]
path = mainui
url = https://github.com/FWGS/mainui_cpp
[submodule "ref_gl/nanogl"]
path = ref_gl/nanogl
url = https://github.com/FWGS/nanogl
[submodule "ref_gl/gl-wes-v2"]
path = ref_gl/gl-wes-v2
url = https://github.com/FWGS/gl-wes-v2
[submodule "vgui-dev"]
path = vgui-dev
url = https://github.com/FWGS/vgui-dev

213
.travis.yml Normal file
View File

@@ -0,0 +1,213 @@
language: c
compiler: gcc
sudo: false
env:
global:
- SDL_VERSION=2.0.8
- DEPLOY_BRANCH=anewengine
git:
depth: 50
submodules: true
jdk:
- oraclejdk8
jobs:
include:
- stage: init
name: "Initialize webdav cache"
os: linux
cache: false
script:
- sh scripts/yadisk_clear.sh
- stage: build
name: "Build for Windows MSVC"
cache: ccache
os: windows
before_script:
- sh scripts/travis_common_deps.sh
- sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
script:
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh
after_script:
- sh scripts/continious_upload.sh xash3d-vc.7z xash3d-vc2008-sln.7z
- # ...
name: "Build for Linux i686"
cache: ccache
os: linux
dist: xenial
addons:
apt:
packages:
- gcc-multilib
- g++-multilib
- libx11-dev:i386
- libxext-dev:i386
- x11-utils
- libgl1-mesa-dev
- libasound-dev
- libstdc++6:i386
- libfuse2:i386
- zlib1g:i386
- unzip
before_script:
- export ARCH=i686
- sh scripts/travis_common_deps.sh
- sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
script:
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh full
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh dedicated
after_script:
- ccache --show-stats
- sh scripts/continious_upload.sh xash3d-fwgs-${ARCH}.AppImage xashds-linux-${ARCH}
- # ...
name: "Build for Android"
cache: ccache
os: linux
dist: xenial
language: java # we want xenial, so just java, not android
jdk: openjdk8
addons:
apt:
packages:
- clang-9
- lld-9
- p7zip-full
sources:
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
before_script:
- export ANDROID_HOME=$TRAVIS_BUILD_DIR/sdk
- sh scripts/travis_common_deps.sh
- sh scripts/travis_android_deps.sh r10e
- export ANDROID_SDK_HOME=$ANDROID_HOME
- export ANDROID_NDK_HOME=$ANDROID_SDK_HOME/ndk-bundle
script:
- cd android
- export ARCHS="armeabi armeabi-v7a x86"
- export TOOLCHAIN="host"
- sh compile.sh release
after_script:
- ccache --show-stats
- sh ../scripts/continious_upload.sh xashdroid.apk
- # ...
name: "Build for Android 64"
cache: ccache
os: linux
dist: xenial
language: java # we want xenial, so just java, not android
jdk: openjdk8
addons:
apt:
packages:
- clang-9
- lld-9
- p7zip-full
sources:
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
before_script:
- export ANDROID_HOME=$TRAVIS_BUILD_DIR/sdk
- sh scripts/travis_common_deps.sh
- sh scripts/travis_android_deps.sh r10e
- export ANDROID_SDK_HOME=$ANDROID_HOME
- export ANDROID_NDK_HOME=$ANDROID_SDK_HOME/ndk-bundle
script:
- cd android
- export ARCHS="aarch64 x86_64"
- export API=21
- export TOOLCHAIN="host"
- sh compile.sh release
after_script:
- ccache --show-stats
- mv xashdroid.apk xashdroid-64-test.apk
- sh ../scripts/continious_upload.sh xashdroid-64-test.apk
- # ...
name: "Build for Linux amd64"
cache: ccache
os: linux
dist: xenial
addons:
apt:
packages:
- libx11-dev
- libxext-dev
- x11-utils
- libgl1-mesa-dev
- libasound-dev
- libstdc++6
- libfuse2
- unzip
before_script:
- export ARCH=x86_64
- sh scripts/travis_common_deps.sh
- sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
script:
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh full
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh dedicated
after_script:
- ccache --show-stats
- sh scripts/continious_upload.sh xash3d-fwgs-${ARCH}.AppImage xashds-linux-${ARCH}
# - # ...
# name: "Build for Windows MinGW"
# cache: ccache
# os: linux
# dist: xenial
# addons:
# apt:
# packages:
# - mingw-w64-i686-dev
# - binutils-mingw-w64-i686
# - gcc-mingw-w64-i686
# - g++-mingw-w64-i686
# - p7zip-full
# before_script:
# - sh scripts/travis_common_deps.sh
# - sh scripts/travis_mingw_deps.sh
# script:
# - sh scripts/build_mingw_engine.sh
# after_script:
# - ccache --show-stats
# - sh scripts/continious_upload.sh xash3d-mingw.7z
# - # ...
# name: "Build for OSX"
# cache: ccache
# os: osx
# before_script:
# - sh scripts/travis_common_deps.sh
# - sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
# script:
# - sh scripts/build_${TRAVIS_OS_NAME}_engine.sh
# after_script:
# - sh scripts/continious_upload.sh xash3d-osx.tar.bz2
- # ...
name: "Build for MotoMAGX"
sudo: true
cache: ccache
os: linux
dist: xenial
addons:
apt:
packages:
- libc6:i386
- libstdc++6:i386
- gcc-multilib
- g++-multilib
- p7zip-full
sources:
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
before_script:
- sh scripts/travis_common_deps.sh
- sh scripts/travis_motomagx_deps.sh
script:
- sh scripts/build_motomagx_engine.sh
after_script:
- cd $TRAVIS_BUILD_DIR
- ccache --show-stats
- sh scripts/continious_upload.sh xash3d-magx.7z
- stage: deploy
name: "Deploy to github repo"
os: linux
cache: false
script:
- sh scripts/travis-deploy.sh xash3d-fwgs-i686.AppImage xash3d-fwgs-x86_64.AppImage xash3d-vc.7z xash3d-vc2008-sln.7z xashdroid.apk xashdroid-64-test.apk xashds-linux-i686 xashds-linux-x86_64 xash3d-magx.7z

47
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,47 @@
## If you are reporting bugs
1. Check you are using latest version. You can build latest Xash3D FWGS for yourself, look to README.md.
2. Check open issues is your bug is already reported and closed issues if it reported and fixed. Don't send bug if it's already reported.
3. Re-run engine with `-dev 2 -log` arguments, reproduce bug and post engine.log which can be found in your working directory.
3. Describe steps to reproduce bug.
4. Describe which OS and architecture you are using.
6. Attach screenshot if it will help clarify the situation.
## If you are contributing code
### Which branch?
* We recommend using `master` branch.
### Third-party libraries
* Philosophy of any Xash Project by Uncle Mike: don't be bloated. We follow it too.
* Adding new library is allowed only if there is a REAL reason to use it. It's will be nice, if you will leave a possibility to remove new dependency at build-time.
* Adding new dependencies for Waf Build System is not welcomed.
### Portability level
* Xash3D have it's own crt library. It's recommended to use it. It most cases it's just a wrappers around standart C library.
* If your feature need platform-specific code, move it to `engine/platform` and try to implement to every supported OS and every supported compiler or at least leave a stubs.
* You must put it under appopriate macro. It's a rule: Xash3D FWGS must compile everywhere. For list of platforms we support, refer to public/build.h file.
### Code style
* This project uses mixed Quake's and HLSDK's C/C++ code style convention.
* In short:
* Use spaces in parenthesis.
* Only tabs for indentation.
* Any brace must have it's own line.
* Short blocks, if statements and loops on single line are allowed.
* Avoid magic numbers.
* While macros are powerful, it's better to avoid overusing them.
* If you unsure, try to mimic code style from anywhere else of engine source code.
* **ANY** commit message should start from declaring a tags, in format:
`tag: added some bugs`
`tag: subtag: fixed some features`
Tags can be any: subsystem, simple feature name or even just a filename, without extension.
Just keep them always same, it helps keep history clean and commit messages short.

View File

@@ -0,0 +1,71 @@
## Abstract
Before start, I would recommend you to compile and run engine for already supported and well-spread platform, such as GNU/Linux or Windows. Hack it, get familiar with engine.
One beauties of Xash3D FWGS Engine is it modularity, so game logic, UI and renderers are located in platform-independent libraries. Every library is loaded at run time and may or may be not optional. For example, if your platform doesn't have OpenGL of any kind, you can skip it and use our software renderer! Of course, there is no real reason to run game engine, if you don't have game logic of any kind, so the minimal build of Xash3D FWGS is headless dedicated server.
Historically, Xash3D Engine was even more modular(see github.com/a1batross/Xash3D_ancient), but we thought that to fulfill our crossplatform needs we will keep all platform-specific stuff in the engine itself and libraries must import or expose platform-independent APIs.
Ok, get to the point!
## Porting guidelines
It will not be a complete tutorial as covering everything in one article is probably just impossible. Instead, I will give you hints on how engine can be ported, how to get your port to upstreamed and how you should maintain your port.
0) Get to know your platform. Maybe I asked for this lately, but you MUST KNOW YOUR PLATFORM, i.e. what's this capable of.
The one of unsupported configurations at this time is when platform can't load dynamic libraries(`*.so` or DLLs). We can't help you as supporting full-static ports are violating the GPL license in various ways.
The other yet unsupported configuration is the big endian.
1) Setup toolchain. For dirty port, you can write Makefile for yourself, engine is written that way, so **it doesn't relies** on any generated data or any special processing. But I recommend you to use Waf anyway, it's better integrated to engine and self-documentable. Also, I will cover only our Waf build options.
2) Open `public/build.h` file. Add appropriate checks for your operating system and/or CPU architecture. It shouldn't be hard.
Also, you'll need to build [Half-Life SDK](https://github.com/FWGS/hlsdk-xash3d/). It has same `public/build.h` so reflect changes into it. Note that to be compatible with HLSDK proprietary license, it's relicensed as public domain under [Unlicense](https://unlicense.org).
We have a library naming scheme that allows us and game creators to distribute binaries for different platforms in one archive. Read `Documentation/extensions/library-naming.md` for more information.
In short, you need to call your platform in unique way. For engine side it's done in `engine/common/build.c` file in engine source code, for HLSDK side it's done in `cmake/LibraryNaming.cmake` and `scripts/waifulib/library-naming.py` files in HLSDK source code.
You can use [predef project wiki](https://sourceforge.net/p/predef/wiki/Home/) for reference.
2) Look at the `engine/platform` directory. We usually try to have all platform-specific stuff inside this folder.
* Functions that must be available on your platform are declared in `platform.h` header. Most of them aren't used in headless dedicated build, but I will cover that later.
* The POSIX-compliant(for *nix operating systems) goes into `posix` subdirectory.
* The SDL-specific code goes into `sdl` subdirectory. Note that even I said before that platform-specific code is in `platform` directory, SDL obviously isn't a __platform__, so you can met checks for XASH_SDL inside whole engine, usually in input.
* Custom SWAP implementation for *nix-based systems is in `swap` subdirectory. It's used when hardware may not have enough memory and you can't add swap memory. I will cover that later
It relies on a fact that systems with paged memory will load pages into RAM and move unused to mmap()-ed by custom swap area.
That allowed to run game engine on music player with MIPS CPU, Linux without SWAP support and
* Other folders as `win32`, `android`, `linux` and so on are self-descriptive.
3) As proof of concept, you can try to test that network features and dynamic library loading are implemented correctly. Build a dedicated server with XASH_DEDICATED or `--dedicated` passed to `waf configure`.
Start a server and try to connect to it from PC. If everything is fine, then you can move to next step.
If you get out of memory issues, you can try Low Memory Mode, it's enabled with `--low-memory-mode=N` passed to `waf configure` where N is 1 or 2. Low Memory Mode 1 means that we will NOT break a network compatibility. 2 is deeper and doesn't guarantee protocol compatibility and available multiplayer. Of course, with Low Memory Mode 2 you can't test your port dedicated server.
If you got anything compiling, it's nice time to make a commit. Commit your changes into git and push them somewhere(GitHub, GitLab or what you prefer), so you will not lose them accidentally.
4) Here is most interesting, building the client part.
There are three possible situations for you, by increasing difficulty.
1. Do you have SDL2 for your platform? If yes, go ahead and compile engine with client part enabled.
2. Do you have SDL1.2 for your platform? If yes, try to compile it, but SDL1.2 support is very limited and not tested well.
3. You don't have SDL and you can't port it for some reason by yourself or SDL port just don't stable for your platform? Then you need to implement an engine backend.
How to implement engine backend? Well, we have a backends system that was introduced in Old Engine. It's simply two files: backends.h and defaults.h in `common` folder in repository root. You will need to add a macros for your backends in `backends.h` and define a logic in `defaults.h`. We have already have some, check them out, as they may be handy for you.
Once you did it, go back to `platform` directory and open `platform.h` headers. Create new subdirectory in `platform` folder and start implementing missing platform-specific backends one by one. I can't explain this as for obvious reasons it's too specific. You can use macros you defined before in `build.h` to check that you're compiling for your platform and `backends.h` macros to check if platform-specific backend must be enabled.
As you finished, compile engine, fix errors and commit your changes and push to repository.
Remember, if something doesn't work and you can't figure out why, you can join our Discord server at discord.me/fwgs. Ping me (@a1batross) or other engine developer and attach link to your repository, so we can discuss and help you in porting.

View File

@@ -0,0 +1,68 @@
## Console variables
Console variables (or CVars) are present in all quake-based games.
By default, it is settings, created by engine, server or client libraries.
But you can use `set` command to define variables even if they are not created by the engine.
For example, you can set cvar before it is registered in code.
`set defaultmap crossfire`
This works even in server.cfg before server cvars initialization and the engine will reuse its value on cvar creation
## Aliases
An alias allows to define new commands.
`alias wnext "invnext;wait;wait;+attack;wait;-attack"`
You can hook any command by adding an alias to it and unaliasing it, when you want to use original command.
```
alias invnext1 "unalias invnext;wnext;alias invnext invnext1"
alias invnext invnext1
```
## Scripting extensions
This is an extensions of Xash3D FWGS(merged to original Xash3D since build 3887), that can be enabled by cmd_scripting cvar.
Enabling scripting: `cmd_scripting 1`
This is an archive cvar and it will be saved.
### CVar substitution
You can substitute cvar value to any command by adding \$ symbol:
`echo $sv_cheats`
### Condition checking
Allows checking cvar values.
```
if <value1> <operator> <value2>
:<action1>
:if <value3>
::<action2>
:<action3>
else
:<action4>
```
* Values are any string or numeric values (for example, substituted cvars).
* Operator is = (or ==), \!=, \<, \>, \<=, \>=. == is same to =.
* If single value specified, condition is true when value is non-zero
Example:
```
if $sv_cheats == 1
:echo Cheats enabled, adding cheat menu
:exec cheatmenu.cfg
else
:echo Please enable cheats to use this!
```

View File

@@ -0,0 +1,48 @@
## Цель
На текущий момент клиенты имеют некоторые части платформозависимого кода внутри себя. Это плохо, т.к. мы не можем использовать одинаковые функции (если не перепишем почти половину кода SDL) на разных платформах.
## Клиентская часть
* Клиент будет иметь возможность полностью реализовать touch-ввод. Отрисовка может быть произведена через HUD.
* Клиент получит простые события движения и обзора от движка
### Клиентская реализация
#### Клиент будет экспортировать некоторые функции движку (опционально):
* `int IN_ClientTouchEvent ( int fingerID, float x, float y, float dx, float dy );`
Вернёт 1 если касание активно, иначе 0.
* `void IN_ClientMoveEvent ( float forwardmove, float sidemove );`
Клиент будет накапливать значения величин для команд движения перед созданием команд и очищать их при CreateMove.
* `void IN_ClientLookEvent ( float relyaw, float relpitch );`
Клиент будет вращать камерой когда нужно, прямо как в реализации мыши
## Движковая часть
* Движок будет управлять событиями платформы и вызывать клиентские функции
* Движок реализует стандартную систему взгляда и движения если её нет в клиенте
### Движковая реализация
#### События касания
Перед вызовом ClientMove движок обязан получить события о касании.
Если из клиента экспортирована функция IN_ClientTouchEvent, событие будет отправлено клиенту.
Иначе, движок будет рисовать свой touch-интерфейс.
#### Другие события
Интерфейс прикосновений и код джойстика в движке будут генерировать следующие два типа событий:
* События движения (функция IN_ClientMoveEvent)
* События просмотра (функция IN_ClientLookEvent)
Если клиент экспортирует эти функции, события будут отправляться клиенту перед CreateMove
Иначе события просмотра будут происходить перед CreateMove, но после MoveEvent. Они будут применены к генерируемым командам

View File

@@ -0,0 +1,48 @@
## Purpose
Clients have different platform-depended input code now.
It is bad because we cannot use same functions (if we won't rewrite almost half of SDL) on different platforms.
## Client part
* Client will have ability to fully implement touch input. Drawing may be done by HUD.
* Client will receive basic motion and look events from engine
### Client implementation
#### Client will optionally export some functions to Engine:
* `int IN_ClientTouchEvent ( int fingerID, float x, float y, float dx, float dy );`
Return 1 if touch is active, 0 otherwise.
* `void IN_ClientMoveEvent ( float forwardmove, float sidemove );`
Client wil accumulate move values before creating commands and flush it on CreateMove.
* `void IN_ClientLookEvent ( float relyaw, float relpitch );`
Client will rotate camera when needed as in mouse implementation
## Engine part
* Engine will handle platform events and call client functions.
* Engine will implement fallback look and movement system when client interface not present
### Engine implementation
#### Touch events
Before calling ClientMove engine must get touch events.
If client exported IN_ClientTouchEvent, event will be sent to client.
Otherwise engine will draw own touch interface.
#### Other events
Engine touch interface and joystick support code will generate two types of events:
* Move events (IN_ClientMoveEvent function)
* Look events (IN_ClientLookEvent function)
If client exported these functions, events will be sent to client before CreateMove
Otherwise Look Event will be processed before CreateMove, but MoveEvent after. It will be applied to generated command

View File

@@ -0,0 +1,41 @@
I propose a new library naming scheme, which will allow to distribute mods and games in single archive to different operating systems and CPUs:
Legend:
* $os -- Q_buildos() return value, in lower case.
* $arch -- Q_buildarch() return value, in lower case.
* $ext -- OS-specific extension: dll, so, dylib, etc.
The scheme will be:
1. Client library:
* ```client.$ext``` for **Win/Lin/Mac** with **x86**.
* ```client_$arch.$ext``` for **Win/Lin/Mac** with **NON-x86**.
* ```client_$os_$arch.$ext``` for everything else.
2. Menu library:
* ```menu.$ext``` for **Win/Lin/Mac** with **x86**.
* ```menu_$arch.$ext``` for **Win/Lin/Mac** with **NON-x86**.
* ```menu_$os_$arch.$ext``` for everything else.
3. Server library:
* On **Win/Lin/Mac** with **x86**, it **MUST** use the raw gamedll name for corresponding OS field from `gameinfo.txt`.
* On **Win/Lin/Mac** with **NON-x86**, it **MUST** use the raw gamedll name for corresponding OS field from `gameinfo.txt`, but append ```_$arch``` before file extension. Like: ```hl_amd64.so``` or ```cs_e2k.so```.
* On everything else, it must use gamedll name from ```gamedll_linux``` field, but append ```_$os_$arch``` before file extension. Like: ```hl_haiku_amd64.so``` or ```cs_freebsd_armhf.so```.
Why ```gamedll_linux``` and not ```gamedll```? Because it looks more logic that way, most operating systems are *nix-like and share code with Linux, rather than Windows.
4. Refresh library: not needed, as RefAPI is not stable and it's not intended to distribute with mods.
For any libraries distributed **with** engine, naming scheme should be used more convenient for OS port.
Issue #0. Inconsistency between ABI and Q_buildarch.\
Resolution: Change Q_buildarch return value to use Debian-styled architectures list: https://www.debian.org/ports/, which includes a special naming for big/little-endian and hard/soft-float ARM.
Issue #1: Build-system integration.\
Resolution: implemented as [LibraryNaming.cmake](https://github.com/FWGS/hlsdk-xash3d/blob/master/cmake/LibraryNaming.cmake) and [library_naming.py](https://github.com/FWGS/hlsdk-xash3d/blob/master/scripts/waifulib/library_naming.py) extensions, see
Issue #2(related to #0): Which ARM flavours we actually need to handle?\
Resolution: Little-endian only, as there is no known big-endian ARM platforms in the wild.
Architecture is coded this way:
* ```armvxy```, where `x` is ARM instruction set level and `y` is hard-float ABI presence: `hf` where hard float ABI used, otherwise `l`.
See discussion: https://github.com/FWGS/xash3d-fwgs/issues/39

View File

@@ -0,0 +1,75 @@
# Server porting
Original valve's server code was compatible with linux and gcc 2.x.
Newer gcc versions have restriction which breaks build.
Now, to make it building with gcc 4.x, you need do following:
* Go to cbase.h and redefine macros as following
```
#define SetThink( a ) m_pfnThink = static_cast <void (CBaseEntity::*)(void)> (&a)
#define SetTouch( a ) m_pfnTouch = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (&a)
#define SetUse( a ) m_pfnUse = static_cast <void (CBaseEntity::*)( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )> (&a)
#define SetBlocked( a ) m_pfnBlocked = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (&a)
#define ResetThink( ) m_pfnThink = static_cast <void (CBaseEntity::*)(void)> (NULL)
#define ResetTouch( ) m_pfnTouch = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (NULL)
#define ResetUse( ) m_pfnUse = static_cast <void (CBaseEntity::*)( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )> (NULL)
#define ResetBlocked( ) m_pfnBlocked = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (NULL)
...
#define SetMoveDone( a ) m_pfnCallWhenMoveDone = static_cast <void (CBaseToggle::*)(void)> (&a)
```
* Replace all SetThink(NULL), SetTouch(NULL), setUse(NULL) and SetBlocked(NULL) by ResetThink(), ResetTouch(), ResetUse() and ResetBlocked()
* Sometimes you may need to add #include <ctype.h> if functions tolower or isspace are missing
# Client porting
## VGUI library
Valve's client uses vgui library which is available only on x86 systems and has big amount of mistakes in headers. The best and simplest way of porting is removing VGUI dependency at all.
Most singleplayer mods don't really use VGUI at all. It is used in multiplayer only to show score table and MOTD window
## Porting
### First strategy: full port
#### Basic port (Stage 1)
* First, remove all files and headers which use vgui (contains "vgui" in file name).
* After that, try to build it and remove vgui includes.
* Remove all gViewPort usings.
* Remove all CVoiceManager usings (xash3d does not support voice)
* Redefine all DLLEXPORT defines as empty field (Place it under _WIN32 macro if you want to keep windows compatibility).
* Remove hud_servers.cpp and Servers_Init/Servers_Shutdown from hud.cpp
* Fix CAPS filenames in includes (like STDIO.H, replace by stdio.h).
* Replace broken macros as DECLARE_MESSAGE, DECLARE_COMMAND by fixed examples from our hlsdk-xash3d port (cl_util.h)
* Add ctype.h where it is need (tolower, isspace functions)
* Add string.h where it is need (memcpy, strcpy, etc)
* Use in_defs.h from hlsdk_client
* Add scoreboard_stub.cpp and input_stub.cpp from hlsdk-xash3d to fix linking.
Now your client should be able to build and work correctly. Add input_xash3d.cpp from hlsdk-xash3d project to fix input.
#### Multiplayer fix (Stage 2)
Look at hlsdk-xash3d project.
Main changes are:
* Add MOTD.cpp, scoreboard.cpp and input_xash3d.cpp
* Add missing functions to hud_redraw.cpp, hud.cpp and tri.cpp, fix class defination in hud.h
* Remove duplicate functions from hud.cpp and HOOK_MESSAGE's for it
* Remove +showscores/-showscores hooks from input.h
* Fix cl_util.h
### Second way: move mod to hlsdk-xash3d
Look at changes you made in client.
If there are not much changes (for example, only some weapons was add), add these changes in hlsdk-xash3d.
You may use diff with original HLSDK you used and apply it as patch to hlsdk-xash3d.
Files must have same line endings (use dos2unix on all files).
I recommend to enable ignoring space changes in diff.
### Writing Makefiles
Use Makefile from hlsdk-xash3d as Makefile example.
Get .c and .cpp file lists from Visual Studio project and fill SRCS and SRCS_C variables to Makefile.
Remove all files containing vgui in name from list, add missing include dirs.
Do same for Android.mk if you are building for android.

36
Documentation/ports.md Normal file
View File

@@ -0,0 +1,36 @@
Xash3D FWGS is intended to be easily ported to specific platform, however main issue is maintaining such ports.
This page is about merged ports to main source tree and responsible for it developers.
For porting guidelines, look here(TODO!)
Status:
* **Supported**: active, confirmed to be fully functional.
* **In progress**: active, under development.
* **Incomplete**: not active, but some work was accepted to main repository before
* **Old Engine**: port was for old engine fork
* **Not maintained**: lack of human resources
* **Not merged**: was done in third-party fork, real status unknown
* **Deprecated**: not supported anymore
Table is sorted by status.
| Platform | Status | Maintainer | Note
| -------- | ------ | ---------- | ----
| Windows | Supported | @a1batross |
| Linux(x86) | Supported | @a1batross, @mittorn |
| Linux(amd64) | Supported | @mittorn |
| *BSD | Supported | @nekonomicon |
| Linux(arm) | Supported | @a1batross, @mittorn |
| Android | Supported | @a1batross, @mittorn |
| MotoMAGX | Supported | @a1batross |
| Linux(elbrus) | In progress | @a1batross, @mittorn | Rare and eventual access to e2k machine
| Android/Linux(aarch64) | In progress | @a1batross |
| Linux(mipsel) | In progress | @mittorn |
| Haiku | Incomplete, Old Engine | not maintained |
| Emscripten | Incomplete, Old Engine | not maintained |
| PSVita | Not merged, Old Engine | not maintained | [GitHub Repository](https://github.com/fgsfdsfgs/vitaXash3D)
| Switch | Not merged, Old Engine | not maintained | [GitHub Repository](https://github.com/switchports/xash3d-switch)
| 3DS | Not merged, Old Engine | not maintained | [GitHub Repository](https://github.com/masterfeizz/Xash3DS)
| macOS | Deprecated | not maintained | See GitHub issue #61
| iOS | Deprecated | not maintained | See GitHub issue #61

View File

@@ -0,0 +1,15 @@
As online community is growing, we don't want to keep bad or invalid servers on the Internet Games list. It's a common rules for all Xash3D server owners who are using default master server.
1. Breaking master server or clients is prohibited in any way. If you found a serious bug, contact us at contact 'at' fwgs.ru or post an issue at GitHub.
2. Changing settings, exploiting vulnerabilities of clients is prohibited in any way. If you found a serious bug, contact us at contact 'at' fwgs.ru or post an issue at GitHub.
2. Agressive advertisement and spam on other servers is prohibited in any way.
3. If your server is require downloading custom content, it should be available for everyone. Recommended way to deliver custom content is FastDL.
4. It's recommended to keep your server is up-to-date. You may use our public Debian/Ubuntu/Arch Linux [repository](https://github.com/FWGS/xash3d/wiki/How-to-set-up-a-Xash3D-Dedicated-Server-on-Debian-or-Ubuntu) to simplify updating process.
Just follow these rules to not get banned on our master server. Good luck, have fun!

File diff suppressed because it is too large Load Diff

93
README.md Normal file
View File

@@ -0,0 +1,93 @@
# Xash3D FWGS Engine
[![Build Status](https://api.travis-ci.org/FWGS/xash3d-fwgs.svg?branch=master)](https://travis-ci.org/FWGS/xash3d-fwgs) [![Discord Server](https://img.shields.io/discord/355697768582610945.svg)](https://discord.gg/TbnHcVb)
Xash3D FWGS is a fork of Xash3D Engine by Unkle Mike with extended features and crossplatform.
```
Xash3D is a game engine, aimed to provide compatibility with Half-Life Engine,
as well as to give game developers well known workflow and extend it.
Read more about Xash3D on ModDB: https://www.moddb.com/engines/xash3d-engine
```
Latest release build: https://github.com/FWGS/xash3d-fwgs/releases/latest
Latest development build: https://github.com/FWGS/xash3d-deploy/tree/newengine-master
## Fork features
* HLSDK 2.4 support.
* Crossplatform: officially supported x86 and ARM on Windows/Linux/BSD/Android. (see Documentation/ports.md for more info)
* Modern compilers support: say no more to MSVC6.
* Better multiplayer support: multiple master servers, headless dedicated server.
* Mobility API: allows better game integration on mobile devices(vibration, touch controls)
* Different input methods: touch, gamepad and classic mouse & keyboard.
* TrueType font rendering, as a part of mainui_cpp.
* Multiple renderers support(OpenGL, GLES, Software)
* A set of small improvements, without broken compatibility.
## Planned fork features
* Virtual Reality support and game API
* Voice support
* Vulkan renderer
## Contributing
* Before sending an issue, check if someone already reported your issue. Make sure you're following "How To Ask Questions The Smart Way" guide by Eric Steven Raymond. Read more: http://www.catb.org/~esr/faqs/smart-questions.html
* Before sending a PR, check if you followed our coding guide in CODING_STYLE.md file.
## Build instructions
We are using Waf build system. If you have some Waf-related questions, I recommend you to read https://waf.io/book/
If you're stuck somewhere and you need a clear example, read `.travis.yml` and `scripts/build*.sh`.
### Prerequisites
#### Windows(Visual Studio)
* Install Visual Studio.
* Install latest [Python](https://python.org) **OR** run `cinst python.install` if you have Chocolatey.
* Install latest [Git](https://git-scm.com/download/win) **OR** run `cinst git.install` if you have Chocolatey.
* Download [SDL2](https://libsdl.org/download-2.0.php) development package for Visual Studio.
* Clone this repository: `git clone --recursive https://github.com/FWGS/xash3d-fwgs`.
* Make sure you have at least 12GB of free space to store all build-time dependencies: ~10GB for Visual Studio, 300 MB for Git, 100 MB for Python and other.
#### GNU/Linux
NOTE FOR USERS WITH X86 COMPATIBLE CPUs:
We have forced build system to throw an error, if you're trying to build 64-bit engine. This done for keeping compatibility with Steam releases of Half-Life and based on it's engine games.
Even if Xash3D FWGS does support targetting 64-bit, you can't load games without recompiling them from source code!
##### Debian/Ubuntu
* Enable i386 on your system, if you're compiling 32-bit engine on amd64. If not, skip this
`$ sudo dpkg --add-architecture i386`
* Install development tools
* For 32-bit engine on amd64:
`$ sudo apt install build-essential gcc-multilib g++-multilib python libsdl2-dev:i386 libfontconfig-dev:i386 libfreetype6-dev:i386`
* For everything else:
`$ sudo apt install build-essential python libsdl2-dev libfontconfig-dev libfreetype6-dev`
* Clone this repostory:
`$ git clone --recursive https://github.com/FWGS/xash3d-fwgs`
#### ArchLinux
* ArchLinux users are lucky enough and there is a `xash3d-git` AUR package for them.
### Building
#### Windows(Visual Studio)
0) Open command line
1) Navigate to `xash3d-fwgs` directory.
2) Carefully examine which build options are available: `waf --help`
3) Configure build: `waf configure -T release --sdl2=c:/path/to/SDL2 --prefix=c:/path/to/any/output/directory`
4) Compile: `waf build`
5) Install: `waf install`
#### Linux
0) Examine which build options are available: `./waf --help`
1) Configure build: `./waf configure -T release --prefix=/path/to/any/output/directory`
(To compile 64-bit engine on 64-bit x86 processor, you need to pass `-8` also)
2) Compile: `./waf build`
3) 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.

54
common/backends.h Normal file
View File

@@ -0,0 +1,54 @@
/*
backends.h - backend macro definitions
Copyright (C) 2016 Mittorn
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.
*/
#ifndef BACKENDS_H
#define BACKENDS_H
// video backends (XASH_VIDEO)
#define VIDEO_NULL 0
#define VIDEO_SDL 1
#define VIDEO_ANDROID 2
#define VIDEO_FBDEV 3
// audio backends (XASH_SOUND)
#define SOUND_NULL 0
#define SOUND_SDL 1
#define SOUND_OPENSLES 2
#define SOUND_ALSA 3
// crash handler (XASH_CRASHHANDLER)
#define CRASHHANDLER_NULL 0
#define CRASHHANDLER_UCONTEXT 1
#define CRASHHANDLER_DBGHELP 2
#define CRASHHANDLER_WIN32 3
// input (XASH_INPUT)
#define INPUT_NULL 0
#define INPUT_SDL 1
#define INPUT_ANDROID 2
#define INPUT_EVDEV 3
// timer (XASH_TIMER)
#define TIMER_NULL 0 // not used
#define TIMER_SDL 1
#define TIMER_LINUX 2
#define TIMER_WIN32 3
// messageboxes (XASH_MESSAGEBOX)
#define MSGBOX_STDERR 0
#define MSGBOX_SDL 1
#define MSGBOX_ANDROID 2
#define MSGBOX_WIN32 3
#endif /* BACKENDS_H */

View File

@@ -57,4 +57,4 @@ struct beam_s
struct particle_s *particles;
};
#endif//BEAMDEF_H
#endif//BEAMDEF_H

View File

@@ -22,4 +22,4 @@ typedef struct
vec3_t origin;
} boneinfo_t;
#endif//BONEINFO_H
#endif//BONEINFO_H

View File

@@ -321,4 +321,4 @@ typedef struct
int lightofs; // start of [numstyles*surfsize] samples
} dface32_t;
#endif//BSPFILE_H
#endif//BSPFILE_H

View File

@@ -102,4 +102,4 @@ struct cl_entity_s
colorVec cvFloorColor;
};
#endif//CL_ENTITY_H
#endif//CL_ENTITY_H

110
common/com_image.h Normal file
View File

@@ -0,0 +1,110 @@
#pragma once
/*
========================================================================
internal image format
typically expanded to rgba buffer
NOTE: number at end of pixelformat name it's a total bitscount e.g. PF_RGB_24 == PF_RGB_888
========================================================================
*/
#define ImageRAW( type ) (type == PF_RGBA_32 || type == PF_BGRA_32 || type == PF_RGB_24 || type == PF_BGR_24 || type == PF_LUMINANCE)
#define ImageDXT( type ) (type == PF_DXT1 || type == PF_DXT3 || type == PF_DXT5 || type == PF_ATI2)
typedef enum
{
PF_UNKNOWN = 0,
PF_INDEXED_24, // inflated palette (768 bytes)
PF_INDEXED_32, // deflated palette (1024 bytes)
PF_RGBA_32, // normal rgba buffer
PF_BGRA_32, // big endian RGBA (MacOS)
PF_RGB_24, // uncompressed dds or another 24-bit image
PF_BGR_24, // big-endian RGB (MacOS)
PF_LUMINANCE,
PF_DXT1, // s3tc DXT1 format
PF_DXT3, // s3tc DXT3 format
PF_DXT5, // s3tc DXT5 format
PF_ATI2, // latc ATI2N format
PF_TOTALCOUNT, // must be last
} pixformat_t;
typedef struct bpc_desc_s
{
int format; // pixelformat
char name[16]; // used for debug
uint glFormat; // RGBA format
int bpp; // channels (e.g. rgb = 3, rgba = 4)
} bpc_desc_t;
// imagelib global settings
typedef enum
{
IL_USE_LERPING = BIT(0), // lerping images during resample
IL_KEEP_8BIT = BIT(1), // don't expand paletted images
IL_ALLOW_OVERWRITE = BIT(2), // allow to overwrite stored images
IL_DONTFLIP_TGA = BIT(3), // Steam background completely ignore tga attribute 0x20 (stupid lammers!)
IL_DDS_HARDWARE = BIT(4), // DXT compression is support
IL_LOAD_DECAL = BIT(5), // special mode for load gradient decals
IL_OVERVIEW = BIT(6), // overview required some unque operations
} ilFlags_t;
// goes into rgbdata_t->encode
#define DXT_ENCODE_DEFAULT 0 // don't use custom encoders
#define DXT_ENCODE_COLOR_YCoCg 0x1A01 // make sure that value dosn't collide with anything
#define DXT_ENCODE_ALPHA_1BIT 0x1A02 // normal 1-bit alpha
#define DXT_ENCODE_ALPHA_8BIT 0x1A03 // normal 8-bit alpha
#define DXT_ENCODE_ALPHA_SDF 0x1A04 // signed distance field
#define DXT_ENCODE_NORMAL_AG_ORTHO 0x1A05 // orthographic projection
#define DXT_ENCODE_NORMAL_AG_STEREO 0x1A06 // stereographic projection
#define DXT_ENCODE_NORMAL_AG_PARABOLOID 0x1A07 // paraboloid projection
#define DXT_ENCODE_NORMAL_AG_QUARTIC 0x1A08 // newton method
#define DXT_ENCODE_NORMAL_AG_AZIMUTHAL 0x1A09 // Lambert Azimuthal Equal-Area
// rgbdata output flags
typedef enum
{
// rgbdata->flags
IMAGE_CUBEMAP = BIT(0), // it's 6-sides cubemap buffer
IMAGE_HAS_ALPHA = BIT(1), // image contain alpha-channel
IMAGE_HAS_COLOR = BIT(2), // image contain RGB-channel
IMAGE_COLORINDEX = BIT(3), // all colors in palette is gradients of last color (decals)
IMAGE_HAS_LUMA = BIT(4), // image has luma pixels (q1-style maps)
IMAGE_SKYBOX = BIT(5), // only used by FS_SaveImage - for write right suffixes
IMAGE_QUAKESKY = BIT(6), // it's a quake sky double layered clouds (so keep it as 8 bit)
IMAGE_DDS_FORMAT = BIT(7), // a hint for GL loader
IMAGE_MULTILAYER = BIT(8), // to differentiate from 3D texture
IMAGE_ONEBIT_ALPHA = BIT(9), // binary alpha
IMAGE_QUAKEPAL = BIT(10), // image has quake1 palette
// Image_Process manipulation flags
IMAGE_FLIP_X = BIT(16), // flip the image by width
IMAGE_FLIP_Y = BIT(17), // flip the image by height
IMAGE_ROT_90 = BIT(18), // flip from upper left corner to down right corner
IMAGE_ROT180 = IMAGE_FLIP_X|IMAGE_FLIP_Y,
IMAGE_ROT270 = IMAGE_FLIP_X|IMAGE_FLIP_Y|IMAGE_ROT_90,
IMAGE_EMBOSS = BIT(19), // apply emboss mapping
IMAGE_RESAMPLE = BIT(20), // resample image to specified dims
// reserved
// reserved
IMAGE_FORCE_RGBA = BIT(23), // force image to RGBA buffer
IMAGE_MAKE_LUMA = BIT(24), // create luma texture from indexed
IMAGE_QUANTIZE = BIT(25), // make indexed image from 24 or 32- bit image
IMAGE_LIGHTGAMMA = BIT(26), // apply gamma for image
IMAGE_REMAP = BIT(27), // interpret width and height as top and bottom color
} imgFlags_t;
typedef struct rgbdata_s
{
word width; // image width
word height; // image height
word depth; // image depth
uint type; // compression type
uint flags; // misc image flags
word encode; // DXT may have custom encoder, that will be decoded in GLSL-side
byte numMips; // mipmap count
byte *palette; // palette if present
byte *buffer; // image buffer
rgba_t fogParams; // some water textures in hl1 has info about fog color and alpha
size_t size; // for bounds checking
} rgbdata_t;

View File

@@ -16,11 +16,9 @@ GNU General Public License for more details.
#ifndef COM_MODEL_H
#define COM_MODEL_H
#include "xash3d_types.h"
#include "bspfile.h" // we need some declarations from it
typedef vec_t vec2_t[2];
typedef vec_t vec4_t[4];
/*
==============================================================================
@@ -232,7 +230,7 @@ typedef struct mextrasurf_s
int reserved[32]; // just for future expansions or mod-makers
} mextrasurf_t;
typedef struct msurface_s
struct msurface_s
{
int visframe; // should be drawn when node is crossed
@@ -264,7 +262,7 @@ typedef struct msurface_s
color24 *samples; // note: this is the actual lightmap data for this surface
decal_t *pdecals;
} msurface_t;
};
typedef struct hull_s
{
@@ -504,4 +502,36 @@ typedef struct
maliasframedesc_t frames[1]; // variable sized
} aliashdr_t;
#endif//COM_MODEL_H
// remapping info
#define SUIT_HUE_START 192
#define SUIT_HUE_END 223
#define PLATE_HUE_START 160
#define PLATE_HUE_END 191
#define SHIRT_HUE_START 16
#define SHIRT_HUE_END 32
#define PANTS_HUE_START 96
#define PANTS_HUE_END 112
// 1/32 epsilon to keep floating point happy
#define DIST_EPSILON (1.0f / 32.0f)
#define FRAC_EPSILON (1.0f / 1024.0f)
#define BACKFACE_EPSILON 0.01f
#define MAX_BOX_LEAFS 256
#define ANIM_CYCLE 2
#define MOD_FRAMES 20
#define MAX_DEMOS 32
#define MAX_MOVIES 8
#define MAX_CDTRACKS 32
#define MAX_CLIENT_SPRITES 256 // SpriteTextures
#define MAX_EFRAGS 8192 // Arcane Dimensions required
#define MAX_REQUESTS 64
#endif//COM_MODEL_H

View File

@@ -22,4 +22,4 @@ typedef struct con_nprint_s
float color[3]; // RGB colors ( 0.0 -> 1.0 scale )
} con_nprint_t;
#endif//CON_NPRINT_H
#endif//CON_NPRINT_H

View File

@@ -729,20 +729,11 @@ enum
typedef int func_t;
typedef int string_t;
typedef unsigned char byte;
typedef unsigned short word;
#include "xash3d_types.h"
#define Q_isspace( ch ) (ch < 32 || ch > 255)
#undef true
#undef false
#ifndef __cplusplus
typedef enum { false, true } qboolean;
#else
typedef int qboolean;
#endif
typedef struct
{
byte r, g, b;
@@ -778,4 +769,4 @@ typedef struct
int hitgroup; // 0 == generic, non zero is specific body part
} trace_t;
#endif//CONST_H
#endif//CONST_H

View File

@@ -28,7 +28,7 @@
#define FCVAR_MOVEVARS (1<<10) // this cvar is a part of movevars_t struct that shared between client and server
#define FCVAR_LATCH (1<<11) // notify client what this cvar will be applied only after server restart (but don't does more nothing)
#define FCVAR_GLCONFIG (1<<12) // write it into opengl.cfg
#define FCVAR_GLCONFIG (1<<12) // write it into <renderer>.cfg(see RefAPI)
#define FCVAR_CHANGED (1<<13) // set each time the cvar is changed
#define FCVAR_GAMEUIDLL (1<<14) // defined by the menu DLL
#define FCVAR_CHEAT (1<<15) // can not be changed if cheats are disabled
@@ -42,4 +42,4 @@ typedef struct cvar_s
struct cvar_s *next;
} cvar_t;
#endif//CVARDEF_H
#endif//CVARDEF_H

184
common/defaults.h Normal file
View File

@@ -0,0 +1,184 @@
/*
defaults.h - set up default configuration
Copyright (C) 2016 Mittorn
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.
*/
#ifndef DEFAULTS_H
#define DEFAULTS_H
#include "backends.h"
#include "build.h"
/*
===================================================================
SETUP BACKENDS DEFINITIONS
===================================================================
*/
#if !XASH_DEDICATED
#if XASH_SDL
// we are building using libSDL
#ifndef XASH_VIDEO
#define XASH_VIDEO VIDEO_SDL
#endif // XASH_VIDEO
#ifndef XASH_INPUT
#define XASH_INPUT INPUT_SDL
#endif // XASH_INPUT
#ifndef XASH_SOUND
#define XASH_SOUND SOUND_SDL
#endif // XASH_SOUND
#if XASH_SDL == 2
#ifndef XASH_TIMER
#define XASH_TIMER TIMER_SDL
#endif // XASH_TIMER
#ifndef XASH_MESSAGEBOX
#define XASH_MESSAGEBOX MSGBOX_SDL
#endif // XASH_MESSAGEBOX
#endif
#elif XASH_ANDROID
// we are building for Android platform, use Android APIs
#ifndef XASH_VIDEO
#define XASH_VIDEO VIDEO_ANDROID
#endif // XASH_VIDEO
#ifndef XASH_INPUT
#define XASH_INPUT INPUT_ANDROID
#endif // XASH_INPUT
#ifndef XASH_SOUND
#define XASH_SOUND SOUND_OPENSLES
#endif // XASH_SOUND
#ifndef XASH_MESSAGEBOX
#define XASH_MESSAGEBOX MSGBOX_ANDROID
#endif // XASH_MESSAGEBOX
#define XASH_USE_EVDEV
#elif XASH_LINUX
// we are building for Linux without SDL2, can draw only to framebuffer yet
#ifndef XASH_VIDEO
#define XASH_VIDEO VIDEO_FBDEV
#endif // XASH_VIDEO
#ifndef XASH_INPUT
#define XASH_INPUT INPUT_EVDEV
#endif // XASH_INPUT
#ifndef XASH_SOUND
#define XASH_SOUND SOUND_ALSA
#endif // XASH_SOUND
#define XASH_USE_EVDEV
#endif // XASH_LINUX
#endif // XASH_DEDICATED
//
// select messagebox implementation
//
#ifndef XASH_MESSAGEBOX
#if XASH_WIN32
#define XASH_MESSAGEBOX MSGBOX_WIN32
#else // !XASH_WIN32
#define XASH_MESSAGEBOX MSGBOX_STDERR
#endif // !XASH_WIN32
#endif // XASH_MESSAGEBOX
//
// select crashhandler based on defines
//
#ifndef XASH_CRASHHANDLER
#if XASH_WIN32 && defined(DBGHELP)
#define XASH_CRASHHANDLER CRASHHANDLER_DBGHELP
#elif XASH_LINUX || XASH_BSD
#define XASH_CRASHHANDLER CRASHHANDLER_UCONTEXT
#else // !(XASH_LINUX || XASH_BSD || XASH_WIN32)
#define XASH_CRASHHANDLER CRASHHANDLER_NULL
#endif // !(XASH_LINUX || XASH_BSD || XASH_WIN32)
#endif
//
// no timer - no xash
//
#ifndef XASH_TIMER
#if XASH_WIN32
#define XASH_TIMER TIMER_WIN32
#else // !XASH_WIN32
#define XASH_TIMER TIMER_LINUX
#endif // !XASH_WIN32
#endif
//
// fallback to NULL
//
#ifndef XASH_VIDEO
#define XASH_VIDEO VIDEO_NULL
#endif // XASH_VIDEO
#ifndef XASH_SOUND
#define XASH_SOUND SOUND_NULL
#endif // XASH_SOUND
#ifndef XASH_INPUT
#define XASH_INPUT INPUT_NULL
#endif // XASH_INPUT
/*
=========================================================================
Default build-depended cvar and constant values
=========================================================================
*/
#if XASH_MOBILE_PLATFORM
#define DEFAULT_TOUCH_ENABLE "1"
#define DEFAULT_M_IGNORE "1"
#else // !XASH_MOBILE_PLATFORM
#define DEFAULT_TOUCH_ENABLE "0"
#define DEFAULT_M_IGNORE "0"
#endif // !XASH_MOBILE_PLATFORM
#if XASH_ANDROID || XASH_IOS || XASH_EMSCRIPTEN
#define XASH_INTERNAL_GAMELIBS
// this means that libraries are provided with engine, but not in game data
// You need add library loading code to library.c when adding new platform
#endif // XASH_ANDROID || XASH_IOS || XASH_EMSCRIPTEN
// allow override for developer/debug builds
#ifndef DEFAULT_DEV
#define DEFAULT_DEV 0
#endif // DEFAULT_DEV
#ifndef DEFAULT_FULLSCREEN
#define DEFAULT_FULLSCREEN 1
#endif // DEFAULT_FULLSCREEN
#ifndef DEFAULT_ACCELERATED_RENDERER
#if XASH_MOBILE_PLATFORM
#define DEFAULT_ACCELERATED_RENDERER "gles1"
#else // !XASH_MOBILE_PLATFORM
#define DEFAULT_ACCELERATED_RENDERER "gl"
#endif // !XASH_MOBILE_PLATFORM
#endif // DEFAULT_ACCELERATED_RENDERER
#ifndef DEFAULT_SOFTWARE_RENDERER
#define DEFAULT_SOFTWARE_RENDERER "soft" // mittorn's ref_soft
#endif // DEFAULT_SOFTWARE_RENDERER
#endif // DEFAULTS_H

View File

@@ -24,4 +24,4 @@ typedef struct demo_api_s
void (*WriteBuffer)( int size, unsigned char *buffer );
} demo_api_t;
#endif//DEMO_API_H
#endif//DEMO_API_H

View File

@@ -28,4 +28,4 @@ typedef struct dlight_s
qboolean dark; // subtracts light instead of adding
} dlight_t;
#endif//DLIGHT_H
#endif//DLIGHT_H

View File

@@ -26,4 +26,4 @@ GNU General Public License for more details.
#define ENGINE_IMPROVED_LINETRACE (1<<6) // new traceline that tracing through alphatextures
#define ENGINE_COMPUTE_STUDIO_LERP (1<<7) // enable MOVETYPE_STEP lerping back in engine
#endif//FEATURES_H
#endif//FEATURES_H

View File

@@ -28,7 +28,7 @@ struct entity_state_s
// Fields which are filled in by routines outside of delta compression
int entityType;
// Index into cl_entities array for this entity.
int number;
int number;
float msg_time;
// Message number last time the player/entity state was updated.
@@ -71,7 +71,7 @@ struct entity_state_s
int owner;
// Friction, for prediction.
float friction;
float friction;
// Gravity multiplier
float gravity;
@@ -87,7 +87,7 @@ struct entity_state_s
// Use the crouched hull, or the regular player hull.
int usehull;
// Latched buttons last time state updated.
int oldbuttons;
int oldbuttons;
// -1 = in air, else pmove entity number
int onground;
int iStepLeft;
@@ -185,4 +185,4 @@ typedef struct local_state_s
weapon_data_t weapondata[MAX_LOCAL_WEAPONS];
} local_state_t;
#endif//ENTITY_STATE_H
#endif//ENTITY_STATE_H

View File

@@ -22,4 +22,4 @@
#define ET_BEAM 3
#define ET_FRAGMENTED 4 // BMODEL or SPRITE that was split across BSP nodes
#endif//ENTITY_TYPES_H
#endif//ENTITY_TYPES_H

View File

@@ -55,4 +55,4 @@ typedef struct event_api_s
void ( *EV_PopTraceBounds)( void );
} event_api_t;
#endif//EVENT_API_H
#endif//EVENT_API_H

View File

@@ -44,4 +44,4 @@ typedef struct event_args_s
int bparam2;
} event_args_t;
#endif//EVENT_ARGS_H
#endif//EVENT_ARGS_H

View File

@@ -42,4 +42,4 @@
// Only issue event client side ( from shared code )
#define FEV_CLIENT (1<<6)
#endif//EVENT_FLAGS_H
#endif//EVENT_FLAGS_H

View File

@@ -47,4 +47,4 @@ typedef struct
int gamemode;
} GAMEINFO;
#endif//GAMEINFO_H
#endif//GAMEINFO_H

View File

@@ -56,4 +56,4 @@
#define MAX_DIRECTOR_CMD_PARAMETERS 4
#define MAX_DIRECTOR_CMD_STRING 128
#endif//HLTV_H
#endif//HLTV_H

View File

@@ -35,4 +35,4 @@ typedef struct IVoiceTweak_s
float (*GetControlFloat)( VoiceTweakControl iControl );
} IVoiceTweak;
#endif//IVOICETWEAK_H
#endif//IVOICETWEAK_H

18
common/kbutton.h Normal file
View File

@@ -0,0 +1,18 @@
//========= Copyright <20> 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#if !defined( KBUTTONH )
#define KBUTTONH
#pragma once
typedef struct kbutton_s
{
int down[2]; // key nums holding it down
int state; // low bit is down state
} kbutton_t;
#endif // !KBUTTONH

View File

@@ -26,4 +26,4 @@ typedef struct
float time; // local time is gurantee what new style begins from the start, not mid or end of the sequence
} lightstyle_t;
#endif//LIGHTSTYLE_H
#endif//LIGHTSTYLE_H

View File

@@ -28,6 +28,7 @@
// kill the request hook after receiving the first response
#define FNETAPI_MULTIPLE_RESPONSE ( 1<<0 )
struct net_response_s;
typedef void (*net_api_response_func_t) ( struct net_response_s *response );
#define NET_SUCCESS ( 0 )
@@ -94,4 +95,4 @@ typedef struct net_api_s
void (*SetValueForKey)( char *s, const char *key, const char *value, int maxsize );
} net_api_t;
#endif//NET_APIH
#endif//NET_APIH

View File

@@ -34,4 +34,4 @@ typedef struct netadr_s
unsigned short port;
} netadr_t;
#endif//NETADR_H
#endif//NETADR_H

View File

@@ -50,4 +50,4 @@ typedef struct particle_s
unsigned char context;
} particle_t;
#endif//PARTICLEDEF_H
#endif//PARTICLEDEF_H

View File

@@ -38,4 +38,4 @@ struct pmtrace_s
int hitgroup;
};
#endif//PM_TRACE_H
#endif//PM_TRACE_H

141
common/port.h Normal file
View File

@@ -0,0 +1,141 @@
/*
port.h -- Portability Layer for Windows types
Copyright (C) 2015 Alibek Omarov
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.
*/
#pragma once
#ifndef PORT_H
#define PORT_H
#include "build.h"
#if !XASH_WIN32
#include <dlfcn.h>
#include <unistd.h>
#define PATH_SPLITTER "/"
#if XASH_APPLE
#include <sys/syslimits.h>
#include "TargetConditionals.h"
#define OS_LIB_EXT "dylib"
#define OPEN_COMMAND "open"
#else
#define OS_LIB_EXT "so"
#define OPEN_COMMAND "xdg-open"
#endif
#define OS_LIB_PREFIX "lib"
#if XASH_ANDROID
//#if defined(LOAD_HARDFP)
// #define POSTFIX "_hardfp"
//#else
#define POSTFIX
//#endif
#else
#endif
#define VGUI_SUPPORT_DLL "libvgui_support." OS_LIB_EXT
// Windows-specific
#define __cdecl
#define __stdcall
#define _inline static inline
#define FORCEINLINE inline __attribute__((always_inline))
#define O_BINARY 0 // O_BINARY is Windows extension
#define O_TEXT 0 // O_TEXT is Windows extension
// Windows functions to Linux equivalent
#define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH )
#define LoadLibrary( x ) dlopen( x, RTLD_NOW )
#define GetProcAddress( x, y ) dlsym( x, y )
#define SetCurrentDirectory( x ) (!chdir( x ))
#define FreeLibrary( x ) dlclose( x )
//#define MAKEWORD( a, b ) ((short int)(((unsigned char)(a))|(((short int)((unsigned char)(b)))<<8)))
#define max( a, b ) (((a) > (b)) ? (a) : (b))
#define min( a, b ) (((a) < (b)) ? (a) : (b))
#define tell( a ) lseek(a, 0, SEEK_CUR)
typedef unsigned char BYTE;
typedef short int WORD;
typedef unsigned int DWORD;
typedef int LONG;
typedef unsigned int ULONG;
typedef int WPARAM;
typedef unsigned int LPARAM;
typedef void* HANDLE;
typedef void* HMODULE;
typedef void* HINSTANCE;
typedef char* LPSTR;
typedef struct tagPOINT
{
int x, y;
} POINT;
#else // WIN32
#define PATH_SPLITTER "\\"
#ifdef __MINGW32__
#define _inline static inline
#define FORCEINLINE inline __attribute__((always_inline))
#else
#define FORCEINLINE __forceinline
#endif
#define open _open
#define read _read
#define alloca _alloca
// shut-up compiler warnings
#pragma warning(disable : 4244) // MIPS
#pragma warning(disable : 4018) // signed/unsigned mismatch
#pragma warning(disable : 4305) // truncation from const double to float
#pragma warning(disable : 4115) // named type definition in parentheses
#pragma warning(disable : 4100) // unreferenced formal parameter
#pragma warning(disable : 4127) // conditional expression is constant
#pragma warning(disable : 4057) // differs in indirection to slightly different base types
#pragma warning(disable : 4201) // nonstandard extension used
#pragma warning(disable : 4706) // assignment within conditional expression
#pragma warning(disable : 4054) // type cast' : from function pointer
#pragma warning(disable : 4310) // cast truncates constant value
#define HSPRITE WINAPI_HSPRITE
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
#undef HSPRITE
#define OS_LIB_PREFIX ""
#define OS_LIB_EXT "dll"
#define VGUI_SUPPORT_DLL "../vgui_support." OS_LIB_EXT
#ifdef XASH_64BIT
// windows NameForFunction not implemented yet
#define XASH_ALLOW_SAVERESTORE_OFFSETS
#endif
#endif //WIN32
#ifndef XASH_LOW_MEMORY
#define XASH_LOW_MEMORY 0
#endif
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#if defined XASH_SDL && !defined REF_DLL
#include <SDL.h>
#endif
#endif // PORT_H

View File

@@ -35,4 +35,4 @@ typedef struct qfont_s
byte data[4];
} qfont_t;
#endif//QFONT_H
#endif//QFONT_H

View File

@@ -84,7 +84,7 @@ color24 gTracerColors[] =
#define FTENT_CLIENTCUSTOM 0x00080000 // Must specify callback. Callback function is responsible for killing tempent and updating fields ( unless other flags specify how to do things )
#define FTENT_SCALE 0x00100000 // An experiment
typedef struct tempent_s TEMPENTITY;
struct pmtrace_s;
typedef struct tempent_s
{
int flags;
@@ -98,7 +98,7 @@ typedef struct tempent_s
int hitSound;
void (*hitcallback)( struct tempent_s *ent, struct pmtrace_s *ptr );
void (*callback)( struct tempent_s *ent, float frametime, float currenttime );
TEMPENTITY *next;
struct tempent_s *next;
int priority;
short clientIndex; // if attached, this is the index of the client to stick to
// if COLLIDEALL, this is the index of the client to ignore
@@ -117,58 +117,58 @@ typedef struct efx_api_s efx_api_t;
struct efx_api_s
{
particle_t *(*R_AllocParticle)( void (*callback)( struct particle_s *particle, float frametime ));
void (*R_BlobExplosion)( float *org );
void (*R_Blood)( float *org, float *dir, int pcolor, int speed );
void (*R_BloodSprite)( float *org, int colorindex, int modelIndex, int modelIndex2, float size );
void (*R_BloodStream)( float *org, float *dir, int pcolor, int speed );
void (*R_BreakModel)( float *pos, float *size, float *dir, float random, float life, int count, int modelIndex, char flags );
void (*R_Bubbles)( float *mins, float *maxs, float height, int modelIndex, int count, float speed );
void (*R_BubbleTrail)( float *start, float *end, float height, int modelIndex, int count, float speed );
void (*R_BulletImpactParticles)( float *pos );
void (*R_BlobExplosion)( const float *org );
void (*R_Blood)( const float *org, const float *dir, int pcolor, int speed );
void (*R_BloodSprite)( const float *org, int colorindex, int modelIndex, int modelIndex2, float size );
void (*R_BloodStream)( const float *org, const float *dir, int pcolor, int speed );
void (*R_BreakModel)( const float *pos, const float *size, const float *dir, float random, float life, int count, int modelIndex, char flags );
void (*R_Bubbles)( const float *mins, const float *maxs, float height, int modelIndex, int count, float speed );
void (*R_BubbleTrail)( const float *start, const float *end, float height, int modelIndex, int count, float speed );
void (*R_BulletImpactParticles)( const float *pos );
void (*R_EntityParticles)( struct cl_entity_s *ent );
void (*R_Explosion)( float *pos, int model, float scale, float framerate, int flags );
void (*R_FizzEffect)( struct cl_entity_s *pent, int modelIndex, int density );
void (*R_FireField)( float *org, int radius, int modelIndex, int count, int flags, float life );
void (*R_FlickerParticles)( float *org );
void (*R_FunnelSprite)( float *org, int modelIndex, int reverse );
void (*R_Implosion)( float *end, float radius, int count, float life );
void (*R_LargeFunnel)( float *org, int reverse );
void (*R_LavaSplash)( float *org );
void (*R_MultiGunshot)( float *org, float *dir, float *noise, int count, int decalCount, int *decalIndices );
void (*R_MuzzleFlash)( float *pos1, int type );
void (*R_ParticleBox)( float *mins, float *maxs, unsigned char r, unsigned char g, unsigned char b, float life );
void (*R_ParticleBurst)( float *pos, int size, int color, float life );
void (*R_ParticleExplosion)( float *org );
void (*R_ParticleExplosion2)( float *org, int colorStart, int colorLength );
void (*R_ParticleLine)( float *start, float *end, unsigned char r, unsigned char g, unsigned char b, float life );
void (*R_FlickerParticles)( const float *org );
void (*R_FunnelSprite)( const float *org, int modelIndex, int reverse );
void (*R_Implosion)( const float *end, float radius, int count, float life );
void (*R_LargeFunnel)( const float *org, int reverse );
void (*R_LavaSplash)( const float *org );
void (*R_MultiGunshot)( const float *org, const float *dir, const float *noise, int count, int decalCount, int *decalIndices );
void (*R_MuzzleFlash)( const float *pos1, int type );
void (*R_ParticleBox)( const float *mins, const float *maxs, unsigned char r, unsigned char g, unsigned char b, float life );
void (*R_ParticleBurst)( const float *pos, int size, int color, float life );
void (*R_ParticleExplosion)( const float *org );
void (*R_ParticleExplosion2)( const float *org, int colorStart, int colorLength );
void (*R_ParticleLine)( const float *start, const float *end, unsigned char r, unsigned char g, unsigned char b, float life );
void (*R_PlayerSprites)( int client, int modelIndex, int count, int size );
void (*R_Projectile)( float *origin, float *velocity, int modelIndex, int life, int owner, void (*hitcallback)( struct tempent_s *ent, struct pmtrace_s *ptr ) );
void (*R_RicochetSound)( float *pos );
void (*R_RicochetSprite)( float *pos, struct model_s *pmodel, float duration, float scale );
void (*R_RocketFlare)( float *pos );
void (*R_Projectile)( const float *origin, const float *velocity, int modelIndex, int life, int owner, void (*hitcallback)( struct tempent_s *ent, struct pmtrace_s *ptr ) );
void (*R_RicochetSound)( const float *pos );
void (*R_RicochetSprite)( const float *pos, struct model_s *pmodel, float duration, float scale );
void (*R_RocketFlare)( const float *pos );
void (*R_RocketTrail)( float *start, float *end, int type );
void (*R_RunParticleEffect)( float *org, float *dir, int color, int count );
void (*R_ShowLine)( float *start, float *end );
void (*R_SparkEffect)( float *pos, int count, int velocityMin, int velocityMax );
void (*R_SparkShower)( float *pos );
void (*R_SparkStreaks)( float *pos, int count, int velocityMin, int velocityMax );
void (*R_Spray)( float *pos, float *dir, int modelIndex, int count, int speed, int spread, int rendermode );
void (*R_RunParticleEffect)( const float *org, const float *dir, int color, int count );
void (*R_ShowLine)( const float *start, const float *end );
void (*R_SparkEffect)( const float *pos, int count, int velocityMin, int velocityMax );
void (*R_SparkShower)( const float *pos );
void (*R_SparkStreaks)( const float *pos, int count, int velocityMin, int velocityMax );
void (*R_Spray)( const float *pos, const float *dir, int modelIndex, int count, int speed, int spread, int rendermode );
void (*R_Sprite_Explode)( TEMPENTITY *pTemp, float scale, int flags );
void (*R_Sprite_Smoke)( TEMPENTITY *pTemp, float scale );
void (*R_Sprite_Spray)( float *pos, float *dir, int modelIndex, int count, int speed, int iRand );
void (*R_Sprite_Spray)( const float *pos, const float *dir, int modelIndex, int count, int speed, int iRand );
void (*R_Sprite_Trail)( int type, float *start, float *end, int modelIndex, int count, float life, float size, float amplitude, int renderamt, float speed );
void (*R_Sprite_WallPuff)( TEMPENTITY *pTemp, float scale );
void (*R_StreakSplash)( float *pos, float *dir, int color, int count, float speed, int velocityMin, int velocityMax );
void (*R_TracerEffect)( float *start, float *end );
void (*R_StreakSplash)( const float *pos, const float *dir, int color, int count, float speed, int velocityMin, int velocityMax );
void (*R_TracerEffect)( const float *start, const float *end );
void (*R_UserTracerParticle)( float *org, float *vel, float life, int colorIndex, float length, unsigned char deathcontext, void (*deathfunc)( struct particle_s *particle ));
particle_t *(*R_TracerParticles)( float *org, float *vel, float life );
void (*R_TeleportSplash)( float *org );
void (*R_TempSphereModel)( float *pos, float speed, float life, int count, int modelIndex );
TEMPENTITY *(*R_TempModel)( float *pos, float *dir, float *angles, float life, int modelIndex, int soundtype );
TEMPENTITY *(*R_DefaultSprite)( float *pos, int spriteIndex, float framerate );
TEMPENTITY *(*R_TempSprite)( float *pos, float *dir, float scale, int modelIndex, int rendermode, int renderfx, float a, float life, int flags );
void (*R_TeleportSplash)( const float *org );
void (*R_TempSphereModel)( const float *pos, float speed, float life, int count, int modelIndex );
TEMPENTITY *(*R_TempModel)( const float *pos, const float *dir, const float *angles, float life, int modelIndex, int soundtype );
TEMPENTITY *(*R_DefaultSprite)( const float *pos, int spriteIndex, float framerate );
TEMPENTITY *(*R_TempSprite)( float *pos, const float *dir, float scale, int modelIndex, int rendermode, int renderfx, float a, float life, int flags );
int (*Draw_DecalIndex)( int id );
int (*Draw_DecalIndexFromName)( char *name );
int (*Draw_DecalIndexFromName)( const char *name );
void (*R_DecalShoot)( int textureIndex, int entity, int modelIndex, float *position, int flags );
void (*R_AttachTentToPlayer)( int client, int modelIndex, float zoffset, float life );
void (*R_KillAttachedTents)( int client );
@@ -182,14 +182,14 @@ struct efx_api_s
BEAM *(*R_BeamRing)( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
dlight_t *(*CL_AllocDlight)( int key );
dlight_t *(*CL_AllocElight)( int key );
TEMPENTITY *(*CL_TempEntAlloc)( float *org, struct model_s *model );
TEMPENTITY *(*CL_TempEntAllocNoModel)( float *org );
TEMPENTITY *(*CL_TempEntAllocHigh)( float *org, struct model_s *model );
TEMPENTITY *(*CL_TentEntAllocCustom)( float *origin, struct model_s *model, int high, void (*callback)( struct tempent_s *ent, float frametime, float currenttime ));
TEMPENTITY *(*CL_TempEntAlloc)( const float *org, struct model_s *model );
TEMPENTITY *(*CL_TempEntAllocNoModel)( const float *org );
TEMPENTITY *(*CL_TempEntAllocHigh)( const float *org, struct model_s *model );
TEMPENTITY *(*CL_TentEntAllocCustom)( const float *origin, struct model_s *model, int high, void (*callback)( struct tempent_s *ent, float frametime, float currenttime ));
void (*R_GetPackedColor)( short *packed, short color );
short (*R_LookupColor)( unsigned char r, unsigned char g, unsigned char b );
void (*R_DecalRemoveAll)( int textureIndex ); // textureIndex points to the decal index in the array, not the actual texture index.
void (*R_FireCustomDecal)( int textureIndex, int entity, int modelIndex, float *position, int flags, float scale );
};
#endif//R_EFX_H
#endif//R_EFX_H

View File

@@ -26,7 +26,7 @@ typedef struct engine_studio_api_s
// Check to see if pointer is in the cache
void *( *Cache_Check )( struct cache_user_s *c );
// Load file into cache ( can be swapped out on demand )
void ( *LoadCacheFile )( char *path, struct cache_user_s *cu );
void ( *LoadCacheFile )( const char *path, struct cache_user_s *cu );
// Retrieve model pointer for the named model
struct model_s *( *Mod_ForName )( const char *name, int crash_if_missing );
// Retrieve pointer to studio model data block from a model
@@ -120,7 +120,7 @@ typedef struct server_studio_api_s
// Check to see if pointer is in the cache
void *( *Cache_Check )( struct cache_user_s *c );
// Load file into cache ( can be swapped out on demand )
void ( *LoadCacheFile )( char *path, struct cache_user_s *cu );
void ( *LoadCacheFile )( const char *path, struct cache_user_s *cu );
// Retrieve pointer to studio model data block from a model
void *( *Mod_Extradata )( struct model_s *mod );
} server_studio_api_t;
@@ -151,4 +151,4 @@ typedef struct sv_blending_interface_s
const edict_t *pEdict );
} sv_blending_interface_t;
#endif//R_STUDIOINT_H
#endif//R_STUDIOINT_H

View File

@@ -102,4 +102,4 @@ typedef struct ref_viewpass_s
int flags; // if !=0 nothing is drawn by the engine except clientDraw functions
} ref_viewpass_t;
#endif//REF_PARAMS_H
#endif//REF_PARAMS_H

View File

@@ -120,6 +120,7 @@ typedef enum
{
GLES_WRAPPER_NONE = 0, // native GLES
GLES_WRAPPER_NANOGL, // used on GLES platforms
GLES_WRAPPER_WES, // used on GLES platforms
} gles_wrapper_t;
// 30 bytes here
@@ -152,6 +153,8 @@ typedef struct decallist_s
modelstate_t studio_state; // studio decals only
} decallist_t;
struct ref_viewpass_s;
typedef struct render_api_s
{
// Get renderer info (doesn't changes engine state at all)
@@ -175,9 +178,9 @@ typedef struct render_api_s
const char* (*GL_TextureName)( unsigned int texnum );
const byte* (*GL_TextureData)( unsigned int texnum ); // may be NULL
int (*GL_LoadTexture)( const char *name, const byte *buf, size_t size, int flags );
int (*GL_CreateTexture)( const char *name, int width, int height, const void *buffer, int flags );
int (*GL_CreateTexture)( const char *name, int width, int height, const void *buffer, texFlags_t flags );
int (*GL_LoadTextureArray)( const char **names, int flags );
int (*GL_CreateTextureArray)( const char *name, int width, int height, int depth, const void *buffer, int flags );
int (*GL_CreateTextureArray)( const char *name, int width, int height, int depth, const void *buffer, texFlags_t flags );
void (*GL_FreeTexture)( unsigned int texnum );
// Decals manipulating (draw & remove)
@@ -219,7 +222,7 @@ typedef struct render_api_s
struct mstudiotex_s *( *StudioGetTexture )( struct cl_entity_s *e );
const struct ref_overview_s *( *GetOverviewParms )( void );
const char *( *GetFileByIndex )( int fileindex );
int (*pfnSaveFile)( const char *filename, const void *data, long len );
int (*pfnSaveFile)( const char *filename, const void *data, int len );
void (*R_Reserved0)( void );
// static allocations
@@ -228,14 +231,15 @@ typedef struct render_api_s
// engine utils (not related with render API but placed here)
char **(*pfnGetFilesList)( const char *pattern, int *numFiles, int gamedironly );
unsigned long (*pfnFileBufferCRC32)( const void *buffer, const int length );
unsigned int (*pfnFileBufferCRC32)( const void *buffer, const int length );
int (*COM_CompareFileTime)( const char *filename1, const char *filename2, int *iCompare );
void (*Host_Error)( const char *error, ... ); // cause Host Error
void* ( *pfnGetModel )( int modelindex );
float (*pfnTime)( void ); // Sys_DoubleTime
void (*Cvar_Set)( char *name, char *value );
void (*Cvar_Set)( const char *name, const char *value );
void (*S_FadeMusicVolume)( float fadePercent ); // fade background track (0-100 percents)
void (*SetRandomSeed)( long lSeed ); // set custom seed for RANDOM_FLOAT\RANDOM_LONG for predictable random
// a1ba: changed long to int
void (*SetRandomSeed)( int lSeed ); // set custom seed for RANDOM_FLOAT\RANDOM_LONG for predictable random
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 37
} render_api_t;
@@ -254,7 +258,7 @@ typedef struct render_interface_s
// clear decals by engine request (e.g. for demo recording or vid_restart)
void (*R_ClearStudioDecals)( void );
// grab r_speeds message
qboolean (*R_SpeedsMessage)( char *out, size_t size );
qboolean (*R_SpeedsMessage)( char *out, size_t size );
// alloc or destroy model custom data
void (*Mod_ProcessUserData)( struct model_s *mod, qboolean create, const byte *buffer );
// alloc or destroy entity custom data
@@ -269,4 +273,4 @@ typedef struct render_interface_s
void (*CL_UpdateLatchedVars)( struct cl_entity_s *e, qboolean reset );
} render_interface_t;
#endif//RENDER_API_H
#endif//RENDER_API_H

View File

@@ -26,4 +26,4 @@ typedef struct screenfade_s
int fadeFlags; // Fading flags
} screenfade_t;
#endif//SCREENFADE_H
#endif//SCREENFADE_H

View File

@@ -24,4 +24,4 @@ typedef struct mstudioevent_s
char options[64];
} mstudioevent_t;
#endif//STUDIO_EVENT_H
#endif//STUDIO_EVENT_H

View File

@@ -44,14 +44,14 @@ typedef struct triangleapi_s
void (*Color4f)( float r, float g, float b, float a );
void (*Color4ub)( unsigned char r, unsigned char g, unsigned char b, unsigned char a );
void (*TexCoord2f)( float u, float v );
void (*Vertex3fv)( float *worldPnt );
void (*Vertex3fv)( const float *worldPnt );
void (*Vertex3f)( float x, float y, float z );
void (*Brightness)( float brightness );
void (*CullFace)( TRICULLSTYLE style );
int (*SpriteTexture)( struct model_s *pSpriteModel, int frame );
int (*WorldToScreen)( float *world, float *screen ); // Returns 1 if it's z clipped
int (*WorldToScreen)( const float *world, float *screen ); // Returns 1 if it's z clipped
void (*Fog)( float flFogColor[3], float flStart, float flEnd, int bOn ); //Works just like GL_FOG, flFogColor is r/g/b.
void (*ScreenToWorld)( float *screen, float *world );
void (*ScreenToWorld)( const float *screen, float *world );
void (*GetMatrix)( const int pname, float *matrix );
int (*BoxInPVS)( float *mins, float *maxs );
void (*LightAtPoint)( float *pos, float *value );
@@ -59,4 +59,4 @@ typedef struct triangleapi_s
void (*FogParams)( float flDensity, int iFogSkybox );
} triangleapi_t;
#endif//TRIANGLEAPI_H
#endif//TRIANGLEAPI_H

View File

@@ -36,4 +36,4 @@ typedef struct usercmd_s
vec3_t impact_position;
} usercmd_t;
#endif//USERCMD_H
#endif//USERCMD_H

View File

@@ -83,4 +83,4 @@ typedef struct mip_s
unsigned int offsets[4]; // four mip maps stored
} mip_t;
#endif//WADFILE_H
#endif//WADFILE_H

View File

@@ -47,4 +47,4 @@ typedef struct weapon_data_s
float fuser4;
} weapon_data_t;
#endif//WEAPONINFO_H
#endif//WEAPONINFO_H

View File

@@ -21,4 +21,4 @@ typedef struct wrect_s
int left, right, top, bottom;
} wrect_t;
#endif//WRECT_H
#endif//WRECT_H

156
common/xash3d_types.h Normal file
View File

@@ -0,0 +1,156 @@
// basic typedefs
#ifndef XASH_TYPES_H
#define XASH_TYPES_H
#ifdef _WIN32
#include <wchar.h> // off_t
#endif // _WIN32
#include <sys/types.h> // off_t
typedef unsigned char byte;
typedef int sound_t;
typedef float vec_t;
typedef vec_t vec2_t[2];
typedef vec_t vec3_t[3];
typedef vec_t vec4_t[4];
typedef vec_t quat_t[4];
typedef byte rgba_t[4]; // unsigned byte colorpack
typedef byte rgb_t[3]; // unsigned byte colorpack
typedef vec_t matrix3x4[3][4];
typedef vec_t matrix4x4[4][4];
#undef true
#undef false
#ifndef __cplusplus
typedef enum { false, true } qboolean;
#else
typedef int qboolean;
#endif
#if _MSC_VER == 1200
typedef __int64 integer64; //msvc6
#elif defined (XASH_SDL) && !defined(REF_DLL)
typedef Uint64 integer64;
#else
typedef unsigned long long integer64;
#endif
typedef integer64 longtime_t;
#define MAX_STRING 256 // generic string
#define MAX_INFO_STRING 256 // infostrings are transmitted across network
#define MAX_SERVERINFO_STRING 512 // server handles too many settings. expand to 1024?
#define MAX_LOCALINFO_STRING 32768 // localinfo used on server and not sended to the clients
#define MAX_SYSPATH 1024 // system filepath
#define MAX_PRINT_MSG 8192 // how many symbols can handle single call of Con_Printf or Con_DPrintf
#define MAX_TOKEN 2048 // parse token length
#define MAX_MODS 512 // environment games that engine can keep visible
#define MAX_USERMSG_LENGTH 2048 // don't modify it's relies on a client-side definitions
#define BIT( n ) ( 1U << ( n ))
#define GAMMA ( 2.2f ) // Valve Software gamma
#define INVGAMMA ( 1.0f / 2.2f ) // back to 1.0
#define TEXGAMMA ( 0.9f ) // compensate dim textures
#define SetBits( iBitVector, bits ) ((iBitVector) = (iBitVector) | (bits))
#define ClearBits( iBitVector, bits ) ((iBitVector) = (iBitVector) & ~(bits))
#define FBitSet( iBitVector, bit ) ((iBitVector) & (bit))
#ifndef __cplusplus
#ifdef NULL
#undef NULL
#endif
#define NULL ((void *)0)
#endif
// color strings
#define IsColorString( p ) ( p && *( p ) == '^' && *(( p ) + 1) && *(( p ) + 1) >= '0' && *(( p ) + 1 ) <= '9' )
#define ColorIndex( c ) ((( c ) - '0' ) & 7 )
#if defined(__GNUC__)
#ifdef __i386__
#define EXPORT __attribute__ ((visibility ("default"),force_align_arg_pointer))
#define GAME_EXPORT __attribute((force_align_arg_pointer))
#else
#define EXPORT __attribute__ ((visibility ("default")))
#define GAME_EXPORT
#endif
#elif defined(_MSC_VER)
#define EXPORT __declspec( dllexport )
#define GAME_EXPORT
#else
#define EXPORT
#define GAME_EXPORT
#endif
#ifdef XASH_BIG_ENDIAN
#define LittleLong(x) (((int)(((x)&255)<<24)) + ((int)((((x)>>8)&255)<<16)) + ((int)(((x)>>16)&255)<<8) + (((x) >> 24)&255))
#define LittleLongSW(x) (x = LittleLong(x) )
#define LittleShort(x) ((short)( (((short)(x) >> 8) & 255) + (((short)(x) & 255) << 8)))
#define LittleShortSW(x) (x = LittleShort(x) )
_inline float LittleFloat( float f )
{
union
{
float f;
unsigned char b[4];
} dat1, dat2;
dat1.f = f;
dat2.b[0] = dat1.b[3];
dat2.b[1] = dat1.b[2];
dat2.b[2] = dat1.b[1];
dat2.b[3] = dat1.b[0];
return dat2.f;
}
#else
#define LittleLong(x) (x)
#define LittleLongSW(x)
#define LittleShort(x) (x)
#define LittleShortSW(x)
#define LittleFloat(x) (x)
#endif
typedef unsigned int dword;
typedef unsigned int uint;
typedef char string[MAX_STRING];
typedef struct file_s file_t; // normal file
typedef struct wfile_s wfile_t; // wad file
typedef struct stream_s stream_t; // sound stream for background music playing
typedef off_t fs_offset_t;
typedef struct dllfunc_s
{
const char *name;
void **func;
} dllfunc_t;
typedef struct dll_info_s
{
const char *name; // name of library
const dllfunc_t *fcts; // list of dll exports
qboolean crash; // crash if dll not found
void *link; // hinstance of loading library
} dll_info_t;
typedef void (*setpair_t)( const char *key, const void *value, void *buffer, void *numpairs );
// config strings are a general means of communication from
// the server to all connected clients.
// each config string can be at most CS_SIZE characters.
#if XASH_LOW_MEMORY == 0
#define MAX_QPATH 64 // max length of a game pathname
#elif XASH_LOW_MEMORY == 2
#define MAX_QPATH 32 // should be enough for singleplayer
#elif XASH_LOW_MEMORY == 1
#define MAX_QPATH 48
#endif
#define MAX_OSPATH 260 // max length of a filesystem pathname
#define CS_SIZE 64 // size of one config string
#define CS_TIME 16 // size of time string
#endif // XASH_TYPES_H

View File

@@ -0,0 +1,206 @@
#############################################
# Makefile.linux - linux makefile
# Copyright (C) 2017 mittorn
# 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.
##############################################
# Default options - optimized to debug on local machine
CC ?= gcc
CXX ?= g++
CFLAGS ?= -g -O1 -fsigned-char -Wall -Wextra -Wsign-compare -Wno-unknown-pragmas -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-variable
LDFLAGS =
LBITS := $(shell getconf LONG_BIT)
DEPS :=
XASH_COMMIT := $(firstword $(shell git rev-parse --short=6 HEAD) unknown)
ifeq ($(XASH_COMMIT),unknown)
$(warning You seems to build xash3d without git)
$(warning Please use git if you are going to publish your build)
endif
# Pass 64BIT=1 to make arguments to allow amd64 builds
ifneq ($(64BIT),1)
ifeq ($(LBITS),64)
LDFLAGS += -m32
CFLAGS += -m32
endif
endif
TOPDIR = $(PWD)/..
INCLUDES :=
XASH_SINGLE_BINARY ?= 1
INSTALL_DIR ?= ./install/
ifeq ($(NANOGL),1)
INCLUDES += -Inanogl -Inanogl/GL
endif
INCLUDES += -I/usr/include/SDL2 -Icommon -I../common -I. -I../pm_shared -Iclient -Iserver -Iclient/vgui -Icommon/sdl
#############################
# Preprocessor defines:
#############################
DEFINES =
# Specify commit hash in version string
DEFINES += -DXASH_BUILD_COMMIT=\"$(XASH_COMMIT)\"
# Only SDL backend exists on linux
ifeq ($(XASH_DEDICATED),1)
DEFINES += -DXASH_DEDICATED
else
DEFINES += -DXASH_SDL
LIBS += -lSDL2
endif
#############################################
# GL/GLES translators.
# You need clone it to engine folder to use
# Only one translator should be enabled
#############################################
ifeq ($(NANOGL),1)
DEFINES += -DXASH_NANOGL -D__MULTITEXTURE_SUPPORT__ -DEGL_LIB=\"libEGL.so\"
endif
ifeq ($(WES),1)
DEFINES += -DXASH_WES -D__MULTITEXTURE_SUPPORT__ -DEGL_LIB=\"libEGL.so\"
endif
ifeq ($(REGAL),1)
DEFINES += -DXASH_REGAL -D__MULTITEXTURE_SUPPORT__ -DEGL_LIB=\"regal/lib/linux-32/libRegal.so\"
LIBS += regal/lib/linux-32/libRegal.so
endif
# Some libc implementations cannot use libdl in static builds, so disable it by default
ifeq ($(XASH_STATIC),1)
ifneq ($(XASH_STATIC_LIBDL),1)
DEFINES += -DNO_LIBDL
endif
XASH_SINGLE_BINARY := 1
endif
ifneq ($(XASH_STATIC),1)
LIBS += -ldl
endif
ifeq ($(XASH_STATIC_LIBDL),1)
LIBS += -ldl
endif
LIBS += -lm -pthread
ifeq ($(XASH_SINGLE_BINARY),1)
DEFINES += -DSINGLE_BINARY
endif
# Collect files
SRCS_CPP =
SRCS = $(wildcard server/*.c) $(wildcard client/vgui/*.c) $(wildcard client/avi/*.c) $(wildcard common/*.c) $(wildcard common/imagelib/*.c) $(wildcard common/soundlib/*.c) $(wildcard common/soundlib/libmpg/*.c)
ifneq ($(XASH_DEDICATED),1)
SRCS += $(wildcard client/*.c)
SRCS += $(wildcard platform/sdl/*.c)
ifeq ($(WES),1)
SRCS += $(wildcard gl-wes-v2/src/*.c)
endif
ifeq ($(NANOGL),1)
SRCS_CPP += $(wildcard nanogl/*.cpp)
endif
endif
OBJS = $(patsubst %.c,obj/%.o,$(SRCS))
OBJS_CPP = $(patsubst %.cpp,obj/%.o,$(SRCS_CPP))
#################################
# Windows DLL loader
# Should be enabled only on i386 builds
#################################
LOADER :=
ifeq ($(XASH_DLL_LOADER),1)
DEFINES += -DDLL_LOADER
ifeq ($(XASH_SINGLE_BINARY),1)
LOADER = libloader.a
else
LOADER = libloader.so
endif
DEPS += $(LOADER)
LIBS += $(LOADER)
endif
# Rules for binaries
ifeq ($(XASH_SINGLE_BINARY),0)
BINARIES = libxash.so
libxash.so : $(OBJS) $(OBJS_CPP) $(DEPS)
$(CC) -fvisibility=hidden -o libxash.so $(LDFLAGS) -shared $(OBJS) $(OBJS_CPP) $(LIBS)
else
BINARIES = xash
xash: $(OBJS) $(OBJS_CPP) $(DEPS)
ifeq ($(XASH_STATIC),1)
$(CC) -o xash -static $(LDFLAGS) $(OBJS) $(OBJS_CPP) $(LIBS)
else
$(CC) -o xash -fvisibility=hidden $(LDFLAGS) $(OBJS) $(OBJS_CPP) $(LIBS)
endif
endif
ifeq ($(XASH_DLL_LOADER),1)
$(LOADER):
$(MAKE) -f ../loader/Makefile.linux -C ../loader $(LOADER)
cp ../loader/$(LOADER) .
endif
# Create dirs for object files
DIRS := obj obj/server obj/client/avi obj/client/vgui obj/common/sdl obj/common/imagelib obj/common/soundlib/libmpg obj/platform/sdl obj/nanogl
$(OBJS): | $(DIRS)
$(DIRS) :
mkdir -p $(DIRS)
# Object rules
obj/%.o : %.c
$(CC) $(CFLAGS) $(INCLUDES) $(DEFINES) -c "$<" -o "$@" -Wno-unused-result -fvisibility=hidden
obj/%.o : %.cpp
$(CXX) $(CFLAGS) $(INCLUDES) $(DEFINES) -c "$<" -o "$@"
default: $(BINARIES)
.PHONY: depend clean list install
clean:
$(RM) $(OBJS) $(OBJS_CPP) $(BINARIES) ../loader/*.o ../loader/*.a ../loader/*.so $(LOADER)
list:
@echo Sources:
@echo $(SRCS)
@echo C++ Sources:
@echo $(SRCS_CPP)
@echo Objects:
@echo $(OBJS) $(OBJS_CPP)
@echo Dirs:
@echo $(DIRS)
@echo Dependencies:
@echo $(DEPS)
# Simple install rule
install: $(BINARIES)
mkdir -p $(INSTALL_DIR)
ifeq ($(XASH_SINGLE_BINARY),1)
cp xash $(INSTALL_DIR)/xash_bin
else
cp libxash.so $(INSTALL_DIR)/
cp libloader.so $(INSTALL_DIR)/
endif

269
contrib/mittorn/README.md Normal file
View File

@@ -0,0 +1,269 @@
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
- [Building](#building)
- [Manual build (without CMake)](#manual-build-without-cmake)
- [Building Engine](#building-engine)
- [Building launch binary](#building-launch-binary)
- [Building on Windows](#building-on-windows)
- [Visual Studio 2013 (recommended for Windows)](#visual-studio-2013-recommended-for-windows)
- [Visual Studio 6](#visual-studio-6)
- [MinGW](#mingw)
- [Building Game mods](#building-game-mods)
- [Linux](#linux)
- [microndk](#microndk)
- [Makefile.linux](#makefile-linux)
- [Windows](#windows)
- [Running](#running)
- [Manual running](#manual-running)
- [Running with GDB](#running-with-gdb)
- [Using DLL Loader](#using-dll-loader)
- [Running MinGW builds](#running-mingw-builds)
- [Running MinGW builds under GDB](#running-mingw-builds-under-gdb)
# Building
## Manual build (without CMake)
### Building engine
Clone Xash3D repository using git:
git clone https://github.com/FWGS/xash3d
Move to the Xash3D folder:
cd xash3d/engine
make -f Makefile.linux XASH_VGUI=1
or same for dedicated
make -f Makefile.linux XASH_DEDICATED=1
To enable dll support on linux, build loader library:
cd ../loader
make -f Makefile.linux libloader.so libloader.a
cp libloader.so libloader.a ../engine/
And built engine with XASH_DLL_LOADER=1:
cd ../engine
make -f Makefile.linux XASH_VGUI=1 XASH_SDL=1 XASH_DLL_LOADER=1
or same for dedicated server
cd ../engine
make -f Makefile.linux XASH_DEDICATED=1 XASH_DLL_LOADER=1
### Building engine in separate library
Some old distros does not support hidden symbol visibility
This results in crash when loading server library
Building launch binary
cd (xash3d)/game_launch
gcc xash.c -o xash -ldl -lrt -lm
Building engine library:
make -f Makefile.linux XASH_SINGLE_BINARY=0
## Building on Windows
### Visual Studio 2013 (recommended for Windows)
Download latest prebuilt SDL2 from
https://www.libsdl.org/release/SDL2-devel-2.0.4-VC.zip
Unzip and rename `SDL2-2.0.4` folder to `SDL2` and put it next to xash3d project folder.
..\xash3d\
..\SDL2\
Open `xash.sln` with Visual Studio 2013 and make a build. After building, copy contents of `Debug` or
`Release` folder to directory you choose. Copy `valve` folder and `vgui.dll` from your Half Life game
installation folder and `SDL2.dll` form `\SDL2\lib\x86\` to it.
Move `vgui_support.dll` into `valve` folder.
..\valve\
..\valve\vgui_support.dll
..\menu.dll
..\SDL2.dll
..\vgui.dll
..\xash.dll
..\xash.exe
Now you good to go, just run `xash.exe`.
### Visual Studio 6
This is legacy configuration, but msvc6 seems to generate more stable and more effective code
Setup your msvc6 enviroment, unpack SDL2-2.0.4 to xash3d folder and do:
cd (xash3d)\engine
..\msvc6\build.bat
cd (xash3d)\game_launch
..\msvc6\build_launch.bat
### MinGW
The most effective configuration, but maybe unstable.
Setup your MinGW environment and run:
cd (xash3d)\engine\
CC=gcc mingw32-make -f Makefile.mingw
engine will be built to single exe binary
## Building game mods
### Linux
#### microndk
All mods that ported to android may be build to linux using Android.mk with microndk:
[https://github.com/SDLash3D/microndk]
Clone microndk repo somewhere, change xash3d_config to preffered configuration (change arch to x86
for example)
Go to dlls folder if you are building server or cl_dlls if you are building client and do:
make -f /path/to/microndk/microndk.mk -j4
Do:
make -f /path/to/microndk/microndk.mk -j4 clean
every time when you build client after building server
#### Makefile.linux
### Windows
On windows common way is using Visual Studio as many mods does not correctly work with mingw.
Just open project and build it.
Other is using mingw and microndk, but it was not tested yet.
hlsdk-xash3d based mods may work fine with mingw.
You may use microndk to build it. Build process is very similar to linux one.
After setting up MinGW enviroment, do:<br>
`mingw32-make -f \path\to\microndk\Microndk.mk`
to build 64-bit library, use:<br>
`mingw32-make -f \path\to\microndk\Microndk.mk 64BIT=1`
Edit xash3d_config.mk to set optimal CFLAGS if you are running server
# Running
Copy **valve** folder from Half-Life:
cp -r $HOME/.steam/steam/steamapps/common/Half-Life/valve $HOME/Games/Xash3D
**NOTE**: If you build with CMake, you can now use `make install`. It will install binaries where
they must be located. So just run `xash3d` from command line in directory where is gamedata is located.
For additional info look to the CMakeLists.txt in repo root and xash3d.sh script.
After a successful build, copy the next files to some other directory where you want to run Xash3D:
cp engine/libxash.so game_launch/xash3d mainui/libxashmenu.so $HOME/Games/Xash3D
If you built it with XASH_VGUI, also copy vgui.so:
cp ../hlsdk/linux/vgui.so vgui_support/libvgui_support.so $HOME/Games/Xash3D
Copy script:
cp ../xash3d.sh $HOME/Games/Xash3D
Run:
cd $HOME/Games/Xash3D
./xash3d.sh
## Manual running
Put xash3d binaries and vgui(optionally) to you game data directory and run:
LD_LIBRARY_PATH=. ./xash -dev 5
## Running under GDB
LD_LIBRARY_PATH=. gdb --args ./xash -dev 5
## Using DLL Loader
Put vgui_support.dll from windows build to your game data folder and run:
LD_LIBRARY_PATH=. ./xash -dev 5 -vguilib vgui.dll -clientlib valve/cl_dlls/client.dll -dll dlls/hl.dll
## Running MinGW builds
Put exe file to your game data directory
cd (game)\
xash_bin -dev 5
### Running MinGW builds under GDB
gdb --args ./xash_bin.exe -dev 5
# Useful GDB commands
Start or restart process:
(gdb) r
Show backtrace:
(gdb) bt
Full backtrace:
(gdb) bt full
Continue execution:
(gdb) c
Recover from segmentation fault:
Skipping function:
(gdb) handle SIGSEGV nopass
(gdb) ret
(gdb) c
Restart frame for beginning:
(gdb) handle SIGSEGV nopass
(gdb) jump *Host_AbortCurrentFrame
Anti-Crash script (useful for scripting servers):
```
cd /path/to/rootdir
file xash
set args xash -dev 5 -nowcon
handle SIGSEGV nopass
catch signal SIGSEGV
set $crashes=0
commands
print $crashes++
if $crashes > 500
set $crashes=0
run
else
jump *Host_AbortCurrentFrame
end
end
run
```

7
contrib/mittorn/setup.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
SCRIPTDIR=$(dirname "$0")
TOPDIR=$SCRIPTDIR/../../
cp $SCRIPTDIR/Makefile.dllloader $TOPDIR/loader/
cp $SCRIPTDIR/Makefile.emscripten $TOPDIR/engine/
cp $SCRIPTDIR/Makefile.linux $TOPDIR/engine/
cp $SCRIPTDIR/wscript $TOPDIR/engine/

73
contrib/mittorn/wscript Normal file
View File

@@ -0,0 +1,73 @@
#! /usr/bin/env python
# encoding: utf-8
# mittorn, 2018
VERSION='0.99'
APPNAME='xash3d-fwgs'
top = '.'
def options(opt):
opt.load('compiler_c')
# opt.load('msvs')
opt.add_option('--dedicated', action = 'store_true', help = 'build dedicated server only' )
opt.add_option('--64bits', dest = 'amd64', action = 'store_true', help = 'build 64-bit engine on x86_64' )
def configure(conf):
conf.load('compiler_c')
conf.env.append_unique('CFLAGS', '-O2')
conf.env.append_unique('DEFINES', 'SINGLE_BINARY')
conf.env.append_value('LINKFLAGS', '-ldl')
conf.env.append_value('LINKFLAGS', '-lm')
conf.env.append_value('LINKFLAGS', '-pthread')
# check for 64-bit builds
# TODO: check 32-bit toolchain and dependencies
if conf.env.DEST_CPU == 'x86_64' and not conf.options.amd64:
conf.env.append_value('LINKFLAGS', '-m32')
conf.env.append_value('CFLAGS', '-m32')
print('NOTE: will build engine with 64-bit toolchain using -m32')
else:
print('Warning: 64bit engine may be unstable')
# check for dedicated server build
if conf.options.dedicated:
conf.env.append_unique('DEFINES', 'XASH_DEDICATED')
conf.env.dedicated = True
else:
# TODO: add way to specify SDL2 path, move to separate function
try:
conf.check_cfg(path='sdl2-config', args='--cflags --libs', package='', msg='Checking for SDL2', uselib_store='SDL2')
except conf.errors.ConfigurationError:
conf.fatal('SDL2 not availiable! If you want to build dedicated server, specify --dedicated')
conf.env.append_unique('DEFINES', 'XASH_SDL')
def build(bld):
# basic build: dedicated only, no dependencies
use = [];
source = bld.path.ant_glob([
'common/*.c',
'common/imagelib/*.c',
'common/soundlib/*.c',
'common/soundlib/libmpg/*.c',
'server/*.c'])
# add client files and sdl2 library
if not bld.env.dedicated:
use += ['SDL2']
source += bld.path.ant_glob([
'client/*.c',
'client/vgui/*.c',
'client/avi/*.c',
'platform/sdl/*.c'])
bld(
target = 'xash',
features = 'c cprogram',
includes = ['../common', '../pm_shared', 'common', 'server', 'client', 'client/vgui', '.' ],
source = source,
use = use
)

View File

@@ -135,4 +135,4 @@ typedef struct
aliasskintype_t type;
} daliasskintype_t;
#endif//ALIAS_H
#endif//ALIAS_H

View File

@@ -15,6 +15,14 @@ GNU General Public License for more details.
#ifndef CDLL_EXP_H
#define CDLL_EXP_H
struct tempent_s;
struct usercmd_s;
struct physent_s;
struct playermove_s;
struct mstudioevent_s;
struct engine_studio_api_s;
struct r_studio_interface_s;
// NOTE: ordering is important!
typedef struct cldll_func_s
{
@@ -62,6 +70,10 @@ typedef struct cldll_func_s
// Xash3D extension
int (*pfnGetRenderInterface)( int version, render_api_t *renderfuncs, render_interface_t *callback );
void (*pfnClipMoveToEntity)( struct physent_s *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, struct pmtrace_s *tr );
// Xash3D FWGS extension
int (*pfnTouchEvent)( int type, int fingerID, float x, float y, float dx, float dy );
void (*pfnMoveEvent)( float forwardmove, float sidemove );
void (*pfnLookEvent)( float relyaw, float relpitch );
} cldll_func_t;
#endif//CDLL_EXP_H
#endif//CDLL_EXP_H

View File

@@ -27,6 +27,16 @@ extern "C" {
#endif
#include "const.h"
#include <stdint.h>
#define MAX_ALIAS_NAME 32
typedef struct cmdalias_s
{
struct cmdalias_s *next;
char name[MAX_ALIAS_NAME];
char *value;
} cmdalias_t;
// this file is included by both the engine and the client-dll,
// so make sure engine declarations aren't done twice
@@ -96,8 +106,14 @@ typedef struct hud_player_info_s
char *model;
short topcolor;
short bottomcolor;
uint64_t m_nSteamID;
} hud_player_info_t;
struct screenfade_s;
struct tagPOINT;
struct event_args_s;
typedef struct cl_enginefuncs_s
{
// sprite handlers
@@ -119,20 +135,20 @@ typedef struct cl_enginefuncs_s
void (*pfnSetCrosshair)( HSPRITE hspr, wrect_t rc, int r, int g, int b );
// cvar handlers
struct cvar_s *(*pfnRegisterVariable)( char *szName, char *szValue, int flags );
float (*pfnGetCvarFloat)( char *szName );
char* (*pfnGetCvarString)( char *szName );
struct cvar_s *(*pfnRegisterVariable)( const char *szName, const char *szValue, int flags );
float (*pfnGetCvarFloat)( const char *szName );
const char* (*pfnGetCvarString)( const char *szName );
// command handlers
int (*pfnAddCommand)( char *cmd_name, void (*function)(void) );
int (*pfnHookUserMsg)( char *szMsgName, pfnUserMsgHook pfn );
int (*pfnServerCmd)( char *szCmdString );
int (*pfnClientCmd)( char *szCmdString );
int (*pfnAddCommand)( const char *cmd_name, void (*function)(void) );
int (*pfnHookUserMsg)( const char *szMsgName, pfnUserMsgHook pfn );
int (*pfnServerCmd)( const char *szCmdString );
int (*pfnClientCmd)( const char *szCmdString );
void (*pfnGetPlayerInfo)( int ent_num, hud_player_info_t *pinfo );
// sound handlers
void (*pfnPlaySoundByName)( char *szSound, float volume );
void (*pfnPlaySoundByName)( const char *szSound, float volume );
void (*pfnPlaySoundByIndex)( int iSound, float volume );
// vector helpers
@@ -154,14 +170,14 @@ typedef struct cl_enginefuncs_s
void (*GetViewAngles)( float * );
void (*SetViewAngles)( float * );
int (*GetMaxClients)( void );
void (*Cvar_SetValue)( char *cvar, float value );
void (*Cvar_SetValue)( const char *cvar, float value );
int (*Cmd_Argc)( void );
char *(*Cmd_Argv)( int arg );
void (*Con_Printf)( char *fmt, ... );
void (*Con_DPrintf)( char *fmt, ... );
void (*Con_NPrintf)( int pos, char *fmt, ... );
void (*Con_NXPrintf)( struct con_nprint_s *info, char *fmt, ... );
int (*Cmd_Argc)( void );
const char *(*Cmd_Argv)( int arg );
void (*Con_Printf)( const char *fmt, ... );
void (*Con_DPrintf)( const char *fmt, ... );
void (*Con_NPrintf)( int pos, const char *fmt, ... );
void (*Con_NXPrintf)( struct con_nprint_s *info, const char *fmt, ... );
const char* (*PhysInfo_ValueForKey)( const char *key );
const char* (*ServerInfo_ValueForKey)( const char *key );
@@ -180,8 +196,8 @@ typedef struct cl_enginefuncs_s
void (*V_CalcShake)( void );
void (*V_ApplyShake)( float *origin, float *angles, float factor );
int (*PM_PointContents)( float *point, int *truecontents );
int (*PM_WaterEntity)( float *p );
int (*PM_PointContents)( const float *point, int *truecontents );
int (*PM_WaterEntity)( const float *p );
struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehull, int ignore_pe );
struct model_s *(*CL_LoadModel)( const char *modelname, int *index );
@@ -194,19 +210,20 @@ typedef struct cl_enginefuncs_s
void (*pfnPlaybackEvent)( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
void (*pfnWeaponAnim)( int iAnim, int body );
float (*pfnRandomFloat)( float flLow, float flHigh );
long (*pfnRandomLong)( long lLow, long lHigh );
void (*pfnHookEvent)( char *name, void ( *pfnEvent )( struct event_args_s *args ));
int (*Con_IsVisible) ();
int (*pfnRandomLong)( int lLow, int lHigh );
void (*pfnHookEvent)( const char *name, void ( *pfnEvent )( struct event_args_s *args ));
int (*Con_IsVisible) ( void );
const char *(*pfnGetGameDirectory)( void );
struct cvar_s *(*pfnGetCvarPointer)( const char *szName );
const char *(*Key_LookupBinding)( const char *pBinding );
const char *(*pfnGetLevelName)( void );
void (*pfnGetScreenFade)( struct screenfade_s *fade );
void (*pfnSetScreenFade)( struct screenfade_s *fade );
void* (*VGui_GetPanel)( );
void* (*VGui_GetPanel)( void );
void (*VGui_ViewportPaintBackground)( int extents[4] );
byte* (*COM_LoadFile)( char *path, int usehunk, int *pLength );
byte* (*COM_LoadFile)( const char *path, int usehunk, int *pLength );
char* (*COM_ParseFile)( char *data, char *token );
void (*COM_FreeFile)( void *buffer );
@@ -248,39 +265,47 @@ typedef struct cl_enginefuncs_s
void (*pfnGetMousePos)( struct tagPOINT *ppt );
void (*pfnSetMousePos)( int x, int y );
void (*pfnSetMouseEnable)( qboolean fEnable );
void (*pfnUnused1)( void );
void (*pfnUnused2)( void );
void (*pfnUnused3)( void );
void (*pfnUnused4)( void );
float (*pfnGetClientOldTime)( void );
float (*pfnGetGravity)( void );
struct model_s*(*pfnGetModelByIndex)( int index );
void (*pfnUnused5)( void );
void (*pfnUnused6)( void );
void (*pfnUnused7)( void );
void (*pfnUnused8)( void );
void (*pfnUnused9)( void );
void (*pfnUnused10)( void );
void (*pfnUnused11)( void );
void (*pfnUnused12)( void );
const char*(*LocalPlayerInfo_ValueForKey)( const char* key );
void (*pfnUnused13)( void );
void (*pfnUnused14)( void );
void (*pfnUnused15)( void );
void (*pfnUnused16)( void );
void (*Cvar_Set)( char *name, char *value );
void (*pfnUnused17)( void );
void (*pfnUnused18)( void );
void (*pfnUnused19)( void );
double (*pfnSys_FloatTime)( void );
void (*pfnUnused20)( void );
void (*pfnUnused21)( void );
void (*pfnUnused22)( void );
void (*pfnUnused23)( void );
void (*pfnFillRGBABlend)( int x, int y, int width, int height, int r, int g, int b, int a );
int (*pfnGetAppID)( void );
void (*pfnUnused24)( void );
void (*pfnUnused25)( void );
// undocumented interface starts here
struct cvar_s* (*pfnGetFirstCvarPtr)( void );
void* (*pfnGetFirstCmdFunctionHandle)( void );
void* (*pfnGetNextCmdFunctionHandle)( void *cmdhandle );
const char* (*pfnGetCmdFunctionName)( void *cmdhandle );
float (*pfnGetClientOldTime)( void );
float (*pfnGetGravity)( void );
struct model_s* (*pfnGetModelByIndex)( int index );
void (*pfnSetFilterMode)( int mode ); // same as gl_texsort in original Quake
void (*pfnSetFilterColor)( float red, float green, float blue );
void (*pfnSetFilterBrightness)( float brightness );
void *(*pfnSequenceGet)( const char *fileName, const char *entryName );
void (*pfnSPR_DrawGeneric)( int frame, int x, int y, const wrect_t *prc, int blendsrc, int blenddst, int width, int height );
void *(*pfnSequencePickSentence)( const char *groupName, int pickMethod, int *entryPicked );
int (*pfnDrawString)( int x, int y, const char *str, int r, int g, int b );
int (*pfnDrawStringReverse)( int x, int y, const char *str, int r, int g, int b );
const char *(*LocalPlayerInfo_ValueForKey)( const char* key );
int (*pfnVGUI2DrawCharacter)( int x, int y, int ch, unsigned int font );
int (*pfnVGUI2DrawCharacterAdditive)( int x, int y, int ch, int r, int g, int b, unsigned int font );
unsigned int (*pfnGetApproxWavePlayLen)( char *filename );
void* (*GetCareerGameUI)( void ); // g-cont. !!!! potential crash-point!
void (*Cvar_Set)( char *name, char *value );
int (*pfnIsPlayingCareerMatch)( void );
void (*pfnPlaySoundVoiceByName)( char *szSound, float volume, int pitch );
void (*pfnPrimeMusicStream)( char *filename, int looping );
double (*pfnSys_FloatTime)( void );
// decay funcs
void (*pfnProcessTutorMessageDecayBuffer)( int *buffer, int buflen );
void (*pfnConstructTutorMessageDecayBuffer)( int *buffer, int buflen );
void (*pfnResetTutorMessageDecayData)( void );
void (*pfnPlaySoundByNameAtPitch)( char *szSound, float volume, int pitch );
void (*pfnFillRGBABlend)( int x, int y, int width, int height, int r, int g, int b, int a );
int (*pfnGetAppID)( void );
cmdalias_t *(*pfnGetAliases)( void );
void (*pfnVguiWrap2_GetMouseDelta)( int *x, int *y );
// added in 2019 update, not documented yet
int (*pfnFilteredClientCmd)( const char *cmd );
} cl_enginefunc_t;
#define CLDLL_INTERFACE_VERSION 7
@@ -289,4 +314,4 @@ typedef struct cl_enginefuncs_s
}
#endif
#endif//CDLL_INT_H
#endif//CDLL_INT_H

38
engine/client/avi/avi.h Normal file
View File

@@ -0,0 +1,38 @@
/*
avi.h -- common avi support header
Copyright (C) 2018 a1batross, 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.
*/
#ifndef AVI_H
#define AVI_H
//
// avikit.c
//
typedef struct movie_state_s movie_state_t;
int AVI_GetVideoFrameNumber( movie_state_t *Avi, float time );
byte *AVI_GetVideoFrame( movie_state_t *Avi, int frame );
qboolean AVI_GetVideoInfo( movie_state_t *Avi, int *xres, int *yres, float *duration );
qboolean AVI_GetAudioInfo( movie_state_t *Avi, wavdata_t *snd_info );
int AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, int offset, int length );
void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audio, int quiet );
movie_state_t *AVI_LoadVideo( const char *filename, qboolean load_audio );
int AVI_TimeToSoundPosition( movie_state_t *Avi, int time );
int AVI_GetVideoFrameCount( movie_state_t *Avi );
void AVI_CloseVideo( movie_state_t *Avi );
qboolean AVI_IsActive( movie_state_t *Avi );
void AVI_FreeVideo( movie_state_t *Avi );
movie_state_t *AVI_GetState( int num );
qboolean AVI_Initailize( void );
void AVI_Shutdown( void );
#endif // AVI_H

View File

@@ -0,0 +1,95 @@
/*
avi_stub.c - playing AVI files (stub)
Copyright (C) 2018 a1batross
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 "build.h"
#if !XASH_WIN32
#include "common.h"
int AVI_GetVideoFrameNumber( movie_state_t *Avi, float time )
{
return 0;
}
byte *AVI_GetVideoFrame( movie_state_t *Avi, int frame )
{
return NULL;
}
qboolean AVI_GetVideoInfo( movie_state_t *Avi, int *xres, int *yres, float *duration )
{
return false;
}
qboolean AVI_GetAudioInfo( movie_state_t *Avi, wavdata_t *snd_info )
{
return false;
}
int AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, int offset, int length )
{
return 0;
}
void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audio, int quiet )
{
;
}
movie_state_t *AVI_LoadVideo( const char *filename, qboolean load_audio )
{
return NULL;
}
int AVI_TimeToSoundPosition( movie_state_t *Avi, int time )
{
return 0;
}
int AVI_GetVideoFrameCount( movie_state_t *Avi )
{
return 0;
}
void AVI_CloseVideo( movie_state_t *Avi )
{
;
}
qboolean AVI_IsActive( movie_state_t *Avi )
{
return false;
}
void AVI_FreeVideo( movie_state_t *Avi )
{
;
}
movie_state_t *AVI_GetState( int num )
{
return NULL;
}
qboolean AVI_Initailize( void )
{
return false;
}
void AVI_Shutdown( void )
{
;
}
#endif // WIN32

View File

@@ -1,5 +1,5 @@
/*
avikit.c - playing AVI files (based on original AVIKit code)
avi_win.c - playing AVI files (based on original AVIKit code, Win32 version)
Copyright (C) 2010 Uncle Mike
This program is free software: you can redistribute it and/or modify
@@ -13,9 +13,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#include "build.h"
#if XASH_WIN32
#include "common.h"
#include "client.h"
#include "gl_local.h"
#include <vfw.h> // video for windows
// msvfw32.dll exports
@@ -251,7 +252,7 @@ qboolean AVI_ACMConvertAudio( movie_state_t *Avi )
return true;
}
qboolean AVI_GetVideoInfo( movie_state_t *Avi, long *xres, long *yres, float *duration )
qboolean AVI_GetVideoInfo( movie_state_t *Avi, int *xres, int *yres, float *duration )
{
if( !Avi->active )
return false;
@@ -269,7 +270,7 @@ qboolean AVI_GetVideoInfo( movie_state_t *Avi, long *xres, long *yres, float *du
}
// returns a unique frame identifier
long AVI_GetVideoFrameNumber( movie_state_t *Avi, float time )
int AVI_GetVideoFrameNumber( movie_state_t *Avi, float time )
{
if( !Avi->active )
return 0;
@@ -277,7 +278,7 @@ long AVI_GetVideoFrameNumber( movie_state_t *Avi, float time )
return (time * Avi->video_fps);
}
long AVI_GetVideoFrameCount( movie_state_t *Avi )
int AVI_GetVideoFrameCount( movie_state_t *Avi )
{
if( !Avi->active )
return 0;
@@ -285,7 +286,7 @@ long AVI_GetVideoFrameCount( movie_state_t *Avi )
return Avi->video_frames;
}
long AVI_TimeToSoundPosition( movie_state_t *Avi, long time )
int AVI_TimeToSoundPosition( movie_state_t *Avi, int time )
{
if( !Avi->active || !Avi->audio_stream )
return 0;
@@ -382,7 +383,7 @@ qboolean AVI_SeekPosition( movie_state_t *Avi, dword offset )
}
// get a chunk of audio from the stream (in bytes)
long AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, long offset, long length )
int AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, int offset, int length )
{
long result = 0;
int i;
@@ -729,4 +730,5 @@ void AVI_Shutdown( void )
Sys_FreeLibrary( &msvfw_dll );
Sys_FreeLibrary( &msacm_dll );
avi_initialized = false;
}
}
#endif // _WIN32

View File

@@ -15,7 +15,6 @@ GNU General Public License for more details.
#include "common.h"
#include "client.h"
#include "gl_local.h"
/*
====================
@@ -148,23 +147,13 @@ CL_ScreenshotGetName
*/
qboolean CL_ScreenshotGetName( int lastnum, char *filename )
{
int a, b, c, d;
if( lastnum < 0 || lastnum > 9999 )
{
Con_Printf( S_ERROR "unable to write screenshot\n" );
return false;
}
a = lastnum / 1000;
lastnum -= a * 1000;
b = lastnum / 100;
lastnum -= b * 100;
c = lastnum / 10;
lastnum -= c * 10;
d = lastnum;
Q_sprintf( filename, "scrshots/%s_shot%i%i%i%i.bmp", clgame.mapname, a, b, c, d );
Q_sprintf( filename, "scrshots/%s_shot%0004d.png", clgame.mapname, lastnum );
return true;
}
@@ -176,8 +165,6 @@ CL_SnapshotGetName
*/
qboolean CL_SnapshotGetName( int lastnum, char *filename )
{
int a, b, c, d;
if( lastnum < 0 || lastnum > 9999 )
{
Con_Printf( S_ERROR "unable to write snapshot\n" );
@@ -185,15 +172,7 @@ qboolean CL_SnapshotGetName( int lastnum, char *filename )
return false;
}
a = lastnum / 1000;
lastnum -= a * 1000;
b = lastnum / 100;
lastnum -= b * 100;
c = lastnum / 10;
lastnum -= c * 10;
d = lastnum;
Q_sprintf( filename, "../%s_%i%i%i%i.bmp", clgame.mapname, a, b, c, d );
Q_sprintf( filename, "../%s_%0004d.png", clgame.mapname, lastnum );
return true;
}
@@ -344,7 +323,7 @@ void CL_LevelShot_f( void )
// check for exist
if( cls.demoplayback && ( cls.demonum != -1 ))
{
Q_sprintf( cls.shotname, "levelshots/%s_%s.bmp", cls.demoname, glState.wideScreen ? "16x9" : "4x3" );
Q_sprintf( cls.shotname, "levelshots/%s_%s.bmp", cls.demoname, refState.wideScreen ? "16x9" : "4x3" );
Q_snprintf( filename, sizeof( filename ), "%s.dem", cls.demoname );
// make sure what levelshot is newer than demo
@@ -353,7 +332,7 @@ void CL_LevelShot_f( void )
}
else
{
Q_sprintf( cls.shotname, "levelshots/%s_%s.bmp", clgame.mapname, glState.wideScreen ? "16x9" : "4x3" );
Q_sprintf( cls.shotname, "levelshots/%s_%s.bmp", clgame.mapname, refState.wideScreen ? "16x9" : "4x3" );
// make sure what levelshot is newer than bsp
ft1 = FS_FileTime( cl.worldmodel->name, false );
@@ -424,53 +403,7 @@ void CL_SetSky_f( void )
return;
}
R_SetupSky( Cmd_Argv( 1 ));
}
/*
================
SCR_TimeRefresh_f
timerefresh [noflip]
================
*/
void SCR_TimeRefresh_f( void )
{
int i;
double start, stop;
double time;
if( cls.state != ca_active )
return;
start = Sys_DoubleTime();
// run without page flipping like GoldSrc
if( Cmd_Argc() == 1 )
{
pglDrawBuffer( GL_FRONT );
for( i = 0; i < 128; i++ )
{
RI.viewangles[1] = i / 128.0 * 360.0f;
R_RenderScene();
}
pglFinish();
R_EndFrame();
}
else
{
for( i = 0; i < 128; i++ )
{
R_BeginFrame( true );
RI.viewangles[1] = i / 128.0 * 360.0f;
R_RenderScene();
R_EndFrame();
}
}
stop = Sys_DoubleTime ();
time = (stop - start);
Con_Printf( "%f seconds (%f fps)\n", time, 128 / time );
ref.dllFuncs.R_SetupSky( Cmd_Argv( 1 ));
}
/*
@@ -482,6 +415,6 @@ viewpos (level-designer helper)
*/
void SCR_Viewpos_f( void )
{
Con_Printf( "org ( %g %g %g )\n", RI.vieworg[0], RI.vieworg[1], RI.vieworg[2] );
Con_Printf( "ang ( %g %g %g )\n", RI.viewangles[0], RI.viewangles[1], RI.viewangles[2] );
}
Con_Printf( "org ( %g %g %g )\n", refState.vieworg[0], refState.vieworg[1], refState.vieworg[2] );
Con_Printf( "ang ( %g %g %g )\n", refState.viewangles[0], refState.viewangles[1], refState.viewangles[2] );
}

View File

@@ -70,6 +70,13 @@ qboolean CL_CheckFile( sizebuf_t *msg, resource_t *pResource )
return true;
}
if( cl.downloadUrl[0] )
{
HTTP_AddDownload( filepath, pResource->nDownloadSize, true );
host.downloadcount++;
return false;
}
MSG_BeginClientCmd( msg, clc_stringcmd );
MSG_WriteString( msg, va( "dlfile %s", filepath ));
host.downloadcount++;
@@ -140,4 +147,4 @@ void CL_ClearResourceLists( void )
{
CL_ClearResourceList( &cl.resourcesneeded );
CL_ClearResourceList( &cl.resourcesonhand );
}
}

View File

@@ -17,7 +17,6 @@ GNU General Public License for more details.
#include "client.h"
#include "net_encode.h"
#include "particledef.h"
#include "gl_local.h"
#include "cl_tent.h"
#include "shake.h"
#include "hltv.h"
@@ -239,4 +238,4 @@ void CL_WriteMessageHistory( void )
if( host_developer.value >= DEV_EXTENDED )
CL_WriteErrorMessage( MSG_GetNumBytesRead( msg ) - 1, msg );
cls_message_debug.parsing = false;
}
}

View File

@@ -15,7 +15,6 @@ GNU General Public License for more details.
#include "common.h"
#include "client.h"
#include "gl_local.h"
#include "net_encode.h"
#define dem_unknown 0 // unknown command
@@ -52,6 +51,7 @@ const char *demo_cmd[dem_lastcmd+1] =
"dem_stop",
};
#pragma pack( push, 1 )
typedef struct
{
int id; // should be IDEM
@@ -63,6 +63,7 @@ typedef struct
char gamedir[64]; // name of game directory (FS_Gamedir())
int directory_offset; // offset of Entry Directory.
} demoheader_t;
#pragma pack( pop )
typedef struct
{
@@ -349,9 +350,9 @@ Write demo header
*/
void CL_WriteDemoHeader( const char *name )
{
long copysize;
long savepos;
long curpos;
int copysize;
int savepos;
int curpos;
Con_Printf( "recording to %s.\n", name );
cls.demofile = FS_Open( name, "wb", false );
@@ -489,7 +490,7 @@ void CL_DrawDemoRecording( void )
{
char string[64];
rgba_t color = { 255, 255, 255, 255 };
long pos;
int pos;
int len;
if(!( host_developer.value && cls.demorecording ))
@@ -497,10 +498,10 @@ void CL_DrawDemoRecording( void )
pos = FS_Tell( cls.demofile );
Q_snprintf( string, sizeof( string ), "^1RECORDING:^7 %s: %s time: %02d:%02d", cls.demoname,
Q_memprint( pos ), (int)(cls.demotime / 60.0f ), (int)fmod( cls.demotime, 60.0f ));
Q_memprint( pos ), (int)(cls.demotime / 60.0f ), (int)fmod( cls.demotime, 60.0f ));
Con_DrawStringLen( string, &len, NULL );
Con_DrawString(( glState.width - len ) >> 1, glState.height >> 2, string, color );
Con_DrawString(( refState.width - len ) >> 1, refState.height >> 4, string, color );
}
/*
@@ -1153,6 +1154,7 @@ void CL_StopPlayback( void )
// let game known about demo state
Cvar_FullSet( "cl_background", "0", FCVAR_READ_ONLY );
cls.state = ca_disconnected;
memset( &cls.serveradr, 0, sizeof( cls.serveradr ) );
cls.set_lastdemo = false;
S_StopBackgroundTrack();
cls.connect_time = 0;
@@ -1169,7 +1171,7 @@ void CL_StopPlayback( void )
CL_GetDemoComment
==================
*/
qboolean CL_GetDemoComment( const char *demoname, char *comment )
int CL_GetDemoComment( const char *demoname, char *comment )
{
file_t *demfile;
demoheader_t demohdr;
@@ -1185,7 +1187,7 @@ qboolean CL_GetDemoComment( const char *demoname, char *comment )
{
Q_strncpy( comment, "", MAX_STRING );
return false;
}
}
// read in the m_DemoHeader
FS_Read( demfile, &demohdr, sizeof( demoheader_t ));
@@ -1302,8 +1304,6 @@ CL_DemoGetName
*/
static void CL_DemoGetName( int lastnum, char *filename )
{
int a, b, c, d;
if( lastnum < 0 || lastnum > 9999 )
{
// bound
@@ -1311,15 +1311,7 @@ static void CL_DemoGetName( int lastnum, char *filename )
return;
}
a = lastnum / 1000;
lastnum -= a * 1000;
b = lastnum / 100;
lastnum -= b * 100;
c = lastnum / 10;
lastnum -= c * 10;
d = lastnum;
Q_sprintf( filename, "demo%i%i%i%i", a, b, c, d );
Q_sprintf( filename, "demo%0004d", lastnum );
}
/*
@@ -1627,4 +1619,4 @@ void CL_Stop_f( void )
{
S_StopBackgroundTrack();
}
}
}

View File

@@ -14,11 +14,11 @@ GNU General Public License for more details.
*/
#include "common.h"
#include "client.h"
#include "gl_local.h"
#include "mod_local.h"
#include "entity_types.h"
#include "studio.h"
#include "world.h" // BOX_ON_PLANE_SIDE
#include "client.h"
#include "mathlib.h"
/*
===============================================================================
@@ -103,7 +103,7 @@ static void R_SplitEntityOnNode( mnode_t *node )
return; // no free fragments...
}
clgame.free_efrags = clgame.free_efrags->entnext;
clgame.free_efrags = ef->entnext;
ef->entity = r_addent;
// add the entity link
@@ -206,4 +206,4 @@ void R_StoreEfrags( efrag_t **ppefrag, int framecount )
break;
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -63,7 +63,7 @@ void CL_CalcPlayerVelocity( int idx, vec3_t velocity )
if( dt != 0.0 )
{
VectorSubtract( clgame.entities[idx].curstate.velocity, clgame.entities[idx].prevstate.velocity, delta );
VectorScale( delta, 1.0 / dt, velocity );
VectorScale( delta, 1.0f / dt, velocity );
}
else
{
@@ -393,7 +393,7 @@ void CL_ParseEvent( sizebuf_t *msg )
event_index = MSG_ReadUBitLong( msg, MAX_EVENT_BITS );
if( MSG_ReadOneBit( msg ))
packet_index = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS );
packet_index = MSG_ReadUBitLong( msg, cls.legacymode ? MAX_LEGACY_ENTITY_BITS : MAX_ENTITY_BITS );
else packet_index = -1;
if( MSG_ReadOneBit( msg ))
@@ -492,4 +492,4 @@ void CL_PlaybackEvent( int flags, const edict_t *pInvoker, word eventindex, floa
args.bparam2 = bparam2;
CL_QueueEvent( flags, eventindex, delay, &args );
}
}

View File

@@ -17,7 +17,6 @@ GNU General Public License for more details.
#include "client.h"
#include "net_encode.h"
#include "entity_types.h"
#include "gl_local.h"
#include "pm_local.h"
#include "cl_tent.h"
#include "studio.h"
@@ -102,7 +101,7 @@ qboolean CL_EntityTeleported( cl_entity_t *ent )
VectorSubtract( ent->curstate.origin, ent->prevstate.origin, delta );
// compute potential max movement in units per frame and compare with entity movement
maxlen = ( clgame.movevars.maxvelocity * ( 1.0 / GAME_FPS ));
maxlen = ( clgame.movevars.maxvelocity * ( 1.0f / GAME_FPS ));
len = VectorLength( delta );
return (len > maxlen);
@@ -230,6 +229,33 @@ void CL_UpdateLatchedVars( cl_entity_t *ent )
clgame.drawFuncs.CL_UpdateLatchedVars( ent, false );
}
/*
====================
CL_GetStudioEstimatedFrame
====================
*/
float CL_GetStudioEstimatedFrame( cl_entity_t *ent )
{
studiohdr_t *pstudiohdr;
mstudioseqdesc_t *pseqdesc;
int sequence;
if( ent->model != NULL && ent->model->type == mod_studio )
{
pstudiohdr = (studiohdr_t *)Mod_StudioExtradata( ent->model );
if( pstudiohdr )
{
sequence = bound( 0, ent->curstate.sequence, pstudiohdr->numseq - 1 );
pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + sequence;
return ref.dllFuncs.R_StudioEstimateFrame( ent, pseqdesc );
}
}
return 0;
}
/*
====================
CL_ResetLatchedVars
@@ -330,7 +356,7 @@ qboolean CL_FindInterpolationUpdates( cl_entity_t *ent, float targettime, positi
for( i = 1; i < HISTORY_MAX - 1; i++ )
{
at = ent->ph[( imod - i ) & HISTORY_MASK].animtime;
if( at == 0.0 ) break;
if( at == 0.0f ) break;
if( targettime > at )
{
@@ -729,7 +755,10 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
CL_WriteDemoJumpTime();
// sentinel count. save it for debug checking
count = ( MSG_ReadUBitLong( msg, MAX_VISIBLE_PACKET_BITS ) + 1 );
if( cls.legacymode )
count = MSG_ReadWord( msg );
else count = MSG_ReadUBitLong( msg, MAX_VISIBLE_PACKET_BITS ) + 1;
newframe = &cl.frames[cl.parsecountmod];
// allocate parse entities
@@ -803,9 +832,19 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
while( 1 )
{
newnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS );
if( newnum == LAST_EDICT ) break; // end of packet entities
int lastedict;
if( cls.legacymode )
{
newnum = MSG_ReadWord( msg );
lastedict = 0;
}
else
{
newnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS );
lastedict = LAST_EDICT;
}
if( newnum == lastedict ) break; // end of packet entities
if( MSG_CheckOverflow( msg ))
Host_Error( "CL_ParsePacketEntities: overflow\n" );
player = CL_IsPlayerIndex( newnum );
@@ -934,10 +973,10 @@ qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType )
if( entityType == ET_BEAM )
{
CL_AddCustomBeam( ent );
ref.dllFuncs.CL_AddCustomBeam( ent );
return true;
}
else if( !R_AddEntity( ent, entityType ))
else if( !ref.dllFuncs.R_AddEntity( ent, entityType ))
{
return false;
}
@@ -1109,7 +1148,7 @@ void CL_LinkPacketEntities( frame_t *frame )
if( ent->curstate.rendermode == kRenderNormal )
{
// auto 'solid' faces
if( FBitSet( ent->model->flags, MODEL_TRANSPARENT ) && CL_IsQuakeCompatible( ))
if( FBitSet( ent->model->flags, MODEL_TRANSPARENT ) && Host_IsQuakeCompatible( ))
{
ent->curstate.rendermode = kRenderTransAlpha;
ent->curstate.renderamt = 255;
@@ -1186,7 +1225,7 @@ void CL_LinkPacketEntities( frame_t *frame )
if( ent->model->type == mod_studio )
{
if( interpolate && FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP ))
R_StudioLerpMovement( ent, cl.time, ent->origin, ent->angles );
ref.dllFuncs.R_StudioLerpMovement( ent, cl.time, ent->origin, ent->angles );
}
}
@@ -1257,8 +1296,6 @@ void CL_EmitEntities( void )
{
if( cl.paused ) return; // don't waste time
R_ClearScene ();
// not in server yet, no entities to redraw
if( cls.state != ca_active || !cl.validsequence )
return;
@@ -1268,7 +1305,7 @@ void CL_EmitEntities( void )
return;
// animate lightestyles
CL_RunLightStyles ();
ref.dllFuncs.CL_RunLightStyles ();
// decay dynamic lights
CL_DecayLights ();
@@ -1279,9 +1316,7 @@ void CL_EmitEntities( void )
// set client ideal pitch when mlook is disabled
CL_SetIdealPitch ();
// clear the scene befor start new frame
if( clgame.drawFuncs.R_ClearScene != NULL )
clgame.drawFuncs.R_ClearScene();
ref.dllFuncs.R_ClearScene ();
// link all the visible clients first
CL_LinkPlayers ( &cl.frames[cl.parsecountmod] );
@@ -1325,11 +1360,11 @@ qboolean CL_GetEntitySpatialization( channel_t *ch )
if(( ch->entnum - 1 ) == cl.playernum )
{
VectorCopy( RI.vieworg, ch->origin );
VectorCopy( refState.vieworg, ch->origin );
return true;
}
valid_origin = VectorIsNull( ch->origin ) ? false : true;
valid_origin = VectorIsNull( ch->origin ) ? false : true;
ent = CL_GetEntityByIndex( ch->entnum );
// entity is not present on the client but has valid origin
@@ -1341,20 +1376,10 @@ qboolean CL_GetEntitySpatialization( channel_t *ch )
if( ent->curstate.messagenum != cl.parsecount )
return valid_origin;
#endif
ch->movetype = ent->curstate.movetype;
// setup origin
VectorAverage( ent->curstate.mins, ent->curstate.maxs, ch->origin );
VectorAdd( ch->origin, ent->curstate.origin, ch->origin );
// setup mins\maxs
VectorAdd( ent->curstate.mins, ent->curstate.origin, ch->absmin );
VectorAdd( ent->curstate.maxs, ent->curstate.origin, ch->absmax );
// setup radius
if( ent->model != NULL && ent->model->radius ) ch->radius = ent->model->radius;
else ch->radius = RadiusFromBounds( ent->curstate.mins, ent->curstate.maxs );
return true;
}
@@ -1363,7 +1388,7 @@ qboolean CL_GetMovieSpatialization( rawchan_t *ch )
cl_entity_t *ent;
qboolean valid_origin;
valid_origin = VectorIsNull( ch->origin ) ? false : true;
valid_origin = VectorIsNull( ch->origin ) ? false : true;
ent = CL_GetEntityByIndex( ch->entnum );
// entity is not present on the client but has valid origin
@@ -1385,4 +1410,4 @@ void CL_ExtraUpdate( void )
{
clgame.dllFuncs.IN_Accumulate();
S_ExtraUpdate();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -16,11 +16,11 @@ GNU General Public License for more details.
#include "common.h"
#include "client.h"
#include "const.h"
#include "gl_local.h"
#include "library.h"
#include "input.h"
#include "server.h" // !!svgame.hInstance
#include "vid_common.h"
static MENUAPI GetMenuAPI;
static void UI_UpdateUserinfo( void );
gameui_static_t gameui;
@@ -47,7 +47,7 @@ void UI_UpdateMenu( float realtime )
gameui.globals->frametime = host.realframetime;
gameui.globals->demoplayback = cls.demoplayback;
gameui.globals->demorecording = cls.demorecording;
gameui.globals->allow_console = host.allow_console;
gameui.globals->developer = host.allow_console;
gameui.dllFuncs.pfnRedraw( realtime );
UI_UpdateUserinfo();
@@ -135,6 +135,161 @@ qboolean UI_IsVisible( void )
return gameui.dllFuncs.pfnIsVisible();
}
/*
=======================
UI_AddTouchButtonToList
send button parameters to menu
=======================
*/
void UI_AddTouchButtonToList( const char *name, const char *texture, const char *command, unsigned char *color, int flags )
{
if( gameui.dllFuncs2.pfnAddTouchButtonToList )
{
gameui.dllFuncs2.pfnAddTouchButtonToList( name, texture, command, color, flags );
}
}
/*
=================
UI_ResetPing
notify gameui dll about latency reset
=================
*/
void UI_ResetPing( void )
{
if( gameui.dllFuncs2.pfnResetPing )
{
gameui.dllFuncs2.pfnResetPing( );
}
}
/*
=================
UI_ShowConnectionWarning
show connection warning dialog implemented by gameui dll
=================
*/
void UI_ShowConnectionWarning( void )
{
if( cls.state != ca_connected )
return;
if( Host_IsLocalClient() )
return;
if( ++cl.lostpackets == 8 )
{
CL_Disconnect();
if( gameui.dllFuncs2.pfnShowConnectionWarning )
{
gameui.dllFuncs2.pfnShowConnectionWarning();
}
Con_DPrintf( S_WARN "Too many lost packets! Showing Network options menu\n" );
}
}
/*
=================
UI_ShowConnectionWarning
show update dialog
=================
*/
void UI_ShowUpdateDialog( qboolean preferStore )
{
if( gameui.dllFuncs2.pfnShowUpdateDialog )
{
gameui.dllFuncs2.pfnShowUpdateDialog( preferStore );
}
Con_Printf( S_WARN "This version is not supported anymore. To continue, install latest engine version\n" );
}
/*
=================
UI_ShowConnectionWarning
show message box
=================
*/
void UI_ShowMessageBox( const char *text )
{
if( gameui.dllFuncs2.pfnShowMessageBox )
{
gameui.dllFuncs2.pfnShowMessageBox( text );
}
}
void UI_ConnectionProgress_Disconnect( void )
{
if( gameui.dllFuncs2.pfnConnectionProgress_Disconnect )
{
gameui.dllFuncs2.pfnConnectionProgress_Disconnect( );
}
}
void UI_ConnectionProgress_Download( const char *pszFileName, const char *pszServerName, const char *pszServerPath, int iCurrent, int iTotal, const char *comment )
{
if( !gameui.dllFuncs2.pfnConnectionProgress_Download )
return;
if( pszServerPath )
{
char serverpath[MAX_SYSPATH];
Q_snprintf( serverpath, sizeof( serverpath ), "%s%s", pszServerName, pszServerPath );
gameui.dllFuncs2.pfnConnectionProgress_Download( pszFileName, serverpath, iCurrent, iTotal, comment );
}
else
{
gameui.dllFuncs2.pfnConnectionProgress_Download( pszFileName, pszServerName, iCurrent, iTotal, comment );
}
}
void UI_ConnectionProgress_DownloadEnd( void )
{
if( gameui.dllFuncs2.pfnConnectionProgress_DownloadEnd )
{
gameui.dllFuncs2.pfnConnectionProgress_DownloadEnd( );
}
}
void UI_ConnectionProgress_Precache( void )
{
if( gameui.dllFuncs2.pfnConnectionProgress_Precache )
{
gameui.dllFuncs2.pfnConnectionProgress_Precache( );
}
}
void UI_ConnectionProgress_Connect( const char *server ) // NULL for local server
{
if( gameui.dllFuncs2.pfnConnectionProgress_Connect )
{
gameui.dllFuncs2.pfnConnectionProgress_Connect( server );
}
}
void UI_ConnectionProgress_ChangeLevel( void )
{
if( gameui.dllFuncs2.pfnConnectionProgress_ChangeLevel )
{
gameui.dllFuncs2.pfnConnectionProgress_ChangeLevel( );
}
}
void UI_ConnectionProgress_ParseServerInfo( const char *server )
{
if( gameui.dllFuncs2.pfnConnectionProgress_ParseServerInfo )
{
gameui.dllFuncs2.pfnConnectionProgress_ParseServerInfo( server );
}
}
static void UI_DrawLogo( const char *filename, float x, float y, float width, float height )
{
static float cin_time;
@@ -201,7 +356,7 @@ static void UI_DrawLogo( const char *filename, float x, float y, float width, fl
redraw = true;
}
R_DrawStretchRaw( x, y, width, height, gameui.logo_xres, gameui.logo_yres, cin_data, redraw );
ref.dllFuncs.R_DrawStretchRaw( x, y, width, height, gameui.logo_xres, gameui.logo_yres, cin_data, redraw );
}
static int UI_GetLogoWidth( void )
@@ -358,8 +513,8 @@ static void PIC_DrawGeneric( float x, float y, float width, float height, const
return;
PicAdjustSize( &x, &y, &width, &height );
R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, gameui.ds.gl_texturenum );
pglColor4ub( 255, 255, 255, 255 );
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, gameui.ds.gl_texturenum );
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
}
/*
@@ -374,13 +529,13 @@ pfnPIC_Load
=========
*/
static HIMAGE pfnPIC_Load( const char *szPicName, const byte *image_buf, long image_size, long flags )
static HIMAGE pfnPIC_Load( const char *szPicName, const byte *image_buf, int image_size, int flags )
{
HIMAGE tx;
if( !COM_CheckString( szPicName ))
{
Con_Reportf( S_ERROR "CL_LoadImage: bad name!\n" );
Con_Reportf( S_ERROR "CL_LoadImage: refusing to load image with empty name\n" );
return 0;
}
@@ -388,7 +543,7 @@ static HIMAGE pfnPIC_Load( const char *szPicName, const byte *image_buf, long im
SetBits( flags, TF_IMAGE );
Image_SetForceFlags( IL_LOAD_DECAL ); // allow decal images for menu
tx = GL_LoadTexture( szPicName, image_buf, image_size, flags );
tx = ref.dllFuncs.GL_LoadTexture( szPicName, image_buf, image_size, flags );
Image_ClearForceFlags();
return tx;
@@ -437,7 +592,7 @@ void pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a )
g = bound( 0, g, 255 );
b = bound( 0, b, 255 );
a = bound( 0, a, 255 );
pglColor4ub( r, g, b, a );
ref.dllFuncs.Color4ub( r, g, b, a );
}
/*
@@ -448,7 +603,7 @@ pfnPIC_Draw
*/
void pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc )
{
GL_SetRenderMode( kRenderNormal );
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
PIC_DrawGeneric( x, y, width, height, prc );
}
@@ -460,7 +615,7 @@ pfnPIC_DrawTrans
*/
void pfnPIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc )
{
GL_SetRenderMode( kRenderTransTexture );
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
PIC_DrawGeneric( x, y, width, height, prc );
}
@@ -472,7 +627,7 @@ pfnPIC_DrawHoles
*/
void pfnPIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc )
{
GL_SetRenderMode( kRenderTransAlpha );
ref.dllFuncs.GL_SetRenderMode( kRenderTransAlpha );
PIC_DrawGeneric( x, y, width, height, prc );
}
@@ -484,7 +639,7 @@ pfnPIC_DrawAdditive
*/
void pfnPIC_DrawAdditive( int x, int y, int width, int height, const wrect_t *prc )
{
GL_SetRenderMode( kRenderTransAdd );
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
PIC_DrawGeneric( x, y, width, height, prc );
}
@@ -536,10 +691,10 @@ static void pfnFillRGBA( int x, int y, int width, int height, int r, int g, int
g = bound( 0, g, 255 );
b = bound( 0, b, 255 );
a = bound( 0, a, 255 );
pglColor4ub( r, g, b, a );
GL_SetRenderMode( kRenderTransTexture );
R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, tr.whiteTexture );
pglColor4ub( 255, 255, 255, 255 );
ref.dllFuncs.Color4ub( r, g, b, a );
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, R_GetBuiltinTexture( REF_WHITE_TEXTURE ) );
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
}
/*
@@ -597,7 +752,7 @@ static void pfnDrawCharacter( int ix, int iy, int iwidth, int iheight, int ch, i
color[0] = (ulRGBA & 0xFF0000) >> 16;
color[1] = (ulRGBA & 0xFF00) >> 8;
color[2] = (ulRGBA & 0xFF) >> 0;
pglColor4ubv( color );
ref.dllFuncs.Color4ub( color[0], color[1], color[2], color[3] );
col = (ch & 15) * 0.0625f + (0.5f / 256.0f);
row = (ch >> 4) * 0.0625f + (0.5f / 256.0f);
@@ -612,9 +767,9 @@ static void pfnDrawCharacter( int ix, int iy, int iwidth, int iheight, int ch, i
if( gameui.ds.scissor_test && !PIC_Scissor( &x, &y, &width, &height, &s1, &t1, &s2, &t2 ))
return;
GL_SetRenderMode( kRenderTransTexture );
R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, hFont );
pglColor4ub( 255, 255, 255, 255 );
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, hFont );
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
}
/*
@@ -685,8 +840,8 @@ for drawing playermodel previews
*/
static void pfnClearScene( void )
{
R_PushScene();
R_ClearScene();
ref.dllFuncs.R_PushScene();
ref.dllFuncs.R_ClearScene();
}
/*
@@ -698,17 +853,21 @@ for drawing playermodel previews
*/
static void pfnRenderScene( const ref_viewpass_t *rvp )
{
ref_viewpass_t copy;
// to avoid division by zero
if( !rvp || rvp->fov_x <= 0.0f || rvp->fov_y <= 0.0f )
return;
// don't allow special modes from menu
((ref_viewpass_t *)&rvp)->flags = 0;
copy = *rvp;
R_Set2DMode( false );
R_RenderFrame( rvp );
R_Set2DMode( true );
R_PopScene();
// don't allow special modes from menu
copy.flags = 0;
ref.dllFuncs.R_Set2DMode( false );
GL_RenderFrame( &copy );
ref.dllFuncs.R_Set2DMode( true );
ref.dllFuncs.R_PopScene();
}
/*
@@ -720,7 +879,7 @@ adding player model into visible list
*/
static int pfnAddEntity( int entityType, cl_entity_t *ent )
{
if( !R_AddEntity( ent, entityType ))
if( !ref.dllFuncs.R_AddEntity( ent, entityType ))
return false;
return true;
}
@@ -867,15 +1026,27 @@ pfnCheckGameDll
*/
int pfnCheckGameDll( void )
{
string dllpath;
void *hInst;
if( SV_Initialized( )) return true;
#if TARGET_OS_IPHONE
// loading server library drains too many ram
// so 512MB iPod Touch cannot even connect to
// to servers in cstrike
return true;
#endif
if(( hInst = COM_LoadLibrary( GI->game_dll, true, false )) != NULL )
if( svgame.hInstance )
return true;
COM_GetCommonLibraryPath( LIBRARY_SERVER, dllpath, sizeof( dllpath ));
if(( hInst = COM_LoadLibrary( dllpath, true, false )) != NULL )
{
COM_FreeLibrary( hInst );
COM_FreeLibrary( hInst ); // don't increase linker's reference counter
return true;
}
Con_Reportf( S_WARN "Could not load server library:\n%s", COM_GetLibraryError() );
return false;
}
@@ -902,7 +1073,7 @@ pfnHostEndGame
static void pfnHostEndGame( const char *szFinalMessage )
{
if( !szFinalMessage ) szFinalMessage = "";
Host_EndGame( false, szFinalMessage );
Host_EndGame( false, "%s", szFinalMessage );
}
/*
@@ -916,6 +1087,26 @@ static void pfnStartBackgroundTrack( const char *introTrack, const char *mainTra
S_StartBackgroundTrack( introTrack, mainTrack, 0, false );
}
static void GL_ProcessTexture( int texnum, float gamma, int topColor, int bottomColor )
{
ref.dllFuncs.GL_ProcessTexture( texnum, gamma, topColor, bottomColor );
}
/*
=================
UI_ShellExecute
=================
*/
static void UI_ShellExecute( const char *path, const char *parms, int shouldExit )
{
Platform_ShellExecute( path, parms );
if( shouldExit )
Sys_Quit();
}
// engine callbacks
static ui_enginefuncs_t gEngfuncs =
{
@@ -988,7 +1179,7 @@ static ui_enginefuncs_t gEngfuncs =
CL_GetDemoComment,
pfnCheckGameDll,
pfnGetClipboardData,
Sys_ShellExecute,
UI_ShellExecute,
Host_WriteServerConfig,
pfnChangeInstance,
pfnStartBackgroundTrack,
@@ -1000,8 +1191,36 @@ static ui_enginefuncs_t gEngfuncs =
GL_ProcessTexture,
COM_CompareFileTime,
VID_GetModeString,
COM_SaveFile,
FS_Delete,
(void*)COM_SaveFile,
(void*)FS_Delete
};
static void pfnEnableTextInput( int enable )
{
Key_EnableTextInput( enable, false );
}
static int pfnGetRenderers( unsigned int num, char *shortName, size_t size1, char *readableName, size_t size2 )
{
if( num >= ref.numRenderers )
return 0;
if( shortName && size1 )
Q_strncpy( shortName, ref.shortNames[num], size1 );
if( readableName && size2 )
Q_strncpy( readableName, ref.readableNames[num], size2 );
return 1;
}
static ui_extendedfuncs_t gExtendedfuncs =
{
pfnEnableTextInput,
Con_UtfProcessChar,
Con_UtfMoveLeft,
Con_UtfMoveRight,
pfnGetRenderers
};
void UI_UnloadProgs( void )
@@ -1024,7 +1243,12 @@ void UI_UnloadProgs( void )
qboolean UI_LoadProgs( void )
{
static ui_enginefuncs_t gpEngfuncs;
static ui_extendedfuncs_t gpExtendedfuncs;
static ui_globalvars_t gpGlobals;
UIEXTENEDEDAPI GetExtAPI;
UITEXTAPI GiveTextApi;
MENUAPI GetMenuAPI;
string dllpath;
int i;
if( gameui.hInstance ) UI_UnloadProgs();
@@ -1032,12 +1256,27 @@ qboolean UI_LoadProgs( void )
// setup globals
gameui.globals = &gpGlobals;
if(( gameui.hInstance = COM_LoadLibrary( va( "%s/menu.dll", GI->dll_path ), false, false )) == NULL )
COM_GetCommonLibraryPath( LIBRARY_GAMEUI, dllpath, sizeof( dllpath ));
if(!( gameui.hInstance = COM_LoadLibrary( dllpath, false, false )))
{
if(( gameui.hInstance = COM_LoadLibrary( "menu.dll", false, true )) == NULL )
string path = OS_LIB_PREFIX "menu." OS_LIB_EXT;
FS_AllowDirectPaths( true );
// no use to load it from engine directory, as library loader
// that implements internal gamelibs already knows how to load it
#ifndef XASH_INTERNAL_GAMELIBS
if(!( gameui.hInstance = COM_LoadLibrary( path, false, true )))
#endif
{
FS_AllowDirectPaths( false );
return false;
}
}
FS_AllowDirectPaths( false );
if(( GetMenuAPI = (MENUAPI)COM_GetProcAddress( gameui.hInstance, "GetMenuAPI" )) == NULL )
{
COM_FreeLibrary( gameui.hInstance );
@@ -1046,6 +1285,9 @@ qboolean UI_LoadProgs( void )
return false;
}
gameui.use_text_api = false;
// make local copy of engfuncs to prevent overwrite it with user dll
memcpy( &gpEngfuncs, &gEngfuncs, sizeof( gpEngfuncs ));
@@ -1060,6 +1302,41 @@ qboolean UI_LoadProgs( void )
return false;
}
// make local copy of engfuncs to prevent overwrite it with user dll
memcpy( &gpExtendedfuncs, &gExtendedfuncs, sizeof( gExtendedfuncs ));
memset( &gameui.dllFuncs2, 0, sizeof( gameui.dllFuncs2 ));
// try to initialize new extended API
if( ( GetExtAPI = (UIEXTENEDEDAPI)COM_GetProcAddress( gameui.hInstance, "GetExtAPI" ) ) )
{
Con_Reportf( "UI_LoadProgs: extended Menu API found\n" );
if( GetExtAPI( MENU_EXTENDED_API_VERSION, &gameui.dllFuncs2, &gpExtendedfuncs ) )
{
Con_Reportf( "UI_LoadProgs: extended Menu API initialized\n" );
gameui.use_text_api = true;
}
}
else // otherwise, fallback to old and deprecated extensions
{
if( ( GiveTextApi = (UITEXTAPI)COM_GetProcAddress( gameui.hInstance, "GiveTextAPI" ) ) )
{
Con_Reportf( "UI_LoadProgs: extended text API found\n" );
Con_Reportf( S_WARN "Text API is deprecated! If you are mod developer, consider moving to Extended Menu API!\n" );
if( GiveTextApi( &gpExtendedfuncs ) ) // they are binary compatible, so we can just pass extended funcs API to menu
{
Con_Reportf( "UI_LoadProgs: extended text API initialized\n" );
gameui.use_text_api = true;
}
}
gameui.dllFuncs2.pfnAddTouchButtonToList = (ADDTOUCHBUTTONTOLIST)COM_GetProcAddress( gameui.hInstance, "AddTouchButtonToList" );
if( gameui.dllFuncs2.pfnAddTouchButtonToList )
{
Con_Reportf( "UI_LoadProgs: AddTouchButtonToList call found\n" );
Con_Reportf( S_WARN "AddTouchButtonToList is deprecated! If you are mod developer, consider moving to Extended Menu API!\n" );
}
}
Cvar_FullSet( "host_gameuiloaded", "1", FCVAR_READ_ONLY );
// setup gameinfo
@@ -1072,10 +1349,10 @@ qboolean UI_LoadProgs( void )
UI_ConvertGameInfo( &gameui.gameInfo, SI.GameInfo ); // current gameinfo
// setup globals
gameui.globals->allow_console = host.allow_console;
gameui.globals->developer = host.allow_console;
// initialize game
gameui.dllFuncs.pfnInit();
return true;
}
}

View File

@@ -17,10 +17,11 @@ GNU General Public License for more details.
#include "client.h"
#include "net_encode.h"
#include "cl_tent.h"
#include "gl_local.h"
#include "input.h"
#include "../cl_dll/kbutton.h"
#include "kbutton.h"
#include "vgui_draw.h"
#include "library.h"
#include "vid_common.h"
#define MAX_TOTAL_CMDS 32
#define MAX_CMD_BUFFER 8000
@@ -56,6 +57,7 @@ convar_t *cl_nosmooth;
convar_t *cl_smoothtime;
convar_t *cl_clockreset;
convar_t *cl_fixtimerate;
convar_t *hud_scale;
convar_t *cl_solid_players;
convar_t *cl_draw_beams;
convar_t *cl_updaterate;
@@ -63,7 +65,13 @@ convar_t *cl_showevents;
convar_t *cl_cmdrate;
convar_t *cl_interp;
convar_t *cl_dlmax;
convar_t *cl_upmax;
convar_t *cl_lw;
convar_t *cl_charset;
convar_t *cl_trace_messages;
convar_t *hud_utf8;
convar_t *ui_renderworld;
//
// userinfo
@@ -78,8 +86,10 @@ client_t cl;
client_static_t cls;
clgame_static_t clgame;
void CL_InternetServers_f( void );
//======================================================================
qboolean CL_Active( void )
int CL_Active( void )
{
return ( cls.state == ca_active );
}
@@ -146,19 +156,6 @@ qboolean CL_IsBackgroundMap( void )
return ( cl.background && !cls.demoplayback );
}
qboolean CL_IsQuakeCompatible( void )
{
// feature set
if( FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
return true;
// quake demo playing
if( cls.demoplayback == DEMO_QUAKE1 )
return true;
return false;
}
char *CL_Userinfo( void )
{
return cls.userinfo;
@@ -203,12 +200,18 @@ void CL_CheckClientState( void )
}
}
int CL_GetFragmentSize( void *unused )
int CL_GetFragmentSize( void *unused, fragsize_t mode )
{
if( mode == FRAGSIZE_SPLIT )
return 0;
if( mode == FRAGSIZE_UNRELIABLE )
return NET_MAX_MESSAGE;
if( Netchan_IsLocal( &cls.netchan ))
return FRAGMENT_LOCAL_SIZE;
return FRAGMENT_MIN_SIZE;
return cl_upmax->value;
}
/*
@@ -269,13 +272,13 @@ static float CL_LerpPoint( void )
if( frac < 0.0f )
{
if( frac < -0.01 )
if( frac < -0.01f )
cl.time = cl.mtime[1];
frac = 0.0f;
}
else if( frac > 1.0f )
{
if( frac > 1.01 )
if( frac > 1.01f )
cl.time = cl.mtime[0];
frac = 1.0f;
}
@@ -640,7 +643,7 @@ void CL_CreateCmd( void )
if( !cls.demoplayback )
{
pcmd->senttime = host.realtime;
pcmd->senttime = host.realtime;
memset( &pcmd->cmd, 0, sizeof( pcmd->cmd ));
pcmd->receivedtime = -1.0;
pcmd->heldback = false;
@@ -648,7 +651,9 @@ void CL_CreateCmd( void )
}
active = (( cls.signon == SIGNONS ) && !cl.paused && !cls.demoplayback );
Platform_PreCreateMove();
clgame.dllFuncs.CL_CreateMove( host.frametime, &pcmd->cmd, active );
IN_EngineAppendMove( host.frametime, &pcmd->cmd, active );
CL_PopPMStates();
@@ -802,7 +807,7 @@ void CL_WritePacket( void )
newcmds = ( cls.netchan.outgoing_sequence - cls.lastoutgoingcommand );
// put an upper/lower bound on this
newcmds = bound( 0, newcmds, MAX_TOTAL_CMDS );
newcmds = bound( 0, newcmds, cls.legacymode?MAX_LEGACY_TOTAL_CMDS:MAX_TOTAL_CMDS );
if( cls.state == ca_connected ) newcmds = 0;
MSG_WriteByte( &buf, newcmds );
@@ -904,7 +909,7 @@ CL_BeginUpload_f
*/
void CL_BeginUpload_f( void )
{
char *name;
const char *name;
resource_t custResource;
byte *buf = NULL;
int size = 0;
@@ -991,38 +996,6 @@ void CL_Drop( void )
CL_Disconnect();
}
/*
=======================
CL_GetCDKeyHash()
Connections will now use a hashed cd key value
=======================
*/
char *CL_GetCDKeyHash( void )
{
const char *keyBuffer;
static char szHashedKeyBuffer[256];
int nKeyLength = 0;
byte digest[17]; // The MD5 Hash
MD5Context_t ctx;
keyBuffer = Sys_GetMachineKey( &nKeyLength );
// now get the md5 hash of the key
memset( &ctx, 0, sizeof( ctx ));
memset( digest, 0, sizeof( digest ));
MD5Init( &ctx );
MD5Update( &ctx, (byte *)keyBuffer, nKeyLength );
MD5Final( digest, &ctx );
digest[16] = '\0';
memset( szHashedKeyBuffer, 0, 256 );
Q_strncpy( szHashedKeyBuffer, MD5_Print( digest ), sizeof( szHashedKeyBuffer ));
return szHashedKeyBuffer;
}
/*
=======================
CL_SendConnectPacket
@@ -1034,8 +1007,8 @@ connect.
void CL_SendConnectPacket( void )
{
char protinfo[MAX_INFO_STRING];
char *qport;
char *key;
const char *qport;
const char *key;
netadr_t adr;
if( !NET_StringToAdr( cls.servername, &adr ))
@@ -1047,13 +1020,63 @@ void CL_SendConnectPacket( void )
if( adr.port == 0 ) adr.port = MSG_BigShort( PORT_SERVER );
qport = Cvar_VariableString( "net_qport" );
key = CL_GetCDKeyHash();
key = ID_GetMD5();
memset( protinfo, 0, sizeof( protinfo ));
Info_SetValueForKey( protinfo, "uuid", key, sizeof( protinfo ));
Info_SetValueForKey( protinfo, "qport", qport, sizeof( protinfo ));
Netchan_OutOfBandPrint( NS_CLIENT, adr, "connect %i %i \"%s\" \"%s\"\n", PROTOCOL_VERSION, cls.challenge, protinfo, cls.userinfo );
if( adr.type == NA_LOOPBACK )
{
IN_LockInputDevices( false );
}
else
{
int input_devices;
input_devices = IN_CollectInputDevices();
IN_LockInputDevices( true );
Info_SetValueForKey( protinfo, "d", va( "%d", input_devices ), sizeof( protinfo ) );
Info_SetValueForKey( protinfo, "v", XASH_VERSION, sizeof( protinfo ) );
Info_SetValueForKey( protinfo, "b", va( "%d", Q_buildnum() ), sizeof( protinfo ) );
Info_SetValueForKey( protinfo, "o", Q_buildos(), sizeof( protinfo ) );
Info_SetValueForKey( protinfo, "a", Q_buildarch(), sizeof( protinfo ) );
}
if( cls.legacymode )
{
// set related userinfo keys
if( cl_dlmax->value >= 40000 || cl_dlmax->value < 100 )
Info_SetValueForKey( cls.userinfo, "cl_maxpacket", "1400", sizeof( cls.userinfo ) );
else
Info_SetValueForKey( cls.userinfo, "cl_maxpacket", cl_dlmax->string, sizeof( cls.userinfo ) );
if( !*Info_ValueForKey( cls.userinfo,"cl_maxpayload") )
Info_SetValueForKey( cls.userinfo, "cl_maxpayload", "1000", sizeof( cls.userinfo ) );
Info_SetValueForKey( protinfo, "i", key, sizeof( protinfo ) );
Netchan_OutOfBandPrint( NS_CLIENT, adr, "connect %i %i %i \"%s\" %d \"%s\"\n",
PROTOCOL_LEGACY_VERSION, Q_atoi( qport ), cls.challenge, cls.userinfo, NET_LEGACY_EXT_SPLIT, protinfo );
Con_Printf( "Trying to connect by legacy protocol\n" );
}
else
{
int extensions = NET_EXT_SPLITSIZE;
if( cl_dlmax->value > FRAGMENT_MAX_SIZE || cl_dlmax->value < FRAGMENT_MIN_SIZE )
Cvar_SetValue( "cl_dlmax", FRAGMENT_DEFAULT_SIZE );
Info_RemoveKey( cls.userinfo, "cl_maxpacket" );
Info_RemoveKey( cls.userinfo, "cl_maxpayload" );
Info_SetValueForKey( protinfo, "uuid", key, sizeof( protinfo ));
Info_SetValueForKey( protinfo, "qport", qport, sizeof( protinfo ));
Info_SetValueForKey( protinfo, "ext", va("%d", extensions), sizeof( protinfo ));
Netchan_OutOfBandPrint( NS_CLIENT, adr, "connect %i %i \"%s\" \"%s\"\n", PROTOCOL_VERSION, cls.challenge, protinfo, cls.userinfo );
Con_Printf( "Trying to connect by modern protocol\n" );
}
cls.timestart = Sys_DoubleTime();
}
@@ -1067,6 +1090,10 @@ Resend a connect message if the last one has timed out
void CL_CheckForResend( void )
{
netadr_t adr;
int res;
if( cls.internetservers_wait )
CL_InternetServers_f();
// if the local server is running and we aren't then connect
if( cls.state == ca_disconnected && SV_Active( ))
@@ -1074,6 +1101,8 @@ void CL_CheckForResend( void )
cls.signon = 0;
cls.state = ca_connecting;
Q_strncpy( cls.servername, "localhost", sizeof( cls.servername ));
cls.serveradr.type = NA_LOOPBACK;
// we don't need a challenge on the localhost
CL_SendConnectPacket();
return;
@@ -1091,12 +1120,20 @@ void CL_CheckForResend( void )
if(( host.realtime - cls.connect_time ) < cl_resend.value )
return;
if( !NET_StringToAdr( cls.servername, &adr ))
res = NET_StringToAdrNB( cls.servername, &adr );
if( !res )
{
CL_Disconnect();
return;
}
if( res == 2 )
{
cls.connect_time = MAX_HEARTBEAT;
return;
}
// only retry so many times before failure.
if( cls.connect_retry >= CL_CONNECTION_RETRIES )
{
@@ -1118,15 +1155,17 @@ void CL_CheckForResend( void )
return;
}
cls.serveradr = adr;
cls.max_fragment_size = Q_max( FRAGMENT_MAX_SIZE, cls.max_fragment_size >> Q_min( 1, cls.connect_retry ));
cls.connect_time = host.realtime; // for retransmit requests
cls.connect_retry++;
Con_Printf( "Connecting to %s... [retry #%i]\n", cls.servername, cls.connect_retry );
if( cl_test_bandwidth.value )
if( !cls.legacymode && cl_test_bandwidth.value )
Netchan_OutOfBandPrint( NS_CLIENT, adr, "bandwidth %i %i\n", PROTOCOL_VERSION, cls.max_fragment_size );
else Netchan_OutOfBandPrint( NS_CLIENT, adr, "getchallenge\n" );
else
Netchan_OutOfBandPrint( NS_CLIENT, adr, "getchallenge\n" );
}
resource_t *CL_AddResource( resourcetype_t type, const char *name, int size, qboolean bFatalIfMissing, int index )
@@ -1191,8 +1230,14 @@ CL_Connect_f
void CL_Connect_f( void )
{
string server;
qboolean legacyconnect = false;
if( Cmd_Argc() != 2 )
// hidden hint to connect by using legacy protocol
if( Cmd_Argc() == 3 )
{
legacyconnect = !Q_strcmp( Cmd_Argv( 2 ), "legacy" );
}
else if( Cmd_Argc() != 2 )
{
Con_Printf( S_USAGE "connect <server>\n" );
return;
@@ -1212,6 +1257,7 @@ void CL_Connect_f( void )
Key_SetKeyDest( key_console );
cls.state = ca_connecting;
cls.legacymode = legacyconnect;
Q_strncpy( cls.servername, server, sizeof( cls.servername ));
cls.connect_time = MAX_HEARTBEAT; // CL_CheckForResend() will fire immediately
cls.max_fragment_size = FRAGMENT_MAX_SIZE; // guess a we can establish connection with maximum fragment size
@@ -1322,6 +1368,7 @@ void CL_ClearState( void )
Cvar_SetValue( "scr_download", -1.0f );
Cvar_SetValue( "scr_loading", 0.0f );
host.allow_console = host.allow_console_init;
HTTP_ClearCustomServers();
}
/*
@@ -1351,6 +1398,24 @@ void CL_SendDisconnectMessage( void )
Netchan_TransmitBits( &cls.netchan, MSG_GetNumBitsWritten( &buf ), MSG_GetData( &buf ));
}
int CL_GetSplitSize( void )
{
int splitsize;
if( Host_IsDedicated() )
return 0;
if( !(cls.extensions & NET_EXT_SPLITSIZE) )
return 1400;
splitsize = cl_dlmax->value;
if( splitsize < FRAGMENT_MIN_SIZE || splitsize > FRAGMENT_MAX_SIZE )
Cvar_SetValue( "cl_dlmax", FRAGMENT_DEFAULT_SIZE );
return cl_dlmax->value;
}
/*
=====================
CL_Reconnect
@@ -1363,6 +1428,28 @@ void CL_Reconnect( qboolean setup_netchan )
if( setup_netchan )
{
Netchan_Setup( NS_CLIENT, &cls.netchan, net_from, Cvar_VariableInteger( "net_qport" ), NULL, CL_GetFragmentSize );
if( cls.legacymode )
{
unsigned int extensions = Q_atoi( Cmd_Argv( 1 ) );
if( extensions & NET_LEGACY_EXT_SPLIT )
{
// only enable incoming split for legacy mode
cls.netchan.split = true;
Con_Reportf( "^2NET_EXT_SPLIT enabled^7 (packet sizes is %d/%d)\n", (int)cl_dlmax->value, 65536 );
}
}
else
{
cls.extensions = Q_atoi( Info_ValueForKey( Cmd_Argv( 1 ), "ext" ));
if( cls.extensions & NET_EXT_SPLITSIZE )
{
Con_Reportf( "^2NET_EXT_SPLITSIZE enabled^7 (packet size is %d)\n", (int)cl_dlmax->value );
}
}
}
else
{
@@ -1397,6 +1484,8 @@ This is also called on Host_Error, so it shouldn't cause any errors
*/
void CL_Disconnect( void )
{
cls.legacymode = false;
if( cls.state == ca_disconnected )
return;
@@ -1415,7 +1504,10 @@ void CL_Disconnect( void )
// clear the network channel, too.
Netchan_Clear( &cls.netchan );
IN_LockInputDevices( false ); // unlock input devices
cls.state = ca_disconnected;
memset( &cls.serveradr, 0, sizeof( cls.serveradr ) );
cls.set_lastdemo = false;
cls.connect_retry = 0;
cls.signon = 0;
@@ -1463,7 +1555,8 @@ void CL_LocalServers_f( void )
Con_Printf( "Scanning for servers on the local network area...\n" );
NET_Config( true ); // allow remote
cls.legacyservercount = 0;
// send a broadcast packet
adr.type = NA_BROADCAST;
adr.port = MSG_BigShort( PORT_SERVER );
@@ -1471,6 +1564,8 @@ void CL_LocalServers_f( void )
Netchan_OutOfBandPrint( NS_CLIENT, adr, "info %i", PROTOCOL_VERSION );
}
#define MS_SCAN_REQUEST "1\xFF" "0.0.0.0:0\0"
/*
=================
CL_InternetServers_f
@@ -1479,28 +1574,27 @@ CL_InternetServers_f
void CL_InternetServers_f( void )
{
char fullquery[512] = MS_SCAN_REQUEST;
char *info = fullquery + sizeof( MS_SCAN_REQUEST ) - 1;
int remaining = sizeof( fullquery ) - sizeof( MS_SCAN_REQUEST );
netadr_t adr;
char *info = fullquery + sizeof( MS_SCAN_REQUEST ) - 1;
const size_t remaining = sizeof( fullquery ) - sizeof( MS_SCAN_REQUEST );
NET_Config( true ); // allow remote
if( !NET_StringToAdr( MASTERSERVER_ADR, &adr ) )
{
Con_DPrintf( S_ERROR "Can't resolve adr: %s\n", MASTERSERVER_ADR );
return;
}
Con_Printf( "Scanning for servers on the internet area...\n" );
Info_SetValueForKey( info, "gamedir", GI->gamefolder, remaining );
Info_SetValueForKey( info, "clver", XASH_VERSION, remaining ); // let master know about client version
// Info_SetValueForKey( info, "nat", cl_nat->string, remaining );
cls.legacyservercount = 0;
NET_SendPacket( NS_CLIENT, sizeof( MS_SCAN_REQUEST ) + Q_strlen( info ), fullquery, adr );
cls.internetservers_wait = NET_SendToMasters( NS_CLIENT, sizeof( MS_SCAN_REQUEST ) + Q_strlen( info ), fullquery );
cls.internetservers_pending = true;
// now we clearing the vgui request
if( clgame.master_request != NULL )
memset( clgame.master_request, 0, sizeof( net_request_t ));
clgame.request_type = NET_REQUEST_GAMEUI;
if( !cls.internetservers_wait )
{
// now we clearing the vgui request
if( clgame.master_request != NULL )
memset( clgame.master_request, 0, sizeof( net_request_t ));
clgame.request_type = NET_REQUEST_GAMEUI;
}
}
/*
@@ -1612,15 +1706,35 @@ void CL_ParseStatusMessage( netadr_t from, sizebuf_t *msg )
{
static char infostring[MAX_INFO_STRING+8];
char *s = MSG_ReadString( msg );
int i;
CL_FixupColorStringsForInfoString( s, infostring );
if( Q_strstr( infostring, "wrong version" ) )
{
Netchan_OutOfBandPrint( NS_CLIENT, from, "info %i", PROTOCOL_LEGACY_VERSION );
Con_Printf( "^1Server^7: %s, Info: %s\n", NET_AdrToString( from ), infostring );
if( cls.legacyservercount < MAX_LEGACY_SERVERS )
cls.legacyservers[cls.legacyservercount++] = from;
return;
}
if( !COM_CheckString( Info_ValueForKey( infostring, "gamedir" )))
{
Con_Printf( "^1Server^7: %s, Info: %s\n", NET_AdrToString( from ), infostring );
return; // unsupported proto
}
for( i = 0; i < cls.legacyservercount; i++ )
{
if( NET_CompareAdr( cls.legacyservers[i], from ) )
{
Info_SetValueForKey( infostring, "legacy", "1", sizeof( infostring ) );
Con_Print("Legacy: ");
break;
}
}
// more info about servers
Con_Printf( "^2Server^7: %s, Game: %s\n", NET_AdrToString( from ), Info_ValueForKey( infostring, "gamedir" ));
@@ -1640,7 +1754,7 @@ void CL_ParseNETInfoMessage( netadr_t from, sizebuf_t *msg, const char *s )
static char infostring[MAX_INFO_STRING+8];
int i, context, type;
int errorBits = 0;
char *val;
const char *val;
context = Q_atoi( Cmd_Argv( 1 ));
type = Q_atoi( Cmd_Argv( 2 ));
@@ -1729,7 +1843,7 @@ void CL_SetupOverviewParams( void )
// calculate nearest aspect
mapAspect = world.size[!ov->rotated] / world.size[ov->rotated];
screenAspect = (float)glState.width / (float)glState.height;
screenAspect = (float)refState.width / (float)refState.height;
aspect = Q_max( mapAspect, screenAspect );
ov->zNear = world.maxs[2];
@@ -1751,6 +1865,19 @@ void CL_SetupOverviewParams( void )
}
}
/*
=================
CL_IsFromConnectingServer
Used for connectionless packets, when netchan may not be ready.
=================
*/
static qboolean CL_IsFromConnectingServer( netadr_t from )
{
return NET_IsLocalAddress( from ) ||
NET_CompareAdr( cls.serveradr, from );
}
/*
=================
CL_ConnectionlessPacket
@@ -1761,7 +1888,8 @@ Responses to broadcasts, etc
void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
{
char *args;
char *c, buf[MAX_SYSPATH];
const char *c;
char buf[MAX_SYSPATH];
int len = sizeof( buf );
int dataoffset = 0;
netadr_t servadr;
@@ -1779,6 +1907,9 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
// server connection
if( !Q_strcmp( c, "client_connect" ))
{
if( !CL_IsFromConnectingServer( from ))
return;
if( cls.state == ca_connected )
{
Con_DPrintf( S_ERROR "dup connect received. ignored\n");
@@ -1807,8 +1938,9 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
return;
}
ShowWindow( host.hWnd, SW_RESTORE );
SetForegroundWindow ( host.hWnd );
#if XASH_SDL == 2
SDL_ShowWindow( host.hWnd );
#endif
args = MSG_ReadString( msg );
Cbuf_AddText( args );
Cbuf_AddText( "\n" );
@@ -1821,10 +1953,16 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
else if( !Q_strcmp( c, "testpacket" ))
{
byte recv_buf[NET_MAX_FRAGMENT];
dword crcValue = MSG_ReadLong( msg );
int realsize = MSG_GetMaxBytes( msg ) - MSG_GetNumBytesRead( msg );
dword crcValue;
int realsize;
dword crcValue2 = 0;
if( !CL_IsFromConnectingServer( from ))
return;
crcValue = MSG_ReadLong( msg );
realsize = MSG_GetMaxBytes( msg ) - MSG_GetNumBytesRead( msg );
if( cls.max_fragment_size != MSG_GetMaxBytes( msg ))
{
if( cls.connect_retry >= CL_TEST_RETRIES )
@@ -1832,7 +1970,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
// too many fails use default connection method
Con_Printf( "hi-speed connection is failed, use default method\n" );
Netchan_OutOfBandPrint( NS_CLIENT, from, "getchallenge\n" );
Cvar_SetValue( "cl_dlmax", FRAGMENT_MIN_SIZE );
Cvar_SetValue( "cl_dlmax", FRAGMENT_DEFAULT_SIZE );
cls.connect_time = host.realtime;
return;
}
@@ -1851,7 +1989,8 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
if( crcValue == crcValue2 )
{
// packet was sucessfully delivered, adjust the fragment size and get challenge
Con_DPrintf( "CRC %p is matched, get challenge, fragment size %d\n", crcValue, cls.max_fragment_size );
Con_DPrintf( "CRC %x is matched, get challenge, fragment size %d\n", crcValue, cls.max_fragment_size );
Netchan_OutOfBandPrint( NS_CLIENT, from, "getchallenge\n" );
Cvar_SetValue( "cl_dlmax", cls.max_fragment_size );
cls.connect_time = host.realtime;
@@ -1868,6 +2007,8 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
return;
}
Msg( "got testpacket, CRC mismatched 0x%08x should be 0x%08x, trying next fragment size %d\n", crcValue2, crcValue, cls.max_fragment_size >> 1 );
// trying the next size of packet
cls.connect_time = MAX_HEARTBEAT;
}
@@ -1879,6 +2020,9 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
}
else if( !Q_strcmp( c, "challenge" ))
{
if( !CL_IsFromConnectingServer( from ))
return;
// challenge from the server we are connecting to
cls.challenge = Q_atoi( Cmd_Argv( 1 ));
CL_SendConnectPacket();
@@ -1886,14 +2030,68 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
}
else if( !Q_strcmp( c, "echo" ))
{
if( !CL_IsFromConnectingServer( from ))
return;
// echo request from server
Netchan_OutOfBandPrint( NS_CLIENT, from, "%s", Cmd_Argv( 1 ));
}
else if( !Q_strcmp( c, "disconnect" ))
{
if( !CL_IsFromConnectingServer( from ))
return;
// a disconnect message from the server, which will happen if the server
// dropped the connection but it is still getting packets from us
CL_Disconnect_f();
if( NET_CompareAdr( from, cls.legacyserver ))
{
Cbuf_AddText( va( "connect %s legacy\n", NET_AdrToString( from )));
memset( &cls.legacyserver, 0, sizeof( cls.legacyserver ));
}
}
else if( !Q_strcmp( c, "errormsg" ))
{
if( !CL_IsFromConnectingServer( from ))
return;
args = MSG_ReadString( msg );
if( !Q_strcmp( args, "Server uses protocol version 48.\n" ))
{
cls.legacyserver = from;
}
else
{
if( UI_IsVisible() )
UI_ShowMessageBox( va("^3Server message^7\n%s", args ) );
Msg( "%s", args );
}
}
else if( !Q_strcmp( c, "updatemsg" ))
{
// got an update message from master server
// show update dialog from menu
netadr_t adr;
qboolean preferStore = true;
if( !Q_strcmp( Cmd_Argv( 1 ), "nostore" ) )
preferStore = false;
// trust only hardcoded master server
if( NET_StringToAdr( MASTERSERVER_ADR, &adr ) )
{
if( NET_CompareAdr( from, adr ))
{
UI_ShowUpdateDialog( preferStore );
}
}
else
{
// in case we don't have master anymore
UI_ShowUpdateDialog( preferStore );
}
}
else if( !Q_strcmp( c, "f" ))
{
@@ -1924,7 +2122,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
nr->pfnFunc( &nr->resp );
// throw the list, now it will be stored in user area
prev = &((net_adrlist_t *)nr->resp.response);
prev = (net_adrlist_t**)&nr->resp.response;
while( 1 )
{
@@ -1959,11 +2157,17 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
Netchan_OutOfBandPrint( NS_CLIENT, servadr, "info %i", PROTOCOL_VERSION );
}
}
if( cls.internetservers_pending )
{
UI_ResetPing();
cls.internetservers_pending = false;
}
}
else if( clgame.dllFuncs.pfnConnectionlessPacket( &from, args, buf, &len ))
{
// user out of band message (must be handled in CL_ConnectionlessPacket)
if( len > 0 ) Netchan_OutOfBand( NS_SERVER, from, len, buf );
if( len > 0 ) Netchan_OutOfBand( NS_SERVER, from, len, (byte *)buf );
}
else Con_DPrintf( S_ERROR "bad connectionless packet from %s:\n%s\n", NET_AdrToString( from ), args );
}
@@ -2000,6 +2204,11 @@ void CL_ReadNetMessage( void )
while( CL_GetMessage( net_message_buffer, &curSize ))
{
if( cls.legacymode && *((int *)&net_message_buffer) == 0xFFFFFFFE )
// Will rewrite existing packet by merged
if( !NetSplit_GetLong( &cls.netchan.netsplit, &net_from, net_message_buffer, &curSize ) )
continue;
MSG_Init( &net_message, "ServerData", net_message_buffer, curSize );
// check for connectionless packet (0xffffffff) first
@@ -2031,6 +2240,7 @@ void CL_ReadNetMessage( void )
// run special handler for quake demos
if( cls.demoplayback == DEMO_QUAKE1 )
CL_ParseQuakeMessage( &net_message, true );
else if( cls.legacymode ) CL_ParseLegacyServerMessage( &net_message, true );
else CL_ParseServerMessage( &net_message, true );
cl.send_reply = true;
}
@@ -2112,7 +2322,7 @@ void CL_ReadPackets( void )
// if in the debugger last frame, don't timeout
if( host.frametime > 5.0f ) cls.netchan.last_received = Sys_DoubleTime();
// check timeout
if( cls.state >= ca_connected && cls.state != ca_cinematic && !cls.demoplayback )
{
@@ -2201,6 +2411,17 @@ void CL_ProcessFile( qboolean successfully_received, const char *filename )
{
Con_Printf( S_ERROR "server failed to transmit file '%s'\n", CL_CleanFileName( filename ));
}
if( cls.legacymode )
{
if( host.downloadcount > 0 )
host.downloadcount--;
if( !host.downloadcount )
{
MSG_WriteByte( &cls.netchan.message, clc_stringcmd );
MSG_WriteString( &cls.netchan.message, "continueloading" );
}
return;
}
pfilename = filename;
@@ -2250,7 +2471,7 @@ void CL_ProcessFile( qboolean successfully_received, const char *filename )
}
else
{
Con_Printf( "Downloaded %i bytes for purported %i byte file, ignoring download\n",
Con_Printf( "Downloaded %i bytes for purported %i byte file, ignoring download\n",
cls.netchan.tempbuffersize, p->nDownloadSize );
}
@@ -2445,7 +2666,7 @@ qboolean CL_PrecacheResources( void )
{
if( FBitSet( pRes->ucFlags, RES_WASMISSING ))
{
Con_Printf( S_ERROR "%s%s couldn't load\n", DEFAULT_SOUNDPATH, pRes->szFileName );
Con_Printf( S_ERROR "Could not load sound %s%s\n", DEFAULT_SOUNDPATH, pRes->szFileName );
cl.sound_precache[pRes->nIndex][0] = 0;
cl.sound_index[pRes->nIndex] = 0;
}
@@ -2573,6 +2794,7 @@ void CL_InitLocal( void )
{
cls.state = ca_disconnected;
cls.signon = 0;
memset( &cls.serveradr, 0, sizeof( cls.serveradr ) );
cl.resourcesneeded.pNext = cl.resourcesneeded.pPrev = &cl.resourcesneeded;
cl.resourcesonhand.pNext = cl.resourcesonhand.pPrev = &cl.resourcesonhand;
@@ -2594,16 +2816,21 @@ void CL_InitLocal( void )
cl_solid_players = Cvar_Get( "cl_solid_players", "1", 0, "Make all players not solid (can't traceline them)" );
cl_interp = Cvar_Get( "ex_interp", "0.1", FCVAR_ARCHIVE, "Interpolate object positions starting this many seconds in past" );
cl_timeout = Cvar_Get( "cl_timeout", "60", 0, "connect timeout (in-seconds)" );
cl_charset = Cvar_Get( "cl_charset", "utf-8", FCVAR_ARCHIVE, "1-byte charset to use (iconv style)" );
hud_utf8 = Cvar_Get( "hud_utf8", "0", FCVAR_ARCHIVE, "Use utf-8 encoding for hud text" );
rcon_client_password = Cvar_Get( "rcon_password", "", 0, "remote control client password" );
rcon_address = Cvar_Get( "rcon_address", "", 0, "remote control address" );
cl_trace_messages = Cvar_Get( "cl_trace_messages", "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable message names tracing (good for developers)");
// userinfo
cl_nopred = Cvar_Get( "cl_nopred", "0", FCVAR_ARCHIVE|FCVAR_USERINFO, "disable client movement prediction" );
name = Cvar_Get( "name", Sys_GetCurrentUser(), FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_PRINTABLEONLY, "player name" );
model = Cvar_Get( "model", "", FCVAR_USERINFO|FCVAR_ARCHIVE, "player model ('player' is a singleplayer model)" );
cl_updaterate = Cvar_Get( "cl_updaterate", "20", FCVAR_USERINFO|FCVAR_ARCHIVE, "refresh rate of server messages" );
cl_dlmax = Cvar_Get( "cl_dlmax", "0", FCVAR_USERINFO|FCVAR_ARCHIVE, "max allowed fragment size on download resources" );
cl_dlmax = Cvar_Get( "cl_dlmax", "0", FCVAR_USERINFO|FCVAR_ARCHIVE, "max allowed outcoming fragment size" );
cl_upmax = Cvar_Get( "cl_upmax", "1200", FCVAR_ARCHIVE, "max allowed incoming fragment size" );
rate = Cvar_Get( "rate", "3500", FCVAR_USERINFO|FCVAR_ARCHIVE, "player network rate" );
topcolor = Cvar_Get( "topcolor", "0", FCVAR_USERINFO|FCVAR_ARCHIVE, "player top color" );
bottomcolor = Cvar_Get( "bottomcolor", "0", FCVAR_USERINFO|FCVAR_ARCHIVE, "player bottom color" );
@@ -2626,10 +2853,11 @@ void CL_InitLocal( void )
cl_bmodelinterp = Cvar_Get( "cl_bmodelinterp", "1", FCVAR_ARCHIVE, "enable bmodel interpolation" );
cl_clockreset = Cvar_Get( "cl_clockreset", "0.1", FCVAR_ARCHIVE, "frametime delta maximum value before reset" );
cl_fixtimerate = Cvar_Get( "cl_fixtimerate", "7.5", FCVAR_ARCHIVE, "time in msec to client clock adjusting" );
Cvar_Get( "hud_scale", "0", FCVAR_ARCHIVE|FCVAR_LATCH, "scale hud at current resolution" );
hud_scale = Cvar_Get( "hud_scale", "0", FCVAR_ARCHIVE|FCVAR_LATCH, "scale hud at current resolution" );
Cvar_Get( "cl_background", "0", FCVAR_READ_ONLY, "indicate what background map is running" );
cl_showevents = Cvar_Get( "cl_showevents", "0", FCVAR_ARCHIVE, "show events playback" );
Cvar_Get( "lastdemo", "", FCVAR_ARCHIVE, "last played demo" );
ui_renderworld = Cvar_Get( "ui_renderworld", "0", FCVAR_ARCHIVE, "render world when UI is visible" );
// these two added to shut up CS 1.5 about 'unknown' commands
Cvar_Get( "lightgamma", "1", FCVAR_ARCHIVE, "ambient lighting level (legacy, unused)" );
@@ -2688,6 +2916,8 @@ void CL_InitLocal( void )
Cmd_AddCommand ("reconnect", CL_Reconnect_f, "reconnect to current level" );
Cmd_AddCommand ("rcon", CL_Rcon_f, "sends a command to the server console (rcon_password and rcon_address required)" );
Cmd_AddCommand ("precache", CL_LegacyPrecache_f, "legacy server compatibility" );
}
//============================================================================
@@ -2709,12 +2939,13 @@ void CL_AdjustClock( void )
if( fabs( cl.timedelta ) >= 0.001f )
{
double msec, adjust, sign;
double msec, adjust;
float sign;
msec = ( cl.timedelta * 1000.0 );
sign = ( msec < 0 ) ? 1.0 : -1.0;
msec = ( cl.timedelta * 1000.0f );
sign = ( msec < 0 ) ? 1.0f : -1.0f;
msec = fabs( msec );
adjust = sign * ( cl_fixtimerate->value / 1000.0 );
adjust = sign * ( cl_fixtimerate->value / 1000.0f );
if( fabs( adjust ) < fabs( cl.timedelta ))
{
@@ -2824,19 +3055,26 @@ CL_Init
*/
void CL_Init( void )
{
string libpath;
if( host.type == HOST_DEDICATED )
return; // nothing running on the client
CL_InitLocal();
R_Init(); // init renderer
VID_Init(); // init video
S_Init(); // init sound
// unreliable buffer. unsed for unreliable commands and voice stream
MSG_Init( &cls.datagram, "cls.datagram", cls.datagram_buf, sizeof( cls.datagram_buf ));
if( !CL_LoadProgs( va( "%s/client.dll", GI->dll_path )))
Host_Error( "can't initialize client.dll\n" );
// IN_TouchInit();
Con_LoadHistory();
COM_GetCommonLibraryPath( LIBRARY_CLIENT, libpath, sizeof( libpath ));
if( !CL_LoadProgs( libpath ) )
Host_Error( "can't initialize %s: %s\n", libpath, COM_GetLibraryError() );
cls.initialized = true;
cl.maxclients = 1; // allow to drawing player in menu
@@ -2858,11 +3096,18 @@ void CL_Shutdown( void )
Con_Printf( "CL_Shutdown()\n" );
Host_WriteOpenGLConfig ();
Host_WriteVideoConfig ();
if( !host.crashed )
{
Host_WriteOpenGLConfig ();
Host_WriteVideoConfig ();
Touch_WriteConfig();
}
CL_CloseDemoHeader();
// IN_TouchShutdown ();
Joy_Shutdown ();
CL_CloseDemoHeader ();
IN_Shutdown ();
Mobile_Shutdown ();
SCR_Shutdown ();
CL_UnloadProgs ();
@@ -2872,4 +3117,4 @@ void CL_Shutdown( void )
R_Shutdown ();
Con_Shutdown ();
}
}

136
engine/client/cl_mobile.c Normal file
View File

@@ -0,0 +1,136 @@
/*
cl_mobile.c - common mobile interface
Copyright (C) 2015 a1batross
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#include "common.h"
#include "client.h"
#include "mobility_int.h"
#include "library.h"
#include "input.h"
#include "platform/platform.h"
mobile_engfuncs_t *gMobileEngfuncs;
convar_t *vibration_length;
convar_t *vibration_enable;
static void pfnVibrate( float life, char flags )
{
if( !vibration_enable->value )
return;
if( life < 0.0f )
{
Con_Reportf( S_WARN "Negative vibrate time: %f\n", life );
return;
}
//Con_Reportf( "Vibrate: %f %d\n", life, flags );
// here goes platform-specific backends
Platform_Vibrate( life * vibration_length->value, flags );
}
static void Vibrate_f( void )
{
if( Cmd_Argc() != 2 )
{
Msg( S_USAGE "vibrate <time>\n" );
return;
}
pfnVibrate( Q_atof( Cmd_Argv(1) ), VIBRATE_NORMAL );
}
static void pfnEnableTextInput( int enable )
{
Key_EnableTextInput( enable, false );
}
static int pfnDrawScaledCharacter( int x, int y, int number, int r, int g, int b, float scale )
{
int width = clgame.scrInfo.charWidths[number] * scale * hud_scale->value;
int height = clgame.scrInfo.iCharHeight * scale * hud_scale->value;
if( !cls.creditsFont.valid )
return 0;
x *= hud_scale->value;
y *= hud_scale->value;
number &= 255;
number = Con_UtfProcessChar( number );
if( number < 32 )
return 0;
if( y < -height )
return 0;
pfnPIC_Set( cls.creditsFont.hFontTexture, r, g, b, 255 );
pfnPIC_DrawAdditive( x, y, width, height, &cls.creditsFont.fontRc[number] );
return width;
}
static void *pfnGetNativeObject( const char *obj )
{
if( !obj )
return NULL;
// Backend should consider that obj is case-sensitive
return Platform_GetNativeObject( obj );
}
static mobile_engfuncs_t gpMobileEngfuncs =
{
MOBILITY_API_VERSION,
pfnVibrate,
pfnEnableTextInput,
Touch_AddClientButton,
Touch_AddDefaultButton,
Touch_HideButtons,
Touch_RemoveButton,
(void*)Touch_SetClientOnly,
Touch_ResetDefaultButtons,
pfnDrawScaledCharacter,
Sys_Warn,
pfnGetNativeObject,
ID_SetCustomClientID
};
qboolean Mobile_Init( void )
{
qboolean success = false;
pfnMobilityInterface ExportToClient;
// find a mobility interface
ExportToClient = COM_GetProcAddress( clgame.hInstance, MOBILITY_CLIENT_EXPORT );
gMobileEngfuncs = &gpMobileEngfuncs;
if( ExportToClient && !ExportToClient( gMobileEngfuncs ) )
success = true;
Cmd_AddCommand( "vibrate", (xcommand_t)Vibrate_f, "Vibrate for specified time");
vibration_length = Cvar_Get( "vibration_length", "1.0", FCVAR_ARCHIVE, "Vibration length");
vibration_enable = Cvar_Get( "vibration_enable", "1", FCVAR_ARCHIVE, "Enable vibration");
return success;
}
void Mobile_Shutdown( void )
{
Cmd_RemoveCommand( "vibrate" );
}

View File

@@ -15,14 +15,17 @@ GNU General Public License for more details.
#include "common.h"
#include "client.h"
#include "gl_local.h"
#if XASH_LOW_MEMORY
#define NET_TIMINGS 1024
#else
#define NET_TIMINGS 64
#endif
#define NET_TIMINGS_MASK (NET_TIMINGS - 1)
#define LATENCY_AVG_FRAC 0.5
#define FRAMERATE_AVG_FRAC 0.5
#define PACKETLOSS_AVG_FRAC 0.5
#define PACKETCHOKE_AVG_FRAC 0.5
#define LATENCY_AVG_FRAC 0.5f
#define FRAMERATE_AVG_FRAC 0.5f
#define PACKETLOSS_AVG_FRAC 0.5f
#define PACKETCHOKE_AVG_FRAC 0.5f
#define NETGRAPH_LERP_HEIGHT 24
#define NETGRAPH_NET_COLORS 5
#define NUM_LATENCY_SAMPLES 8
@@ -75,12 +78,12 @@ NetGraph_FillRGBA shortcut
*/
static void NetGraph_DrawRect( wrect_t *rect, byte colors[4] )
{
pglColor4ubv( colors ); // color for this quad
ref.dllFuncs.Color4ub( colors[0], colors[1], colors[2], colors[3] ); // color for this quad
pglVertex2f( rect->left, rect->top );
pglVertex2f( rect->left + rect->right, rect->top );
pglVertex2f( rect->left + rect->right, rect->top + rect->bottom );
pglVertex2f( rect->left, rect->top + rect->bottom );
ref.dllFuncs.Vertex3f( rect->left, rect->top, 0 );
ref.dllFuncs.Vertex3f( rect->left + rect->right, rect->top, 0 );
ref.dllFuncs.Vertex3f( rect->left + rect->right, rect->top + rect->bottom, 0 );
ref.dllFuncs.Vertex3f( rect->left, rect->top + rect->bottom, 0 );
}
/*
@@ -204,7 +207,7 @@ void NetGraph_GetFrameData( float *latency, int *latency_count )
else
{
int frame_latency = Q_min( 1.0f, f->latency );
p->latency = (( frame_latency + 0.1 ) / 1.1 ) * ( net_graphheight->value - NETGRAPH_LERP_HEIGHT - 2 );
p->latency = (( frame_latency + 0.1f ) / 1.1f ) * ( net_graphheight->value - NETGRAPH_LERP_HEIGHT - 2 );
if( i > cls.netchan.incoming_sequence - NUM_LATENCY_SAMPLES )
{
@@ -230,12 +233,12 @@ void NetGraph_GetFrameData( float *latency, int *latency_count )
}
// packet loss
loss = 100.0 * (float)loss_count / CL_UPDATE_BACKUP;
packet_loss = PACKETLOSS_AVG_FRAC * packet_loss + ( 1.0 - PACKETLOSS_AVG_FRAC ) * loss;
loss = 100.0f * (float)loss_count / CL_UPDATE_BACKUP;
packet_loss = PACKETLOSS_AVG_FRAC * packet_loss + ( 1.0f - PACKETLOSS_AVG_FRAC ) * loss;
// packet choke
choke = 100.0 * (float)choke_count / CL_UPDATE_BACKUP;
packet_choke = PACKETCHOKE_AVG_FRAC * packet_choke + ( 1.0 - PACKETCHOKE_AVG_FRAC ) * choke;
choke = 100.0f * (float)choke_count / CL_UPDATE_BACKUP;
packet_choke = PACKETCHOKE_AVG_FRAC * packet_choke + ( 1.0f - PACKETCHOKE_AVG_FRAC ) * choke;
}
/*
@@ -366,12 +369,12 @@ void NetGraph_DrawTextFields( int x, int y, int w, wrect_t rect, int count, floa
avg -= 1000.0f / cl_updaterate->value;
// can't be below zero
avg = Q_max( 0.0, avg );
avg = Q_max( 0.0f, avg );
}
else avg = 0.0;
// move rolling average
framerate = FRAMERATE_AVG_FRAC * host.frametime + ( 1.0 - FRAMERATE_AVG_FRAC ) * framerate;
framerate = FRAMERATE_AVG_FRAC * host.frametime + ( 1.0f - FRAMERATE_AVG_FRAC ) * framerate;
Con_SetFont( 0 );
if( framerate > 0.0f )
@@ -397,8 +400,8 @@ void NetGraph_DrawTextFields( int x, int y, int w, wrect_t rect, int count, floa
if( net_graph->value > 2 )
{
int loss = (int)(( packet_loss + PACKETLOSS_AVG_FRAC ) - 0.01 );
int choke = (int)(( packet_choke + PACKETCHOKE_AVG_FRAC ) - 0.01 );
int loss = (int)(( packet_loss + PACKETLOSS_AVG_FRAC ) - 0.01f );
int choke = (int)(( packet_choke + PACKETCHOKE_AVG_FRAC ) - 0.01f );
Con_DrawString( x, y, va( "loss: %i choke: %i", loss, choke ), colors );
}
@@ -595,8 +598,8 @@ NetGraph_GetScreenPos
void NetGraph_GetScreenPos( wrect_t *rect, int *w, int *x, int *y )
{
rect->left = rect->top = 0;
rect->right = glState.width;
rect->bottom = glState.height;
rect->right = refState.width;
rect->bottom = refState.height;
*w = Q_min( NET_TIMINGS, net_graphwidth->value );
if( rect->right < *w + 10 )
@@ -652,20 +655,17 @@ void SCR_DrawNetGraph( void )
if( net_graph->value < 3 )
{
pglEnable( GL_BLEND );
pglDisable( GL_TEXTURE_2D );
pglTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
pglBlendFunc( GL_SRC_ALPHA, GL_ONE );
pglBegin( GL_QUADS ); // draw all the fills as a long solid sequence of quads for speedup reasons
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
ref.dllFuncs.Begin( TRI_QUADS ); // draw all the fills as a long solid sequence of quads for speedup reasons
// NOTE: fill colors without texture at this point
NetGraph_DrawDataUsage( x, y, w );
NetGraph_DrawTimes( rect, x, w );
pglEnd();
pglColor4ub( 255, 255, 255, 255 );
pglEnable( GL_TEXTURE_2D );
pglDisable( GL_BLEND );
ref.dllFuncs.End();
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
}
}
@@ -680,4 +680,4 @@ void CL_InitNetgraph( void )
packet_loss = packet_choke = 0.0;
NetGraph_InitColors();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -216,7 +216,7 @@ qboolean CL_PlayerTeleported( local_state_t *from, local_state_t *to )
VectorSubtract( to->playerstate.origin, from->playerstate.origin, delta );
// compute potential max movement in units per frame and compare with entity movement
maxlen = ( clgame.movevars.maxvelocity * ( 1.0 / GAME_FPS ));
maxlen = ( clgame.movevars.maxvelocity * ( 1.0f / GAME_FPS ));
len = VectorLength( delta );
return (len > maxlen);
@@ -755,7 +755,7 @@ static pmtrace_t pfnPlayerTrace( float *start, float *end, int traceFlags, int i
return PM_PlayerTraceExt( clgame.pmove, start, end, traceFlags, clgame.pmove->numphysent, clgame.pmove->physents, ignore_pe, NULL );
}
static pmtrace_t *pfnTraceLine( float *start, float *end, int flags, int usehull, int ignore_pe )
pmtrace_t *PM_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe )
{
static pmtrace_t tr;
int old_usehull;
@@ -887,17 +887,6 @@ static pmtrace_t *pfnTraceLineEx( float *start, float *end, int flags, int usehu
return &tr;
}
static struct msurface_s *pfnTraceSurface( int ground, float *vstart, float *vend )
{
physent_t *pe;
if( ground < 0 || ground >= clgame.pmove->numphysent )
return NULL; // bad ground
pe = &clgame.pmove->physents[ground];
return PM_TraceSurface( pe, vstart, vend );
}
/*
===============
CL_InitClientMove
@@ -928,7 +917,7 @@ void CL_InitClientMove( void )
// common utilities
clgame.pmove->PM_Info_ValueForKey = Info_ValueForKey;
clgame.pmove->PM_Particle = CL_Particle;
clgame.pmove->PM_Particle = CL_Particle; // ref should be initialized here already
clgame.pmove->PM_TestPlayerPosition = pfnTestPlayerPosition;
clgame.pmove->Con_NPrintf = Con_NPrintf;
clgame.pmove->Con_DPrintf = Con_DPrintf;
@@ -939,12 +928,12 @@ void CL_InitClientMove( void )
clgame.pmove->PM_TruePointContents = pfnTruePointContents;
clgame.pmove->PM_HullPointContents = pfnHullPointContents;
clgame.pmove->PM_PlayerTrace = pfnPlayerTrace;
clgame.pmove->PM_TraceLine = pfnTraceLine;
clgame.pmove->PM_TraceLine = PM_TraceLine;
clgame.pmove->RandomLong = COM_RandomLong;
clgame.pmove->RandomFloat = COM_RandomFloat;
clgame.pmove->PM_GetModelType = pfnGetModelType;
clgame.pmove->PM_GetModelBounds = pfnGetModelBounds;
clgame.pmove->PM_HullForBsp = pfnHullForBsp;
clgame.pmove->PM_HullForBsp = (void*)pfnHullForBsp;
clgame.pmove->PM_TraceModel = pfnTraceModel;
clgame.pmove->COM_FileSize = COM_FileSize;
clgame.pmove->COM_LoadFile = COM_LoadFile;
@@ -1337,14 +1326,14 @@ void CL_PredictMovement( qboolean repredicting )
cls.correction_time -= host.frametime;
// Make sure smoothtime is postive
if( cl_smoothtime->value <= 0.0 )
if( cl_smoothtime->value <= 0.0f )
Cvar_DirectSet( cl_smoothtime, "0.1" );
// Clamp from 0 to cl_smoothtime.value
cls.correction_time = bound( 0.0, cls.correction_time, cl_smoothtime->value );
// Compute backward interpolation fraction along full correction
frac = 1.0 - cls.correction_time / cl_smoothtime->value;
frac = 1.0f - cls.correction_time / cl_smoothtime->value;
// Determine how much error we still have to make up for
VectorSubtract( cl.simorg, cl.local.lastorigin, delta );
@@ -1359,4 +1348,4 @@ void CL_PredictMovement( qboolean repredicting )
VectorCopy( cl.simorg, cl.local.lastorigin );
cl.local.repredicting = false;
}
}

View File

@@ -17,7 +17,6 @@ GNU General Public License for more details.
#include "client.h"
#include "net_encode.h"
#include "particledef.h"
#include "gl_local.h"
#include "cl_tent.h"
#include "shake.h"
#include "hltv.h"
@@ -86,7 +85,7 @@ static qboolean CL_QuakeEntityTeleported( cl_entity_t *ent, entity_state_t *news
VectorSubtract( newstate->origin, ent->prevstate.origin, delta );
// compute potential max movement in units per frame and compare with entity movement
maxlen = ( clgame.movevars.maxvelocity * ( 1.0 / GAME_FPS ));
maxlen = ( clgame.movevars.maxvelocity * ( 1.0f / GAME_FPS ));
len = VectorLength( delta );
return (len > maxlen);
@@ -303,8 +302,8 @@ static void CL_ParseQuakeServerInfo( sizebuf_t *msg )
// get splash name
if( cls.demoplayback && ( cls.demonum != -1 ))
Cvar_Set( "cl_levelshot_name", va( "levelshots/%s_%s", cls.demoname, glState.wideScreen ? "16x9" : "4x3" ));
else Cvar_Set( "cl_levelshot_name", va( "levelshots/%s_%s", clgame.mapname, glState.wideScreen ? "16x9" : "4x3" ));
Cvar_Set( "cl_levelshot_name", va( "levelshots/%s_%s", cls.demoname, refState.wideScreen ? "16x9" : "4x3" ));
else Cvar_Set( "cl_levelshot_name", va( "levelshots/%s_%s", clgame.mapname, refState.wideScreen ? "16x9" : "4x3" ));
Cvar_SetValue( "scr_loading", 0.0f ); // reset progress bar
if(( cl_allow_levelshots->value && !cls.changelevel ) || cl.background )
@@ -350,8 +349,8 @@ static void CL_ParseQuakeClientData( sizebuf_t *msg )
// this is the frame update that this message corresponds to
i = cls.netchan.incoming_sequence;
cl.parsecount = i; // ack'd incoming messages.
cl.parsecountmod = cl.parsecount & CL_UPDATE_MASK; // index into window.
cl.parsecount = i; // ack'd incoming messages.
cl.parsecountmod = cl.parsecount & CL_UPDATE_MASK; // index into window.
frame = &cl.frames[cl.parsecountmod]; // frame at index.
frame->time = cl.mtime[0]; // mark network received time
frame->receivedtime = host.realtime; // time now that we are parsing.
@@ -677,7 +676,7 @@ static void CL_ParseQuakeStaticEntity( sizebuf_t *msg )
if( ent->model != NULL )
{
// auto 'solid' faces
if( FBitSet( ent->model->flags, MODEL_TRANSPARENT ) && CL_IsQuakeCompatible( ))
if( FBitSet( ent->model->flags, MODEL_TRANSPARENT ) && Host_IsQuakeCompatible())
{
ent->curstate.rendermode = kRenderTransAlpha;
ent->curstate.renderamt = 255;
@@ -1130,4 +1129,4 @@ void CL_ParseQuakeMessage( sizebuf_t *msg, qboolean normal_message )
// check deferred cmds
CL_QuakeExecStuff();
}
}

View File

@@ -15,7 +15,6 @@ GNU General Public License for more details.
#include "common.h"
#include "client.h"
#include "gl_local.h"
#include "studio.h"
/*
@@ -78,7 +77,9 @@ byte *CL_CreateRawTextureFromPixels( texture_t *tx, size_t *size, int topcolor,
// fill header
if( !pin.name[0] ) Q_strncpy( pin.name, "#raw_remap_image.mdl", sizeof( pin.name ));
pin.flags = STUDIO_NF_COLORMAP; // just in case :-)
pin.index = (int)(tx + 1); // pointer to pixels
//pin.index = (int)(tx + 1); // pointer to pixels
// no more pointer-to-int-to-pointer casts
Image_SetMDLPointer( (byte*)((texture_t *)tx + 1) );
pin.width = tx->width;
pin.height = tx->height;
@@ -99,22 +100,23 @@ Dupliacte texture with remap pixels
*/
void CL_DuplicateTexture( mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
{
gl_texture_t *glt;
const char *name;
texture_t *tx = NULL;
char texname[128];
int i, size, index;
int i, index;
size_t size;
byte paletteBackup[768];
byte *raw, *pal;
// save off the real texture index
index = ptexture->index;
glt = R_GetTexture( index );
Q_snprintf( texname, sizeof( texname ), "#%i_%s", RI.currententity->curstate.number, glt->name + 1 );
name = ref.dllFuncs.GL_TextureName( index );
Q_snprintf( texname, sizeof( texname ), "#%i_%s", refState.currententity->curstate.number, name + 1 );
// search for pixels
for( i = 0; i < RI.currentmodel->numtextures; i++ )
for( i = 0; i < refState.currentmodel->numtextures; i++ )
{
tx = RI.currentmodel->textures[i];
tx = refState.currentmodel->textures[i];
if( tx->gl_texturenum == index )
break; // found
}
@@ -126,7 +128,7 @@ void CL_DuplicateTexture( mstudiotexture_t *ptexture, int topcolor, int bottomco
memcpy( paletteBackup, pal, 768 );
raw = CL_CreateRawTextureFromPixels( tx, &size, topcolor, bottomcolor );
ptexture->index = GL_LoadTexture( texname, raw, size, TF_FORCE_COLOR ); // do copy
ptexture->index = ref.dllFuncs.GL_LoadTexture( texname, raw, size, TF_FORCE_COLOR ); // do copy
// restore original palette
memcpy( pal, paletteBackup, 768 );
@@ -141,30 +143,31 @@ Update texture top and bottom colors
*/
void CL_UpdateStudioTexture( mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
{
gl_texture_t *glt;
rgbdata_t *pic;
texture_t *tx = NULL;
char texname[128], name[128], mdlname[128];
int i, size, index;
const char *origtexname;
int i, index;
size_t size;
byte paletteBackup[768];
byte *raw, *pal;
// save off the real texture index
glt = R_GetTexture( ptexture->index );
origtexname = ref.dllFuncs.GL_TextureName( ptexture->index );
// build name of original texture
Q_strncpy( mdlname, RI.currentmodel->name, sizeof( mdlname ));
Q_strncpy( mdlname, refState.currentmodel->name, sizeof( mdlname ));
COM_FileBase( ptexture->name, name );
COM_StripExtension( mdlname );
Q_snprintf( texname, sizeof( texname ), "#%s/%s.mdl", mdlname, name );
index = GL_FindTexture( texname );
index = ref.dllFuncs.GL_FindTexture( texname );
if( !index ) return; // couldn't find texture
// search for pixels
for( i = 0; i < RI.currentmodel->numtextures; i++ )
for( i = 0; i < refState.currentmodel->numtextures; i++ )
{
tx = RI.currentmodel->textures[i];
tx = refState.currentmodel->textures[i];
if( tx->gl_texturenum == index )
break; // found
}
@@ -176,14 +179,14 @@ void CL_UpdateStudioTexture( mstudiotexture_t *ptexture, int topcolor, int botto
memcpy( paletteBackup, pal, 768 );
raw = CL_CreateRawTextureFromPixels( tx, &size, topcolor, bottomcolor );
pic = FS_LoadImage( glt->name, raw, size );
pic = FS_LoadImage( origtexname, raw, size );
if( !pic )
{
Con_DPrintf( S_ERROR "Couldn't update texture %s\n", glt->name );
Con_DPrintf( S_ERROR "Couldn't update texture %s\n", origtexname );
return;
}
index = GL_UpdateTextureInternal( glt->name, pic, 0 );
index = GL_UpdateTextureInternal( origtexname, pic, 0 );
FS_FreeImage( pic );
// restore original palette
@@ -205,15 +208,15 @@ void CL_UpdateAliasTexture( unsigned short *texture, int skinnum, int topcolor,
rgbdata_t skin, *pic;
texture_t *tx;
if( !texture || !RI.currentmodel->textures )
if( !texture || !refState.currentmodel->textures )
return; // no remapinfo in model
tx = RI.currentmodel->textures[skinnum];
tx = refState.currentmodel->textures[skinnum];
if( !tx ) return; // missing texture ?
if( *texture == 0 )
{
Q_snprintf( texname, sizeof( texname ), "%s:remap%i_%i", RI.currentmodel->name, skinnum, RI.currententity->index );
Q_snprintf( texname, sizeof( texname ), "%s:remap%i_%i", refState.currentmodel->name, skinnum, refState.currententity->index );
skin.width = tx->width;
skin.height = tx->height;
skin.depth = skin.numMips = 1;
@@ -228,7 +231,7 @@ void CL_UpdateAliasTexture( unsigned short *texture, int skinnum, int topcolor,
}
// and now we can remap with internal routines
GL_ProcessTexture( *texture, -1.0f, topcolor, bottomcolor );
ref.dllFuncs.GL_ProcessTexture( *texture, -1.0f, topcolor, bottomcolor );
}
/*
@@ -247,10 +250,10 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
mstudiotexture_t *src, *dst;
int i, size;
if( !RI.currententity ) return;
i = ( RI.currententity == &clgame.viewent ) ? clgame.maxEntities : RI.currententity->curstate.number;
if( !refState.currententity ) return;
i = ( refState.currententity == &clgame.viewent ) ? clgame.maxEntities : refState.currententity->curstate.number;
if( !RI.currentmodel || ( RI.currentmodel->type != mod_alias && RI.currentmodel->type != mod_studio ))
if( !refState.currentmodel || ( refState.currentmodel->type != mod_alias && refState.currentmodel->type != mod_studio ))
{
// entity has changed model by another type, release remap info
if( clgame.remap_info[i] )
@@ -262,7 +265,7 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
}
// model doesn't contains remap textures
if( RI.currentmodel->numtextures <= 0 )
if( refState.currentmodel->numtextures <= 0 )
{
// entity has changed model with no remap textures
if( clgame.remap_info[i] )
@@ -273,16 +276,16 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
return;
}
if( RI.currentmodel->type == mod_studio )
if( refState.currentmodel->type == mod_studio )
{
phdr = (studiohdr_t *)Mod_StudioExtradata( RI.currentmodel );
phdr = (studiohdr_t *)Mod_StudioExtradata( refState.currentmodel );
if( !phdr ) return; // bad model?
src = (mstudiotexture_t *)(((byte *)phdr) + phdr->textureindex);
dst = (clgame.remap_info[i] ? clgame.remap_info[i]->ptexture : NULL);
// NOTE: we must copy all the structures 'mstudiotexture_t' for easy access when model is rendering
if( !CL_CmpStudioTextures( phdr->numtextures, src, dst ) || clgame.remap_info[i]->model != RI.currentmodel )
if( !CL_CmpStudioTextures( phdr->numtextures, src, dst ) || clgame.remap_info[i]->model != refState.currentmodel )
{
// this code catches studiomodel change with another studiomodel with remap textures
// e.g. playermodel 'barney' with playermodel 'gordon'
@@ -314,13 +317,13 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
CL_DuplicateTexture( &dst[i], topcolor, bottomcolor );
}
}
else if( RI.currentmodel->type == mod_alias )
else if( refState.currentmodel->type == mod_alias )
{
ahdr = (aliashdr_t *)Mod_AliasExtradata( RI.currentmodel );
ahdr = (aliashdr_t *)Mod_AliasExtradata( refState.currentmodel );
if( !ahdr ) return; // bad model?
// NOTE: we must copy all the structures 'mstudiotexture_t' for easy access when model is rendering
if( !clgame.remap_info[i] || clgame.remap_info[i]->model != RI.currentmodel )
if( !clgame.remap_info[i] || clgame.remap_info[i]->model != refState.currentmodel )
{
// this code catches studiomodel change with another studiomodel with remap textures
// e.g. playermodel 'barney' with playermodel 'gordon'
@@ -333,7 +336,7 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
return;
}
info->numtextures = RI.currentmodel->numtextures;
info->numtextures = refState.currentmodel->numtextures;
// alias remapping is easy
CL_UpdateRemapInfo( topcolor, bottomcolor );
@@ -344,7 +347,7 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
return;
}
info->model = RI.currentmodel;
info->model = refState.currentmodel;
}
/*
@@ -359,7 +362,7 @@ void CL_UpdateRemapInfo( int topcolor, int bottomcolor )
remap_info_t *info;
int i;
i = ( RI.currententity == &clgame.viewent ) ? clgame.maxEntities : RI.currententity->curstate.number;
i = ( refState.currententity == &clgame.viewent ) ? clgame.maxEntities : refState.currententity->curstate.number;
info = clgame.remap_info[i];
if( !info ) return; // no remap info
@@ -399,11 +402,11 @@ void CL_FreeRemapInfo( remap_info_t *info )
if( info->ptexture != NULL )
{
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP ))
GL_FreeTexture( info->ptexture[i].index );
ref.dllFuncs.GL_FreeTexture( info->ptexture[i].index );
}
if( info->textures[i] != 0 )
GL_FreeTexture( info->textures[i] );
ref.dllFuncs.GL_FreeTexture( info->textures[i] );
}
Mem_Free( info ); // release struct
@@ -430,4 +433,4 @@ void CL_ClearAllRemaps( void )
Mem_Free( clgame.remap_info );
}
clgame.remap_info = NULL;
}
}

345
engine/client/cl_render.c Normal file
View File

@@ -0,0 +1,345 @@
/*
cl_render.c - RenderAPI loader & implementation
Copyright (C) 2019 a1batross
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#include "common.h"
#include "client.h"
#include "library.h"
#include "platform/platform.h"
int R_FatPVS( const vec3_t org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis )
{
return Mod_FatPVS( org, radius, visbuffer, world.visbytes, merge, fullvis );
}
lightstyle_t *CL_GetLightStyle( int number )
{
Assert( number >= 0 && number < MAX_LIGHTSTYLES );
return &cl.lightstyles[number];
}
const ref_overview_t *GL_GetOverviewParms( void )
{
return &clgame.overView;
}
static void *R_Mem_Alloc( size_t cb, const char *filename, const int fileline )
{
return _Mem_Alloc( cls.mempool, cb, true, filename, fileline );
}
static void R_Mem_Free( void *mem, const char *filename, const int fileline )
{
if( !mem ) return;
_Mem_Free( mem, filename, fileline );
}
/*
=========
pfnGetFilesList
=========
*/
static char **pfnGetFilesList( const char *pattern, int *numFiles, int gamedironly )
{
static search_t *t = NULL;
if( t ) Mem_Free( t ); // release prev search
t = FS_Search( pattern, true, gamedironly );
if( !t )
{
if( numFiles ) *numFiles = 0;
return NULL;
}
if( numFiles ) *numFiles = t->numfilenames;
return t->filenames;
}
static uint pfnFileBufferCRC32( const void *buffer, const int length )
{
uint modelCRC = 0;
if( !buffer || length <= 0 )
return modelCRC;
CRC32_Init( &modelCRC );
CRC32_ProcessBuffer( &modelCRC, buffer, length );
return CRC32_Final( modelCRC );
}
/*
=================
R_EnvShot
=================
*/
static void R_EnvShot( const float *vieworg, const char *name, qboolean skyshot, int shotsize )
{
static vec3_t viewPoint;
if( !COM_CheckString( name ))
return;
if( cls.scrshot_action != scrshot_inactive )
{
if( cls.scrshot_action != scrshot_skyshot && cls.scrshot_action != scrshot_envshot )
Con_Printf( S_ERROR "R_%sShot: subsystem is busy, try for next frame.\n", skyshot ? "Sky" : "Env" );
return;
}
cls.envshot_vieworg = NULL; // use client view
Q_strncpy( cls.shotname, name, sizeof( cls.shotname ));
if( vieworg )
{
// make sure what viewpoint don't temporare
VectorCopy( vieworg, viewPoint );
cls.envshot_vieworg = viewPoint;
cls.envshot_disable_vis = true;
}
// make request for envshot
if( skyshot ) cls.scrshot_action = scrshot_skyshot;
else cls.scrshot_action = scrshot_envshot;
// catch negative values
cls.envshot_viewsize = max( 0, shotsize );
}
/*
=============
CL_GenericHandle
=============
*/
const char *CL_GenericHandle( int fileindex )
{
if( fileindex < 0 || fileindex >= MAX_CUSTOM )
return 0;
return cl.files_precache[fileindex];
}
int CL_RenderGetParm( const int parm, const int arg, const qboolean checkRef )
{
switch( parm )
{
case PARM_BSP2_SUPPORTED:
#ifdef SUPPORT_BSP2_FORMAT
return 1;
#endif
return 0;
case PARM_SKY_SPHERE:
return FBitSet( world.flags, FWORLD_SKYSPHERE ) && !FBitSet( world.flags, FWORLD_CUSTOM_SKYBOX );
case PARAM_GAMEPAUSED:
return cl.paused;
case PARM_CLIENT_INGAME:
return CL_IsInGame();
case PARM_MAX_ENTITIES:
return clgame.maxEntities;
case PARM_FEATURES:
return host.features;
case PARM_MAP_HAS_DELUXE:
return FBitSet( world.flags, FWORLD_HAS_DELUXEMAP );
case PARM_CLIENT_ACTIVE:
return (cls.state == ca_active);
case PARM_DEDICATED_SERVER:
return (host.type == HOST_DEDICATED);
case PARM_WATER_ALPHA:
return FBitSet( world.flags, FWORLD_WATERALPHA );
case PARM_DELUXEDATA:
return *(int *)&world.deluxedata;
case PARM_SHADOWDATA:
return *(int *)&world.shadowdata;
default:
// indicates call from client.dll
if( checkRef )
{
return ref.dllFuncs.RefGetParm( parm, arg );
}
// call issued from ref_dll, check extensions here
else switch( parm )
{
case PARM_DEV_OVERVIEW:
return CL_IsDevOverviewMode();
case PARM_THIRDPERSON:
return CL_IsThirdPerson();
case PARM_QUAKE_COMPATIBLE:
return Host_IsQuakeCompatible();
case PARM_PLAYER_INDEX:
return cl.playernum + 1;
case PARM_VIEWENT_INDEX:
return cl.viewentity;
case PARM_CONNSTATE:
return (int)cls.state;
case PARM_PLAYING_DEMO:
return cls.demoplayback;
case PARM_WATER_LEVEL:
return cl.local.waterlevel;
case PARM_MAX_CLIENTS:
return cl.maxclients;
case PARM_LOCAL_HEALTH:
return cl.local.health;
case PARM_LOCAL_GAME:
return Host_IsLocalGame();
case PARM_NUMENTITIES:
return pfnNumberOfEntities();
case PARM_NUMMODELS:
return cl.nummodels;
}
}
return 0;
}
static int pfnRenderGetParm( int parm, int arg )
{
return CL_RenderGetParm( parm, arg, true );
}
static render_api_t gRenderAPI =
{
pfnRenderGetParm, // GL_RenderGetParm,
NULL, // R_GetDetailScaleForTexture,
NULL, // R_GetExtraParmsForTexture,
CL_GetLightStyle,
CL_GetDynamicLight,
CL_GetEntityLight,
LightToTexGamma,
NULL, // R_GetFrameTime,
NULL, // R_SetCurrentEntity,
NULL, // R_SetCurrentModel,
R_FatPVS,
R_StoreEfrags,
NULL, // GL_FindTexture,
NULL, // GL_TextureName,
NULL, // GL_TextureData,
NULL, // GL_LoadTexture,
NULL, // GL_CreateTexture,
NULL, // GL_LoadTextureArray,
NULL, // GL_CreateTextureArray,
NULL, // GL_FreeTexture,
NULL, // DrawSingleDecal,
NULL, // R_DecalSetupVerts,
NULL, // R_EntityRemoveDecals,
(void*)AVI_LoadVideo,
(void*)AVI_GetVideoInfo,
(void*)AVI_GetVideoFrameNumber,
(void*)AVI_GetVideoFrame,
NULL, // R_UploadStretchRaw,
(void*)AVI_FreeVideo,
(void*)AVI_IsActive,
S_StreamAviSamples,
NULL,
NULL,
NULL, // GL_Bind,
NULL, // GL_SelectTexture,
NULL, // GL_LoadTexMatrixExt,
NULL, // GL_LoadIdentityTexMatrix,
NULL, // GL_CleanUpTextureUnits,
NULL, // GL_TexGen,
NULL, // GL_TextureTarget,
NULL, // GL_SetTexCoordArrayMode,
GL_GetProcAddress,
NULL, // GL_UpdateTexSize,
NULL,
NULL,
NULL, // CL_DrawParticlesExternal,
R_EnvShot,
pfnSPR_LoadExt,
NULL, // R_LightVec,
NULL, // R_StudioGetTexture,
GL_GetOverviewParms,
CL_GenericHandle,
COM_SaveFile,
NULL,
R_Mem_Alloc,
R_Mem_Free,
pfnGetFilesList,
pfnFileBufferCRC32,
COM_CompareFileTime,
Host_Error,
(void*)CL_ModelHandle,
pfnTime,
Cvar_Set,
S_FadeMusicVolume,
COM_SetRandomSeed,
};
static void R_FillRenderAPIFromRef( render_api_t *to, const ref_interface_t *from )
{
to->GetDetailScaleForTexture = from->GetDetailScaleForTexture;
to->GetExtraParmsForTexture = from->GetExtraParmsForTexture;
to->GetFrameTime = from->GetFrameTime;
to->R_SetCurrentEntity = from->R_SetCurrentEntity;
to->R_SetCurrentModel = from->R_SetCurrentModel;
to->GL_FindTexture = from->GL_FindTexture;
to->GL_TextureName = from->GL_TextureName;
to->GL_TextureData = from->GL_TextureData;
to->GL_LoadTexture = from->GL_LoadTexture;
to->GL_CreateTexture = from->GL_CreateTexture;
to->GL_LoadTextureArray = from->GL_LoadTextureArray;
to->GL_CreateTextureArray = from->GL_CreateTextureArray;
to->GL_FreeTexture = from->GL_FreeTexture;
to->DrawSingleDecal = from->DrawSingleDecal;
to->R_DecalSetupVerts = from->R_DecalSetupVerts;
to->R_EntityRemoveDecals = from->R_EntityRemoveDecals;
to->AVI_UploadRawFrame = from->AVI_UploadRawFrame;
to->GL_Bind = from->GL_Bind;
to->GL_SelectTexture = from->GL_SelectTexture;
to->GL_LoadTextureMatrix = from->GL_LoadTextureMatrix;
to->GL_TexMatrixIdentity = from->GL_TexMatrixIdentity;
to->GL_CleanUpTextureUnits = from->GL_CleanUpTextureUnits;
to->GL_TexGen = from->GL_TexGen;
to->GL_TextureTarget = from->GL_TextureTarget;
to->GL_TexCoordArrayMode = from->GL_TexCoordArrayMode;
to->GL_UpdateTexSize = from->GL_UpdateTexSize;
to->GL_DrawParticles = from->GL_DrawParticles;
to->LightVec = from->LightVec;
to->StudioGetTexture = from->StudioGetTexture;
}
/*
===============
R_InitRenderAPI
Initialize client external rendering
===============
*/
qboolean R_InitRenderAPI( void )
{
// make sure what render functions is cleared
memset( &clgame.drawFuncs, 0, sizeof( clgame.drawFuncs ));
// fill missing functions from renderer
R_FillRenderAPIFromRef( &gRenderAPI, &ref.dllFuncs );
if( clgame.dllFuncs.pfnGetRenderInterface )
{
if( clgame.dllFuncs.pfnGetRenderInterface( CL_RENDER_INTERFACE_VERSION, &gRenderAPI, &clgame.drawFuncs ))
{
Con_Reportf( "CL_LoadProgs: ^2initailized extended RenderAPI ^7ver. %i\n", CL_RENDER_INTERFACE_VERSION );
return true;
}
// make sure what render functions is cleared
memset( &clgame.drawFuncs, 0, sizeof( clgame.drawFuncs ));
return false; // just tell user about problems
}
// render interface is missed
return true;
}

View File

@@ -15,10 +15,10 @@ GNU General Public License for more details.
#include "common.h"
#include "client.h"
#include "gl_local.h"
#include "vgui_draw.h"
#include "qfont.h"
#include "input.h"
#include "library.h"
convar_t *scr_centertime;
convar_t *scr_loading;
@@ -96,10 +96,10 @@ void SCR_DrawFPS( int height )
Q_snprintf( fpsstring, sizeof( fpsstring ), "fps: ^1%4i min, ^3%4i cur, ^2%4i max", minfps, curfps, maxfps );
else Q_snprintf( fpsstring, sizeof( fpsstring ), "%4i fps", curfps );
MakeRGBA( color, 255, 255, 255, 255 );
}
}
Con_DrawStringLen( fpsstring, &offset, NULL );
Con_DrawString( glState.width - offset - 4, height, fpsstring, color );
Con_DrawString( refState.width - offset - 4, height, fpsstring, color );
}
/*
@@ -148,7 +148,7 @@ void SCR_NetSpeeds( void )
Q_snprintf( msg, sizeof( msg ), "sv fps: ^1%4i min, ^3%4i cur, ^2%4i max\ncl fps: ^1%4i min, ^3%4i cur, ^2%4i max\nGame Time: %02d:%02d\nTotal received from server: %s\nTotal sent to server: %s\n",
min_svfps, cur_svfps, max_svfps, min_clfps, cur_clfps, max_clfps, (int)(time / 60.0f ), (int)fmod( time, 60.0f ), Q_memprint( cls.netchan.total_received ), Q_memprint( cls.netchan.total_sended ));
x = glState.width - 320;
x = refState.width - 320;
y = 384;
Con_DrawStringLen( NULL, NULL, &height );
@@ -181,13 +181,13 @@ void SCR_RSpeeds( void )
if( !host.allow_console )
return;
if( R_SpeedsMessage( msg, sizeof( msg )))
if( ref.dllFuncs.R_SpeedsMessage( msg, sizeof( msg )))
{
int x, y, height;
char *p, *start, *end;
rgba_t color;
x = glState.width - 340;
x = refState.width - 340;
y = 64;
Con_DrawStringLen( NULL, NULL, &height );
@@ -227,6 +227,37 @@ void SCR_MakeLevelShot( void )
Cbuf_AddText( "levelshot\n" );
}
/*
===============
VID_WriteOverviewScript
Create overview script file
===============
*/
void VID_WriteOverviewScript( void )
{
ref_overview_t *ov = &clgame.overView;
string filename;
file_t *f;
Q_snprintf( filename, sizeof( filename ), "overviews/%s.txt", clgame.mapname );
f = FS_Open( filename, "w", false );
if( !f ) return;
FS_Printf( f, "// overview description file for %s.bsp\n\n", clgame.mapname );
FS_Print( f, "global\n{\n" );
FS_Printf( f, "\tZOOM\t%.2f\n", ov->flZoom );
FS_Printf( f, "\tORIGIN\t%.2f\t%.2f\t%.2f\n", ov->origin[0], ov->origin[1], ov->origin[2] );
FS_Printf( f, "\tROTATED\t%i\n", ov->rotated ? 1 : 0 );
FS_Print( f, "}\n\nlayer\n{\n" );
FS_Printf( f, "\tIMAGE\t\"overviews/%s.bmp\"\n", clgame.mapname );
FS_Printf( f, "\tHEIGHT\t%.2f\n", ov->zFar ); // ???
FS_Print( f, "}\n" );
FS_Close( f );
}
/*
================
SCR_MakeScreenShot
@@ -246,25 +277,27 @@ void SCR_MakeScreenShot( void )
switch( cls.scrshot_action )
{
case scrshot_normal:
iRet = VID_ScreenShot( cls.shotname, VID_SCREENSHOT );
iRet = ref.dllFuncs.VID_ScreenShot( cls.shotname, VID_SCREENSHOT );
break;
case scrshot_snapshot:
iRet = VID_ScreenShot( cls.shotname, VID_SNAPSHOT );
iRet = ref.dllFuncs.VID_ScreenShot( cls.shotname, VID_SNAPSHOT );
break;
case scrshot_plaque:
iRet = VID_ScreenShot( cls.shotname, VID_LEVELSHOT );
iRet = ref.dllFuncs.VID_ScreenShot( cls.shotname, VID_LEVELSHOT );
break;
case scrshot_savegame:
iRet = VID_ScreenShot( cls.shotname, VID_MINISHOT );
iRet = ref.dllFuncs.VID_ScreenShot( cls.shotname, VID_MINISHOT );
break;
case scrshot_envshot:
iRet = VID_CubemapShot( cls.shotname, viewsize, cls.envshot_vieworg, false );
iRet = ref.dllFuncs.VID_CubemapShot( cls.shotname, viewsize, cls.envshot_vieworg, false );
break;
case scrshot_skyshot:
iRet = VID_CubemapShot( cls.shotname, viewsize, cls.envshot_vieworg, true );
iRet = ref.dllFuncs.VID_CubemapShot( cls.shotname, viewsize, cls.envshot_vieworg, true );
break;
case scrshot_mapshot:
iRet = VID_ScreenShot( cls.shotname, VID_MAPSHOT );
iRet = ref.dllFuncs.VID_ScreenShot( cls.shotname, VID_MAPSHOT );
if( iRet )
VID_WriteOverviewScript(); // store overview script too
break;
case scrshot_inactive:
return;
@@ -295,9 +328,9 @@ void SCR_DrawPlaque( void )
{
if(( cl_allow_levelshots->value && !cls.changelevel ) || cl.background )
{
int levelshot = GL_LoadTexture( cl_levelshot_name->string, NULL, 0, TF_IMAGE );
GL_SetRenderMode( kRenderNormal );
R_DrawStretchPic( 0, 0, glState.width, glState.height, 0, 0, 1, 1, levelshot );
int levelshot = ref.dllFuncs.GL_LoadTexture( cl_levelshot_name->string, NULL, 0, TF_IMAGE );
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
ref.dllFuncs.R_DrawStretchPic( 0, 0, refState.width, refState.height, 0, 0, 1, 1, levelshot );
if( !cl.background ) CL_DrawHUD( CL_LOADING );
}
}
@@ -373,7 +406,7 @@ SCR_DirtyScreen
void SCR_DirtyScreen( void )
{
SCR_AddDirtyPoint( 0, 0 );
SCR_AddDirtyPoint( glState.width - 1, glState.height - 1 );
SCR_AddDirtyPoint( refState.width - 1, refState.height - 1 );
}
/*
@@ -425,7 +458,7 @@ void SCR_TileClear( void )
{
// clear above view screen
i = clear.y2 < top-1 ? clear.y2 : top - 1;
R_DrawTileClear( clear.x1, clear.y1, clear.x2 - clear.x1 + 1, i - clear.y1 + 1 );
ref.dllFuncs.R_DrawTileClear( cls.tileImage, clear.x1, clear.y1, clear.x2 - clear.x1 + 1, i - clear.y1 + 1 );
clear.y1 = top;
}
@@ -433,7 +466,7 @@ void SCR_TileClear( void )
{
// clear below view screen
i = clear.y1 > bottom + 1 ? clear.y1 : bottom + 1;
R_DrawTileClear( clear.x1, i, clear.x2 - clear.x1 + 1, clear.y2 - i + 1 );
ref.dllFuncs.R_DrawTileClear( cls.tileImage, clear.x1, i, clear.x2 - clear.x1 + 1, clear.y2 - i + 1 );
clear.y2 = bottom;
}
@@ -441,7 +474,7 @@ void SCR_TileClear( void )
{
// clear left of view screen
i = clear.x2 < left - 1 ? clear.x2 : left - 1;
R_DrawTileClear( clear.x1, clear.y1, i - clear.x1 + 1, clear.y2 - clear.y1 + 1 );
ref.dllFuncs.R_DrawTileClear( cls.tileImage, clear.x1, clear.y1, i - clear.x1 + 1, clear.y2 - clear.y1 + 1 );
clear.x1 = left;
}
@@ -449,7 +482,7 @@ void SCR_TileClear( void )
{
// clear left of view screen
i = clear.x1 > right + 1 ? clear.x1 : right + 1;
R_DrawTileClear( i, clear.y1, clear.x2 - i + 1, clear.y2 - clear.y1 + 1 );
ref.dllFuncs.R_DrawTileClear( cls.tileImage, i, clear.y1, clear.x2 - i + 1, clear.y2 - clear.y1 + 1 );
clear.x2 = right;
}
}
@@ -501,7 +534,7 @@ qboolean SCR_LoadFixedWidthFont( const char *fontname )
if( !FS_FileExists( fontname, false ))
return false;
cls.creditsFont.hFontTexture = GL_LoadTexture( fontname, NULL, 0, TF_IMAGE|TF_KEEP_SOURCE );
cls.creditsFont.hFontTexture = ref.dllFuncs.GL_LoadTexture( fontname, NULL, 0, TF_IMAGE|TF_KEEP_SOURCE );
R_GetTextureParms( &fontWidth, NULL, cls.creditsFont.hFontTexture );
cls.creditsFont.charHeight = clgame.scrInfo.iCharHeight = fontWidth / 16;
cls.creditsFont.type = FONT_FIXED;
@@ -524,7 +557,7 @@ qboolean SCR_LoadVariableWidthFont( const char *fontname )
{
int i, fontWidth;
byte *buffer;
size_t length;
fs_offset_t length;
qfont_t *src;
if( cls.creditsFont.valid )
@@ -533,7 +566,7 @@ qboolean SCR_LoadVariableWidthFont( const char *fontname )
if( !FS_FileExists( fontname, false ))
return false;
cls.creditsFont.hFontTexture = GL_LoadTexture( fontname, NULL, 0, TF_IMAGE );
cls.creditsFont.hFontTexture = ref.dllFuncs.GL_LoadTexture( fontname, NULL, 0, TF_IMAGE );
R_GetTextureParms( &fontWidth, NULL, cls.creditsFont.hFontTexture );
// half-life font with variable chars witdh
@@ -571,7 +604,18 @@ INTERNAL RESOURCE
*/
void SCR_LoadCreditsFont( void )
{
if( !SCR_LoadVariableWidthFont( "gfx.wad/creditsfont.fnt" ))
const char *path = "gfx/creditsfont.fnt";
dword crc;
// replace default gfx.wad textures by current charset's font
if( !CRC32_File( &crc, "gfx.wad" ) || crc == 0x49eb9f16 )
{
const char *path2 = va("creditsfont_%s.fnt", Cvar_VariableString( "con_charset" ) );
if( FS_FileExists( path2, false ) )
path = path2;
}
if( !SCR_LoadVariableWidthFont( path ))
{
if( !SCR_LoadFixedWidthFont( "gfx/conchars" ))
Con_DPrintf( S_ERROR "failed to load HUD font\n" );
@@ -631,24 +675,24 @@ void SCR_RegisterTextures( void )
// register gfx.wad images
if( FS_FileExists( "gfx/paused.lmp", false ))
cls.pauseIcon = GL_LoadTexture( "gfx/paused.lmp", NULL, 0, TF_IMAGE );
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/paused.lmp", NULL, 0, TF_IMAGE );
else if( FS_FileExists( "gfx/pause.lmp", false ))
cls.pauseIcon = GL_LoadTexture( "gfx/pause.lmp", NULL, 0, TF_IMAGE );
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/pause.lmp", NULL, 0, TF_IMAGE );
if( FS_FileExists( "gfx/lambda.lmp", false ))
{
if( cl_allow_levelshots->value )
cls.loadingBar = GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE );
else cls.loadingBar = GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE );
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 );
}
else if( FS_FileExists( "gfx/loading.lmp", false ))
{
if( cl_allow_levelshots->value )
cls.loadingBar = GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE );
else cls.loadingBar = GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE );
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 );
}
cls.tileImage = GL_LoadTexture( "gfx/backtile.lmp", NULL, 0, TF_NOMIPMAP );
cls.tileImage = ref.dllFuncs.GL_LoadTexture( "gfx/backtile.lmp", NULL, 0, TF_NOMIPMAP );
}
/*
@@ -683,15 +727,21 @@ SCR_VidInit
*/
void SCR_VidInit( void )
{
if( !ref.initialized ) // don't call VidInit too soon
return;
memset( &clgame.ds, 0, sizeof( clgame.ds )); // reset a draw state
memset( &gameui.ds, 0, sizeof( gameui.ds )); // reset a draw state
memset( &clgame.centerPrint, 0, sizeof( clgame.centerPrint ));
// update screen sizes for menu
gameui.globals->scrWidth = glState.width;
gameui.globals->scrHeight = glState.height;
if( gameui.globals )
{
gameui.globals->scrWidth = refState.width;
gameui.globals->scrHeight = refState.height;
}
VGui_Startup ();
VGui_Startup( NULL, refState.width, refState.height ); // initialized already, so pass NULL
CL_ClearSpriteTextures(); // now all hud sprites are invalid
@@ -723,7 +773,6 @@ void SCR_Init( void )
scr_viewsize = Cvar_Get( "viewsize", "120", FCVAR_ARCHIVE, "screen size" );
// register our commands
Cmd_AddCommand( "timerefresh", SCR_TimeRefresh_f, "turn quickly and print rendering statistcs" );
Cmd_AddCommand( "skyname", CL_SetSky_f, "set new skybox by basename" );
Cmd_AddCommand( "loadsky", CL_SetSky_f, "set new skybox by basename" );
Cmd_AddCommand( "viewpos", SCR_Viewpos_f, "prints current player origin" );
@@ -732,7 +781,7 @@ void SCR_Init( void )
if( !UI_LoadProgs( ))
{
Con_Printf( S_ERROR "can't initialize gameui.dll\n" ); // there is non fatal for us
Con_Printf( S_ERROR "can't initialize gameui DLL: %s\n", COM_GetLibraryError() ); // there is non fatal for us
host.allow_console = true; // we need console, because menu is missing
}
@@ -761,4 +810,4 @@ void SCR_Shutdown( void )
UI_UnloadProgs();
scr_init = false;
}
}

View File

@@ -20,7 +20,6 @@ GNU General Public License for more details.
#include "triangleapi.h"
#include "cl_tent.h"
#include "pm_local.h"
#include "gl_local.h"
#include "studio.h"
#include "wadfile.h" // acess decal size
#include "sound.h"
@@ -151,7 +150,7 @@ void CL_AddClientResources( void )
int i;
// don't request resources from localhost or in quake-compatibility mode
if( cl.maxclients <= 1 || CL_IsQuakeCompatible( ))
if( cl.maxclients <= 1 || Host_IsQuakeCompatible( ))
return;
// check sprites first
@@ -197,125 +196,6 @@ void CL_AddClientResources( void )
#endif
}
/*
===============
CL_FxBlend
===============
*/
int CL_FxBlend( cl_entity_t *e )
{
int blend = 0;
float offset, dist;
vec3_t tmp;
offset = ((int)e->index ) * 363.0f; // Use ent index to de-sync these fx
switch( e->curstate.renderfx )
{
case kRenderFxPulseSlowWide:
blend = e->curstate.renderamt + 0x40 * sin( cl.time * 2 + offset );
break;
case kRenderFxPulseFastWide:
blend = e->curstate.renderamt + 0x40 * sin( cl.time * 8 + offset );
break;
case kRenderFxPulseSlow:
blend = e->curstate.renderamt + 0x10 * sin( cl.time * 2 + offset );
break;
case kRenderFxPulseFast:
blend = e->curstate.renderamt + 0x10 * sin( cl.time * 8 + offset );
break;
case kRenderFxFadeSlow:
if( RP_NORMALPASS( ))
{
if( e->curstate.renderamt > 0 )
e->curstate.renderamt -= 1;
else e->curstate.renderamt = 0;
}
blend = e->curstate.renderamt;
break;
case kRenderFxFadeFast:
if( RP_NORMALPASS( ))
{
if( e->curstate.renderamt > 3 )
e->curstate.renderamt -= 4;
else e->curstate.renderamt = 0;
}
blend = e->curstate.renderamt;
break;
case kRenderFxSolidSlow:
if( RP_NORMALPASS( ))
{
if( e->curstate.renderamt < 255 )
e->curstate.renderamt += 1;
else e->curstate.renderamt = 255;
}
blend = e->curstate.renderamt;
break;
case kRenderFxSolidFast:
if( RP_NORMALPASS( ))
{
if( e->curstate.renderamt < 252 )
e->curstate.renderamt += 4;
else e->curstate.renderamt = 255;
}
blend = e->curstate.renderamt;
break;
case kRenderFxStrobeSlow:
blend = 20 * sin( cl.time * 4 + offset );
if( blend < 0 ) blend = 0;
else blend = e->curstate.renderamt;
break;
case kRenderFxStrobeFast:
blend = 20 * sin( cl.time * 16 + offset );
if( blend < 0 ) blend = 0;
else blend = e->curstate.renderamt;
break;
case kRenderFxStrobeFaster:
blend = 20 * sin( cl.time * 36 + offset );
if( blend < 0 ) blend = 0;
else blend = e->curstate.renderamt;
break;
case kRenderFxFlickerSlow:
blend = 20 * (sin( cl.time * 2 ) + sin( cl.time * 17 + offset ));
if( blend < 0 ) blend = 0;
else blend = e->curstate.renderamt;
break;
case kRenderFxFlickerFast:
blend = 20 * (sin( cl.time * 16 ) + sin( cl.time * 23 + offset ));
if( blend < 0 ) blend = 0;
else blend = e->curstate.renderamt;
break;
case kRenderFxHologram:
case kRenderFxDistort:
VectorCopy( e->origin, tmp );
VectorSubtract( tmp, RI.vieworg, tmp );
dist = DotProduct( tmp, RI.vforward );
// turn off distance fade
if( e->curstate.renderfx == kRenderFxDistort )
dist = 1;
if( dist <= 0 )
{
blend = 0;
}
else
{
e->curstate.renderamt = 180;
if( dist <= 100 ) blend = e->curstate.renderamt;
else blend = (int) ((1.0f - ( dist - 100 ) * ( 1.0f / 400.0f )) * e->curstate.renderamt );
blend += COM_RandomLong( -32, 31 );
}
break;
default:
blend = e->curstate.renderamt;
break;
}
blend = bound( 0, blend, 255 );
return blend;
}
/*
================
@@ -521,8 +401,7 @@ int CL_TempEntAddEntity( cl_entity_t *pEntity )
VectorCopy( pEntity->origin, pEntity->latched.prevorigin );
// add to list
if( CL_AddVisibleEntity( pEntity, ET_TEMPENTITY ))
r_stats.c_active_tents_count++;
CL_AddVisibleEntity( pEntity, ET_TEMPENTITY );
return 1;
}
@@ -670,7 +549,7 @@ CL_TempEntAlloc
custom tempentity allocation
==============
*/
*/
TEMPENTITY *CL_TempEntAllocCustom( const vec3_t org, model_t *model, int high, void (*pfn)( TEMPENTITY*, float, float ))
{
TEMPENTITY *pTemp;
@@ -2013,6 +1892,8 @@ void R_Sprite_WallPuff( TEMPENTITY *pTemp, float scale )
pTemp->die = cl.time + 0.01f;
}
/*
==============
CL_ParseTempEntity
@@ -2024,7 +1905,7 @@ void CL_ParseTempEntity( sizebuf_t *msg )
{
sizebuf_t buf;
byte pbuf[256];
int iSize = MSG_ReadWord( msg );
int iSize;
int type, color, count, flags;
int decalIndex, modelIndex, entityIndex;
float scale, life, frameRate, vel, random;
@@ -2035,6 +1916,10 @@ void CL_ParseTempEntity( sizebuf_t *msg )
cl_entity_t *pEnt;
dlight_t *dl;
if( cls.legacymode )
iSize = MSG_ReadByte( msg );
else iSize = MSG_ReadWord( msg );
decalIndex = modelIndex = entityIndex = 0;
// parse user message into buffer
@@ -2717,6 +2602,18 @@ void CL_DecayLights( void )
}
}
dlight_t *CL_GetDynamicLight( int number )
{
Assert( number >= 0 && number < MAX_DLIGHTS );
return &cl_dlights[number];
}
dlight_t *CL_GetEntityLight( int number )
{
Assert( number >= 0 && number < MAX_ELIGHTS );
return &cl_elights[number];
}
/*
================
CL_UpdateFlashlight
@@ -2801,7 +2698,7 @@ void CL_AddEntityEffects( cl_entity_t *ent )
if( FBitSet( ent->curstate.effects, EF_DIMLIGHT ))
{
if( ent->player && !CL_IsQuakeCompatible( ))
if( ent->player && !Host_IsQuakeCompatible( ))
{
CL_UpdateFlashlight( ent );
}
@@ -2948,7 +2845,7 @@ void CL_TestLights( void )
numLights = bound( 1, cl_testlights->value, MAX_DLIGHTS );
AngleVectors( cl.viewangles, forward, right, NULL );
for( i = 0; i < numLights; i++ )
{
dl = &cl_dlights[i];
@@ -2974,18 +2871,6 @@ DECAL MANAGEMENT
==============================================================
*/
/*
===============
CL_DecalShoot
normal temporary decal
===============
*/
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags )
{
R_DecalShoot( textureIndex, entityIndex, modelIndex, pos, flags, 1.0f );
}
/*
===============
CL_FireCustomDecal
@@ -2995,7 +2880,19 @@ custom temporary decal
*/
void CL_FireCustomDecal( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags, float scale )
{
R_DecalShoot( textureIndex, entityIndex, modelIndex, pos, flags, scale );
ref.dllFuncs.R_DecalShoot( textureIndex, entityIndex, modelIndex, pos, flags, scale );
}
/*
===============
CL_DecalShoot
normal temporary decal
===============
*/
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags )
{
CL_FireCustomDecal( textureIndex, entityIndex, modelIndex, pos, flags, 1.0f );
}
/*
@@ -3026,7 +2923,7 @@ void CL_PlayerDecal( int playernum, int customIndex, int entityIndex, float *pos
}
}
R_DecalShoot( textureIndex, entityIndex, 0, pos, FDECAL_CUSTOM, 1.0f );
CL_DecalShoot( textureIndex, entityIndex, 0, pos, FDECAL_CUSTOM );
}
/*
@@ -3066,7 +2963,7 @@ int CL_DecalIndex( int id )
if( cl.decal_index[id] == 0 )
{
Image_SetForceFlags( IL_LOAD_DECAL );
cl.decal_index[id] = GL_LoadTexture( host.draw_decals[id], NULL, 0, TF_DECAL );
cl.decal_index[id] = ref.dllFuncs.GL_LoadTexture( host.draw_decals[id], NULL, 0, TF_DECAL );
Image_ClearForceFlags();
}
@@ -3083,7 +2980,7 @@ remove all decals with specified texture
void CL_DecalRemoveAll( int textureIndex )
{
int id = bound( 0, textureIndex, MAX_DECALS - 1 );
R_DecalRemoveAll( cl.decal_index[id] );
ref.dllFuncs.R_DecalRemoveAll( cl.decal_index[id] );
}
/*
@@ -3112,6 +3009,29 @@ void CL_ClearEfrags( void )
clgame.free_efrags[i].entnext = &clgame.free_efrags[i+1];
clgame.free_efrags[i].entnext = NULL;
}
/*
=======================
R_ClearStaticEntities
e.g. by demo request
=======================
*/
void CL_ClearStaticEntities( void )
{
int i;
if( host.type == HOST_DEDICATED )
return;
// clear out efrags in case the level hasn't been reloaded
for( i = 0; i < cl.worldmodel->numleafs; i++ )
cl.worldmodel->leafs[i+1].efrags = NULL;
clgame.numStatics = 0;
CL_ClearEfrags ();
}
/*
==============
@@ -3126,4 +3046,5 @@ void CL_ClearEffects( void )
CL_ClearViewBeams ();
CL_ClearParticles ();
CL_ClearLightStyles ();
}
}

View File

@@ -16,6 +16,8 @@ GNU General Public License for more details.
#ifndef CL_TENT_H
#define CL_TENT_H
#include "triangleapi.h"
// EfxAPI
struct particle_s *R_AllocParticle( void (*callback)( struct particle_s*, float ));
void R_Explosion( vec3_t pos, int model, float scale, float framerate, int flags );
@@ -87,6 +89,9 @@ void CL_DecalRemoveAll( int textureIndex );
int CL_DecalIndexFromName( const char *name );
int CL_DecalIndex( int id );
// RefAPI
struct particle_s *CL_AllocParticleFast( void );
// Beams
struct beam_s *R_BeamLightning( vec3_t start, vec3_t end, int modelIndex, float life, float width, float amplitude, float brightness, float speed );
struct beam_s *R_BeamEnts( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
@@ -99,22 +104,18 @@ void R_BeamKill( int deadEntity );
// TriAPI
void TriBegin( int mode );
void TriTexCoord2f( float u, float v );
void TriVertex3fv( const float *v );
void TriVertex3f( float x, float y, float z );
int TriBoxInPVS( float *mins, float *maxs );
void TriRenderMode( int mode );
void TriColor4f( float r, float g, float b, float a );
int TriSpriteTexture( model_t *pSpriteModel, int frame );
void TriColor4fRendermode( float r, float g, float b, float a, int rendermode );
int TriWorldToScreen( float *world, float *screen );
void TriColor4ub( byte r, byte g, byte b, byte a );
void TriBrightness( float brightness );
void TriRenderMode( int mode );
void TriCullFace( int mode );
void TriEnd( void );
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_shell;
#endif//CL_TENT_H
#endif//CL_TENT_H

View File

@@ -15,7 +15,6 @@ GNU General Public License for more details.
#include "common.h"
#include "client.h"
#include "gl_local.h"
/*
=================================================================
@@ -25,7 +24,7 @@ AVI PLAYING
=================================================================
*/
static long xres, yres;
static int xres, yres;
static float video_duration;
static float cin_time;
static int cin_frame;
@@ -85,7 +84,8 @@ void SCR_CreateStartupVids( void )
void SCR_CheckStartupVids( void )
{
int c = 0;
char *afile, *pfile;
byte *afile;
char *pfile;
string token;
if( Sys_CheckParm( "-nointro" ) || host_developer.value || cls.demonum != -1 || GameState->nextstate != STATE_RUNFRAME )
@@ -102,7 +102,7 @@ void SCR_CheckStartupVids( void )
afile = FS_LoadFile( DEFAULT_VIDEOLIST_PATH, NULL, false );
if( !afile ) return; // something bad happens
pfile = afile;
pfile = (char *)afile;
while(( pfile = COM_ParseFile( pfile, token )) != NULL )
{
@@ -180,7 +180,7 @@ qboolean SCR_DrawCinematic( void )
qboolean redraw = false;
byte *frame = NULL;
if( !glw_state.initialized || cin_time <= 0.0f )
if( !ref.initialized || cin_time <= 0.0f )
return false;
if( cin_frame != last_frame )
@@ -190,7 +190,7 @@ qboolean SCR_DrawCinematic( void )
redraw = true;
}
R_DrawStretchRaw( 0, 0, glState.width, glState.height, xres, yres, frame, redraw );
ref.dllFuncs.R_DrawStretchRaw( 0, 0, refState.width, refState.height, xres, yres, frame, redraw );
return true;
}
@@ -242,7 +242,7 @@ qboolean SCR_PlayCinematic( const char *arg )
return true;
}
long SCR_GetAudioChunk( char *rawdata, long length )
int SCR_GetAudioChunk( char *rawdata, int length )
{
int r;
@@ -307,4 +307,4 @@ void SCR_FreeCinematic( void )
AVI_CloseVideo( cin_state );
AVI_Shutdown();
}
}

View File

@@ -17,9 +17,10 @@ GNU General Public License for more details.
#include "client.h"
#include "const.h"
#include "entity_types.h"
#include "gl_local.h"
#include "vgui_draw.h"
#include "sound.h"
#include "input.h" // touch
#include "platform/platform.h" // GL_UpdateSwapInterval
/*
===============
@@ -44,7 +45,7 @@ void V_CalcViewRect( void )
sb_lines = 24; // no inventory
else sb_lines = 48;
if( scr_viewsize->value >= 100.0 )
if( scr_viewsize->value >= 100.0f )
{
full = true;
size = 100.0f;
@@ -57,19 +58,19 @@ void V_CalcViewRect( void )
sb_lines = 0;
full = true;
}
size /= 100.0;
size /= 100.0f;
clgame.viewport[2] = glState.width * size;
clgame.viewport[3] = glState.height * size;
clgame.viewport[2] = refState.width * size;
clgame.viewport[3] = refState.height * size;
if( clgame.viewport[3] > glState.height - sb_lines )
clgame.viewport[3] = glState.height - sb_lines;
if( clgame.viewport[3] > glState.height )
clgame.viewport[3] = glState.height;
if( clgame.viewport[3] > refState.height - sb_lines )
clgame.viewport[3] = refState.height - sb_lines;
if( clgame.viewport[3] > refState.height )
clgame.viewport[3] = refState.height;
clgame.viewport[0] = ( glState.width - clgame.viewport[2] ) / 2;
clgame.viewport[0] = ( refState.width - clgame.viewport[2] ) / 2;
if( full ) clgame.viewport[1] = 0;
else clgame.viewport[1] = ( glState.height - sb_lines - clgame.viewport[3] ) / 2;
else clgame.viewport[1] = ( refState.height - sb_lines - clgame.viewport[3] ) / 2;
}
@@ -113,8 +114,8 @@ void V_SetRefParams( ref_params_t *fd )
memset( fd, 0, sizeof( ref_params_t ));
// probably this is not needs
VectorCopy( RI.vieworg, fd->vieworg );
VectorCopy( RI.viewangles, fd->viewangles );
VectorCopy( refState.vieworg, fd->vieworg );
VectorCopy( refState.viewangles, fd->viewangles );
fd->frametime = host.frametime;
fd->time = cl.time;
@@ -183,7 +184,7 @@ void V_RefApplyOverview( ref_viewpass_t *rvp )
return;
// NOTE: Xash3D may use 16:9 or 16:10 aspects
aspect = (float)glState.width / (float)glState.height;
aspect = (float)refState.width / (float)refState.height;
size_x = fabs( 8192.0f / ov->flZoom );
size_y = fabs( 8192.0f / (ov->flZoom * aspect ));
@@ -216,7 +217,7 @@ void V_RefApplyOverview( ref_viewpass_t *rvp )
SetBits( rvp->flags, RF_DRAW_OVERVIEW );
Mod_SetOrthoBounds( mins, maxs );
ref.dllFuncs.GL_OrthoBounds( mins, maxs );
}
/*
@@ -254,7 +255,7 @@ void V_GetRefParams( ref_params_t *fd, ref_viewpass_t *rvp )
rvp->fov_y = V_CalcFov( &rvp->fov_x, clgame.viewport[2], clgame.viewport[3] );
// adjust FOV for widescreen
if( glState.wideScreen && r_adjust_fov->value )
if( refState.wideScreen && r_adjust_fov->value )
V_AdjustFov( &rvp->fov_x, &rvp->fov_y, clgame.viewport[2], clgame.viewport[3], false );
rvp->flags = 0;
@@ -273,7 +274,7 @@ V_PreRender
qboolean V_PreRender( void )
{
// too early
if( !glw_state.initialized )
if( !ref.initialized )
return false;
if( host.status == HOST_NOFOCUS )
@@ -292,8 +293,10 @@ qboolean V_PreRender( void )
}
return false;
}
R_BeginFrame( !cl.paused && ( cls.state == ca_active ));
ref.dllFuncs.R_BeginFrame( !cl.paused && ( cls.state == ca_active ));
GL_UpdateSwapInterval( );
return true;
}
@@ -312,15 +315,15 @@ void V_RenderView( void )
ref_viewpass_t rvp;
int viewnum = 0;
if( !cl.video_prepped || ( UI_IsVisible() && !cl.background ))
if( !cl.video_prepped || ( !ui_renderworld->value && UI_IsVisible() && !cl.background ))
return; // still loading
V_CalcViewRect (); // compute viewport rectangle
V_SetRefParams( &rp );
V_SetupViewModel ();
R_Set2DMode( false );
ref.dllFuncs.R_Set2DMode( false );
SCR_DirtyScreen();
GL_BackendStartFrame ();
ref.dllFuncs.GL_BackendStartFrame ();
do
{
@@ -330,11 +333,10 @@ void V_RenderView( void )
if( viewnum == 0 && FBitSet( rvp.flags, RF_ONLY_CLIENTDRAW ))
{
pglClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
pglClear( GL_COLOR_BUFFER_BIT );
ref.dllFuncs.R_ClearScreen();
}
R_RenderFrame( &rvp );
GL_RenderFrame( &rvp );
S_UpdateFrame( &rvp );
viewnum++;
@@ -342,7 +344,101 @@ void V_RenderView( void )
// draw debug triangles on a server
SV_DrawDebugTriangles ();
GL_BackendEndFrame ();
ref.dllFuncs.GL_BackendEndFrame ();
}
#define POINT_SIZE 16.0f
#define NODE_INTERVAL_X(x) (x * 16.0f)
#define NODE_INTERVAL_Y(x) (x * 16.0f)
void R_DrawLeafNode( float x, float y, float scale )
{
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 ) );
}
void R_DrawNodeConnection( float x, float y, float x2, float y2 )
{
ref.dllFuncs.Begin( TRI_LINES );
ref.dllFuncs.Vertex3f( x, y, 0 );
ref.dllFuncs.Vertex3f( x2, y2, 0 );
ref.dllFuncs.End( );
}
void R_ShowTree_r( mnode_t *node, float x, float y, float scale, int shownodes, mleaf_t *viewleaf )
{
float downScale = scale * 0.8f;
downScale = Q_max( downScale, 1.0f );
if( !node ) return;
world.recursion_level++;
if( node->contents < 0 )
{
mleaf_t *leaf = (mleaf_t *)node;
if( world.recursion_level > world.max_recursion )
world.max_recursion = world.recursion_level;
if( shownodes == 1 )
{
if( cl.worldmodel->leafs == leaf )
ref.dllFuncs.Color4f( 1.0f, 1.0f, 1.0f, 1.0f );
else if( viewleaf && viewleaf == leaf )
ref.dllFuncs.Color4f( 1.0f, 0.0f, 0.0f, 1.0f );
else ref.dllFuncs.Color4f( 0.0f, 1.0f, 0.0f, 1.0f );
R_DrawLeafNode( x, y, scale );
}
world.recursion_level--;
return;
}
if( shownodes == 1 )
{
ref.dllFuncs.Color4f( 0.0f, 0.0f, 1.0f, 1.0f );
R_DrawLeafNode( x, y, scale );
}
else if( shownodes == 2 )
{
R_DrawNodeConnection( x, y, x - scale, y + scale );
R_DrawNodeConnection( x, y, x + scale, y + scale );
}
R_ShowTree_r( node->children[1], x - scale, y + scale, downScale, shownodes, viewleaf );
R_ShowTree_r( node->children[0], x + scale, y + scale, downScale, shownodes, viewleaf );
world.recursion_level--;
}
void R_ShowTree( void )
{
float x = (float)((refState.width - (int)POINT_SIZE) >> 1);
float y = NODE_INTERVAL_Y(1.0f);
mleaf_t *viewleaf;
if( !cl.worldmodel || !CVAR_TO_BOOL( r_showtree ))
return;
world.recursion_level = 0;
viewleaf = Mod_PointInLeaf( refState.vieworg, cl.worldmodel->nodes );
//pglEnable( GL_BLEND );
//pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
//pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
//pglLineWidth( 2.0f );
ref.dllFuncs.Color4f( 1, 0.7f, 0, 1.0f );
//pglDisable( GL_TEXTURE_2D );
R_ShowTree_r( cl.worldmodel->nodes, x, y, world.max_recursion * 3.5f, 2, viewleaf );
//pglEnable( GL_TEXTURE_2D );
//pglLineWidth( 1.0f );
R_ShowTree_r( cl.worldmodel->nodes, x, y, world.max_recursion * 3.5f, 1, viewleaf );
Con_NPrintf( 0, "max recursion %d\n", world.max_recursion );
}
/*
@@ -356,14 +452,14 @@ void V_PostRender( void )
static double oldtime;
qboolean draw_2d = false;
R_AllowFog( false );
R_Set2DMode( true );
ref.dllFuncs.R_AllowFog( false );
ref.dllFuncs.R_Set2DMode( true );
if( cls.state == ca_active && cls.signon == SIGNONS && cls.scrshot_action != scrshot_mapshot )
{
SCR_TileClear();
CL_DrawHUD( CL_ACTIVE );
VGui_Paint( true );
VGui_Paint();
}
switch( cls.scrshot_action )
@@ -383,17 +479,19 @@ void V_PostRender( void )
SV_DrawOrthoTriangles();
CL_DrawDemoRecording();
CL_DrawHUD( CL_CHANGELEVEL );
R_ShowTextures();
ref.dllFuncs.R_ShowTextures();
R_ShowTree();
Con_DrawConsole();
UI_UpdateMenu( host.realtime );
Con_DrawVersion();
Con_DrawDebug(); // must be last
Touch_Draw();
OSK_Draw();
S_ExtraUpdate();
}
SCR_MakeScreenShot();
R_AllowFog( true );
R_EndFrame();
}
ref.dllFuncs.R_AllowFog( true );
ref.dllFuncs.R_EndFrame();
}

View File

@@ -16,6 +16,7 @@ GNU General Public License for more details.
#ifndef CLIENT_H
#define CLIENT_H
#include "xash3d_types.h"
#include "mathlib.h"
#include "cdll_int.h"
#include "menu_int.h"
@@ -31,35 +32,13 @@ GNU General Public License for more details.
#include "netchan.h"
#include "net_api.h"
#include "world.h"
#define MAX_DEMOS 32
#define MAX_MOVIES 8
#define MAX_CDTRACKS 32
#define MAX_CLIENT_SPRITES 256 // SpriteTextures
#define MAX_EFRAGS 8192 // Arcane Dimensions required
#define MAX_REQUESTS 64
// screenshot types
#define VID_SCREENSHOT 0
#define VID_LEVELSHOT 1
#define VID_MINISHOT 2
#define VID_MAPSHOT 3 // special case for overview layer
#define VID_SNAPSHOT 4 // save screenshot into root dir and no gamma correction
#include "ref_common.h"
// client sprite types
#define SPR_CLIENT 0 // client sprite for temp-entities or user-textures
#define SPR_HUDSPRITE 1 // hud sprite
#define SPR_MAPSPRITE 2 // contain overview.bmp that diced into frames 128x128
typedef int sound_t;
typedef enum
{
DEMO_INACTIVE = 0,
DEMO_XASH3D,
DEMO_QUAKE1
} demo_mode;
//=============================================================================
typedef struct netbandwithgraph_s
{
@@ -116,7 +95,11 @@ typedef struct
#define ANGLE_MASK (ANGLE_BACKUP - 1)
#define CL_UPDATE_MASK (CL_UPDATE_BACKUP - 1)
#if XASH_LOW_MEMORY == 2
#define CL_UPDATE_BACKUP SINGLEPLAYER_BACKUP
#else
extern int CL_UPDATE_BACKUP;
#endif
#define SIGNONS 2 // signon messages to receive before connected
#define INVALID_HANDLE 0xFFFF // for XashXT cache system
@@ -166,13 +149,6 @@ typedef struct
float weaponstarttime;
} cl_local_data_t;
typedef struct
{
char name[MAX_OSPATH];
char modelname[MAX_OSPATH];
model_t *model;
} player_model_t;
typedef struct
{
qboolean bUsed;
@@ -237,7 +213,6 @@ typedef struct
float timedelta; // floating delta between two updates
char serverinfo[MAX_SERVERINFO_STRING];
player_model_t player_models[MAX_CLIENTS]; // cache of player models
player_info_t players[MAX_CLIENTS]; // collected info about all other players include himself
double lastresourcecheck;
string downloadUrl;
@@ -293,6 +268,8 @@ typedef struct
short decal_index[MAX_DECALS];
model_t *worldmodel; // pointer to world
int lostpackets; // count lost packets and show dialog in menu
} client_t;
/*
@@ -303,16 +280,6 @@ of server connections
==================================================================
*/
typedef enum
{
ca_disconnected = 0,// not talking to a server
ca_connecting, // sending request packets to the server
ca_connected, // netchan_t established, waiting for svc_serverdata
ca_validate, // download resources, validating, auth on server
ca_active, // game views should be displayed
ca_cinematic, // playing a cinematic, not connected to a server
} connstate_t;
typedef enum
{
scrshot_inactive,
@@ -378,7 +345,7 @@ typedef struct
qboolean adjust_size; // allow to adjust scale for fonts
int renderMode; // override kRenderMode from TriAPI
int cullMode; // override CULL FACE from TriAPI
TRICULLSTYLE cullMode; // override CULL FACE from TriAPI
// holds text color
rgba_t textColor;
@@ -446,16 +413,6 @@ typedef struct
float applied_angle;
} screen_shake_t;
typedef struct
{
unsigned short textures[MAX_SKINS];// alias textures
struct mstudiotex_s *ptexture; // array of textures with local copy of remapped textures
short numtextures; // textures count
short topcolor; // cached value
short bottomcolor; // cached value
model_t *model; // for catch model changes
} remap_info_t;
typedef enum
{
NET_REQUEST_CANCEL = 0, // request was cancelled for some reasons
@@ -530,12 +487,15 @@ typedef struct
efrag_t *free_efrags; // linked efrags
cl_entity_t viewent; // viewmodel
qboolean client_dll_uses_sdl;
} clgame_static_t;
typedef struct
{
void *hInstance; // pointer to client.dll
UI_FUNCTIONS dllFuncs; // dll exported funcs
UI_EXTENDED_FUNCTIONS dllFuncs2; // fwgs extension
byte *mempool; // client edicts pool
cl_entity_t playermodel; // uiPlayerSetup drawing model
@@ -548,9 +508,11 @@ typedef struct
ui_globalvars_t *globals;
qboolean drawLogo; // set to TRUE if logo.avi missed or corrupted
long logo_xres;
long logo_yres;
int logo_xres;
int logo_yres;
float logo_length;
qboolean use_text_api;
} gameui_static_t;
typedef struct
@@ -602,7 +564,7 @@ typedef struct
double packet_loss_recalc_time;
int starting_count; // message num readed bits
float nextcmdtime; // when can we send the next command packet?
float nextcmdtime; // when can we send the next command packet?
int lastoutgoingcommand; // sequence number of last outgoing command
int lastupdate_sequence; // prediction stuff
@@ -648,7 +610,7 @@ typedef struct
// demo recording info must be here, so it isn't clearing on level change
qboolean demorecording;
qboolean demoplayback;
int demoplayback;
qboolean demowaiting; // don't record until a non-delta message is received
qboolean timedemo;
string demoname; // for demo looping
@@ -657,6 +619,17 @@ typedef struct
file_t *demofile;
file_t *demoheader; // contain demo startup info in case we record a demo on this level
qboolean internetservers_wait; // internetservers is waiting for dns request
qboolean internetservers_pending; // internetservers is waiting for dns request
// legacy mode support
qboolean legacymode; // one-way 48 protocol compatibility
netadr_t legacyserver;
netadr_t legacyservers[MAX_LEGACY_SERVERS];
int legacyservercount;
int extensions;
netadr_t serveradr;
} client_static_t;
#ifdef __cplusplus
@@ -704,10 +677,14 @@ extern convar_t *cl_levelshot_name;
extern convar_t *cl_draw_beams;
extern convar_t *cl_clockreset;
extern convar_t *cl_fixtimerate;
extern convar_t *hud_scale;
extern convar_t *gl_showtextures;
extern convar_t *cl_bmodelinterp;
extern convar_t *cl_righthand;
extern convar_t *cl_lw; // local weapons
extern convar_t *cl_charset;
extern convar_t *cl_trace_messages;
extern convar_t *hud_utf8;
extern convar_t *cl_showevents;
extern convar_t *scr_centertime;
extern convar_t *scr_viewsize;
@@ -715,12 +692,17 @@ extern convar_t *scr_loading;
extern convar_t *v_dark; // start from dark
extern convar_t *net_graph;
extern convar_t *rate;
extern convar_t *m_ignore;
extern convar_t *r_showtree;
extern convar_t *ui_renderworld;
//=============================================================================
void CL_SetLightstyle( int style, const char* s, float f );
void CL_RunLightStyles( void );
void CL_DecayLights( void );
dlight_t *CL_GetDynamicLight( int number );
dlight_t *CL_GetEntityLight( int number );
//=================================================
@@ -737,7 +719,6 @@ void CL_SaveShot_f( void );
void CL_LevelShot_f( void );
void CL_SetSky_f( void );
void SCR_Viewpos_f( void );
void SCR_TimeRefresh_f( void );
//
// cl_custom.c
@@ -757,6 +738,11 @@ void CL_ResetFrame( frame_t *frame );
void CL_WriteMessageHistory( void );
const char *CL_MsgInfo( int cmd );
//
// cl_efx.c
//
void CL_Particle( const vec3_t org, int color, float life, int zpos, int zvel );
//
// cl_main.c
//
@@ -765,7 +751,7 @@ void CL_SendCommand( void );
void CL_Disconnect_f( void );
void CL_ProcessFile( qboolean successfully_received, const char *filename );
void CL_WriteUsercmd( sizebuf_t *msg, int from, int to );
int CL_GetFragmentSize( void *unused );
int CL_GetFragmentSize( void *unused , fragsize_t mode );
qboolean CL_PrecacheResources( void );
void CL_SetupOverviewParams( void );
void CL_UpdateFrameLerp( void );
@@ -844,10 +830,17 @@ model_t *CL_LoadModel( const char *modelname, int *index );
HSPRITE pfnSPR_Load( const char *szPicName );
HSPRITE pfnSPR_LoadExt( const char *szPicName, uint texFlags );
void PicAdjustSize( float *x, float *y, float *w, float *h );
int CL_GetScreenInfo( SCREENINFO *pscrinfo );
void CL_FillRGBA( int x, int y, int width, int height, int r, int g, int b, int a );
void CL_PlayerTrace( float *start, float *end, int traceFlags, int ignore_pe, pmtrace_t *tr );
void CL_PlayerTraceExt( float *start, float *end, int traceFlags, int (*pfnIgnore)( physent_t *pe ), pmtrace_t *tr );
void CL_SetTraceHull( int hull );
void CL_GetMousePosition( int *mx, int *my ); // TODO: move to input
cl_entity_t* CL_GetViewModel( void );
void pfnGetScreenFade( struct screenfade_s *fade );
physent_t *pfnGetPhysent( int idx );
struct msurface_s *pfnTraceSurface( int ground, float *vstart, float *vend );
movevars_t *pfnGetMoveVars( void );
_inline cl_entity_t *CL_EDICT_NUM( int n )
{
@@ -862,6 +855,9 @@ _inline cl_entity_t *CL_EDICT_NUM( int n )
// cl_parse.c
//
void CL_ParseServerMessage( sizebuf_t *msg, qboolean normal_message );
void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message );
void CL_LegacyPrecache_f( void );
void CL_ParseTempEntity( sizebuf_t *msg );
void CL_StartResourceDownloading( const char *pszMessage, qboolean bCustom );
qboolean CL_DispatchUserMessage( const char *pszName, int iSize, void *pbuf );
@@ -935,14 +931,11 @@ void CL_SetUpPlayerPrediction( int dopred, int bIncludeLocalClient );
//
void CL_ParseQuakeMessage( sizebuf_t *msg, qboolean normal_message );
//
// cl_studio.c
//
void CL_InitStudioAPI( void );
//
// cl_frame.c
//
struct channel_s;
struct rawchan_s;
int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta );
qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType );
void CL_ResetLatchedVars( cl_entity_t *ent, qboolean full_reset );
@@ -962,31 +955,42 @@ void CL_EmitEntities( void );
remap_info_t *CL_GetRemapInfoForEntity( cl_entity_t *e );
void CL_AllocRemapInfo( int topcolor, int bottomcolor );
void CL_FreeRemapInfo( remap_info_t *info );
void R_StudioSetRemapColors( int top, int bottom );
void CL_UpdateRemapInfo( int topcolor, int bottomcolor );
void CL_ClearAllRemaps( void );
//
// cl_render.c
//
qboolean R_InitRenderAPI( void );
int CL_RenderGetParm( const int parm, const int arg, const qboolean checkRef );
lightstyle_t *CL_GetLightStyle( int number );
int R_FatPVS( const vec3_t org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis );
const ref_overview_t *GL_GetOverviewParms( void );
//
// cl_efrag.c
//
void R_StoreEfrags( efrag_t **ppefrag, int framecount );
void R_AddEfrags( cl_entity_t *ent );
void R_RemoveEfrags( cl_entity_t *ent );
//
// cl_tent.c
//
struct particle_s;
int CL_AddEntity( int entityType, cl_entity_t *pEnt );
void CL_WeaponAnim( int iAnim, int body );
void CL_ClearEffects( void );
void CL_ClearEfrags( void );
void CL_TestLights( void );
void CL_DrawParticlesExternal( const ref_viewpass_t *rvp, qboolean trans_pass, float frametime );
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_PlayerDecal( int playerIndex, int textureIndex, int entityIndex, float *pos );
void R_FreeDeadParticles( struct particle_s **ppparticles );
void CL_AddClientResource( const char *filename, int type );
void CL_AddClientResources( void );
int CL_FxBlend( cl_entity_t *e );
void CL_InitParticles( void );
void CL_ClearParticles( void );
void CL_FreeParticles( void );
void CL_DrawParticles( double frametime );
void CL_DrawTracers( double frametime );
void CL_InitTempEnts( void );
void CL_ClearTempEnts( void );
void CL_FreeTempEnts( void );
@@ -994,12 +998,13 @@ void CL_TempEntUpdate( void );
void CL_InitViewBeams( void );
void CL_ClearViewBeams( void );
void CL_FreeViewBeams( void );
void CL_DrawBeams( int fTrans );
void CL_AddCustomBeam( cl_entity_t *pEnvBeam );
cl_entity_t *R_BeamGetEntity( int index );
void CL_KillDeadBeams( cl_entity_t *pDeadEntity );
void CL_ParseViewBeam( sizebuf_t *msg, int beamType );
void CL_LoadClientSprites( void );
void CL_ReadPointFile_f( void );
void CL_DrawEFX( float time, qboolean fTrans );
void CL_ThinkParticle( double frametime, particle_t *p );
void CL_ReadLineFile_f( void );
void CL_RunLightStyles( void );
@@ -1007,7 +1012,7 @@ void CL_RunLightStyles( void );
// console.c
//
extern convar_t *con_fontsize;
qboolean Con_Visible( void );
int Con_Visible( void );
qboolean Con_FixedFont( void );
void Con_VidInit( void );
void Con_Shutdown( void );
@@ -1017,6 +1022,10 @@ void Con_DrawDebug( void );
void Con_RunConsole( void );
void Con_DrawConsole( void );
void Con_DrawVersion( void );
int Con_UtfProcessChar( int in );
int Con_UtfProcessCharForce( int in );
int Con_UtfMoveLeft( char *str, int pos );
int Con_UtfMoveRight( char *str, int pos, int length );
void Con_DrawStringLen( const char *pText, int *length, int *height );
int Con_DrawString( int x, int y, const char *string, rgba_t setColor );
int Con_DrawCharacter( int x, int y, int number, rgba_t color );
@@ -1029,13 +1038,18 @@ void Con_RestoreFont( void );
void Key_Console( int key );
void Key_Message( int key );
void Con_FastClose( void );
void Con_Bottom( void );
void Con_Top( void );
void Con_PageDown( int lines );
void Con_PageUp( int lines );
void Con_LoadHistory( void );
//
// 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_StartBackgroundTrack( const char *intro, const char *loop, long position, qboolean fullpath );
void S_StartBackgroundTrack( const char *intro, const char *loop, int position, qboolean fullpath );
void S_StopBackgroundTrack( void );
void S_StreamSetPause( int pause );
void S_StartStreaming( void );
@@ -1069,12 +1083,29 @@ qboolean UI_CreditsActive( void );
void UI_CharEvent( int key );
qboolean UI_MouseInRect( void );
qboolean UI_IsVisible( void );
void UI_ResetPing( void );
void UI_ShowUpdateDialog( qboolean preferStore );
void UI_ShowMessageBox( const char *text );
void UI_AddTouchButtonToList( const char *name, const char *texture, const char *command, unsigned char *color, int flags );
void UI_ConnectionProgress_Disconnect( void );
void UI_ConnectionProgress_Download( const char *pszFileName, const char *pszServerName, const char *pszServerPath, int iCurrent, int iTotal, const char *comment );
void UI_ConnectionProgress_DownloadEnd( void );
void UI_ConnectionProgress_Precache( void );
void UI_ConnectionProgress_Connect( const char *server );
void UI_ConnectionProgress_ChangeLevel( void );
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
//
qboolean Mobile_Init( void );
void Mobile_Shutdown( void );
//
// cl_video.c
//
@@ -1087,4 +1118,27 @@ void SCR_RunCinematic( void );
void SCR_StopCinematic( void );
void CL_PlayVideo_f( void );
#endif//CLIENT_H
//
// keys.c
//
int Key_IsDown( int keynum );
const char *Key_IsBind( int keynum );
void Key_Event( int key, int down );
void Key_Init( void );
void Key_WriteBindings( file_t *f );
const char *Key_GetBinding( int keynum );
void Key_SetBinding( int keynum, const char *binding );
void Key_ClearStates( void );
const char *Key_KeynumToString( int keynum );
int Key_StringToKeynum( const char *str );
int Key_GetKey( const char *binding );
void Key_EnumCmds_f( void );
void Key_SetKeyDest( int key_dest );
void Key_EnableTextInput( qboolean enable, qboolean force );
int Key_ToUpper( int key );
void OSK_Draw( void );
extern rgba_t g_color_table[8];
#endif//CLIENT_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

439
engine/client/in_joy.c Normal file
View File

@@ -0,0 +1,439 @@
/*
joyinput.c - joystick common input code
Copyright (C) 2016 a1batross
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#include "common.h"
#include "input.h"
#include "keydefs.h"
#include "client.h"
#include "platform/platform.h"
#ifndef SHRT_MAX
#define SHRT_MAX 0x7FFF
#endif
typedef enum engineAxis_e
{
JOY_AXIS_SIDE = 0,
JOY_AXIS_FWD,
JOY_AXIS_PITCH,
JOY_AXIS_YAW,
JOY_AXIS_RT,
JOY_AXIS_LT,
JOY_AXIS_NULL
} engineAxis_t;
#define MAX_AXES JOY_AXIS_NULL
// index - axis num come from event
// value - inner axis
static engineAxis_t joyaxesmap[MAX_AXES] =
{
JOY_AXIS_SIDE, // left stick, x
JOY_AXIS_FWD, // left stick, y
JOY_AXIS_PITCH, // right stick, y
JOY_AXIS_YAW, // right stick, x
JOY_AXIS_RT, // right trigger
JOY_AXIS_LT // left trigger
};
static struct joy_axis_s
{
short val;
short prevval;
} joyaxis[MAX_AXES] = { 0 };
static byte currentbinding; // add posibility to remap keys, to place it in joykeys[]
convar_t *joy_enable;
static convar_t *joy_pitch;
static convar_t *joy_yaw;
static convar_t *joy_forward;
static convar_t *joy_side;
static convar_t *joy_found;
static convar_t *joy_index;
static convar_t *joy_lt_threshold;
static convar_t *joy_rt_threshold;
static convar_t *joy_side_deadzone;
static convar_t *joy_forward_deadzone;
static convar_t *joy_side_key_threshold;
static convar_t *joy_forward_key_threshold;
static convar_t *joy_pitch_deadzone;
static convar_t *joy_yaw_deadzone;
static convar_t *joy_axis_binding;
/*
============
Joy_IsActive
============
*/
qboolean Joy_IsActive( void )
{
return joy_found->value && joy_enable->value;
}
/*
============
Joy_HatMotionEvent
DPad events
============
*/
void Joy_HatMotionEvent( byte hat, byte value )
{
struct
{
int mask;
int key;
} keys[] =
{
{ JOY_HAT_UP, K_UPARROW },
{ JOY_HAT_DOWN, K_DOWNARROW },
{ JOY_HAT_LEFT, K_LEFTARROW },
{ JOY_HAT_RIGHT, K_RIGHTARROW },
};
int i;
if( !joy_found->value )
return;
for( i = 0; i < ARRAYSIZE( keys ); i++ )
{
if( value & keys[i].mask )
{
if( !Key_IsDown( keys[i].key ))
Key_Event( keys[i].key, true );
}
else
{
if( Key_IsDown( keys[i].key ))
Key_Event( keys[i].key, false );
}
}
}
/*
=============
Joy_ProcessTrigger
=============
*/
static void Joy_ProcessTrigger( const engineAxis_t engineAxis, short value )
{
int trigButton = 0, trigThreshold = 0;
switch( engineAxis )
{
case JOY_AXIS_RT:
trigButton = K_JOY2;
trigThreshold = joy_rt_threshold->value;
break;
case JOY_AXIS_LT:
trigButton = K_JOY1;
trigThreshold = joy_lt_threshold->value;
break;
default:
Con_Reportf( S_ERROR "Joy_ProcessTrigger: invalid axis = %i", engineAxis );
break;
}
// update axis values
joyaxis[engineAxis].prevval = joyaxis[engineAxis].val;
joyaxis[engineAxis].val = value;
if( joyaxis[engineAxis].val > trigThreshold &&
joyaxis[engineAxis].prevval <= trigThreshold ) // ignore random press
{
Key_Event( trigButton, true );
}
else if( joyaxis[engineAxis].val < trigThreshold &&
joyaxis[engineAxis].prevval >= trigThreshold ) // we're unpressing (inverted)
{
Key_Event( trigButton, false );
}
}
static int Joy_GetHatValueForAxis( const engineAxis_t engineAxis )
{
int threshold, negative, positive;
switch( engineAxis )
{
case JOY_AXIS_SIDE:
threshold = joy_side_key_threshold->value;
negative = JOY_HAT_LEFT;
positive = JOY_HAT_RIGHT;
break;
case JOY_AXIS_FWD:
threshold = joy_side_key_threshold->value;
negative = JOY_HAT_UP;
positive = JOY_HAT_DOWN;
break;
default:
ASSERT( false ); // only fwd/side axes can emit key events
return 0;
}
// similar code in Joy_ProcessTrigger
if( joyaxis[engineAxis].val > threshold &&
joyaxis[engineAxis].prevval <= threshold ) // ignore random press
{
return positive;
}
if( joyaxis[engineAxis].val < -threshold &&
joyaxis[engineAxis].prevval >= -threshold ) // we're unpressing (inverted)
{
return negative;
}
return 0;
}
/*
=============
Joy_ProcessStick
=============
*/
static void Joy_ProcessStick( const engineAxis_t engineAxis, short value )
{
int deadzone = 0;
switch( engineAxis )
{
case JOY_AXIS_FWD: deadzone = joy_forward_deadzone->value; break;
case JOY_AXIS_SIDE: deadzone = joy_side_deadzone->value; break;
case JOY_AXIS_PITCH: deadzone = joy_pitch_deadzone->value; break;
case JOY_AXIS_YAW: deadzone = joy_yaw_deadzone->value; break;
default:
Con_Reportf( S_ERROR "Joy_ProcessStick: invalid axis = %i", engineAxis );
break;
}
if( value < deadzone && value > -deadzone )
value = 0; // caught new event in deadzone, fill it with zero(no motion)
// update axis values
joyaxis[engineAxis].prevval = joyaxis[engineAxis].val;
joyaxis[engineAxis].val = value;
// fwd/side axis simulate hat movement
if( ( engineAxis == JOY_AXIS_SIDE || engineAxis == JOY_AXIS_FWD ) &&
( CL_IsInMenu() || CL_IsInConsole() ) )
{
int val = 0;
val |= Joy_GetHatValueForAxis( JOY_AXIS_SIDE );
val |= Joy_GetHatValueForAxis( JOY_AXIS_FWD );
Joy_HatMotionEvent( 0, val );
}
}
/*
=============
Joy_AxisMotionEvent
Axis events
=============
*/
void Joy_AxisMotionEvent( byte axis, short value )
{
byte engineAxis;
if( !joy_found->value )
return;
if( axis >= MAX_AXES )
{
Con_Reportf( "Only 6 axes is supported\n" );
return;
}
engineAxis = joyaxesmap[axis]; // convert to engine inner axis control
if( engineAxis == JOY_AXIS_NULL )
return;
if( value == joyaxis[engineAxis].val )
return; // it is not an update
if( engineAxis >= JOY_AXIS_RT )
Joy_ProcessTrigger( engineAxis, value );
else
Joy_ProcessStick( engineAxis, value );
}
/*
=============
Joy_BallMotionEvent
Trackball events. UNDONE
=============
*/
void Joy_BallMotionEvent( byte ball, short xrel, short yrel )
{
//if( !joy_found->value )
// return;
}
/*
=============
Joy_ButtonEvent
Button events
=============
*/
void Joy_ButtonEvent( byte button, byte down )
{
if( !joy_found->value )
return;
// generic game button code.
if( button > 32 )
{
int origbutton = button;
button = ( button & 31 ) + K_AUX1;
Con_Reportf( "Only 32 joybuttons is supported, converting %i button ID to %s\n", origbutton, Key_KeynumToString( button ) );
}
else button += K_AUX1;
Key_Event( button, down );
}
/*
=============
Joy_RemoveEvent
Called when joystick is removed. For future expansion
=============
*/
void Joy_RemoveEvent( void )
{
if( joy_found->value )
Cvar_FullSet( "joy_found", "0", FCVAR_READ_ONLY );
}
/*
=============
Joy_RemoveEvent
Called when joystick is removed. For future expansion
=============
*/
void Joy_AddEvent( void )
{
if( joy_enable->value && !joy_found->value )
Cvar_FullSet( "joy_found", "1", FCVAR_READ_ONLY );
}
/*
=============
Joy_FinalizeMove
Append movement from axis. Called everyframe
=============
*/
void Joy_FinalizeMove( float *fw, float *side, float *dpitch, float *dyaw )
{
if( !Joy_IsActive() )
return;
if( FBitSet( joy_axis_binding->flags, FCVAR_CHANGED ) )
{
const char *bind = joy_axis_binding->string;
size_t i;
for( i = 0; bind[i]; i++ )
{
switch( bind[i] )
{
case 's': joyaxesmap[i] = JOY_AXIS_SIDE; break;
case 'f': joyaxesmap[i] = JOY_AXIS_FWD; break;
case 'y': joyaxesmap[i] = JOY_AXIS_YAW; break;
case 'p': joyaxesmap[i] = JOY_AXIS_PITCH; break;
case 'r': joyaxesmap[i] = JOY_AXIS_RT; break;
case 'l': joyaxesmap[i] = JOY_AXIS_LT; break;
default : joyaxesmap[i] = JOY_AXIS_NULL; break;
}
}
ClearBits( joy_axis_binding->flags, FCVAR_CHANGED );
}
*fw -= joy_forward->value * (float)joyaxis[JOY_AXIS_FWD ].val/(float)SHRT_MAX; // must be form -1.0 to 1.0
*side += joy_side->value * (float)joyaxis[JOY_AXIS_SIDE].val/(float)SHRT_MAX;
#if !defined(XASH_SDL)
*dpitch += joy_pitch->value * (float)joyaxis[JOY_AXIS_PITCH].val/(float)SHRT_MAX * host.realframetime; // abs axis rotate is frametime related
*dyaw -= joy_yaw->value * (float)joyaxis[JOY_AXIS_YAW ].val/(float)SHRT_MAX * host.realframetime;
#else
// HACKHACK: SDL have inverted look axis.
*dpitch -= joy_pitch->value * (float)joyaxis[JOY_AXIS_PITCH].val/(float)SHRT_MAX * host.realframetime;
*dyaw += joy_yaw->value * (float)joyaxis[JOY_AXIS_YAW ].val/(float)SHRT_MAX * host.realframetime;
#endif
}
/*
=============
Joy_Init
Main init procedure
=============
*/
void Joy_Init( void )
{
joy_pitch = Cvar_Get( "joy_pitch", "100.0", FCVAR_ARCHIVE, "joystick pitch sensitivity" );
joy_yaw = Cvar_Get( "joy_yaw", "100.0", FCVAR_ARCHIVE, "joystick yaw sensitivity" );
joy_side = Cvar_Get( "joy_side", "1.0", FCVAR_ARCHIVE, "joystick side sensitivity. Values from -1.0 to 1.0" );
joy_forward = Cvar_Get( "joy_forward", "1.0", FCVAR_ARCHIVE, "joystick forward sensitivity. Values from -1.0 to 1.0" );
joy_lt_threshold = Cvar_Get( "joy_lt_threshold", "-16384", FCVAR_ARCHIVE, "left trigger threshold. Value from -32768 to 32767");
joy_rt_threshold = Cvar_Get( "joy_rt_threshold", "-16384", FCVAR_ARCHIVE, "right trigger threshold. Value from -32768 to 32767" );
// emit a key event at 75% axis move
joy_side_key_threshold = Cvar_Get( "joy_side_key_threshold", "24576", FCVAR_ARCHIVE, "side axis key event emit threshold. Value from 0 to 32767" );
joy_forward_key_threshold = Cvar_Get( "joy_forward_key_threshold", "24576", FCVAR_ARCHIVE, "forward axis key event emit threshold. Value from 0 to 32767");
// by default, we rely on deadzone detection come from system, but some glitchy devices report false deadzones
joy_side_deadzone = Cvar_Get( "joy_side_deadzone", "0", FCVAR_ARCHIVE, "side axis deadzone. Value from 0 to 32767" );
joy_forward_deadzone = Cvar_Get( "joy_forward_deadzone", "0", FCVAR_ARCHIVE, "forward axis deadzone. Value from 0 to 32767");
joy_pitch_deadzone = Cvar_Get( "joy_pitch_deadzone", "0", FCVAR_ARCHIVE, "pitch axis deadzone. Value from 0 to 32767");
joy_yaw_deadzone = Cvar_Get( "joy_yaw_deadzone", "0", FCVAR_ARCHIVE, "yaw axis deadzone. Value from 0 to 32767" );
joy_axis_binding = Cvar_Get( "joy_axis_binding", "sfpyrl", FCVAR_ARCHIVE, "axis hardware id to engine inner axis binding, "
"s - side, f - forward, y - yaw, p - pitch, r - left trigger, l - right trigger" );
joy_found = Cvar_Get( "joy_found", "0", FCVAR_READ_ONLY, "is joystick is connected" );
// we doesn't loaded config.cfg yet, so this cvar is not archive.
// change by +set joy_index in cmdline
joy_index = Cvar_Get( "joy_index", "0", FCVAR_READ_ONLY, "current active joystick" );
joy_enable = Cvar_Get( "joy_enable", "1", FCVAR_ARCHIVE, "enable joystick" );
if( Sys_CheckParm( "-nojoy" ))
{
Cvar_FullSet( "joy_enable", "0", FCVAR_READ_ONLY );
return;
}
Cvar_FullSet( "joy_found", va( "%d", Platform_JoyInit( joy_index->value )), FCVAR_READ_ONLY );
}
/*
===========
Joy_Shutdown
Shutdown joystick code
===========
*/
void Joy_Shutdown( void )
{
Cvar_FullSet( "joy_found", 0, FCVAR_READ_ONLY );
}

1975
engine/client/in_touch.c Normal file

File diff suppressed because it is too large Load Diff

699
engine/client/input.c Normal file
View File

@@ -0,0 +1,699 @@
/*
input.c - win32 input devices
Copyright (C) 2007 Uncle Mike
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#include "common.h"
#include "input.h"
#include "client.h"
#include "vgui_draw.h"
#ifdef XASH_SDL
#include <SDL.h>
#endif
#include "platform/platform.h"
void* in_mousecursor;
qboolean in_mouseactive; // false when not focus app
qboolean in_mouseinitialized;
qboolean in_mouse_suspended;
POINT in_lastvalidpos;
qboolean in_mouse_savedpos;
static struct inputstate_s
{
float lastpitch, lastyaw;
} inputstate;
extern convar_t *vid_fullscreen;
convar_t *m_enginemouse;
convar_t *m_pitch;
convar_t *m_yaw;
convar_t *m_enginesens;
convar_t *m_ignore;
convar_t *cl_forwardspeed;
convar_t *cl_sidespeed;
convar_t *cl_backspeed;
convar_t *look_filter;
/*
================
IN_CollectInputDevices
Returns a bit mask representing connected devices or, at least, enabled
================
*/
uint IN_CollectInputDevices( void )
{
uint ret = 0;
if( !m_ignore->value ) // no way to check is mouse connected, so use cvar only
ret |= INPUT_DEVICE_MOUSE;
if( CVAR_TO_BOOL(touch_enable) )
ret |= INPUT_DEVICE_TOUCH;
if( Joy_IsActive() ) // connected or enabled
ret |= INPUT_DEVICE_JOYSTICK;
Con_Reportf( "Connected devices: %s%s%s%s\n",
FBitSet( ret, INPUT_DEVICE_MOUSE ) ? "mouse " : "",
FBitSet( ret, INPUT_DEVICE_TOUCH ) ? "touch " : "",
FBitSet( ret, INPUT_DEVICE_JOYSTICK ) ? "joy " : "",
FBitSet( ret, INPUT_DEVICE_VR ) ? "vr " : "");
return ret;
}
/*
=================
IN_LockInputDevices
tries to lock any possibilty to connect another input device after
player is connected to the server
=================
*/
void IN_LockInputDevices( qboolean lock )
{
extern convar_t *joy_enable; // private to input system
if( lock )
{
SetBits( m_ignore->flags, FCVAR_READ_ONLY );
SetBits( joy_enable->flags, FCVAR_READ_ONLY );
SetBits( touch_enable->flags, FCVAR_READ_ONLY );
}
else
{
ClearBits( m_ignore->flags, FCVAR_READ_ONLY );
ClearBits( joy_enable->flags, FCVAR_READ_ONLY );
ClearBits( touch_enable->flags, FCVAR_READ_ONLY );
}
}
/*
===========
IN_StartupMouse
===========
*/
void IN_StartupMouse( void )
{
m_ignore = Cvar_Get( "m_ignore", DEFAULT_M_IGNORE, FCVAR_ARCHIVE , "ignore mouse events" );
m_enginemouse = Cvar_Get( "m_enginemouse", "0", FCVAR_ARCHIVE, "read mouse events in engine instead of client" );
m_enginesens = Cvar_Get( "m_enginesens", "0.3", FCVAR_ARCHIVE, "mouse sensitivity, when m_enginemouse enabled" );
m_pitch = Cvar_Get( "m_pitch", "0.022", FCVAR_ARCHIVE, "mouse pitch value" );
m_yaw = Cvar_Get( "m_yaw", "0.022", FCVAR_ARCHIVE, "mouse yaw value" );
look_filter = Cvar_Get( "look_filter", "0", FCVAR_ARCHIVE, "filter look events making it smoother" );
// You can use -nomouse argument to prevent using mouse from client
// -noenginemouse will disable all mouse input
if( Sys_CheckParm( "-noenginemouse" )) return;
in_mouseinitialized = true;
}
static void IN_ActivateCursor( void )
{
if( cls.key_dest == key_menu )
{
#ifdef XASH_SDL
SDL_SetCursor( in_mousecursor );
#endif
}
}
void IN_SetCursor( void *hCursor )
{
in_mousecursor = hCursor;
IN_ActivateCursor();
}
/*
===========
IN_MouseSavePos
Save mouse pos before state change e.g. changelevel
===========
*/
void IN_MouseSavePos( void )
{
if( !in_mouseactive )
return;
Platform_GetMousePos( &in_lastvalidpos.x, &in_lastvalidpos.y );
in_mouse_savedpos = true;
}
/*
===========
IN_MouseRestorePos
Restore right position for background
===========
*/
void IN_MouseRestorePos( void )
{
if( !in_mouse_savedpos )
return;
Platform_SetMousePos( in_lastvalidpos.x, in_lastvalidpos.y );
in_mouse_savedpos = false;
}
/*
===========
IN_ToggleClientMouse
Called when key_dest is changed
===========
*/
void IN_ToggleClientMouse( int newstate, int oldstate )
{
if( newstate == oldstate ) return;
if( oldstate == key_game )
{
if( cls.initialized )
clgame.dllFuncs.IN_DeactivateMouse();
}
else if( newstate == key_game )
{
// reset mouse pos, so cancel effect in game
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
if( CVAR_TO_BOOL( touch_enable ) )
{
SDL_SetRelativeMouseMode( SDL_FALSE );
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
}
else
#endif
{
Platform_SetMousePos( host.window_center_x, host.window_center_y );
#if XASH_SDL
SDL_SetWindowGrab( host.hWnd, SDL_TRUE );
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
if( clgame.dllFuncs.pfnLookEvent )
SDL_SetRelativeMouseMode( SDL_TRUE );
#endif
#endif // XASH_SDL
}
if( cls.initialized )
clgame.dllFuncs.IN_ActivateMouse();
}
if( ( newstate == key_menu || newstate == key_console || newstate == key_message ) && ( !CL_IsBackgroundMap() || CL_IsBackgroundDemo( )))
{
#ifdef XASH_SDL
SDL_SetWindowGrab(host.hWnd, SDL_FALSE);
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
if( clgame.dllFuncs.pfnLookEvent )
SDL_SetRelativeMouseMode( SDL_FALSE );
#endif
#endif // XASH_SDL
#if XASH_ANDROID
Android_ShowMouse( true );
#endif
#ifdef XASH_USE_EVDEV
Evdev_SetGrab( false );
#endif
}
else
{
#if XASH_ANDROID
Android_ShowMouse( false );
#endif
#ifdef XASH_USE_EVDEV
Evdev_SetGrab( true );
#endif
}
}
/*
===========
IN_ActivateMouse
Called when the window gains focus or changes in some way
===========
*/
void IN_ActivateMouse( qboolean force )
{
int width, height;
static int oldstate;
if( !in_mouseinitialized )
return;
if( CL_Active() && host.mouse_visible && !force )
return; // VGUI controls
if( cls.key_dest == key_menu && !Cvar_VariableInteger( "fullscreen" ))
{
// check for mouse leave-entering
if( !in_mouse_suspended && !UI_MouseInRect( ))
in_mouse_suspended = true;
if( oldstate != in_mouse_suspended )
{
if( in_mouse_suspended )
{
#ifdef XASH_SDL
/// TODO: Platform_ShowCursor
if( !touch_emulate )
SDL_ShowCursor( SDL_FALSE );
#endif
UI_ShowCursor( false );
}
}
oldstate = in_mouse_suspended;
if( in_mouse_suspended )
{
in_mouse_suspended = false;
in_mouseactive = false; // re-initialize mouse
UI_ShowCursor( true );
}
}
if( in_mouseactive ) return;
in_mouseactive = true;
if( UI_IsVisible( )) return;
if( cls.key_dest == key_game )
{
clgame.dllFuncs.IN_ActivateMouse();
#ifdef XASH_SDL
SDL_GetRelativeMouseState( 0, 0 ); // Reset mouse position
#endif
}
}
/*
===========
IN_DeactivateMouse
Called when the window loses focus
===========
*/
void IN_DeactivateMouse( void )
{
if( !in_mouseinitialized || !in_mouseactive )
return;
if( cls.key_dest == key_game )
{
clgame.dllFuncs.IN_DeactivateMouse();
}
in_mouseactive = false;
#ifdef XASH_SDL
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
#endif // XASH_SDL
}
/*
================
IN_MouseMove
================
*/
void IN_MouseMove( void )
{
POINT current_pos;
if( !in_mouseinitialized || !in_mouseactive || !UI_IsVisible( ))
return;
// find mouse movement
Platform_GetMousePos( &current_pos.x, &current_pos.y );
VGui_MouseMove( current_pos.x, current_pos.y );
// HACKHACK: show cursor in UI, as mainui doesn't call
// platform-dependent SetCursor anymore
#ifdef XASH_SDL
if( UI_IsVisible() )
SDL_ShowCursor( SDL_TRUE );
#endif
// if the menu is visible, move the menu cursor
UI_MouseMove( current_pos.x, current_pos.y );
IN_ActivateCursor();
}
/*
===========
IN_MouseEvent
===========
*/
void IN_MouseEvent( void )
{
int i;
// touch emu: handle motion
if( CVAR_TO_BOOL( touch_emulate ))
{
if( Key_IsDown( K_SHIFT ) )
Touch_KeyEvent( K_MOUSE2, 2 );
else
Touch_KeyEvent( K_MOUSE1, 2 );
}
if( !in_mouseinitialized || !in_mouseactive )
return;
if( m_ignore->value )
return;
if( cls.key_dest == key_game )
{
#if defined( XASH_SDL )
static qboolean ignore; // igonre mouse warp event
int x, y;
Platform_GetMousePos(&x, &y);
if( host.mouse_visible )
SDL_ShowCursor( SDL_TRUE );
else if( !CVAR_TO_BOOL( touch_emulate ) )
SDL_ShowCursor( SDL_FALSE );
if( x < host.window_center_x / 2 ||
y < host.window_center_y / 2 ||
x > host.window_center_x + host.window_center_x / 2 ||
y > host.window_center_y + host.window_center_y / 2 )
{
Platform_SetMousePos( host.window_center_x, host.window_center_y );
ignore = 1; // next mouse event will be mouse warp
return;
}
if ( !ignore )
{
if( !m_enginemouse->value )
{
// a1ba: mouse keys are now separated
// so pass 0 here
clgame.dllFuncs.IN_MouseEvent( 0 );
}
}
else
{
SDL_GetRelativeMouseState( 0, 0 ); // reset relative state
ignore = 0;
}
#endif
return;
}
else
{
#if XASH_SDL && !XASH_WIN32
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
SDL_SetRelativeMouseMode( SDL_FALSE );
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
SDL_ShowCursor( SDL_TRUE );
#endif // XASH_SDL && !XASH_WIN32
IN_MouseMove();
}
}
/*
===========
IN_Shutdown
===========
*/
void IN_Shutdown( void )
{
IN_DeactivateMouse( );
#ifdef XASH_USE_EVDEV
Evdev_Shutdown();
#endif
Touch_Shutdown();
}
/*
===========
IN_Init
===========
*/
void IN_Init( void )
{
cl_forwardspeed = Cvar_Get( "cl_forwardspeed", "400", FCVAR_ARCHIVE | FCVAR_CLIENTDLL, "Default forward move speed" );
cl_backspeed = Cvar_Get( "cl_backspeed", "400", FCVAR_ARCHIVE | FCVAR_CLIENTDLL, "Default back move speed" );
cl_sidespeed = Cvar_Get( "cl_sidespeed", "400", FCVAR_ARCHIVE | FCVAR_CLIENTDLL, "Default side move speed" );
if( !Host_IsDedicated() )
{
IN_StartupMouse( );
Joy_Init(); // common joystick support init
Touch_Init();
#ifdef XASH_USE_EVDEV
Evdev_Init();
#endif
}
}
/*
================
IN_JoyMove
Common function for engine joystick movement
-1 < forwardmove < 1, -1 < sidemove < 1
================
*/
#define F (1U << 0) // Forward
#define B (1U << 1) // Back
#define L (1U << 2) // Left
#define R (1U << 3) // Right
#define T (1U << 4) // Forward stop
#define S (1U << 5) // Side stop
static void IN_JoyAppendMove( usercmd_t *cmd, float forwardmove, float sidemove )
{
static uint moveflags = T | S;
if( forwardmove ) cmd->forwardmove = forwardmove * cl_forwardspeed->value;
if( sidemove ) cmd->sidemove = sidemove * cl_sidespeed->value;
if( forwardmove )
{
moveflags &= ~T;
}
else if( !( moveflags & T ) )
{
Cmd_ExecuteString( "-back" );
Cmd_ExecuteString( "-forward" );
moveflags |= T;
}
if( sidemove )
{
moveflags &= ~S;
}
else if( !( moveflags & S ) )
{
Cmd_ExecuteString( "-moveleft" );
Cmd_ExecuteString( "-moveright" );
moveflags |= S;
}
if ( forwardmove > 0.7f && !( moveflags & F ))
{
moveflags |= F;
Cmd_ExecuteString( "+forward" );
}
else if ( forwardmove < 0.7f && ( moveflags & F ))
{
moveflags &= ~F;
Cmd_ExecuteString( "-forward" );
}
if ( forwardmove < -0.7f && !( moveflags & B ))
{
moveflags |= B;
Cmd_ExecuteString( "+back" );
}
else if ( forwardmove > -0.7f && ( moveflags & B ))
{
moveflags &= ~B;
Cmd_ExecuteString( "-back" );
}
if ( sidemove > 0.9f && !( moveflags & R ))
{
moveflags |= R;
Cmd_ExecuteString( "+moveright" );
}
else if ( sidemove < 0.9f && ( moveflags & R ))
{
moveflags &= ~R;
Cmd_ExecuteString( "-moveright" );
}
if ( sidemove < -0.9f && !( moveflags & L ))
{
moveflags |= L;
Cmd_ExecuteString( "+moveleft" );
}
else if ( sidemove > -0.9f && ( moveflags & L ))
{
moveflags &= ~L;
Cmd_ExecuteString( "-moveleft" );
}
}
void IN_CollectInput( float *forward, float *side, float *pitch, float *yaw, qboolean includeMouse, qboolean includeSdlMouse )
{
if( includeMouse )
{
#if XASH_INPUT == INPUT_SDL
if( includeSdlMouse )
{
int x, y;
SDL_GetRelativeMouseState( &x, &y );
*pitch += y * m_pitch->value;
*yaw -= x * m_yaw->value;
}
#endif // INPUT_SDL
#if XASH_INPUT == INPUT_ANDROID
{
float x, y;
Android_MouseMove( &x, &y );
*pitch += y * m_pitch->value;
*yaw -= x * m_yaw->value;
}
#endif // ANDROID
#ifdef XASH_USE_EVDEV
IN_EvdevMove( yaw, pitch );
#endif
}
Joy_FinalizeMove( forward, side, yaw, pitch );
Touch_GetMove( forward, side, yaw, pitch );
if( look_filter->value )
{
*pitch = ( inputstate.lastpitch + *pitch ) / 2;
*yaw = ( inputstate.lastyaw + *yaw ) / 2;
inputstate.lastpitch = *pitch;
inputstate.lastyaw = *yaw;
}
}
/*
================
IN_EngineAppendMove
Called from cl_main.c after generating command in client
================
*/
void IN_EngineAppendMove( float frametime, void *cmd1, qboolean active )
{
float forward, side, pitch, yaw;
usercmd_t *cmd = cmd1;
if( clgame.dllFuncs.pfnLookEvent )
return;
if( cls.key_dest != key_game || cl.paused || cl.intermission )
return;
forward = side = pitch = yaw = 0;
if( active )
{
float sensitivity = 1;//( (float)cl.local.scr_fov / (float)90.0f );
IN_CollectInput( &forward, &side, &pitch, &yaw, in_mouseinitialized && !CVAR_TO_BOOL( m_ignore ), m_enginemouse->value );
IN_JoyAppendMove( cmd, forward, side );
if( pitch || yaw )
{
cmd->viewangles[YAW] += yaw * sensitivity;
cmd->viewangles[PITCH] += pitch * sensitivity;
cmd->viewangles[PITCH] = bound( -90, cmd->viewangles[PITCH], 90 );
VectorCopy(cmd->viewangles, cl.viewangles);
}
}
}
/*
==================
Host_InputFrame
Called every frame, even if not generating commands
==================
*/
void Host_InputFrame( void )
{
qboolean shutdownMouse = false;
float forward = 0, side = 0, pitch = 0, yaw = 0;
Sys_SendKeyEvents ();
#ifdef XASH_USE_EVDEV
IN_EvdevFrame();
#endif
if( clgame.dllFuncs.pfnLookEvent )
{
IN_CollectInput( &forward, &side, &pitch, &yaw, in_mouseinitialized && !CVAR_TO_BOOL( m_ignore ), true );
if( cls.key_dest == key_game )
{
clgame.dllFuncs.pfnLookEvent( yaw, pitch );
clgame.dllFuncs.pfnMoveEvent( forward, side );
}
}
Cbuf_Execute ();
if( !in_mouseinitialized )
return;
if( host.status != HOST_FRAME )
{
IN_DeactivateMouse();
return;
}
// release mouse during pause or console typeing
if( cl.paused && cls.key_dest == key_game )
shutdownMouse = true;
if( shutdownMouse && !Cvar_VariableInteger( "fullscreen" ))
{
IN_DeactivateMouse();
return;
}
IN_ActivateMouse( false );
IN_MouseMove();
}

109
engine/client/input.h Normal file
View File

@@ -0,0 +1,109 @@
/*
input.h - win32 input devices
Copyright (C) 2007 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.
*/
#ifndef INPUT_H
#define INPUT_H
/*
==============================================================
INPUT
==============================================================
*/
#include "keydefs.h"
//
// input.c
//
extern qboolean in_mouseinitialized;
void IN_Init( void );
void Host_InputFrame( void );
void IN_Shutdown( void );
void IN_MouseEvent( void );
void IN_ActivateMouse( qboolean force );
void IN_DeactivateMouse( void );
void IN_MouseSavePos( void );
void IN_MouseRestorePos( void );
void IN_ToggleClientMouse( int newstate, int oldstate );
void IN_SetCursor( void *hCursor );
uint IN_CollectInputDevices( void );
void IN_LockInputDevices( qboolean lock );
void IN_EngineAppendMove( float frametime, void *cmd, qboolean active );
extern convar_t *m_yaw;
extern convar_t *m_pitch;
//
// in_touch.c
//
typedef enum
{
event_down = 0,
event_up,
event_motion
} touchEventType;
extern convar_t *touch_enable;
extern convar_t *touch_emulate;
void Touch_Draw( void );
void Touch_SetClientOnly( qboolean state );
void Touch_RemoveButton( const char *name );
void Touch_HideButtons( const char *name, unsigned char hide );
//void IN_TouchSetCommand( const char *name, const char *command );
//void IN_TouchSetTexture( const char *name, const char *texture );
//void IN_TouchSetColor( const char *name, byte *color );
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_WriteConfig( void );
void Touch_Init( void );
void Touch_Shutdown( void );
void Touch_GetMove( float * forward, float *side, float *yaw, float *pitch );
void Touch_ResetDefaultButtons( void );
int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx, float dy );
void Touch_KeyEvent( int key, int down );
//
// in_joy.c
//
enum
{
JOY_HAT_CENTERED = 0,
JOY_HAT_UP = BIT(0),
JOY_HAT_RIGHT = BIT(1),
JOY_HAT_DOWN = BIT(2),
JOY_HAT_LEFT = BIT(3),
JOY_HAT_RIGHTUP = JOY_HAT_RIGHT | JOY_HAT_UP,
JOY_HAT_RIGHTDOWN = JOY_HAT_RIGHT | JOY_HAT_DOWN,
JOY_HAT_LEFTUP = JOY_HAT_LEFT | JOY_HAT_UP,
JOY_HAT_LEFTDOWN = JOY_HAT_LEFT | JOY_HAT_DOWN
};
qboolean Joy_IsActive( void );
void Joy_HatMotionEvent( byte hat, byte value );
void Joy_AxisMotionEvent( byte axis, short value );
void Joy_BallMotionEvent( byte ball, short xrel, short yrel );
void Joy_ButtonEvent( byte button, byte down );
void Joy_AddEvent( void );
void Joy_RemoveEvent( void );
void Joy_FinalizeMove( float *fw, float *side, float *dpitch, float *dyaw );
void Joy_Init( void );
void Joy_Shutdown( void );
void Joy_EnableTextInput(qboolean enable, qboolean force);
#endif//INPUT_H

Some files were not shown because too many files have changed in this diff Show More