Browse Source

Merge branch 'master' into hltopdown

hltopdown
Andrey Akhmichin 4 years ago
parent
commit
6b4c45ae23
  1. 2
      cl_dll/GameStudioModelRenderer.cpp
  2. 2
      cl_dll/GameStudioModelRenderer_Sample.cpp
  3. 2
      cl_dll/StudioModelRenderer.cpp
  4. 9
      cl_dll/cl_dll.h
  5. 1
      cl_dll/demo.cpp
  6. 2
      cl_dll/entity.cpp
  7. 2
      cl_dll/ev_hldm.cpp
  8. 1
      cl_dll/hl/hl_baseentity.cpp
  9. 4
      cl_dll/hud_iface.h
  10. 6
      cl_dll/hud_spectator.cpp
  11. 1
      cl_dll/hud_update.cpp
  12. 1
      cl_dll/studio_util.cpp
  13. 4
      cl_dll/text_message.cpp
  14. 4
      cl_dll/util.cpp
  15. 5
      cl_dll/util_vector.h
  16. 16
      cl_dll/wrect.h
  17. 98
      cl_dll/wscript
  18. 246
      common/bspfile.h
  19. 411
      common/com_model.h
  20. 49
      common/gameinfo.h
  21. 29
      common/lightstyle.h
  22. 4
      common/mathlib.h
  23. 261
      common/render_api.h
  24. 24
      common/wrect.h
  25. 16
      dlls/animation.cpp
  26. 8
      dlls/bigmomma.cpp
  27. 5
      dlls/bullsquid.cpp
  28. 1
      dlls/cbase.h
  29. 5
      dlls/crossbow.cpp
  30. 6
      dlls/extdll.h
  31. 8
      dlls/game.cpp
  32. 2
      dlls/game.h
  33. 12
      dlls/gauss.cpp
  34. 5
      dlls/h_export.cpp
  35. 8
      dlls/houndeye.cpp
  36. 5
      dlls/monsters.cpp
  37. 7
      dlls/nodes.cpp
  38. 33
      dlls/physcallback.h
  39. 2
      dlls/util.cpp
  40. 4
      dlls/util.h
  41. 110
      dlls/world.cpp
  42. 133
      dlls/wscript
  43. 70
      engine/cdll_exp.h
  44. 2
      engine/custom.h
  45. 188
      engine/menu_int.h
  46. 114
      engine/physint.h
  47. 53
      engine/warpsin.h
  48. 12
      public/build.h
  49. 12
      scripts/waifulib/library_naming.py
  50. 18
      wscript

2
cl_dll/GameStudioModelRenderer.cpp

@ -18,8 +18,6 @@ @@ -18,8 +18,6 @@
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <cmath>
#include "studio_util.h"
#include "r_studioint.h"

2
cl_dll/GameStudioModelRenderer_Sample.cpp

@ -18,8 +18,6 @@ @@ -18,8 +18,6 @@
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <cmath>
#include "studio_util.h"
#include "r_studioint.h"

2
cl_dll/StudioModelRenderer.cpp

@ -20,8 +20,6 @@ @@ -20,8 +20,6 @@
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <cmath>
#include "studio_util.h"
#include "r_studioint.h"

9
cl_dll/cl_dll.h

@ -31,7 +31,8 @@ @@ -31,7 +31,8 @@
typedef unsigned char byte;
typedef unsigned short word;
typedef float vec_t;
typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf );
// redefine
//typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf );
#include "util_vector.h"
@ -43,7 +44,11 @@ typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf ); @@ -43,7 +44,11 @@ typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf );
#endif
#include "exportdef.h"
#include <string.h>
#if HAVE_CMATH
#include <cmath>
#else
#include <math.h>
#endif
#if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
#define XASH_64BIT
#endif

1
cl_dll/demo.cpp

@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
#include "cl_util.h"
#include "demo.h"
#include "demo_api.h"
#include <memory.h>
int g_demosniper = 0;
int g_demosniperdamage = 0;

2
cl_dll/entity.cpp

@ -7,8 +7,6 @@ @@ -7,8 +7,6 @@
// Client side entity management functions
#include <memory.h>
#include "hud.h"
#include "cl_util.h"
#include "const.h"

2
cl_dll/ev_hldm.cpp

@ -815,6 +815,7 @@ void EV_FirePython( event_args_t *args ) @@ -815,6 +815,7 @@ void EV_FirePython( event_args_t *args )
//======================
// GAUSS START
//======================
#define SND_STOP (1 << 5)
#define SND_CHANGE_PITCH (1 << 7) // duplicated in protocol.h change sound pitch
void EV_SpinGauss( event_args_t *args )
@ -835,6 +836,7 @@ void EV_SpinGauss( event_args_t *args ) @@ -835,6 +836,7 @@ void EV_SpinGauss( event_args_t *args )
pitch = args->iparam1;
iSoundState = args->bparam1 ? SND_CHANGE_PITCH : 0;
iSoundState = args->bparam2 ? SND_STOP : iSoundState;
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "ambience/pulsemachine.wav", 1.0, ATTN_NORM, iSoundState, pitch );
}

1
cl_dll/hl/hl_baseentity.cpp

@ -347,3 +347,4 @@ int CBasePlayerWeapon::ExtractClipAmmo( CBasePlayerWeapon *pWeapon ) { return 0; @@ -347,3 +347,4 @@ int CBasePlayerWeapon::ExtractClipAmmo( CBasePlayerWeapon *pWeapon ) { return 0;
void CBasePlayerWeapon::RetireWeapon( void ) { }
void CSoundEnt::InsertSound( int iType, const Vector &vecOrigin, int iVolume, float flDuration ) {}
void RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType ){}
void CSprite::AnimateUntilDead( void ) {}

4
cl_dll/hud_iface.h

@ -10,8 +10,8 @@ @@ -10,8 +10,8 @@
#define HUD_IFACEH
#include "exportdef.h"
typedef int (*pfnUserMsgHook)( const char *pszName, int iSize, void *pbuf );
// redefine
// typedef int (*pfnUserMsgHook)( const char *pszName, int iSize, void *pbuf );
#include "wrect.h"
#include "../engine/cdll_int.h"
extern cl_enginefunc_t gEngfuncs;

6
cl_dll/hud_spectator.cpp

@ -825,7 +825,7 @@ bool CHudSpectator::ParseOverviewFile() @@ -825,7 +825,7 @@ bool CHudSpectator::ParseOverviewFile()
char token[1024] = { 0 };
float height;
char *pfile = NULL;
char *afile = NULL, *pfile = NULL;
memset( &m_OverviewData, 0, sizeof(m_OverviewData) );
@ -850,7 +850,7 @@ bool CHudSpectator::ParseOverviewFile() @@ -850,7 +850,7 @@ bool CHudSpectator::ParseOverviewFile()
sprintf( filename, "overviews/%s.txt", levelname );
pfile = (char *)gEngfuncs.COM_LoadFile( filename, 5, NULL );
afile = pfile = (char *)gEngfuncs.COM_LoadFile( filename, 5, NULL );
if( !pfile )
{
@ -963,7 +963,7 @@ bool CHudSpectator::ParseOverviewFile() @@ -963,7 +963,7 @@ bool CHudSpectator::ParseOverviewFile()
}
}
gEngfuncs.COM_FreeFile( pfile );
gEngfuncs.COM_FreeFile( afile );
m_mapZoom = m_OverviewData.zoom;
m_mapOrigin = m_OverviewData.origin;

1
cl_dll/hud_update.cpp

@ -20,7 +20,6 @@ @@ -20,7 +20,6 @@
#include "hud.h"
#include "cl_util.h"
#include <stdlib.h>
#include <memory.h>
int CL_ButtonBits( int );
void CL_ResetButtonBits( int bits );

1
cl_dll/studio_util.cpp

@ -5,7 +5,6 @@ @@ -5,7 +5,6 @@
// $NoKeywords: $
//=============================================================================
#include <memory.h>
#include "hud.h"
#include "cl_util.h"
#include "const.h"

4
cl_dll/text_message.cpp

@ -182,19 +182,23 @@ int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf @@ -182,19 +182,23 @@ int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf
{
case HUD_PRINTCENTER:
_snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
psz[MSG_BUF_SIZE - 1] = '\0';
CenterPrint( ConvertCRtoNL( psz ) );
break;
case HUD_PRINTNOTIFY:
psz[0] = 1; // mark this message to go into the notify buffer
_snprintf( psz + 1, MSG_BUF_SIZE - 1, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
psz[MSG_BUF_SIZE - 2] = '\0';
ConsolePrint( ConvertCRtoNL( psz ) );
break;
case HUD_PRINTTALK:
_snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
psz[MSG_BUF_SIZE - 1] = '\0';
gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), MSG_BUF_SIZE );
break;
case HUD_PRINTCONSOLE:
_snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
psz[MSG_BUF_SIZE - 1] = '\0';
ConsolePrint( ConvertCRtoNL( psz ) );
break;
}

4
cl_dll/util.cpp

@ -33,10 +33,10 @@ @@ -33,10 +33,10 @@
#ifndef M_PI_F
#define M_PI_F (float)M_PI
#endif
extern vec3_t vec3_origin;
#ifdef _MSC_VER
// if C++ mangling differs from C symbol name
#if defined _MSC_VER || defined __WATCOMC__
vec3_t vec3_origin;
#endif

5
cl_dll/util_vector.h

@ -22,8 +22,11 @@ @@ -22,8 +22,11 @@
// Misc C-runtime library headers
#include <stdio.h>
#include <stdlib.h>
#if HAVE_CMATH
#include <cmath>
#else
#include <math.h>
#endif
// Header file containing definition of globalvars_t and entvars_t
typedef unsigned int func_t; //
typedef int string_t; // from engine's pr_comp.h;

16
cl_dll/wrect.h

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#pragma once
#if !defined( WRECTH )
#define WRECTH
typedef struct rect_s
{
int left, right, top, bottom;
} wrect_t;
#endif

98
cl_dll/wscript

