Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
191 lines
4.8 KiB
C++
191 lines
4.8 KiB
C++
// DlgMakePlant.cpp : implementation file
|
||
//
|
||
|
||
#include "stdafx.h"
|
||
#include "worldcreator.h"
|
||
#include "DlgMakePlant.h"
|
||
#include "MainFrm.h"
|
||
#include "WorldCreatorView.h"
|
||
#include "RenderOption.h"
|
||
|
||
|
||
#ifdef _DEBUG
|
||
#define new DEBUG_NEW
|
||
#undef THIS_FILE
|
||
static char THIS_FILE[] = __FILE__;
|
||
#endif
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// CDlgMakePlant dialog
|
||
|
||
|
||
CDlgMakePlant::CDlgMakePlant(CWnd* pParent /*=NULL*/)
|
||
: CDialog(CDlgMakePlant::IDD, pParent)
|
||
{
|
||
//{{AFX_DATA_INIT(CDlgMakePlant)
|
||
m_isAdd = FALSE;
|
||
m_isDel = FALSE;
|
||
m_fTreeRange = 0.0f;
|
||
m_fTreeRate = 0.0f;
|
||
//}}AFX_DATA_INIT
|
||
}
|
||
|
||
|
||
void CDlgMakePlant::DoDataExchange(CDataExchange* pDX)
|
||
{
|
||
CDialog::DoDataExchange(pDX);
|
||
//{{AFX_DATA_MAP(CDlgMakePlant)
|
||
DDX_Control(pDX, IDC_LIST_DRAWTREE, m_DrawTreeList);
|
||
DDX_Control(pDX, IDC_LIST_TREE, m_TreeList);
|
||
DDX_Check(pDX, IDC_CHECK_TREEADD, m_isAdd);
|
||
DDX_Check(pDX, IDC_CHECK_TREEDEL, m_isDel);
|
||
DDX_Text(pDX, IDC_EDIT_TREERANGE, m_fTreeRange);
|
||
DDV_MinMaxFloat(pDX, m_fTreeRange, 0.f, 30000.f);
|
||
DDX_Text(pDX, IDC_EDIT_TREERATE, m_fTreeRate);
|
||
DDV_MinMaxFloat(pDX, m_fTreeRate, 0.f, 1.f);
|
||
//}}AFX_DATA_MAP
|
||
}
|
||
|
||
|
||
BEGIN_MESSAGE_MAP(CDlgMakePlant, CDialog)
|
||
//{{AFX_MSG_MAP(CDlgMakePlant)
|
||
ON_BN_CLICKED(IDC_CHECK_TREEADD, OnCheckTreeadd)
|
||
ON_BN_CLICKED(IDC_CHECK_TREEDEL, OnCheckTreedel)
|
||
ON_LBN_DBLCLK(IDC_LIST_TREE, OnDblclkListTree)
|
||
ON_LBN_DBLCLK(IDC_LIST_DRAWTREE, OnDblclkListDrawtree)
|
||
ON_EN_CHANGE(IDC_EDIT_TREERANGE, OnChangeEditTreerange)
|
||
ON_EN_CHANGE(IDC_EDIT_TREERATE, OnChangeEditTreerate)
|
||
//}}AFX_MSG_MAP
|
||
END_MESSAGE_MAP()
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// CDlgMakePlant message handlers
|
||
|
||
BOOL CDlgMakePlant::OnInitDialog()
|
||
{
|
||
CDialog::OnInitDialog();
|
||
m_isAdd=TRUE;
|
||
CString strAddTree;
|
||
//
|
||
|
||
char strPath[256];
|
||
GetCurrentDirectory(256,strPath);
|
||
|
||
|
||
char strTree[256] = {0};
|
||
|
||
if(!strcmp(CRenderOption::m_strBaseGraphicsDataPath,"Default"))
|
||
sprintf(strTree,"%s\\Objects\\NatureObject\\TreeInfo.txt",strPath);
|
||
else {
|
||
sprintf(strTree,"%s\\Objects\\NatureObject\\TreeInfo",strPath);
|
||
strcat(strTree,"_");
|
||
strcat(strTree,CRenderOption::m_strBaseGraphicsDataPath);
|
||
strcat(strTree,".txt");
|
||
}
|
||
|
||
FILE *fp=fopen(strTree,"r");
|
||
//
|
||
//FILE *fp=fopen("C:\\MP-Project\\Objects\\NatureObject\\TreeInfo.txt","r");
|
||
if(fp)
|
||
{
|
||
for(int i=0;i<MAX_TREEKIND;i++)
|
||
{
|
||
char strTreeName[256];
|
||
fscanf(fp,"%s",strTreeName);
|
||
m_TreeList.AddString(strTreeName);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
for(int i=0;i<MAX_TREEKIND;i++)
|
||
{
|
||
strAddTree.Format("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d",i);
|
||
m_TreeList.AddString(strAddTree);
|
||
}
|
||
}
|
||
m_fTreeRange=500.0f;
|
||
m_fTreeRate=0.7f;
|
||
UpdateData(FALSE);
|
||
// TODO: Add extra initialization here
|
||
|
||
return TRUE; // return TRUE unless you set the focus to a control
|
||
// EXCEPTION: OCX Property Pages should return FALSE
|
||
}
|
||
|
||
void CDlgMakePlant::OnCheckTreeadd()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
UpdateData();
|
||
if(m_isAdd)
|
||
{
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CWorldCreatorView *av=(CWorldCreatorView *)mf->GetActiveView();
|
||
av->m_MouseInterface=50;
|
||
m_isDel=FALSE;
|
||
}
|
||
UpdateData(FALSE);
|
||
}
|
||
|
||
void CDlgMakePlant::OnCheckTreedel()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
UpdateData();
|
||
if(m_isDel)
|
||
{
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CWorldCreatorView *av=(CWorldCreatorView *)mf->GetActiveView();
|
||
av->m_MouseInterface=51;
|
||
m_isAdd=FALSE;
|
||
}
|
||
UpdateData(FALSE);
|
||
}
|
||
|
||
void CDlgMakePlant::OnOK()
|
||
{
|
||
// TODO: Add extra validation here
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CWorldCreatorView *av=(CWorldCreatorView *)mf->GetActiveView();
|
||
av->m_MouseInterface=-1;
|
||
CDialog::OnOK();
|
||
}
|
||
|
||
void CDlgMakePlant::OnDblclkListTree()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
long TreeKind=m_TreeList.GetCurSel();
|
||
CString strAddTree;
|
||
strAddTree.Format("%d",TreeKind);
|
||
m_DrawTreeList.AddString(strAddTree);
|
||
}
|
||
|
||
void CDlgMakePlant::OnDblclkListDrawtree()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
long TreeKind=m_DrawTreeList.GetCurSel();
|
||
m_DrawTreeList.DeleteString(TreeKind);
|
||
}
|
||
|
||
void CDlgMakePlant::OnChangeEditTreerange()
|
||
{
|
||
UpdateData();
|
||
// TODO: If this is a RICHEDIT control, the control will not
|
||
// send this notification unless you override the CDialog::OnInitDialog()
|
||
// function and call CRichEditCtrl().SetEventMask()
|
||
// with the ENM_CHANGE flag ORed into the mask.
|
||
|
||
// TODO: Add your control notification handler code here
|
||
|
||
}
|
||
|
||
void CDlgMakePlant::OnChangeEditTreerate()
|
||
{
|
||
UpdateData();
|
||
// TODO: If this is a RICHEDIT control, the control will not
|
||
// send this notification unless you override the CDialog::OnInitDialog()
|
||
// function and call CRichEditCtrl().SetEventMask()
|
||
// with the ENM_CHANGE flag ORed into the mask.
|
||
|
||
// TODO: Add your control notification handler code here
|
||
|
||
}
|