summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2WorldDef.h
blob: 6aa3ee6ad21950c353e0827d90f03b3ec96c419a (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
#pragma once
#include "common.h"
#include "T2PaletteAnimeDef.h"
#include "T2TemplatePlugin.h"

// unknown name
struct GradeDef {
	unsigned int m0; // mask of VIPs available
	int m4; // minimum population
	int m8; // grade up animation ID
	int mC;
	int m10;
	int m14; // grade up animation start frame
};

class AFX_CLASS_EXPORT T2WorldDef : public T2TemplatePlugin {
public:
	T2WorldDef(DWORD inType, T2PluginSpecifier& inSpecifier, CResFile* inResFile, T2WorldPlugin* inPlugin);
public:
	virtual ~T2WorldDef();
	virtual void GetName(CString& outStr);
	virtual int GetSortKey() { return mWorldType; }
    CPalette* GetPalette() { return GetPaletteAnimeDef()->GetTowerPalette(); }
    BOOL IsUseMatterObject() const { return false; }
    int GetOutViewKind() const { return mOutViewKind; }
    T2PaletteAnimeDef* GetPaletteAnimeDef() const { return mPaletteAnimeDef; }
    T2SeasonParamDef* GetSeasonParamDef() const { return mSeasonParamDef; }
	virtual int GetInitialFunds() const { return mInitialFunds; }
    int GetHeight() const { return mHeight; }
    int GetWidth() const { return mWidth; }
    void GetBuildArea(RECT& rect) const { rect = mBuildArea; }
	virtual BOOL IsHoliday(T2DateTime* inDateTime) const { return false; }
	virtual BOOL IsRainyDay(T2DateTime* inDateTime) const { return false; }
    BOOL IsStoppableFloor(int y) {
        return !((y >= (mGroundLine - mLobbyHeight) && y < (mGroundLine - 1)));
    }
    int GetLobbyHeight() { return mLobbyHeight; }
	virtual int ExchangeMoney(int v) const;
	virtual void DrawWorld(T2TowerDoc* inDoc);
	virtual void DoAnimate(T2TowerDoc* inDoc);
	virtual void DrawBkgnd(const RECT& inRect, T2TowerDoc* inDoc);
	virtual void DrawBkgnd(unsigned int inImageIndex, const RECT& inDestRect, T2TowerDoc* inDoc);
	virtual void DrawRoofAndFloor(const RECT& inRect, T2TowerDoc* inDoc, ROOFANDFLOOR inRoofAndFloor);
	virtual void DrawBuild(T2Equip* inEquip, T2TowerDoc* inDoc);
	virtual void DrawSideObj(T2Equip* inEquip, T2TowerDoc* inDoc, SIDEOBJPATTERN inSideObjPattern);
	virtual void DrawOptionObj(T2TowerDoc* inDoc, const RECT& inRect);
	virtual void DrawRubble(T2TowerDoc* inDoc, T2Tenant* inTenant);
	virtual void DrawMark(T2BitImage* inDestImage, const RECT& inRect, int inZoomLevel, unsigned int inPattern);
	virtual void DrawCrane(T2TowerDoc* inDoc, const RECT& inRect);
	virtual const char* GetMoneyUnit() { return mMoneyUnit; }
	virtual T2EventItem* MakeXEvent(T2TowerEvent* inTowerEvent, CResFile*, unsigned long, int);
    T2Maru_Reggae* GetReggae() { return NULL; }
	virtual T2Transport* GetCruise(T2TowerEvent* inTowerEvent) { return NULL; }
	virtual void InitializeBkgndInfo(BkgndInfo* inBkgndInfoPtr);
	virtual void InitializeFloorInfo(T2FloorInfo* inFloorInfo);
	virtual void InitializeDocument(T2TowerDoc* inDoc);
	virtual BOOL TenantAreaCheck(T2TowerDoc* inDoc, RECT& inRect, BOOL inShowMessage);
	virtual void CalcOptionObj(T2TowerDoc* inDoc, T2Equip* inEquip);
	virtual void CalcCranePos(T2TowerDoc* inDoc);
	virtual void ClearCranePos(T2TowerDoc* inDoc);
	virtual void DrawCtrl(T2TowerDoc* inDoc, T2MWControl* inControl);
	virtual void ButtonDownOnCtrl(T2TowerDoc* inDoc, T2MWControl* inControl, CPoint inPt, CWnd* inWnd);
	virtual void ButtonUpOnCtrl(T2TowerDoc* inDoc, T2MWControl* inControl, CPoint inPt, CWnd* inWnd);
	virtual void MouseMoveOnCtrl(T2TowerDoc* inDoc, T2MWControl* inControl, CPoint inPt, CWnd* inWnd);
	virtual void GetToolTipText(T2TowerDoc* inDoc, T2MWControl* inControl, LPNMTTDISPINFO outInfo);
	virtual int IdleProc(T2TowerDoc* inDoc);
	virtual int CheckGameLevelProc(T2TowerDoc* inDoc);
	virtual void GetGradeUpMessage(int inGradeNum, CString& outStr);
	virtual void DayChanged(T2TowerDoc* inDoc) {}
	virtual void ViewModeChanged(T2TowerDoc* inDoc, VIEWMODE);
	virtual void ReplaceSkyOffscreen(int inResID);
	virtual BOOL3 ChangeFastSEProc(T2PaletteAnime* inPaletteAnime) { return BOOL3_NEG1; }
    virtual BOOL3 ChangeSEProc(T2PaletteAnime* inPaletteAnime) { return BOOL3_NEG1; }
	virtual BOOL3 ChangeFastSEProc(T2PaletteAnime* inPaletteAnime, T2DateTime* inDateTime) { return BOOL3_NEG1; }
	virtual BOOL3 ChangeSkyColorProc(T2PaletteAnime* inPaletteAnime) { return BOOL3_NEG1; }
	virtual BOOL3 AdjustSkyStateProc(T2PaletteAnime* inPaletteAnime, T2DateTime* inDateTime) { return BOOL3_NEG1; }
	virtual BOOL UseOwnSkyPaletteFunction() { return false; }
	virtual void SetupGradeUpAnimation(T2DlgItemAnimation* inAnimation, int inGradeNum);
	virtual void WriteStatisticsProc(T2TowerDoc* inDoc, T2Archive& inArchive);
	virtual void ReadStatisticsProc(T2TowerDoc* inDoc, T2Archive& inArchive);
	virtual BOOL CheckTreasure(T2TowerDoc* inDoc, T2TreasureStatus* inTreasureStatus);
    int GetCashAmount(int i) const {
        return (i >= 0 && i < 8) ? mCashAmount[i] : 0;
    }
    virtual unsigned long OptionProc(unsigned long, void*) { return 0; }

	unsigned int GetToiletDenomi(unsigned int inVal) const;
	unsigned int GetColdDenomi(unsigned int inVal1, unsigned int inVal2) const;
	BOOL IsDustOn(unsigned int inVal) const;
	T2TowerVision* GetTowerVision();
	void SetLatestBuild(T2Equip* inEquip, BOOL inFlag);
	void SetLatestBuild(T2ToolDef* inToolDef, BOOL inFlag);
	void InitTowerEvent(T2TowerDoc* inDoc);
	void WriteTowerEvent(T2Archive& inArchive);
	void ReadTowerEvent(T2Archive& inArchive);
	void StopEvent();
	T2TowerEvent* GetTowerEvent();
	T2FireBurning* GetFireBurning();
	T2MetroRailway* GetMetroRailway();
	T2BlackOut* GetBlackOut();
	BOOL IsBlackOut();

protected:
	virtual void DrawClock(T2MWControl* inControl, T2DateTime& inDateTime);
	virtual void DrawCalendar(T2MWControl* inControl, T2DateTime& inDateTime, T2TowerDoc* inDoc);
	virtual void DrawFunds(T2MWControl* inControl, int inFunds);
	virtual void DrawPopulation(T2MWControl* inControl, int inPop);
	virtual void DrawMessage(T2MWControl* inControl);
	virtual void DrawPauseButton(T2MWControl* inControl);
	virtual void DrawInViewButton(T2MWControl* inControl);
	virtual void DrawOutViewButton(T2MWControl* inControl);
	virtual void DrawMaintButton(T2MWControl* inControl);
	virtual void DrawEvalButton(T2MWControl* inControl);
	virtual void DrawPriceButton(T2MWControl* inControl);
	virtual void DrawTransButton(T2MWControl* inControl);
	virtual void DrawSlider(T2MWControl* inControl);
	virtual void ClickClock(T2MWControl* inControl, T2TowerDoc* inDoc);
	virtual void ClickCalendar(T2MWControl* inControl, T2TowerDoc* inDoc);
	virtual void ClickFunds(T2MWControl* inControl, T2TowerDoc* inDoc);
	virtual void ClickPopulation(T2MWControl* inControl, T2TowerDoc* inDoc);
	virtual void ClickPauseButton(T2MWControl* inControl, T2TowerDoc* inDoc);
	virtual void ClickInViewButton(T2MWControl* inControl, T2TowerDoc* inDoc);
	virtual void ClickOutViewButton(T2MWControl* inControl, T2TowerDoc* inDoc);
	virtual void ClickMaintButton(T2MWControl* inControl, T2TowerDoc* inDoc);
	virtual void ClickEvalButton(T2MWControl* inControl, T2TowerDoc* inDoc);
	virtual void ClickPriceButton(T2MWControl* inControl, T2TowerDoc* inDoc);
	virtual void ClickTransButton(T2MWControl* inControl, T2TowerDoc* inDoc);
	virtual int SliderPointToValue(T2MWControl* inControl, CPoint inPt);
	virtual void GetClockTip(T2TowerDoc* inDoc, T2MWControl* inControl, char* outStr);
	virtual void GetCalendarTip(T2TowerDoc* inDoc, T2MWControl* inControl, char* outStr);
	virtual void GetFundsTip(T2TowerDoc* inDoc, T2MWControl* inControl, char* outStr);
	virtual void GetPopulationTip(T2TowerDoc* inDoc, T2MWControl* inControl, char* outStr);
	virtual void GetPauseButtonTip(T2TowerDoc* inDoc, T2MWControl* inControl, char* outStr);
	virtual void DrawSimpleMWControl(T2MWControl* inControl, const char* inStr);

	void SetupOffscreen(HINSTANCE inModule);
	void DisposeOffscreen();
	void SetupPalette(HINSTANCE inModule);
	void DisposePalette();

	T2PaletteAnimeDef* MakePaletteAnimeDef();
	T2PoolDef* MakePoolDef();
	T2SeasonParamDef* MakeSeasonParamDef();
	T2ColdTableDef* MakeColdTableDef();

	friend class T2FloorInfo;
	friend class T2MainWindow;
	friend class T2Maru_Reggae;
	friend class T2MetroRailway;
	friend class T2OutDecoration;
	friend class T2OuterObjDef;
    friend class T2People;
	friend class T2SantaClaus;
	friend class T2TenantDef;
	friend class T2Terrorist;
    friend class T2ToolDef;
	friend class T2ToolWindow;
	friend class T2WorldPlugin;
	friend class T2VisitVIP;

	int mWorldType;
	int mGroundLine;
	int mLobbyHeight;
	int _5C;
	POINT mInitPos;
	int mTopFloorLine;
	int mBottomFloorLine;
	int m70;
	int m74;
	int _78;
	int _7C;
	int _80;
	int mNumOfGradeDef;
	GradeDef mGradeDef[8];
	int m148[5];
	char m15C[20];
	unsigned int mDustOnThreshold;
	unsigned int mToiletVar1;
	unsigned int mToiletVar2;
	int m17C;
	int mBGVUnit;
	int mBGHUnit;
	int mSkyVSize;
	int mSkyHSize;
	POINT m190;
	T2WordDefArray *mWordDefArray;
	T2BitImage *mSkyOffscreen;
	T2BitImage *m1A0;
	T2BitImage *m1A4[2];
	T2BitImage *m1AC;
	T2BitImage *m1B0;
	T2BitImage *m1B4;
	T2BitImage *m1B8;
	T2BitImage *m1BC;
	T2BitImage *m1C0;
	T2BitImage *m1C4;
	T2BitImage *m1C8;
	T2BitImage *m1CC;
	T2ImageObj *m1D0;
	T2PoolDef *mPoolDef;
	int _1D8;
	int _1DC;
	int _1E0;
	int _1E4;
	int _1E8;
	int _1EC;
	int _1F0;
	T2BitImage *mImage;
	int mHeight;
	int mWidth;
	RECT mBuildArea;
	int _210;
	BOOL _214;
	int mOutViewKind;
	T2PaletteAnimeDef *mPaletteAnimeDef;
	T2SeasonParamDef *mSeasonParamDef;
	T2ColdTableDef *mColdTableDef;
	int m228;
	int mCashAmount[8];
	int mInitialFunds;
	int mMoneyNumerator;
	int mMoneyDenominator;
	CString mMoneyUnit;
	T2TowerEvent *mTowerEvent;
};

inline /*virtual*/ int T2WorldDef::ExchangeMoney(int v) const {
    return (mMoneyNumerator == 1 && mMoneyDenominator == 1) ? v : ((v / mMoneyDenominator) * mMoneyNumerator);
}