ScummVM API documentation
dragon_arcade.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 DGDS_MINIGAMES_DRAGON_ARCADE_H
23#define DGDS_MINIGAMES_DRAGON_ARCADE_H
24
25#include "common/types.h"
26#include "engines/dgds/minigames/dragon_arcade_ttm.h"
27
28namespace Dgds {
29
30enum DragonBulletState {
31 kBulletInactive = 0,
32 kBulletFlying = 1,
33 kBulletHittingBlade = 2,
34 kBulletHittingEnemy = 3,
35};
36
37enum DragonBladeMoveFlag {
38 kBladeMoveNone = 0,
39 kBladeMoveUp = 1,
40 kBladeMoveDown = 2,
41 kBladeMoveRight = 4,
42 kBladeMoveLeft = 8,
43};
44
46public:
47 ArcadeNPCState() : xx(0), yy(0), x(0), y(0), x_11(0), y_11(0), x_12(0), y_12(0),
48 ttmPage(0), byte12(0), byte13(0), health(0), ttmNum(0), x_21(0), y_21(0),
49 x_22(0), y_22(0) {}
50 int16 xx;
51 int16 yy;
52 int16 x;
53 int16 y;
54 int16 x_11;
55 int16 y_11;
56 int16 x_12;
57 int16 y_12;
58 int16 ttmPage;
59 int8 byte12;
60 int8 byte13;
61 int8 health;
62 int8 ttmNum; /* Set to 0, 1 or 2 */
63 int16 x_21;
64 int16 y_21;
65 int16 x_22;
66 int16 y_22;
67};
68
70public:
71 DragonArcadeBullet() : _x(0), _y(0), _state(kBulletInactive),
72 _flipMode(kImageFlipNone), _bulletType(0), _ySpeed(0) {}
73
74 int16 _x;
75 int16 _y;
76 DragonBulletState _state;
77 ImageFlipMode _flipMode;
78 int16 _bulletType;
79 uint16 _ySpeed;
80 // these fields are in the original but seem to not be used.
81 // int16 _var2;
82 // int16 _var3;
83};
84
86public:
88
89 void arcadeTick();
90 void onKeyDown(Common::KeyState kbd);
91 void onKeyUp(Common::KeyState kbd);
92
93private:
94 void initIfNeeded();
95 void drawBackgroundAndWeapons();
96 void checkToOpenMenu();
97 void clearAllBulletStates();
98 void clearAllNPCStates();
99 void createBullet(int16 x, int16 y, ImageFlipMode flipMode, int16 bulletType);
100 void bladeTakeHitAndCheck();
101 void enemyTakeHit() { _npcState[1].health--; }
102 void enemyTakeHitAndCheck();
103 void playSfx(int16 num) const;
104 void drawBulletHitCircles(uint16 x, uint16 y, bool colorFlag);
105 void drawHealthBars();
106 void runThenDrawBulletsInFlight();
107 void redraw();
108 void finish();
109 void loadTTMScriptsForStage(uint16 stage);
110 void fadeInAndClearScreen();
111 bool doTickUpdate();
112 void resetStageState();
113 void initValuesForStage();
114 void initValuesForStage0();
115 void initValuesForStage2();
116 void initValuesForStage3();
117 void initValuesForStage4();
118 void initValuesForStage6();
119 void setFinishCountdownIfLessThan0(int16 val);
120 void updateBladeWithInputs();
121 void updateBlade();
122 void updateBoss();
123 void updateBoss2();
124 void decBossHealth();
125 void decBossHealthAndCheck();
126 void bladeTakeHit();
127 void arcade16bc();
128 void arcade16de(int16 param);
129 void arcade1e83();
130 void arcade2445();
131 void arcade2754(int16 findResult);
132 void arcade34b4();
133 void arcade3e96();
134 void arcade4085();
135 void updateXScrollOffset();
136 bool isNpcInsideXRange(int16 num);
137 void updateBullets();
138 void checkBladeFireAllStages();
139 void checkEnemyFireStage0124();
140 void checkBossFireStage3();
141 void checkBossFireStage6();
142 void updateMouseAndJoystickStates();
143 int16 findFloorUnderBlade();
144 int16 checkBulletCollision(int16 num);
145 void mouseUpdate();
146 void keyboardUpdate();
147 void limitToCenterOfScreenAndUpdateCursor();
148 uint16 moveToNextStage();
149 void findFloorMatch();
150 void findFloorMinGT();
151 void findFloorMinGE();
152 void findFloorMatchOrMinOrMax();
153 void findFloorMax();
154 void updateFloorsUnderBlade();
155 bool isFloorNotFound();
156 void playSFX55AndStuff();
157 void moveBladeX();
158 void handleMouseStates();
159 void drawScrollBmp();
160
161 int16 _lastDrawnBladeHealth;
162 int16 _lastDrawnBossHealth;
163 uint16 _nextRandomVal;
164 int16 _loadedArcadeStage;
165 int16 _nextStage;
166 int16 _attemptCounter;
167 int16 _shouldUpdateState;
168 int16 _finishCountdown;
169 int16 _bladeState1;
170 int16 _bladePageOffset;
171 uint16 _mouseButtonWentDown;
172 int16 _scrollXOffset;
173 int32 _nTickUpdates;
174 int16 _startDifficultyMaybe;
175 int16 _bossStateUpdateCounter;
176 int16 _npcStateResetCounter;
177 int16 _scrollVelocityX;
178 uint16 _uint0a17;
179 int16 _currentYOffset;
180 int16 _int0b58;
181 int16 _int0b5a;
182 int16 _int0b60;
183 int16 _ttmYAdjust;
184 uint16 _uint0be6;
185 bool _dontMoveBladeFlag;
186 int16 _scrollXIncrement;
187 bool _lMouseButtonState;
188 bool _rMouseButtonState;
189 bool _lastLMouseButtonState;
190 bool _lastRMouseButtonState;
191 int16 _bladeXMove;
192 int16 _currentArrowNum;
193 int16 _foundFloorY;
194 bool _foundFloorFlag;
195 int16 _lastFloorY;
196
197 bool _haveBigGun;
198 bool _haveBomb;
199 bool _enemyHasSmallGun;
200 bool _dontRedrawBgndAndWeapons;
201 // maybe don't need these
202 //bool _arcadeNeedsBufferCopy;
203 //bool _flagInventoryOpened;
204 bool _initFinished;
205 bool _stillLoadingScriptsMaybe;
206 bool _flag40ee;
207 bool _flag40ef;
208 int16 _someMoveDirection;
209 bool _bladeHasFired;
210 bool _mouseIsAvailable;
211 bool _isMovingStage;
212 DragonBladeMoveFlag _bladeMoveFlag;
213 DragonBladeMoveFlag _keyStateFlags;
214 DragonBladeMoveFlag _bladeMoveFlagBeforeRButton;
215 DragonBladeMoveFlag _bladeHorizMoveAttempt;
216 DragonArcadeBullet _bullets[20];
217 ArcadeNPCState _npcState[20];
218 Common::SharedPtr<Image> _bulletImg;
219 Common::SharedPtr<Image> _arrowImg;
220 Common::SharedPtr<Image> _scrollImg;
221 DragonArcadeTTM _arcadeTTM;
222 Common::Array<int16> _floorY;
223 Common::Array<bool> _floorFlag;
224};
225
226} // end namespace Dgds
227
228#endif // DGDS_MINIGAMES_DRAGON_ARCADE_H
Definition: ptr.h:159
Definition: dragon_arcade.h:45
Definition: dragon_arcade.h:69
Definition: dragon_arcade.h:85
Definition: dragon_arcade_ttm.h:75
Definition: keyboard.h:294