Initial test code to render isometric tiles, including test art and test map.

This commit is contained in:
Justin Marshall
2020-06-26 20:07:36 -07:00
parent d3fca9b7d2
commit 2a74c0750e
9 changed files with 444 additions and 9 deletions
+15 -4
View File
@@ -569,10 +569,10 @@ short const * DisplayClass::Text_Overlap_List(char const * text, int x, int y) c
void DisplayClass::Set_View_Dimensions(int x, int y, int width, int height)
{
if (width == -1) width = SeenBuff.Get_Width();
TacLeptonWidth = Pixel_To_Lepton( width - x);
TacLeptonWidth = Pixel_To_Lepton( width - x) * 2;
if (height == -1) height = SeenBuff.Get_Height();
TacLeptonHeight = Pixel_To_Lepton(height - y);
TacLeptonHeight = Pixel_To_Lepton(height - y) * 2;
/*
** Adjust the tactical cell if it is now in an invalid position
@@ -1756,6 +1756,17 @@ 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);
}
}
@@ -2344,7 +2355,7 @@ void DisplayClass::Redraw_Icons(void)
/*
** Only cells flagged to be redraw are examined.
*/
if (In_View(cell) && Is_Cell_Flagged(cell)) {
{
int xpixel;
int ypixel;
@@ -2403,7 +2414,7 @@ void DisplayClass::Redraw_OIcons(void)
cellptr->Draw_It(xpixel, ypixel, true);
}
}
}
}
}
}
}
+4 -2
View File
@@ -40,9 +40,11 @@
struct Image_t;
#define ICON_PIXEL_W 24
// jmarshall - isometric
#define ICON_PIXEL_W 48
#define ICON_PIXEL_H 24
#define ICON_LEPTON_W 256
// jmarshall end
#define ICON_LEPTON_W 512
#define ICON_LEPTON_H 256
#define CELL_PIXEL_W ICON_PIXEL_W
#define CELL_PIXEL_H ICON_PIXEL_H
+3 -3
View File
@@ -219,7 +219,7 @@ Image_t* Load_StampHD(int theater, const char* iconName, const void* icondata) {
{
const char* tileEntryName = Tileset_FindHDTexture(theater, fixedIconName, i, d);
sprintf(filename, "DATA/ART/TEXTURES/SRGB/RED_ALERT/TERRAIN/%s/%s", Theaters[theater].Name, tileEntryName);
COM_SetExtension(filename, sizeof(filename), ".dds");
//COM_SetExtension(filename, sizeof(filename), ".dds");
if (image == NULL) {
// If the image is already loaded, then we are done.
@@ -330,8 +330,8 @@ void __cdecl Buffer_Draw_Stamp_Clip2(GraphicViewPortClass& viewport, const void
uint8_t* MapPtr = (uint8_t * )iconImage->IconMapPtr;
int icon_index = MapPtr != nullptr ? MapPtr[icon] : icon;
{
int blit_height = iconImage->renderheight[0];
int blit_width = iconImage->renderwidth[0];
int blit_height = CELL_PIXEL_H;
int blit_width = CELL_PIXEL_W;
int width = left + right;
int xstart = left + x;