From c0c336500955a23e344651e5412c9d9d441ef4ee Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Wed, 28 Jun 2023 22:22:32 +0100 Subject: first pass of T2DLL --- src/T2DLL/T2WorldDef.h | 306 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 201 insertions(+), 105 deletions(-) (limited to 'src/T2DLL/T2WorldDef.h') diff --git a/src/T2DLL/T2WorldDef.h b/src/T2DLL/T2WorldDef.h index b80d358..d1e9092 100644 --- a/src/T2DLL/T2WorldDef.h +++ b/src/T2DLL/T2WorldDef.h @@ -1,132 +1,228 @@ #pragma once #include "common.h" +#include "T2PaletteAnimeDef.h" #include "T2TemplatePlugin.h" -class T2WorldDef : public T2TemplatePlugin { +// 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_EXT_CLASS T2WorldDef : public T2TemplatePlugin { public: - T2WorldDef(unsigned long, T2PluginSpecifier&, CResFile*, T2WorldPlugin*); + T2WorldDef(DWORD inType, T2PluginSpecifier& inSpecifier, CResFile* inResFile, T2WorldPlugin* inPlugin); public: virtual ~T2WorldDef(); - virtual void GetName(CString&); - virtual int GetSortKey() { return 0; } - virtual int GetInitialFunds() const { return 0; } - virtual int IsHoliday(T2DateTime*) const { return 0; } - virtual int IsRainyDay(T2DateTime*) const { return 0; } - virtual int ExchangeMoney(int) const { return 0; } - virtual void DrawWorld(T2TowerDoc*); - virtual void DoAnimate(T2TowerDoc*); - virtual void DrawBkgnd(unsigned int, const RECT&, T2TowerDoc*); - virtual void DrawBkgnd(const RECT&, T2TowerDoc*); - virtual void DrawRoofAndFloor(const RECT&, T2TowerDoc*, ROOFANDFLOOR); - virtual void DrawBuild(T2Equip*, T2TowerDoc*); - virtual void DrawSideObj(T2Equip*, T2TowerDoc*, SIDEOBJPATTERN); - virtual void DrawOptionObj(T2TowerDoc*, const RECT&); - virtual void DrawRubble(T2TowerDoc*, T2Tenant*); - virtual void DrawMark(T2BitImage*, const RECT&, int, unsigned int); - virtual void DrawCrane(T2TowerDoc*, const RECT&); - virtual const char* GetMoneyUnit() { return 0; } - virtual T2EventItem* MakeXEvent(T2TowerEvent*, CResFile*, unsigned long, int); - virtual T2Transport* GetCruise(T2TowerEvent*) { return 0; } - virtual void InitializeBkgndInfo(BkgndInfo*); - virtual void InitializeFloorInfo(T2FloorInfo*); - virtual void InitializeDocument(T2TowerDoc*); - virtual int TenantAreaCheck(T2TowerDoc*, RECT&, int); - virtual void CalcOptionObj(T2TowerDoc*, T2Equip*); - virtual void CalcCranePos(T2TowerDoc*); - virtual void ClearCranePos(T2TowerDoc*); - virtual void DrawCtrl(T2TowerDoc*, T2MWControl*); - virtual void ButtonDownOnCtrl(T2TowerDoc*, T2MWControl*, CPoint, CWnd*); - virtual void ButtonUpOnCtrl(T2TowerDoc*, T2MWControl*, CPoint, CWnd*); - virtual void MouseMoveOnCtrl(T2TowerDoc*, T2MWControl*, CPoint, CWnd*); - virtual void GetToolTipText(T2TowerDoc*, T2MWControl*, NMTTDISPINFOA*); - virtual int IdleProc(T2TowerDoc*); - virtual int CheckGameLevelProc(T2TowerDoc*); - virtual void GetGradeUpMessage(int, CString&); - virtual void DayChanged(T2TowerDoc*) {} - virtual void ViewModeChanged(T2TowerDoc*, VIEWMODE); - virtual void ReplaceSkyOffscreen(int); - virtual BOOL3 ChangeFastSEProc(T2PaletteAnime*) { return BOOL3_0; } - virtual BOOL3 ChangeFastSEProc(T2PaletteAnime*, T2DateTime*) { return BOOL3_0; } - virtual BOOL3 ChangeSEProc(T2PaletteAnime*) { return BOOL3_0; } - virtual BOOL3 ChangeSkyColorProc(T2PaletteAnime*) { return BOOL3_0; } - virtual BOOL3 AdjustSkyStateProc(T2PaletteAnime*, T2DateTime*) { return BOOL3_0; } - virtual int UseOwnSkyPaletteFunction() { return 0; } - virtual void SetupGradeUpAnimation(T2DlgItemAnimation*, int); - virtual void WriteStatisticsProc(T2TowerDoc*, T2Archive&); - virtual void ReadStatisticsProc(T2TowerDoc*, T2Archive&); - virtual int CheckTreasure(T2TowerDoc*, T2TreasureStatus*); + virtual void GetName(CString& outStr); + virtual int GetSortKey() { return mWorldType; } + virtual int GetInitialFunds() const { return mInitialFunds; } + virtual BOOL IsHoliday(T2DateTime* inDateTime) const { return false; } + virtual BOOL IsRainyDay(T2DateTime* inDateTime) const { return false; } + virtual int ExchangeMoney(int v) const { + return (mMoneyNumerator == 1 && mMoneyDenominator == 1) ? v : ((v / mMoneyDenominator) * mMoneyNumerator); + } + 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); + 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 ChangeFastSEProc(T2PaletteAnime* inPaletteAnime, T2DateTime* inDateTime) { return BOOL3_NEG1; } + virtual BOOL3 ChangeSEProc(T2PaletteAnime* inPaletteAnime) { 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); virtual unsigned long OptionProc(unsigned long, void*) { return 0; } - unsigned int GetToiletDenomi(unsigned int) const; - unsigned int GetColdDenomi(unsigned int, unsigned int) const; - int IsDustOn(unsigned int) const; + 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*, int); - void SetLatestBuild(T2ToolDef*, int); - void InitTowerEvent(T2TowerDoc*); - void WriteTowerEvent(T2Archive&); - void ReadTowerEvent(T2Archive&); + 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(); - int IsBlackOut(); + BOOL IsBlackOut(); - CPalette* GetPalette() { return 0; } - int IsUseMatterObject() const { return 0; } - int GetOutViewKind() const { return 0; } - T2PaletteAnimeDef* GetPaletteAnimeDef() const { return 0; } - T2SeasonParamDef* GetSeasonParamDef() const { return 0; } - int GetHeight() const { return 0; } - int GetWidth() const { return 0; } - void GetBuildArea(RECT&) const {} - int IsStoppableFloor(int) { return 0; } - int GetLobbyHeight() { return 0; } - T2Maru_Reggae* GetReggae() { return 0; } - int GetCashAmount(int) const { return 0; } + 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; } + int GetHeight() const { return mHeight; } + int GetWidth() const { return mWidth; } + void GetBuildArea(RECT& rect) const { rect = mBuildArea; } + BOOL IsStoppableFloor(int y) { + return !((y >= (mGroundLine - mLobbyHeight) && y < (mGroundLine - 1))); + } + int GetLobbyHeight() { return mLobbyHeight; } + T2Maru_Reggae* GetReggae() { return NULL; } + int GetCashAmount(int i) const { + return (i >= 0 && i < 8) ? mCashAmount[i] : 0; + } protected: - virtual void DrawClock(T2MWControl*, T2DateTime&); - virtual void DrawCalendar(T2MWControl*, T2DateTime&, T2TowerDoc*); - virtual void DrawFunds(T2MWControl*, int); - virtual void DrawPopulation(T2MWControl*, int); - virtual void DrawMessage(T2MWControl*); - virtual void DrawPauseButton(T2MWControl*); - virtual void DrawInViewButton(T2MWControl*); - virtual void DrawOutViewButton(T2MWControl*); - virtual void DrawMaintButton(T2MWControl*); - virtual void DrawEvalButton(T2MWControl*); - virtual void DrawPriceButton(T2MWControl*); - virtual void DrawTransButton(T2MWControl*); - virtual void DrawSlider(T2MWControl*); - virtual void ClickClock(T2MWControl*, T2TowerDoc*); - virtual void ClickCalendar(T2MWControl*, T2TowerDoc*); - virtual void ClickFunds(T2MWControl*, T2TowerDoc*); - virtual void ClickPopulation(T2MWControl*, T2TowerDoc*); - virtual void ClickPauseButton(T2MWControl*, T2TowerDoc*); - virtual void ClickInViewButton(T2MWControl*, T2TowerDoc*); - virtual void ClickOutViewButton(T2MWControl*, T2TowerDoc*); - virtual void ClickMaintButton(T2MWControl*, T2TowerDoc*); - virtual void ClickEvalButton(T2MWControl*, T2TowerDoc*); - virtual void ClickPriceButton(T2MWControl*, T2TowerDoc*); - virtual void ClickTransButton(T2MWControl*, T2TowerDoc*); - virtual int SliderPointToValue(T2MWControl*, CPoint); - virtual void GetClockTip(T2TowerDoc*, T2MWControl*, char*); - virtual void GetCalendarTip(T2TowerDoc*, T2MWControl*, char*); - virtual void GetFundsTip(T2TowerDoc*, T2MWControl*, char*); - virtual void GetPopulationTip(T2TowerDoc*, T2MWControl*, char*); - virtual void GetPauseButtonTip(T2TowerDoc*, T2MWControl*, char*); - virtual void DrawSimpleMWControl(T2MWControl*, const char*); + 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); + void SetupOffscreen(HINSTANCE inModule); void DisposeOffscreen(); - void SetupPalette(HINSTANCE); + void SetupPalette(HINSTANCE inModule); void DisposePalette(); -protected: 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; }; -- cgit v1.2.3