ScummVM API documentation
artparts.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_ARTPARTS_ARTPARTS_H
23#define HODJNPODJ_ARTPARTS_ARTPARTS_H
24
25#include "bagel/boflib/sound.h"
26#include "bagel/hodjnpodj/hnplibs/button.h"
27#include "bagel/hodjnpodj/hnplibs/text.h"
28
29namespace Bagel {
30namespace HodjNPodj {
31namespace ArtParts {
32
33// Border info
34#define SIDE_BORDER 20
35#define TOP_BORDER 28 //32
36#define BOTTOM_BORDER 20 //16
37#define HILITE_BORDER 3
38
39// Art Parts constants
40#define ART_WIDTH 600
41#define ART_HEIGHT 432
42
43// For the "frame" of correct pieces around the artwork:
44#define FRAME_WIDTH 4
45#define FRAME_HEIGHT 4
46
47// Starting value defaults
48#define MAX_COLUMNS 30
49#define MIN_COLUMNS 1
50
51#define MAX_ROWS 24
52#define MIN_ROWS 1
53
54#define START_COLUMNS 4
55#define START_ROWS 4
56
57// Timer constants
58#define MIN_TIME 0 // 15 Seconds
59#define MAX_TIME 600 // 180 Seconds = 3 minute max
60#define TIMER_START 0 // Increment scrollbar in steps of 15 Secs
61#define TIMER_MAX 12 // if Time > MAX_TIME, No Time Limit
62
63#define DISPLAY_TIMER 1
64#define SHOW_TIMER 2
65#define MS_SCALE 1000 // Scale seconds to milliseconds
66
67#define CLICK_TIME 1000 // Every Second, update timer clock
68#define PAUSE_TIME 3000 // Wait three seconds before erasing hint screen
69
70// Sound files
71#define PICK_SOUND "sound\\pickart.wav"
72#define SWITCH_SOUND "sound\\moveart.wav"
73#define WIN_SOUND "sound\\sound146.wav"
74#define UNDO_SOUND "sound\\sound355.wav"
75#define LOSE_SOUND "sound\\buzzer.wav"
76#define RULES_WAV "sound\\artparts.wav"
77
78#define GAME_THEME "sound\\artparts.mid"
79
80// Backdrop bitmaps
81#define MAINSCREEN "art\\ARTPART1.BMP"
82#define FRAMESCREEN "art\\ARTPART1.BMP"
83#define TEXTSCREEN "art\\ARTTEMP.BMP"
84
85#define DATA_FILE "artfiles.dat"
86#define MAX_FILE_LENGTH 20 // Longest Art file name length allowed
87
88// New Game button area
89#define NEWGAME_LOCATION_X 70
90#define NEWGAME_LOCATION_Y 5
91#define NEWGAME_WIDTH 113
92#define NEWGAME_HEIGHT 13
93
94// Time Display area
95#define TIME_LOCATION_X 457
96#define TIME_LOCATION_Y 4
97#define TIME_WIDTH 117
98#define TIME_HEIGHT 16
100
101// CMainWindow:
102// See game.cpp for the code to the member functions and the message map.
103//
104class CMainWindow : public CFrameWnd {
105public:
106 CMainWindow();
107 ~CMainWindow();
108
109 bool LoadArtWork();
110 void DrawPart(const CPoint &Src, const CPoint &Dst, int nWidth, int nHeight);
111 void SwitchAreas(const CRect &Src, const CRect &Dst);
112 void InitValues();
113 void NewGame();
114 void CheckForWin();
115 void ShowOutOfPlace();
116
117//added data members:
118 bool m_bPlaying = false; // Flag True if playing, False if setting options
119 bool m_bNewGame = false; // Flag to check if a new game is being played
120 bool m_bFirst = false; // Flag to check if the first area is being selected
121 CPoint First;
122 CPoint Second;
123 CPoint Center;
124 CPoint UpLeft;
125 CRect BaseRect; // The part that is the base of the select area
126 CRect OldRect; // The last area highlighted
127 CRect HiLiteRect; // The new area to highlight
128 CRect SrcRect; // The area to be moved
129 CRect DstRect; // The destination of the moving area
130
131 void SplashScreen();
132 void SplashScratch();
133 void SplashScratchPaint();
134
135private:
136 POINT Grid[MAX_COLUMNS][MAX_ROWS]; // Location of the art parts
137
138 CBmpButton *m_pScrollButton = nullptr;
139 CBitmap *pScratch1 = nullptr, // Off-screen bitmap of current positions
140 *pScratch2 = nullptr, // Off-screen bitmap of new positions
141 *pOldBmp1 = nullptr,
142 *pOldBmp2 = nullptr;
143 CPalette *pOldPal1 = nullptr,
144 *pOldPal2 = nullptr;
145 CDC *pScratch1DC = nullptr,
146 *pScratch2DC = nullptr;
147 CText *m_pTimeText = nullptr; // Time to be posted in Locale box of screen
148 CBitmap *pLocaleBitmap = nullptr, // Locale of game bitmap for title bar
149 *pBlankBitmap = nullptr; // Blank area of locale for time display
150
151 bool bStartOkay = true;
152 bool bGameStarted = false; // becomes true at start time, false at game end
153 bool bSwitched = false; // flag for undo -- only true after a part switch
154 bool bSuccess;
155 bool m_bIgnoreScrollClick;
156 bool m_bShowOutOfPlace = false;
157 char szCurrentArt[64] = {};
158
159 static CPalette *pGamePalette; // Palette of current artwork
160 static int nSeconds;
161 static int nMinutes;
162 static int nLastPick;
163 static int m_nTime; // Time is in SECONDS
164 static int m_nRows; // Number of rows in the artwork grid
165 static int m_nColumns; // Number of columns in the artwork grid
166 static int m_nWidth; // The Width of each Part
167 static int m_nHeight; // The Height of each Part
168 static float m_nScore; // The current percentage of correctly placed parts
169 static bool bFramed; // Framed (hint) mode is turned off by default
170
171 static int tempTime; // temporary holding places
172 static int tempRows; //...for options changes,
173 static int tempColumns; //...which only get used
174 static bool tempFramed; //...when NewGame is called.
175
176 CSound *pGameSound = nullptr; // Game theme song
177
178private:
179 void initStatics();
180 void OnSoundNotify(CSound *pSound);
181 static bool CopyPaletteContents(CPalette *pSource, CPalette *pDest);
182 void MyFocusRect(CDC *pDC, CRect rect, int nDrawMode);
183 static void GetSubOptions(CWnd *pParentWind);
184
185protected:
186 virtual bool OnCommand(WPARAM wParam, LPARAM lParam) override;
187
188 //{{AFX_MSG( CMainWindow )
189 afx_msg void OnPaint();
190 afx_msg void OnChar(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
191 afx_msg void OnSysKeyDown(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
192 afx_msg void OnTimer(uintptr nIDEvent);
193 afx_msg void OnLButtonDown(unsigned int nFlags, CPoint point);
194 afx_msg void OnRButtonDown(unsigned int nFlags, CPoint point);
195 afx_msg void OnLButtonUp(unsigned int nFlags, CPoint point);
196 afx_msg void OnMButtonDown(unsigned int nFlags, CPoint point);
197 afx_msg void OnMouseMove(unsigned int nFlags, CPoint point);
198 afx_msg void OnKeyDown(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
199 afx_msg void OnClose();
200 afx_msg LRESULT OnMCINotify(WPARAM, LPARAM);
201 afx_msg LRESULT OnMMIONotify(WPARAM, LPARAM);
202 //}}AFX_MSG
203
204 DECLARE_MESSAGE_MAP()
205};
206
207} // namespace ArtParts
208} // namespace HodjNPodj
209} // namespace Bagel
210
211#endif
Definition: artparts.h:104
Definition: button.h:65
Definition: text.h:62
Definition: afxwin.h:635
Definition: afxwin.h:721
Definition: afxwin.h:1532
Definition: afxwin.h:667
Definition: atltypes.h:79
Definition: atltypes.h:131
Definition: afxwin.h:1141
Definition: minwindef.h:161