summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2HallEventPlugin.cpp
blob: b75e4ffd29a1803332cdca4565c844250aafda9d (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
70
71
72
#include "CResFile.h"
#include "T2BitImage.h"
#include "T2HallEventPlugin.h"
#include "T2ImageObj.h"

T2HallEventPlugin::T2HallEventPlugin(DWORD inType, T2PluginSpecifier& inSpecifier)
    : T2SubPlugin(inType, inSpecifier)
{
    mCC = 0;
    mD0 = 0;
    _F0 = 0;
    mF4 = 0;
    mResID = 0;
}

/*virtual*/ T2HallEventPlugin::~T2HallEventPlugin() {
}

/*virtual*/ void T2HallEventPlugin::LoadRsrcFromStream(CResFile& inResFile) {
    T2SubPlugin::LoadRsrcFromStream(inResFile);

    inResFile >> mResID;
    inResFile >> mCC;
    inResFile >> mD0;
    inResFile >> mOpenTime;
    inResFile >> mCloseTime;
    inResFile >> mD4;
    inResFile >> mD8;

    unsigned short us;
    inResFile >> us;
    mDupCustomerTableDefRes = us;

    inResFile >> mDC;
    inResFile >> mE0;
    inResFile >> mE4;
    inResFile >> mBindTime;
    inResFile >> mF4;
    inResFile >> mF8;
    inResFile >> mEC;
}

void T2HallEventPlugin::UnfoldPluginSelf() {
    if (mResID) {
        mImage = new T2BitImage(mSpecifier.mPath, mResID, true);
        mImageObj = new T2ImageObj;

        int width = mImage->mBitmap.header.biWidth;
        int height = mImage->mBitmap.header.biHeight;
        if (height < 0)
            height = 0 - height;
        height /= 4;

        CRect rect(0, 0, width, height);
        for (int n = 0; n < 4; n++) {
            mImageObj->AddObject("SCRE", 200 + n, *mImage, &rect, false, false);
            rect.OffsetRect(0, height);
        }
    }
}

/*virtual*/ DWORD T2HallEventPlugin::LoadSelf() {
    DWORD result = 0;
    CResFile resFile;

    if (resFile.OpenResource(mSpecifier.mPath, 128, 'HEDF'))
        LoadRsrcFromStream(resFile);
    else
        result = 0xFFFFFFFF;

    return result;
}