mirror of
https://github.com/jmarshall23/CnC_Remastered_Collection.git
synced 2026-08-12 08:00:55 +02:00
DisplayTacticalCoord will now store the result instead of recalc everytime its needed.
This commit is contained in:
@@ -1241,11 +1241,10 @@ bool DisplayClass::Scroll_Map(DirType facing, int & distance, bool really)
|
||||
int neighborCellX = weights[crude].x * (distance * 0.4f);
|
||||
int neighbotCellY = weights[crude].y * (distance * 0.4f);
|
||||
DisplayTacticalCoord newCoord = TacticalCoord;
|
||||
newCoord.x += Pixel_To_Lepton(neighborCellX);
|
||||
newCoord.y += Pixel_To_Lepton(neighbotCellY);
|
||||
newCoord.AddPixelXY(neighborCellX, neighbotCellY);
|
||||
|
||||
int sx = Lepton_To_Pixel(newCoord.x);
|
||||
int sy = Lepton_To_Pixel(newCoord.y);
|
||||
int sx = Lepton_To_Pixel(newCoord.GetX());
|
||||
int sy = Lepton_To_Pixel(newCoord.GetY());
|
||||
CellClass::ConvertCoordsToIsometric(sx, sy);
|
||||
sy += (ScreenWidth / 4);
|
||||
sy += ScreenHeight / 2;
|
||||
|
||||
@@ -10,17 +10,29 @@ DisplayTacticalCoord::DisplayTacticalCoord() {
|
||||
|
||||
DisplayTacticalCoord::DisplayTacticalCoord(COORDINATE coord)
|
||||
{
|
||||
SetFromCoordinate(coord);
|
||||
SetFromCoordinate(coord);
|
||||
}
|
||||
|
||||
COORDINATE DisplayTacticalCoord::GetCoordinate() const
|
||||
{
|
||||
return XY_Coord(x, y);
|
||||
return coord;
|
||||
}
|
||||
|
||||
void DisplayTacticalCoord::SetXY(int x, int y) {
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->coord = XY_Coord(x, y);
|
||||
}
|
||||
|
||||
void DisplayTacticalCoord::SetFromCoordinate(COORDINATE coord)
|
||||
{
|
||||
//Map.Coord_To_Pixel(coord, x, y);
|
||||
this->coord = coord;
|
||||
x = Coord_X(coord);
|
||||
y = Coord_Y(coord);
|
||||
}
|
||||
|
||||
void DisplayTacticalCoord::AddPixelXY(int x, int y) {
|
||||
int _x = this->x + Pixel_To_Lepton(x);
|
||||
int _y = this->y + Pixel_To_Lepton(y);
|
||||
SetXY(_x, _y);
|
||||
}
|
||||
@@ -9,7 +9,14 @@ struct DisplayTacticalCoord {
|
||||
COORDINATE GetCoordinate() const;
|
||||
|
||||
void SetFromCoordinate(COORDINATE coord);
|
||||
void SetXY(int x, int y);
|
||||
|
||||
int GetX() { return x; }
|
||||
int GetY() { return y; }
|
||||
|
||||
void AddPixelXY(int x, int y);
|
||||
private:
|
||||
int x;
|
||||
int y;
|
||||
COORDINATE coord;
|
||||
};
|
||||
Reference in New Issue
Block a user