From 318cfe0cfc8a11d4bd7ff3065cf85d0ce85b3d44 Mon Sep 17 00:00:00 2001 From: Justin Marshall Date: Sun, 5 Jul 2020 19:55:03 -0700 Subject: [PATCH] Iso tiles now render into the radar view. --- code/redalert/radar.cpp | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/code/redalert/radar.cpp b/code/redalert/radar.cpp index 1f40905..138f54c 100644 --- a/code/redalert/radar.cpp +++ b/code/redalert/radar.cpp @@ -1081,28 +1081,13 @@ void RadarClass::Plot_Radar_Pixel(CELL cell) ptr = &TemplateTypeClass::As_Reference(TEMPLATE_CLEAR1); icon = cellptr->Clear_Icon(); } -// jmarshall - fix radar -// IconsetClass const * iconset = (IconsetClass const *)ptr->Get_Image_Data(); -// unsigned char const * icondata = iconset->Icon_Data(); -// -// -// /* -// ** Convert the logical icon number into the actual icon number. -// */ -// icon &= 0x00FF; -// icon = *(iconset->Map_Data() + icon); -//// jmarshall -// unsigned char * data = (unsigned char *)icondata + icon*(24*24); -// Image_t* image; -// { -// char tmp[512]; -// sprintf(tmp, "radar_%d_%d", ptr->Type, icon); -// image = Image_CreateImageFrom8Bit(tmp, 24, 24, (unsigned char*)data); -// } -// GL_RenderImage(image, x, y, ZoomFactor, ZoomFactor); -// jmarshall end - //Buffer_To_Page(0, 0, 24, 24, data, _TileStage); - //_TileStage.Scale(*LogicPage, 0, 0, x, y, 24, 24, ZoomFactor, ZoomFactor, TRUE); + IsoTile *tile = (IsoTile *)ptr->Get_Image_Data(); + if(icon > tile->NumTiles() || tile->GetTileInfo(icon) == NULL) { + icon = 0; + } + + IsoTileImageHeader* tileHeader = tile->GetTileInfo(icon); + GL_FillRect(tileHeader->LowRGB.GetRawRed(), tileHeader->LowRGB.GetRawGreen(), tileHeader->LowRGB.GetRawBlue(), x, y,ZoomFactor, ZoomFactor); } else { // LogicPage->Fill_Rect(x, y, x+ZoomFactor-1, y+ZoomFactor-1, cellptr->Cell_Color(false)); /*BG*/ LogicPage->Put_Pixel(x, y, cellptr->Cell_Color(false));