Merge pull request #372 from Sh1ft0x0EF/coderev-generic

enum-like defines -> enums
This commit is contained in:
Lev 2017-02-19 10:20:09 +05:00 committed by GitHub
commit f1e6b6ca40
9 changed files with 89 additions and 61 deletions

View File

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

View File

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

View File

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

View File

@ -31,12 +31,12 @@
#include "maintypes.h"
#include "model.h"
// up / down
#define PITCH 0
// left / right
#define YAW 1
// fall over
#define ROLL 2
enum
{
PITCH = 0, // up / down
YAW, // left / right
ROLL // fall over
};
#define RAD2DEG(x) ((float)(x) * (float)(180.f / M_PI))
#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];
// values for model_t's needload
#define NL_PRESENT 0
#define NL_NEEDS_LOADED 1
#define NL_UNREFERENCED 2
enum
{
NL_PRESENT = 0,
NL_NEEDS_LOADED,
NL_UNREFERENCED
};
void SW_Mod_Init(void)
{

View File

@ -82,7 +82,13 @@
#define M2A_CHALLENGE 's' // + challenge value
// 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
#define MAX_RATE 100000.0f
@ -214,10 +220,13 @@ typedef enum clc_commands_e
clc_endoflist = 255,
} clc_commands_t;
#define MAX_FLOWS 2
#define FLOW_OUTGOING 0
#define FLOW_INCOMING 1
enum
{
FLOW_OUTGOING = 0,
FLOW_INCOMING,
MAX_FLOWS
};
// Message data
typedef struct flowstats_s
@ -268,9 +277,6 @@ typedef struct flow_s
#define UDP_HEADER_SIZE 28
#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 FRAG_GETID(fragid) ( ( fragid >> 16 ) & 0xffff )
#define FRAG_GETCOUNT(fragid) ( fragid & 0xffff )

View File

@ -37,14 +37,17 @@
#define MAX_RANDOM_RANGE 0x7FFFFFFFUL
// TODO: Make enum with bits
#define AMBIENT_SOUND_STATIC 0 // medium radius attenuation
#define AMBIENT_SOUND_EVERYWHERE 1
#define AMBIENT_SOUND_SMALLRADIUS 2
#define AMBIENT_SOUND_MEDIUMRADIUS 4
#define AMBIENT_SOUND_LARGERADIUS 8
#define AMBIENT_SOUND_START_SILENT 16
#define AMBIENT_SOUND_NOT_LOOPING 32
// Ambient sound flags
enum
{
AMBIENT_SOUND_STATIC = 0, // medium radius attenuation
AMBIENT_SOUND_EVERYWHERE = BIT(0),
AMBIENT_SOUND_SMALLRADIUS = BIT(1),
AMBIENT_SOUND_MEDIUMRADIUS = BIT(2),
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
@ -88,8 +91,11 @@ extern vec3_t vec_origin;
extern int r_visframecount;
#define GROUP_OP_AND 0
#define GROUP_OP_NAND 1
enum
{
GROUP_OP_AND = 0,
GROUP_OP_NAND
};
void PF_makevectors_I(const float *rgflVector);
float PF_Time(void);

View File

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

View File

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