summaryrefslogtreecommitdiffstats
path: root/src/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics')
-rw-r--r--src/graphics/common/blitz.h4
-rw-r--r--src/graphics/common/cloud.cpp2
-rw-r--r--src/graphics/common/cloud.h7
-rw-r--r--src/graphics/common/light.h12
-rw-r--r--src/graphics/common/model.cpp6
-rw-r--r--src/graphics/common/particule.cpp4
-rw-r--r--src/graphics/common/particule.h38
-rw-r--r--src/graphics/common/planet.h7
-rw-r--r--src/graphics/common/pyro.h10
-rw-r--r--src/graphics/common/terrain.cpp2
-rw-r--r--src/graphics/common/terrain.h29
-rw-r--r--src/graphics/common/text.h14
-rw-r--r--src/graphics/common/water.h14
-rw-r--r--src/graphics/d3d/d3dengine.cpp17
-rw-r--r--src/graphics/d3d/d3dengine.h103
15 files changed, 123 insertions, 146 deletions
diff --git a/src/graphics/common/blitz.h b/src/graphics/common/blitz.h
index 59268b5..d492654 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 75e44d6..1d4f6d9 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 2be63c7..cf97bc7 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 2ae8d2a..2b20094 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 324f219..fa1fe1c 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 d84ca22..edf9c3d 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 06fca92..4014060 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 75af350..fd2f0f2 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 b34842a..d898a94 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 06bf90f..af0bb6e 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 50f5612..1ea5a6a 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 5d41c5c..defa218 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 c0593a0..7a7ffef 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 5b0dde0..53f651f 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 ca821aa..40744a4 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)
-
-
-typedef struct
+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)
+
+
+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;
+};