2004-08-23 00:15:46 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
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 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2011-06-01 13:21:54 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
// quakedef.h -- primary header for client
|
|
|
|
|
2005-12-15 19:15:39 +00:00
|
|
|
#ifndef __QUAKEDEF_H__
|
|
|
|
#define __QUAKEDEF_H__
|
|
|
|
|
2020-11-04 10:19:30 +00:00
|
|
|
#include "../common/bothdefs.h" //first thing included by ALL files.
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2011-10-27 15:46:36 +00:00
|
|
|
//for msvc #pragma message lines
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#define MSVC_LINE __FILE__"("STRINGIFY(__LINE__)"):"
|
|
|
|
#define warningmsg(s) message(MSVC_LINE s)
|
|
|
|
#elif __GNUC__ >=4
|
|
|
|
#define warningmsg(s) message(s)
|
|
|
|
#endif
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#ifdef MSVCDISABLEWARNINGS
|
|
|
|
//#pragma warning( disable : 4244 4127 4201 4214 4514 4305 4115 4018)
|
|
|
|
/*#pragma warning( disable : 4244) //conversion from const double to float
|
|
|
|
#pragma warning( disable : 4305) //truncation from const double to float
|
|
|
|
#pragma warning( disable : 4018) //signed/unsigned mismatch... fix these?
|
|
|
|
#pragma warning( disable : 4706) //assignment within conditional expression - watch for these in GCC where they can be fixed but still functional.
|
|
|
|
#pragma warning( disable : 4100) //unreferenced formal parameter
|
|
|
|
#pragma warning( disable : 4201) //nonstandard extension used : nameless struct/union
|
|
|
|
#pragma warning( disable : 4213) //nonstandard extension used : cast on l-value
|
|
|
|
#pragma warning( disable : 4127) //conditional expression is constant - fixme?
|
|
|
|
*/
|
|
|
|
#pragma warning( 4 : 4244) //conversion from const double to float
|
|
|
|
#pragma warning( 4 : 4305) //truncation from const double to float
|
|
|
|
#pragma warning( 4 : 4018) //truncation from const double to float
|
|
|
|
|
|
|
|
#pragma warning( 2 : 4701)
|
|
|
|
#pragma warning(2:4132 4268)// const object not initialized
|
|
|
|
|
|
|
|
#pragma warning(2:4032) // function arg has different type from declaration
|
|
|
|
#pragma warning(2:4092) // 'sizeof' value too big
|
|
|
|
#pragma warning(2:4132 4268)// const object not initialized
|
|
|
|
//#pragma warning(2:4152) // pointer conversion between function and data
|
|
|
|
#pragma warning(2:4239) // standard doesn't allow this conversion
|
|
|
|
#pragma warning(2:4701) // local variable used without being initialized
|
|
|
|
//#pragma warning(2:4706) // if (a=b) instead of (if a==b)
|
|
|
|
#pragma warning(2:4709) // comma in array subscript
|
|
|
|
#pragma warning(3:4061) // not all enum values tested in switch statement
|
|
|
|
#pragma warning(3:4710) // inline function was not inlined
|
|
|
|
#pragma warning(3:4121) // space added for structure alignment
|
|
|
|
#pragma warning(3:4505) // unreferenced local function removed
|
|
|
|
#pragma warning(3:4019) // empty statement at global scope
|
|
|
|
//#pragma warning(3:4057) // pointers refer to different base types
|
|
|
|
#pragma warning(3:4125) // decimal digit terminates octal escape
|
2006-01-28 02:35:40 +00:00
|
|
|
#pragma warning(2:4131) // old-style function declarator
|
2004-08-23 00:15:46 +00:00
|
|
|
#pragma warning(3:4211) // extern redefined as static
|
|
|
|
//#pragma warning(3:4213) // cast on left side of = is non-standard
|
|
|
|
#pragma warning(3:4222) // member function at file scope shouldn't be static
|
|
|
|
#pragma warning(3:4234 4235)// keyword not supported or reserved for future
|
|
|
|
#pragma warning(3:4504) // type ambiguous; simplify code
|
|
|
|
#pragma warning(3:4507) // explicit linkage specified after default linkage
|
|
|
|
#pragma warning(3:4515) // namespace uses itself
|
|
|
|
#pragma warning(3:4516 4517)// access declarations are deprecated
|
|
|
|
#pragma warning(3:4670) // base class of thrown object is inaccessible
|
|
|
|
#pragma warning(3:4671) // copy ctor of thrown object is inaccessible
|
|
|
|
#pragma warning(3:4673) // thrown object cannot be handled in catch block
|
|
|
|
#pragma warning(3:4674) // dtor of thrown object is inaccessible
|
|
|
|
#pragma warning(3:4705) // statement has no effect (example: a+1;)
|
2005-02-28 07:16:19 +00:00
|
|
|
|
2006-02-11 14:51:36 +00:00
|
|
|
#pragma warning(3:4013) // function undefined, assuming extern returning int
|
2005-11-30 01:20:53 +00:00
|
|
|
|
2005-02-28 07:16:19 +00:00
|
|
|
|
|
|
|
#pragma warning( 4 : 4267) //truncation from const double to float
|
2013-03-12 22:53:23 +00:00
|
|
|
#pragma warning( 4 : 4710) //function not inlined
|
2009-04-06 00:34:32 +00:00
|
|
|
|
2009-11-04 21:16:50 +00:00
|
|
|
#pragma warning( error : 4020)
|
2009-04-06 00:34:32 +00:00
|
|
|
|
2009-11-04 21:16:50 +00:00
|
|
|
#pragma warning(error:4013)
|
2010-10-02 02:25:39 +00:00
|
|
|
|
|
|
|
//msvc... shut the fuck up.
|
|
|
|
#define _CRT_SECURE_NO_DEPRECATE
|
|
|
|
#define _CRT_NONSTDC_NO_DEPRECATE
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define QUAKEDEF_H__
|
|
|
|
|
|
|
|
#ifdef __linux__
|
|
|
|
#define PNG_SUCKS_WITH_SETJMP //cos it does.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//define PARANOID // speed sapping error checking
|
|
|
|
|
2007-08-07 00:30:25 +00:00
|
|
|
#include <float.h>
|
2004-08-23 00:15:46 +00:00
|
|
|
#include <math.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2006-02-11 02:09:43 +00:00
|
|
|
#if defined(AVAIL_PNGLIB) && defined(PNG_SUCKS_WITH_SETJMP) && !defined(SERVERONLY)
|
2011-06-01 13:21:54 +00:00
|
|
|
#if defined(MINGW)
|
|
|
|
#include "./mingw-libs/png.h"
|
|
|
|
#elif defined(_WIN32)
|
|
|
|
#include "png.h"
|
|
|
|
#else
|
|
|
|
#include <png.h>
|
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
#else
|
2013-04-02 05:18:17 +00:00
|
|
|
#ifdef FTE_TARGET_WEB
|
2013-08-21 07:41:33 +00:00
|
|
|
#include "web/ftejslib.h"
|
|
|
|
//officially, emscripten supports longjmp.
|
|
|
|
//unofficially, this makes firefox crash with memory issues.
|
|
|
|
#define setjmp(x) (x=0,x)
|
|
|
|
#define longjmp(b,r) emscriptenfte_abortmainloop(__func__)
|
2013-04-02 05:18:17 +00:00
|
|
|
typedef int jmp_buf;
|
|
|
|
#else
|
|
|
|
#include <setjmp.h>
|
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|
|
|
|
#include <time.h>
|
2017-06-21 01:24:25 +00:00
|
|
|
|
|
|
|
#ifdef USE_MSVCRT_DEBUG
|
2018-05-19 05:07:30 +00:00
|
|
|
#define _CRTDBG_MAP_ALLOC
|
|
|
|
#include <crtdbg.h>
|
2017-06-21 01:24:25 +00:00
|
|
|
#endif
|
|
|
|
#if defined(_WIN32) || defined(__DJGPP__)
|
2018-05-19 05:07:30 +00:00
|
|
|
#include <malloc.h>
|
|
|
|
#elif !defined(alloca) //alloca.h isn't present on bsd (stdlib.h should define it to __builtin_alloca, and we can check for that here).
|
|
|
|
#include <alloca.h>
|
2017-06-21 01:24:25 +00:00
|
|
|
#endif
|
|
|
|
|
2019-02-23 09:29:20 +00:00
|
|
|
#ifdef FTE_TARGET_WEB //emscripten's filesystem is throwing all sorts of exceptions and making it hard to debug real bugs.
|
|
|
|
#define NOSTDIO
|
|
|
|
#endif
|
|
|
|
#ifdef NOSTDIO
|
|
|
|
#define stat stat_nolink
|
|
|
|
#define fopen fopen_nolink
|
|
|
|
#define fread fread_nolink
|
|
|
|
#define fwrite fwrite_nolink
|
|
|
|
#define fclose fclose_nolink
|
|
|
|
#define fseek fseek_nolink
|
|
|
|
#define open open_nolink
|
|
|
|
#define read read_nolink
|
|
|
|
#define write write_nolink
|
|
|
|
#define close close_nolink
|
|
|
|
#endif
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-11-04 10:19:30 +00:00
|
|
|
#include "../common/common.h"
|
|
|
|
#include "../common/bspfile.h"
|
2004-08-23 00:15:46 +00:00
|
|
|
#include "vid.h"
|
2020-11-04 10:19:30 +00:00
|
|
|
#include "../common/sys.h"
|
|
|
|
#include "../common/zone.h"
|
|
|
|
#include "../common/mathlib.h"
|
|
|
|
#include "../common/cvar.h"
|
|
|
|
#include "../common/translate.h"
|
|
|
|
#include "../common/net.h"
|
2018-11-19 06:37:25 +00:00
|
|
|
#ifndef WEBSVONLY
|
2020-11-04 10:19:30 +00:00
|
|
|
#include "../common/protocol.h"
|
|
|
|
#include "../common/cmd.h"
|
|
|
|
#include "../common/console.h"
|
2009-04-01 22:03:56 +00:00
|
|
|
#include "screen.h"
|
2018-09-29 17:31:58 +00:00
|
|
|
#include "wad.h"
|
2004-08-23 00:15:46 +00:00
|
|
|
#include "sbar.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "merged.h"
|
|
|
|
#include "render.h"
|
|
|
|
#include "client.h"
|
2020-11-04 10:19:30 +00:00
|
|
|
#include "../gl/gl_model.h"
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2020-11-04 10:19:30 +00:00
|
|
|
#include "../common/vm.h"
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
#include "input.h"
|
|
|
|
#include "keys.h"
|
|
|
|
#include "view.h"
|
|
|
|
#include "menu.h"
|
2020-11-04 10:19:30 +00:00
|
|
|
#include "../common/crc.h"
|
2004-08-23 00:15:46 +00:00
|
|
|
#include "cdaudio.h"
|
2020-11-04 10:19:30 +00:00
|
|
|
#include "../common/pmove.h"
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2020-11-04 10:19:30 +00:00
|
|
|
#include "../qclib/progtype.h"
|
|
|
|
#include "../server/progdefs.h"
|
|
|
|
#include "../server/progs.h"
|
|
|
|
#include "../common/world.h"
|
|
|
|
#include "../server/q2game.h"
|
2010-11-06 23:11:42 +00:00
|
|
|
#include "../http/iweb.h"
|
2014-03-30 08:55:06 +00:00
|
|
|
#ifdef CLIENTONLY
|
|
|
|
#define SSV_IsSubServer() false
|
|
|
|
#else
|
2020-11-04 10:19:30 +00:00
|
|
|
#include "../server/server.h"
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|
2018-11-19 06:37:25 +00:00
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2020-06-12 23:29:58 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
#define q_max(a,b) ((a) > (b) ? (a) : (b))
|
|
|
|
#define q_min(a,b) ((a) < (b) ? (a) : (b))
|
|
|
|
#else
|
|
|
|
#ifndef max
|
|
|
|
#define max(a,b) ((a) > (b) ? (a) : (b))
|
|
|
|
#define min(a,b) ((a) < (b) ? (a) : (b))
|
|
|
|
#endif
|
|
|
|
#define max3(a,b,c) max(max(a,b),c)
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
|
|
|
//msvcrt lacks any and all c99 support.
|
2016-07-12 00:40:13 +00:00
|
|
|
#if defined(_WIN32)
|
|
|
|
#ifdef __GNUC__
|
|
|
|
#include <inttypes.h>
|
|
|
|
#else
|
|
|
|
#define PRIxPTR "p"
|
|
|
|
//totally different from any other system
|
|
|
|
#define PRIx64 "I64x"
|
|
|
|
#define PRIu64 "I64u"
|
|
|
|
#define PRIi64 "I64i"
|
|
|
|
#endif
|
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
|
|
|
|
|
|
|
#ifdef _WIN64
|
2020-10-26 06:30:35 +00:00
|
|
|
#define PRIxSIZE PRIx64
|
|
|
|
#define PRIuSIZE PRIu64
|
|
|
|
#define PRIiSIZE PRIi64
|
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
|
|
|
#else
|
2016-07-12 00:40:13 +00:00
|
|
|
//don't use I, for the sake of older libcs
|
2016-02-10 23:23:43 +00:00
|
|
|
#define PRIxSIZE "x"
|
|
|
|
#define PRIuSIZE "u"
|
|
|
|
#define PRIiSIZE "i"
|
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
|
|
|
#endif
|
|
|
|
#else
|
2016-02-10 23:23:43 +00:00
|
|
|
#include <inttypes.h>
|
|
|
|
//these are non-standard. c99 would expect people to just use %zx etc
|
2016-07-12 00:40:13 +00:00
|
|
|
#if FTE_WORDSIZE != 32 || __STDC_VERSION__ >= 199901L || defined(__GNUC__)
|
2016-02-10 23:23:43 +00:00
|
|
|
//64bit systems are expected to have an awareness of c99
|
|
|
|
#define PRIxSIZE "zx"
|
|
|
|
#define PRIuSIZE "zu"
|
|
|
|
#define PRIiSIZE "zi"
|
|
|
|
#else
|
|
|
|
//regular old c89 for 32bit platforms.
|
2016-07-12 00:40:13 +00:00
|
|
|
#define PRIxSIZE PRIxPTR
|
|
|
|
#define PRIuSIZE PRIuPTR
|
|
|
|
#define PRIiSIZE PRIiPTR
|
2016-02-10 23:23:43 +00:00
|
|
|
#endif
|
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2006-03-06 01:41:09 +00:00
|
|
|
#ifdef _WIN32
|
2019-12-17 17:41:12 +00:00
|
|
|
#if (_MSC_VER >= 1900)
|
|
|
|
// MSVC 14 has standardized snprintf functions, hurrah!
|
|
|
|
#elif (_MSC_VER >= 1400)
|
|
|
|
//with MSVC 8, use MS extensions. return values are still wrong.
|
2016-07-12 00:40:13 +00:00
|
|
|
#define snprintf linuxlike_snprintf_vc8
|
|
|
|
int VARGS linuxlike_snprintf_vc8(char *buffer, int size, const char *format, ...) LIKEPRINTF(3);
|
|
|
|
#define vsnprintf(a, b, c, d) vsnprintf_s(a, b, _TRUNCATE, c, d)
|
|
|
|
#else
|
2019-12-17 17:41:12 +00:00
|
|
|
//msvc crap. return values are wrong but at least we can null terminate it safely.
|
2016-07-12 00:40:13 +00:00
|
|
|
#define snprintf linuxlike_snprintf
|
|
|
|
int VARGS linuxlike_snprintf(char *buffer, int size, const char *format, ...) LIKEPRINTF(3);
|
|
|
|
#define vsnprintf linuxlike_vsnprintf
|
|
|
|
int VARGS linuxlike_vsnprintf(char *buffer, int size, const char *format, va_list argptr);
|
|
|
|
#endif
|
2006-03-06 03:15:34 +00:00
|
|
|
|
2016-07-12 00:40:13 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
//these are provided so we don't use them
|
|
|
|
//but mingw has some defines elsewhere and makes gcc moan
|
|
|
|
#define _vsnprintf unsafe_vsnprintf
|
|
|
|
#define _snprintf unsafe_snprintf
|
2019-12-17 17:41:12 +00:00
|
|
|
|
|
|
|
#ifndef strcasecmp
|
|
|
|
#define strcasecmp _stricmp
|
|
|
|
#endif
|
|
|
|
#ifndef strncasecmp
|
|
|
|
#define strncasecmp _strnicmp
|
|
|
|
#endif
|
2016-07-12 00:40:13 +00:00
|
|
|
#endif
|
2006-10-05 21:59:43 +00:00
|
|
|
#endif
|
2006-03-06 01:41:09 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
// the host system specifies the base of the directory tree, the
|
|
|
|
// command line parms passed to the program, and the amount of memory
|
|
|
|
// available for the program to use
|
|
|
|
|
|
|
|
typedef struct quakeparms_s
|
|
|
|
{
|
2016-11-20 20:52:41 +00:00
|
|
|
const char *basedir; //working directory
|
|
|
|
const char *binarydir; //exe directory
|
2015-04-14 23:12:17 +00:00
|
|
|
const char *manifest; //linked manifest data (for installer functionality etc)
|
|
|
|
int argc;
|
2009-04-01 22:03:56 +00:00
|
|
|
const char **argv;
|
2004-08-23 00:15:46 +00:00
|
|
|
} quakeparms_t;
|
|
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
#define MAX_NUM_ARGVS 128
|
|
|
|
|
|
|
|
|
|
|
|
extern qboolean noclip_anglehack;
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// host
|
|
|
|
//
|
|
|
|
extern quakeparms_t host_parms;
|
|
|
|
|
2011-07-30 14:14:56 +00:00
|
|
|
extern cvar_t fs_gamename;
|
2020-04-19 01:23:32 +00:00
|
|
|
#ifdef PACKAGEMANAGER
|
2019-06-17 04:21:41 +00:00
|
|
|
extern cvar_t pkg_downloads_url;
|
|
|
|
extern cvar_t pkg_autoupdate;
|
2020-04-19 01:23:32 +00:00
|
|
|
#endif
|
2011-07-30 14:14:56 +00:00
|
|
|
extern cvar_t com_protocolname;
|
2018-01-24 12:13:32 +00:00
|
|
|
extern cvar_t com_protocolversion;
|
2013-05-11 14:02:55 +00:00
|
|
|
extern cvar_t com_nogamedirnativecode;
|
|
|
|
extern cvar_t com_parseutf8;
|
2019-04-16 22:40:05 +00:00
|
|
|
#ifdef HAVE_LEGACY
|
2019-03-01 22:39:30 +00:00
|
|
|
extern cvar_t ezcompat_markup;
|
2018-07-22 11:49:37 +00:00
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
extern cvar_t sys_ticrate;
|
|
|
|
extern cvar_t sys_nostdout;
|
|
|
|
extern cvar_t developer;
|
2020-06-12 23:29:58 +00:00
|
|
|
extern cvar_t host_mapname;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
extern cvar_t password;
|
|
|
|
|
|
|
|
extern qboolean host_initialized; // true if into command execution
|
|
|
|
extern double host_frametime;
|
|
|
|
extern qbyte *host_basepal;
|
2010-08-28 17:14:38 +00:00
|
|
|
extern qbyte *h2playertranslations;
|
2004-08-23 00:15:46 +00:00
|
|
|
extern int host_framecount; // incremented every frame, never reset
|
|
|
|
extern double realtime; // not bounded in any way, changed at
|
|
|
|
// start of every frame, never reset
|
|
|
|
|
|
|
|
void Host_ServerFrame (void);
|
|
|
|
void Host_InitCommands (void);
|
|
|
|
void Host_Init (quakeparms_t *parms);
|
2010-02-06 01:25:04 +00:00
|
|
|
void Host_FinishInit(void);
|
2004-08-23 00:15:46 +00:00
|
|
|
void Host_Shutdown(void);
|
2018-05-21 13:47:53 +00:00
|
|
|
NORETURN void VARGS Host_Error (const char *error, ...) LIKEPRINTF(1);
|
|
|
|
NORETURN void VARGS Host_EndGame (const char *message, ...) LIKEPRINTF(1);
|
2004-08-23 00:15:46 +00:00
|
|
|
qboolean Host_SimulationTime(float time);
|
2011-07-06 01:01:13 +00:00
|
|
|
double Host_Frame (double time);
|
2013-06-23 02:17:02 +00:00
|
|
|
qboolean Host_RunFile(const char *fname, int nlen, vfsfile_t *file);
|
2004-08-23 00:15:46 +00:00
|
|
|
void Host_Quit_f (void);
|
2009-11-04 21:16:50 +00:00
|
|
|
void VARGS Host_ClientCommands (char *fmt, ...) LIKEPRINTF(1);
|
2004-08-23 00:15:46 +00:00
|
|
|
void Host_ShutdownServer (qboolean crash);
|
|
|
|
|
2014-10-05 20:04:11 +00:00
|
|
|
#ifdef LOADERTHREAD
|
2015-09-07 14:42:17 +00:00
|
|
|
extern qboolean com_workererror; //supresses shutdown prints+threads
|
2014-10-05 20:04:11 +00:00
|
|
|
extern cvar_t worker_flush;
|
|
|
|
qboolean COM_DoWork(int thread, qboolean leavelocked);
|
|
|
|
#define COM_MainThreadWork() while (COM_DoWork(0, false) && worker_flush.ival) /*called each frame to do any gl uploads or whatever*/
|
|
|
|
#define COM_MainThreadFlush() while (COM_DoWork(0, false)) /*make sure the main thread has done ALL work pending*/
|
2016-02-15 06:01:17 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
WG_MAIN = 0,
|
|
|
|
WG_LOADER = 1,
|
|
|
|
WG_COUNT = 2 //main and loaders
|
|
|
|
} wgroup_t;
|
2020-04-29 10:43:22 +00:00
|
|
|
void COM_AddWork(wgroup_t thread, void(*func)(void *ctx, void *data, size_t a, size_t b), void *ctx, void *data, size_t a, size_t b); //low priority
|
|
|
|
void COM_InsertWork(wgroup_t tg, void(*func)(void *ctx, void *data, size_t a, size_t b), void *ctx, void *data, size_t a, size_t b); //high priority
|
2014-10-05 20:04:11 +00:00
|
|
|
qboolean COM_HasWork(void);
|
|
|
|
void COM_WorkerFullSync(void);
|
2020-05-14 15:50:26 +00:00
|
|
|
void COM_WorkerLock(void); //callable on main thread to temporarily suspend workers (in a safe location)
|
|
|
|
void COM_WorkerUnlock(void);
|
2014-10-05 20:04:11 +00:00
|
|
|
void COM_DestroyWorkerThread(void);
|
2019-09-25 20:23:24 +00:00
|
|
|
void COM_WorkerPartialSync(void *priorityctx, int *address, int value); //aka: while(*address==value)wait();
|
2018-03-25 09:36:14 +00:00
|
|
|
extern void *com_resourcemutex; //random mutex to simplify resource creation type stuff.
|
2014-10-05 20:04:11 +00:00
|
|
|
void COM_WorkerAbort(char *message); //calls sys_error on the main thread, if running on a worker.
|
|
|
|
#ifdef _DEBUG
|
|
|
|
void COM_AssertMainThread(const char *msg);
|
|
|
|
#else
|
|
|
|
#define COM_AssertMainThread(msg)
|
|
|
|
#endif
|
|
|
|
#else
|
2015-09-07 14:42:17 +00:00
|
|
|
#define com_workererror false
|
2014-10-05 20:04:11 +00:00
|
|
|
#define COM_AddWork(t,f,a,b,c,d) (f)((a),(b),(c),(d))
|
2019-03-12 08:28:19 +00:00
|
|
|
#define COM_InsertWork(t,f,a,b,c,d) (f)((a),(b),(c),(d))
|
2014-10-05 20:04:11 +00:00
|
|
|
#define COM_WorkerPartialSync(c,a,v)
|
|
|
|
#define COM_WorkerFullSync()
|
2020-05-14 15:50:26 +00:00
|
|
|
#define COM_WorkerLock()
|
|
|
|
#define COM_WorkerUnlock()
|
2014-10-05 20:04:11 +00:00
|
|
|
#define COM_HasWork() false
|
|
|
|
#define COM_DoWork(t,l) false
|
|
|
|
#define COM_AssertMainThread(msg)
|
2020-09-29 07:09:01 +00:00
|
|
|
#define COM_MainThreadWork() while(0)
|
2014-10-05 20:04:11 +00:00
|
|
|
#define COM_MainThreadFlush()
|
|
|
|
#define COM_DestroyWorkerThread()
|
|
|
|
#define COM_WorkerAbort(m)
|
|
|
|
#endif
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
extern qboolean msg_suppress_1; // suppresses resolution and cache size console output
|
|
|
|
// an fullscreen DIB focus gain/loss
|
|
|
|
|
2018-12-28 00:04:36 +00:00
|
|
|
#ifndef HAVE_CLIENT
|
|
|
|
#define isDedicated true
|
|
|
|
#elif !defined(HAVE_SERVER)
|
|
|
|
#define isDedicated false
|
|
|
|
#else
|
2004-08-23 00:15:46 +00:00
|
|
|
extern qboolean isDedicated;
|
|
|
|
#endif
|
2015-02-07 22:34:22 +00:00
|
|
|
extern qboolean wantquit; //flagged if we want to force a quit, safely breaking out of any modal stuff
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-12-15 19:15:39 +00:00
|
|
|
#endif //__QUAKEDEF_H__
|