summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2AdvertisePlugin.cpp
blob: 5b10df38ace873bc32992f1a2fb36be956c78ec2 (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
#include "CResFile.h"
#include "T2AdvertisePlugin.h"
#include "T2BitImage.h"
#include "T2ImageObj.h"

T2AdvertisePlugin::T2AdvertisePlugin(DWORD type, T2PluginSpecifier& specifier)
	: T2SubPlugin(type, specifier)
{
	mPath = "";
	mCC = 0;
	mD0 = 0;
	mDay = 0;
	mMoney = 0;
	mSubType = 0;
	mTieup = NULL;
}

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

/*virtual*/ void T2AdvertisePlugin::LoadRsrcFromStream(CResFile& resFile) {
	T2SubPlugin::LoadRsrcFromStream(resFile);
	resFile >> mSubType;
	resFile >> mCC;
	resFile >> mD0;
	resFile >> mDay;
	resFile >> mMoney;
	resFile >> mPath;
}

void T2AdvertisePlugin::UnfoldPluginSelf() {
	if (mCC != 0) {
        mImage = new T2BitImage(mSpecifier.mPath, mCC, 1);
		mImageObj = new T2ImageObj;
		mImageObj->AddObject("BILL", -1, *mImage, NULL, 0, 0);
	}
}

unsigned int T2AdvertisePlugin::GetSubType() {
	return mSubType;
}

unsigned int T2AdvertisePlugin::GetDay() {
	return mDay;
}

int T2AdvertisePlugin::GetMoney() {
	return mMoney;
}

void T2AdvertisePlugin::GetPath(CString& outStr) {
	outStr = mPath;
}

/*virtual*/ unsigned long T2AdvertisePlugin::LoadSelf() {
	unsigned long result = 0;

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

	return result;
}