Isometric tiles will no longer render on top of each other.

This commit is contained in:
Justin Marshall
2020-07-01 14:13:28 -07:00
parent c7748a616d
commit ede9d518bf
4 changed files with 27 additions and 5 deletions
+11 -2
View File
@@ -999,13 +999,14 @@ bool CellClass::Get_Template_Info(char *template_name, int &icon, void *&image_d
}
void CellClass::ConvertCoordsToIsometric(int& x, int& y) {
y = y * 2;
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 = sx;// + (CELL_PIXEL_W / 2);
y = sy;// + (CELL_PIXEL_W / 2);
x = x + (ScreenWidth / 2);
}
@@ -1306,6 +1307,14 @@ void CellClass::Draw_It(int x, int y, bool objects)
#ifdef CHEAT_KEYS
}
#endif
//{
// int isox = x, isoy = y;
// ConvertCoordsToIsometric(isox, isoy);
// char tmp[12];
// sprintf(tmp, "%d", cell);
// GL_DrawText(6, isox, isoy, tmp);
//}
BEnd(BENCH_CELL);
}
+11
View File
@@ -81,6 +81,17 @@ void GL_DrawText(int color, int x, int y, char* text) {
ImGui::GetBackgroundDrawList()->AddText(pos, ImGui::ColorConvertFloat4ToU32(ImVec4(r, g, b, 1)), text);
}
void GL_DrawForegroundText(int color, int x, int y, char* text) {
ImVec2 pos(x, y);
if (color == 0 || color == 160) { // This is a hack!
color = g_ColorXlat[color % 15];
}
float r = backbuffer_palette[(color * 3) + 0] / 255.0f;
float g = backbuffer_palette[(color * 3) + 1] / 255.0f;
float b = backbuffer_palette[(color * 3) + 2] / 255.0f;
ImGui::GetForegroundDrawList()->AddText(pos, ImGui::ColorConvertFloat4ToU32(ImVec4(r, g, b, 1)), text);
}
void GL_DrawLine(int color, int x, int y, int dx, int dy) {
ImVec2 pos(x, y);
ImVec2 pos2(dx, dy);
+2 -1
View File
@@ -9,4 +9,5 @@ void GL_FillRect(int color, int x, int y, int width, int height);
void GL_DrawLine(int color, int x, int y, int dx, int dy);
void GL_ResetClipRect(void);
void GL_SetClipRect(int x, int y, int width, int height);
void GL_ForceForegroundRender(bool force);
void GL_ForceForegroundRender(bool force);
void GL_DrawForegroundText(int color, int x, int y, char* text);
+3 -2
View File
@@ -267,8 +267,9 @@ void __cdecl Buffer_Draw_Stamp_Clip2(GraphicViewPortClass& viewport, const void
// src += IconWidth;
//}
if (iconImage->HouseImages[0].image[icon_index] == 0)
return;
if (iconImage->HouseImages[0].image[icon_index][0] == 0) {
icon_index = 0;
}
GL_SetClipRect(xstart, ystart, blit_width, blit_height);
GL_RenderImage(iconImage, xstart, ystart, blit_width, blit_height, 0, icon_index);