summaryrefslogtreecommitdiff
path: root/src/T2TowerDoc.h
blob: 9371bce858e87118482f913e39bdd93fc043a18b (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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
#pragma once
#include "common.h"
#include "T2MsgWindowCallback.h"
#include "T2Settlement.h"
#include "T2Sprite.h"
#include "T2ToolCallback.h"
#include "T2TowerMainView.h"

enum {
    kControlWindow,
    kMessageWindow,
    kToolWindow
};

// The type of entity found when performing a hit test
enum {
    kHitNull,
    kHitBkgndInfo,
    kHitTenant,
    kHitMover,
    kHitPeople,
    kHitOutObj,
    kHitSpriteObj
};

union HitTestResult {
	T2DrawableObject *obj;
	T2SpriteObj *spriteObj;
	unsigned int bkgndInfo;
};

enum {
    // Leave the cursor as-is
    kCursorNoChange = -1,
    // Destruct (193, 184)
    kCursorDestruct = 0,
    // Finger (187, 188)
    kCursorFinger = 1,
    // Info (193, 183)
    kCursorInfo = 2,
    // Zoom (195, 195)
    kCursorZoom = 3,
    // Hand (189, 190)
    kCursorHand = 4,
    // Mic (185, 185)
    kCursorMic = 5,
    // Search range (192, 192)
    kCursorSearchRange = 6,
    // No symbol (210, 210)
    kCursorNo = 7,
    // Use IDC_ARROW
    kCursorDefault = 0x100
};

class T2HUnknown;

typedef void (*TowerDocDestroyCallback)(void *);

enum {
    kDm0 = 0,
    kDm1,
    kDm2,
    kDm3
};

struct DragMask {
    int x0;
    int x4;
    RECT rect;
};

class T2TowerDoc : public CDocument, public T2MsgWindowCallback, public T2ToolCallback {
	DECLARE_DYNCREATE(T2TowerDoc)
	DECLARE_MESSAGE_MAP()

public:
	T2TowerDoc();
	virtual ~T2TowerDoc();
	virtual void Serialize(CArchive &ar);

    // is this one properly placed???
	virtual BOOL IsDustOn() const { return mIsDustOn; }
	virtual void LoadsWorldPlugin(); // new file?
	// C0
	virtual void towerDoc_vfC0(int);
	virtual void towerDoc_vfC4();

	virtual void towerDoc_vfC8();
	virtual void towerDoc_vfCC(T2PluginSpecifier *inWorldPluginSpec, BOOL inIsExistingFile);
    void xUnkNameSelectWorld(T2PluginSpecifier *inWorldPluginSpec);
    void x41CFEB();
	// D0
	virtual void towerDoc_vfD0();
    void LoadOptionPlugins();
	virtual void towerDoc_vfD4(BOOL inResetMainWindow);
    virtual BOOL OnNewDocument();
    virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
    virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);

	virtual void towerDoc_vfD8(const RECT &inRect1, const RECT &inRect2);
	virtual void DrawRequestAll(const RECT &inRect);
	// E0
	virtual void DrawMoverAll(const RECT &inRect);
	virtual void DrawInView(const RECT &inRect1, const RECT &inRect2);
	virtual void DrawOutView(const RECT &inRect1, const RECT &inRect2);
	virtual void DrawBuilding(const RECT &inRect1, const RECT &inRect2);
	// F0
	virtual void towerDoc_vfF0(const RECT &inRect1, const RECT &inRect2);
	virtual void DrawBkgnd(const RECT &inRect);
	virtual void towerDoc_vfF8(const RECT &inRect);
	virtual void towerDoc_vfFC(const RECT &inRect);
	// 100
	virtual void towerDoc_vf100(const RECT &inRect);
	virtual void DrawTenantOutViewAll(const RECT &inRect);
	virtual int GetZoomLevel() const;
    void SetZoomLevel(int inZoom) { mZoomLevel = inZoom; }
	virtual T2BitImage *GetImage() const;
	// 110
	virtual T2TowerMainView *GetMainView() const;
	virtual void SelectPlugins(BOOL inIsGradeUp);
	virtual void InitSound(T2SoundPlayer *inSoundPlayer);
    void LoadSoundForPlugin(T2TemplatePlugin *inPlugin);
	virtual void UpdatePalette(int startIndex, int count, PALETTEENTRY *entries); // updates palette
	// 120
	virtual T2DateTime *GetNow() const;
	virtual T2RouteNavigator *GetRouteNavi() const;
	virtual T2TemplatePluginList *GetSilhouetteTemplates();
	virtual T2FloorInfo *GetFloorInfo() const { return mFloorInfo; }
	// 130
	virtual T2Pool *GetPool() const { return mPool; }
	virtual T2SoundPlayer *GetSoundPlayer() const { return mSoundPlayer; }
	virtual int GetLevel() const { return mGameLevel; }
	virtual T2TowerMessage *towerDoc_vf13C() { return mTowerMessage; }
	// 140
	virtual int GetViewMode() const { return mViewMode; }
	virtual void SetViewMode(int inViewMode);
	virtual int GetWalkRate() const { return mWalkRate; }
	virtual void SetWalkRate(int inWalkRate);
	// 150
	virtual T2TrafficInfo *GetTrafficInfo() const { return mTrafficInfo; }
	virtual BOOL IsToiletFlagOn() const;
	virtual BOOL IsColdFlagOn() const;
    int CheckGameLevel();
    void UpdateAllTenant();
	virtual BOOL IsRectInView(const RECT &inRect);
	// 160
	virtual T2PaletteAnime *GetPaletteAnime() const { return mPaletteAnime; }
	virtual void SetInfoBarText(const char *inText);
	virtual void towerDoc_vf168(const RECT &inRect) {
		mTowerMainView->CenterOnRectAndZoom(inRect);
    }
	virtual BOOL GetElevTransparent() const { return mElevTransparent; }
	// 170
	virtual T2WorldDef *GetWorldDef() const { return mWorldDef; }
	virtual T2RegistedTenantDB *GetRegistedTenantDB() const { return mRegistedTenantDB; }
	virtual T2TemplatePluginList *GetTenantTemplates() const { return mTenantTemplates; }
	virtual T2TemplatePluginList *GetMoverTemplates() const { return mMoverTemplates; }
	// 180
	virtual T2TemplatePluginList *GetOuterObjTemplates() const { return mOuterObjTemplates; }
    CPluginInfoArray *MakePluginInfoArray();
    void _MakePluginInfoArray(CPluginInfoArray *inResultArray, CFilePluginList *inPluginArray);
	virtual void towerDoc_vf184(int inFlags);
	virtual void FinalEventOccur();
	virtual T2Tenant *GetSearchRangeFrom() const { return mSearchRangeFrom; }
	// 190
	virtual void SetSearchRangeFrom(T2Tenant *inTenant);
	virtual void towerDoc_vf194();
	virtual void towerDoc_vf198(unsigned short inWindowType);
	virtual void SetCursorType(int inCursor, BOOL inIsPressed);
	// 1A0
	virtual void towerDoc_vf1A0(BOOL inPause);
	virtual BOOL towerDoc_vf1A4() const { return _1F8 != 0; }
	virtual void *towerDoc_vf1A8() const { return mDestroyCallbackData; }
	virtual void towerDoc_vf1AC(void *inData) { mDestroyCallbackData = inData; }
	// 1B0
	virtual void towerDoc_vf1B0(TowerDocDestroyCallback inFunc) { mDestroyCallback = inFunc; }
	virtual void BreakoutEmergency();
	virtual void AddFavoritePeople(T2People *inPeople);
	virtual void AddFavoriteTenant(T2Tenant *inTenant);
	// 1C0
	virtual void RemoveFavoritePeople(const char *inName, BOOL inFlag);
	virtual void RemoveFavoritePeople(T2People *inPeople, BOOL inFlag);
	virtual void RemoveFavoriteTenant(const char *inName, BOOL inFlag);
	virtual void RemoveFavoriteTenant(T2Tenant *inTenant, BOOL inFlag);
	// 1D0
	virtual void towerDoc_vf1D0(int unk1, int unk2) {}
	virtual void towerDoc_vf1D4();
	virtual void towerDoc_vf1D8();
	virtual void CreatePool();
	// 1E0
	virtual void LoadPool(T2Archive &inArchive);
	virtual void DoDestruct(const CPoint &inPt);
	virtual BOOL DestructTenant(POINT inPt1, POINT inPt2, T2Tenant *inTenant, BOOL inSkipSounds);
    BOOL OutsideAreaCheck(T2Tenant *inTenant, BOOL inShowError);
    void CalcCraneUpdateRect(RECT &ioRect);
	virtual BOOL DestructMover(POINT inPt1, POINT inPt2, T2Mover *inMover);
	// 1F0
	virtual BOOL DestructOutObj(POINT inPt1, POINT inPt2, T2OutObj *inOutObj);
	virtual BOOL DoClickByTenantTool(CRect inRect, T2TenantDef *inDef, unsigned int inValiation);
	virtual void DoDragByTenantTool(CRect inRect);
	virtual void DoReleaseByTenantTool(CRect inRect);
	// 200
	virtual BOOL DoClickByMoverTool(CRect inRect, T2MoverDef *inDef, unsigned int inValiation, BOOL inIsFromMouseMove);
	virtual void DoDragByMoverTool(CRect inRect);
	virtual void DoReleaseByMoverTool(CRect inRect);
	virtual void DoClickByOutObjTool(CRect inRect, T2OuterObjDef *inDef, unsigned int inValiation);
	// 210
	virtual void DoDragByOutObjTool(CRect inRect);
	virtual void DoReleaseByOutObjTool(CRect inRect);
	virtual BOOL DoClickByFingerTool(CPoint inPt);
	virtual void DoDragByFingerTool(CPoint inPt);
	// 220
	virtual void DoReleaseByFingerTool(CPoint inPt);
	virtual void DoGetInfo(CPoint inPt);
	virtual void towerDoc_vf228(CPoint inPt);
	virtual void DoInterview(CPoint inPt);
	// 230
	virtual void DoSearchRangeTool(CPoint inPt);
	virtual void DoRenumberTenant();
	virtual void DoFind(T2Name *inName);
    BOOL x4295F1(T2People *inPeople, RECT &outRect);
	virtual BOOL towerDoc_vf23C(CPoint inPt);
	// 240
	virtual void CalcDragMask(CRect inRect);
	virtual int CalcDragMaskPoint(CRect &ioRect, int &ioFunds, DragMask *inArray, int inMode, BOOL inShowError); // CalcDragMaskPoint
	virtual BOOL towerDoc_vf248(CRect inRect);
	virtual T2Tenant *AssignNewTenant(T2TenantDef *inTenantDef, RECT &inRect, unsigned int inValiation);
	// 250
	virtual void CheckBuildQueue();
	virtual BOOL CheckTenantArea(const RECT &inRect, T2TenantDef *inTenantDef, BOOL inShowErr, BOOL inUnkFlag);
	virtual BOOL towerDoc_vf258(const RECT &inRect, T2MoverDef *inMoverDef);
	virtual BOOL towerDoc_vf25C(const RECT &inRect, T2MoverDef *inMoverDef);
	// 260
	virtual void towerDoc_vf260(const RECT &inRect, T2OuterObjDef *inOuterObjDef);
	virtual void TenantAdded(T2Tenant *inTenant);
	virtual void TenantRemoved(T2Tenant *inTenant);
	virtual int GetCurrentFunds() const { return mSettlement->GetCurrentFunds(); }
	// 270
	virtual void DoPay(int inCost, short inFundGroup);
	virtual void DoPayTool(int inCost, short inFundGroup, T2ToolDef *inToolDef, const char *inMessage, int inLimitLength, int inLimitType);
	virtual void DoPayTool(int inCost, short inFundGroup, T2ToolDef *toolDef);
	virtual int GetNextTenantNumber(int inV);
	// 280
	virtual void towerDoc_vf280(); // empty: RecreateFavoriteMenus?
	virtual void towerDoc_vf284() { UpdateAllTenant(); }
	virtual BOOL towerDoc_vf288(RECT &ioRect, int &ioCost);
	virtual void FillFloor(const RECT &inRect);
	// 290
	virtual void towerDoc_vf290(BOOL inPause);
	virtual void towerDoc_vf294() { towerDoc_vf290(false); }
	virtual void towerDoc_vf298();
	virtual int HitTest(POINT inPt, HitTestResult &outObj, BOOL inSkipPeople, BOOL inSkipOuterObj);
    int HitTestLayer(T2BitImage *inImage, POINT inPt, HitTestResult &outObj, int inLayer);
	// 2A0
	virtual T2ToolWindow *towerDoc_vf2A0();
	virtual int GetDrawSpeed() const { return mDrawSpeed; }
	virtual int SetDrawSpeed(int inVal) {
		int oldVal = mDrawSpeed;
		mDrawSpeed = inVal;
		return oldVal;
	}
	virtual BOOL SetElevTransparent(BOOL inTransparent);
	// 2B0
	virtual BOOL towerDoc_vf2B0(BOOL inValue); // SetVolatile maybe?
	virtual int towerDoc_vf2B4() const { return _1FC; }
	virtual void CallbackZoomIn(POINT inPt);
    virtual void CallbackZoomOut();
    virtual void CallbackInView();
    virtual void CallbackOutView();
    virtual void CallbackPriceView();
    virtual void CallbackMaintView();
    virtual void CallbackTransView();
    virtual void CallbackEvalView();
    virtual void CallbackPause(BOOL inPause);
    virtual void CallbackCalendar();
    virtual void CallbackFunds();
    virtual void CallbackPopulation();
	virtual BOOL towerDoc_vf2BC(const char *inPath);
	// 2C0
	virtual BOOL towerDoc_vf2C0(const char *inPath);
    virtual void toolCallback_vf00(int unkParam1, T2ToolIconItem *inItem);

    void x429A9A(BOOL inPause);
    void x429B01(BOOL inPause);

    // this might be SetVolatile actually
	void SetFireBurning(BOOL flag) { m208 = flag; }

	int Get228() { return m228; }
	BOOL Get22C() const { return _22C; }

    T2PluginLoader *mT2PluginLoader;
    T2WorldPlugin *mWorldPlugin;
    T2PluginSpecifier *mWorldPluginSpecifier;
    T2PluginSpecifier *mToolPaletteSpecifier;
    DWORD mWorldPluginID;
    DWORD mToolPaletteID;
    T2WorldDef *mWorldDef;
    int _78;
    int _7C;
	int mZoomLevel;
    // the current funds when the player clicked to begin building a tenant
    int mFundsOnClick;
    BOOL mPause;
    int mGameLevel;
    int _90;
    int _94;
    int _98;
    int m9C;
    DWORD mA0; // VIPs that have been satisfied
	int mViewMode;
    int _A8;
    int _AC;
    BOOL _B0;
    int mLastRequestedCursor;
    int mCurrentCursorIndex;
    int mBC;
    DWORD mC0;
    T2DateTime *mNow;
    T2TowerMessage *mTowerMessage;
    CString mCC;
	T2FloorInfo *mFloorInfo;
    BkgndInfo *mBkgndInfo;
    T2TrafficInfo *mTrafficInfo;
    T2Sprite mSprite;
    T2SoundPlayer *mSoundPlayer;
    CFilePluginList *mTenantPlugins;
    CFilePluginList *mMoverPlugins;
    CFilePluginList *mOuterObjPlugins;
    T2MoviePluginList *mMoviePluginList;
    CFilePluginList *mHallEventPlugins;
    CFilePluginList *mAdvertisePlugins;
    T2TemplatePluginList *mTenantTemplates;
    T2TemplatePluginList *mMoverTemplates;
    T2TemplatePluginList *mMatterTemplates;
    T2TemplatePluginList *mPeopleTemplates;
    T2TemplatePluginList *mSilhouetteTemplates;
    T2TemplatePluginList *mOuterObjTemplates;
    T2TemplatePluginDB *mTemplatePluginDB;
    T2OptionPluginList *mOptionPluginList;
    T2OuterObjList *mOuterObjList;
    T2Settlement *mSettlement;
	T2NameList *mNameDB;
	T2PeopleArrayList *mPeopleArrayList;
    T2Pool *mPool;
    T2RegistedTenantDB *mRegistedTenantDB;
    T2TenantDef *mFloorDef;
    T2RouteNavigator *mRouteNavigator;
    T2Tenant *mSearchRangeFrom;
    int mCraneCount;
    POINT *mCranePosArray;
    T2HUnknown *_170;
    int _174;
    T2PaletteAnime *mPaletteAnime;
    BOOL mPaletteUpdated;
    BOOL mDebugStepRunEnabled;
    BOOL mDisplayIPS;
	POINT m188;
    BOOL mErrorFlag;
    BOOL mNewDocFlag;
    BOOL mIsStuffLoadedFlag;
	T2TowerMainView *mTowerMainView;
    T2TenantDef *m1A0;
    T2Tenant *_1A4;
    int _1A8;
    int _1AC;
    unsigned int mValiation;
    DragMask *mDragMask;
    CObjectQueue *mObjectQueue;
    POINT _1BC;
    T2Equip *m1C4;
	// does the system support palettes?
    BOOL mIsPaletteMode;
    int m1CC;
    BOOL mElevTransparent;
    BOOL mIsDustOn;
    unsigned int mToiletDenomi;
    unsigned int mColdDenomi;
    int mWalkRate;
    BOOL _1E4;
    void *mDestroyCallbackData;
    TowerDocDestroyCallback mDestroyCallback;
    int m1F0;
    int _1F4;
    int _1F8;
    int _1FC;
    int _200;
    int m204;
    int m208;
    time_t m20C;
    int m210;
    int m214;
    DWORD m218;
    DWORD m21C;
    unsigned int mDrawSpeed;
    int _224;
    int m228;
    BOOL _22C;

protected:
	afx_msg void OnSystemInformation();
	afx_msg void OnUpdateDebugStepRun(CCmdUI *pCmdUI);
	afx_msg void OnDebugStepRun();
    void InvalClock();
    void InvalCalender();
    void InvalFunds();
    void InvalPopulation();
    void SetupGradeAnimation();
    void x42670C();
    void x426717();
    void CycleOutlinePalette();
	afx_msg void OnUpdateDebugIdleSpeedMeasuring(CCmdUI *pCmdUI);
	afx_msg void OnDebugIdleSpeedMeasuring();
	afx_msg void OnUpdateDebugAllLoadMeasuring(CCmdUI *pCmdUI);
	afx_msg void OnDebugAllLoadMeasuring();
	afx_msg void OnUpdateDebugPool(CCmdUI *pCmdUI);
	afx_msg void OnDebugPool();
	afx_msg void OnUpdateDebugDisplayIPS(CCmdUI *pCmdUI);
	afx_msg void OnDebugDisplayIPS();
	afx_msg void OnUpdateDebugPeople(CCmdUI *pCmdUI);
	afx_msg void OnDebugPeople();
	afx_msg void OnDebugGradeUp();
	afx_msg void OnDebugGradeDown();
	afx_msg void OnPause();
	afx_msg void OnUpdatePause(CCmdUI *pCmdUI);
	afx_msg void OnSetting();
	afx_msg void OnUpdateSetting(CCmdUI *pCmdUI);
	afx_msg void OnHideElevatorRoom();
	afx_msg void OnUpdateHideElevatorRoom(CCmdUI *pCmdUI);
	afx_msg void OnFavorite();
	afx_msg void OnUpdateFavorite(CCmdUI *pCmdUI);
	afx_msg void OnHideControlWindow();
	afx_msg void OnUpdateHideControlWindow(CCmdUI *pCmdUI);
	afx_msg void OnHideMessageWindow();
	afx_msg void OnUpdateHideMessageWindow(CCmdUI *pCmdUI);
	afx_msg void OnHideToolWindow();
	afx_msg void OnUpdateHideToolWindow(CCmdUI *pCmdUI);
};