@ -14,33 +14,88 @@ def configure(conf): @@ -14,33 +14,88 @@ def configure(conf):
conf.check_cc(lib='dl')
if conf.env.DEST_OS == 'win32':
conf.check_cxx( lib='user32' )
conf.check_cxx(lib='user32')
def build(bld):
source = bld.path.parent.ant_glob([
'pm_shared/*.c',
'dlls/crossbow.cpp', 'dlls/crowbar.cpp', 'dlls/egon.cpp', 'dlls/gauss.cpp', 'dlls/handgrenade.cpp',
'dlls/hornetgun.cpp', 'dlls/mp5.cpp', 'dlls/python.cpp', 'dlls/rpg.cpp', 'dlls/satchel.cpp',
'dlls/shotgun.cpp', 'dlls/squeakgrenade.cpp', 'dlls/tripmine.cpp', 'dlls/glock.cpp'
'pm_shared/*.c'
])
source += bld.path.ant_glob([
'hl/*.cpp'
])
source += bld.path.ant_glob([
'dlls/crossbow.cpp',
'dlls/crowbar.cpp',
'dlls/egon.cpp',
'dlls/gauss.cpp',
'dlls/glock.cpp',
'dlls/handgrenade.cpp',
'dlls/hornetgun.cpp',
'dlls/mp5.cpp',
'dlls/python.cpp',
'dlls/rpg.cpp',
'dlls/satchel.cpp',
'dlls/shotgun.cpp',
'dlls/squeakgrenade.cpp',
'dlls/tripmine.cpp'
])
source += bld.path.ant_glob(['hl/*.cpp'])
source += [
'ev_hldm.cpp', 'ammo.cpp', 'ammo_secondary.cpp', 'ammohistory.cpp',
'battery.cpp', 'cdll_int.cpp', 'com_weapons.cpp', 'death.cpp',
'demo.cpp', 'entity.cpp', 'ev_common.cpp', 'events.cpp',
'flashlight.cpp', 'GameStudioModelRenderer.cpp', 'geiger.cpp',
'health.cpp', 'hud.cpp', 'hud_msg.cpp', 'hud_redraw.cpp',
'hud_spectator.cpp', 'hud_update.cpp', 'in_camera.cpp',
'input.cpp', 'input_goldsource.cpp', 'input_mouse.cpp',
'input_xash3d.cpp', 'menu.cpp', 'message.cpp',
'overview.cpp', 'parsemsg.cpp', 'saytext.cpp',
'status_icons.cpp', 'statusbar.cpp', 'studio_util.cpp',
'StudioModelRenderer.cpp', 'text_message.cpp', 'train.cpp',
'tri.cpp', 'util.cpp', 'view.cpp', 'scoreboard.cpp', 'MOTD.cpp'
'GameStudioModelRenderer.cpp',
'MOTD.cpp',
'StudioModelRenderer.cpp',
'ammo.cpp',
'ammo_secondary.cpp',
'ammohistory.cpp',
'battery.cpp',
'cdll_int.cpp',
'com_weapons.cpp',
'death.cpp',
'demo.cpp',
'entity.cpp',
'ev_hldm.cpp',
'ev_common.cpp',
'events.cpp',
'flashlight.cpp',
'geiger.cpp',
'health.cpp',
'hud.cpp',
'hud_msg.cpp',
'hud_redraw.cpp',
'hud_spectator.cpp',
'hud_update.cpp',
'in_camera.cpp',
'input.cpp',
'input_goldsource.cpp',
'input_mouse.cpp',
'input_xash3d.cpp',
'menu.cpp',
'message.cpp',
'overview.cpp',
'parsemsg.cpp',
'saytext.cpp',
'scoreboard.cpp',
'status_icons.cpp',
'statusbar.cpp',
'studio_util.cpp',
'text_message.cpp',
'train.cpp',
'tri.cpp',
'util.cpp',
'view.cpp'
]
includes = Utils.to_list('. hl/ ../dlls ../dlls/wpn_shared ../common ../engine ../pm_shared ../game_shared ../public ../utils/false_vgui/include')
includes = [
'.',
'hl/',
'../dlls',
'../dlls/wpn_shared',
'../common',
'../engine',
'../pm_shared',
'../game_shared',
'../public',
'../utils/false_vgui/include'
]
defines = ['CLIENT_DLL']
if bld.env.GOLDSRC:
@ -53,7 +108,7 @@ def build(bld): @@ -53,7 +108,7 @@ def build(bld):
if bld.env.DEST_OS == 'win32':
libs += ["USER32"]
if bld.env.DEST_OS not in ['android']:
if bld.env.DEST_OS not in ['android', 'dos']:
install_path = os.path.join(bld.env.GAMEDIR, bld.env.CLIENT_DIR)
else:
install_path = bld.env.PREFIX
@ -61,6 +116,7 @@ def build(bld): @@ -61,6 +116,7 @@ def build(bld):
bld.shlib(
source = source,
target = 'client' + bld.env.POSTFIX,
name = 'client',
features = 'c cxx',
includes = includes,
defines = defines,

246
common/bspfile.h

@ -1,246 +0,0 @@ @@ -1,246 +0,0 @@
/*
bspfile.h - BSP format included q1, hl1 support
Copyright (C) 2010 Uncle Mike
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#pragma once
#ifndef BSPFILE_H
#define BSPFILE_H
/*
==============================================================================
BRUSH MODELS
.bsp contain level static geometry with including PVS and lightning info
==============================================================================
*/
// header
#define Q1BSP_VERSION 29 // quake1 regular version (beta is 28)
#define HLBSP_VERSION 30 // half-life regular version
#define XTBSP_VERSION 31 // extended lightmaps and expanded clipnodes limit
#define IDEXTRAHEADER (('H'<<24)+('S'<<16)+('A'<<8)+'X') // little-endian "XASH"
#define EXTRA_VERSION 2 // because version 1 was occupied by old versions of XashXT
#define DELUXEMAP_VERSION 1
#define IDDELUXEMAPHEADER (('T'<<24)+('I'<<16)+('L'<<8)+'Q') // little-endian "QLIT"
// worldcraft predefined angles
#define ANGLE_UP -1
#define ANGLE_DOWN -2
// bmodel limits
#define MAX_MAP_HULLS 4 // MAX_HULLS
#define SURF_NOCULL BIT( 0 ) // two-sided polygon (e.g. 'water4b')
#define SURF_PLANEBACK BIT( 1 ) // plane should be negated
#define SURF_DRAWSKY BIT( 2 ) // sky surface
#define SURF_WATERCSG BIT( 3 ) // culled by csg (was SURF_DRAWSPRITE)
#define SURF_DRAWTURB BIT( 4 ) // warp surface
#define SURF_DRAWTILED BIT( 5 ) // face without lighmap
#define SURF_CONVEYOR BIT( 6 ) // scrolled texture (was SURF_DRAWBACKGROUND)
#define SURF_UNDERWATER BIT( 7 ) // caustics
#define SURF_TRANSPARENT BIT( 8 ) // it's a transparent texture (was SURF_DONTWARP)
#define SURF_REFLECT BIT( 31 ) // reflect surface (mirror)
// lightstyle management
#define LM_STYLES 4 // MAXLIGHTMAPS
#define LS_NORMAL 0x00
#define LS_UNUSED 0xFE
#define LS_NONE 0xFF
#define MAX_MAP_MODELS 1024 // can be increased up to 2048 if needed
#define MAX_MAP_BRUSHES 32768 // unsigned short limit
#define MAX_MAP_ENTITIES 8192 // can be increased up to 32768 if needed
#define MAX_MAP_ENTSTRING 0x80000 // 512 kB should be enough
#define MAX_MAP_PLANES 65536 // can be increased without problems
#define MAX_MAP_NODES 32767 // because negative shorts are leafs
#define MAX_MAP_CLIPNODES 32767 // because negative shorts are contents
#define MAX_MAP_LEAFS 32767 // signed short limit
#define MAX_MAP_VERTS 65535 // unsigned short limit
#define MAX_MAP_FACES 65535 // unsigned short limit
#define MAX_MAP_MARKSURFACES 65535 // unsigned short limit
#define MAX_MAP_TEXINFO MAX_MAP_FACES // in theory each face may have personal texinfo
#define MAX_MAP_EDGES 0x100000 // can be increased but not needed
#define MAX_MAP_SURFEDGES 0x200000 // can be increased but not needed
#define MAX_MAP_TEXTURES 2048 // can be increased but not needed
#define MAX_MAP_MIPTEX 0x2000000 // 32 Mb internal textures data
#define MAX_MAP_LIGHTING 0x2000000 // 32 Mb lightmap raw data (can contain deluxemaps)
#define MAX_MAP_VISIBILITY 0x800000 // 8 Mb visdata
// quake lump ordering
#define LUMP_ENTITIES 0
#define LUMP_PLANES 1
#define LUMP_TEXTURES 2 // internal textures
#define LUMP_VERTEXES 3
#define LUMP_VISIBILITY 4
#define LUMP_NODES 5
#define LUMP_TEXINFO 6
#define LUMP_FACES 7
#define LUMP_LIGHTING 8
#define LUMP_CLIPNODES 9
#define LUMP_LEAFS 10
#define LUMP_MARKSURFACES 11
#define LUMP_EDGES 12
#define LUMP_SURFEDGES 13
#define LUMP_MODELS 14 // internal submodels
#define HEADER_LUMPS 15
// version 31
#define LUMP_CLIPNODES2 15 // hull0 goes into LUMP_NODES, hull1 goes into LUMP_CLIPNODES,
#define LUMP_CLIPNODES3 16 // hull2 goes into LUMP_CLIPNODES2, hull3 goes into LUMP_CLIPNODES3
#define HEADER_LUMPS_31 17
#define LUMP_FACES_EXTRADATA 0 // extension of dface_t
#define LUMP_VERTS_EXTRADATA 1 // extension of dvertex_t
#define LUMP_CUBEMAPS 2 // cubemap description
#define EXTRA_LUMPS 8 // g-cont. just for future expansions
// texture flags
#define TEX_SPECIAL BIT( 0 ) // sky or slime, no lightmap or 256 subdivision
// ambient sound types
enum
{
AMBIENT_WATER = 0, // waterfall
AMBIENT_SKY, // wind
AMBIENT_SLIME, // never used in quake
AMBIENT_LAVA, // never used in quake
NUM_AMBIENTS // automatic ambient sounds
};
//
// BSP File Structures
//
typedef struct
{
int fileofs;
int filelen;
} dlump_t;
typedef struct
{
int version;
dlump_t lumps[HEADER_LUMPS];
} dheader_t;
typedef struct
{
int version;
dlump_t lumps[HEADER_LUMPS_31];
} dheader31_t;
typedef struct
{
int id; // must be little endian XASH
int version;
dlump_t lumps[EXTRA_LUMPS];
} dextrahdr_t;
typedef struct
{
vec3_t mins;
vec3_t maxs;
vec3_t origin; // for sounds or lights
int headnode[MAX_MAP_HULLS];
int visleafs; // not including the solid leaf 0
int firstface;
int numfaces;
} dmodel_t;
typedef struct
{
int nummiptex;
int dataofs[4]; // [nummiptex]
} dmiptexlump_t;
typedef struct
{
vec3_t point;
} dvertex_t;
typedef struct
{
vec3_t normal;
float dist;
int type; // PLANE_X - PLANE_ANYZ ?
} dplane_t;
typedef struct
{
int planenum;
short children[2]; // negative numbers are -(leafs + 1), not nodes
short mins[3]; // for sphere culling
short maxs[3];
word firstface;
word numfaces; // counting both sides
} dnode_t;
// leaf 0 is the generic CONTENTS_SOLID leaf, used for all solid areas
// all other leafs need visibility info
typedef struct
{
int contents;
int visofs; // -1 = no visibility info
short mins[3]; // for frustum culling
short maxs[3];
word firstmarksurface;
word nummarksurfaces;
// automatic ambient sounds
byte ambient_level[NUM_AMBIENTS]; // ambient sound level (0 - 255)
} dleaf_t;
typedef struct
{
int planenum;
short children[2]; // negative numbers are contents
} dclipnode_t;
typedef struct
{
float vecs[2][4]; // texmatrix [s/t][xyz offset]
int miptex;
int flags;
} dtexinfo_t;
typedef word dmarkface_t; // leaf marksurfaces indexes
typedef int dsurfedge_t; // map surfedges
// NOTE: that edge 0 is never used, because negative edge nums
// are used for counterclockwise use of the edge in a face
typedef struct
{
word v[2]; // vertex numbers
} dedge_t;
typedef struct
{
word planenum;
short side;
int firstedge; // we must support > 64k edges
short numedges;
short texinfo;
// lighting info
byte styles[LM_STYLES];
int lightofs; // start of [numstyles*surfsize] samples
} dface_t;
#endif//BSPFILE_H

411
common/com_model.h

@ -1,59 +1,78 @@ @@ -1,59 +1,78 @@
/*
com_model.h - cient model structures
Copyright (C) 2010 Uncle Mike
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
// com_model.h
#pragma once
#ifndef COM_MODEL_H
#if !defined( COM_MODEL_H )
#define COM_MODEL_H
#include "bspfile.h" // we need some declarations from it
#define STUDIO_RENDER 1
#define STUDIO_EVENTS 2
typedef vec_t vec2_t[2];
typedef vec_t vec4_t[4];
#define MAX_CLIENTS 32
#define MAX_EDICTS 900
/*
==============================================================================
#define MAX_MODEL_NAME 64
#define MAX_MAP_HULLS 4
#define MIPLEVELS 4
#define NUM_AMBIENTS 4 // automatic ambient sounds
#define MAXLIGHTMAPS 4
#define PLANE_ANYZ 5
ENGINE MODEL FORMAT
==============================================================================
*/
#define STUDIO_RENDER 1
#define STUDIO_EVENTS 2
#define ALIAS_Z_CLIP_PLANE 5
#define ZISCALE ((float)0x8000)
// flags in finalvert_t.flags
#define ALIAS_LEFT_CLIP 0x0001
#define ALIAS_TOP_CLIP 0x0002
#define ALIAS_RIGHT_CLIP 0x0004
#define ALIAS_BOTTOM_CLIP 0x0008
#define ALIAS_Z_CLIP 0x0010
#define ALIAS_ONSEAM 0x0020
#define ALIAS_XY_CLIP_MASK 0x000F
#define MIPLEVELS 4
#define VERTEXSIZE 7
#define MAXLIGHTMAPS 4
#define NUM_AMBIENTS 4 // automatic ambient sounds
#define ZISCALE ((float)0x8000)
// model types
typedef enum
{
mod_bad = -1,
mod_brush,
mod_sprite,
mod_alias,
mod_studio
} modtype_t;
// must match definition in modelgen.h
#ifndef SYNCTYPE_T
#define SYNCTYPE_T
typedef enum
{
ST_SYNC=0,
ST_RAND
} synctype_t;
#endif
typedef struct
{
float mins[3], maxs[3];
float origin[3];
int headnode[MAX_MAP_HULLS];
int visleafs; // not including the solid leaf 0
int firstface, numfaces;
} dmodel_t;
// plane_t structure
typedef struct mplane_s
{
vec3_t normal;
float dist;
byte type; // for fast side tests
byte signbits; // signx + (signy<<1) + (signz<<1)
byte pad[2];
vec3_t normal; // surface normal
float dist; // closest appoach to origin
byte type; // for texture axis selection and fast side tests
byte signbits; // signx + signy<<1 + signz<<1
byte pad[2];
} mplane_t;
typedef struct
@ -70,292 +89,246 @@ typedef struct @@ -70,292 +89,246 @@ typedef struct
typedef struct texture_s
{
char name[16];
unsigned int width, height;
int gl_texturenum;
struct msurface_s *texturechain; // for gl_texsort drawing
int anim_total; // total tenths in sequence ( 0 = no)
int anim_min, anim_max; // time for this frame min <=time< max
struct texture_s *anim_next; // in the animation sequence
struct texture_s *alternate_anims; // bmodels in frame 1 use these
unsigned short fb_texturenum; // auto-luma texturenum
unsigned short dt_texturenum; // detail-texture binding
unsigned int unused[3]; // reserved
unsigned width, height;
int anim_total; // total tenths in sequence ( 0 = no)
int anim_min, anim_max; // time for this frame min <=time< max
struct texture_s *anim_next; // in the animation sequence
struct texture_s *alternate_anims; // bmodels in frame 1 use these
unsigned offsets[MIPLEVELS]; // four mip maps stored
unsigned paloffset;
} texture_t;
typedef struct
{
float vecs[2][4]; // [s/t] unit vectors in world space.
// [i][3] is the s/t offset relative to the origin.
// s or t = dot( 3Dpoint, vecs[i] ) + vecs[i][3]
float mipadjust; // mipmap limits for very small surfaces
texture_t *texture;
int flags; // sky or slime, no lightmap or 256 subdivision
float vecs[2][4]; // [s/t] unit vectors in world space.
// [i][3] is the s/t offset relative to the origin.
// s or t = dot(3Dpoint,vecs[i])+vecs[i][3]
float mipadjust; // ?? mipmap limits for very small surfaces
texture_t *texture;
int flags; // sky or slime, no lightmap or 256 subdivision
} mtexinfo_t;
// 73 bytes per VBO vertex
// FIXME: align to 32 bytes
typedef struct glvert_s
{
vec3_t vertex; // position
vec3_t normal; // normal
vec2_t stcoord; // ST texture coords
vec2_t lmcoord; // ST lightmap coords
vec2_t sccoord; // ST scissor coords (decals only) - for normalmap coords migration
vec3_t tangent; // tangent
vec3_t binormal; // binormal
byte color[4]; // colors per vertex
} glvert_t;
typedef struct glpoly_s
{
struct glpoly_s *next;
struct glpoly_s *chain;
int numverts;
int flags; // for SURF_UNDERWATER
float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
} glpoly_t;
typedef struct mnode_s
{
// common with leaf
int contents; // 0, to differentiate from leafs
int visframe; // node needs to be traversed if current
int contents; // 0, to differentiate from leafs
int visframe; // node needs to be traversed if current
short minmaxs[6]; // for bounding box culling
float minmaxs[6]; // for bounding box culling
struct mnode_s *parent;
// node specific
mplane_t *plane;
mplane_t *plane;
struct mnode_s *children[2];
unsigned short firstsurface;
unsigned short numsurfaces;
unsigned short firstsurface;
unsigned short numsurfaces;
} mnode_t;
typedef struct msurface_s msurface_t;
typedef struct decal_s decal_t;
typedef struct decal_s decal_t;
// JAY: Compress this as much as possible
struct decal_s
{
decal_t *pnext; // linked list for each surface
msurface_t *psurface; // Surface id for persistence / unlinking
float dx; // local texture coordinates
float dy; //
float scale; // Pixel scale
decal_t *pnext; // linked list for each surface
msurface_t *psurface; // Surface id for persistence / unlinking
short dx; // Offsets into surface texture (in texture coordinates, so we don't need floats)
short dy;
short texture; // Decal texture
byte flags; // Decal flags FDECAL_*
byte scale; // Pixel scale
byte flags; // Decal flags
short entityIndex; // Entity this is attached to
// Xash3D added
vec3_t position; // location of the decal center in world space.
vec3_t saxis; // direction of the s axis in world space
struct msurfmesh_s *mesh; // decal mesh in local space
int reserved[4]; // for future expansions
};
typedef struct mleaf_s
{
// common with node
int contents;
int visframe; // node needs to be traversed if current
int contents; // wil be a negative contents number
int visframe; // node needs to be traversed if current
float minmaxs[6]; // for bounding box culling
short minmaxs[6]; // for bounding box culling
struct mnode_s *parent;
// leaf specific
byte *compressed_vis;
struct efrag_s *efrags;
msurface_t **firstmarksurface;
int nummarksurfaces;
byte *compressed_pas;
int nummarksurfaces;
int key; // BSP sequence number for leaf's contents
byte ambient_sound_level[NUM_AMBIENTS];
} mleaf_t;
struct msurface_s
{
int visframe; // should be drawn when node is crossed
int visframe; // should be drawn when node is crossed
mplane_t *plane; // pointer to shared plane
int flags; // see SURF_ #defines
int dlightframe; // last frame the surface was checked by an animated light
int dlightbits; // dynamically generated. Indicates if the surface illumination
// is modified by an animated light.
int firstedge; // look up in model->surfedges[], negative numbers
int numedges; // are backwards edges
mplane_t *plane; // pointer to shared plane
int flags; // see SURF_ #defines
short texturemins[2];
short extents[2];
int firstedge; // look up in model->surfedges[], negative numbers
int numedges; // are backwards edges
int light_s, light_t; // gl lightmap coordinates
// surface generation data
struct surfcache_s *cachespots[MIPLEVELS];
glpoly_t *polys; // multiple if warped
struct msurface_s *texturechain;
short texturemins[2]; // smallest s/t position on the surface.
short extents[2]; // ?? s/t texture size, 1..256 for all non-sky surfaces
mtexinfo_t *texinfo;
// lighting info
int dlightframe; // last frame the surface was checked by an animated light
int dlightbits; // dynamically generated. Indicates if the surface illumination
// is modified by an animated light.
int lightmaptexturenum;
byte styles[MAXLIGHTMAPS];
int cached_light[MAXLIGHTMAPS]; // values currently used in lightmap
struct msurface_s *lightmapchain; // for new dlights rendering (was cached_dlight)
// lighting info
byte styles[MAXLIGHTMAPS]; // index into d_lightstylevalue[] for animated lights
// no one surface can be effected by more than 4
// animated lights.
color24 *samples;
color24 *samples; // note: this is the actual lightmap data for this surface
decal_t *pdecals;
};
typedef struct msurfmesh_s
{
unsigned short numVerts;
unsigned short numElems; // ~ 20 000 vertex per one surface. Should be enough
unsigned int startVert; // user-variable. may be used for construct world single-VBO
unsigned int startElem; // user-variable. may be used for construct world single-VBO
glvert_t *verts; // vertexes array
unsigned short *elems; // indices
struct msurface_s *surf; // pointer to parent surface. Just for consistency
struct msurfmesh_s *next; // temporary chain of subdivided surfaces
} msurfmesh_t;
// surface extradata stored in cache.data for all brushmodels
typedef struct mextrasurf_s
typedef struct
{
vec3_t mins, maxs;
vec3_t origin; // surface origin
msurfmesh_t *mesh; // VBO\VA ready surface mesh. Not used by engine but can be used by mod-makers
int dlight_s, dlight_t; // gl lightmap coordinates for dynamic lightmaps
int mirrortexturenum; // gl texnum
float mirrormatrix[4][4];
struct mextrasurf_s *mirrorchain; // for gl_texsort drawing
struct mextrasurf_s *detailchain; // for detail textures drawing
color24 *deluxemap; // note: this is the actual deluxemap data for this surface
int reserved[32]; // just for future expansions or mod-makers
} mextrasurf_t;
int planenum;
short children[2]; // negative numbers are contents
} dclipnode_t;
typedef struct hull_s
{
dclipnode_t *clipnodes;
mplane_t *planes;
int firstclipnode;
int lastclipnode;
mplane_t *planes;
int firstclipnode;
int lastclipnode;
vec3_t clip_mins;
vec3_t clip_maxs;
} hull_t;
#ifndef CACHE_USER
#if !defined( CACHE_USER ) && !defined( QUAKEDEF_H )
#define CACHE_USER
typedef struct cache_user_s
{
void *data; // extradata
void *data;
} cache_user_t;
#endif
typedef struct model_s
{
char name[64]; // model name
qboolean needload; // bmodels and sprites don't cache normally
char name[ MAX_MODEL_NAME ];
qboolean needload; // bmodels and sprites don't cache normally
// shared modelinfo
modtype_t type; // model type
int numframes; // sprite's framecount
byte *mempool; // private mempool (was synctype)
int flags; // hl compatibility
modtype_t type;
int numframes;
synctype_t synctype;
int flags;
//
// volume occupied by the model
//
vec3_t mins, maxs; // bounding box at angles '0 0 0'
vec3_t mins, maxs;
float radius;
// brush model
int firstmodelsurface;
int nummodelsurfaces;
//
// brush model
//
int firstmodelsurface, nummodelsurfaces;
int numsubmodels;
dmodel_t *submodels; // or studio animations
int numsubmodels;
dmodel_t *submodels;
int numplanes;
mplane_t *planes;
int numplanes;
mplane_t *planes;
int numleafs; // number of visible leafs, not counting 0
mleaf_t *leafs;
int numleafs; // number of visible leafs, not counting 0
struct mleaf_s *leafs;
int numvertexes;
mvertex_t *vertexes;
int numvertexes;
mvertex_t *vertexes;
int numedges;
int numedges;
medge_t *edges;
int numnodes;
int numnodes;
mnode_t *nodes;
int numtexinfo;
int numtexinfo;
mtexinfo_t *texinfo;
int numsurfaces;
int numsurfaces;
msurface_t *surfaces;
int numsurfedges;
int *surfedges;
int numsurfedges;
int *surfedges;
int numclipnodes;
int numclipnodes;
dclipnode_t *clipnodes;
int nummarksurfaces;
int nummarksurfaces;
msurface_t **marksurfaces;
hull_t hulls[MAX_MAP_HULLS];
int numtextures;
texture_t **textures;
int numtextures;
texture_t **textures;
byte *visdata;
color24 *lightdata;
char *entities;
//
// additional model data
//
cache_user_t cache; // only access through Mod_Extradata
} model_t;
typedef vec_t vec4_t[4];
typedef struct alight_s
{
int ambientlight; // clip at 128
int shadelight; // clip at 192 - ambientlight
int ambientlight; // clip at 128
int shadelight; // clip at 192 - ambientlight
vec3_t color;
float *plightvec;
} alight_t;
typedef struct auxvert_s
{
float fv[3]; // viewspace x, y
float fv[3]; // viewspace x, y
} auxvert_t;
#define MAX_SCOREBOARDNAME 32
#define MAX_INFO_STRING 256
#include "custom.h"
#define MAX_INFO_STRING 256
#define MAX_SCOREBOARDNAME 32
typedef struct player_info_s
{
int userid; // User id on server
char userinfo[MAX_INFO_STRING]; // User info string
char name[MAX_SCOREBOARDNAME]; // Name (extracted from userinfo)
int spectator; // Spectator or not, unused
// User id on server
int userid;
// User info string
char userinfo[ MAX_INFO_STRING ];
// Name
char name[ MAX_SCOREBOARDNAME ];
// Spectator or not, unused
int spectator;
int ping;
int packet_loss;
// skin information
char model[64];
char model[MAX_QPATH];
int topcolor;
int bottomcolor;
@ -364,50 +337,12 @@ typedef struct player_info_s @@ -364,50 +337,12 @@ typedef struct player_info_s
// Gait frame estimation
int gaitsequence;
float gaitframe;
float gaityaw;
vec3_t prevgaitorigin;
float gaitframe;
float gaityaw;
vec3_t prevgaitorigin;
customization_t customdata;
customization_t customdata;
} player_info_t;
//
// sprite representation in memory
//
typedef enum { SPR_SINGLE = 0, SPR_GROUP, SPR_ANGLED } spriteframetype_t;
#endif // COM_MODEL_H
typedef struct mspriteframe_s
{
int width;
int height;
float up, down, left, right;
int gl_texturenum;
} mspriteframe_t;
typedef struct
{
int numframes;
float *intervals;
mspriteframe_t *frames[1];
} mspritegroup_t;
typedef struct
{
spriteframetype_t type;
mspriteframe_t *frameptr;
} mspriteframedesc_t;
typedef struct
{
short type;
short texFormat;
int maxwidth;
int maxheight;
int numframes;
int radius;
int facecull;
int synctype;
mspriteframedesc_t frames[1];
} msprite_t;
#endif//COM_MODEL_H

