ScummVM API documentation
bfish.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_BATTLEFISH_BFISH_H
23#define HODJNPODJ_BATTLEFISH_BFISH_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/boflib/sound.h"
31
32namespace Bagel {
33namespace HodjNPodj {
34namespace Battlefish {
35
36#define GRID_ROWS 8
37#define GRID_COLS 8
38#define MAX_FISH 4
39#define MAX_FISH_SIZE 2*3
40
41#define MAX_TURNS MAX_FISH
42
43typedef struct {
44 POINT nLoc[MAX_FISH_SIZE + 1];
45 byte life;
46} FISH;
47
48class CBFishWindow : public CFrameWnd {
49public:
51 void PlayGame();
52 void PaintScreen();
53 void LoadIniSettings();
54 void SaveIniSettings();
55
56protected:
57 void FlushInputEvents();
58 void GameReset();
59 void GamePause();
60 void GameResume();
61 void HandleError(ERROR_CODE);
62 void DeleteSprite(CSprite *);
63 ERROR_CODE RepaintSpriteList(CDC *);
64 ERROR_CODE LoadMasterSprites();
65 void ReleaseMasterSprites();
66 void PlaceUserFish();
67 void PlaceEnemyFish();
68 void RotateFish(int);
69 void AssignFishToGrid(int);
70 int GetEnemyGridIndex(CPoint);
71 int GetUserGridIndex(CPoint);
72 int GetFishIndex(CSprite *);
73 bool OkToPlaceFish(int, CPoint, bool);
74 void PlaceFish(int, CPoint);
75 int IndexToId(int);
76 int IdToIndex(int);
77 CPoint SnapToGrid(CPoint);
78 void UsersTurn(int);
79 void ComputersTurn();
80 int SelectRandomTarget();
81 int SelectBurningTarget();
82 int SelectBestFitTarget();
83 int FindNeighborTarget(int, int);
84 int FindTarget(int, int);
85 int FindMatch(int, int);
86 bool FishFits(int, int, int);
87 int GetNeighbors(int, int);
88 void CreatePlume(CPoint);
89 void CreateHarpoon(CPoint);
90 void SinkUserFish(int);
91 void SinkEnemyFish(int);
92 void PlaceTurnHarpoons();
93 void RemoveTurnHarpoon();
94
95 virtual bool OnCommand(WPARAM wParam, LPARAM lParam) override;
96 LRESULT OnMCINotify(WPARAM, LPARAM);
97 LRESULT OnMMIONotify(WPARAM, LPARAM);
98 void OnSoundNotify(CSound *);
99 void OnPaint();
100 void OnMouseMove(unsigned int, CPoint);
101 void OnRButtonDown(unsigned int, CPoint);
102 void OnLButtonDown(unsigned int, CPoint);
103 void OnLButtonUp(unsigned int, CPoint);
104 void OnSysChar(unsigned int, unsigned int, unsigned int);
105 void OnSysKeyDown(unsigned int, unsigned int, unsigned int);
106 void OnKeyDown(unsigned int, unsigned int, unsigned int);
107 void OnActivate(unsigned int, CWnd *, bool) override;
108 void OnClose();
109
110 DECLARE_MESSAGE_MAP()
111
112 // Data Members
113 //
114 byte m_nUserGrid[GRID_ROWS][GRID_COLS] = {};
115 byte m_nEnemyGrid[GRID_ROWS][GRID_COLS] = {};
116 FISH m_aEnemyFishInfo[MAX_FISH] = {};
117 FISH m_aUserFishInfo[MAX_FISH] = {};
118 CRect m_rNewGameButton;
119 CRect m_rEndPlacement;
120 CPoint m_cLastPoint;
121 CSprite *m_pHarpoons[MAX_TURNS] = {};
122 CSprite *m_pFish[MAX_FISH] = {};
123 CSprite *m_pEnemyFish[MAX_FISH] = {};
124 CSprite *m_pMasterHit = nullptr;
125 CSprite *m_pMasterMiss = nullptr;
126 CSprite *m_pMasterHarpoon = nullptr;
127 CSprite *m_pDragFish = nullptr;
128 CSprite *m_pScrollSprite = nullptr;
129 CSprite *m_pOctopus = nullptr;
130 CPalette *m_pGamePalette = nullptr;
131 CSound *m_pSoundTrack = nullptr;
132 CText *m_pTxtClickHere = nullptr;
133 int m_nEnemyFish = 0;
134 int m_nUserFish = 0;
135 int m_nTurns = 0;
136 int m_nDifficultyLevel = 0;
137 bool m_bGameActive = false;
138 bool m_bPause = false;
139 bool m_bUserEditMode = false;
140 bool m_bMovingFish = false;
141 bool m_bLastRotated = false;
142 bool m_bStillCheck = false;
143 bool m_bUsersTurn = false;
144 bool m_bInMenu = false;
145};
146
147} // namespace Battlefish
148} // namespace HodjNPodj
149} // namespace Bagel
150
151#endif
Definition: sprite.h:41
Definition: text.h:62
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