ScummVM API documentation
riddles.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_RIDDLES_H
23#define HODJNPODJ_RIDDLES_H
24
25#include "bagel/afxwin.h"
26#include "bagel/hodjnpodj/hnplibs/stdinc.h"
27#include "bagel/boflib/error.h"
28#include "bagel/boflib/sound.h"
29#include "bagel/hodjnpodj/hnplibs/sprite.h"
30#include "bagel/hodjnpodj/hnplibs/text.h"
31#include "bagel/hodjnpodj/hnplibs/button.h"
32
33namespace Bagel {
34namespace HodjNPodj {
35namespace Riddles {
36
37// Easter egg parameters
38#define FISH_X 13
39#define FISH_Y 40
40#define NUM_FISH_CELS 25
41
42#define SKIER_X 6
43#define SKIER_Y 98
44#define NUM_SKIER_CELS 14
45
46#define NESSIE_X 17
47#define NESSIE_Y 24
48#define NUM_NESSIE_CELS 27
49
50#define ANIM_X 5
51#define ANIM_Y 24
52#define ANIM_DX 211
53#define ANIM_DY 173
54#define ANIM_SLEEP 100 // In milliseconds
55
56#define COLUMN_1_X 213
57#define COLUMN_1_Y 25
58#define COLUMN_1_DX 38
59#define COLUMN_1_DY 195
60
61#define COLUMN_2_X 332
62#define COLUMN_2_Y 25
63#define COLUMN_2_DX 50
64#define COLUMN_2_DY 187
65
66#define COLUMN_3_X 397
67#define COLUMN_3_Y 25
68#define COLUMN_3_DX 40
69#define COLUMN_3_DY 197
70
71#define COLUMN_4_X 451
72#define COLUMN_4_Y 25
73#define COLUMN_4_DX 63
74#define COLUMN_4_DY 227
75
76#define COLUMN_5_X 544
77#define COLUMN_5_Y 25
78#define COLUMN_5_DX 53
79#define COLUMN_5_DY 38
80
81#define COLUMN_6_X 560
82#define COLUMN_6_Y 63
83#define COLUMN_6_DX 63
84#define COLUMN_6_DY 59
85
86#define COLUMN_7_X 584
87#define COLUMN_7_Y 122
88#define COLUMN_7_DX 40
89#define COLUMN_7_DY 88
90
91#define COLUMN_WAV "sound\\COLUMN.WAV"
92
93#define MAX_RIDDLE_LENGTH 159
94#define MIN_RIDDLE_LENGTH 20
95#define MAX_ANSWERS 13
96#define MAX_ANSWER_LENGTH 23
97
98#define FISH_ANIM "art\\ridfish.bmp"
99#define FISH_WAV "sound\\lakefish.wav"
100#define NESS_ANIM "art\\nessie.bmp"
101#define NESS_WAV "sound\\serpent.wav"
102#define SKIER_ANIM "art\\skier.bmp"
103#define SKIER_WAV "sound\\jetski.wav"
104
105#include "common/pack-start.h" // START STRUCT PACKING
106struct RIDDLE {
107 uint16 nSoundId;
108 char text[MAX_RIDDLE_LENGTH + 1];
109 char answers[MAX_ANSWERS][MAX_ANSWER_LENGTH + 1];
110} PACKED_STRUCT;
111#include "common/pack-end.h" // END STRUCT PACKING
112
113class CMyEdit: public CEdit {
114protected:
115 void OnChar(unsigned int, unsigned int, unsigned int);
116 void OnSysChar(unsigned int, unsigned int, unsigned int);
117 void OnKeyDown(unsigned int, unsigned int, unsigned int);
118 void OnSysKeyDown(unsigned int, unsigned int, unsigned int);
119
120 DECLARE_MESSAGE_MAP()
121};
122
123class CRiddlesWindow : public CFrameWnd {
124private:
125 CBrush cBrush;
126
127public:
129 void PlayGame();
130 void PaintScreen();
131 void LoadIniSettings();
132 void ParseAnswer(const char *);
133 void GamePause();
134 void GameResume();
135
136private:
137 void OnSoundNotify(CSound *pSound);
138
139protected:
140 void FlushInputEvents();
141 bool CheckUserGuess(const char *);
142 ERROR_CODE RepaintSpriteList();
143 ERROR_CODE LoadRiddle();
144 ERROR_CODE BuildSpriteList();
145 ERROR_CODE DisplayLine(const char *, int, int, int);
146 int CharToIndex(char);
147 ERROR_CODE ValidateRiddle(RIDDLE *);
148 ERROR_CODE LoadMasterSprites();
149 void GameReset();
150 virtual bool OnCommand(WPARAM wParam, LPARAM lParam) override;
151 void HandleError(ERROR_CODE);
152 void DeleteSprite(CSprite *);
153
154 void OnPaint();
155 void OnMouseMove(unsigned int, CPoint);
156 void OnLButtonDown(unsigned int, CPoint);
157 void OnClose();
158 void OnSetFocus(CWnd *);
159 void OnTimer(uintptr);
160 LRESULT OnMCINotify(WPARAM, LPARAM);
161 LRESULT OnMMIONotify(WPARAM, LPARAM);
162 HBRUSH OnCtlColor(CDC *, CWnd *, unsigned int);
163
164 DECLARE_MESSAGE_MAP()
165
166 CRect m_rNewGameButton;
167 CMyEdit *m_pEditText = nullptr;
168 CPalette *m_pGamePalette = nullptr;
169 CBmpButton *m_pScrollButton = nullptr;
170 RIDDLE *m_pRiddle = nullptr;
171 CSprite *m_pSunDial = nullptr;
172 CSound *m_pSoundTrack = nullptr;
173 int m_nTimeLimit = 0;
174 int m_nInitTimeLimit = 0;
175 int m_nTimer = 0;
176 int m_nDifficultyLevel = 0;
177 unsigned int m_nRiddleNumber = 0;
178 bool m_bGameActive = false;
179 bool m_bPause = false;
180 bool m_bIgnoreScrollClick = false;
181};
182
183} // namespace Riddles
184} // namespace HodjNPodj
185} // namespace Bagel
186
187#endif
Definition: button.h:65
Definition: sprite.h:41
Definition: riddles.h:113
Definition: afxwin.h:565
Definition: afxwin.h:721
Definition: afxwin.h:1739
Definition: afxwin.h:1532
Definition: afxwin.h:667
Definition: atltypes.h:79
Definition: atltypes.h:131
Definition: afxwin.h:1141
Definition: riddles.h:106
Definition: minwindef.h:87