49
common/gameinfo.h

@ -1,49 +0,0 @@ @@ -1,49 +0,0 @@
/*
gameinfo.h - current game info
Copyright (C) 2010 Uncle Mike
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#pragma once
#ifndef GAMEINFO_H
#define GAMEINFO_H
#define GFL_NOMODELS (1<<0)
/*
========================================================================
GAMEINFO stuff
internal shared gameinfo structure (readonly for engine parts)
========================================================================
*/
typedef struct
{
// filesystem info
char gamefolder[64]; // used for change game '-game x'
char startmap[64]; // map to start singleplayer game
char trainmap[64]; // map to start hazard course (if specified)
char title[64]; // Game Main Title
char version[14]; // game version (optional)
short flags; // game flags
// about mod info
char game_url[256]; // link to a developer's site
char update_url[256]; // link to updates page
char type[64]; // single, toolkit, multiplayer etc
char date[64];
char size[64]; // displayed mod size
int gamemode;
} GAMEINFO;
#endif//GAMEINFO_H

29
common/lightstyle.h

@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
/*
lightstyle.h - lighstyle description
Copyright (C) 2011 Uncle Mike
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#pragma once
#ifndef LIGHTSTYLE_H
#define LIGHTSTYLE_H
typedef struct
{
char pattern[256];
float map[256];
int length;
float value;
qboolean interp; // allow to interpolate this lightstyle
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

4
common/mathlib.h

@ -22,7 +22,11 @@ @@ -22,7 +22,11 @@
#include <tgmath.h>
#endif // HAVE_TGMATH_H
#else // __cplusplus
#if HAVE_CMATH
#include <cmath>
#else
#include <math.h>
#endif
#endif // __cplusplus
typedef float vec_t;

261
common/render_api.h

@ -1,261 +0,0 @@ @@ -1,261 +0,0 @@
/*
render_api.h - Xash3D extension for client interface
Copyright (C) 2011 Uncle Mike
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#pragma once
#ifndef RENDER_API_H
#define RENDER_API_H
#include "lightstyle.h"
#include "dlight.h"
// changes for version 28
// replace decal_t from software declaration to hardware (matched to normal HL)
// mextrasurf_t->increased limit of reserved fields (up from 7 to 32)
// replace R_StoreEfrags with him extended version
// formed group for BSP decal manipulating
// move misc functions at end of the interface
// added new export for clearing studio decals
#define CL_RENDER_INTERFACE_VERSION 35
#define MAX_STUDIO_DECALS 4096 // + unused space of BSP decals
#define SURF_INFO( surf, mod ) ((mextrasurf_t *)mod->cache.data + (surf - mod->surfaces))
#define INFO_SURF( surf, mod ) (mod->surfaces + (surf - (mextrasurf_t *)mod->cache.data))
// render info parms
#define PARM_TEX_WIDTH 1 // all parms with prefix 'TEX_' receive arg as texnum
#define PARM_TEX_HEIGHT 2 // otherwise it's not used
#define PARM_TEX_SRC_WIDTH 3
#define PARM_TEX_SRC_HEIGHT 4
#define PARM_TEX_SKYBOX 5 // second arg as skybox ordering num
#define PARM_TEX_SKYTEXNUM 6 // skytexturenum for quake sky
#define PARM_TEX_LIGHTMAP 7 // second arg as number 0 - 128
#define PARM_TEX_TARGET 8
#define PARM_TEX_TEXNUM 9
#define PARM_TEX_FLAGS 10
#define PARM_TEX_TYPE 11
#define PARM_TEX_CACHEFRAME 12 // compare with worldmodel->needload
#define PARM_TEX_GLFORMAT 13 // get a texture GL-format
// reserved
#define PARM_WORLD_VERSION 16 // return the version of bsp
#define PARM_SKY_SPHERE 17 // sky is quake sphere ?
#define PARM_MAP_HAS_MIRRORS 18 // current map has mirorrs
#define PARM_MAP_HAS_DELUXE 19 // map has deluxedata
#define PARM_MAX_ENTITIES 20
#define PARM_WIDESCREEN 21
#define PARM_FULLSCREEN 22
#define PARM_SCREEN_WIDTH 23
#define PARM_SCREEN_HEIGHT 24
#define PARM_CLIENT_INGAME 25
#define PARM_FEATURES 26 // same as movevars->features
#define PARM_ACTIVE_TMU 27 // for debug
#define PARM_CACHEFRAME 28
#define PARM_MAX_IMAGE_UNITS 29
#define PARM_CLIENT_ACTIVE 30
#define PARM_REBUILD_GAMMA 31 // if true lightmaps rebuilding for gamma change
enum
{
// skybox ordering
SKYBOX_RIGHT = 0,
SKYBOX_BACK,
SKYBOX_LEFT,
SKYBOX_FORWARD,
SKYBOX_UP,
SKYBOX_DOWN,
};
typedef enum
{
TEX_INVALID = 0, // free slot
TEX_SYSTEM, // generated by engine
TEX_NOMIP, // hud pics, menu etc
TEX_BRUSH, // a map texture
TEX_SPRITE, // sprite frames
TEX_STUDIO, // studio skins
TEX_LIGHTMAP, // lightmap textures
TEX_DECAL, // decals
TEX_VGUI, // vgui fonts or images
TEX_CUBEMAP, // cubemap textures (sky)
TEX_DETAIL, // detail textures
TEX_REMAP, // local copy of remap texture
TEX_SCREENCOPY, // keep screen copy e.g. for mirror
TEX_CUSTOM, // user created texture
TEX_DEPTHMAP // shadowmap texture
} texType_t;
typedef enum
{
TF_NEAREST = (1<<0), // disable texfilter
TF_KEEP_RGBDATA = (1<<1), // some images keep source
TF_NOFLIP_TGA = (1<<2), // Steam background completely ignore tga attribute 0x20
TF_KEEP_8BIT = (1<<3), // keep original 8-bit image (if present)
TF_NOPICMIP = (1<<4), // ignore r_picmip resample rules
TF_UNCOMPRESSED = (1<<5), // don't compress texture in video memory
TF_CUBEMAP = (1<<6), // it's cubemap texture
TF_DEPTHMAP = (1<<7), // custom texture filter used
TF_INTENSITY = (1<<8), // monochrome intensity image
TF_LUMINANCE = (1<<9), // force image to grayscale
TF_SKYSIDE = (1<<10), // this is a part of skybox
TF_CLAMP = (1<<11), // clamp texcoords to [0..1] range
TF_NOMIPMAP = (1<<12), // don't build mips for this image
TF_HAS_LUMA = (1<<13), // sets by GL_UploadTexture
TF_MAKELUMA = (1<<14), // create luma from quake texture (only q1 textures contain luma-pixels)
TF_NORMALMAP = (1<<15), // is a normalmap
TF_HAS_ALPHA = (1<<16), // image has alpha (used only for GL_CreateTexture)
TF_FORCE_COLOR = (1<<17), // force upload monochrome textures as RGB (detail textures)
TF_TEXTURE_1D = (1<<18), // this is GL_TEXTURE_1D
TF_BORDER = (1<<19), // zero clamp for projected textures
TF_TEXTURE_3D = (1<<20), // this is GL_TEXTURE_3D
TF_STATIC = (1<<21), // a marker for purge mechanism (not used by engine)
TF_TEXTURE_RECTANGLE= (1<<22), // this is GL_TEXTURE_RECTANGLE
TF_ALPHA_BORDER = (1<<23), // clamp to (0,0,0,255) (probably no difference)
TF_IMAGE_PROGRAM = (1<<24), // enable image program support like in Doom3
TF_ALPHACONTRAST = (1<<25), // special texture flags for internal usage
TF_FLOAT = (1<<26), // float textures
TF_NOCOMPARE = (1<<27), // disable comparing for depth textures
TF_FLOATDATA = (1<<28), // incoming dataType has type GL_FLOAT
} texFlags_t;
typedef struct beam_s BEAM;
typedef struct particle_s particle_t;
// 12 bytes here
typedef struct modelstate_s
{
short sequence;
short frame; // 10 bits multiple by 4, should be enough
byte blending[2];
byte controller[4];
byte body;
byte skin;
} modelstate_t;
typedef struct decallist_s
{
vec3_t position;
char name[64];
short entityIndex;
byte depth;
byte flags;
float scale;
// this is the surface plane that we hit so that
// we can move certain decals across
// transitions if they hit similar geometry
vec3_t impactPlaneNormal;
modelstate_t studio_state; // studio decals only
} decallist_t;
typedef struct render_api_s
{
// Get renderer info (doesn't changes engine state at all)
int (*RenderGetParm)( int parm, int arg ); // generic
void (*GetDetailScaleForTexture)( int texture, float *xScale, float *yScale );
void (*GetExtraParmsForTexture)( int texture, byte *red, byte *green, byte *blue, byte *alpha );
lightstyle_t* (*GetLightStyle)( int number );
dlight_t* (*GetDynamicLight)( int number );
dlight_t* (*GetEntityLight)( int number );
byte (*TextureToTexGamma)( byte color ); // software gamma support
void (*GetBeamChains)( BEAM ***active_beams, BEAM ***free_beams, particle_t ***free_trails );
// Set renderer info (tell engine about changes)
void (*R_SetCurrentEntity)( struct cl_entity_s *ent ); // tell engine about both currententity and currentmodel
void (*R_SetCurrentModel)( struct model_s *mod ); // change currentmodel but leave currententity unchanged
void (*GL_SetWorldviewProjectionMatrix)( const float *glmatrix ); // update viewprojection matrix (tracers uses it)
void (*R_StoreEfrags)( struct efrag_s **ppefrag, int framecount );// store efrags for static entities
// Texture tools
int (*GL_FindTexture)( const char *name );
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 );
void (*GL_SetTextureType)( unsigned int texnum, unsigned int type );
void (*GL_TextureCacheFrame)( unsigned int texnum );
void (*GL_FreeTexture)( unsigned int texnum );
// Decals manipulating (draw & remove)
void (*DrawSingleDecal)( struct decal_s *pDecal, struct msurface_s *fa );
float *(*R_DecalSetupVerts)( struct decal_s *pDecal, struct msurface_s *surf, int texture, int *outCount );
void (*R_EntityRemoveDecals)( struct model_s *mod ); // remove all the decals from specified entity (BSP only)
// AVIkit support
void *(*AVI_LoadVideo)( const char *filename, int ignore_hwgamma );
int (*AVI_GetVideoInfo)( void *Avi, long *xres, long *yres, float *duration );
long (*AVI_GetVideoFrameNumber)( void *Avi, float time );
byte *(*AVI_GetVideoFrame)( void *Avi, long frame );
void (*AVI_UploadRawFrame)( int texture, int cols, int rows, int width, int height, const byte *data );
void (*AVI_FreeVideo)( void *Avi );
int (*AVI_IsActive)( void *Avi );
// glState related calls (must use this instead of normal gl-calls to prevent de-synchornize local states between engine and the client)
void (*GL_Bind)( int tmu, unsigned int texnum );
void (*GL_SelectTexture)( int tmu );
void (*GL_LoadTextureMatrix)( const float *glmatrix );
void (*GL_TexMatrixIdentity)( void );
void (*GL_CleanUpTextureUnits)( int last ); // pass 0 for clear all the texture units
void (*GL_TexGen)( unsigned int coord, unsigned int mode );
void (*GL_TextureTarget)( unsigned int target ); // change texture unit mode without bind texture
void (*GL_TexCoordArrayMode)( unsigned int texmode );
void (*GL_Reserved0)( void ); // for potential interface expansion without broken compatibility
void (*GL_Reserved1)( void );
void (*GL_Reserved2)( void );
void (*GL_Reserved3)( void );
// Misc renderer functions
void (*GL_DrawParticles)( const float *vieworg, const float *fwd, const float *rt, const float *up, unsigned int clipFlags );
void (*EnvShot)( const float *vieworg, const char *name, qboolean skyshot, int shotsize ); // creates a cubemap or skybox into gfx\env folder
int (*COM_CompareFileTime)( const char *filename1, const char *filename2, int *iCompare );
void (*Host_Error)( const char *error, ... ); // cause Host Error
int (*SPR_LoadExt)( const char *szPicName, unsigned int texFlags ); // extended version of SPR_Load
void (*TessPolygon)( struct msurface_s *surf, struct model_s *mod, float tessSize );
struct mstudiotex_s *( *StudioGetTexture )( struct cl_entity_s *e );
const struct ref_overview_s *( *GetOverviewParms )( void );
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
// static allocations
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
// find in files
char **(*pfnGetFilesList)( const char *pattern, int *numFiles, int gamedironly );
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 35
} render_api_t;
// render callbacks
typedef struct render_interface_s
{
int version;
// passed through R_RenderFrame (0 - use engine renderer, 1 - use custom client renderer)
int (*GL_RenderFrame)( const struct ref_params_s *pparams, qboolean drawWorld );
// build all the lightmaps on new level or when gamma is changed
void (*GL_BuildLightmaps)( void );
// setup map bounds for ortho-projection when we in dev_overview mode
void (*GL_OrthoBounds)( const float *mins, const float *maxs );
// handle decals which hit mod_studio or mod_sprite
void (*R_StudioDecalShoot)( int decalTexture, struct cl_entity_s *ent, const float *start, const float *pos, int flags, modelstate_t *state );
// prepare studio decals for save
int (*R_CreateStudioDecalList)( decallist_t *pList, int count, qboolean changelevel );
// 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 );
// replace with built-in R_DrawCubemapView for make skyshots or envshots
qboolean (*R_DrawCubemapView)( const float *origin, const float *angles, int size );
// alloc or destroy studiomodel custom data
void (*Mod_ProcessUserData)( struct model_s *mod, qboolean create, const byte *buffer );
} render_interface_t;
#endif//RENDER_API_H

24
common/wrect.h

@ -1,24 +0,0 @@ @@ -1,24 +0,0 @@
/*
wrect.h - rectangle definition
Copyright (C) 2010 Uncle Mike
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#pragma once
#ifndef WRECT_H
#define WRECT_H
typedef struct wrect_s
{
int left, right, top, bottom;
} wrect_t;
#endif//WRECT_H

16
dlls/animation.cpp

@ -13,6 +13,10 @@ @@ -13,6 +13,10 @@
*
****/
/* all this mess was here to use quake mathlib instead of hlsdk vectors
* it may break debug info or even build because global symbols types differ
* it's better to define VectorCopy macro for Vector class */
#if 0
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -50,7 +54,17 @@ typedef unsigned char byte; @@ -50,7 +54,17 @@ typedef unsigned char byte;
#include "enginecallback.h"
#endif
extern globalvars_t *gpGlobals;
//extern globalvars_t *gpGlobals;
#else
#include "extdll.h"
#include "util.h"
#include "activity.h"
#include "activitymap.h"
#include "animation.h"
#include "scriptevent.h"
#include "studio.h"
#define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];}
#endif
#pragma warning( disable : 4244 )

