diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-07-05 19:04:06 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-07-05 19:04:06 +0100 |
commit | 5e61c1280c15ab9969b94cd360cafd4a11b2dd30 (patch) | |
tree | 1fdb60d771c4351b5aa5dcf1a43376c0558625a4 /src/T2TowerMainView.h | |
parent | c2efba6907fab934a04959b9bb644cf7141cc955 (diff) | |
download | t2win-5e61c1280c15ab9969b94cd360cafd4a11b2dd30.tar.gz t2win-5e61c1280c15ab9969b94cd360cafd4a11b2dd30.zip |
matched T2.exe
Diffstat (limited to '')
-rw-r--r-- | src/T2TowerMainView.h | 209 |
1 files changed, 163 insertions, 46 deletions
diff --git a/src/T2TowerMainView.h b/src/T2TowerMainView.h index 4bb33ad..0bccd8f 100644 --- a/src/T2TowerMainView.h +++ b/src/T2TowerMainView.h @@ -2,62 +2,179 @@ #include "common.h" #include "LAttachable.h" +enum { + kTool0_Null = 0, + kTool1_Tenant, + kTool2_Mover, + kTool3_OutObj, + kTool4_Finger, + kTool5_Hand +}; + +enum { + kAnotherToolVar0 = 0, + kAnotherToolVar1, + kAnotherToolVar2, + kAnotherToolVar3 +}; + +enum { + kScroll1 = 1, + kScroll2, + kScroll3, + kScrollOptionMask = 0xFF, + kScrollOpt2 = 0x100, + kScrollOpt2Mask = 0xFF00, + kScrollOpt3 = 0x10000, + kScrollOpt3Mask = 0xFF0000, +}; + class T2TowerMainView : public CView, public LAttachable { + DECLARE_MESSAGE_MAP() + DECLARE_DYNCREATE(T2TowerMainView) + public: + T2TowerMainView(); + virtual ~T2TowerMainView(); + virtual void AssertValid() const; + virtual void Dump(CDumpContext &dc) const; + virtual BOOL PreTranslateMessage(MSG *pMsg); + virtual void OnInitialUpdate() {} + virtual void tmv_vf110(); - virtual void tmv_vf114(); - virtual void tmv_vf118(); + virtual void DrawDebugGrid(); + virtual void CopySimulationImage(const RECT &inRect); + void x42B484(CDC *pDC, const RECT &inRect); virtual void tmv_vf11C(); virtual void tmv_vf120(); // DrawSimulation? - virtual void tmv_vf124(BOOL); // some invalidator - virtual void tmv_vf128(const RECT &, BOOL flag = false); // updates various rects - InvalUnitRect? - virtual void tmv_vf12C(); - virtual void tmv_vf130(int); // set scroll Y? - virtual void tmv_vf134(int); // set scroll X: - virtual void tmv_vf138(const POINT &, WPARAM); - virtual void tmv_vf13C(); - virtual void tmv_vf140(RECT &); // gets visible rect in unit coords? + virtual void Invalidate(BOOL inFlag); + virtual void InvalUnitRect(const RECT &inRect, BOOL inFlag = false); + virtual T2TowerDoc *GetTowerDoc(); + virtual void SetScrollV(int inV); + virtual void SetScrollH(int inH); + virtual void tmv_vf138(const POINT &inPt, unsigned int inCode); + virtual void tmv_vf13C(int inX, int inY, unsigned int inCode); + virtual void GetVisibleUnitRect(RECT &outRect) const; + void HandToolClick(CPoint inPt); + void HandToolDrag(CPoint inPt); + void HandToolRelease(CPoint inPt); virtual void tmv_vf144(); - virtual void tmv_vf148(); - virtual void tmv_vf14C(); - virtual void tmv_vf150(); - virtual void tmv_vf154(); - virtual void tmv_vf158(); - virtual void tmv_vf15C(const RECT *); // CenterOnView? - virtual void tmv_vf160(); + virtual void DoZoomIn(POINT inPt); + virtual void DoZoomOut(); + virtual void UnhideToolSprite(); + virtual void HideToolSprite(); + virtual void CenterOnRectAndZoom(const RECT &inRect); + virtual void CenterOnRect(const RECT *inRect); + + virtual BOOL tmv_vf160(POINT &outPt); T2TowerDoc *mDocument; - RECT m50; - T2BitImage *m60; - POINT m64; + + // Represents the full world area in unit coordinates + RECT mWorldBounds; + + // A buffer storing the entire tower + T2BitImage *mImage; + + // Where the view is currently scrolled to + POINT mScrollOffset; + RECT m6C; POINT m7C; - int m84; - int m88; - RECT m8C; - RECT m9C; - RECT mAC; - RECT mBC; - CPoint mCC; - int _D4; - int mD8; - int mDC; - int _E0; - int _E4; - int _E8; + + // An extra offset that will centre the image within the viewport, if the + // viewport is larger than the world area + POINT mImageOrigin; + + // The unit coordinates that are currently visible + RECT mVisibleArea; + + RECT mUpdateRect1; + RECT mUpdateRect2; + RECT mSpriteUpdateRect; + + // The last point handled when clicking or dragging with the Hand tool + CPoint mHandToolLastPos; + + // Which mouse buttons we consider to be held down + UINT mPressedButtons; + + // Tracks how many times the tool-specific sprite has been hidden + int mHideToolSpriteCount; + + BOOL mDC; + POINT _E0; + int mAnotherToolVar; int _EC; - BOOL mDebugMode; - BOOL mF4; - int _F8; - int mFC; - int mSomeSpriteIndex; - CString mSomeSpriteName; - int _108; - int _10C; - int _110; - int _114; + int mDebugMode; + int mActiveTool; + BOOL mIsDebugGrid; + T2ToolDef *mActiveToolDef; + int mToolSpriteIndex; + CString mToolSpriteName; + POINT _108; + BOOL mSkipOffscreenDraw; + unsigned int mDbgEquipID; T2Equip *mDbgEquip; - int _11C; - int _120; - CPoint m124; + POINT mNextScrollOffset; + + // Where the player initially clicked, in window coordinates + CPoint mInitialClickPos; + +protected: + virtual BOOL PreCreateWindow(CREATESTRUCT &cs); + virtual void OnDraw(CDC *pDC); + virtual void OnUpdate(CView *pSender, LPARAM lHint, CObject *pHint); + virtual void OnActivateView(BOOL bActivate, CView *pActivateView, CView *pDeactiveView); + + BOOL CreateToolSprite(BOOL inSkipShowing = false); + BOOL DeleteToolSprite(); + + afx_msg int OnCreate(LPCREATESTRUCT lpcs); + afx_msg void OnDestroy(); + void AdjustWorldBounds(); + void ClearUpdateRect(); + void x42AC1B(); + afx_msg void OnSize(UINT nType, int cx, int cy); + + afx_msg void OnDebugNormalDisplay(); + afx_msg void OnUpdateDebugNormalDisplay(CCmdUI *pCmdUI); + afx_msg void OnDebugBkgndInfo(); + afx_msg void OnUpdateDebugBkgndInfo(CCmdUI *pCmdUI); + afx_msg void OnDebugFloorInfoTenant(); + afx_msg void OnUpdateDebugFloorInfoTenant(CCmdUI *pCmdUI); + afx_msg void OnDebugFloorInfoMover(); + afx_msg void OnUpdateDebugFloorInfoMover(CCmdUI *pCmdUI); + afx_msg void OnDebugFloorInfoRequest(); + afx_msg void OnUpdateDebugFloorInfoRequest(CCmdUI *pCmdUI); + + void DrawDebugBkgndInfo(CDC *pDC); + void DrawDebugFloorInfoTenant(CDC *pDC, const RECT &inRect); + void DrawDebugFloorInfoMover(CDC *pDC, const RECT &inRect); + void DrawDebugFloorInfoRequest(CDC *pDC, const RECT &inRect); + void DrawDebugEquip(CDC *pDC, const RECT &inRect); + void x42CA08(const POINT &inPt); + afx_msg void OnCommand10000to10010(UINT nCmd); + + afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + void HandleLButtonDown(CPoint inPt); + afx_msg void OnMouseMove(UINT nFlags, CPoint point); + afx_msg void OnLButtonUp(UINT nFlags, CPoint point); + void HandleLButtonUp(CPoint inPt); + + afx_msg void OnUpdateDebugGrid(CCmdUI *pCmdUI); + afx_msg void OnDebugGrid(); + + void x42E366(int inType); + + afx_msg void OnRButtonDown(UINT nFlags, CPoint point); + void HandleRButtonDown(CPoint inPt); + afx_msg void OnRButtonUp(UINT nFlags, CPoint point); + void HandleRButtonUp(CPoint inPt); + + afx_msg void OnUpdateDebugDisplaySpeedMeasuring(CCmdUI *pCmdUI); + afx_msg void OnDebugDisplaySpeedMeasuring(); + afx_msg void OnUpdateDebugOffscreenSpeedMeasuring(CCmdUI *pCmdUI); + afx_msg void OnDebugOffscreenSpeedMeasuring(); + afx_msg void OnTimer(UINT nIDEvent); }; |