summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/event.h81
-rw-r--r--src/common/global.h64
-rw-r--r--src/common/iman.h5
-rw-r--r--src/common/metafile.h12
-rw-r--r--src/common/misc.h26
-rw-r--r--src/common/modfile.cpp7
-rw-r--r--src/common/modfile.h15
-rw-r--r--src/common/profile.h4
-rw-r--r--src/common/restext.cpp5
-rw-r--r--src/common/restext.h199
-rw-r--r--src/common/struct.h2
11 files changed, 206 insertions, 214 deletions
diff --git a/src/common/event.h b/src/common/event.h
index e2ec120..bf17934 100644
--- a/src/common/event.h
+++ b/src/common/event.h
@@ -34,7 +34,7 @@
class CInstanceManager;
-#define MAXEVENT 100
+const int MAXEVENT = 100;
// Events.
@@ -528,7 +528,7 @@ enum EventMsg
EVENT_FORCE_DWORD = 0x7fffffff
};
-typedef struct
+struct Event
{
EventMsg event; // event (EVENT *)
long param; // parameter
@@ -538,45 +538,44 @@ typedef struct
float axeZ; // control the Z axis (-1 .. 1)
short keyState; // state of the keyboard (KS_ *)
float rTime; // relative time
-}
-Event;
-
-
-#define VK_BUTTON1 (0x100+1) // joystick button 1
-#define VK_BUTTON2 (0x100+2) // joystick button 2
-#define VK_BUTTON3 (0x100+3) // joystick button 3
-#define VK_BUTTON4 (0x100+4) // joystick button 4
-#define VK_BUTTON5 (0x100+5) // joystick button 5
-#define VK_BUTTON6 (0x100+6) // joystick button 6
-#define VK_BUTTON7 (0x100+7) // joystick button 7
-#define VK_BUTTON8 (0x100+8) // joystick button 8
-#define VK_BUTTON9 (0x100+9) // joystick button 9
-#define VK_BUTTON10 (0x100+10) // joystick button 10
-#define VK_BUTTON11 (0x100+11) // joystick button 11
-#define VK_BUTTON12 (0x100+12) // joystick button 12
-#define VK_BUTTON13 (0x100+13) // joystick button 13
-#define VK_BUTTON14 (0x100+14) // joystick button 14
-#define VK_BUTTON15 (0x100+15) // joystick button 15
-#define VK_BUTTON16 (0x100+16) // joystick button 16
-#define VK_BUTTON17 (0x100+17) // joystick button 17
-#define VK_BUTTON18 (0x100+18) // joystick button 18
-#define VK_BUTTON19 (0x100+19) // joystick button 19
-#define VK_BUTTON20 (0x100+20) // joystick button 20
-#define VK_BUTTON21 (0x100+21) // joystick button 21
-#define VK_BUTTON22 (0x100+22) // joystick button 22
-#define VK_BUTTON23 (0x100+23) // joystick button 23
-#define VK_BUTTON24 (0x100+24) // joystick button 24
-#define VK_BUTTON25 (0x100+25) // joystick button 25
-#define VK_BUTTON26 (0x100+26) // joystick button 26
-#define VK_BUTTON27 (0x100+27) // joystick button 27
-#define VK_BUTTON28 (0x100+28) // joystick button 28
-#define VK_BUTTON29 (0x100+29) // joystick button 29
-#define VK_BUTTON30 (0x100+30) // joystick button 30
-#define VK_BUTTON31 (0x100+31) // joystick button 31
-#define VK_BUTTON32 (0x100+32) // joystick button 32
-
-#define VK_WHEELUP (0x200+1) // Mousewheel up
-#define VK_WHEELDOWN (0x200+2) // Mousewheel down
+};
+
+
+const int VK_BUTTON1 = (0x100+1); // joystick button 1
+const int VK_BUTTON2 = (0x100+2); // joystick button 2
+const int VK_BUTTON3 = (0x100+3); // joystick button 3
+const int VK_BUTTON4 = (0x100+4); // joystick button 4
+const int VK_BUTTON5 = (0x100+5); // joystick button 5
+const int VK_BUTTON6 = (0x100+6); // joystick button 6
+const int VK_BUTTON7 = (0x100+7); // joystick button 7
+const int VK_BUTTON8 = (0x100+8); // joystick button 8
+const int VK_BUTTON9 = (0x100+9); // joystick button 9
+const int VK_BUTTON10 = (0x100+10); // joystick button 10
+const int VK_BUTTON11 = (0x100+11); // joystick button 11
+const int VK_BUTTON12 = (0x100+12); // joystick button 12
+const int VK_BUTTON13 = (0x100+13); // joystick button 13
+const int VK_BUTTON14 = (0x100+14); // joystick button 14
+const int VK_BUTTON15 = (0x100+15); // joystick button 15
+const int VK_BUTTON16 = (0x100+16); // joystick button 16
+const int VK_BUTTON17 = (0x100+17); // joystick button 17
+const int VK_BUTTON18 = (0x100+18); // joystick button 18
+const int VK_BUTTON19 = (0x100+19); // joystick button 19
+const int VK_BUTTON20 = (0x100+20); // joystick button 20
+const int VK_BUTTON21 = (0x100+21); // joystick button 21
+const int VK_BUTTON22 = (0x100+22); // joystick button 22
+const int VK_BUTTON23 = (0x100+23); // joystick button 23
+const int VK_BUTTON24 = (0x100+24); // joystick button 24
+const int VK_BUTTON25 = (0x100+25); // joystick button 25
+const int VK_BUTTON26 = (0x100+26); // joystick button 26
+const int VK_BUTTON27 = (0x100+27); // joystick button 27
+const int VK_BUTTON28 = (0x100+28); // joystick button 28
+const int VK_BUTTON29 = (0x100+29); // joystick button 29
+const int VK_BUTTON30 = (0x100+30); // joystick button 30
+const int VK_BUTTON31 = (0x100+31); // joystick button 31
+const int VK_BUTTON32 = (0x100+32); // joystick button 32
+
+const int VK_WHEELUP = (0x200+1); // Mousewheel up
+const int VK_WHEELDOWN = (0x200+2); // Mousewheel down
enum KeyRank
diff --git a/src/common/global.h b/src/common/global.h
index 628660b..212b8b4 100644
--- a/src/common/global.h
+++ b/src/common/global.h
@@ -17,39 +17,43 @@
// global.h
-
-#define BUILD_FACTORY (1<<0) // factory
-#define BUILD_DERRICK (1<<1) // derrick
-#define BUILD_CONVERT (1<<2) // converter
-#define BUILD_RADAR (1<<3) // radar
-#define BUILD_ENERGY (1<<4) // factory of cells
-#define BUILD_NUCLEAR (1<<5) // nuclear power plant
-#define BUILD_STATION (1<<6) // base station
-#define BUILD_REPAIR (1<<7) // repair center
-#define BUILD_TOWER (1<<8) // defense tower
-#define BUILD_RESEARCH (1<<9) // research center
-#define BUILD_LABO (1<<10) // laboratory
-#define BUILD_PARA (1<<11) // lightning protection
-#define BUILD_INFO (1<<12) // information terminal
-#define BUILD_GFLAT (1<<16) // flat floor
-#define BUILD_FLAG (1<<17) // puts / removes colored flag
+enum BuildType
+{
+ BUILD_FACTORY = (1<<0), // factory
+ BUILD_DERRICK = (1<<1), // derrick
+ BUILD_CONVERT = (1<<2), // converter
+ BUILD_RADAR = (1<<3), // radar
+ BUILD_ENERGY = (1<<4), // factory of cells
+ BUILD_NUCLEAR = (1<<5), // nuclear power plant
+ BUILD_STATION = (1<<6), // base station
+ BUILD_REPAIR = (1<<7), // repair center
+ BUILD_TOWER = (1<<8), // defense tower
+ BUILD_RESEARCH = (1<<9), // research center
+ BUILD_LABO = (1<<10), // laboratory
+ BUILD_PARA = (1<<11), // lightning protection
+ BUILD_INFO = (1<<12), // information terminal
+ BUILD_GFLAT = (1<<16), // flat floor
+ BUILD_FLAG = (1<<17) // puts / removes colored flag
+};
// Do not change values ​​was because of backups (bits = ...).
-
-#define RESEARCH_TANK (1<<0) // caterpillars
-#define RESEARCH_FLY (1<<1) // wings
-#define RESEARCH_CANON (1<<2) // cannon
-#define RESEARCH_TOWER (1<<3) // defense tower
-#define RESEARCH_ATOMIC (1<<4) // nuclear
-#define RESEARCH_THUMP (1<<5) // thumper
-#define RESEARCH_SHIELD (1<<6) // shield
-#define RESEARCH_PHAZER (1<<7) // phazer gun
-#define RESEARCH_iPAW (1<<8) // legs of insects
-#define RESEARCH_iGUN (1<<9) // cannon of insects
-#define RESEARCH_RECYCLER (1<<10) // recycler
-#define RESEARCH_SUBM (1<<11) // submarine
-#define RESEARCH_SNIFFER (1<<12) // sniffer
+enum ResearchType
+{
+ RESEARCH_TANK = (1<<0), // caterpillars
+ RESEARCH_FLY = (1<<1), // wings
+ RESEARCH_CANON = (1<<2), // cannon
+ RESEARCH_TOWER = (1<<3), // defense tower
+ RESEARCH_ATOMIC = (1<<4), // nuclear
+ RESEARCH_THUMP = (1<<5), // thumper
+ RESEARCH_SHIELD = (1<<6), // shield
+ RESEARCH_PHAZER = (1<<7), // phazer gun
+ RESEARCH_iPAW = (1<<8), // legs of insects
+ RESEARCH_iGUN = (1<<9), // cannon of insects
+ RESEARCH_RECYCLER = (1<<10), // recycler
+ RESEARCH_SUBM = (1<<11), // submarine
+ RESEARCH_SNIFFER = (1<<12) // sniffer
+};
extern long g_id; // unique identifier
extern long g_build; // constructible buildings
diff --git a/src/common/iman.h b/src/common/iman.h
index b41305f..738a8c2 100644
--- a/src/common/iman.h
+++ b/src/common/iman.h
@@ -23,13 +23,12 @@
-typedef struct
+struct BaseClass
{
int totalPossible;
int totalUsed;
void** classPointer;
-}
-BaseClass;
+};
diff --git a/src/common/metafile.h b/src/common/metafile.h
index c580f6a..0fa1b51 100644
--- a/src/common/metafile.h
+++ b/src/common/metafile.h
@@ -22,24 +22,22 @@
#include <stdio.h>
-#define METAMAX 5
+const int METAMAX = 5;
-typedef struct
+struct MetaHeader
{
char name[14]; // file name (8.3 max)
int start; // position from the beginning of the metafile
int len; // length of the file
-}
-MetaHeader;
+};
-typedef struct
+struct MetaFile
{
char name[50]; // name of the metafile
FILE* stream; // channel
int total; // number of files
MetaHeader* headers; // headers of files
-}
-MetaFile;
+};
diff --git a/src/common/misc.h b/src/common/misc.h
index 93b57de..1108413 100644
--- a/src/common/misc.h
+++ b/src/common/misc.h
@@ -63,7 +63,7 @@ enum ClassType
CLASS_BLITZ = 27,
};
-#define CLASS_MAX 30
+const int CLASS_MAX = 30;
@@ -203,18 +203,18 @@ enum Error
// Keyboard state.
-#define KS_PAGEUP (1<<4)
-#define KS_PAGEDOWN (1<<5)
-#define KS_SHIFT (1<<6)
-#define KS_CONTROL (1<<7)
-#define KS_MLEFT (1<<8)
-#define KS_MRIGHT (1<<9)
-#define KS_NUMUP (1<<10)
-#define KS_NUMDOWN (1<<11)
-#define KS_NUMLEFT (1<<12)
-#define KS_NUMRIGHT (1<<13)
-#define KS_NUMPLUS (1<<14)
-#define KS_NUMMINUS (1<<15)
+const int KS_PAGEUP = (1<<4);
+const int KS_PAGEDOWN = (1<<5);
+const int KS_SHIFT = (1<<6);
+const int KS_CONTROL = (1<<7);
+const int KS_MLEFT = (1<<8);
+const int KS_MRIGHT = (1<<9);
+const int KS_NUMUP = (1<<10);
+const int KS_NUMDOWN = (1<<11);
+const int KS_NUMLEFT = (1<<12);
+const int KS_NUMRIGHT = (1<<13);
+const int KS_NUMPLUS = (1<<14);
+const int KS_NUMMINUS = (1<<15);
// Procedures.
diff --git a/src/common/modfile.cpp b/src/common/modfile.cpp
index a7bfeab..ddda0d8 100644
--- a/src/common/modfile.cpp
+++ b/src/common/modfile.cpp
@@ -35,7 +35,7 @@
-#define MAX_VERTICES 2000
+const int MAX_VERTICES = 2000;
@@ -243,14 +243,13 @@ bool CModFile::ReadDXF(char *filename, float min, float max)
-typedef struct
+struct InfoMOD
{
int rev;
int vers;
int total;
int reserve[10];
-}
-InfoMOD;
+};
// Change nom.bmp to nom.tga
diff --git a/src/common/modfile.h b/src/common/modfile.h
index c6fc43b..8095a91 100644
--- a/src/common/modfile.h
+++ b/src/common/modfile.h
@@ -27,7 +27,7 @@ class CInstanceManager;
-typedef struct
+struct OldModelTriangle1
{
char bUsed; // true -> using
char bSelect; // true -> selected
@@ -38,10 +38,9 @@ typedef struct
char texName[20];
float min;
float max;
-}
-OldModelTriangle1; // length = 196 bytes
+}; // length = 196 bytes
-typedef struct
+struct OldModelTriangle2
{
char bUsed; // true -> used
char bSelect; // true -> selected
@@ -57,10 +56,9 @@ typedef struct
short reserve2;
short reserve3;
short reserve4;
-}
-OldModelTriangle2;
+};
-typedef struct
+struct ModelTriangle
{
char bUsed; // true -> used
char bSelect; // true -> selected
@@ -76,8 +74,7 @@ typedef struct
short reserve2;
short reserve3;
short reserve4;
-}
-ModelTriangle; // length = 208 bytes
+}; // length = 208 bytes
diff --git a/src/common/profile.h b/src/common/profile.h
index 3a2d870..a7f04a6 100644
--- a/src/common/profile.h
+++ b/src/common/profile.h
@@ -19,10 +19,6 @@
#pragma once
-#define STRICT
-#define D3D_OVERLOADS
-
-
extern bool InitCurrentDirectory();
extern bool SetProfileString(char* section, char* key, char* string);
extern bool GetProfileString(char* section, char* key, char* buffer, int max);
diff --git a/src/common/restext.cpp b/src/common/restext.cpp
index 34c91f2..725a96a 100644
--- a/src/common/restext.cpp
+++ b/src/common/restext.cpp
@@ -49,12 +49,11 @@ void SetGlobalGamerName(char *name)
-typedef struct
+struct KeyDesc
{
KeyRank key;
char name[20];
-}
-KeyDesc;
+};
static KeyDesc keyTable[22] =
{
diff --git a/src/common/restext.h b/src/common/restext.h
index 2bcbb3d..481255f 100644
--- a/src/common/restext.h
+++ b/src/common/restext.h
@@ -44,104 +44,107 @@ enum ResType
// Resources of type RES_TEXT.
-#define RT_VERSION_ID 1
-#define RT_DISINFO_TITLE 2
-#define RT_WINDOW_MAXIMIZED 3
-#define RT_WINDOW_MINIMIZED 4
-#define RT_WINDOW_STANDARD 5
-#define RT_WINDOW_CLOSE 6
-
-#define RT_STUDIO_TITLE 10
-#define RT_SCRIPT_NEW 20
-#define RT_NAME_DEFAULT 21
-#define RT_IO_NEW 22
-#define RT_KEY_OR 23
-
-#define RT_TITLE_BASE 40
-#define RT_TITLE_INIT 41
-#define RT_TITLE_TRAINER 42
-#define RT_TITLE_DEFI 43
-#define RT_TITLE_MISSION 44
-#define RT_TITLE_FREE 45
-#define RT_TITLE_PROTO 46
-#define RT_TITLE_SETUP 47
-#define RT_TITLE_NAME 48
-#define RT_TITLE_PERSO 49
-#define RT_TITLE_WRITE 50
-#define RT_TITLE_READ 51
-#define RT_TITLE_USER 52
-#define RT_TITLE_TEEN 53
-
-#define RT_PLAY_CHAPt 60
-#define RT_PLAY_CHAPd 61
-#define RT_PLAY_CHAPm 62
-#define RT_PLAY_CHAPf 63
-#define RT_PLAY_CHAPp 64
-#define RT_PLAY_LISTt 65
-#define RT_PLAY_LISTd 66
-#define RT_PLAY_LISTm 67
-#define RT_PLAY_LISTf 68
-#define RT_PLAY_LISTp 69
-#define RT_PLAY_RESUME 70
-#define RT_PLAY_CHAPu 71
-#define RT_PLAY_LISTu 72
-#define RT_PLAY_CHAPte 73
-#define RT_PLAY_LISTk 74
-
-#define RT_SETUP_DEVICE 80
-#define RT_SETUP_MODE 81
-#define RT_SETUP_KEY1 82
-#define RT_SETUP_KEY2 83
-
-#define RT_PERSO_FACE 90
-#define RT_PERSO_GLASSES 91
-#define RT_PERSO_HAIR 92
-#define RT_PERSO_COMBI 93
-#define RT_PERSO_BAND 94
-
-#define RT_DIALOG_TITLE 100
-#define RT_DIALOG_ABORT 101
-#define RT_DIALOG_QUIT 102
-#define RT_DIALOG_YES 103
-#define RT_DIALOG_NO 104
-#define RT_DIALOG_DELOBJ 105
-#define RT_DIALOG_DELGAME 106
-#define RT_DIALOG_YESDEL 107
-#define RT_DIALOG_NODEL 108
-#define RT_DIALOG_LOADING 109
-#define RT_DIALOG_YESQUIT 110
-#define RT_DIALOG_NOQUIT 111
-
-#define RT_STUDIO_LISTTT 120
-#define RT_STUDIO_COMPOK 121
-#define RT_STUDIO_PROGSTOP 122
-
-#define RT_SATCOM_LIST 140
-#define RT_SATCOM_BOT 141
-#define RT_SATCOM_BUILDING 142
-#define RT_SATCOM_FRET 143
-#define RT_SATCOM_ALIEN 144
-#define RT_SATCOM_NULL 145
-#define RT_SATCOM_ERROR1 146
-#define RT_SATCOM_ERROR2 147
-
-#define RT_IO_OPEN 150
-#define RT_IO_SAVE 151
-#define RT_IO_LIST 152
-#define RT_IO_NAME 153
-#define RT_IO_DIR 154
-#define RT_IO_PRIVATE 155
-#define RT_IO_PUBLIC 156
-
-#define RT_GENERIC_DEV1 170
-#define RT_GENERIC_DEV2 171
-#define RT_GENERIC_EDIT1 172
-#define RT_GENERIC_EDIT2 173
-
-#define RT_INTERFACE_REC 180
-
-#define RT_MESSAGE_WIN 200
-#define RT_MESSAGE_LOST 201
+enum ResTextType
+{
+ RT_VERSION_ID = 1,
+ RT_DISINFO_TITLE = 2,
+ RT_WINDOW_MAXIMIZED = 3,
+ RT_WINDOW_MINIMIZED = 4,
+ RT_WINDOW_STANDARD = 5,
+ RT_WINDOW_CLOSE = 6,
+
+ RT_STUDIO_TITLE = 10,
+ RT_SCRIPT_NEW = 20,
+ RT_NAME_DEFAULT = 21,
+ RT_IO_NEW = 22,
+ RT_KEY_OR = 23,
+
+ RT_TITLE_BASE = 40,
+ RT_TITLE_INIT = 41,
+ RT_TITLE_TRAINER = 42,
+ RT_TITLE_DEFI = 43,
+ RT_TITLE_MISSION = 44,
+ RT_TITLE_FREE = 45,
+ RT_TITLE_PROTO = 46,
+ RT_TITLE_SETUP = 47,
+ RT_TITLE_NAME = 48,
+ RT_TITLE_PERSO = 49,
+ RT_TITLE_WRITE = 50,
+ RT_TITLE_READ = 51,
+ RT_TITLE_USER = 52,
+ RT_TITLE_TEEN = 53,
+
+ RT_PLAY_CHAPt = 60,
+ RT_PLAY_CHAPd = 61,
+ RT_PLAY_CHAPm = 62,
+ RT_PLAY_CHAPf = 63,
+ RT_PLAY_CHAPp = 64,
+ RT_PLAY_LISTt = 65,
+ RT_PLAY_LISTd = 66,
+ RT_PLAY_LISTm = 67,
+ RT_PLAY_LISTf = 68,
+ RT_PLAY_LISTp = 69,
+ RT_PLAY_RESUME = 70,
+ RT_PLAY_CHAPu = 71,
+ RT_PLAY_LISTu = 72,
+ RT_PLAY_CHAPte = 73,
+ RT_PLAY_LISTk = 74,
+
+ RT_SETUP_DEVICE = 80,
+ RT_SETUP_MODE = 81,
+ RT_SETUP_KEY1 = 82,
+ RT_SETUP_KEY2 = 83,
+
+ RT_PERSO_FACE = 90,
+ RT_PERSO_GLASSES = 91,
+ RT_PERSO_HAIR = 92,
+ RT_PERSO_COMBI = 93,
+ RT_PERSO_BAND = 94,
+
+ RT_DIALOG_TITLE = 100,
+ RT_DIALOG_ABORT = 101,
+ RT_DIALOG_QUIT = 102,
+ RT_DIALOG_YES = 103,
+ RT_DIALOG_NO = 104,
+ RT_DIALOG_DELOBJ = 105,
+ RT_DIALOG_DELGAME = 106,
+ RT_DIALOG_YESDEL = 107,
+ RT_DIALOG_NODEL = 108,
+ RT_DIALOG_LOADING = 109,
+ RT_DIALOG_YESQUIT = 110,
+ RT_DIALOG_NOQUIT = 111,
+
+ RT_STUDIO_LISTTT = 120,
+ RT_STUDIO_COMPOK = 121,
+ RT_STUDIO_PROGSTOP = 122,
+
+ RT_SATCOM_LIST = 140,
+ RT_SATCOM_BOT = 141,
+ RT_SATCOM_BUILDING = 142,
+ RT_SATCOM_FRET = 143,
+ RT_SATCOM_ALIEN = 144,
+ RT_SATCOM_NULL = 145,
+ RT_SATCOM_ERROR1 = 146,
+ RT_SATCOM_ERROR2 = 147,
+
+ RT_IO_OPEN = 150,
+ RT_IO_SAVE = 151,
+ RT_IO_LIST = 152,
+ RT_IO_NAME = 153,
+ RT_IO_DIR = 154,
+ RT_IO_PRIVATE = 155,
+ RT_IO_PUBLIC = 156,
+
+ RT_GENERIC_DEV1 = 170,
+ RT_GENERIC_DEV2 = 171,
+ RT_GENERIC_EDIT1 = 172,
+ RT_GENERIC_EDIT2 = 173,
+
+ RT_INTERFACE_REC = 180,
+
+ RT_MESSAGE_WIN = 200,
+ RT_MESSAGE_LOST = 201,
+};
static CD3DEngine* g_engine = 0;
diff --git a/src/common/struct.h b/src/common/struct.h
index 376c837..901651f 100644
--- a/src/common/struct.h
+++ b/src/common/struct.h
@@ -22,8 +22,6 @@
#include <d3d.h>
-#define NAN 999999
-
#define D3DFVF_VERTEX2 (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX2)
struct D3DVERTEX2