8
dlls/bigmomma.cpp

@ -931,7 +931,7 @@ void CBigMomma::StartTask( Task_t *pTask ) @@ -931,7 +931,7 @@ void CBigMomma::StartTask( Task_t *pTask )
TaskComplete();
break;
case TASK_WAIT_NODE:
m_flWait = gpGlobals->time + GetNodeDelay();
m_flWaitFinished = gpGlobals->time + GetNodeDelay();
if( m_hTargetEnt->pev->spawnflags & SF_INFOBM_WAIT )
ALERT( at_aiconsole, "BM: Wait at node %s forever\n", STRING( pev->netname ) );
else
@ -1007,8 +1007,10 @@ void CBigMomma::RunTask( Task_t *pTask ) @@ -1007,8 +1007,10 @@ void CBigMomma::RunTask( Task_t *pTask )
return;
if( gpGlobals->time > m_flWaitFinished )
{
TaskComplete();
ALERT( at_aiconsole, "BM: The WAIT is over!\n" );
ALERT( at_aiconsole, "BM: The WAIT is over!\n" );
}
break;
case TASK_PLAY_NODE_PRESEQUENCE:
case TASK_PLAY_NODE_SEQUENCE:
@ -1104,7 +1106,7 @@ void CBMortar::Spawn( void ) @@ -1104,7 +1106,7 @@ void CBMortar::Spawn( void )
UTIL_SetSize( pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) );
m_maxFrame = (float) MODEL_FRAMES( pev->modelindex ) - 1;
m_maxFrame = MODEL_FRAMES( pev->modelindex ) - 1;
pev->dmgtime = gpGlobals->time + 0.4f;
}

