summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2TreasureDialog.cpp
blob: 74bee6556da7101c560cb55ebcbe366776926f4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#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);
}