#include "StdAfx.h" #include "CTokenizer.h" #include "T2PluginSpecifier.h" #include "../T2TowerDoc.h" #include "T2TreasureDialog.h" #include "T2TreasurePane.h" T2TreasureDialog::T2TreasureDialog() { } /*virtual*/ T2TreasureDialog::~T2TreasureDialog() { } /*virtual*/ void T2TreasureDialog::OnT2Create() { mTreasurePane = (T2TreasurePane *) GetDlgItem(1000); mTextPane = (T2DlgItem *) GetDlgItem(1001); } /*virtual*/ void T2TreasureDialog::CreateDlgItem(CTokenizer& inTokenizer, T2DialogDef& inDef) { if (!_stricmp(inTokenizer.Current(), "TRPN")) { RECT rect; UINT id = inTokenizer.NextInteger(); rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); T2TreasurePane *theTreasurePane = new T2TreasurePane(mTowerDoc, mImageObj, mPalette); theTreasurePane->Create("", inDef.flags, rect, this, id); theTreasurePane->CreateSubItem(NULL); if (mCurrentFont >= 0) theTreasurePane->SetFont(*mFonts[mCurrentFont]); } else { T2Dialog::CreateDlgItem(inTokenizer, inDef); } } /*virtual*/ void T2TreasureDialog::OnT2Destroy() { } /*virtual*/ void T2TreasureDialog::ShowSelf() { ShowWindow(SW_SHOWNORMAL); } /*virtual*/ void T2TreasureDialog::HideSelf() { ShowWindow(SW_HIDE); } /*static*/ void T2TreasureDialog::ShowTreasureDialog(T2TowerDoc* inTowerDoc, T2TreasureStatus* inStatus) { #line 69 // nice _ASSERT(inTowerDoc != NULL); CRect rect; AfxGetMainWnd()->GetWindowRect(rect); T2DLGTEMPLATE theTemplate; theTemplate.pt = rect.CenterPoint(); theTemplate.moduleHandle = inTowerDoc->mWorldPluginSpecifier->mInstance; theTemplate.resID = 11000; T2TreasureDialog *theDialog = new T2TreasureDialog; theDialog->Realize(inTowerDoc, &theTemplate, inTowerDoc, NULL, NULL, true, NULL, 0, true); theDialog->SetTreasureInfo(inTowerDoc, inStatus); } void T2TreasureDialog::SetTreasureInfo(T2TowerDoc* inTowerDoc, T2TreasureStatus* inStatus) { mTreasurePane->SetAnimPics(inTowerDoc, inStatus->animID1, inStatus->animID2); strncpy(mText, inStatus->text, 255); mTextPane->SetWindowText(mText); }