code reformatted .

This commit is contained in:
Zero Fanker 2024-04-16 20:51:17 -04:00
parent 76d336504f
commit 1de6ad56c2
265 changed files with 18240 additions and 21591 deletions

View file

@ -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/>.
*/
#if !defined(AFX_ISOVIEW_H__7FB6D6A0_7B52_11D3_99E1_DA6DFD21E706__INCLUDED_)
@ -46,7 +46,7 @@ struct TextToRender
int drawx;
int drawy;
int color;
bool fixedScreenPos = false;
bool fixedScreenPos = false;
bool useFont9 = false;
bool centered = false;
};
@ -66,7 +66,7 @@ class CIsoView : public CView
protected:
DECLARE_DYNCREATE(CIsoView)
// attributes
// attributes
public:
INT m_mapx;
INT m_mapy;
@ -94,18 +94,18 @@ private:
std::vector<TextToRender> m_texts_to_render;
std::vector<WaypointToRender> m_waypoints_to_render;
// operations
// operations
public:
CIsoView();
CIsoView();
virtual ~CIsoView();
// overwriteables
//{{AFX_VIRTUAL(CIsoView)
public:
// overwriteables
//{{AFX_VIRTUAL(CIsoView)
public:
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
protected:
protected:
virtual void OnDraw(CDC* pDC); // Überschrieben zum Zeichnen dieser Ansicht
virtual void OnInitialUpdate(); // Zum ersten Mal nach der Konstruktion
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
@ -114,7 +114,7 @@ public:
// implementation
protected:
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
@ -129,7 +129,7 @@ protected:
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMove(int x, int y);
afx_msg void OnSize(UINT nType, int cx, int cy);
@ -170,21 +170,21 @@ public:
int m_BrushSize_x;
int m_BrushSize_y;
BOOL ReachableFrom(DWORD dwStart, DWORD dwEnd);
void __fastcall ChangeTileHeight(DWORD dwPos, DWORD dwNewHeight, BOOL bNonMorphableMove, BOOL bOnlyThisTile=FALSE, BOOL bNoSlopes=FALSE);
void UpdateOverlayPictures(int id=-1);
void __fastcall ChangeTileHeight(DWORD dwPos, DWORD dwNewHeight, BOOL bNonMorphableMove, BOOL bOnlyThisTile = FALSE, BOOL bNoSlopes = FALSE);
void UpdateOverlayPictures(int id = -1);
void UpdateStatusBar(int x, int y);
void DrawCell(int x, int y, int w, int h, COLORREF col, BOOL dotted=FALSE, HDC hDC=nullptr);
void DrawCell(void* dest, int dest_width, int dest_height, int dest_pitch, int x, int y, int w, int h, int col, bool dotted=false, bool touchNeighbours=false, int colNeighbour=CLR_INVALID) const;
void DrawCell(int x, int y, int w, int h, COLORREF col, BOOL dotted = FALSE, HDC hDC = nullptr);
void DrawCell(void* dest, int dest_width, int dest_height, int dest_pitch, int x, int y, int w, int h, int col, bool dotted = false, bool touchNeighbours = false, int colNeighbour = CLR_INVALID) const;
void DrawCellCursor(const MapCoords& mapCoords, const DDSURFACEDESC2& desc);
void DrawTube(const CTube& tube, const DDSURFACEDESC2* ddsd=nullptr, const COLORREF* color=nullptr) const;
void DrawTube(const CTube& tube, const DDSURFACEDESC2* ddsd = nullptr, const COLORREF* color = nullptr) const;
/// <summary>
/// Converts from (world) pixel coordinates to logical map coordinates
/// </summary>
/// <param name="projCoords">World pixel coordinates</param>
/// <returns>Logical map coordinates</returns>
MapCoords GetMapCoordinates(const ProjectedCoords& projCoords, bool bAllowAccessBehindCliffs=false, bool ignoreHideFlags = false) const;
MapCoords GetMapCoordinates(const ProjectedCoords& projCoords, bool bAllowAccessBehindCliffs = false, bool ignoreHideFlags = false) const;
/// <summary>
/// Converts from view / render target pixel coordinates (0/0 is top left corner of screen) to logical map coordinates
/// If you use mouse-move coordinates you need to
@ -264,77 +264,70 @@ public:
void SetError(const char* text);
CWnd* owner;
void ReInitializeDDraw();
COLORREF GetColor(const char* house, const char* color=NULL);
void Blit(LPDIRECTDRAWSURFACE4 pic, int x, int y, int width=-1, int height=-1)
COLORREF GetColor(const char* house, const char* color = NULL);
void Blit(LPDIRECTDRAWSURFACE4 pic, int x, int y, int width = -1, int height = -1)
{
if(pic==NULL) return;
if (pic == NULL) return;
x+=1;
y+=1;
x += 1;
y += 1;
//y-=f_y;
RECT r;
GetDesktopWindow()->GetWindowRect(&r);
//GetWindowRect(&r);
if(width==-1 || height==-1)
{
if (width == -1 || height == -1) {
DDSURFACEDESC2 ddsd;
memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
ddsd.dwSize=sizeof(DDSURFACEDESC2);
ddsd.dwFlags=DDSD_WIDTH | DDSD_HEIGHT;
ddsd.dwSize = sizeof(DDSURFACEDESC2);
ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT;
pic->GetSurfaceDesc(&ddsd);
width=ddsd.dwWidth;
height=ddsd.dwHeight;
width = ddsd.dwWidth;
height = ddsd.dwHeight;
}
if(x+width<0 || y+height<0) return;
if(x>r.right || y>r.bottom) return;
if (x + width < 0 || y + height < 0) return;
if (x > r.right || y > r.bottom) return;
if (x < 0 || y < 0 || x + width >= r.right || y + height >= r.bottom) {
if(x<0 || y<0 || x+width>=r.right || y+height>=r.bottom)
{
RECT blrect;
RECT srcRect;
srcRect.left=0;
srcRect.top=0;
srcRect.right=width;
srcRect.bottom=height;
blrect.left=x;
if(blrect.left<0)
{
srcRect.left=r.left+1-blrect.left;
blrect.left=r.left+1;
srcRect.left = 0;
srcRect.top = 0;
srcRect.right = width;
srcRect.bottom = height;
blrect.left = x;
if (blrect.left < 0) {
srcRect.left = r.left + 1 - blrect.left;
blrect.left = r.left + 1;
}
blrect.top=y;
if(blrect.top<0)
{
blrect.top = y;
if (blrect.top < 0) {
//errstream << "BlRect.top=" << blrect.top << endl;
srcRect.top=(r.top+1)-blrect.top; //(r.top-blrect.top);
blrect.top=r.top+1;//r.top;
srcRect.top = (r.top + 1) - blrect.top; //(r.top-blrect.top);
blrect.top = r.top + 1;//r.top;
// errstream << blrect.top << " " << srcRect.top << endl;
}
blrect.right=(x+width);
if(x+width>r.right)
{
srcRect.right=width-((x+width)-r.right);// -(-blrect.right+r.right);
blrect.right=r.right;
blrect.right = (x + width);
if (x + width > r.right) {
srcRect.right = width - ((x + width) - r.right);// -(-blrect.right+r.right);
blrect.right = r.right;
}
blrect.bottom=(y+height);
if(y+height>r.bottom)
{
srcRect.bottom=height-((y+height)-r.bottom); // -(-blrect.bottom+r.bottom);
blrect.bottom=r.bottom;
blrect.bottom = (y + height);
if (y + height > r.bottom) {
srcRect.bottom = height - ((y + height) - r.bottom); // -(-blrect.bottom+r.bottom);
blrect.bottom = r.bottom;
}
DDBLTFX fx;
memset(&fx, 0, sizeof(DDBLTFX));
fx.dwSize=sizeof(DDBLTFX);
fx.dwSize = sizeof(DDBLTFX);
lpdsBack->Blt(&blrect, pic, &srcRect, DDBLT_KEYSRC, &fx);
}
else
lpdsBack->BltFast(x,y, pic, NULL, DDBLTFAST_SRCCOLORKEY);
} else
lpdsBack->BltFast(x, y, pic, NULL, DDBLTFAST_SRCCOLORKEY);
}
void updateFontScaled();
void TextOut(int x, int y, const char* text, COLORREF col);
@ -343,18 +336,18 @@ public:
LPDIRECTDRAWSURFACE4 lpdsTemp; // used for saving the isoview when drawing current tile
LPDIRECTDRAWSURFACE4 lpdsBackHighRes; // used for rendering text and some lines in high-res
LPDIRECTDRAWSURFACE4 lpds;
DDPIXELFORMAT pf;
DDPIXELFORMAT pf;
std::unique_ptr<FSunPackLib::ColorConverter> m_color_converter;
LPDIRECTDRAW4 dd;
LPDIRECTDRAW dd_1;
HGLRC m_hglrc;
void HandleProperties(int n, int type);
void UpdateDialog(BOOL bRepos=TRUE);
void UpdateDialog(BOOL bRepos = TRUE);
CMenu m_menu;
BOOL b_IsLoading;
int m_fontDefaultHeight;
int m_Font9Height;
std::unique_ptr<TextDrawer> m_textDefault;
std::unique_ptr<TextDrawer> m_textDefault;
std::unique_ptr<TextDrawer> m_textScaled;
std::unique_ptr<TextDrawer> m_text9;
std::unique_ptr<TextDrawer> m_text9Scaled;
@ -368,8 +361,8 @@ private:
private:
RECT m_myRect;
// mapdata* _map;
COLORREF m_linecolor;
RECT line;