5
dlls/bullsquid.cpp

@ -95,7 +95,7 @@ void CSquidSpit::Spawn( void ) @@ -95,7 +95,7 @@ void CSquidSpit::Spawn( void )
UTIL_SetSize( pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) );
m_maxFrame = (float)MODEL_FRAMES( pev->modelindex ) - 1;
m_maxFrame = MODEL_FRAMES( pev->modelindex ) - 1;
}
void CSquidSpit::Animate( void )
@ -536,6 +536,9 @@ void CBullsquid::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -536,6 +536,9 @@ void CBullsquid::HandleAnimEvent( MonsterEvent_t *pEvent )
{
case BSQUID_AE_SPIT:
{
if( m_hEnemy == 0 )
return;
Vector vecSpitOffset;
Vector vecSpitDir;

1
dlls/cbase.h

@ -58,7 +58,6 @@ CBaseEntity @@ -58,7 +58,6 @@ CBaseEntity
extern "C" EXPORT int GetEntityAPI( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion );
extern "C" EXPORT int GetEntityAPI2( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
extern "C" EXPORT int Server_GetPhysicsInterface( int iVersion, server_physics_api_t *pfuncsFromEngine, physics_interface_t *pFunctionTable );
extern int DispatchSpawn( edict_t *pent );
extern void DispatchKeyValue( edict_t *pentKeyvalue, KeyValueData *pkvd );

5
dlls/crossbow.cpp

@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
#define BOLT_AIR_VELOCITY 2000
#define BOLT_WATER_VELOCITY 1000
extern BOOL gPhysicsInterfaceInitialized;
extern BOOL g_fIsXash3D;
// UNDONE: Save/restore this? Don't forget to set classname and LINK_ENTITY_TO_CLASS()
//
@ -169,7 +169,8 @@ void CCrossbowBolt::BoltTouch( CBaseEntity *pOther ) @@ -169,7 +169,8 @@ void CCrossbowBolt::BoltTouch( CBaseEntity *pOther )
pev->angles.z = RANDOM_LONG( 0, 360 );
pev->nextthink = gpGlobals->time + 10.0f;
if (gPhysicsInterfaceInitialized) {
if( g_fIsXash3D )
{
// g-cont. Setup movewith feature
pev->movetype = MOVETYPE_COMPOUND; // set movewith type
pev->aiment = ENT( pOther->pev ); // set parent

6
dlls/extdll.h

@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
#define NOMCX
#define NOIME
#define HSPRITE HSPRITE_win32
#include "windows.h"
#include <windows.h>
#undef HSPRITE
#else // _WIN32
#ifndef FALSE
@ -66,7 +66,11 @@ typedef int BOOL; @@ -66,7 +66,11 @@ typedef int BOOL;
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#if HAVE_CMATH
#include <cmath>
#else
#include <math.h>
#endif
#ifndef M_PI_F
#define M_PI_F (float)M_PI

8
dlls/game.cpp

@ -17,6 +17,8 @@ @@ -17,6 +17,8 @@
#include "util.h"
#include "game.h"
BOOL g_fIsXash3D;
cvar_t displaysoundlist = {"displaysoundlist","0"};
// multiplayer server rules
@ -53,6 +55,8 @@ cvar_t *g_psv_gravity = NULL; @@ -53,6 +55,8 @@ cvar_t *g_psv_gravity = NULL;
cvar_t *g_psv_aim = NULL;
cvar_t *g_footsteps = NULL;
cvar_t *g_psv_developer;
//CVARS FOR SKILL LEVEL SETTINGS
// Agrunt
cvar_t sk_agrunt_health1 = {"sk_agrunt_health1","0"};
@ -453,11 +457,15 @@ cvar_t sk_player_leg3 = { "sk_player_leg3","1" }; @@ -453,11 +457,15 @@ cvar_t sk_player_leg3 = { "sk_player_leg3","1" };
void GameDLLInit( void )
{
// Register cvars here:
if( CVAR_GET_POINTER( "build" ) )
g_fIsXash3D = TRUE;
g_psv_gravity = CVAR_GET_POINTER( "sv_gravity" );
g_psv_aim = CVAR_GET_POINTER( "sv_aim" );
g_footsteps = CVAR_GET_POINTER( "mp_footsteps" );
g_psv_developer = CVAR_GET_POINTER( "developer" );
CVAR_REGISTER( &displaysoundlist );
CVAR_REGISTER( &allow_spectators );

2
dlls/game.h

@ -43,4 +43,6 @@ extern cvar_t allowmonsters; @@ -43,4 +43,6 @@ extern cvar_t allowmonsters;
extern cvar_t *g_psv_gravity;
extern cvar_t *g_psv_aim;
extern cvar_t *g_footsteps;
extern cvar_t *g_psv_developer;
#endif // GAME_H

12
dlls/gauss.cpp

@ -278,19 +278,27 @@ void CGauss::SecondaryAttack() @@ -278,19 +278,27 @@ void CGauss::SecondaryAttack()
// ALERT( at_console, "%d %d %d\n", m_fInAttack, m_iSoundState, pitch );
const bool overcharge = m_pPlayer->m_flStartCharge < gpGlobals->time - 10.0f;
if( m_iSoundState == 0 )
ALERT( at_console, "sound state %d\n", m_iSoundState );
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussSpin, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, pitch, 0, ( m_iSoundState == SND_CHANGE_PITCH ) ? 1 : 0, 0 );
#ifdef GAUSS_OVERCHARGE_FIX
if (!overcharge)
#endif
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussSpin, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, pitch, 0, ( m_iSoundState == SND_CHANGE_PITCH ) ? 1 : 0, 0 );
m_iSoundState = SND_CHANGE_PITCH; // hack for going through level transitions
m_pPlayer->m_iWeaponVolume = GAUSS_PRIMARY_CHARGE_VOLUME;
// m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.1f;
if( m_pPlayer->m_flStartCharge < gpGlobals->time - 10.0f )
if( overcharge )
{
// Player charged up too long. Zap him.
#ifdef GAUSS_OVERCHARGE_FIX
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussSpin, 0.0, g_vecZero, g_vecZero, 0.0, 0.0, pitch, 0, 0, 1 );
#endif
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/electro4.wav", 1.0f, ATTN_NORM, 0, 80 + RANDOM_LONG( 0, 0x3f ) );
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/electro6.wav", 1.0f, ATTN_NORM, 0, 75 + RANDOM_LONG( 0, 0x3f ) );

5
dlls/h_export.cpp

@ -26,9 +26,8 @@ @@ -26,9 +26,8 @@
#include "cbase.h"
// Holds engine functionality callbacks
enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals;
server_physics_api_t g_physfuncs;
enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals;
#ifdef _WIN32

8
dlls/houndeye.cpp

@ -35,7 +35,7 @@ extern CGraph WorldGraph; @@ -35,7 +35,7 @@ extern CGraph WorldGraph;
#define HOUNDEYE_MAX_ATTACK_RADIUS 384.0f
#define HOUNDEYE_SQUAD_BONUS 1.1f
#define HOUNDEYE_EYE_FRAMES 4 // how many different switchable maps for the eye
#define HOUNDEYE_EYE_FRAMES 3 // how many different switchable maps for the eye
#define HOUNDEYE_SOUND_STARTLE_VOLUME 128 // how loud a sound has to be to badly scare a sleeping houndeye
@ -783,6 +783,11 @@ void CHoundeye::RunTask( Task_t *pTask ) @@ -783,6 +783,11 @@ void CHoundeye::RunTask( Task_t *pTask )
{
pev->skin++;
}
if( pev->skin == HOUNDEYE_EYE_FRAMES - 1 )
{
TaskComplete();
}
break;
}
case TASK_HOUND_HOP_BACK:
@ -952,6 +957,7 @@ Task_t tlHoundSleep[] = @@ -952,6 +957,7 @@ Task_t tlHoundSleep[] =
{ TASK_HOUND_FALL_ASLEEP, (float)0 },
{ TASK_WAIT_RANDOM, (float)25 },
{ TASK_HOUND_CLOSE_EYE, (float)0 },
{ TASK_WAIT_INDEFINITE, (float)0 },
//{ TASK_WAIT, (float)10 },
//{ TASK_WAIT_RANDOM, (float)10 },
};

5
dlls/monsters.cpp

@ -33,6 +33,7 @@ @@ -33,6 +33,7 @@
#include "decals.h"
#include "soundent.h"
#include "gamerules.h"
#include "game.h"
#define MONSTER_CUT_CORNER_DIST 8 // 8 means the monster's bounding box is contained without the box of the node in WC
@ -2066,7 +2067,9 @@ void CBaseMonster::StartMonster( void ) @@ -2066,7 +2067,9 @@ void CBaseMonster::StartMonster( void )
if( !WALK_MOVE( ENT( pev ), 0, 0, WALKMOVE_NORMAL ) )
{
ALERT( at_error, "Monster %s stuck in wall--level design error\n", STRING( pev->classname ) );
pev->effects = EF_BRIGHTFIELD;
if( g_psv_developer && g_psv_developer->value )
pev->effects = EF_BRIGHTFIELD;
}
}
else

7
dlls/nodes.cpp

@ -42,10 +42,13 @@ CGraph WorldGraph; @@ -42,10 +42,13 @@ CGraph WorldGraph;
LINK_ENTITY_TO_CLASS( info_node, CNodeEnt )
LINK_ENTITY_TO_CLASS( info_node_air, CNodeEnt )
#if !defined _WIN32
#ifdef __DOS__
#include <direct.h>
#define CreateDirectoryA(p, n) mkdir(p)
#elif !defined _WIN32
#include <unistd.h>
#include <sys/stat.h>
#define CreateDirectoryA(p, n) mkdir(p, 0777)
#define CreateDirectoryA(p, n) mkdir(p,777)
#endif
//=========================================================

33
dlls/physcallback.h

@ -1,33 +0,0 @@ @@ -1,33 +0,0 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#pragma once
#ifndef PHYSCALLBACK_H
#define PHYSCALLBACK_H
#include "physint.h"
// Must be provided by user of this code
extern server_physics_api_t g_physfuncs;
// The actual physic callbacks
#define LINK_ENTITY (*g_physfuncs.pfnLinkEdict)
#define PHYSICS_TIME (*g_physfuncs.pfnGetServerTime)
#define HOST_FRAMETIME (*g_physfuncs.pfnGetFrameTime)
#define MODEL_HANDLE (*g_physfuncs.pfnGetModel)
#define GET_AREANODE (*g_physfuncs.pfnGetHeadnode)
#define GET_SERVER_STATE (*g_physfuncs.pfnServerState)
#define HOST_ERROR (*g_physfuncs.pfnHost_Error)
#endif //PHYSCALLBACK_H

2
dlls/util.cpp

@ -1729,7 +1729,7 @@ void CSaveRestoreBuffer::BufferRewind( int size ) @@ -1729,7 +1729,7 @@ void CSaveRestoreBuffer::BufferRewind( int size )
m_pdata->size -= size;
}
#ifndef _WIN32
#if !defined _WIN32 && !defined __WATCOMC__
extern "C" {
unsigned _rotr( unsigned val, int shift )
{

4
dlls/util.h

@ -26,10 +26,6 @@ @@ -26,10 +26,6 @@
#include "enginecallback.h"
#endif
#ifndef PHYSCALLBACK_H
#include "physcallback.h"
#endif
#include <string.h>
#include <ctype.h>
inline void MESSAGE_BEGIN( int msg_dest, int msg_type, const float *pOrigin, entvars_t *ent ); // implementation later in this file

110
dlls/world.cpp

@ -33,7 +33,6 @@ @@ -33,7 +33,6 @@
#include "weapons.h"
#include "gamerules.h"
#include "teamplay_gamerules.h"
#include "physcallback.h"
extern CGraph WorldGraph;
extern CSoundEnt *pSoundEnt;
@ -730,112 +729,3 @@ void CWorld::KeyValue( KeyValueData *pkvd ) @@ -730,112 +729,3 @@ void CWorld::KeyValue( KeyValueData *pkvd )
CBaseEntity::KeyValue( pkvd );
}
//
// Xash3D physics interface
//
typedef void (*LINK_ENTITY_FN)( entvars_t *pev );
//
// attempt to create custom entity when default method is failed
// 0 - attempt to create, -1 - reject to create
//
int DispatchCreateEntity( edict_t *pent, const char *szName )
{
/*
#ifdef CREATE_ENTITY_TEST
// quake armor entities. we just replaced it with item_battery...
if( !strcmp( szName, "item_armor1" ) || !strcmp( szName, "item_armor2" ) )
{
LINK_ENTITY_FN SpawnEdict;
// ugly method to get acess with himself exports
SpawnEdict = (LINK_ENTITY_FN)GetProcAddress( GetModuleHandle( "hl" ), "item_battery" );
if( SpawnEdict != NULL ) // found the valid spawn
{
// BUGBUG: old classname hanging in memory
pent->v.classname = ALLOC_STRING( "item_battery" );
//ALERT( at_console, "DispatchCreateEntity: replace %s with %s\n", szName, STRING( pent->v.classname ) );
SpawnEdict( &pent->v );
return 0; // handled
}
}
#endif
*/
return -1;
}
//
// run custom physics for each entity
// return 0 to use built-in engine physic
//
int DispatchPhysicsEntity( edict_t *pEdict )
{
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE( pEdict );
if( !pEntity )
{
//ALERT( at_console, "skip %s [%i] without private data\n", STRING( pEdict->v.classname ), ENTINDEX( pEdict ) );
return 0; // not initialized
}
// NOTE: at this point pEntity assume to be valid
/*
#ifdef CUSTOM_PHYSICS_TEST
// test alien controller without physics, thinking only
if( FClassnameIs( pEntity->pev, "monster_alien_controller" ) )
{
float thinktime;
thinktime = pEntity->pev->nextthink;
if( thinktime <= 0.0f || thinktime > PHYSICS_TIME() + gpGlobals->frametime )
return 1;
if( thinktime < PHYSICS_TIME() )
thinktime = PHYSICS_TIME(); // don't let things stay in the past.
// it is possible to start that way
// by a trigger with a local time.
pEntity->pev->nextthink = 0.0f;
gpGlobals->time = thinktime;
DispatchThink( pEdict );
#ifdef GRAVITY_TEST
// stupid fake gravity test
pEntity->pev->origin.z -= 1;
LINK_ENTITY( pEdict, true );
#endif
return 1; // handled
}
#endif
*/
return 0;
}
static physics_interface_t gPhysicsInterface =
{
SV_PHYSICS_INTERFACE_VERSION,
DispatchCreateEntity,
DispatchPhysicsEntity,
};
BOOL gPhysicsInterfaceInitialized = FALSE;
int Server_GetPhysicsInterface( int iVersion, server_physics_api_t *pfuncsFromEngine, physics_interface_t *pFunctionTable )
{
if( !pFunctionTable || !pfuncsFromEngine || iVersion != SV_PHYSICS_INTERFACE_VERSION )
{
return FALSE;
}
// copy new physics interface
memcpy( &g_physfuncs, pfuncsFromEngine, sizeof(server_physics_api_t) );
// fill engine callbacks
memcpy( pFunctionTable, &gPhysicsInterface, sizeof(physics_interface_t) );
gPhysicsInterfaceInitialized = TRUE;
return TRUE;
}

133
dlls/wscript

@ -27,28 +27,106 @@ def build(bld): @@ -27,28 +27,106 @@ def build(bld):
])
source += [
'agrunt.cpp', 'airtank.cpp', 'aflock.cpp', 'animating.cpp', 'animation.cpp', 'apache.cpp',
'barnacle.cpp', 'barney.cpp', 'bigmomma.cpp', 'bloater.cpp', 'bmodels.cpp', 'bullsquid.cpp', 'buttons.cpp',
'cbase.cpp', 'client.cpp', 'combat.cpp', 'controller.cpp', 'crossbow.cpp', 'crowbar.cpp',
'defaultai.cpp', 'doors.cpp',
'effects.cpp', 'egon.cpp', 'explode.cpp',
'flyingmonster.cpp', 'func_break.cpp', 'func_tank.cpp',
'game.cpp', 'gamerules.cpp', 'gargantua.cpp', 'gauss.cpp', 'genericmonster.cpp', 'ggrenade.cpp', 'globals.cpp', 'glock.cpp', 'gman.cpp',
'h_ai.cpp', 'h_battery.cpp', 'h_cine.cpp', 'h_cycler.cpp', 'h_export.cpp', 'handgrenade.cpp', 'hassassin.cpp', 'headcrab.cpp',
'healthkit.cpp', 'hgrunt.cpp', 'hornet.cpp', 'hornetgun.cpp', 'houndeye.cpp',
'ichthyosaur.cpp', 'islave.cpp', 'items.cpp',
'leech.cpp', 'lights.cpp',
'maprules.cpp', 'monstermaker.cpp', 'monsters.cpp', 'monsterstate.cpp', 'mortar.cpp', 'mp5.cpp', 'multiplay_gamerules.cpp',
'nihilanth.cpp', 'nodes.cpp',
'observer.cpp', 'osprey.cpp',
'pathcorner.cpp', 'plane.cpp', 'plats.cpp', 'player.cpp', 'playermonster.cpp', 'python.cpp',
'rat.cpp', 'roach.cpp', 'rpg.cpp',
'satchel.cpp', 'schedule.cpp', 'scientist.cpp', 'scripted.cpp', 'shotgun.cpp', 'singleplay_gamerules.cpp', 'skill.cpp',
'sound.cpp', 'soundent.cpp', 'spectator.cpp', 'squadmonster.cpp', 'squeakgrenade.cpp', 'subs.cpp',
'talkmonster.cpp', 'teamplay_gamerules.cpp', 'tempmonster.cpp', 'tentacle.cpp',
'triggers.cpp', 'tripmine.cpp', 'turret.cpp',
'agrunt.cpp',
'airtank.cpp',
'aflock.cpp',
'animating.cpp',
'animation.cpp',
'apache.cpp',
'barnacle.cpp',
'barney.cpp',
'bigmomma.cpp',
'bloater.cpp',
'bmodels.cpp',
'bullsquid.cpp',
'buttons.cpp',
'cbase.cpp',
'client.cpp',
'combat.cpp',
'controller.cpp',
'crossbow.cpp',
'crowbar.cpp',
'defaultai.cpp',
'doors.cpp',
'effects.cpp',
'egon.cpp',
'explode.cpp',
'flyingmonster.cpp',
'func_break.cpp',
'func_tank.cpp',
'game.cpp',
'gamerules.cpp',
'gargantua.cpp',
'gauss.cpp',
'genericmonster.cpp',
'ggrenade.cpp',
'globals.cpp',
'glock.cpp',
'gman.cpp',
'h_ai.cpp',
'h_battery.cpp',
'h_cine.cpp',
'h_cycler.cpp',
'h_export.cpp',
'handgrenade.cpp',
'hassassin.cpp',
'headcrab.cpp',
'healthkit.cpp',
'hgrunt.cpp',
'hornet.cpp',
'hornetgun.cpp',
'houndeye.cpp',
'ichthyosaur.cpp',
'islave.cpp',
'items.cpp',
'leech.cpp',
'lights.cpp',
'maprules.cpp',
'monstermaker.cpp',
'monsters.cpp',
'monsterstate.cpp',
'mortar.cpp',
'mp5.cpp',
'multiplay_gamerules.cpp',
'nihilanth.cpp',
'nodes.cpp',
'observer.cpp',
'osprey.cpp',
'pathcorner.cpp',
'plane.cpp',
'plats.cpp',
'player.cpp',
'playermonster.cpp',
'python.cpp',
'rat.cpp',
'roach.cpp',
'rpg.cpp',
'satchel.cpp',
'schedule.cpp',
'scientist.cpp',
'scripted.cpp',
'shotgun.cpp',
'singleplay_gamerules.cpp',
'skill.cpp',
'sound.cpp',
'soundent.cpp',
'spectator.cpp',
'squadmonster.cpp',
'squeakgrenade.cpp',
'subs.cpp',
'talkmonster.cpp',
'teamplay_gamerules.cpp',
'tempmonster.cpp',
'tentacle.cpp',
'triggers.cpp',
'tripmine.cpp',
'turret.cpp',
'util.cpp',
'weapons.cpp', 'world.cpp', 'xen.cpp', 'zombie.cpp']
'weapons.cpp',
'world.cpp',
'xen.cpp',
'zombie.cpp'
]
if bld.env.VOICEMGR:
source += bld.path.parent.ant_glob([
@ -57,11 +135,19 @@ def build(bld): @@ -57,11 +135,19 @@ def build(bld):
else:
defines += ['NO_VOICEGAMEMGR']
includes = Utils.to_list('. wpn_shared ../common ../engine ../pm_shared ../game_shared ../public')
includes = [
'.',
'wpn_shared',
'../common',
'../engine',
'../pm_shared',
'../game_shared',
'../public'
]
libs = []
if bld.env.DEST_OS not in ['android']:
if bld.env.DEST_OS not in ['android', 'dos']:
install_path = os.path.join(bld.env.GAMEDIR, bld.env.SERVER_DIR)
else:
install_path = bld.env.PREFIX
@ -69,6 +155,7 @@ def build(bld): @@ -69,6 +155,7 @@ def build(bld):
bld.shlib(
source = source,
target = bld.env.SERVER_NAME + bld.env.POSTFIX,
name = 'server',
features = 'c cxx',
includes = includes,
defines = defines,

70
engine/cdll_exp.h

@ -1,70 +0,0 @@ @@ -1,70 +0,0 @@
/*
cdll_exp.h - exports for client
Copyright (C) 2013 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.
*/
#pragma once
#ifndef CDLL_EXP_H
#define CDLL_EXP_H
// NOTE: ordering is important!
typedef struct cldll_func_s
{
int (*pfnInitialize)( cl_enginefunc_t *pEnginefuncs, int iVersion );
void (*pfnInit)( void );
int (*pfnVidInit)( void );
int (*pfnRedraw)( float flTime, int intermission );
int (*pfnUpdateClientData)( client_data_t *cdata, float flTime );
void (*pfnReset)( void );
void (*pfnPlayerMove)( struct playermove_s *ppmove, int server );
void (*pfnPlayerMoveInit)( struct playermove_s *ppmove );
char (*pfnPlayerMoveTexture)( char *name );
void (*IN_ActivateMouse)( void );
void (*IN_DeactivateMouse)( void );
void (*IN_MouseEvent)( int mstate );
void (*IN_ClearStates)( void );
void (*IN_Accumulate)( void );
void (*CL_CreateMove)( float frametime, struct usercmd_s *cmd, int active );
int (*CL_IsThirdPerson)( void );
void (*CL_CameraOffset)( float *ofs );
void *(*KB_Find)( const char *name );
void (*CAM_Think)( void ); // camera stuff
void (*pfnCalcRefdef)( ref_params_t *pparams );
int (*pfnAddEntity)( int type, cl_entity_t *ent, const char *modelname );
void (*pfnCreateEntities)( void );
void (*pfnDrawNormalTriangles)( void );
void (*pfnDrawTransparentTriangles)( void );
void (*pfnStudioEvent)( const struct mstudioevent_s *event, const cl_entity_t *entity );
void (*pfnPostRunCmd)( struct local_state_s *from, struct local_state_s *to, usercmd_t *cmd, int runfuncs, double time, unsigned int random_seed );
void (*pfnShutdown)( void );
void (*pfnTxferLocalOverrides)( entity_state_t *state, const clientdata_t *client );
void (*pfnProcessPlayerState)( entity_state_t *dst, const entity_state_t *src );
void (*pfnTxferPredictionData)( entity_state_t *ps, const entity_state_t *pps, clientdata_t *pcd, const clientdata_t *ppcd, weapon_data_t *wd, const weapon_data_t *pwd );
void (*pfnDemo_ReadBuffer)( int size, byte *buffer );
int (*pfnConnectionlessPacket)( const struct netadr_s *net_from, const char *args, char *buffer, int *size );
int (*pfnGetHullBounds)( int hullnumber, float *mins, float *maxs );
void (*pfnFrame)( double time );
int (*pfnKey_Event)( int eventcode, int keynum, const char *pszCurrentBinding );
void (*pfnTempEntUpdate)( double frametime, double client_time, double cl_gravity, struct tempent_s **ppTempEntFree, struct tempent_s **ppTempEntActive, int ( *Callback_AddVisibleEntity )( cl_entity_t *pEntity ), void ( *Callback_TempEntPlaySound )( struct tempent_s *pTemp, float damp ));
cl_entity_t *(*pfnGetUserEntity)( int index );
void (*pfnVoiceStatus)( int entindex, qboolean bTalking );
void (*pfnDirectorMessage)( int iSize, void *pbuf );
int (*pfnGetStudioModelInterface)( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio );
void (*pfnChatInputPosition)( int *x, int *y );
int (*pfnGetPlayerTeam)( int playerIndex );
void *(*pfnGetClientFactory)( void );
// 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 );
} cldll_func_t;
#endif//CDLL_EXP_H

2
engine/custom.h

@ -18,6 +18,8 @@ @@ -18,6 +18,8 @@
#include "const.h"
#define MAX_QPATH 64 // Must match value in quakedefs.h
/////////////////
// Customization
// passed to pfnPlayerCustomization

188
engine/menu_int.h

@ -1,188 +0,0 @@ @@ -1,188 +0,0 @@
/*
menu_int.h - interface between engine and menu
Copyright (C) 2010 Uncle Mike
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#pragma once
#ifndef MENU_INT_H
#define MENU_INT_H
#include "cvardef.h"
#include "gameinfo.h"
#include "wrect.h"
typedef int HIMAGE; // handle to a graphic
// flags for PIC_Load
#define PIC_NEAREST (1<<0) // disable texfilter
#define PIC_KEEP_RGBDATA (1<<1) // some images keep source
#define PIC_NOFLIP_TGA (1<<2) // Steam background completely ignore tga attribute 0x20
#define PIC_KEEP_8BIT (1<<3) // keep original 8-bit image (if present)
typedef struct ui_globalvars_s
{
float time; // unclamped host.realtime
float frametime;
int scrWidth; // actual values
int scrHeight;
int maxClients;
int developer;
int demoplayback;
int demorecording;
char demoname[64]; // name of currently playing demo
char maptitle[64]; // title of active map
} ui_globalvars_t;
typedef struct ui_enginefuncs_s
{
// image handlers
HIMAGE (*pfnPIC_Load)( const char *szPicName, const byte *ucRawImage, long ulRawImageSize, long flags );
void (*pfnPIC_Free)( const char *szPicName );
int (*pfnPIC_Width)( HIMAGE hPic );
int (*pfnPIC_Height)( HIMAGE hPic );
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_DrawHoles)( 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_DrawAdditive)( int x, int y, int width, int height, const wrect_t *prc );
void (*pfnPIC_EnableScissor)( int x, int y, int width, int height );
void (*pfnPIC_DisableScissor)( void );
// screen handlers
void (*pfnFillRGBA)( int x, int y, int width, int height, int r, int g, int b, int a );
// cvar handlers
cvar_t* (*pfnRegisterVariable)( const char *szName, const char *szValue, int flags );
float (*pfnGetCvarFloat)( const char *szName );
char* (*pfnGetCvarString)( const char *szName );
void (*pfnCvarSetString)( const char *szName, const char *szValue );
void (*pfnCvarSetValue)( const char *szName, float flValue );
// command handlers
int (*pfnAddCommand)( const char *cmd_name, void (*function)(void) );
void (*pfnClientCmd)( int execute_now, const char *szCmdString );
void (*pfnDelCommand)( const char *cmd_name );
int (*pfnCmdArgc)( void );
char* (*pfnCmdArgv)( int argc );
char* (*pfnCmd_Args)( void );
// debug messages (in-menu shows only notify)
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, ... );
// sound handlers
void (*pfnPlayLocalSound)( const char *szSound );
// cinematic handlers
void (*pfnDrawLogo)( const char *filename, float x, float y, float width, float height );
int (*pfnGetLogoWidth)( void );
int (*pfnGetLogoHeight)( void );
float (*pfnGetLogoLength)( void ); // cinematic duration in seconds
// text message system
void (*pfnDrawCharacter)( int x, int y, int width, int height, int ch, int ulRGBA, HIMAGE hFont );
int (*pfnDrawConsoleString)( int x, int y, const char *string );
void (*pfnDrawSetTextColor)( int r, int g, int b, int alpha );
void (*pfnDrawConsoleStringLen)( const char *string, int *length, int *height );
void (*pfnSetConsoleDefaultColor)( int r, int g, int b ); // color must came from colors.lst
// custom rendering (for playermodel preview)
struct cl_entity_s* (*pfnGetPlayerModel)( void ); // for drawing playermodel previews
void (*pfnSetModel)( struct cl_entity_s *ed, const char *path );
void (*pfnClearScene)( void );
void (*pfnRenderScene)( const struct ref_params_s *fd );
int (*CL_CreateVisibleEntity)( int type, struct cl_entity_s *ent );
// misc handlers
void (*pfnHostError)( const char *szFmt, ... );
int (*pfnFileExists)( const char *filename, int gamedironly );
void (*pfnGetGameDir)( char *szGetGameDir );
// gameinfo handlers
int (*pfnCreateMapsList)( int fRefresh );
int (*pfnClientInGame)( void );
void (*pfnClientJoin)( const struct netadr_s adr );
// parse txt files
byte* (*COM_LoadFile)( const char *filename, int *pLength );
char* (*COM_ParseFile)( char *data, char *token );
void (*COM_FreeFile)( void *buffer );
// keyfuncs
void (*pfnKeyClearStates)( void ); // call when menu open or close
void (*pfnSetKeyDest)( int dest );
const char *(*pfnKeynumToString)( int keynum );
const char *(*pfnKeyGetBinding)( int keynum );
void (*pfnKeySetBinding)( int keynum, const char *binding );
int (*pfnKeyIsDown)( int keynum );
int (*pfnKeyGetOverstrikeMode)( void );
void (*pfnKeySetOverstrikeMode)( int fActive );
void *(*pfnKeyGetState)( const char *name ); // for mlook, klook etc
// engine memory manager
void* (*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
// collect info from engine
int (*pfnGetGameInfo)( GAMEINFO *pgameinfo );
GAMEINFO **(*pfnGetGamesList)( int *numGames ); // collect info about all mods
char **(*pfnGetFilesList)( const char *pattern, int *numFiles, int gamedironly ); // find in files
int (*pfnGetSaveComment)( const char *savename, char *comment );
int (*pfnGetDemoComment)( const char *demoname, char *comment );
int (*pfnCheckGameDll)( void ); // returns false if hl.dll is missed or invalid
char *(*pfnGetClipboardData)( void );
// engine launcher
void (*pfnShellExecute)( const char *name, const char *args, int closeEngine );
void (*pfnWriteServerConfig)( const char *name );
void (*pfnChangeInstance)( const char *newInstance, const char *szFinalMessage );
void (*pfnPlayBackgroundTrack)( const char *introName, const char *loopName );
void (*pfnHostEndGame)( const char *szFinalMessage );
// menu interface is freezed at version 0.75
// new functions starts here
float (*pfnRandomFloat)( float flLow, float flHigh );
int (*pfnRandomLong)( int lLow, int lHigh );
void (*pfnSetCursor)( void *hCursor ); // change cursor
int (*pfnIsMapValid)( char *filename );
void (*pfnProcessImage)( int texnum, float gamma, int topColor, int bottomColor );
int (*pfnCompareFileTime)( char *filename1, char *filename2, int *iCompare );
} ui_enginefuncs_t;
typedef struct
{
int (*pfnVidInit)( void );
void (*pfnInit)( void );
void (*pfnShutdown)( void );
void (*pfnRedraw)( float flTime );
void (*pfnKeyEvent)( int key, int down );
void (*pfnMouseMove)( int x, int y );
void (*pfnSetActiveMenu)( int active );
void (*pfnAddServerToList)( struct netadr_s adr, const char *info );
void (*pfnGetCursorPos)( int *pos_x, int *pos_y );
void (*pfnSetCursorPos)( int pos_x, int pos_y );
void (*pfnShowCursor)( int show );
void (*pfnCharEvent)( int key );
int (*pfnMouseInRect)( void ); // mouse entering\leave game window
int (*pfnIsVisible)( void );
int (*pfnCreditsActive)( void ); // unused
void (*pfnFinalCredits)( void ); // show credits + game end
} UI_FUNCTIONS;
typedef int (*MENUAPI)( UI_FUNCTIONS *pFunctionTable, ui_enginefuncs_t* engfuncs, ui_globalvars_t *pGlobals );
#endif//MENU_INT_H

114
engine/physint.h

@ -1,114 +0,0 @@ @@ -1,114 +0,0 @@
/*
physint.h - Server Physics Interface
Copyright (C) 2011 Uncle Mike
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#pragma once
#ifndef PHYSINT_H
#define PHYSINT_H
#define SV_PHYSICS_INTERFACE_VERSION 6
#define STRUCT_FROM_LINK( l, t, m ) ((t *)((byte *)l - (int)&(((t *)0)->m)))
#define EDICT_FROM_AREA( l ) STRUCT_FROM_LINK( l, edict_t, area )
// values that can be returned with pfnServerState
#define SERVER_DEAD 0
#define SERVER_LOADING 1
#define SERVER_ACTIVE 2
typedef struct areanode_s
{
int axis; // -1 = leaf node
float dist;
struct areanode_s *children[2];
link_t trigger_edicts;
link_t solid_edicts;
link_t water_edicts; // func water
} areanode_t;
typedef struct server_physics_api_s
{
// unlink edict from old position and link onto new
void ( *pfnLinkEdict) ( edict_t *ent, qboolean touch_triggers );
double ( *pfnGetServerTime )( void ); // unclamped
double ( *pfnGetFrameTime )( void ); // unclamped
void* ( *pfnGetModel )( int modelindex );
areanode_t* ( *pfnGetHeadnode )( void ); // BSP tree for all physic entities
int ( *pfnServerState )( void );
void ( *pfnHost_Error )( const char *error, ... ); // cause Host Error
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 6
struct triangleapi_s *pTriAPI; // draw coliisions etc. Only for local system
// draw debug messages (must be called from DrawOrthoTriangles). Only for local system
int ( *pfnDrawConsoleString )( int x, int y, char *string );
void ( *pfnDrawSetTextColor )( float r, float g, float b );
void ( *pfnDrawConsoleStringLen )( const char *string, int *length, int *height );
void ( *Con_NPrintf )( int pos, char *fmt, ... );
void ( *Con_NXPrintf )( struct con_nprint_s *info, char *fmt, ... );
const char *( *pfnGetLightStyle )( int style ); // read custom appreance for selected lightstyle
void ( *pfnUpdateFogSettings )( unsigned int packed_fog );
char **(*pfnGetFilesList)( const char *pattern, int *numFiles, int gamedironly );
struct msurface_s *(*pfnTraceSurface)( edict_t *pTextureEntity, const float *v1, const float *v2 );
const byte *(*pfnGetTextureData)( unsigned int texnum );
// static allocations
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
} server_physics_api_t;
// physic callbacks
typedef struct physics_interface_s
{
int version;
// passed through pfnCreate (0 is attempt to create, -1 is reject)
int ( *SV_CreateEntity )( edict_t *pent, const char *szName );
// run custom physics for each entity (return 0 to use built-in engine physic)
int ( *SV_PhysicsEntity )( edict_t *pEntity );
// spawn entities with internal mod function e.g. for re-arrange spawn order (0 - use engine parser, 1 - use mod parser)
int ( *SV_LoadEntities )( const char *mapname, char *entities );
// update conveyor belt for clients
void ( *SV_UpdatePlayerBaseVelocity )( edict_t *ent );
// The game .dll should return 1 if save game should be allowed
int ( *SV_AllowSaveGame )( void );
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 6
// override trigger area checking and touching
int ( *SV_TriggerTouch )( edict_t *pent, edict_t *trigger );
// some engine features can be enabled only through this function
unsigned int ( *SV_CheckFeatures )( void );
// used for draw debug collisions for custom physic engine etc
void ( *DrawDebugTriangles )( void );
// used for draw debug overlay (textured)
void ( *DrawNormalTriangles )( void );
// used for draw debug messages (2d mode)
void ( *DrawOrthoTriangles )( void );
// tracing entities with SOLID_CUSTOM mode on a server (not used by pmove code)
void ( *ClipMoveToEntity)( edict_t *ent, const float *start, float *mins, float *maxs, const float *end, trace_t *trace );
// tracing entities with SOLID_CUSTOM mode on a server (only used by pmove code)
void ( *ClipPMoveToEntity)( struct physent_s *pe, const float *start, float *mins, float *maxs, const float *end, struct pmtrace_s *tr );
// called at end the frame of SV_Physics call
void ( *SV_EndFrame )( void );
// called through save\restore process
void (*pfnCreateEntitiesInTransitionList)( SAVERESTOREDATA*, int levelMask );
// called through save\restore process
void (*pfnCreateEntitiesInRestoreList)( SAVERESTOREDATA*, int createPlayers );
// allocate custom string (e.g. using user implementation of stringtable, not engine strings)
string_t (*pfnAllocString)( const char *szValue );
// make custom string (e.g. using user implementation of stringtable, not engine strings)
string_t (*pfnMakeString)( const char *szValue );
// read custom string (e.g. using user implementation of stringtable, not engine strings)
const char* (*pfnGetString)( string_t iString );
// helper for restore custom decals that have custom message (e.g. Paranoia)
int (*pfnRestoreDecal)( struct decallist_s *entry, edict_t *pEdict, qboolean adjacent );
} physics_interface_t;
#endif//PHYSINT_H

53
engine/warpsin.h

@ -1,53 +0,0 @@ @@ -1,53 +0,0 @@
/*
Copyright (C) 1997-2001 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.
*/
0.000000, 0.098165, 0.196270, 0.294259, 0.392069, 0.489643, 0.586920, 0.683850,
0.780360, 0.876405, 0.971920, 1.066850, 1.161140, 1.254725, 1.347560, 1.439580,
1.530735, 1.620965, 1.710220, 1.798445, 1.885585, 1.971595, 2.056410, 2.139990,
2.222280, 2.303235, 2.382795, 2.460925, 2.537575, 2.612690, 2.686235, 2.758160,
2.828425, 2.896990, 2.963805, 3.028835, 3.092040, 3.153385, 3.212830, 3.270340,
3.325880, 3.379415, 3.430915, 3.480350, 3.527685, 3.572895, 3.615955, 3.656840,
3.695520, 3.731970, 3.766175, 3.798115, 3.827760, 3.855105, 3.880125, 3.902810,
3.923140, 3.941110, 3.956705, 3.969920, 3.980740, 3.989160, 3.995180, 3.998795,
4.000000, 3.998795, 3.995180, 3.989160, 3.980740, 3.969920, 3.956705, 3.941110,
3.923140, 3.902810, 3.880125, 3.855105, 3.827760, 3.798115, 3.766175, 3.731970,
3.695520, 3.656840, 3.615955, 3.572895, 3.527685, 3.480350, 3.430915, 3.379415,
3.325880, 3.270340, 3.212830, 3.153385, 3.092040, 3.028835, 2.963805, 2.896990,
2.828425, 2.758160, 2.686235, 2.612690, 2.537575, 2.460925, 2.382795, 2.303235,
2.222280, 2.139990, 2.056410, 1.971595, 1.885585, 1.798445, 1.710220, 1.620965,
1.530735, 1.439580, 1.347560, 1.254725, 1.161140, 1.066850, 0.971920, 0.876405,
0.780360, 0.683850, 0.586920, 0.489643, 0.392069, 0.294259, 0.196270, 0.098165,
0.000000, -0.098165, -0.196270, -0.294259, -0.392069, -0.489643, -0.586920, -0.683850,
-0.780360, -0.876405, -0.971920, -1.066850, -1.161140, -1.254725, -1.347560, -1.439580,
-1.530735, -1.620965, -1.710220, -1.798445, -1.885585, -1.971595, -2.056410, -2.139990,
-2.222280, -2.303235, -2.382795, -2.460925, -2.537575, -2.612690, -2.686235, -2.758160,
-2.828425, -2.896990, -2.963805, -3.028835, -3.092040, -3.153385, -3.212830, -3.270340,
-3.325880, -3.379415, -3.430915, -3.480350, -3.527685, -3.572895, -3.615955, -3.656840,
-3.695520, -3.731970, -3.766175, -3.798115, -3.827760, -3.855105, -3.880125, -3.902810,
-3.923140, -3.941110, -3.956705, -3.969920, -3.980740, -3.989160, -3.995180, -3.998795,
-4.000000, -3.998795, -3.995180, -3.989160, -3.980740, -3.969920, -3.956705, -3.941110,
-3.923140, -3.902810, -3.880125, -3.855105, -3.827760, -3.798115, -3.766175, -3.731970,
-3.695520, -3.656840, -3.615955, -3.572895, -3.527685, -3.480350, -3.430915, -3.379415,
-3.325880, -3.270340, -3.212830, -3.153385, -3.092040, -3.028835, -2.963805, -2.896990,
-2.828425, -2.758160, -2.686235, -2.612690, -2.537575, -2.460925, -2.382795, -2.303235,
-2.222280, -2.139990, -2.056410, -1.971595, -1.885585, -1.798445, -1.710220, -1.620965,
-1.530735, -1.439580, -1.347560, -1.254725, -1.161140, -1.066850, -0.971920, -0.876405,
-0.780360, -0.683850, -0.586920, -0.489643, -0.392069, -0.294259, -0.196270, -0.098165,

12
public/build.h

@ -52,7 +52,7 @@ For more information, please refer to <http://unlicense.org/> @@ -52,7 +52,7 @@ For more information, please refer to <http://unlicense.org/>
#undef XASH_ARMv5
#undef XASH_ARMv6
#undef XASH_ARMv7
#undef XASH_BIG_ENDIAN
//#undef XASH_BIG_ENDIAN
#undef XASH_BSD
#undef XASH_E2K
#undef XASH_EMSCRIPTEN
@ -60,7 +60,7 @@ For more information, please refer to <http://unlicense.org/> @@ -60,7 +60,7 @@ For more information, please refer to <http://unlicense.org/>
#undef XASH_IOS
#undef XASH_JS
#undef XASH_LINUX
#undef XASH_LITTLE_ENDIAN
//#undef XASH_LITTLE_ENDIAN
#undef XASH_MINGW
#undef XASH_MIPS
#undef XASH_MOBILE_PLATFORM
@ -92,12 +92,14 @@ For more information, please refer to <http://unlicense.org/> @@ -92,12 +92,14 @@ For more information, please refer to <http://unlicense.org/>
#if defined(__ANDROID__)
#define XASH_ANDROID 1
#endif // defined(__ANDROID__)
#define XASH_POSIX 1
#elif defined(__APPLE__)
#include <TargetConditionals.h>
#define XASH_APPLE 1
#if TARGET_OS_IOS
#define XASH_IOS 1
#endif // TARGET_OS_IOS
#define XASH_POSIX 1
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#define XASH_BSD 1
#if defined(__FreeBSD__)
@ -107,8 +109,12 @@ For more information, please refer to <http://unlicense.org/> @@ -107,8 +109,12 @@ For more information, please refer to <http://unlicense.org/>
#elif defined(__OpenBSD__)
#define XASH_OPENBSD 1
#endif
#define XASH_POSIX 1
#elif defined __EMSCRIPTEN__
#define XASH_EMSCRIPTEN 1
#elif defined __WATCOMC__ && defined __DOS__
#define XASH_DOS4GW 1
#define XASH_LITTLE_ENDIAN
#else
#error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug"
#endif
@ -127,7 +133,7 @@ For more information, please refer to <http://unlicense.org/> @@ -127,7 +133,7 @@ For more information, please refer to <http://unlicense.org/>
#error "Both XASH_LITTLE_ENDIAN and XASH_BIG_ENDIAN are defined"
#endif
#if !defined(XASH_LITTLE_ENDIAN) || !defined(XASH_BIG_ENDIAN)
#if !defined(XASH_LITTLE_ENDIAN) && !defined(XASH_BIG_ENDIAN)
#if defined XASH_MSVC || __LITTLE_ENDIAN__
//!!! Probably all WinNT installations runs in little endian
#define XASH_LITTLE_ENDIAN 1

12
scripts/waifulib/library_naming.py

@ -49,7 +49,9 @@ DEFINES = [ @@ -49,7 +49,9 @@ DEFINES = [
'XASH_OPENBSD',
'XASH_WIN32',
'XASH_WIN64',
'XASH_X86'
'XASH_X86',
'XASH_DOS4GW',
'XASH_POSIX'
]
def configure(conf):
@ -75,8 +77,11 @@ def configure(conf): @@ -75,8 +77,11 @@ def configure(conf):
buildos = "openbsd"
elif conf.env.XASH_EMSCRIPTEN:
buildos = "emscripten"
elif conf.env.XASH_DOS4GW:
buildos = "dos4gw" # unused, just in case
else:
conf.fatal("Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug")
conf.fatal("Place your operating system name in build.h and library_naming.py!\n"
"If this is a mistake, try to fix conditions above and report a bug")
if conf.env.XASH_AMD64:
buildarch = "amd64"
@ -110,7 +115,8 @@ def configure(conf): @@ -110,7 +115,8 @@ def configure(conf):
elif conf.env.XASH_E2K:
buildarch = "e2k"
else:
raise conf.fatal("Place your architecture name here! If this is a mistake, try to fix conditions above and report a bug")
raise conf.fatal("Place your architecture name in build.h and library_naming.py!\n"
"If this is a mistake, try to fix conditions above and report a bug")
conf.env.revert()

18
wscript

@ -43,6 +43,9 @@ def options(opt): @@ -43,6 +43,9 @@ def options(opt):
grp.add_option('--enable-magx', action = 'store_true', dest = 'MAGX', default = False,
help = 'enable targetting for MotoMAGX phones [default: %default]')
grp.add_option('--enable-simple-mod-hacks', action = 'store_true', dest = 'ENABLE_MOD_HACKS', default = False,
help = 'enable hacks for simple mods that mostly compatible with Half-Life but has little changes. Enforced for Android. [default: %default]')
opt.load('xcompile compiler_cxx compiler_c clang_compilation_database strip_on_install')
if sys.platform == 'win32':
@ -70,7 +73,7 @@ def configure(conf): @@ -70,7 +73,7 @@ def configure(conf):
conf.fatal('Please set a build type, for example "-T release"')
elif not conf.options.BUILD_TYPE in valid_build_types:
conf.end_msg(conf.options.BUILD_TYPE, color='RED')
conf.fatal('Invalid build type. Valid are: %s' % valid_build_types.join(', '))
conf.fatal('Invalid build type. Valid are: %s' % ', '.join(valid_build_types))
conf.end_msg(conf.options.BUILD_TYPE)
# -march=native should not be used
@ -180,8 +183,6 @@ def configure(conf): @@ -180,8 +183,6 @@ def configure(conf):
compiler_optional_flags = [
'-fdiagnostics-color=always',
'-Werror=implicit-function-declaration',
'-Werror=int-conversion',
'-Werror=return-type',
'-Werror=parentheses',
'-Werror=vla',
@ -193,6 +194,8 @@ def configure(conf): @@ -193,6 +194,8 @@ def configure(conf):
]
c_compiler_optional_flags = [
'-Werror=implicit-function-declaration',
'-Werror=int-conversion',
'-Werror=implicit-int',
'-Werror=declaration-after-statement'
]
@ -246,10 +249,16 @@ def configure(conf): @@ -246,10 +249,16 @@ def configure(conf):
conf.define_cond('HAVE_TGMATH_H', tgmath_usable)
else:
conf.undefine('HAVE_TGMATH_H')
cmath_usable = conf.check_cxx(fragment='''#include<cmath>
int main(void){ return (int)sqrt(2.0f); }''',
msg='Checking if cmath is usable', mandatory = False)
conf.define_cond('HAVE_CMATH', cmath_usable)
if conf.env.COMPILER_CC == 'msvc':
conf.define('_CRT_SECURE_NO_WARNINGS', 1)
conf.define('_CRT_NONSTDC_NO_DEPRECATE', 1)
elif conf.env.COMPILER_CC == 'owcc':
pass
else:
conf.env.append_unique('DEFINES', ['stricmp=strcasecmp', 'strnicmp=strncasecmp', '_snprintf=snprintf', '_vsnprintf=vsnprintf', '_LINUX', 'LINUX'])
conf.env.append_unique('CXXFLAGS', ['-Wno-invalid-offsetof', '-fno-rtti', '-fno-exceptions'])
@ -263,6 +272,9 @@ def configure(conf): @@ -263,6 +272,9 @@ def configure(conf):
conf.define('CLIENT_WEAPONS', '1')
if conf.env.DEST_OS == 'android' or conf.options.ENABLE_MOD_HACKS:
conf.define('MOBILE_HACKS', '1')
conf.add_subproject(["cl_dll", "dlls"])
def build(bld):

Loading…
Cancel
Save