25 #include "common/bitarray.h" 26 #include "common/events.h" 27 #include "common/file.h" 28 #include "common/memstream.h" 29 #include "engines/advancedDetector.h" 30 #include "graphics/managed_surface.h" 31 #include "graphics/surface.h" 35 #include "audio/mixer.h" 36 #include "audio/softsynth/pcspk.h" 37 #include "graphics/framelimiter.h" 39 #include "freescape/area.h" 40 #include "freescape/font.h" 41 #include "freescape/gfx.h" 42 #include "freescape/objects/entrance.h" 43 #include "freescape/objects/geometricobject.h" 44 #include "freescape/objects/sensor.h" 45 #include "freescape/sound.h" 55 #define FREESCAPE_DATA_BUNDLE "freescape.dat" 64 enum FreescapeAction {
78 kActionChangeStepSize,
79 kActionToggleRiseLower,
81 kActionLowerOrFlyDown,
91 kActionIncreaseStepSize,
92 kActionDecreaseStepSize,
94 kActionToggleClipMode,
96 kActionDeployDrillingRig,
97 kActionCollectDrillingRig,
107 kActionSelectPrincess,
119 kFreescapeDebugMove = 1,
120 kFreescapeDebugParser,
122 kFreescapeDebugMedia,
123 kFreescapeDebugGroup,
127 kFreescapeDefaultVolume = 192,
130 enum GameStateControl {
131 kFreescapeGameStateStart,
132 kFreescapeGameStatePlaying,
133 kFreescapeGameStateDemo,
134 kFreescapeGameStateEnd,
135 kFreescapeGameStateRestart,
151 void purgeKeyboardEvents();
152 void purgeMouseEvents();
154 void clearExitEvents();
161 kKeyRepeatInitialDelay = 400,
162 kKeyRepeatSustainDelay = 100
169 uint32 _keyRepeatTime;
179 GameStateControl _gameStateControl;
185 bool isSpaceStationOblivion() {
return _targetName.hasPrefix(
"spacestationoblivion"); }
186 bool isDriller() {
return _targetName.hasPrefix(
"driller") || _targetName.hasPrefix(
"spacestationoblivion"); }
187 bool isDark() {
return _targetName.hasPrefix(
"darkside"); }
188 bool isEclipse() {
return _targetName.hasPrefix(
"totaleclipse"); }
189 bool isEclipse2() {
return _targetName.hasPrefix(
"totaleclipse2"); }
190 bool isCastle() {
return _targetName.hasPrefix(
"castle"); }
191 bool isAmiga() {
return _gameDescription->
platform == Common::kPlatformAmiga; }
192 bool isAtariST() {
return _gameDescription->
platform == Common::kPlatformAtariST; }
193 bool isDOS() {
return _gameDescription->
platform == Common::kPlatformDOS; }
194 bool isSpectrum() {
return _gameDescription->
platform == Common::kPlatformZX; }
195 bool isCPC() {
return _gameDescription->
platform == Common::kPlatformAmstradCPC; }
196 bool isC64() {
return _gameDescription->
platform == Common::kPlatformC64; }
198 virtual void beforeStarting();
204 void centerCrossair();
206 virtual void borderScreen();
207 virtual void titleScreen();
210 virtual void loadBorder();
211 virtual void processBorder();
212 void waitInLoop(
int maxWait);
215 virtual void drawBackground();
216 void clearBackground();
217 virtual void drawUI();
218 virtual void drawInfoMenu();
237 virtual void loadAssets();
238 virtual void loadAssetsDemo();
239 virtual void loadAssetsFullGame();
241 virtual void loadAssetsAtariFullGame();
242 virtual void loadAssetsAtariDemo();
244 virtual void loadAssetsAmigaFullGame();
245 virtual void loadAssetsAmigaDemo();
247 virtual void loadAssetsDOSFullGame();
248 virtual void loadAssetsDOSDemo();
250 virtual void loadAssetsZXFullGame();
251 virtual void loadAssetsZXDemo();
253 virtual void loadAssetsCPCFullGame();
254 virtual void loadAssetsCPCDemo();
256 virtual void loadAssetsC64FullGame();
257 virtual void loadAssetsC64Demo();
266 void loadDataBundle();
275 void swapPalette(uint16 areaID);
276 virtual byte *findCGAPalette(uint16 levelID);
278 void loadColorPalette();
283 int _currentDemoInputCode;
284 int _currentDemoInputRepetition;
288 int decodeAmigaAtariKey(
int code);
289 int decodeDOSKey(
int code);
326 Math::Vector3d _scale;
328 virtual void gotoArea(uint16 areaID,
int entranceID);
330 uint16 _startEntrance;
336 bool _disableDemoMode;
342 bool _smoothMovement;
356 void generateDemoInput();
357 virtual void pressedKey(
const int keycode);
358 virtual void releasedKey(
const int keycode);
361 void updatePlayerMovement(
float deltaTime);
362 void updatePlayerMovementSmooth(
float deltaTime);
363 void updatePlayerMovementClassic(
float deltaTime);
364 void resolveCollisions(Math::Vector3d newPosition);
365 virtual void checkIfStillInArea();
366 void changePlayerHeight(
int index);
367 void increaseStepSize();
368 void decreaseStepSize();
369 void changeStepSize();
371 void changeAngle(
int offset,
bool wrapAround);
374 bool checkFloor(Math::Vector3d currentPosition);
375 bool tryStepUp(Math::Vector3d currentPosition);
376 bool tryStepDown(Math::Vector3d currentPosition);
378 bool _isCollidingWithWall;
380 bool _isSteppingDown;
382 int _maxFallingDistance;
386 void rotate(
float xoffset,
float yoffset,
float zoffset);
393 void traverseEntrance(uint16 entranceID);
399 int _angleRotationIndex;
402 Math::Vector3d directionToVector(
float pitch,
float heading,
bool useTable);
407 float _mouseSensitivity;
408 Math::Vector3d _upVector;
409 Math::Vector3d _cameraFront, _cameraRight;
411 Math::Vector3d _position, _rotation, _velocity;
412 Math::Vector3d _lastPosition;
413 int _playerHeightNumber;
414 int _playerHeightMaxNumber;
415 uint16 _playerHeight;
418 uint16 _stepUpDistance;
420 int _playerStepIndex;
425 void warpMouseToCrossair(
void);
431 bool runCollisionConditions(Math::Vector3d
const lastPosition, Math::Vector3d
const newPosition);
432 Math::Vector3d _objExecutingCodeSize;
433 bool _executingGlobalCode;
434 virtual void executeMovementConditions();
435 bool executeObjectConditions(
GeometricObject *obj,
bool shot,
bool collided,
bool activated);
436 void executeEntranceConditions(
Entrance *entrance);
437 void executeLocalGlobalConditions(
bool shot,
bool collided,
bool timer);
438 bool executeCode(
FCLInstructionVector &code,
bool shot,
bool collided,
bool timer,
bool activated);
441 bool checkConditional(
FCLInstruction &instruction,
bool shot,
bool collided,
bool timer,
bool activated);
476 bool _usePrerecordedSounds;
477 void waitForSounds();
479 bool isPlayingSound();
483 void queueSoundConst(
double hzFreq,
int duration);
484 void playSilence(
int duration,
bool sync);
485 void playSoundConst(
double hzFreq,
int duration,
bool sync);
486 void playSoundSweepIncWL(
double hzFreq1,
double hzFreq2,
double wlStepPerMS,
int resolution,
bool sync);
487 uint16 playSoundDOSSpeaker(uint16 startFrequency,
soundSpeakerFx *speakerFxInfo);
490 virtual void playSoundFx(
int index,
bool sync);
499 int _soundIndexShoot;
500 int _soundIndexCollide;
501 int _soundIndexStepDown;
502 int _soundIndexStepUp;
505 int _soundIndexStart;
506 int _soundIndexAreaChange;
509 int _soundIndexNoShield;
510 int _soundIndexNoEnergy;
511 int _soundIndexFallen;
512 int _soundIndexTimeout;
513 int _soundIndexForceEndGame;
514 int _soundIndexCrushed;
515 int _soundIndexMissionComplete;
518 int _screenW, _screenH;
524 int _underFireFrames;
525 int _avoidRenderingFrames;
529 void flashScreen(
int backgroundColor);
531 Math::Vector3d _scaleVector;
532 float _nearClipPlane;
536 void insertTemporaryMessage(
const Common::String &message,
int deadline);
538 void clearTemporalMessages();
558 void loadFonts(byte *font,
int charNumber);
566 virtual void drawStringInSurface(
const Common::String &str,
int x,
int y, uint32 fontColor, uint32 backColor,
Graphics::Surface *surface,
int offset = 0);
567 virtual void drawStringInSurface(
const Common::String &str,
int x,
int y, uint32 primaryFontColor, uint32 secondaryFontColor, uint32 backColor,
Graphics::Surface *surface,
int offset = 0);
571 virtual void initGameState();
572 void setGameBit(
int index);
573 void clearGameBit(
int index);
574 void toggleGameBit(
int index);
575 uint16 getGameBit(
int index);
577 StateVars _gameStateVars;
578 uint32 _gameStateBits;
579 void checkIfPlayerWasCrushed();
580 virtual bool checkIfGameEnded();
581 virtual void endGame();
582 int _endGameDelayTicks;
583 bool _endGameKeyPressed;
584 bool _endGamePlayerEndArea;
586 bool _playerWasCrushed;
589 virtual void checkSensors();
590 virtual void drawSensorShoot(
Sensor *sensor);
591 void takeDamageFromSensor();
603 void pauseEngineIntern(
bool pause)
override;
606 bool startCountdown(uint32 delay);
609 int _initialCountdown;
616 void getTimeFromCountdown(
int &seconds,
int &minutes,
int &hours);
617 virtual void updateTimeVariables();
620 bool _useExtendedTimer;
621 bool _disableSensors;
622 bool _disableFalling;
628 byte *decompressC64RLE(byte *buffer,
int *size, byte marker);
632 enum GameReleaseFlags {
633 GF_AMIGA_RETAIL = (1 << 0),
634 GF_AMIGA_BUDGET = (1 << 1),
635 GF_ZX_RETAIL = (1 << 2),
636 GF_ZX_BUDGET = (1 << 3),
637 GF_ZX_DISC = (1 << 4),
638 GF_CPC_RETAIL = (1 << 5),
639 GF_CPC_RETAIL_ALT = (1 << 6),
640 GF_CPC_BUDGET = (1 << 7),
641 GF_CPC_VIRTUALWORLDS = (1 << 8),
642 GF_ATARI_RETAIL = (1 << 9),
643 GF_ATARI_BUDGET = (1 << 10),
644 GF_C64_TAPE = (1 << 11),
645 GF_C64_DISC = (1 << 12),
652 #endif // FREESCAPE_H Definition: geometricobject.h:34
Definition: managed_surface.h:51
Definition: framelimiter.h:40
EngineFeature
Definition: engine.h:258
bool canSaveAutosaveCurrently() override
Definition: freescape.h:595
Definition: freescape.h:146
Definition: advancedDetector.h:164
RenderMode
Definition: rendermode.h:48
uint32 CustomEventType
Definition: events.h:204
Definition: archive.h:141
Definition: freescape.h:172
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: freescape.h:596
Definition: algorithm.h:29
Definition: entrance.h:34
Definition: keyboard.h:294
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: freescape.h:594
Definition: instruction.h:36
Definition: freescape.h:138
Common::Platform platform
Definition: advancedDetector.h:199
Language
Definition: language.h:45