Skip to content

Commit

Permalink
sdk_includes: update
Browse files Browse the repository at this point in the history
  • Loading branch information
a1batross committed Jan 30, 2024
1 parent 446f452 commit de4402e
Show file tree
Hide file tree
Showing 7 changed files with 1,021 additions and 74 deletions.
2 changes: 1 addition & 1 deletion menus/AdvancedControls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void CAdvancedControls::GetConfig( )
if( EngFuncs::GetCvarFloat( "m_pitch" ) < 0 )
invertMouse.bChecked = true;

mlook = (kbutton_s *)EngFuncs::KEY_GetState( "in_mlook" );
mlook = (kbutton_t *)EngFuncs::KEY_GetState( "in_mlook" );
if( mlook )
{
if( mlook && mlook->state & 1 )
Expand Down
1 change: 1 addition & 0 deletions sdk_includes/common/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ enum
kRenderFxExplode, // Scale up really big!
kRenderFxGlowShell, // Glowing Shell
kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!)
kRenderFxLightMultiplier,
};

typedef int func_t;
Expand Down
39 changes: 28 additions & 11 deletions sdk_includes/common/kbutton.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
/*
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
#if !defined( KBUTTONH )
#define KBUTTONH
#pragma once
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.
typedef struct kbutton_s
*/
#ifndef KBUTTON_H
#define KBUTTON_H

// a1ba: copied from WinQuake/client.h
//
// cl_input
//
typedef struct
{
int down[2]; // key nums holding it down
int state; // low bit is down state
} kbutton_t;

#endif // !KBUTTONH
STATIC_ASSERT( sizeof( kbutton_t ) == 12, "kbutton_t isn't 12 bytes!" );

#endif // KBUTTON_H
110 changes: 54 additions & 56 deletions sdk_includes/common/netadr.h
Original file line number Diff line number Diff line change
@@ -1,76 +1,74 @@
/***
*
* 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.
*
****/

#ifndef NETADR_H
#define NETADR_H

#include "build.h"
/*
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.
*/

#ifndef NET_ADR_H
#define NET_ADR_H

#include STDINT_H

typedef enum
// net.h -- quake's interface to the networking layer
// a1ba: copied from Quake-2/qcommon/qcommon.h and modified to support IPv6

#define PORT_ANY -1

typedef enum {NA_LOOPBACK = 1, NA_BROADCAST, NA_IP, NA_IPX, NA_BROADCAST_IPX, NA_IP6, NA_MULTICAST_IP6} netadrtype_t;

/*
Original Quake-2 structure:
typedef struct
{
NA_UNUSED = 0,
NA_LOOPBACK,
NA_BROADCAST,
NA_IP,
NA_IPX,
NA_BROADCAST_IPX,
NA_IP6,
NA_MULTICAST_IP6, // all nodes multicast
} netadrtype_t;

// Original structure:
// typedef struct netadr_s
// {
// netadrtype_t type;
// unsigned char ip[4];
// unsigned char ipx[10];
// unsigned short port;
// } netadr_t;
netadrtype_t type;
byte ip[4];
byte ipx[10];
unsigned short port;
} netadr_t;
*/

#pragma pack( push, 1 )
typedef struct netadr_s
{
union
{
// IPv6 struct
struct
{
uint32_t type;
union
{
uint8_t ip[4];
uint32_t ip4;
};
uint8_t ipx[10];
uint16_t type6;
uint8_t ip6[16];
};
struct
{
#if XASH_LITTLE_ENDIAN
uint16_t type6;
uint8_t ip6[16];
#elif XASH_BIG_ENDIAN
uint8_t ip6_0[2];
uint16_t type6;
uint8_t ip6_2[14];
#endif
uint32_t type; // must be netadrtype_t but will break with short enums
union
{
uint8_t ip[4];
uint32_t ip4; // for easier conversions
};
uint8_t ipx[10];
};
};
uint16_t port;
uint16_t port;
} netadr_t;
#pragma pack( pop )

STATIC_ASSERT( sizeof( netadr_t ) == 20, "invalid netadr_t size" );
STATIC_ASSERT( sizeof( netadr_t ) == 20, "netadr_t isn't 20 bytes!" );

#endif//NETADR_H
#endif // NET_ADR_H
23 changes: 17 additions & 6 deletions sdk_includes/common/xash3d_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ typedef uint64_t longtime_t;

#define BIT( n ) ( 1U << ( n ))
#define BIT64( n ) ( 1ULL << ( n ))
#define GAMMA ( 2.2f ) // Valve Software gamma
#define INVGAMMA ( 1.0f / 2.2f ) // back to 1.0
#define TEXGAMMA ( 0.9f ) // compensate dim textures
#define SetBits( iBitVector, bits ) ((iBitVector) = (iBitVector) | (bits))
#define ClearBits( iBitVector, bits ) ((iBitVector) = (iBitVector) & ~(bits))
#define FBitSet( iBitVector, bit ) ((iBitVector) & (bit))
Expand Down Expand Up @@ -89,20 +86,26 @@ typedef uint64_t longtime_t;
#define NORETURN __attribute__((noreturn))
#define NONNULL __attribute__((nonnull))
#define ALLOC_CHECK(x) __attribute__((alloc_size(x)))
#define FORCEINLINE inline __attribute__((always_inline))
#define NOINLINE __attribute__((noinline))
#elif defined(_MSC_VER)
#define EXPORT __declspec( dllexport )
#define GAME_EXPORT
#define _format(x)
#define NORETURN
#define NONNULL
#define ALLOC_CHECK(x)
#define FORCEINLINE __forceinline
#define NOINLINE __declspec( noinline )
#else
#define EXPORT
#define GAME_EXPORT
#define _format(x)
#define NORETURN
#define NONNULL
#define ALLOC_CHECK(x)
#define FORCEINLINE
#define NOINLINE
#endif

#if ( __GNUC__ >= 3 )
Expand All @@ -121,10 +124,18 @@ typedef uint64_t longtime_t;
#define likely(x) (x)
#endif

#if defined( static_assert ) // C11 static_assert
#define STATIC_ASSERT static_assert
#if __STDC_VERSION__ >= 202311L || __cplusplus >= 201103L // C23 or C++ static_assert is a keyword
#define STATIC_ASSERT_( ignore, x, y ) static_assert( x, y )
#define STATIC_ASSERT static_assert
#elif __STDC_VERSION__ >= 201112L // in C11 it's _Static_assert
#define STATIC_ASSERT_( ignore, x, y ) _Static_assert( x, y )
#define STATIC_ASSERT _Static_assert
#else
#define STATIC_ASSERT( x, y ) extern int _static_assert_##__LINE__[( x ) ? 1 : -1]
#define STATIC_ASSERT_( id, x, y ) extern int id[( x ) ? 1 : -1]
// need these to correctly expand the line macro
#define STATIC_ASSERT_3( line, x, y ) STATIC_ASSERT_( static_assert_ ## line, x, y )
#define STATIC_ASSERT_2( line, x, y ) STATIC_ASSERT_3( line, x, y )
#define STATIC_ASSERT( x, y ) STATIC_ASSERT_2( __LINE__, x, y )
#endif

#ifdef XASH_BIG_ENDIAN
Expand Down
1 change: 1 addition & 0 deletions sdk_includes/copy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ FILES_LIST=" \
engine/mobility_int.h \
public/build.h \
public/buildenums.h \
public/pstdint.h \
pm_shared/pm_info.h \
"

Expand Down
Loading

0 comments on commit de4402e

Please sign in to comment.