ScummVM API documentation
main.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef HODJNPODJ_NOVACANCY_MAIN_H
23#define HODJNPODJ_NOVACANCY_MAIN_H
24
25#include "bagel/afxwin.h"
26#include "bagel/hodjnpodj/hnplibs/stdinc.h"
27#include "bagel/hodjnpodj/hnplibs/sprite.h"
28#include "bagel/hodjnpodj/hnplibs/text.h"
29#include "bagel/boflib/error.h"
30#include "bagel/hodjnpodj/hnplibs/button.h"
31#include "bagel/boflib/sound.h"
32
33namespace Bagel {
34namespace HodjNPodj {
35namespace NoVacancy {
36
37char *GetStringFromResource(unsigned int);
38
39class CMainWindow : public CFrameWnd {
40public:
42 void PlayGame();
43 void PaintScreen();
44 void LoadIniSettings();
45 void SaveIniSettings();
46
47
48protected:
49 void GameReset();
50 void GamePause();
51 void GameResume();
52 virtual bool OnCommand(WPARAM wParam, LPARAM lParam) override;
53 void HandleError(ERROR_CODE);
54 void DeleteSprite(CSprite *);
55
56 void OnPaint();
57 void OnTimer(uintptr);
58 void OnMouseMove(unsigned int, CPoint);
59 virtual void OnLButtonDown(unsigned int, CPoint);
60 virtual void OnRButtonDown(unsigned int, CPoint);
61 void OnSysChar(unsigned int, unsigned int, unsigned int);
62 virtual void OnSysKeyDown(unsigned int, unsigned int, unsigned int);
63 virtual void OnKeyDown(unsigned int, unsigned int, unsigned int);
64 void OnActivate(unsigned int, CWnd *, bool) override;
65 void OnClose();
66 virtual LRESULT OnMCINotify(WPARAM, LPARAM);
67 virtual LRESULT OnMMIONotify(WPARAM, LPARAM);
68
69 DECLARE_MESSAGE_MAP()
70
71 CRect m_rNewGameButton,
72 m_rectGameArea;
73 CPalette *m_pGamePalette = nullptr;
74 CBmpButton *m_pScrollButton = nullptr;
75
76 CRect m_rLDie; //the rectangles defined by the two dice.
77 CRect m_rRDie;
78
79 //assume all doors are equi-sized and equidistant.
80 CRect m_rDoor1; //the first door
81 CRect m_rDoor[10]; //rectangles representing doors 0 thru 9 ; #0 is unused.
82 bool m_bDieUpdate = false;
83 byte m_iDoorStatus[10] = {}; //status of every door.
84 bool m_bGameJustBegun = false;
85 bool m_bDiceJustThrown = false;
86 bool m_bDoorBmpLoaded[10] = {};
87 bool m_bGameLoadUp = false;
88
89 byte m_cDoorToOpen = 0;
90 byte m_LDie = 0;
91 byte m_RDie = 0;
92 byte m_cUnDoableThrows = 0;
93
94 short m_iMoveValid = 0; // flag to indicate the legal status of the last move. It is a ternary indicator :
95 // 1 => Perfectly legal move, and the dice van be rolled if desired.
96 // 0 => Legal move but not complete to roll the dice. The dice are disabled.
97 // -1=> Illegal move; stop and correct yourself. The dice are disabled.
98 byte m_cDoorCount = 0; // keeps track of all closed doors, irrespective of the validity of the move
99 byte m_cActiveDoor = 0; // the door whose status has just been changed (as result of mouse action).
100 bool m_bOneDieCase = false; // this variable is always false unless doors 7, 8, and 9 are FIEXD.
101
102 //other objects for animation...
103 CRect Paper,
104 Glass,
105 aBrShoes,
106 bBrShoes,
107 BluShoes,
108 Bottle,
109 Cat,
110 Hat6,
111 UmbrStand;
112
113 bool m_bGameActive = false;
114 bool m_bPause = false;
115 bool m_bIgnoreScrollClick = false;
116 bool m_bSound = false;
117 CSound *m_psndBkgndMusic = nullptr;
118
119 CSprite *m_pCLRollingDie = nullptr;
120 CSprite *m_pCRRollingDie = nullptr;
121 CSprite *m_pCSingleRollingDie = nullptr; //unused in v.1.5 or later.
122
123private:
124 bool m_bDiceBmpsLoaded = false;
125 CString gWndClass;
126
127 void AnimateDice();
128 short LegalizeMove(short i);
129 bool IsThrowDoable(byte dice_sum);
130};
131
132
133#define LEFT 0
134#define RIGHT 1
135
136#define FIXED 2
137#define CLOSED 1
138#define OPEN 0
139
140#define toggle(V) (V=!(V))
141#define is_locked(door) (m_iDoorStatus[door]==FIXED)
142
143} // namespace NoVacancy
144} // namespace HodjNPodj
145} // namespace Bagel
146
147#endif
Definition: button.h:65
Definition: sprite.h:41
Definition: afxwin.h:1532
Definition: afxwin.h:667
Definition: atltypes.h:79
Definition: atltypes.h:131
Definition: afxstr.h:31
Definition: afxwin.h:1141