2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-01 01:25:38 +03:00

enum-like defines -> enums

This commit is contained in:
Sh1ft0x0EF 2017-02-18 22:53:56 +04:00
parent 774e065278
commit 77482953d9
9 changed files with 89 additions and 61 deletions

View File

@ -910,12 +910,13 @@ typedef struct modfuncs_s
int m_nVoid9; int m_nVoid9;
} modfuncs_t; } modfuncs_t;
enum
#define k_nEngineVersion15Base 0 {
#define k_nEngineVersion15Patch 1 k_nEngineVersion15Base = 0,
#define k_nEngineVersion16Base 2 k_nEngineVersion15Patch,
#define k_nEngineVersion16Validated 3 // 1.6 engine with built-in validation k_nEngineVersion16Base,
k_nEngineVersion16Validated // 1.6 engine with built-in validation
};
typedef struct validator_s typedef struct validator_s
{ {

View File

@ -32,8 +32,11 @@ extern "C" {
typedef int HSPRITE_t; // handle to a graphic typedef int HSPRITE_t; // handle to a graphic
#define SCRINFO_SCREENFLASH 1 enum
#define SCRINFO_STRETCHED 2 {
SCRINFO_SCREENFLASH = 1,
SCRINFO_STRETCHED
};
typedef struct SCREENINFO_s typedef struct SCREENINFO_s
{ {

View File

@ -32,15 +32,19 @@
#define DELTA_MAX_FIELDS 56 // 7*8 #define DELTA_MAX_FIELDS 56 // 7*8
#define DT_BYTE BIT(0) // A byte enum
#define DT_SHORT BIT(1) // 2 byte field {
#define DT_FLOAT BIT(2) // A floating point field DT_BYTE = BIT(0), // A byte
#define DT_INTEGER BIT(3) // 4 byte integer DT_SHORT = BIT(1), // 2 byte field
#define DT_ANGLE BIT(4) // A floating point angle DT_FLOAT = BIT(2), // A floating point field
#define DT_TIMEWINDOW_8 BIT(5) // A floating point timestamp relative to server time DT_INTEGER = BIT(3), // 4 byte integer
#define DT_TIMEWINDOW_BIG BIT(6) // A floating point timestamp relative to server time (with more precision and custom multiplier) DT_ANGLE = BIT(4), // A floating point angle
#define DT_STRING BIT(7) // A null terminated string, sent as 8 byte chars DT_TIMEWINDOW_8 = BIT(5), // A floating point timestamp relative to server time
#define DT_SIGNED BIT(31) // sign modificator DT_TIMEWINDOW_BIG = BIT(6), // A floating point timestamp relative to server time (with more precision and custom multiplier)
DT_STRING = BIT(7), // A null terminated string, sent as 8 byte chars
DT_SIGNED = BIT(31) // sign modificator
};
#define FDT_MARK BIT(0) // Delta mark for sending #define FDT_MARK BIT(0) // Delta mark for sending

View File

@ -31,12 +31,12 @@
#include "maintypes.h" #include "maintypes.h"
#include "model.h" #include "model.h"
// up / down enum
#define PITCH 0 {
// left / right PITCH = 0, // up / down
#define YAW 1 YAW, // left / right
// fall over ROLL // fall over
#define ROLL 2 };
#define RAD2DEG(x) ((float)(x) * (float)(180.f / M_PI)) #define RAD2DEG(x) ((float)(x) * (float)(180.f / M_PI))
#define DEG2RAD(x) ((float)(x) * (float)(M_PI / 180.f)) #define DEG2RAD(x) ((float)(x) * (float)(M_PI / 180.f))

View File

@ -40,9 +40,12 @@ cachewad_t ad_wad;
mod_known_info_t mod_known_info[MAX_KNOWN_MODELS]; mod_known_info_t mod_known_info[MAX_KNOWN_MODELS];
// values for model_t's needload // values for model_t's needload
#define NL_PRESENT 0 enum
#define NL_NEEDS_LOADED 1 {
#define NL_UNREFERENCED 2 NL_PRESENT = 0,
NL_NEEDS_LOADED,
NL_UNREFERENCED
};
void SW_Mod_Init(void) void SW_Mod_Init(void)
{ {

View File

@ -82,7 +82,13 @@
#define M2A_CHALLENGE 's' // + challenge value #define M2A_CHALLENGE 's' // + challenge value
// 0 == regular, 1 == file stream // 0 == regular, 1 == file stream
#define MAX_STREAMS 2 enum
{
FRAG_NORMAL_STREAM = 0,
FRAG_FILE_STREAM,
MAX_STREAMS
};
// Flow control bytes per second limits // Flow control bytes per second limits
#define MAX_RATE 100000.0f #define MAX_RATE 100000.0f
@ -214,10 +220,13 @@ typedef enum clc_commands_e
clc_endoflist = 255, clc_endoflist = 255,
} clc_commands_t; } clc_commands_t;
#define MAX_FLOWS 2 enum
{
#define FLOW_OUTGOING 0 FLOW_OUTGOING = 0,
#define FLOW_INCOMING 1 FLOW_INCOMING,
MAX_FLOWS
};
// Message data // Message data
typedef struct flowstats_s typedef struct flowstats_s
@ -268,9 +277,6 @@ typedef struct flow_s
#define UDP_HEADER_SIZE 28 #define UDP_HEADER_SIZE 28
#define MAX_RELIABLE_PAYLOAD 1200 #define MAX_RELIABLE_PAYLOAD 1200
#define FRAG_NORMAL_STREAM 0
#define FRAG_FILE_STREAM 1
#define MAKE_FRAGID(id,count) ( ( ( id & 0xffff ) << 16 ) | ( count & 0xffff ) ) #define MAKE_FRAGID(id,count) ( ( ( id & 0xffff ) << 16 ) | ( count & 0xffff ) )
#define FRAG_GETID(fragid) ( ( fragid >> 16 ) & 0xffff ) #define FRAG_GETID(fragid) ( ( fragid >> 16 ) & 0xffff )
#define FRAG_GETCOUNT(fragid) ( fragid & 0xffff ) #define FRAG_GETCOUNT(fragid) ( fragid & 0xffff )

View File

@ -37,14 +37,17 @@
#define MAX_RANDOM_RANGE 0x7FFFFFFFUL #define MAX_RANDOM_RANGE 0x7FFFFFFFUL
// TODO: Make enum with bits // Ambient sound flags
#define AMBIENT_SOUND_STATIC 0 // medium radius attenuation enum
#define AMBIENT_SOUND_EVERYWHERE 1 {
#define AMBIENT_SOUND_SMALLRADIUS 2 AMBIENT_SOUND_STATIC = 0, // medium radius attenuation
#define AMBIENT_SOUND_MEDIUMRADIUS 4 AMBIENT_SOUND_EVERYWHERE = BIT(0),
#define AMBIENT_SOUND_LARGERADIUS 8 AMBIENT_SOUND_SMALLRADIUS = BIT(1),
#define AMBIENT_SOUND_START_SILENT 16 AMBIENT_SOUND_MEDIUMRADIUS = BIT(2),
#define AMBIENT_SOUND_NOT_LOOPING 32 AMBIENT_SOUND_LARGERADIUS = BIT(3),
AMBIENT_SOUND_START_SILENT = BIT(4),
AMBIENT_SOUND_NOT_LOOPING = BIT(5)
};
#define SPEAKER_START_SILENT 1 // wait for trigger 'on' to start announcements #define SPEAKER_START_SILENT 1 // wait for trigger 'on' to start announcements
@ -88,8 +91,11 @@ extern vec3_t vec_origin;
extern int r_visframecount; extern int r_visframecount;
#define GROUP_OP_AND 0 enum
#define GROUP_OP_NAND 1 {
GROUP_OP_AND = 0,
GROUP_OP_NAND
};
void PF_makevectors_I(const float *rgflVector); void PF_makevectors_I(const float *rgflVector);
float PF_Time(void); float PF_Time(void);

