Isometric coordinate conversion is now only applied to rendering the tiles.

This commit is contained in:
Justin Marshall
2020-06-27 09:49:41 -07:00
parent 2a74c0750e
commit 4e1be3e1cb
3 changed files with 38 additions and 44 deletions
+13 -28
View File
@@ -145,32 +145,17 @@ Height=30
1=BwAAIIH//v8f/4AHAAAggf/+/x//gAcAACCB//7/H/+ABwAAIIH//v8f/4AHAAAggQD+/x
2=8AgAcAACCBAP7/HwCA
[TERRAIN]
8638=T01
8778=T01
7989=T01
6453=T01
8008=T01
8399=T01
7503=T01
8631=T01
9781=T01
8883=T01
9147=T03
9043=T03
8280=T03
6998=T03
7519=TC04
8923=TC05
[UNITS]
0=Spain,4TNK,256,9288,0,Guard,None
0=USSR,4TNK,256,7495,0,Guard,None
1=USSR,4TNK,256,7882,0,Guard,None
2=USSR,4TNK,256,7500,0,Guard,None
3=Spain,TRUK,256,7241,0,Guard,None
[STRUCTURES]
0=USSR,IRON,256,7115,0,None,0,0
1=USSR,WEAP,256,6978,0,None,0,0
2=USSR,FACT,256,7355,0,None,0,0
3=USSR,PROC,256,7873,0,None,0,0
0=Spain,IRON,256,7369,0,None,0,0
1=Spain,WEAP,256,6856,0,None,0,0
2=Spain,PDOX,256,7115,0,None,0,0
3=Spain,IRON,256,7109,0,None,0,0
[Base]
Player=USSR
@@ -180,11 +165,11 @@ Count=0
1=BwAAIIH//v8f/4AHAAAggf/+/x//gA==
[Briefing]
1=Rescue Einstein from the Headquarters inside this Soviet complex. Once
2=found, evacuate him via the helicopter at the signal flare. Einstein and
3=Tanya must be kept alive at all costs. Beware the Soviet's Tesla Coils.
4=Direct Tanya to destroy the westmost power plants to take them off-line.
1=A pitiful excuse for resistance has blockaded itself in this village.
2=Stalin has decided to make an example of them. Kill them all and destroy
3=their homes. You will have Yak aircraft to use in teaching these rebels a
4=lesson.
[Digest]
1=pInr5IMV1Wll5YhV9IYdIxGdJ24=
1=eLepta/L7Dh96Ko1pPa9tfZK7oU=
+17 -11
View File
@@ -1756,17 +1756,6 @@ bool DisplayClass::Coord_To_Pixel(COORDINATE coord, int &x, int &y) const
if ((int)yoff <= TacLeptonHeight + EDGE_ZONE*2) {
x = Lepton_To_Pixel(xoff)-CELL_PIXEL_W*2;
y = Lepton_To_Pixel(yoff)-CELL_PIXEL_H*2;
// jmarshall - isometric
int tileWidth = CELL_PIXEL_W;
int tileHeight = CELL_PIXEL_H;
int sx = (x / CELL_PIXEL_W) * (tileWidth / 2) - (y / CELL_PIXEL_W) * (tileWidth / 2);
int sy = (x / CELL_PIXEL_W) * (tileHeight / 2) + (y / CELL_PIXEL_W) * (tileHeight / 2);
x = sx + (CELL_PIXEL_W / 2);
y = sy + (CELL_PIXEL_W / 2);
x = x + (ScreenWidth / 2);
// jmarshall end
return(true);
}
}
@@ -2323,6 +2312,19 @@ ObjectClass * DisplayClass::Cell_Object(CELL cell, int x, int y) const
}
}
// jmarshall - isometric
void DisplayClass::ConvertCoordsToIsometric(int& x, int& y) {
int tileWidth = CELL_PIXEL_W;
int tileHeight = CELL_PIXEL_H;
int sx = (x / CELL_PIXEL_W) * (tileWidth / 2) - (y / CELL_PIXEL_W) * (tileWidth / 2);
int sy = (x / CELL_PIXEL_W) * (tileHeight / 2) + (y / CELL_PIXEL_W) * (tileHeight / 2);
x = sx + (CELL_PIXEL_W / 2);
y = sy + (CELL_PIXEL_W / 2);
x = x + (ScreenWidth / 2);
}
// jmarshall end
/***********************************************************************************************
* DisplayClass::Redraw_Icons -- Draws all terrain icons necessary. *
@@ -2360,6 +2362,8 @@ void DisplayClass::Redraw_Icons(void)
int ypixel;
if (Coord_To_Pixel(coord, xpixel, ypixel)) {
ConvertCoordsToIsometric(xpixel, ypixel);
CellClass * cellptr = &(*this)[coord];
/*
@@ -2405,6 +2409,8 @@ void DisplayClass::Redraw_OIcons(void)
if (Coord_To_Pixel(coord, xpixel, ypixel)) {
CellClass * cellptr = &(*this)[coord];
// ConvertCoordsToIsometric(xpixel, ypixel);
/*
** If there is a portion of the underlying icon that could be visible,
** then draw it. Also draw the cell if the shroud is off.
+7 -4
View File
@@ -41,11 +41,11 @@
struct Image_t;
// jmarshall - isometric
#define ICON_PIXEL_W 48
#define ICON_PIXEL_H 24
#define ICON_PIXEL_W 24
#define ICON_PIXEL_H 12
// jmarshall end
#define ICON_LEPTON_W 512
#define ICON_LEPTON_H 256
#define ICON_LEPTON_W 256
#define ICON_LEPTON_H 128
#define CELL_PIXEL_W ICON_PIXEL_W
#define CELL_PIXEL_H ICON_PIXEL_H
#define CELL_LEPTON_W ICON_LEPTON_W
@@ -222,6 +222,9 @@ class DisplayClass: public MapClass
*/
int TacPixelX;
int TacPixelY;
// jmarshall
static void ConvertCoordsToIsometric(int& x, int& y);
// jmarshall end
/*
** This is the coordinate that the tactical map should be in at next available opportunity.