mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-27 06:02:16 +00:00
2e1a70e319
maplist command now generates links. implemented skin objects for q3. added a csqc builtin for it. also supports compositing skins. playing demos inside zips/pk3s/paks should now work. bumped default rate cvar. added cl_transfer to attempt to connect to a new server without disconnecting first. rewrote fog command. alpha and mindist arguments are now supported. fog change also happens over a short time period. added new args to the showpic console command. can now create clickable items for touchscreen/absmouse users. fixed menus to properly support right-aligned text. this finally fixes variable-width fonts. rewrote console tab completion suggestions display. now clickable links. strings obtained from qc are now marked as const. this has required quite a few added consts all over the place. probably crappy attempt at adding joypad support to the sdl port. no idea if it works. changed key bind event code. buttons now track which event they should trigger when released, instead of being the same one the whole time. this allows +forward etc clickable buttons on screen. Also simplified modifier keys - they no longer trigger random events when pressing the modifier key itself. Right modifiers can now be bound separately from left modifiers. Right will use left's binding if not otherwise bound. Bind assumes left if there's no prefix. multiplayer->setup->network menu no longer crashes. added rgb colours to the translation view (but not to the colour-changing keys). added modelviewer command to view models. added menu_mods menu to switch mods in a more friendly way. will be shown by default if multiple manifests exist in the binarydir. clamped classic tracer density. scrag particles no longer look quite so buggy. added ifdefs to facilitate a potential winrt port. the engine should now have no extra dependencies, but still needs system code+audio drivers to be written. if it can't set a renderer, it'll now try to use *every* renderer until it finds one that works. added experimental mapcluster server mode (that console command). New maps will be started up as required. rewrote skeletal blending code a bit. added cylinder geomtypes. fix cfg_save writing to the wrong path bug. VFS_CLOSE now returns a boolean. false means there was some sort of fatal error (either crc when reading was bad, or the write got corrupted or something). Typically ignorable, depends how robust you want to be. win32 tls code now supports running as a server. added connect tls://address support, as well as equivalent sv_addport support. exposed basic model loading api to plugins. d3d11 backend now optionally supports tessellation hlsl. no suitable hlsl provided by default. !!tess to enable. attempted to add gamma ramp support for d3d11. added support for shader blobs to speed up load times. r_shaderblobs 1 to enable. almost vital for d3d11. added vid_srgb cvar. shadowless lights are no longer disabled if shadows are not supported. attempt to add support for touchscreens in win7/8. Wrote gimmicky lua support, using lua instead of ssqc. define VM_LUA to enable. updated saved game code. can again load saved games from vanilla-like engines. changed scale clamping. 0.0001 should no longer appear as 1. changed default mintic from 0.03 to 0.013 to match vanilla qw. I don't know why it was at 0.03. probably a typo. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4623 fc73d0e0-1445-4013-8a0c-d673dee63da5
301 lines
9.1 KiB
C
301 lines
9.1 KiB
C
/*
|
|
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
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
// quakedef.h -- primary header for client
|
|
|
|
#ifndef __QUAKEDEF_H__
|
|
#define __QUAKEDEF_H__
|
|
|
|
#include "bothdefs.h" //first thing included by ALL files.
|
|
|
|
//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
|
|
|
|
#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
|
|
#pragma warning(2:4131) // old-style function declarator
|
|
#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;)
|
|
|
|
#pragma warning(3:4013) // function undefined, assuming extern returning int
|
|
|
|
|
|
#pragma warning( 4 : 4267) //truncation from const double to float
|
|
#pragma warning( 4 : 4710) //function not inlined
|
|
|
|
#pragma warning( error : 4020)
|
|
|
|
#pragma warning(error:4013)
|
|
|
|
//msvc... shut the fuck up.
|
|
#define _CRT_SECURE_NO_DEPRECATE
|
|
#define _CRT_NONSTDC_NO_DEPRECATE
|
|
#endif
|
|
|
|
|
|
|
|
#define QUAKEDEF_H__
|
|
|
|
#ifdef SERVERONLY
|
|
#define isDedicated true
|
|
#endif
|
|
#ifdef CLIENTONLY
|
|
#define isDedicated false
|
|
#endif
|
|
|
|
#ifdef __linux__
|
|
#define PNG_SUCKS_WITH_SETJMP //cos it does.
|
|
#endif
|
|
|
|
#define QUAKE_GAME // as opposed to utilities
|
|
//define PARANOID // speed sapping error checking
|
|
|
|
#include <float.h>
|
|
#include <math.h>
|
|
#include <string.h>
|
|
#include <stdarg.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#if defined(AVAIL_PNGLIB) && defined(PNG_SUCKS_WITH_SETJMP) && !defined(SERVERONLY)
|
|
#if defined(MINGW)
|
|
#include "./mingw-libs/png.h"
|
|
#elif defined(_WIN32)
|
|
#include "png.h"
|
|
#else
|
|
#include <png.h>
|
|
#endif
|
|
#else
|
|
#ifdef FTE_TARGET_WEB
|
|
#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__)
|
|
typedef int jmp_buf;
|
|
#else
|
|
#include <setjmp.h>
|
|
#endif
|
|
#endif
|
|
#include <time.h>
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "translate.h"
|
|
|
|
#include "common.h"
|
|
#include "bspfile.h"
|
|
#include "vid.h"
|
|
#include "sys.h"
|
|
#include "zone.h"
|
|
#include "mathlib.h"
|
|
#include "cvar.h"
|
|
#include "net.h"
|
|
#include "protocol.h"
|
|
#include "cmd.h"
|
|
#include "wad.h"
|
|
#include "screen.h"
|
|
#include "sbar.h"
|
|
#include "sound.h"
|
|
#include "merged.h"
|
|
#include "render.h"
|
|
#include "client.h"
|
|
#include "gl_model.h"
|
|
|
|
#include "vm.h"
|
|
|
|
#include "input.h"
|
|
#include "keys.h"
|
|
#include "console.h"
|
|
#include "view.h"
|
|
#include "menu.h"
|
|
#include "crc.h"
|
|
#include "cdaudio.h"
|
|
#include "pmove.h"
|
|
|
|
#include "progtype.h"
|
|
#include "progdefs.h"
|
|
#ifndef CLIENTONLY
|
|
#include "progs.h"
|
|
#endif
|
|
#include "world.h"
|
|
#include "q2game.h"
|
|
#include "../http/iweb.h"
|
|
#ifdef CLIENTONLY
|
|
#define SSV_IsSubServer() false
|
|
#else
|
|
#include "server.h"
|
|
#endif
|
|
|
|
#ifndef max
|
|
#define max(a,b) ((a) > (b) ? (a) : (b))
|
|
#define min(a,b) ((a) < (b) ? (a) : (b))
|
|
#endif
|
|
|
|
#ifdef USE_MSVCRT_DEBUG
|
|
#define _CRTDBG_MAP_ALLOC
|
|
#include <crtdbg.h>
|
|
#endif
|
|
|
|
#ifdef _WIN32
|
|
#if (_MSC_VER >= 1400)
|
|
//with MSVC 8, use MS extensions
|
|
#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
|
|
//msvc crap
|
|
#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
|
|
|
|
#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
|
|
#endif
|
|
#endif
|
|
|
|
//=============================================================================
|
|
|
|
// 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
|
|
{
|
|
char *basedir; //working directory
|
|
char *binarydir; //exe directory
|
|
int argc;
|
|
const char **argv;
|
|
} quakeparms_t;
|
|
|
|
|
|
//=============================================================================
|
|
|
|
#define MAX_NUM_ARGVS 128
|
|
|
|
|
|
extern qboolean noclip_anglehack;
|
|
|
|
|
|
//
|
|
// host
|
|
//
|
|
extern quakeparms_t host_parms;
|
|
|
|
extern cvar_t fs_gamename;
|
|
extern cvar_t fs_gamemanifest;
|
|
extern cvar_t com_protocolname;
|
|
extern cvar_t com_modname;
|
|
extern cvar_t com_nogamedirnativecode;
|
|
extern cvar_t com_parseutf8;
|
|
extern cvar_t sys_ticrate;
|
|
extern cvar_t sys_nostdout;
|
|
extern cvar_t developer;
|
|
|
|
extern cvar_t password;
|
|
|
|
extern qboolean host_initialized; // true if into command execution
|
|
extern double host_frametime;
|
|
extern qbyte *host_basepal;
|
|
extern qbyte *h2playertranslations;
|
|
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);
|
|
void Host_FinishInit(void);
|
|
void Host_Shutdown(void);
|
|
NORETURN void VARGS Host_Error (char *error, ...) LIKEPRINTF(1);
|
|
NORETURN void VARGS Host_EndGame (char *message, ...) LIKEPRINTF(1);
|
|
qboolean Host_SimulationTime(float time);
|
|
double Host_Frame (double time);
|
|
qboolean Host_RunFile(const char *fname, int nlen, vfsfile_t *file);
|
|
void Host_Quit_f (void);
|
|
void VARGS Host_ClientCommands (char *fmt, ...) LIKEPRINTF(1);
|
|
void Host_ShutdownServer (qboolean crash);
|
|
|
|
extern qboolean msg_suppress_1; // suppresses resolution and cache size console output
|
|
// an fullscreen DIB focus gain/loss
|
|
|
|
|
|
#if !defined(SERVERONLY) && !defined(CLIENTONLY)
|
|
extern qboolean isDedicated;
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif //__QUAKEDEF_H__
|