ScummVM API documentation
packrat.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_PACKRAT_PACKRAT_H
23#define HODJNPODJ_PACKRAT_PACKRAT_H
24
25#define OINK
26
27#include "bagel/boflib/sound.h"
28#include "bagel/hodjnpodj/packrat/globals.h"
29#include "bagel/hodjnpodj/packrat/resource.h"
30#include "bagel/hodjnpodj/hnplibs/dibdoc.h"
31#include "bagel/hodjnpodj/hnplibs/gamedll.h"
32#include "bagel/hodjnpodj/hnplibs/cbofdlg.h" // header for the options library
33#include "bagel/hodjnpodj/hnplibs/mainmenu.h"
34#include "bagel/hodjnpodj/hnplibs/sprite.h"
35#include "bagel/hodjnpodj/hnplibs/button.h"
36#include "bagel/hodjnpodj/hnplibs/rules.h"
37#include "bagel/hodjnpodj/hnplibs/text.h"
38#include "bagel/hodjnpodj/hnplibs/bitmaps.h"
39
40namespace Bagel {
41namespace HodjNPodj {
42namespace Packrat {
43
44// Button Identifier codes (BIDs)
45#define IDC_OPTION 119
46#define IDC_JUNK 999
47
48// Sound File Identifiers
49
50// Rules File Identifiers
51#define RULESFILE "PACKRAT.TXT"
52#define RULES_WAV "sound\\PACKRAT.WAV"
53
54// Sound files:
55#define GAME_THEME "sound\\PACRAT.MID"
56#define DEAD_WAV "sound\\TAPS.WAV"
57#define DOODAD_WAV "sound\\DOODAD.WAV"
58#define LEVEL_WAV "sound\\APPLAUSE.WAV"
59#define LASTLEV_WAV "sound\\WIN45.WAV"
60// Bitmap Identifiers
61#define OPTSCROLL "ART\\OPTSCRL.BMP"
62
63// Button positioning constants
64#define OPTION_WIDTH 146
65#define OPTION_HEIGHT 23
66#define OPTION_LEFT 246
67#define OPTION_TOP 0
68
70
71// CMainPackRatWindow:
72// See game.cpp for the code to the member functions and the message map.
73//
74
76public:
77 int m_nBadGuySpeed = 0;
78 int m_nPlayerSpeed = 0;
79 int m_nGameLevel = 0;
80 int m_nLives = 0;
81
82private:
83 HWND m_hCallAppWnd = nullptr;
84 LPGAMESTRUCT m_lpGameStruct = nullptr;
85 bool m_bMouseCaptured = false;
86 int *m_anMazeArray = 0;
87 int m_nPDirection = 0;
88 POINT m_ptCurrPLocInGrid = { 0, 0 };
89 POINT m_ptCurrentPPos = { 0, 0 };
90 int m_anBDirection[4] = { 0 };
91 int m_nNumberOfMoves = 0;
92 int m_nBDirection = 0;
93 POINT m_aptCurrBLocInGrid[4] = {
94 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }
95 };
96 POINT m_aptCurrentBPos[4] = {
97 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }
98 };
99 int m_nNumberOfObjectsLeft = 0;
100 long m_lScore = 0;
101 int m_nMaze = 0;
102 int m_nNextDir = 0;
103 bool m_bSuspend = false;
104 CRect MainRect; // screen area spanned by the game window
105 CRect OptionRect; // screen area spanned by the game window
106 CPoint ptBaloon;
107 CPoint ptLastMouseCoord;
108 CPoint ptCurrMouseCoord;
109 CRect rNewGame;
110 CRect ptScore;
111
112public:
113 CMainPackRatWindow(HWND, LPGAMESTRUCT);
114
115 void initStatics();
116 void SplashScreen();
117
118 static void ReleaseResources();
119 static void FlushInputEvents();
120 void MainLoop();
121 void ResetGame();
122 int Power(int, int);
123
124private:
125 void PickUpObject();
126 void PickUpSuperObject();
127 void SetNewPlayerPos();
128 bool SetNewBadGuyPos(int, bool);
129 void SetMaze();
130 void SetLevel();
131 bool PlayerKilled(int);
132 void KillPlayer(bool = false);
133 void KillBadGuy(int, bool = false);
134 void PaintObjects(int = 1);
135 void MoveBadGuys();
136 void MovePlayer();
137 bool CheckMessages();
138 void OnSoundNotify(CSound *pSound);
139
140protected:
141 virtual bool OnCommand(WPARAM wParam, LPARAM lParam) override;
142
143 //{{AFX_MSG( CMainPackRatWindow )
144 afx_msg void OnPaint();
145 afx_msg void OnClose();
146 afx_msg void OnDestroy();
147 afx_msg void OnTimer(uintptr);
148 afx_msg void OnLButtonDown(unsigned int, CPoint);
149 afx_msg void OnLButtonUp(unsigned int, CPoint);
150 afx_msg void OnRButtonDown(unsigned int, CPoint);
151 afx_msg void OnRButtonUp(unsigned int, CPoint);
152 afx_msg void OnMouseMove(unsigned int, CPoint);
153 afx_msg void OnKeyDown(unsigned int, unsigned int, unsigned int);
154 afx_msg void OnSysKeyDown(unsigned int, unsigned int, unsigned int);
155// afx_msg void OnDrawItem( int, LPDRAWITEMSTRUCT );
156 afx_msg bool OnEraseBkgnd(CDC *);
157 afx_msg void OnActivate(unsigned int nState, CWnd *pWndOther, bool bMinimized) override;
158 afx_msg LRESULT OnMCINotify(WPARAM, LPARAM);
159 afx_msg LRESULT OnMMIONotify(WPARAM, LPARAM);
160 //}}AFX_MSG
161
162 DECLARE_MESSAGE_MAP()
163};
164
165} // namespace Packrat
166} // namespace HodjNPodj
167} // namespace Bagel
168
169#endif
Definition: afxwin.h:721
Definition: afxwin.h:1532
Definition: atltypes.h:79
Definition: atltypes.h:131
Definition: afxwin.h:1141
Definition: minwindef.h:161