From a8665d204255b4b0ad9ae6982f77ecd5e053c1b6 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Mon, 11 Jun 2012 17:28:27 +0200 Subject: [PATCH] Changed #defined constants to consts; typedef struct -> struct --- src/app/d3dapp.cpp | 10 +- src/app/d3dapp.h | 1 - src/common/event.h | 75 ++++++------ src/common/global.h | 64 +++++----- src/common/iman.h | 5 +- src/common/metafile.h | 12 +- src/common/misc.h | 26 ++--- src/common/modfile.cpp | 7 +- src/common/modfile.h | 15 +-- src/common/profile.h | 4 - src/common/restext.cpp | 5 +- src/common/restext.h | 175 ++++++++++++++-------------- src/common/struct.h | 2 - src/graphics/common/blitz.h | 4 +- src/graphics/common/cloud.cpp | 2 +- src/graphics/common/cloud.h | 7 +- src/graphics/common/light.h | 12 +- src/graphics/common/model.cpp | 6 +- src/graphics/common/particule.cpp | 4 +- src/graphics/common/particule.h | 38 +++--- src/graphics/common/planet.h | 7 +- src/graphics/common/pyro.h | 10 +- src/graphics/common/terrain.cpp | 2 +- src/graphics/common/terrain.h | 29 +++-- src/graphics/common/text.h | 14 +-- src/graphics/common/water.h | 14 +-- src/graphics/d3d/d3dengine.cpp | 17 ++- src/graphics/d3d/d3dengine.h | 99 +++++++--------- src/object/auto/autobase.cpp | 16 +-- src/object/auto/autobase.h | 19 +-- src/object/auto/autoderrick.cpp | 4 +- src/object/auto/autoenergy.cpp | 4 +- src/object/auto/autohuston.h | 7 +- src/object/auto/autolabo.cpp | 2 +- src/object/auto/autonuclear.cpp | 2 +- src/object/auto/autoportico.cpp | 24 ++-- src/object/auto/autosafe.cpp | 2 +- src/object/auto/autotower.cpp | 4 +- src/object/brain.cpp | 2 +- src/object/brain.h | 7 +- src/object/motion/motionant.cpp | 2 +- src/object/motion/motionant.h | 29 +++-- src/object/motion/motionbee.cpp | 2 +- src/object/motion/motionbee.h | 16 ++- src/object/motion/motionhuman.cpp | 4 +- src/object/motion/motionhuman.h | 52 +++++---- src/object/motion/motionmother.cpp | 2 +- src/object/motion/motionspider.cpp | 2 +- src/object/motion/motionspider.h | 24 ++-- src/object/motion/motiontoto.cpp | 2 +- src/object/motion/motiontoto.h | 11 +- src/object/motion/motionvehicle.cpp | 4 - src/object/motion/motionworm.cpp | 8 +- src/object/object.cpp | 10 +- src/object/object.h | 25 ++-- src/object/robotmain.cpp | 2 +- src/object/robotmain.h | 37 +++--- src/object/task/task.h | 23 ++-- src/object/task/taskbuild.h | 4 +- src/object/task/taskfire.cpp | 6 +- src/object/task/taskgoto.cpp | 6 +- src/object/task/taskgoto.h | 2 +- src/object/task/taskmanip.cpp | 16 +-- src/object/task/taskrecover.cpp | 4 +- src/object/task/taskshield.cpp | 2 +- src/object/task/taskshield.h | 4 +- src/object/task/taskterraform.cpp | 4 +- src/physics/physics.cpp | 6 +- src/physics/physics.h | 5 +- src/script/script.cpp | 6 +- src/sound/sound.cpp | 4 +- src/sound/sound.h | 18 ++- src/ui/button.cpp | 4 +- src/ui/color.cpp | 4 +- src/ui/control.h | 37 +++--- src/ui/displayinfo.cpp | 5 +- src/ui/displaytext.cpp | 2 +- src/ui/displaytext.h | 2 +- src/ui/edit.cpp | 14 +-- src/ui/edit.h | 37 +++--- src/ui/interface.h | 2 +- src/ui/list.cpp | 2 +- src/ui/list.h | 4 +- src/ui/maindialog.cpp | 8 +- src/ui/maindialog.h | 14 +-- src/ui/mainmap.cpp | 4 +- src/ui/map.h | 7 +- src/ui/scroll.h | 2 +- src/ui/slider.cpp | 4 +- src/ui/window.h | 2 +- 90 files changed, 615 insertions(+), 640 deletions(-) diff --git a/src/app/d3dapp.cpp b/src/app/d3dapp.cpp index 6122feb8..3d8f7982 100644 --- a/src/app/d3dapp.cpp +++ b/src/app/d3dapp.cpp @@ -48,14 +48,14 @@ #endif -#define AUDIO_TRACK 13 // total number of audio tracks on the CD -#define MAX_STEP 0.2f // maximum time for a step +const int AUDIO_TRACK = 13; // total number of audio tracks on the CD +const float MAX_STEP = 0.2f; // maximum time for a step -#define WINDOW_DX (640+6) // dimensions in windowed mode -#define WINDOW_DY (480+25) +const int WINDOW_DX = (640+6); // dimensions in windowed mode +const int WINDOW_DY = (480+25); #define USE_THREAD false // true does not work! -#define TIME_THREAD 0.02f +const float TIME_THREAD = 0.02f; diff --git a/src/app/d3dapp.h b/src/app/d3dapp.h index a40dd1ba..7cb13b7b 100644 --- a/src/app/d3dapp.h +++ b/src/app/d3dapp.h @@ -20,7 +20,6 @@ #define D3D_OVERLOADS - #include #include "graphics/d3d/d3dengine.h" diff --git a/src/common/event.h b/src/common/event.h index e2ec120d..bf179343 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 +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 -#define VK_WHEELUP (0x200+1) // Mousewheel up -#define VK_WHEELDOWN (0x200+2) // Mousewheel down +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 628660bc..212b8b41 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 b41305f3..738a8c2b 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 c580f6a8..0fa1b51c 100644 --- a/src/common/metafile.h +++ b/src/common/metafile.h @@ -22,24 +22,22 @@ #include -#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 93b57de1..1108413a 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 a7bfeab5..ddda0d8f 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 c6fc43bc..8095a916 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 3a2d870c..a7f04a66 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 34c91f25..725a96ae 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 2bcbb3d4..481255f8 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 +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, -#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 + RT_STUDIO_TITLE = 10, + RT_SCRIPT_NEW = 20, + RT_NAME_DEFAULT = 21, + RT_IO_NEW = 22, + 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 + 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, -#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 + 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, -#define RT_SETUP_DEVICE 80 -#define RT_SETUP_MODE 81 -#define RT_SETUP_KEY1 82 -#define RT_SETUP_KEY2 83 + RT_SETUP_DEVICE = 80, + RT_SETUP_MODE = 81, + RT_SETUP_KEY1 = 82, + 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 + RT_PERSO_FACE = 90, + RT_PERSO_GLASSES = 91, + RT_PERSO_HAIR = 92, + RT_PERSO_COMBI = 93, + 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 + 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, -#define RT_STUDIO_LISTTT 120 -#define RT_STUDIO_COMPOK 121 -#define RT_STUDIO_PROGSTOP 122 + RT_STUDIO_LISTTT = 120, + RT_STUDIO_COMPOK = 121, + 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 + 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, -#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 + 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, -#define RT_GENERIC_DEV1 170 -#define RT_GENERIC_DEV2 171 -#define RT_GENERIC_EDIT1 172 -#define RT_GENERIC_EDIT2 173 + RT_GENERIC_DEV1 = 170, + RT_GENERIC_DEV2 = 171, + RT_GENERIC_EDIT1 = 172, + RT_GENERIC_EDIT2 = 173, -#define RT_INTERFACE_REC 180 + RT_INTERFACE_REC = 180, -#define RT_MESSAGE_WIN 200 -#define RT_MESSAGE_LOST 201 + 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 376c8375..901651f7 100644 --- a/src/common/struct.h +++ b/src/common/struct.h @@ -22,8 +22,6 @@ #include -#define NAN 999999 - #define D3DFVF_VERTEX2 (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX2) struct D3DVERTEX2 diff --git a/src/graphics/common/blitz.h b/src/graphics/common/blitz.h index 59268b5f..d4926544 100644 --- a/src/graphics/common/blitz.h +++ b/src/graphics/common/blitz.h @@ -31,8 +31,8 @@ class CSound; -#define BLITZPARA 200.0f // radius of lightning protection -#define BLITZMAX 50 +const float BLITZPARA = 200.0f; // radius of lightning protection +const int BLITZMAX = 50; enum BlitzPhase { diff --git a/src/graphics/common/cloud.cpp b/src/graphics/common/cloud.cpp index 75e44d68..1d4f6d99 100644 --- a/src/graphics/common/cloud.cpp +++ b/src/graphics/common/cloud.cpp @@ -35,7 +35,7 @@ -#define DIMEXPAND 4 // extension of the dimensions +const int DIMEXPAND = 4; // extension of the dimensions diff --git a/src/graphics/common/cloud.h b/src/graphics/common/cloud.h index 2be63c75..cf97bc73 100644 --- a/src/graphics/common/cloud.h +++ b/src/graphics/common/cloud.h @@ -28,15 +28,14 @@ class CTerrain; -#define MAXCLOUDLINE 100 +const int MAXCLOUDLINE = 100; -typedef struct +struct CloudLine { short x, y; // beginning short len; // in length x float px1, px2, pz; -} -CloudLine; +}; class CCloud diff --git a/src/graphics/common/light.h b/src/graphics/common/light.h index 2ae8d2ae..2b20094d 100644 --- a/src/graphics/common/light.h +++ b/src/graphics/common/light.h @@ -26,21 +26,20 @@ class CInstanceManager; class CD3DEngine; -#define D3DMAXLIGHT 100 +const int D3DMAXLIGHT = 100; -typedef struct +struct LightProg { float starting; float ending; float current; float progress; float speed; -} -LightProg; +}; -typedef struct +struct Light { char bUsed; // true -> light exists char bEnable; // true -> light turned on @@ -54,8 +53,7 @@ typedef struct LightProg colorRed; LightProg colorGreen; LightProg colorBlue; -} -Light; +}; diff --git a/src/graphics/common/model.cpp b/src/graphics/common/model.cpp index 324f219a..fa1fe1cc 100644 --- a/src/graphics/common/model.cpp +++ b/src/graphics/common/model.cpp @@ -41,7 +41,7 @@ -#define MAX_COLORS 9 +const int MAX_COLORS = 9; static float table_color[MAX_COLORS*3] = { @@ -57,7 +57,7 @@ static float table_color[MAX_COLORS*3] = }; -#define MAX_STATES 10 +const int MAX_STATES = 10; static int table_state[MAX_STATES] = { @@ -74,7 +74,7 @@ static int table_state[MAX_STATES] = }; -#define MAX_NAMES 23 +const int MAX_NAMES = 23; diff --git a/src/graphics/common/particule.cpp b/src/graphics/common/particule.cpp index d84ca22f..edf9c3d3 100644 --- a/src/graphics/common/particule.cpp +++ b/src/graphics/common/particule.cpp @@ -43,8 +43,8 @@ -#define FOG_HSUP 10.0f -#define FOG_HINF 100.0f +const float FOG_HSUP = 10.0f; +const float FOG_HINF = 100.0f; diff --git a/src/graphics/common/particule.h b/src/graphics/common/particule.h index 06fca924..4014060c 100644 --- a/src/graphics/common/particule.h +++ b/src/graphics/common/particule.h @@ -30,17 +30,20 @@ class CWater; class CObject; -#define MAXPARTICULE 500 -#define MAXPARTITYPE 5 -#define MAXTRACK 100 -#define MAXTRACKLEN 10 -#define MAXPARTIFOG 100 -#define MAXWHEELTRACE 1000 +const int MAXPARTICULE = 500; +const int MAXPARTITYPE = 5; +const int MAXTRACK = 100; +const int MAXTRACKLEN = 10; +const int MAXPARTIFOG = 100; +const int MAXWHEELTRACE = 1000; -#define SH_WORLD 0 // particle in the world in the interface -#define SH_FRONT 1 // particle in the world on the interface -#define SH_INTERFACE 2 // particle in the interface -#define SH_MAX 3 +enum ParticulePlace +{ + SH_WORLD = 0, // particle in the world in the interface + SH_FRONT = 1, // particle in the world on the interface + SH_INTERFACE = 2, // particle in the interface + SH_MAX = 3 +}; // type == 0 -> triangles // type == 1 -> effect00 (black background) @@ -198,7 +201,7 @@ enum ParticulePhase PARPHEND = 1, }; -typedef struct +struct Particule { char bUsed; // true -> particle used char bRay; // true -> ray with goal @@ -227,10 +230,9 @@ typedef struct CObject* objFather; // father object (for example reactor) short objRank; // rank of the object, or -1 short trackRank; // rank of the drag -} -Particule; +}; -typedef struct +struct Track { char bUsed; // true -> drag used char bDrawParticule; @@ -242,16 +244,14 @@ typedef struct int head; // head to write index D3DVECTOR pos[MAXTRACKLEN]; float len[MAXTRACKLEN]; -} -Track; +}; -typedef struct +struct WheelTrace { ParticuleType type; // type PARTI* D3DVECTOR pos[4]; // rectangle positions float startTime; // beginning of life -} -WheelTrace; +}; diff --git a/src/graphics/common/planet.h b/src/graphics/common/planet.h index 75af350a..fd2f0f22 100644 --- a/src/graphics/common/planet.h +++ b/src/graphics/common/planet.h @@ -27,9 +27,9 @@ class CD3DEngine; -#define MAXPLANET 10 +const int MAXPLANET = 10; -typedef struct +struct Planet { char bUsed; // true -> planet exists FPOINT start; // initial position in degrees @@ -40,8 +40,7 @@ typedef struct char name[20]; // name of the texture FPOINT uv1, uv2; // texture mapping char bTGA; // texture .TGA -} -Planet; +}; diff --git a/src/graphics/common/pyro.h b/src/graphics/common/pyro.h index b34842a9..d898a942 100644 --- a/src/graphics/common/pyro.h +++ b/src/graphics/common/pyro.h @@ -67,23 +67,21 @@ enum PyroType }; -typedef struct +struct PyroBurnPart { int part; D3DVECTOR initialPos; D3DVECTOR finalPos; D3DVECTOR initialAngle; D3DVECTOR finalAngle; -} -PyroBurnPart; +}; -typedef struct +struct PyroLightOper { float progress; float intensity; D3DCOLORVALUE color; -} -PyroLightOper; +}; diff --git a/src/graphics/common/terrain.cpp b/src/graphics/common/terrain.cpp index 06bf90fa..af0bb6eb 100644 --- a/src/graphics/common/terrain.cpp +++ b/src/graphics/common/terrain.cpp @@ -37,7 +37,7 @@ #include "graphics/common/terrain.h" -#define BMPHEAD 1078 +const int BMPHEAD = 1078; diff --git a/src/graphics/common/terrain.h b/src/graphics/common/terrain.h index 50f56127..1ea5a6ad 100644 --- a/src/graphics/common/terrain.h +++ b/src/graphics/common/terrain.h @@ -19,6 +19,7 @@ #pragma once +#include "math/old/math3d.h" #include "graphics/d3d/d3dengine.h" @@ -28,7 +29,7 @@ class CWater; -#define FLATLIMIT (5.0f*PI/180.0f) +const float FLATLIMIT = (5.0f*PI/180.0f); enum TerrainRes @@ -44,9 +45,9 @@ enum TerrainRes }; -#define MAXBUILDINGLEVEL 100 +const int MAXBUILDINGLEVEL = 100; -typedef struct +struct BuildingLevel { D3DVECTOR center; float factor; @@ -58,40 +59,36 @@ typedef struct float bboxMaxX; float bboxMinZ; float bboxMaxZ; -} -BuildingLevel; +}; -#define MAXMATTERRAIN 100 +const int MAXMATTERRAIN = 100; -typedef struct +struct TerrainMaterial { short id; char texName[20]; float u,v; float hardness; char mat[4]; // up, right, down, left -} -TerrainMaterial; +}; -typedef struct +struct DotLevel { short id; char mat[4]; // up, right, down, left -} -DotLevel; +}; -#define MAXFLYINGLIMIT 10 +const int MAXFLYINGLIMIT = 10; -typedef struct +struct FlyingLimit { D3DVECTOR center; float extRadius; float intRadius; float maxHeight; -} -FlyingLimit; +}; diff --git a/src/graphics/common/text.h b/src/graphics/common/text.h index 5d41c5c3..defa218a 100644 --- a/src/graphics/common/text.h +++ b/src/graphics/common/text.h @@ -26,10 +26,10 @@ class CInstanceManager; -#define SMALLFONT 10.0f -#define BIGFONT 15.0f +const float SMALLFONT = 10.0f; +const float BIGFONT = 15.0f; -#define NORMSTRETCH 0.8f +const float NORMSTRETCH = 0.8f; @@ -58,10 +58,10 @@ enum FontColor COLOR_TABLE = 0x70, }; -#define FONT_MASK 0x03 -#define TITLE_MASK 0x0c -#define COLOR_MASK 0x70 -#define IMAGE_MASK 0x80 +const int FONT_MASK = 0x03; +const int TITLE_MASK = 0x0c; +const int COLOR_MASK = 0x70; +const int IMAGE_MASK = 0x80; diff --git a/src/graphics/common/water.h b/src/graphics/common/water.h index c0593a00..7a7ffef4 100644 --- a/src/graphics/common/water.h +++ b/src/graphics/common/water.h @@ -29,20 +29,19 @@ class CSound; -#define MAXWATERLINE 500 +const int MAXWATERLINE = 500; -typedef struct +struct WaterLine { short x, y; // beginning short len; // length by x float px1, px2, pz; -} -WaterLine; +}; -#define MAXWATVAPOR 10 +const int MAXWATVAPOR = 10; -typedef struct +struct WaterVapor { bool bUsed; ParticuleType type; @@ -50,8 +49,7 @@ typedef struct float delay; float time; float last; -} -WaterVapor; +}; enum WaterType diff --git a/src/graphics/d3d/d3dengine.cpp b/src/graphics/d3d/d3dengine.cpp index 5b0dde0e..53f651fe 100644 --- a/src/graphics/d3d/d3dengine.cpp +++ b/src/graphics/d3d/d3dengine.cpp @@ -47,12 +47,12 @@ -#define SIZEBLOC_TEXTURE 50 -#define SIZEBLOC_TRANSFORM 100 -#define SIZEBLOC_MINMAX 5 -#define SIZEBLOC_LIGHT 10 -#define SIZEBLOC_MATERIAL 100 -#define SIZEBLOC_TRIANGLE 200 +const int SIZEBLOC_TEXTURE = 50; +const int SIZEBLOC_TRANSFORM = 100; +const int SIZEBLOC_MINMAX = 5; +const int SIZEBLOC_LIGHT = 10; +const int SIZEBLOC_MATERIAL = 100; +const int SIZEBLOC_TRIANGLE = 200; @@ -5616,14 +5616,13 @@ void CD3DEngine::DrawMouse() FPOINT pos, ppos, dim; int i; - typedef struct + struct Mouse { D3DMouse type; int icon1, icon2, iconShadow; int mode1, mode2; float hotx, hoty; - } - Mouse; + }; static Mouse table[] = { diff --git a/src/graphics/d3d/d3dengine.h b/src/graphics/d3d/d3dengine.h index ca821aa9..40744a48 100644 --- a/src/graphics/d3d/d3dengine.h +++ b/src/graphics/d3d/d3dengine.h @@ -36,9 +36,9 @@ class CSound; class CTerrain; -#define D3DMAXOBJECT 1200 -#define D3DMAXSHADOW 500 -#define D3DMAXGROUNDSPOT 100 +const int D3DMAXOBJECT = 1200; +const int D3DMAXSHADOW = 500; +const int D3DMAXGROUNDSPOT = 100; enum D3DTypeObj @@ -97,39 +97,38 @@ enum D3DShadowType }; -#define D3DSTATENORMAL 0 // normal opaque materials -#define D3DSTATETTb (1<<0) // the transparent texture (black = no) -#define D3DSTATETTw (1<<1) // the transparent texture (white = no) -#define D3DSTATETD (1<<2) // the transparent diffuse color -#define D3DSTATEWRAP (1<<3) // texture wrappe -#define D3DSTATECLAMP (1<<4) // texture borders with solid color -#define D3DSTATELIGHT (1<<5) // light texture (ambient max) -#define D3DSTATEDUALb (1<<6) // double black texturing -#define D3DSTATEDUALw (1<<7) // double white texturing -#define D3DSTATEPART1 (1<<8) // part 1 (no change in. MOD!) -#define D3DSTATEPART2 (1<<9) // part 2 -#define D3DSTATEPART3 (1<<10) // part 3 -#define D3DSTATEPART4 (1<<11) // part 4 -#define D3DSTATE2FACE (1<<12) // double-sided face -#define D3DSTATEALPHA (1<<13) // image using alpha channel -#define D3DSTATESECOND (1<<14) // always use 2nd floor texturing -#define D3DSTATEFOG (1<<15) // causes the fog -#define D3DSTATETCb (1<<16) // the transparent color (black = no) -#define D3DSTATETCw (1<<17) // the transparent color (white = no) +const int D3DSTATENORMAL = 0; // normal opaque materials +const int D3DSTATETTb = (1<<0); // the transparent texture (black = no) +const int D3DSTATETTw = (1<<1); // the transparent texture (white = no) +const int D3DSTATETD = (1<<2); // the transparent diffuse color +const int D3DSTATEWRAP = (1<<3); // texture wrappe +const int D3DSTATECLAMP = (1<<4); // texture borders with solid color +const int D3DSTATELIGHT = (1<<5); // light texture (ambient max) +const int D3DSTATEDUALb = (1<<6); // double black texturing +const int D3DSTATEDUALw = (1<<7); // double white texturing +const int D3DSTATEPART1 = (1<<8); // part 1 (no change in. MOD!) +const int D3DSTATEPART2 = (1<<9); // part 2 +const int D3DSTATEPART3 = (1<<10); // part 3 +const int D3DSTATEPART4 = (1<<11); // part 4 +const int D3DSTATE2FACE = (1<<12); // double-sided face +const int D3DSTATEALPHA = (1<<13); // image using alpha channel +const int D3DSTATESECOND = (1<<14); // always use 2nd floor texturing +const int D3DSTATEFOG = (1<<15); // causes the fog +const int D3DSTATETCb = (1<<16); // the transparent color (black = no) +const int D3DSTATETCw = (1<<17); // the transparent color (white = no) -typedef struct +struct D3DTriangle { D3DVERTEX2 triangle[3]; D3DMATERIAL7 material; int state; char texName1[20]; char texName2[20]; -} -D3DTriangle; +}; -typedef struct +struct D3DObjLevel6 { int totalPossible; int totalUsed; @@ -137,56 +136,50 @@ typedef struct int state; D3DTypeTri type; // D3DTYPE6x D3DVERTEX2 vertex[1]; -} -D3DObjLevel6; +}; -typedef struct +struct D3DObjLevel5 { int totalPossible; int totalUsed; int reserve; D3DObjLevel6* table[1]; -} -D3DObjLevel5; +}; -typedef struct +struct D3DObjLevel4 { int totalPossible; int totalUsed; float min, max; D3DObjLevel5* table[1]; -} -D3DObjLevel4; +}; -typedef struct +struct D3DObjLevel3 { int totalPossible; int totalUsed; int objRank; D3DObjLevel4* table[1]; -} -D3DObjLevel3; +}; -typedef struct +struct D3DObjLevel2 { int totalPossible; int totalUsed; char texName1[20]; char texName2[20]; D3DObjLevel3* table[1]; -} -D3DObjLevel2; +}; -typedef struct +struct D3DObjLevel1 { int totalPossible; int totalUsed; D3DObjLevel2* table[1]; -} -D3DObjLevel1; +}; -typedef struct +struct D3DObject { char bUsed; // true -> object exists char bVisible; // true -> visible object @@ -201,10 +194,9 @@ typedef struct float radius; // radius of the sphere at the origin int shadowRank; // rank of the associated shadow float transparency; // transparency of the object (0 .. 1) -} -D3DObject; +}; -typedef struct +struct D3DShadow { char bUsed; // true -> object exists char bHide; // true -> invisible shadow (object carried by ex.) @@ -216,10 +208,9 @@ typedef struct float radius; // radius of the shadow float intensity; // intensity of the shadow float height; // height from the ground -} -D3DShadow; +}; -typedef struct +struct D3DGroundSpot { char bUsed; // true -> object exists D3DCOLORVALUE color; // color of the shadow @@ -229,10 +220,9 @@ typedef struct float radius; // radius of the shadow D3DVECTOR drawPos; // drawn to position the shade float drawRadius; // radius of the shadow drawn -} -D3DGroundSpot; +}; -typedef struct +struct D3DGroundMark { char bUsed; // true -> object exists char bDraw; // true -> drawn mark @@ -247,8 +237,7 @@ typedef struct float drawIntensity; // current drawn int dx, dy; // dimensions table char* table; // pointer to the table -} -D3DGroundMark; +}; diff --git a/src/object/auto/autobase.cpp b/src/object/auto/autobase.cpp index 5c1bb2d4..54bf96f7 100644 --- a/src/object/auto/autobase.cpp +++ b/src/object/auto/autobase.cpp @@ -48,14 +48,14 @@ -#define BASE_LAND_TIME 7.5f // hard landing -#define BASE_TAKO_TIME 10.0f // hard landing -#define BASE_DOOR_TIME 6.0f // time opening / closing -#define BASE_DOOR_TIME2 2.0f // time opening / closing suppl. -#define BASE_PORTICO_TIME_MOVE 16.0f // gate advance time -#define BASE_PORTICO_TIME_DOWN 4.0f // gate length down -#define BASE_PORTICO_TIME_OPEN 4.0f // gate opening duration -#define BASE_TRANSIT_TIME 15.0f // transit duration +const float BASE_LAND_TIME = 7.5f; // hard landing +const float BASE_TAKO_TIME = 10.0f; // hard landing +const float BASE_DOOR_TIME = 6.0f; // time opening / closing +const float BASE_DOOR_TIME2 = 2.0f; // time opening / closing suppl. +const float BASE_PORTICO_TIME_MOVE = 16.0f; // gate advance time +const float BASE_PORTICO_TIME_DOWN = 4.0f; // gate length down +const float BASE_PORTICO_TIME_OPEN = 4.0f; // gate opening duration +const float BASE_TRANSIT_TIME = 15.0f; // transit duration diff --git a/src/object/auto/autobase.h b/src/object/auto/autobase.h index 1a3623df..513f16e7 100644 --- a/src/object/auto/autobase.h +++ b/src/object/auto/autobase.h @@ -31,15 +31,16 @@ class CCamera; class CObject; - -#define PARAM_STOP 0 // run=0 -> stops and open -#define PARAM_LANDING 1 // run=1 -> landing -#define PARAM_PORTICO 2 // run=2 -> gate on the ground -#define PARAM_FIXSCENE 3 // run=3 -> open and stops to win / lost -#define PARAM_TRANSIT1 11 // run=11 -> transit in space -#define PARAM_TRANSIT2 12 // run=12 -> transit in space -#define PARAM_TRANSIT3 13 // run=13 -> transit in space - +enum AutoBaseParam +{ + PARAM_STOP = 0, // run=0 -> stops and open + PARAM_LANDING = 1, // run=1 -> landing + PARAM_PORTICO = 2, // run=2 -> gate on the ground + PARAM_FIXSCENE = 3, // run=3 -> open and stops to win / lost + PARAM_TRANSIT1 = 11, // run=11 -> transit in space + PARAM_TRANSIT2 = 12, // run=12 -> transit in space + PARAM_TRANSIT3 = 13 // run=13 -> transit in space +}; enum AutoBasePhase { diff --git a/src/object/auto/autoderrick.cpp b/src/object/auto/autoderrick.cpp index 8350da86..a7d0b5e4 100644 --- a/src/object/auto/autoderrick.cpp +++ b/src/object/auto/autoderrick.cpp @@ -43,8 +43,8 @@ -#define DERRICK_DELAY 10.0f // duration of the extraction -#define DERRICK_DELAYu 30.0f // same, but for uranium +const float DERRICK_DELAY = 10.0f; // duration of the extraction +const float DERRICK_DELAYu = 30.0f; // same, but for uranium diff --git a/src/object/auto/autoenergy.cpp b/src/object/auto/autoenergy.cpp index ba265e83..75ab92ab 100644 --- a/src/object/auto/autoenergy.cpp +++ b/src/object/auto/autoenergy.cpp @@ -46,8 +46,8 @@ -#define ENERGY_POWER 0.4f // Necessary energy for a battery -#define ENERGY_DELAY 12.0f // processing time +const float ENERGY_POWER = 0.4f; // Necessary energy for a battery +const float ENERGY_DELAY = 12.0f; // processing time diff --git a/src/object/auto/autohuston.h b/src/object/auto/autohuston.h index 32954f72..e17d04e8 100644 --- a/src/object/auto/autohuston.h +++ b/src/object/auto/autohuston.h @@ -32,7 +32,7 @@ class CObject; -typedef struct +struct HustonLens { int parti; ParticuleType type; @@ -40,11 +40,10 @@ typedef struct float dim; float total; float off; -} -HustonLens; +}; -#define HUSTONMAXLENS 20 +const int HUSTONMAXLENS = 20; class CAutoHuston : public CAuto diff --git a/src/object/auto/autolabo.cpp b/src/object/auto/autolabo.cpp index 41b62991..7d5c5761 100644 --- a/src/object/auto/autolabo.cpp +++ b/src/object/auto/autolabo.cpp @@ -47,7 +47,7 @@ -#define LABO_DELAY 20.0f // duration of the analysis +const float LABO_DELAY = 20.0f; // duration of the analysis diff --git a/src/object/auto/autonuclear.cpp b/src/object/auto/autonuclear.cpp index a6a99044..5139b9b8 100644 --- a/src/object/auto/autonuclear.cpp +++ b/src/object/auto/autonuclear.cpp @@ -45,7 +45,7 @@ -#define NUCLEAR_DELAY 30.0f // duration of the generation +const float NUCLEAR_DELAY = 30.0f; // duration of the generation diff --git a/src/object/auto/autoportico.cpp b/src/object/auto/autoportico.cpp index 97f11c55..5c4a09cb 100644 --- a/src/object/auto/autoportico.cpp +++ b/src/object/auto/autoportico.cpp @@ -44,20 +44,20 @@ -#define PARAM_DEPOSE 2 // run=2 -> deposits the spaceship +const int PARAM_DEPOSE = 2; // run=2 -> deposits the spaceship -#define PORTICO_POSa 75.0f -#define PORTICO_POSb 65.0f -#define PORTICO_ANGLE1a ( 25.0f*PI/180.0f) -#define PORTICO_ANGLE1b ( 70.0f*PI/180.0f) -#define PORTICO_ANGLE2a (-37.5f*PI/180.0f) -#define PORTICO_ANGLE2b (-62.5f*PI/180.0f) -#define PORTICO_ANGLE3a (-77.5f*PI/180.0f) -#define PORTICO_ANGLE3b (-30.0f*PI/180.0f) +const float PORTICO_POSa = 75.0f; +const float PORTICO_POSb = 65.0f; +const float PORTICO_ANGLE1a = ( 25.0f*PI/180.0f); +const float PORTICO_ANGLE1b = ( 70.0f*PI/180.0f); +const float PORTICO_ANGLE2a = (-37.5f*PI/180.0f); +const float PORTICO_ANGLE2b = (-62.5f*PI/180.0f); +const float PORTICO_ANGLE3a = (-77.5f*PI/180.0f); +const float PORTICO_ANGLE3b = (-30.0f*PI/180.0f); -#define PORTICO_TIME_MOVE 16.0f -#define PORTICO_TIME_DOWN 4.0f -#define PORTICO_TIME_OPEN 12.0f +const float PORTICO_TIME_MOVE = 16.0f; +const float PORTICO_TIME_DOWN = 4.0f; +const float PORTICO_TIME_OPEN = 12.0f; diff --git a/src/object/auto/autosafe.cpp b/src/object/auto/autosafe.cpp index 8104c5e5..65652024 100644 --- a/src/object/auto/autosafe.cpp +++ b/src/object/auto/autosafe.cpp @@ -46,7 +46,7 @@ -#define OPEN_DELAY 8.0f // duration of opening +const float OPEN_DELAY = 8.0f; // duration of opening diff --git a/src/object/auto/autotower.cpp b/src/object/auto/autotower.cpp index 63222b89..74cc984b 100644 --- a/src/object/auto/autotower.cpp +++ b/src/object/auto/autotower.cpp @@ -47,8 +47,8 @@ -#define TOWER_SCOPE 200.0f // range of beam -#define ENERGY_FIRE 0.125f // energy consumed by fire +const float TOWER_SCOPE = 200.0f; // range of beam +const float ENERGY_FIRE = 0.125f; // energy consumed by fire // Object's constructor. diff --git a/src/object/brain.cpp b/src/object/brain.cpp index 1bbebe4a..2984eabc 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -69,7 +69,7 @@ -#define MAXTRACERECORD 1000 +const int MAXTRACERECORD = 1000; diff --git a/src/object/brain.h b/src/object/brain.h index 11fd379c..c54f0f77 100644 --- a/src/object/brain.h +++ b/src/object/brain.h @@ -46,7 +46,7 @@ class CSound; class CParticule; -#define BRAINMAXSCRIPT 10 +const int BRAINMAXSCRIPT = 10; @@ -59,12 +59,11 @@ enum TraceOper TO_PEN = 4, // color change }; -typedef struct +struct TraceRecord { TraceOper oper; float param; -} -TraceRecord; +}; diff --git a/src/object/motion/motionant.cpp b/src/object/motion/motionant.cpp index 0f6543a6..3caf79ac 100644 --- a/src/object/motion/motionant.cpp +++ b/src/object/motion/motionant.cpp @@ -44,7 +44,7 @@ #define ADJUST_ANGLE false // true -> adjusts the angles of the members -#define START_TIME 1000.0f // beginning of the relative time +const float START_TIME = 1000.0f; // beginning of the relative time diff --git a/src/object/motion/motionant.h b/src/object/motion/motionant.h index 084a9a9f..dc969fe5 100644 --- a/src/object/motion/motionant.h +++ b/src/object/motion/motionant.h @@ -32,19 +32,24 @@ class CBrain; class CPhysics; class CObject; +enum MotionAntAction +{ + MA_MARCH = 0, + MA_STOP = 1, + MA_SPEC = 2 +}; -#define MA_MARCH 0 -#define MA_STOP 1 -#define MA_SPEC 2 - -#define MAS_PREPARE 0 -#define MAS_FIRE 1 -#define MAS_TERMINATE 2 -#define MAS_BURN 3 -#define MAS_RUIN 4 -#define MAS_BACK1 5 -#define MAS_BACK2 6 -#define MAS_BACK3 7 +enum MotionAntSpecialAction +{ + MAS_PREPARE = 0, + MAS_FIRE = 1, + MAS_TERMINATE = 2, + MAS_BURN = 3, + MAS_RUIN = 4, + MAS_BACK1 = 5, + MAS_BACK2 = 6, + MAS_BACK3 = 7 +}; class CMotionAnt : public CMotion diff --git a/src/object/motion/motionbee.cpp b/src/object/motion/motionbee.cpp index 7f3da7ad..9167bbcd 100644 --- a/src/object/motion/motionbee.cpp +++ b/src/object/motion/motionbee.cpp @@ -44,7 +44,7 @@ #define ADJUST_ANGLE false // true -> adjusts the angles of the members -#define START_TIME 1000.0f // beginning of the relative time +const float START_TIME = 1000.0f; // beginning of the relative time diff --git a/src/object/motion/motionbee.h b/src/object/motion/motionbee.h index a62f2bab..5c69bff2 100644 --- a/src/object/motion/motionbee.h +++ b/src/object/motion/motionbee.h @@ -33,12 +33,18 @@ class CPhysics; class CObject; -#define MB_MARCH 0 -#define MB_SPEC 1 +enum MotionBeeAction +{ + MB_MARCH = 0, + MB_SPEC = 1 +}; -#define MBS_HOLD 0 -#define MBS_BURN 1 -#define MBS_RUIN 2 +enum MotionBeeSpecialAction +{ + MBS_HOLD = 0, + MBS_BURN = 1, + MBS_RUIN = 2 +}; class CMotionBee : public CMotion diff --git a/src/object/motion/motionhuman.cpp b/src/object/motion/motionhuman.cpp index 02e4dd3c..6667a392 100644 --- a/src/object/motion/motionhuman.cpp +++ b/src/object/motion/motionhuman.cpp @@ -46,9 +46,9 @@ #define ADJUST_ANGLE false // true -> adjusts the angles of the members -#define ADJUST_ACTION (3*3*3*3*MH_SPEC+3*3*3*MHS_SATCOM) +const int ADJUST_ACTION = (3*3*3*3*MH_SPEC+3*3*3*MHS_SATCOM); -#define START_TIME 1000.0f // beginning of the relative time +const float START_TIME = 1000.0f; // beginning of the relative time diff --git a/src/object/motion/motionhuman.h b/src/object/motion/motionhuman.h index e563a817..1fc8d575 100644 --- a/src/object/motion/motionhuman.h +++ b/src/object/motion/motionhuman.h @@ -34,30 +34,36 @@ class CPhysics; class CObject; -#define MH_MARCH 0 -#define MH_MARCHTAKE 1 -#define MH_TURN 2 -#define MH_STOP 3 -#define MH_FLY 4 -#define MH_SWIM 5 -#define MH_SPEC 6 +enum MotionHumanAction +{ + MH_MARCH = 0, + MH_MARCHTAKE = 1, + MH_TURN = 2, + MH_STOP = 3, + MH_FLY = 4, + MH_SWIM = 5, + MH_SPEC = 6 +}; -#define MHS_FIRE 0 -#define MHS_GUN 1 -#define MHS_TAKE 2 -#define MHS_TAKEOTHER 3 -#define MHS_TAKEHIGH 4 -#define MHS_UPRIGHT 5 -#define MHS_WIN 6 -#define MHS_LOST 7 -#define MHS_DEADg 8 -#define MHS_DEADg1 9 -#define MHS_DEADg2 10 -#define MHS_DEADg3 11 -#define MHS_DEADg4 12 -#define MHS_DEADw 13 -#define MHS_FLAG 14 -#define MHS_SATCOM 15 +enum MotionHumanSpecialAction +{ + MHS_FIRE = 0, + MHS_GUN = 1, + MHS_TAKE = 2, + MHS_TAKEOTHER = 3, + MHS_TAKEHIGH = 4, + MHS_UPRIGHT = 5, + MHS_WIN = 6, + MHS_LOST = 7, + MHS_DEADg = 8, + MHS_DEADg1 = 9, + MHS_DEADg2 = 10, + MHS_DEADg3 = 11, + MHS_DEADg4 = 12, + MHS_DEADw = 13, + MHS_FLAG = 14, + MHS_SATCOM = 15 +}; class CMotionHuman : public CMotion diff --git a/src/object/motion/motionmother.cpp b/src/object/motion/motionmother.cpp index 6db0a8bf..cd5fb7c7 100644 --- a/src/object/motion/motionmother.cpp +++ b/src/object/motion/motionmother.cpp @@ -44,7 +44,7 @@ #define ADJUST_ANGLE false // true -> adjusts the angles of the members -#define START_TIME 1000.0f // beginning of the relative time +const float START_TIME = 1000.0f; // beginning of the relative time diff --git a/src/object/motion/motionspider.cpp b/src/object/motion/motionspider.cpp index 26719332..08eb546c 100644 --- a/src/object/motion/motionspider.cpp +++ b/src/object/motion/motionspider.cpp @@ -44,7 +44,7 @@ #define ADJUST_ANGLE false // true -> adjusts the angles of the members -#define START_TIME 1000.0f // beginning of the relative time +const float START_TIME = 1000.0f; // beginning of the relative time diff --git a/src/object/motion/motionspider.h b/src/object/motion/motionspider.h index bda769d4..6f18e073 100644 --- a/src/object/motion/motionspider.h +++ b/src/object/motion/motionspider.h @@ -33,16 +33,22 @@ class CPhysics; class CObject; -#define MS_MARCH 0 -#define MS_STOP 1 -#define MS_SPEC 2 +enum MotionSpiderAction +{ + MS_MARCH = 0, + MS_STOP = 1, + MS_SPEC = 2 +}; -#define MSS_BURN 0 -#define MSS_RUIN 1 -#define MSS_EXPLO 2 -#define MSS_BACK1 3 -#define MSS_BACK2 4 -#define MSS_BACK3 5 +enum MotionSpiderSpecialAction +{ + MSS_BURN = 0, + MSS_RUIN = 1, + MSS_EXPLO = 2, + MSS_BACK1 = 3, + MSS_BACK2 = 4, + MSS_BACK3 = 5 +}; class CMotionSpider : public CMotion diff --git a/src/object/motion/motiontoto.cpp b/src/object/motion/motiontoto.cpp index 64ff021a..317d2ab6 100644 --- a/src/object/motion/motiontoto.cpp +++ b/src/object/motion/motiontoto.cpp @@ -44,7 +44,7 @@ -#define START_TIME 1000.0f // beginning of the relative time +const float START_TIME = 1000.0f; // beginning of the relative time diff --git a/src/object/motion/motiontoto.h b/src/object/motion/motiontoto.h index 1c7f8717..935e4a55 100644 --- a/src/object/motion/motiontoto.h +++ b/src/object/motion/motiontoto.h @@ -34,10 +34,13 @@ class CBrain; class CPhysics; -#define MT_ERROR 0 -#define MT_WARNING 1 -#define MT_INFO 2 -#define MT_MESSAGE 3 +enum MotionTotoAction +{ + MT_ERROR = 0, + MT_WARNING = 1, + MT_INFO = 2, + MT_MESSAGE = 3 +}; class CMotionToto : public CMotion diff --git a/src/object/motion/motionvehicle.cpp b/src/object/motion/motionvehicle.cpp index 56eab8d2..4bd91d07 100644 --- a/src/object/motion/motionvehicle.cpp +++ b/src/object/motion/motionvehicle.cpp @@ -43,10 +43,6 @@ -#define ARM_NEUTRAL_ANGLE1 110.0f*PI/180.0f -#define ARM_NEUTRAL_ANGLE2 -130.0f*PI/180.0f -#define ARM_NEUTRAL_ANGLE3 -50.0f*PI/180.0f - // Object's constructor. diff --git a/src/object/motion/motionworm.cpp b/src/object/motion/motionworm.cpp index dc33e6e9..fc5dc35f 100644 --- a/src/object/motion/motionworm.cpp +++ b/src/object/motion/motionworm.cpp @@ -43,10 +43,10 @@ -#define START_TIME 1000.0f // beginning of the relative time -#define TIME_UPDOWN 2.0f // time for up / down -#define DOWN_ALTITUDE 3.0f // underground distance -#define WORM_PART 7 // number of parts of a worm +const float START_TIME = 1000.0f; // beginning of the relative time +const float TIME_UPDOWN = 2.0f; // time for up / down +const float DOWN_ALTITUDE = 3.0f; // underground distance +const int WORM_PART = 7; // number of parts of a worm diff --git a/src/object/object.cpp b/src/object/object.cpp index 9fb7ae8c..0f8eb291 100644 --- a/src/object/object.cpp +++ b/src/object/object.cpp @@ -91,11 +91,11 @@ #define ADJUST_ONBOARD false // true -> adjusts the camera ONBOARD -#define ADJUST_ARM false // true -> adjusts the manipulator arm -#define VIRUS_DELAY 60.0f // duration of virus infection -#define LOSS_SHIELD 0.24f // loss of the shield by shot -#define LOSS_SHIELD_H 0.10f // loss of the shield for humans -#define LOSS_SHIELD_M 0.02f // loss of the shield for the laying +#define ADJUST_ARM false // true -> adjusts the manipulator arm +const float VIRUS_DELAY = 60.0f; // duration of virus infection +const float LOSS_SHIELD = 0.24f; // loss of the shield by shot +const float LOSS_SHIELD_H = 0.10f; // loss of the shield for humans +const float LOSS_SHIELD_M = 0.02f; // loss of the shield for the laying #if ADJUST_ONBOARD static float debug_x = 0.0f; diff --git a/src/object/object.h b/src/object/object.h index b6f993ae..88eac3de 100644 --- a/src/object/object.h +++ b/src/object/object.h @@ -42,11 +42,11 @@ class CScript; // The father of all parts must always be the part number zero! -#define OBJECTMAXPART 40 -#define MAXCRASHSPHERE 40 -#define OBJECTMAXDESELLIST 10 -#define OBJECTMAXINFO 10 -#define OBJECTMAXCMDLINE 20 +const int OBJECTMAXPART = 40; +const int MAXCRASHSPHERE = 40; +const int OBJECTMAXDESELLIST = 10; +const int OBJECTMAXINFO = 10; +const int OBJECTMAXCMDLINE = 20; enum ObjectType { @@ -303,7 +303,7 @@ enum ObjectMaterial OM_MINERAL = 5, // stone }; -typedef struct +struct ObjectPart { char bUsed; int object; // number of the object in CD3DEngine @@ -319,10 +319,9 @@ typedef struct D3DMATRIX matRotate; D3DMATRIX matTransform; D3DMATRIX matWorld; -} -ObjectPart; +}; -typedef struct +struct Character { float wheelFront; // position X of the front wheels float wheelBack; // position X of the back wheels @@ -330,15 +329,13 @@ typedef struct float wheelRight; // position Z of the right wheels float height; // normal height on top of ground D3DVECTOR posPower; // position of the battery -} -Character; +}; -typedef struct +struct Info { char name[20]; // name of the information float value; // value of the information -} -Info; +}; enum ExploType { diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index d072f666..c3a77526 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -81,7 +81,7 @@ #define CBOT_STACK true // saves the stack of programs CBOT -#define UNIT 4.0f +const float UNIT = 4.0f; diff --git a/src/object/robotmain.h b/src/object/robotmain.h index 893bd503..73f7bfcf 100644 --- a/src/object/robotmain.h +++ b/src/object/robotmain.h @@ -87,7 +87,7 @@ class CDisplayInfo; class CSound; -typedef struct +struct EndTake { D3DVECTOR pos; float dist; @@ -97,26 +97,24 @@ typedef struct int lost; // lost if <= bool bImmediat; char message[100]; -} -EndTake; +}; -#define MAXNEWSCRIPTNAME 20 +const int MAXNEWSCRIPTNAME = 20; -typedef struct +struct NewScriptName { bool bUsed; ObjectType type; char name[40]; -} -NewScriptName; +}; -#define MAXSHOWLIMIT 5 -#define MAXSHOWPARTI 200 -#define SHOWLIMITTIME 20.0f +const int MAXSHOWLIMIT = 5; +const int MAXSHOWPARTI = 200; +const float SHOWLIMITTIME = 20.0f; -typedef struct +struct ShowLimit { bool bUsed; D3DVECTOR pos; @@ -126,17 +124,16 @@ typedef struct CObject* link; float duration; float time; -} -ShowLimit; +}; -#define SATCOM_HUSTON 0 -#define SATCOM_SAT 1 -#define SATCOM_OBJECT 2 -#define SATCOM_LOADING 3 -#define SATCOM_PROG 4 -#define SATCOM_SOLUCE 5 -#define SATCOM_MAX 6 +const int SATCOM_HUSTON = 0; +const int SATCOM_SAT = 1; +const int SATCOM_OBJECT = 2; +const int SATCOM_LOADING = 3; +const int SATCOM_PROG = 4; +const int SATCOM_SOLUCE = 5; +const int SATCOM_MAX = 6; diff --git a/src/object/task/task.h b/src/object/task/task.h index b85fa32c..97ac8197 100644 --- a/src/object/task/task.h +++ b/src/object/task/task.h @@ -20,6 +20,7 @@ #include "common/misc.h" +#include "math/old/math3d.h" class CInstanceManager; @@ -39,19 +40,19 @@ class CDisplayText; class CSound; -#define TAKE_DIST 6.0f // distance to an object to pick it -#define TAKE_DIST_OTHER 1.5f // additional distance if on friend +const float TAKE_DIST = 6.0f; // distance to an object to pick it +const float TAKE_DIST_OTHER = 1.5f; // additional distance if on friend -//?#define ARM_NEUTRAL_ANGLE1 155.0f*PI/180.0f -//?#define ARM_NEUTRAL_ANGLE2 -125.0f*PI/180.0f -//?#define ARM_NEUTRAL_ANGLE3 -45.0f*PI/180.0f -#define ARM_NEUTRAL_ANGLE1 110.0f*PI/180.0f -#define ARM_NEUTRAL_ANGLE2 -130.0f*PI/180.0f -#define ARM_NEUTRAL_ANGLE3 -50.0f*PI/180.0f +//?const float ARM_NEUTRAL_ANGLE1 = 155.0f*PI/180.0f; +//?const float ARM_NEUTRAL_ANGLE2 = -125.0f*PI/180.0f; +//?const float ARM_NEUTRAL_ANGLE3 = -45.0f*PI/180.0f; +const float ARM_NEUTRAL_ANGLE1 = 110.0f*PI/180.0f; +const float ARM_NEUTRAL_ANGLE2 = -130.0f*PI/180.0f; +const float ARM_NEUTRAL_ANGLE3 = -50.0f*PI/180.0f; -#define ARM_STOCK_ANGLE1 110.0f*PI/180.0f -#define ARM_STOCK_ANGLE2 -100.0f*PI/180.0f -#define ARM_STOCK_ANGLE3 -70.0f*PI/180.0f +const float ARM_STOCK_ANGLE1 = 110.0f*PI/180.0f; +const float ARM_STOCK_ANGLE2 = -100.0f*PI/180.0f; +const float ARM_STOCK_ANGLE3 = -70.0f*PI/180.0f; class CTask diff --git a/src/object/task/taskbuild.h b/src/object/task/taskbuild.h index 337edb7e..1cced564 100644 --- a/src/object/task/taskbuild.h +++ b/src/object/task/taskbuild.h @@ -30,8 +30,8 @@ class CPhysics; -#define BUILDMARGIN 16.0f -#define TBMAXLIGHT 4 +const float BUILDMARGIN = 16.0f; +const int TBMAXLIGHT = 4; enum TaskBuildPhase diff --git a/src/object/task/taskfire.cpp b/src/object/task/taskfire.cpp index 02c4159b..81becda5 100644 --- a/src/object/task/taskfire.cpp +++ b/src/object/task/taskfire.cpp @@ -40,9 +40,9 @@ -#define ENERGY_FIRE (0.25f/2.5f) // energy consumed/shot -#define ENERGY_FIREr (0.25f/1.5f) // energy consumed/ray -#define ENERGY_FIREi (0.10f/2.5f) // energy consumed/organic +const float ENERGY_FIRE = (0.25f/2.5f); // energy consumed/shot +const float ENERGY_FIREr = (0.25f/1.5f); // energy consumed/ray +const float ENERGY_FIREi = (0.10f/2.5f); // energy consumed/organic // Object's constructor. diff --git a/src/object/task/taskgoto.cpp b/src/object/task/taskgoto.cpp index 7e4d3f10..c5ffaec0 100644 --- a/src/object/task/taskgoto.cpp +++ b/src/object/task/taskgoto.cpp @@ -39,9 +39,9 @@ -#define FLY_DIST_GROUND 80.0f // minimum distance to remain on the ground -#define FLY_DEF_HEIGHT 50.0f // default flying height -#define BM_DIM_STEP 5.0f +const float FLY_DIST_GROUND = 80.0f; // minimum distance to remain on the ground +const float FLY_DEF_HEIGHT = 50.0f; // default flying height +const float BM_DIM_STEP = 5.0f; diff --git a/src/object/task/taskgoto.h b/src/object/task/taskgoto.h index acd79b62..498bff52 100644 --- a/src/object/task/taskgoto.h +++ b/src/object/task/taskgoto.h @@ -31,7 +31,7 @@ class CObject; -#define MAXPOINTS 500 +const int MAXPOINTS = 500; diff --git a/src/object/task/taskmanip.cpp b/src/object/task/taskmanip.cpp index 5df067c6..36bc4aee 100644 --- a/src/object/task/taskmanip.cpp +++ b/src/object/task/taskmanip.cpp @@ -42,14 +42,14 @@ #include "object/task/taskmanip.h" -//?#define MARGIN_FRONT 2.0f -//?#define MARGIN_BACK 2.0f -//?#define MARGIN_FRIEND 2.0f -//?#define MARGIN_BEE 5.0f -#define MARGIN_FRONT 4.0f //OK 1.9 -#define MARGIN_BACK 4.0f //OK 1.9 -#define MARGIN_FRIEND 4.0f //OK 1.9 -#define MARGIN_BEE 5.0f //OK 1.9 +//?const float MARGIN_FRONT = 2.0f; +//?const float MARGIN_BACK = 2.0f; +//?const float MARGIN_FRIEND = 2.0f; +//?const float MARGIN_BEE = 5.0f; +const float MARGIN_FRONT = 4.0f; //OK 1.9 +const float MARGIN_BACK = 4.0f; //OK 1.9 +const float MARGIN_FRIEND = 4.0f; //OK 1.9 +const float MARGIN_BEE = 5.0f; //OK 1.9 diff --git a/src/object/task/taskrecover.cpp b/src/object/task/taskrecover.cpp index 798540b0..cb47bcef 100644 --- a/src/object/task/taskrecover.cpp +++ b/src/object/task/taskrecover.cpp @@ -40,8 +40,8 @@ #include "object/task/taskrecover.h" -#define ENERGY_RECOVER 0.25f // energy consumed by recovery -#define RECOVER_DIST 11.8f +const float ENERGY_RECOVER = 0.25f; // energy consumed by recovery +const float RECOVER_DIST = 11.8f; diff --git a/src/object/task/taskshield.cpp b/src/object/task/taskshield.cpp index 818a3a70..86e45dfd 100644 --- a/src/object/task/taskshield.cpp +++ b/src/object/task/taskshield.cpp @@ -41,7 +41,7 @@ #include "object/task/taskshield.h" -#define ENERGY_TIME 20.0f // maximum duration if full battery +const float ENERGY_TIME = 20.0f; // maximum duration if full battery diff --git a/src/object/task/taskshield.h b/src/object/task/taskshield.h index e78466ee..5917158e 100644 --- a/src/object/task/taskshield.h +++ b/src/object/task/taskshield.h @@ -30,8 +30,8 @@ class CPhysics; class CObject; -#define RADIUS_SHIELD_MIN 40.0f // minimal radius of the protected zone -#define RADIUS_SHIELD_MAX 100.0f // maximal radius of the protected zone +const float RADIUS_SHIELD_MIN = 40.0f; // minimum radius of the protected zone +const float RADIUS_SHIELD_MAX = 100.0f; // maximum radius of the protected zone enum TaskShieldPhase diff --git a/src/object/task/taskterraform.cpp b/src/object/task/taskterraform.cpp index a3403f0e..1432c3ed 100644 --- a/src/object/task/taskterraform.cpp +++ b/src/object/task/taskterraform.cpp @@ -44,8 +44,8 @@ #include "object/task/taskterraform.h" -#define ENERGY_TERRA 0.40f // energy consumed by blow -#define ACTION_RADIUS 400.0f +const float ENERGY_TERRA = 0.40f; // energy consumed by blow +const float ACTION_RADIUS = 400.0f; diff --git a/src/physics/physics.cpp b/src/physics/physics.cpp index eb26d6e1..b105a440 100644 --- a/src/physics/physics.cpp +++ b/src/physics/physics.cpp @@ -49,9 +49,9 @@ -#define LANDING_SPEED 3.0f -#define LANDING_ACCEL 5.0f -#define LANDING_ACCELh 1.5f +const float LANDING_SPEED = 3.0f; +const float LANDING_ACCEL = 5.0f; +const float LANDING_ACCELh = 1.5f; diff --git a/src/physics/physics.h b/src/physics/physics.h index bc1c8b6f..5b3fa295 100644 --- a/src/physics/physics.h +++ b/src/physics/physics.h @@ -59,7 +59,7 @@ enum PhysicsMode }; -typedef struct +struct Motion { D3DVECTOR advanceAccel; // acceleration starting (+) D3DVECTOR recedeAccel; // acceleration starting (+) @@ -78,8 +78,7 @@ typedef struct D3DVECTOR realSpeed; // real speed(+/-) D3DVECTOR finalInclin; // final inclination -} -Motion; +}; diff --git a/src/script/script.cpp b/src/script/script.cpp index 8af8acc2..592d2a66 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -53,10 +53,10 @@ -#define CBOT_IPF 100 // CBOT: number of instructions / frame +const int CBOT_IPF = 100; // CBOT: number of instructions / frame -#define ERM_CONT 0 // if error -> continue -#define ERM_STOP 1 // if error -> stop +const int ERM_CONT = 0; // if error -> continue +const int ERM_STOP = 1; // if error -> stop diff --git a/src/sound/sound.cpp b/src/sound/sound.cpp index 5965c502..5b8f4696 100644 --- a/src/sound/sound.cpp +++ b/src/sound/sound.cpp @@ -35,8 +35,8 @@ ///////////////////////////////////////////////////////////////////////////// -#define LXIMAGE 640 -#define LYIMAGE 480 +const int LXIMAGE = 640; +const int LYIMAGE = 480; diff --git a/src/sound/sound.h b/src/sound/sound.h index ce1c79e2..e2ddb992 100644 --- a/src/sound/sound.h +++ b/src/sound/sound.h @@ -22,10 +22,10 @@ #include -#define MAXFILES 200 -#define MAXSOUND 32 -#define MAXVOLUME 20 -#define MAXOPER 4 +const int MAXFILES = 200; +const int MAXSOUND = 32; +const int MAXVOLUME = 20; +const int MAXOPER = 4; class CInstanceManager; @@ -123,7 +123,7 @@ enum SoundNext SOPER_LOOP = 3, }; -typedef struct +struct SoundOper { char bUsed; float finalAmplitude; @@ -131,10 +131,9 @@ typedef struct float totalTime; float currentTime; SoundNext nextOper; -} -SoundOper; +}; -typedef struct +struct SoundChannel { char bUsed; // buffer used? char bMute; // silence? @@ -151,8 +150,7 @@ typedef struct float volume; // 2D: volume 1..0 depending on position float pan; // 2D: pan -1..+1 depending on position SoundOper oper[MAXOPER]; -} -SoundChannel; +}; diff --git a/src/ui/button.cpp b/src/ui/button.cpp index 697122c7..701971cc 100644 --- a/src/ui/button.cpp +++ b/src/ui/button.cpp @@ -33,8 +33,8 @@ -#define DELAY1 0.4f -#define DELAY2 0.1f +const float DELAY1 = 0.4f; +const float DELAY2 = 0.1f; diff --git a/src/ui/color.cpp b/src/ui/color.cpp index 8876d276..bf635ff6 100644 --- a/src/ui/color.cpp +++ b/src/ui/color.cpp @@ -33,8 +33,8 @@ -#define DELAY1 0.4f -#define DELAY2 0.1f +const float DELAY1 = 0.4f; +const float DELAY2 = 0.1f; diff --git a/src/ui/control.h b/src/ui/control.h index f36e7baf..8f677c7f 100644 --- a/src/ui/control.h +++ b/src/ui/control.h @@ -32,23 +32,26 @@ class CParticule; class CSound; -#define STATE_ENABLE (1<<0) // active -#define STATE_CHECK (1<<1) // pressed -#define STATE_HILIGHT (1<<2) // overflown by mouse -#define STATE_PRESS (1<<3) // pressed by mouse -#define STATE_VISIBLE (1<<4) // visible -#define STATE_DEAD (1<<5) // inaccessible (x) -#define STATE_DEFAULT (1<<6) // actuated by RETURN -#define STATE_OKAY (1<<7) // green point at the bottom right -#define STATE_SHADOW (1<<8) // shadow -#define STATE_GLINT (1<<9) // dynamic reflection -#define STATE_CARD (1<<10) // tab -#define STATE_EXTEND (1<<11) // extended mode -#define STATE_SIMPLY (1<<12) // undecorated -#define STATE_FRAME (1<<13) // framework highlighting -#define STATE_WARNING (1<<14) // framework hatched yellow / black -#define STATE_VALUE (1<<15) // displays the value -#define STATE_RUN (1<<16) // running program +enum ControlState +{ + STATE_ENABLE = (1<<0), // active + STATE_CHECK = (1<<1), // pressed + STATE_HILIGHT = (1<<2), // overflown by mouse + STATE_PRESS = (1<<3), // pressed by mouse + STATE_VISIBLE = (1<<4), // visible + STATE_DEAD = (1<<5), // inaccessible (x) + STATE_DEFAULT = (1<<6), // actuated by RETURN + STATE_OKAY = (1<<7), // green point at the bottom right + STATE_SHADOW = (1<<8), // shadow + STATE_GLINT = (1<<9), // dynamic reflection + STATE_CARD = (1<<10), // tab + STATE_EXTEND = (1<<11), // extended mode + STATE_SIMPLY = (1<<12), // undecorated + STATE_FRAME = (1<<13), // framework highlighting + STATE_WARNING = (1<<14), // framework hatched yellow / black + STATE_VALUE = (1<<15), // displays the value + STATE_RUN = (1<<16) // running program +}; diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp index b30aeb12..a4e2131f 100644 --- a/src/ui/displayinfo.cpp +++ b/src/ui/displayinfo.cpp @@ -950,12 +950,11 @@ CObject* CDisplayInfo::SearchToto() // Creating the list of objects. -typedef struct +struct ObjectList { int total; ObjectType type; -} -ObjectList; +}; void ObjectAdd(ObjectList list[], ObjectType type) { diff --git a/src/ui/displaytext.cpp b/src/ui/displaytext.cpp index eb5cbeba..a1307a3e 100644 --- a/src/ui/displaytext.cpp +++ b/src/ui/displaytext.cpp @@ -43,7 +43,7 @@ -#define FONTSIZE 12.0f +const float FONTSIZE = 12.0f; diff --git a/src/ui/displaytext.h b/src/ui/displaytext.h index 934fc50b..2a2a6cba 100644 --- a/src/ui/displaytext.h +++ b/src/ui/displaytext.h @@ -37,7 +37,7 @@ enum TextType TT_MESSAGE = 4, }; -#define MAXDTLINE 4 +const int MAXDTLINE = 4; class CDisplayText diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp index 72c11378..92d190de 100644 --- a/src/ui/edit.cpp +++ b/src/ui/edit.cpp @@ -38,13 +38,13 @@ #include "ui/edit.h" -#define MARGX (5.0f/640.0f) -#define MARGY (5.0f/480.0f) -#define MARGYS (4.0f/480.0f) -#define MARGY1 (1.0f/480.0f) -#define DELAY_DBCLICK 0.3f // time limit for double-click -#define DELAY_SCROLL 0.1f // time limit for scroll -#define BIG_FONT 1.6f // expansion for \b; +const float MARGX = (5.0f/640.0f); +const float MARGY = (5.0f/480.0f); +const float MARGYS = (4.0f/480.0f); +const float MARGY1 = (1.0f/480.0f); +const float DELAY_DBCLICK = 0.3f; // time limit for double-click +const float DELAY_SCROLL = 0.1f; // time limit for scroll +const float BIG_FONT = 1.6f; // expansion for \b; diff --git a/src/ui/edit.h b/src/ui/edit.h index fb6d7aea..7ac6c53a 100644 --- a/src/ui/edit.h +++ b/src/ui/edit.h @@ -28,15 +28,15 @@ class CScroll; -#define EDITSTUDIOMAX 20000 // maximum number of characters in CBOT edit -#define EDITLINEMAX 1000 // maximum total number of lines -#define EDITIMAGEMAX 50 // maximum total number of lines with images -#define EDITLINKMAX 100 // maximum number of links -#define EDITHISTORYMAX 50 // max number of levels preserves +const int EDITSTUDIOMAX = 20000; // maximum number of characters in CBOT edit +const int EDITLINEMAX = 1000; // maximum total number of lines +const int EDITIMAGEMAX = 50; // maximum total number of lines with images +const int EDITLINKMAX = 100; // maximum number of links +const int EDITHISTORYMAX = 50; // max number of levels preserves -#define EDITUNDOMAX 20 // max number of successive undo +const int EDITUNDOMAX = 20; // max number of successive undo -typedef struct +struct EditUndo { char* text; // original text int len; // length of the text @@ -44,8 +44,7 @@ typedef struct int cursor2; // offset cursor int lineFirst; // the first line displayed. -} -EditUndo; +}; enum OperUndo { @@ -54,35 +53,31 @@ enum OperUndo OPERUNDO_DELETE = 2, // deleting characters }; -typedef struct +struct ImageLine { char name[40]; // name of the image (without diagram \) float offset; // vertical offset (v texture) float height; // height of the part (dv texture) float width; // width -} -ImageLine; +}; -typedef struct +struct HyperLink { char name[40]; // text file name (without help \) char marker[20]; // name of the marker -} -HyperLink; +}; -typedef struct +struct HyperMarker { char name[20]; // name of the marker int pos; // position in the text -} -HyperMarker; +}; -typedef struct +struct HyperHistory { char filename[50]; // full file name text int firstLine; // rank of the first displayed line -} -HyperHistory; +}; diff --git a/src/ui/interface.h b/src/ui/interface.h index 45435c0a..4c58997e 100644 --- a/src/ui/interface.h +++ b/src/ui/interface.h @@ -43,7 +43,7 @@ class CTarget; class CCamera; -#define MAXCONTROL 100 +const int MAXCONTROL = 100; class CInterface diff --git a/src/ui/list.cpp b/src/ui/list.cpp index c23aef9a..be9dbdae 100644 --- a/src/ui/list.cpp +++ b/src/ui/list.cpp @@ -36,7 +36,7 @@ -#define MARGING 4.0f +const float MARGING = 4.0f; diff --git a/src/ui/list.h b/src/ui/list.h index 82fd4701..ae55d35f 100644 --- a/src/ui/list.h +++ b/src/ui/list.h @@ -28,8 +28,8 @@ class CButton; class CScroll; -#define LISTMAXDISPLAY 20 // maximum number of visible lines -#define LISTMAXTOTAL 100 // maximum total number of lines +const int LISTMAXDISPLAY = 20; // maximum number of visible lines +const int LISTMAXTOTAL = 100; // maximum total number of lines diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index 40ac4c9c..175474d4 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -61,15 +61,15 @@ -#define KEY_VISIBLE 6 // number of visible keys redefinable +const int KEY_VISIBLE = 6; // number of visible keys redefinable #if _SCHOOL & _TEEN -#define KEY_TOTAL 13 // total number of keys redefinable +const int KEY_TOTAL = 13; // total number of keys redefinable #else -#define KEY_TOTAL 21 // total number of keys redefinable +const int KEY_TOTAL = 21; // total number of keys redefinable #endif -#define WELCOME_LENGTH 6.0f +const int WELCOME_LENGTH = 6.0f; diff --git a/src/ui/maindialog.h b/src/ui/maindialog.h index 4062c8dc..9173dde8 100644 --- a/src/ui/maindialog.h +++ b/src/ui/maindialog.h @@ -34,25 +34,23 @@ class CParticule; class CSound; -#define USERLISTMAX 100 -#define MAXSCENE 1000 +const int USERLISTMAX = 100; +const int MAXSCENE = 1000; -typedef struct +struct SceneInfo { char numTry; char bPassed; -} -SceneInfo; +}; -typedef struct +struct GamerPerso { int face; // face int glasses; // glasses D3DCOLORVALUE colorHair; // hair color D3DCOLORVALUE colorCombi; // spacesuit volor D3DCOLORVALUE colorBand; // strips color -} -GamerPerso; +}; diff --git a/src/ui/mainmap.cpp b/src/ui/mainmap.cpp index 9575cbcf..72452d85 100644 --- a/src/ui/mainmap.cpp +++ b/src/ui/mainmap.cpp @@ -40,8 +40,8 @@ -#define ZOOM_MIN 1.0f -#define ZOOM_MAX 16.0f +const float ZOOM_MIN = 1.0f; +const float ZOOM_MAX = 16.0f; diff --git a/src/ui/map.h b/src/ui/map.h index 0a10dbf6..f2df265e 100644 --- a/src/ui/map.h +++ b/src/ui/map.h @@ -31,7 +31,7 @@ class CRobotMain; -#define MAPMAXOBJECT 100 +const int MAPMAXOBJECT = 100; enum MapColor { @@ -48,7 +48,7 @@ enum MapColor MAPCOLOR_BBOX, }; -typedef struct +struct MapObject { char bUsed; CObject* object; @@ -56,8 +56,7 @@ typedef struct ObjectType type; FPOINT pos; float dir; -} -MapObject; +}; diff --git a/src/ui/scroll.h b/src/ui/scroll.h index 738581a1..67dc543d 100644 --- a/src/ui/scroll.h +++ b/src/ui/scroll.h @@ -27,7 +27,7 @@ class CD3DEngine; class CButton; -#define SCROLL_WIDTH (15.0f/640.0f) +const float SCROLL_WIDTH = (15.0f/640.0f); diff --git a/src/ui/slider.cpp b/src/ui/slider.cpp index f01cd3f1..6c2a46a6 100644 --- a/src/ui/slider.cpp +++ b/src/ui/slider.cpp @@ -35,8 +35,8 @@ -#define CURSOR_WIDTH (10.0f/640.0f) -#define HOLE_WIDTH (5.0f/480.0f) +const float CURSOR_WIDTH = (10.0f/640.0f); +const float HOLE_WIDTH = (5.0f/480.0f); diff --git a/src/ui/window.h b/src/ui/window.h index 86ae6f2f..b06fcfbe 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -42,7 +42,7 @@ class CCompass; class CTarget; -#define MAXWINDOW 100 +const int MAXWINDOW = 100; class CWindow : public CControl