mirror of
https://github.com/jmarshall23/CnC_Remastered_Collection.git
synced 2026-08-12 08:00:55 +02:00
Ruberband selection now works better.
This commit is contained in:
+12
-5
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user