mirror of
https://github.com/electronicarts/CNC_TS_and_RA2_Mission_Editor.git
synced 2025-07-18 20:26:42 -04:00
code reformatted .
This commit is contained in:
parent
76d336504f
commit
1de6ad56c2
265 changed files with 18240 additions and 21591 deletions
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// This code determines the cell values for
|
||||
|
@ -31,34 +31,34 @@
|
|||
|
||||
int calcXPos(int x, int y)
|
||||
{
|
||||
int x1=x*256+128;
|
||||
|
||||
int y1 = y*256 + 128;
|
||||
int x1 = x * 256 + 128;
|
||||
|
||||
int y1 = y * 256 + 128;
|
||||
|
||||
int x2 = (x1 - y1) * 30;
|
||||
|
||||
int y2 = (x1 + y1) * 15;
|
||||
|
||||
int x3 = (x2/256 + 512*30) / 60;
|
||||
int x3 = (x2 / 256 + 512 * 30) / 60;
|
||||
|
||||
int y3 = (y2/256) / 30;
|
||||
int y3 = (y2 / 256) / 30;
|
||||
|
||||
return x3;
|
||||
}
|
||||
|
||||
int calcYPos(int x, int y)
|
||||
{
|
||||
int x1=x*256+128;
|
||||
|
||||
int y1 = y*256 + 128;
|
||||
int x1 = x * 256 + 128;
|
||||
|
||||
int y1 = y * 256 + 128;
|
||||
|
||||
int x2 = (x1 - y1) * 30;
|
||||
|
||||
int y2 = (x1 + y1) * 15;
|
||||
|
||||
int x3 = (x2/256 + 512*30) / 60;
|
||||
int x3 = (x2 / 256 + 512 * 30) / 60;
|
||||
|
||||
int y3 = (y2/256) / 30;
|
||||
int y3 = (y2 / 256) / 30;
|
||||
|
||||
return y3;
|
||||
}
|
||||
|
@ -69,84 +69,81 @@ struct MRECT
|
|||
int Y;
|
||||
int Width;
|
||||
int Height;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
void MC_GetHeaderRect(int& startx, int& starty, int& width, int& height)
|
||||
{
|
||||
int leastx=10000;
|
||||
int leasty=10000;
|
||||
int mostx=0;
|
||||
int mosty=0;
|
||||
int leastx = 10000;
|
||||
int leasty = 10000;
|
||||
int mostx = 0;
|
||||
int mosty = 0;
|
||||
|
||||
MRECT LocalRect, PlayRect;
|
||||
|
||||
RECT r;
|
||||
Map->GetLocalSize(&r);
|
||||
LocalRect.X=r.left;
|
||||
LocalRect.Y=r.top;
|
||||
LocalRect.Width=r.right;
|
||||
LocalRect.Height=r.bottom;
|
||||
LocalRect.X = r.left;
|
||||
LocalRect.Y = r.top;
|
||||
LocalRect.Width = r.right;
|
||||
LocalRect.Height = r.bottom;
|
||||
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
PlayRect.X=0;
|
||||
PlayRect.Y=0;
|
||||
PlayRect.Width=Map->GetWidth();
|
||||
PlayRect.Height=Map->GetHeight();
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
PlayRect.X = 0;
|
||||
PlayRect.Y = 0;
|
||||
PlayRect.Width = Map->GetWidth();
|
||||
PlayRect.Height = Map->GetHeight();
|
||||
|
||||
char c[50];
|
||||
char d[50];
|
||||
itoa(LocalRect.Width, c, 10);
|
||||
|
||||
int x,y;
|
||||
int max=Map->GetIsoSize();
|
||||
for(x=0;x<max;x++)
|
||||
{
|
||||
for(y=0;y<max;y++)
|
||||
{
|
||||
int height=0;
|
||||
|
||||
if (TRUE) {
|
||||
int x, y;
|
||||
int max = Map->GetIsoSize();
|
||||
for (x = 0; x < max; x++) {
|
||||
for (y = 0; y < max; y++) {
|
||||
int height = 0;
|
||||
|
||||
height = Map->GetHeightAt(y+x*max); // remember: x/y switched here, WS coordinate system
|
||||
|
||||
// fudge ramps at the top of the map so that they end up considered not in the local rect
|
||||
//if (cell->ramp && x + y < PlayRect.Width + 2*LocalRect.Y + 4 + height) {
|
||||
//height++;
|
||||
//}
|
||||
}
|
||||
if (TRUE) {
|
||||
|
||||
height = Map->GetHeightAt(y + x * max); // remember: x/y switched here, WS coordinate system
|
||||
|
||||
// fudge ramps at the top of the map so that they end up considered not in the local rect
|
||||
//if (cell->ramp && x + y < PlayRect.Width + 2*LocalRect.Y + 4 + height) {
|
||||
//height++;
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
if ((x + y > PlayRect.Width + 2*LocalRect.Y + height) &&
|
||||
(x + y <= PlayRect.Width + 2*(LocalRect.Y + LocalRect.Height + 1) + height) &&
|
||||
(x - y < 2*(LocalRect.X + LocalRect.Width) - PlayRect.Width) &&
|
||||
(y - x < PlayRect.Width - 2*LocalRect.X))
|
||||
//if ((x + y > PlayRect.Width) && (x - y < PlayRect.Width) && (y - x < PlayRect.Width) && (x + y <= PlayRect.Width + 2 * PlayRect.Height))
|
||||
{
|
||||
int rx=calcXPos(x,y);
|
||||
int ry=calcYPos(x,y);
|
||||
if ((x + y > PlayRect.Width + 2 * LocalRect.Y + height) &&
|
||||
(x + y <= PlayRect.Width + 2 * (LocalRect.Y + LocalRect.Height + 1) + height) &&
|
||||
(x - y < 2 * (LocalRect.X + LocalRect.Width) - PlayRect.Width) &&
|
||||
(y - x < PlayRect.Width - 2 * LocalRect.X))
|
||||
//if ((x + y > PlayRect.Width) && (x - y < PlayRect.Width) && (y - x < PlayRect.Width) && (x + y <= PlayRect.Width + 2 * PlayRect.Height))
|
||||
{
|
||||
int rx = calcXPos(x, y);
|
||||
int ry = calcYPos(x, y);
|
||||
|
||||
if (rx < leastx)
|
||||
leastx = rx;
|
||||
|
||||
if (rx > mostx)
|
||||
|
||||
if (rx > mostx)
|
||||
mostx = rx;
|
||||
|
||||
if (ry < leasty)
|
||||
|
||||
if (ry < leasty)
|
||||
leasty = ry;
|
||||
|
||||
if (ry > mosty)
|
||||
|
||||
if (ry > mosty)
|
||||
mosty = ry;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
startx=leastx;
|
||||
starty=leasty;
|
||||
width=mostx-leastx;
|
||||
height=mosty-leasty;
|
||||
startx = leastx;
|
||||
starty = leasty;
|
||||
width = mostx - leastx;
|
||||
height = mosty - leasty;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue