Skip to content

Commit

Permalink
Update ReHLDS API 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Adidasman1 committed Dec 12, 2016
1 parent c8311da commit 08dd8df
Show file tree
Hide file tree
Showing 46 changed files with 522 additions and 329 deletions.
3 changes: 3 additions & 0 deletions dep/rehlsdk/common/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
#define FL_KILLME (1<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time
#define FL_DORMANT (1<<31) // Entity is dormant, no updates to client

// SV_EmitSound2 flags
#define SND_EMIT2_NOPAS (1<<0) // never to do check PAS
#define SND_EMIT2_INVOKER (1<<1) // do not send to the client invoker

// Engine edict->spawnflags
#define SF_NOTINDEATHMATCH 0x0800 // Do not spawn when deathmatch and loading entities from a file
Expand Down
3 changes: 0 additions & 3 deletions dep/rehlsdk/common/kbutton.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,10 @@
#pragma once
#endif


/* <31b2a> ../common/kbutton.h:7 */
typedef struct kbutton_s
{
int down[2];
int state;
} kbutton_t;


#endif // KBUTTON_H
97 changes: 77 additions & 20 deletions dep/rehlsdk/common/mathlib.h
Original file line number Diff line number Diff line change
@@ -1,37 +1,47 @@
/***
/*
*
* 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.
* 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.
*
* 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.
* 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
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/

#ifndef MATHLIB_H
#define MATHLIB_H
#ifdef _WIN32
#pragma once
#endif


/* <42b7f> ../common/mathlib.h:3 */
typedef float vec_t;

/* <42b91> ../common/mathlib.h:6 */
#ifndef DID_VEC3_T_DEFINE
#if !defined DID_VEC3_T_DEFINE && !defined vec3_t
#define DID_VEC3_T_DEFINE
typedef vec_t vec3_t[3];
#endif

/* <80013> ../common/mathlib.h:8 */
typedef vec_t vec4_t[4];
typedef int fixed16_t;

/* <42bac> ../common/mathlib.h:18 */
typedef int fixed16_t; /* size: 4 */

