diff --git a/code/redalert/cell.cpp b/code/redalert/cell.cpp index 8789995..6e06340 100644 --- a/code/redalert/cell.cpp +++ b/code/redalert/cell.cpp @@ -1032,11 +1032,18 @@ bool CellClass::ScreenCoordsToIsoTile(int x, int y, int &tileX, int &tileY) { void CellClass::ConvertIsoCoordsToScreen(int& x, int& y) { int tileX, tileY; - if (!CellClass::ScreenCoordsToIsoTile(x, y, tileX, tileY)) { - return; - } - x = tileX * CELL_PIXEL_W; - y = tileY * CELL_PIXEL_H; + x = x - (ScreenWidth / 2); + y = y + (ScreenWidth / 4); + + float tempPt_x = (2 * y + x); + float tempPt_y = (2 * y - x); + + //x = floor(tempPt_x / (CELL_PIXEL_W)) * CELL_PIXEL_W; + //y = floor(tempPt_y / (CELL_PIXEL_H)) * CELL_PIXEL_H; + x = tempPt_x - CELL_PIXEL_W; + y = tempPt_y - CELL_PIXEL_H; + + Console_Printf("%d %d\n", x, y); } bool CellClass::ScreenCoordsToIsoCoords(COORDINATE screenCoord, COORDINATE& isoCoord) { diff --git a/code/redalert/display.cpp b/code/redalert/display.cpp index ee907cd..61af377 100644 --- a/code/redalert/display.cpp +++ b/code/redalert/display.cpp @@ -3298,7 +3298,7 @@ int DisplayClass::TacticalClass::Action(unsigned flags, KeyNumType & key) ** intercepted and possible rubber-band mode is flagged. */ if (flags & LEFTRELEASE) { - Map.Mouse_Left_Release(cell, x, y, object, action); + Map.Mouse_Left_Release(cell, screenX, screenY, object, action); } /* @@ -3886,7 +3886,14 @@ void DisplayClass::Mouse_Left_Release(CELL cell, int x, int y, ObjectClass * obj if (IsRubberBand) { Refresh_Band(); - Select_These(XYP_Coord(BandX, BandY), XYP_Coord(x, y)); + int _BandX = BandX; + int _BandY = BandY; + int _x = x; + int _y = y; + + CellClass::ConvertIsoCoordsToScreen(_BandX, _BandY); + CellClass::ConvertIsoCoordsToScreen(_x, _y); + Select_These(XYP_Coord(_BandX, _BandY), XYP_Coord(_x, _y)); Set_Default_Mouse(MOUSE_NORMAL, wsmall); IsRubberBand = false;