From c0c336500955a23e344651e5412c9d9d441ef4ee Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Wed, 28 Jun 2023 22:22:32 +0100 Subject: first pass of T2DLL --- src/T2DLL/T2TreasureDialog.cpp | 47 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) (limited to 'src/T2DLL/T2TreasureDialog.cpp') diff --git a/src/T2DLL/T2TreasureDialog.cpp b/src/T2DLL/T2TreasureDialog.cpp index 19ddddc..55e27ec 100644 --- a/src/T2DLL/T2TreasureDialog.cpp +++ b/src/T2DLL/T2TreasureDialog.cpp @@ -1,4 +1,8 @@ +#include "CTokenizer.h" +#include "T2PluginSpecifier.h" +#include "T2TowerDoc.h" #include "T2TreasureDialog.h" +#include "T2TreasurePane.h" T2TreasureDialog::T2TreasureDialog() { } @@ -7,22 +11,59 @@ T2TreasureDialog::T2TreasureDialog() { } /*virtual*/ void T2TreasureDialog::OnT2Create() { + mTreasurePane = (T2TreasurePane *) GetDlgItem(1000); + mTextPane = (T2DlgItem *) GetDlgItem(1001); } -/*virtual*/ void T2TreasureDialog::CreateDlgItem(CTokenizer&, T2Dialog::T2DialogDef&) { +/*virtual*/ void T2TreasureDialog::CreateDlgItem(CTokenizer& inTokenizer, T2DialogDef& inDef) { + if (!_stricmp(inTokenizer.Current(), "ANIM")) { + 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*, T2TreasureStatus*) { +/*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*, T2TreasureStatus*) { +void T2TreasureDialog::SetTreasureInfo(T2TowerDoc* inTowerDoc, T2TreasureStatus* inStatus) { + mTreasurePane->SetAnimPics(inTowerDoc, inStatus->animID1, inStatus->animID2); + strncpy(mText, inStatus->text, 255); + mTextPane->SetWindowText(mText); } -- cgit v1.2.3