View File

@ -59,22 +59,28 @@
#define DEFAULT_SOUND_PACKET_PITCH 100 #define DEFAULT_SOUND_PACKET_PITCH 100
// Sound flags // Sound flags
#define SND_FL_VOLUME BIT(0) // send volume enum
#define SND_FL_ATTENUATION BIT(1) // send attenuation {
#define SND_FL_LARGE_INDEX BIT(2) // send sound number as short instead of byte SND_FL_VOLUME = BIT(0), // send volume
#define SND_FL_PITCH BIT(3) // send pitch SND_FL_ATTENUATION = BIT(1), // send attenuation
#define SND_FL_SENTENCE BIT(4) // set if sound num is actually a sentence num SND_FL_LARGE_INDEX = BIT(2), // send sound number as short instead of byte
#define SND_FL_STOP BIT(5) // stop the sound SND_FL_PITCH = BIT(3), // send pitch
#define SND_FL_CHANGE_VOL BIT(6) // change sound vol SND_FL_SENTENCE = BIT(4), // set if sound num is actually a sentence num
#define SND_FL_CHANGE_PITCH BIT(7) // change sound pitch SND_FL_STOP = BIT(5), // stop the sound
#define SND_FL_SPAWNING BIT(8) // we're spawning, used in some cases for ambients (not sent across network) SND_FL_CHANGE_VOL = BIT(6), // change sound vol
SND_FL_CHANGE_PITCH = BIT(7), // change sound pitch
SND_FL_SPAWNING = BIT(8) // we're spawning, used in some cases for ambients (not sent across network)
};
// Message send destination flags // Message send destination flags
#define MSG_FL_NONE 0 // No flags enum
#define MSG_FL_BROADCAST BIT(0) // Broadcast? {
#define MSG_FL_PVS BIT(1) // Send to PVS MSG_FL_NONE = 0, // No flags
#define MSG_FL_PAS BIT(2) // Send to PAS MSG_FL_BROADCAST = BIT(0), // Broadcast?
#define MSG_FL_ONE BIT(7) // Send to single client MSG_FL_PVS = BIT(1), // Send to PVS
MSG_FL_PAS = BIT(2), // Send to PAS
MSG_FL_ONE = BIT(7), // Send to single client
};
#define RESOURCE_INDEX_BITS 12 #define RESOURCE_INDEX_BITS 12

View File

@ -32,9 +32,8 @@
#include "igame.h" #include "igame.h"
#include "iengine.h" #include "iengine.h"
// sleep time when not focus const int MINIMIZED_SLEEP = 20;
#define NOT_FOCUS_SLEEP 50 const int NOT_FOCUS_SLEEP = 50; // sleep time when not focus
#define MINIMIZED_SLEEP 20
#ifdef HOOK_ENGINE #ifdef HOOK_ENGINE
#define game (*pgame) #define game (*pgame)