/* <42bb7> ../common/mathlib.h:60 */
typedef union DLONG_u
{
int i[2];
Expand All @@ -41,6 +51,50 @@ typedef union DLONG_u

#define M_PI 3.14159265358979323846

#ifdef __cplusplus
#ifdef min
#undef min
#endif

#ifdef max
#undef max
#endif

#ifdef clamp
#undef clamp
#endif

template <typename T>
inline T min(T a, T b) {
return (a < b) ? a : b;
}

template <typename T>
inline T max(T a, T b) {
return (a < b) ? b : a;
}

template <typename T>
inline T clamp(T a, T min, T max) {
return (a > max) ? max : (a < min) ? min : a;
}

template <typename T>
inline T bswap(T s) {
switch (sizeof(T)) {
#ifdef _WIN32
case 2: {auto res = _byteswap_ushort(*(uint16 *)&s); return *(T *)&res;}
case 4: {auto res = _byteswap_ulong(*(uint32 *)(&s)); return *(T *)&res;}
case 8: {auto res = _byteswap_uint64(*(uint64 *)&s); return *(T *)&res;}
#else
case 2: {auto res = _bswap16(*(uint16 *)&s); return *(T *)&res;}
case 4: {auto res = _bswap(*(uint32 *)&s); return *(T *)&res;}
case 8: {auto res = _bswap64(*(uint64 *)&s); return *(T *)&res;}
#endif
default: return s;
}
}
#else // __cplusplus
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
Expand All @@ -50,3 +104,6 @@ typedef union DLONG_u
#endif

#define clamp(val, min, max) (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val)))
#endif // __cplusplus

#endif // MATHLIB_H
10 changes: 5 additions & 5 deletions dep/rehlsdk/common/netadr.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* without written permission from Valve LLC.
*
****/
// netadr.h

#ifndef NETADR_H
#define NETADR_H
#ifdef _WIN32
Expand All @@ -31,10 +31,10 @@ typedef enum

typedef struct netadr_s
{
netadrtype_t type;
unsigned char ip[4];
unsigned char ipx[10];
unsigned short port;
netadrtype_t type;
unsigned char ip[4];
unsigned char ipx[10];
unsigned short port;
} netadr_t;

#endif // NETADR_H
6 changes: 5 additions & 1 deletion dep/rehlsdk/common/qlimits.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,19 @@
#define MAX_LIGHTSTYLE_INDEX_BITS 6
#define MAX_LIGHTSTYLES (1<<MAX_LIGHTSTYLE_INDEX_BITS)

// Resource counts;
// Resource counts
#define MAX_MODEL_INDEX_BITS 9 // sent as a short
#define MAX_MODELS (1<<MAX_MODEL_INDEX_BITS)
#define MAX_SOUND_INDEX_BITS 9
#define MAX_SOUNDS (1<<MAX_SOUND_INDEX_BITS)
#define MAX_SOUNDS_HASHLOOKUP_SIZE (MAX_SOUNDS * 2 - 1)

#define MAX_GENERIC_INDEX_BITS 9
#define MAX_GENERIC (1<<MAX_GENERIC_INDEX_BITS)
#define MAX_DECAL_INDEX_BITS 9
#define MAX_BASE_DECALS (1<<MAX_DECAL_INDEX_BITS)

#define MAX_EVENTS 256
#define MAX_PACKET_ENTITIES 256 // 256 visible entities per frame

#endif // QLIMITS_H
5 changes: 1 addition & 4 deletions dep/rehlsdk/common/quakedef.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,15 @@
*/
#pragma once

/* <19039> ../common/quakedef.h:29 */
typedef int BOOL; /* size: 4 */
typedef int BOOL;

// user message
#define MAX_USER_MSG_DATA 192

/* <627f> ../common/quakedef.h:137 */
//moved to com_model.h
//typedef struct cache_user_s
//{
// void *data;
//} cache_user_t;

/* <4313b> ../common/quakedef.h:162 */
typedef int (*pfnUserMsgHook)(const char *, int, void *);
2 changes: 0 additions & 2 deletions dep/rehlsdk/common/vmodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
*/
#pragma once


/* <430ee> ../common/vmodes.h:40 */
typedef struct rect_s
{
int left, right, top, bottom;
Expand Down
45 changes: 18 additions & 27 deletions dep/rehlsdk/engine/bspfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,46 +27,47 @@
*/
#pragma once

#define BSPVERSION 30
// header
#define Q1BSP_VERSION 29 // quake1 regular version (beta is 28)
#define HLBSP_VERSION 30 // half-life regular version

#define MAX_MAP_HULLS 4

#define CONTENTS_ORIGIN -7 // removed at csg time
#define CONTENTS_CLIP -8 // changed to contents_solid
#define CONTENTS_CURRENT_0 -9
#define CONTENTS_CURRENT_90 -10
#define CONTENTS_CURRENT_0 -9
#define CONTENTS_CURRENT_90 -10
#define CONTENTS_CURRENT_180 -11
#define CONTENTS_CURRENT_270 -12
#define CONTENTS_CURRENT_UP -13
#define CONTENTS_CURRENT_UP -13
#define CONTENTS_CURRENT_DOWN -14

#define CONTENTS_TRANSLUCENT -15

#define LUMP_ENTITIES 0
#define LUMP_ENTITIES 0
#define LUMP_PLANES 1
#define LUMP_TEXTURES 2
#define LUMP_VERTEXES 3
#define LUMP_VISIBILITY 4
#define LUMP_TEXTURES 2
#define LUMP_VERTEXES 3
#define LUMP_VISIBILITY 4
#define LUMP_NODES 5
#define LUMP_TEXINFO 6
#define LUMP_TEXINFO 6
#define LUMP_FACES 7
#define LUMP_LIGHTING 8
#define LUMP_CLIPNODES 9
#define LUMP_LIGHTING 8
#define LUMP_CLIPNODES 9
#define LUMP_LEAFS 10
#define LUMP_MARKSURFACES 11
#define LUMP_MARKSURFACES 11
#define LUMP_EDGES 12
#define LUMP_SURFEDGES 13
#define LUMP_SURFEDGES 13
#define LUMP_MODELS 14

#define HEADER_LUMPS 15
#define HEADER_LUMPS 15

/* <a1fc> ../engine/bspfile.h:41 */
typedef struct lump_s
typedef struct lump_s
{
int fileofs;
int filelen;
} lump_t;

/* <a22c> ../engine/bspfile.h:64 */
typedef struct dmodel_s
{
float mins[3], maxs[3];
Expand All @@ -76,21 +77,18 @@ typedef struct dmodel_s
int firstface, numfaces;
} dmodel_t;

/* <a2c2> ../engine/bspfile.h:73 */
typedef struct dheader_s
{
int version;
lump_t lumps[15];
} dheader_t;

/* <485b2> ../engine/bspfile.h:79 */
typedef struct dmiptexlump_s
{
int _nummiptex;
int dataofs[4];
} dmiptexlump_t;

/* <1ce18> ../engine/bspfile.h:86 */
typedef struct miptex_s
{
char name[16];
Expand All @@ -99,21 +97,18 @@ typedef struct miptex_s
unsigned offsets[4];
} miptex_t;

/* <48652> ../engine/bspfile.h:94 */
typedef struct dvertex_s
{
float point[3];
} dvertex_t;

/* <48674> ../engine/bspfile.h:110 */
typedef struct dplane_s
{
float normal[3];
float dist;
int type;
} dplane_t;

/* <486b2> ../engine/bspfile.h:132 */
typedef struct dnode_s
{
int planenum;
Expand All @@ -124,28 +119,24 @@ typedef struct dnode_s
unsigned short numfaces;
} dnode_t;

/* <a332> ../engine/bspfile.h:142 */
typedef struct dclipnode_s
{
int planenum;
short children[2]; // negative numbers are contents
} dclipnode_t;

/* <4876a> ../engine/bspfile.h:149 */
typedef struct texinfo_s
{
float vecs[2][4];
int _miptex;
int flags;
} texinfo_t;

/* <487c2> ../engine/bspfile.h:159 */
typedef struct dedge_s
{
unsigned short v[2];
} dedge_t;

/* <487f2> ../engine/bspfile.h:165 */
typedef struct dface_s
{
short planenum;
Expand Down
4 changes: 0 additions & 4 deletions dep/rehlsdk/engine/cmd_rehlds.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@

#include "archtypes.h"

/* <8f1> ../engine/cmd.h:65 */
typedef void(*xcommand_t)(void);

/* <904> ../engine/cmd.h:71 */
typedef struct cmd_function_s
{
struct cmd_function_s *next;
Expand All @@ -41,7 +38,6 @@ typedef struct cmd_function_s
int flags;
} cmd_function_t;

/* <95a> ../engine/cmd.h:80 */
typedef enum cmd_source_s
{
src_client = 0, // came in over a net connection as a clc_stringcmd. host_client will be valid during this state.
Expand Down
Loading

0 comments on commit 08dd8df

Please sign in to comment.