25 #include "common/bitarray.h" 26 #include "common/events.h" 27 #include "engines/advancedDetector.h" 28 #include "graphics/managed_surface.h" 29 #include "graphics/surface.h" 32 #include "audio/mixer.h" 33 #include "audio/softsynth/pcspk.h" 34 #include "graphics/framelimiter.h" 36 #include "freescape/area.h" 37 #include "freescape/font.h" 38 #include "freescape/gfx.h" 39 #include "freescape/objects/entrance.h" 40 #include "freescape/objects/geometricobject.h" 41 #include "freescape/objects/sensor.h" 42 #include "freescape/sound.h" 52 #define FREESCAPE_DATA_BUNDLE "freescape.dat" 61 enum FreescapeAction {
73 kActionChangeStepSize,
74 kActionToggleRiseLower,
76 kActionLowerOrFlyDown,
86 kActionIncreaseStepSize,
87 kActionDecreaseStepSize,
89 kActionToggleClipMode,
91 kActionDeployDrillingRig,
92 kActionCollectDrillingRig,
100 kActionSelectPrincess,
108 kFreescapeDebugMove = 1 << 0,
109 kFreescapeDebugParser = 1 << 1,
110 kFreescapeDebugCode = 1 << 2,
111 kFreescapeDebugMedia = 1 << 4,
112 kFreescapeDebugGroup = 1 << 5,
115 enum GameStateControl {
116 kFreescapeGameStateStart,
117 kFreescapeGameStatePlaying,
118 kFreescapeGameStateDemo,
119 kFreescapeGameStateEnd,
120 kFreescapeGameStateRestart,
133 void purgeKeyboardEvents();
134 void purgeMouseEvents();
136 void clearExitEvents();
141 kKeyRepeatInitialDelay = 400,
142 kKeyRepeatSustainDelay = 100
149 uint32 _keyRepeatTime;
159 GameStateControl _gameStateControl;
165 bool isSpaceStationOblivion() {
return _targetName.hasPrefix(
"spacestationoblivion"); }
166 bool isDriller() {
return _targetName.hasPrefix(
"driller") || _targetName.hasPrefix(
"spacestationoblivion"); }
167 bool isDark() {
return _targetName.hasPrefix(
"darkside"); }
168 bool isEclipse() {
return _targetName.hasPrefix(
"totaleclipse"); }
169 bool isEclipse2() {
return _targetName.hasPrefix(
"totaleclipse2"); }
170 bool isCastle() {
return _targetName.hasPrefix(
"castle"); }
171 bool isAmiga() {
return _gameDescription->
platform == Common::kPlatformAmiga; }
172 bool isAtariST() {
return _gameDescription->
platform == Common::kPlatformAtariST; }
173 bool isDOS() {
return _gameDescription->
platform == Common::kPlatformDOS; }
174 bool isSpectrum() {
return _gameDescription->
platform == Common::kPlatformZX; }
175 bool isCPC() {
return _gameDescription->
platform == Common::kPlatformAmstradCPC; }
176 bool isC64() {
return _gameDescription->
platform == Common::kPlatformC64; }
183 void centerCrossair();
185 virtual void borderScreen();
186 virtual void titleScreen();
189 virtual void loadBorder();
190 virtual void processBorder();
191 void waitInLoop(
int maxWait);
194 virtual void drawBackground();
195 void clearBackground();
196 virtual void drawUI();
197 virtual void drawInfoMenu();
216 virtual void loadAssets();
217 virtual void loadAssetsDemo();
218 virtual void loadAssetsFullGame();
220 virtual void loadAssetsAtariFullGame();
221 virtual void loadAssetsAtariDemo();
223 virtual void loadAssetsAmigaFullGame();
224 virtual void loadAssetsAmigaDemo();
226 virtual void loadAssetsDOSFullGame();
227 virtual void loadAssetsDOSDemo();
229 virtual void loadAssetsZXFullGame();
230 virtual void loadAssetsZXDemo();
232 virtual void loadAssetsCPCFullGame();
233 virtual void loadAssetsCPCDemo();
235 virtual void loadAssetsC64FullGame();
236 virtual void loadAssetsC64Demo();
245 void loadDataBundle();
252 void swapPalette(uint16 areaID);
253 virtual byte *findCGAPalette(uint16 levelID);
256 void loadColorPalette();
261 int _currentDemoInputCode;
262 int _currentDemoInputRepetition;
266 int decodeAmigaAtariKey(
int code);
267 int decodeDOSKey(
int code);
304 Math::Vector3d _scale;
306 virtual void gotoArea(uint16 areaID,
int entranceID);
308 uint16 _startEntrance;
314 bool _disableDemoMode;
323 void generateDemoInput();
324 virtual void pressedKey(
const int keycode);
325 virtual void releasedKey(
const int keycode);
328 void move(CameraMovement direction, uint8
scale,
float deltaTime);
329 void resolveCollisions(Math::Vector3d newPosition);
330 virtual void checkIfStillInArea();
331 void changePlayerHeight(
int index);
332 void increaseStepSize();
333 void decreaseStepSize();
334 void changeStepSize();
339 bool checkFloor(Math::Vector3d currentPosition);
340 bool tryStepUp(Math::Vector3d currentPosition);
341 bool tryStepDown(Math::Vector3d currentPosition);
343 int _maxFallingDistance;
347 void rotate(
float xoffset,
float yoffset);
354 void traverseEntrance(uint16 entranceID);
359 int _angleRotationIndex;
362 Math::Vector3d directionToVector(
float pitch,
float heading,
bool useTable);
367 float _mouseSensitivity;
368 Math::Vector3d _upVector;
369 Math::Vector3d _cameraFront, _cameraRight;
371 Math::Vector3d _position, _rotation, _velocity;
372 Math::Vector3d _lastPosition;
373 int _playerHeightNumber;
374 int _playerHeightMaxNumber;
375 uint16 _playerHeight;
378 uint16 _stepUpDistance;
380 int _playerStepIndex;
387 bool runCollisionConditions(Math::Vector3d
const lastPosition, Math::Vector3d
const newPosition);
388 Math::Vector3d _objExecutingCodeSize;
389 bool _executingGlobalCode;
390 virtual void executeMovementConditions();
391 bool executeObjectConditions(
GeometricObject *obj,
bool shot,
bool collided,
bool activated);
392 void executeEntranceConditions(
Entrance *entrance);
393 void executeLocalGlobalConditions(
bool shot,
bool collided,
bool timer);
394 bool executeCode(
FCLInstructionVector &code,
bool shot,
bool collided,
bool timer,
bool activated);
397 bool checkConditional(
FCLInstruction &instruction,
bool shot,
bool collided,
bool timer,
bool activated);
400 void executeExecute(
FCLInstruction &instruction,
bool shot,
bool collided,
bool activated);
431 bool _usePrerecordedSounds;
432 void waitForSounds();
433 void stopAllSounds();
434 bool isPlayingSound();
435 void playSound(
int index,
bool sync);
438 void queueSoundConst(
double hzFreq,
int duration);
439 void playSilence(
int duration,
bool sync);
440 void playSoundConst(
double hzFreq,
int duration,
bool sync);
441 void playSoundSweepIncWL(
double hzFreq1,
double hzFreq2,
double wlStepPerMS,
int resolution,
bool sync);
442 uint16 playSoundDOSSpeaker(uint16 startFrequency,
soundSpeakerFx *speakerFxInfo);
445 virtual void playSoundFx(
int index,
bool sync);
454 int _soundIndexShoot;
455 int _soundIndexCollide;
457 int _soundIndexClimb;
459 int _soundIndexStart;
460 int _soundIndexAreaChange;
463 int _soundIndexNoShield;
464 int _soundIndexNoEnergy;
465 int _soundIndexFallen;
466 int _soundIndexTimeout;
467 int _soundIndexForceEndGame;
468 int _soundIndexCrushed;
469 int _soundIndexMissionComplete;
472 int _screenW, _screenH;
478 int _underFireFrames;
479 int _avoidRenderingFrames;
483 void flashScreen(
int backgroundColor);
485 Math::Vector3d _scaleVector;
486 float _nearClipPlane;
490 void insertTemporaryMessage(
const Common::String message,
int deadline);
492 void clearTemporalMessages();
512 void loadFonts(byte *font,
int charNumber);
520 virtual void drawStringInSurface(
const Common::String &str,
int x,
int y, uint32 fontColor, uint32 backColor,
Graphics::Surface *surface,
int offset = 0);
521 virtual void drawStringInSurface(
const Common::String &str,
int x,
int y, uint32 primaryFontColor, uint32 secondaryFontColor, uint32 backColor,
Graphics::Surface *surface,
int offset = 0);
525 virtual void initGameState();
526 void setGameBit(
int index);
527 void clearGameBit(
int index);
528 void toggleGameBit(
int index);
529 uint16 getGameBit(
int index);
531 StateVars _gameStateVars;
532 uint32 _gameStateBits;
533 void checkIfPlayerWasCrushed();
534 virtual bool checkIfGameEnded();
535 virtual void endGame();
536 int _endGameDelayTicks;
537 bool _endGameKeyPressed;
538 bool _endGamePlayerEndArea;
540 bool _playerWasCrushed;
543 virtual void checkSensors();
544 virtual void drawSensorShoot(
Sensor *sensor);
545 void takeDamageFromSensor();
557 void pauseEngineIntern(
bool pause)
override;
560 bool startCountdown(uint32 delay);
563 int _initialCountdown;
570 void getTimeFromCountdown(
int &seconds,
int &minutes,
int &hours);
571 virtual void updateTimeVariables();
574 bool _useExtendedTimer;
575 bool _disableSensors;
576 bool _disableFalling;
582 enum GameReleaseFlags {
583 GF_AMIGA_RETAIL = (1 << 0),
584 GF_AMIGA_BUDGET = (1 << 1),
585 GF_ZX_RETAIL = (1 << 2),
586 GF_ZX_BUDGET = (1 << 3),
587 GF_ZX_DISC = (1 << 4),
588 GF_CPC_RETAIL = (1 << 5),
589 GF_CPC_RETAIL_ALT = (1 << 6),
590 GF_CPC_BUDGET = (1 << 7),
591 GF_CPC_VIRTUALWORLDS = (1 << 8),
592 GF_ATARI_RETAIL = (1 << 9),
593 GF_ATARI_BUDGET = (1 << 10)
600 #endif // FREESCAPE_H Definition: geometricobject.h:34
Definition: managed_surface.h:51
Definition: framelimiter.h:37
EngineFeature
Definition: engine.h:253
bool canSaveAutosaveCurrently() override
Definition: freescape.h:549
Definition: freescape.h:128
Definition: advancedDetector.h:163
RenderMode
Definition: rendermode.h:48
uint32 CustomEventType
Definition: events.h:193
Definition: archive.h:141
Definition: freescape.h:152
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: freescape.h:550
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
Definition: algorithm.h:29
Definition: entrance.h:34
Out move(In first, In last, Out dst)
Definition: algorithm.h:109
Definition: keyboard.h:294
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: freescape.h:548
Definition: instruction.h:36
Definition: freescape.h:123
Common::Platform platform
Definition: advancedDetector.h:198
Language
Definition: language.h:45