Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
363 lines
10 KiB
C++
363 lines
10 KiB
C++
// BalancerDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "Balancer.h"
|
|
#include "BalancerDlg.h"
|
|
#include "dlgObjectBalance.h"
|
|
#include "dlgObjectProperties.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CAboutDlg dialog used for App About
|
|
|
|
class CAboutDlg : public CDialog
|
|
{
|
|
public:
|
|
CAboutDlg();
|
|
|
|
// Dialog Data
|
|
//{{AFX_DATA(CAboutDlg)
|
|
enum { IDD = IDD_ABOUTBOX };
|
|
//}}AFX_DATA
|
|
|
|
// ClassWizard generated virtual function overrides
|
|
//{{AFX_VIRTUAL(CAboutDlg)
|
|
protected:
|
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
|
//}}AFX_VIRTUAL
|
|
|
|
// Implementation
|
|
protected:
|
|
//{{AFX_MSG(CAboutDlg)
|
|
//}}AFX_MSG
|
|
DECLARE_MESSAGE_MAP()
|
|
};
|
|
|
|
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
|
|
{
|
|
//{{AFX_DATA_INIT(CAboutDlg)
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CAboutDlg)
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CAboutDlg)
|
|
// No message handlers
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CBalancerDlg dialog
|
|
|
|
CBalancerDlg::CBalancerDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CBalancerDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CBalancerDlg)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
//}}AFX_DATA_INIT
|
|
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
|
|
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
|
}
|
|
|
|
void CBalancerDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CBalancerDlg)
|
|
// NOTE: the ClassWizard will add DDX and DDV calls here
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CBalancerDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CBalancerDlg)
|
|
ON_WM_SYSCOMMAND()
|
|
ON_WM_PAINT()
|
|
ON_WM_QUERYDRAGICON()
|
|
ON_BN_CLICKED(IDC_ARMORBAL, OnArmorbal)
|
|
ON_BN_CLICKED(IDC_MECHPROP, OnMechprop)
|
|
ON_BN_CLICKED(IDC_WEAPPROP, OnWeapprop)
|
|
ON_BN_CLICKED(IDC_WEPBAL, OnWepbal)
|
|
ON_BN_CLICKED(ID_EXIT, OnExit)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CBalancerDlg message handlers
|
|
|
|
BOOL CBalancerDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
// Add "About..." menu item to system menu.
|
|
|
|
// IDM_ABOUTBOX must be in the system command range.
|
|
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
|
|
ASSERT(IDM_ABOUTBOX < 0xF000);
|
|
|
|
CMenu* pSysMenu = GetSystemMenu(FALSE);
|
|
if (pSysMenu != NULL)
|
|
{
|
|
CString strAboutMenu;
|
|
strAboutMenu.LoadString(IDS_ABOUTBOX);
|
|
if (!strAboutMenu.IsEmpty())
|
|
{
|
|
pSysMenu->AppendMenu(MF_SEPARATOR);
|
|
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
|
|
}
|
|
}
|
|
|
|
// Set the icon for this dialog. The framework does this automatically
|
|
// when the application's main window is not a dialog
|
|
SetIcon(m_hIcon, TRUE); // Set big icon
|
|
SetIcon(m_hIcon, FALSE); // Set small icon
|
|
|
|
// TODO: Add extra initialization here
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
}
|
|
|
|
void CBalancerDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
|
{
|
|
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
|
|
{
|
|
CAboutDlg dlgAbout;
|
|
dlgAbout.DoModal();
|
|
}
|
|
else
|
|
{
|
|
CDialog::OnSysCommand(nID, lParam);
|
|
}
|
|
}
|
|
|
|
// If you add a minimize button to your dialog, you will need the code below
|
|
// to draw the icon. For MFC applications using the document/view model,
|
|
// this is automatically done for you by the framework.
|
|
|
|
void CBalancerDlg::OnPaint()
|
|
{
|
|
if (IsIconic())
|
|
{
|
|
CPaintDC dc(this); // device context for painting
|
|
|
|
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
|
|
|
|
// Center icon in client rectangle
|
|
int cxIcon = GetSystemMetrics(SM_CXICON);
|
|
int cyIcon = GetSystemMetrics(SM_CYICON);
|
|
CRect rect;
|
|
GetClientRect(&rect);
|
|
int x = (rect.Width() - cxIcon + 1) / 2;
|
|
int y = (rect.Height() - cyIcon + 1) / 2;
|
|
|
|
// Draw the icon
|
|
dc.DrawIcon(x, y, m_hIcon);
|
|
}
|
|
else
|
|
{
|
|
CDialog::OnPaint();
|
|
}
|
|
}
|
|
|
|
// The system calls this to obtain the cursor to display while the user drags
|
|
// the minimized window.
|
|
HCURSOR CBalancerDlg::OnQueryDragIcon()
|
|
{
|
|
return (HCURSOR) m_hIcon;
|
|
}
|
|
|
|
void CBalancerDlg::OnCancel()
|
|
{
|
|
// TODO: Add extra cleanup here
|
|
|
|
// CDialog::OnCancel();
|
|
}
|
|
|
|
void CBalancerDlg::OnOK()
|
|
{
|
|
// TODO: Add extra validation here
|
|
|
|
// CDialog::OnOK();
|
|
}
|
|
//*******************************************************************************************
|
|
//
|
|
//*******************************************************************************************
|
|
// This function is called while searching for mech property notation files. Since
|
|
// .data is not used exclusively for these, I wanted to add filter out basic.data and similar files
|
|
// also not that you can not use the allsubdirectories flag with mechs since they have .data
|
|
// files in the armaturedata subdirectories
|
|
BOOL _stdcall MechPropertyFilesFilter(LPCSTR szCurrentFileName)
|
|
{
|
|
if (!stricmp(szCurrentFileName, "basic.data"))
|
|
{
|
|
return FALSE;
|
|
}
|
|
// also don't allow .data files from _destroyed mechs
|
|
|
|
LPCSTR pszTemp = strrchr(szCurrentFileName, '_');
|
|
if (pszTemp && !stricmp(pszTemp, "_destroyed.data"))
|
|
{
|
|
return FALSE;
|
|
}
|
|
return TRUE;
|
|
}
|
|
//*******************************************************************************************
|
|
//
|
|
//*******************************************************************************************
|
|
// This function is called while searching for mech property notation files. Since
|
|
// .data is not used exclusively for these, I wanted to add filter out basic.data and similar files
|
|
// also not that you can not use the allsubdirectories flag with mechs since they have .data
|
|
// files in the armaturedata subdirectories
|
|
BOOL _stdcall MechPropertyFilesFilter2(LPCSTR szCurrentFileName)
|
|
{
|
|
// also don't allow .data files from _destroyed mechs
|
|
|
|
LPCSTR pszTemp = strrchr(szCurrentFileName, '_');
|
|
if (pszTemp && !stricmp(pszTemp, "_destroyed.damage"))
|
|
{
|
|
return FALSE;
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
void CBalancerDlg::OnArmorbal()
|
|
{
|
|
|
|
CDlgObjectBalance dlgOB;
|
|
|
|
CDOPPROPERTIES_TO_EDIT_ARRAY * pPropertiesToEdit =
|
|
dlgOB.CreatePropertiesToEditArray(13,
|
|
efloat , "joint_luarm\\MaxArmorValue", "L.Arm",
|
|
efloat , "joint_ruarm\\MaxArmorValue", "R.Arm",
|
|
efloat , "joint_luleg\\MaxArmorValue", "L.Leg",
|
|
efloat , "joint_ruleg\\MaxArmorValue", "R.Leg",
|
|
efloat , "joint_head\\MaxArmorValue", "Head",
|
|
efloat , "joint_righttorsofront\\MaxArmorValue", "R.T.F.",
|
|
efloat , "joint_righttorsorear\\MaxArmorValue", "R.T.R.",
|
|
efloat , "joint_lefttorsofront\\MaxArmorValue", "L.T.F.",
|
|
efloat , "joint_lefttorsorear\\MaxArmorValue", "L.T.R.",
|
|
efloat , "joint_hipbelow\\MaxArmorValue", "C.T.F.",
|
|
efloat , "joint_centertorsorear\\MaxArmorValue", "C.T.R.",
|
|
efloat , "joint_specialone\\MaxArmorValue", "Sp. 1",
|
|
efloat , "joint_specialtwo\\MaxArmorValue", "Sp. 2"
|
|
);
|
|
|
|
|
|
dlgOB.SetFileNameToSearchSubdirectoriesFor("*.damage");
|
|
dlgOB.SetFileFilterCallBack(MechPropertyFilesFilter2);
|
|
dlgOB.SetObjectFilesDirectory("content\\mechs");
|
|
|
|
dlgOB.SetHorizontalControlSize(60);
|
|
dlgOB.ShowPageOnly();
|
|
dlgOB.SetPropertyListToEdit(pPropertiesToEdit);
|
|
dlgOB.SetAllowPresentToChange(FALSE);
|
|
dlgOB.ShowFullObjectNames(FALSE);
|
|
dlgOB.ShowFullPropertyName(FALSE);
|
|
|
|
dlgOB.DoModal();
|
|
free(pPropertiesToEdit);
|
|
}
|
|
|
|
void CBalancerDlg::OnMechprop()
|
|
{
|
|
|
|
CDlgObjectProperties dlgOP;
|
|
|
|
CDOPPROPERTIES_TO_EDIT_ARRAY * pPropertiesToEdit =
|
|
dlgOP.CreatePropertiesToEditArray(13,
|
|
efloat , "gamedata\\TiltDegree", "",
|
|
efloat , "gamedata\\TiltSpeed", "",
|
|
efloat , "gamedata\\MinStandTransitionSpeed", "",
|
|
efloat , "gamedata\\MaxGimpSpeed", "",
|
|
efloat , "gamedata\\Acceleration", "",
|
|
efloat , "gamedata\\Decceleration", "",
|
|
efloat , "gamedata\\MaxSpeed", "",
|
|
efloat , "gamedata\\MinSpeed", "",
|
|
efloat , "gamedata\\MaxReverseSpeed", "",
|
|
efloat , "gamedata\\MinReverseSpeed", "",
|
|
efloat , "gamedata\\FullStopTurnRate", "",
|
|
efloat , "gamedata\\TopSpeedTurnRate", "",
|
|
efloat , "gamedata\\MaxHeat", ""
|
|
|
|
);
|
|
dlgOP.SetFileNameToSearchSubdirectoriesFor("*.data");
|
|
dlgOP.SetFileFilterCallBack(MechPropertyFilesFilter);
|
|
dlgOP.SetObjectFilesDirectory("content\\mechs");
|
|
dlgOP.SetPropertyListToEdit(pPropertiesToEdit);
|
|
dlgOP.ShowFullObjectNames(TRUE);
|
|
dlgOP.ShowFullPropertyName(FALSE);
|
|
|
|
dlgOP.DoModal();
|
|
free(pPropertiesToEdit);
|
|
}
|
|
|
|
void CBalancerDlg::OnWeapprop()
|
|
{
|
|
|
|
CDlgObjectProperties dlgOP;
|
|
|
|
CDOPPROPERTIES_TO_EDIT_ARRAY * pPropertiesToEdit =
|
|
dlgOP.CreatePropertiesToEditArray(11,
|
|
eint , "gamedata\\AmmoPerShot", "",
|
|
efloat , "gamedata\\DamageAmount", "",
|
|
efloat , "gamedata\\Heat", "",
|
|
eVector3D, "gamedata\\InitialLinearAcceleration", "",
|
|
eVector3D, "gamedata\\InitialLinearVelocity", "",
|
|
eint , "gamedata\\MaxAmmo", "",
|
|
efloat , "gamedata\\MaxDistance", "",
|
|
efloat , "gamedata\\NumFire", "",
|
|
efloat , "gamedata\\ReloadTime", "",
|
|
efloat , "gamedata\\Tonage", "",
|
|
eint , "gamedata\\TotalSlotsTaken", "");
|
|
dlgOP.SetFileNameToSearchSubdirectoriesFor("*.data");
|
|
dlgOP.SetFileFilterCallBack(NULL);
|
|
dlgOP.SetObjectFilesDirectory("content\\weaponsubsystems");
|
|
dlgOP.SetPropertyListToEdit(pPropertiesToEdit);
|
|
dlgOP.ShowFullObjectNames(FALSE);
|
|
dlgOP.ShowFullPropertyName(FALSE);
|
|
|
|
dlgOP.DoModal();
|
|
free(pPropertiesToEdit);
|
|
}
|
|
|
|
void CBalancerDlg::OnWepbal()
|
|
{
|
|
CDlgObjectBalance dlgOB;
|
|
|
|
CDOPPROPERTIES_TO_EDIT_ARRAY * pPropertiesToEdit =
|
|
dlgOB.CreatePropertiesToEditArray(6,
|
|
efloat , "gamedata\\DamageAmount", "",
|
|
efloat , "gamedata\\HeatToDeal", "",
|
|
efloat , "gamedata\\SplashRadius", "",
|
|
efloat , "gamedata\\ReloadTime", "",
|
|
efloat , "gamedata\\Heat", "",
|
|
efloat , "gamedata\\Tonage", "");
|
|
|
|
|
|
dlgOB.SetFileNameToSearchSubdirectoriesFor("*.data");
|
|
dlgOB.SetFileFilterCallBack(NULL);
|
|
dlgOB.SetObjectFilesDirectory("content\\weaponsubsystems");
|
|
dlgOB.SetPropertyListToEdit(pPropertiesToEdit);
|
|
dlgOB.ShowFullObjectNames(FALSE);
|
|
dlgOB.ShowFullPropertyName(FALSE);
|
|
|
|
dlgOB.DoModal();
|
|
free(pPropertiesToEdit);
|
|
}
|
|
|
|
void CBalancerDlg::OnExit()
|
|
{
|
|
|
|
CDialog::OnOK();
|
|
}
|