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 {
77 kActionChangeStepSize,
78 kActionToggleRiseLower,
80 kActionLowerOrFlyDown,
90 kActionIncreaseStepSize,
91 kActionDecreaseStepSize,
93 kActionToggleClipMode,
95 kActionDeployDrillingRig,
96 kActionCollectDrillingRig,
106 kActionSelectPrincess,
118 kFreescapeDebugMove = 1,
119 kFreescapeDebugParser,
121 kFreescapeDebugMedia,
122 kFreescapeDebugGroup,
126 kFreescapeDefaultVolume = 192,
129 enum GameStateControl {
130 kFreescapeGameStateStart,
131 kFreescapeGameStatePlaying,
132 kFreescapeGameStateDemo,
133 kFreescapeGameStateEnd,
134 kFreescapeGameStateRestart,
150 void purgeKeyboardEvents();
151 void purgeMouseEvents();
153 void clearExitEvents();
159 kKeyRepeatInitialDelay = 400,
160 kKeyRepeatSustainDelay = 100
167 uint32 _keyRepeatTime;
177 GameStateControl _gameStateControl;
183 bool isSpaceStationOblivion() {
return _targetName.hasPrefix(
"spacestationoblivion"); }
184 bool isDriller() {
return _targetName.hasPrefix(
"driller") || _targetName.hasPrefix(
"spacestationoblivion"); }
185 bool isDark() {
return _targetName.hasPrefix(
"darkside"); }
186 bool isEclipse() {
return _targetName.hasPrefix(
"totaleclipse"); }
187 bool isEclipse2() {
return _targetName.hasPrefix(
"totaleclipse2"); }
188 bool isCastle() {
return _targetName.hasPrefix(
"castle"); }
189 bool isAmiga() {
return _gameDescription->
platform == Common::kPlatformAmiga; }
190 bool isAtariST() {
return _gameDescription->
platform == Common::kPlatformAtariST; }
191 bool isDOS() {
return _gameDescription->
platform == Common::kPlatformDOS; }
192 bool isSpectrum() {
return _gameDescription->
platform == Common::kPlatformZX; }
193 bool isCPC() {
return _gameDescription->
platform == Common::kPlatformAmstradCPC; }
194 bool isC64() {
return _gameDescription->
platform == Common::kPlatformC64; }
201 void centerCrossair();
203 virtual void borderScreen();
204 virtual void titleScreen();
207 virtual void loadBorder();
208 virtual void processBorder();
209 void waitInLoop(
int maxWait);
212 virtual void drawBackground();
213 void clearBackground();
214 virtual void drawUI();
215 virtual void drawInfoMenu();
234 virtual void loadAssets();
235 virtual void loadAssetsDemo();
236 virtual void loadAssetsFullGame();
238 virtual void loadAssetsAtariFullGame();
239 virtual void loadAssetsAtariDemo();
241 virtual void loadAssetsAmigaFullGame();
242 virtual void loadAssetsAmigaDemo();
244 virtual void loadAssetsDOSFullGame();
245 virtual void loadAssetsDOSDemo();
247 virtual void loadAssetsZXFullGame();
248 virtual void loadAssetsZXDemo();
250 virtual void loadAssetsCPCFullGame();
251 virtual void loadAssetsCPCDemo();
253 virtual void loadAssetsC64FullGame();
254 virtual void loadAssetsC64Demo();
263 void loadDataBundle();
272 void swapPalette(uint16 areaID);
273 virtual byte *findCGAPalette(uint16 levelID);
275 void loadColorPalette();
280 int _currentDemoInputCode;
281 int _currentDemoInputRepetition;
285 int decodeAmigaAtariKey(
int code);
286 int decodeDOSKey(
int code);
323 Math::Vector3d _scale;
325 virtual void gotoArea(uint16 areaID,
int entranceID);
327 uint16 _startEntrance;
333 bool _disableDemoMode;
339 bool _smoothMovement;
353 void generateDemoInput();
354 virtual void pressedKey(
const int keycode);
355 virtual void releasedKey(
const int keycode);
358 void updatePlayerMovement(
float deltaTime);
359 void updatePlayerMovementSmooth(
float deltaTime);
360 void updatePlayerMovementClassic(
float deltaTime);
361 void resolveCollisions(Math::Vector3d newPosition);
362 virtual void checkIfStillInArea();
363 void changePlayerHeight(
int index);
364 void increaseStepSize();
365 void decreaseStepSize();
366 void changeStepSize();
368 void changeAngle(
int offset,
bool wrapAround);
371 bool checkFloor(Math::Vector3d currentPosition);
372 bool tryStepUp(Math::Vector3d currentPosition);
373 bool tryStepDown(Math::Vector3d currentPosition);
375 bool _isCollidingWithWall;
377 bool _isSteppingDown;
379 int _maxFallingDistance;
383 void rotate(
float xoffset,
float yoffset,
float zoffset);
390 void traverseEntrance(uint16 entranceID);
396 int _angleRotationIndex;
399 Math::Vector3d directionToVector(
float pitch,
float heading,
bool useTable);
404 float _mouseSensitivity;
405 Math::Vector3d _upVector;
406 Math::Vector3d _cameraFront, _cameraRight;
408 Math::Vector3d _position, _rotation, _velocity;
409 Math::Vector3d _lastPosition;
410 int _playerHeightNumber;
411 int _playerHeightMaxNumber;
412 uint16 _playerHeight;
415 uint16 _stepUpDistance;
417 int _playerStepIndex;
422 void warpMouseToCrossair(
void);
428 bool runCollisionConditions(Math::Vector3d
const lastPosition, Math::Vector3d
const newPosition);
429 Math::Vector3d _objExecutingCodeSize;
430 bool _executingGlobalCode;
431 virtual void executeMovementConditions();
432 bool executeObjectConditions(
GeometricObject *obj,
bool shot,
bool collided,
bool activated);
433 void executeEntranceConditions(
Entrance *entrance);
434 void executeLocalGlobalConditions(
bool shot,
bool collided,
bool timer);
435 bool executeCode(
FCLInstructionVector &code,
bool shot,
bool collided,
bool timer,
bool activated);
438 bool checkConditional(
FCLInstruction &instruction,
bool shot,
bool collided,
bool timer,
bool activated);
441 void executeExecute(
FCLInstruction &instruction,
bool shot,
bool collided,
bool activated);
473 bool _usePrerecordedSounds;
474 void waitForSounds();
476 bool isPlayingSound();
480 void queueSoundConst(
double hzFreq,
int duration);
481 void playSilence(
int duration,
bool sync);
482 void playSoundConst(
double hzFreq,
int duration,
bool sync);
483 void playSoundSweepIncWL(
double hzFreq1,
double hzFreq2,
double wlStepPerMS,
int resolution,
bool sync);
484 uint16 playSoundDOSSpeaker(uint16 startFrequency,
soundSpeakerFx *speakerFxInfo);
487 virtual void playSoundFx(
int index,
bool sync);
496 int _soundIndexShoot;
497 int _soundIndexCollide;
499 int _soundIndexClimb;
501 int _soundIndexStart;
502 int _soundIndexAreaChange;
505 int _soundIndexNoShield;
506 int _soundIndexNoEnergy;
507 int _soundIndexFallen;
508 int _soundIndexTimeout;
509 int _soundIndexForceEndGame;
510 int _soundIndexCrushed;
511 int _soundIndexMissionComplete;
514 int _screenW, _screenH;
520 int _underFireFrames;
521 int _avoidRenderingFrames;
525 void flashScreen(
int backgroundColor);
527 Math::Vector3d _scaleVector;
528 float _nearClipPlane;
532 void insertTemporaryMessage(
const Common::String &message,
int deadline);
534 void clearTemporalMessages();
554 void loadFonts(byte *font,
int charNumber);
562 virtual void drawStringInSurface(
const Common::String &str,
int x,
int y, uint32 fontColor, uint32 backColor,
Graphics::Surface *surface,
int offset = 0);
563 virtual void drawStringInSurface(
const Common::String &str,
int x,
int y, uint32 primaryFontColor, uint32 secondaryFontColor, uint32 backColor,
Graphics::Surface *surface,
int offset = 0);
567 virtual void initGameState();
568 void setGameBit(
int index);
569 void clearGameBit(
int index);
570 void toggleGameBit(
int index);
571 uint16 getGameBit(
int index);
573 StateVars _gameStateVars;
574 uint32 _gameStateBits;
575 void checkIfPlayerWasCrushed();
576 virtual bool checkIfGameEnded();
577 virtual void endGame();
578 int _endGameDelayTicks;
579 bool _endGameKeyPressed;
580 bool _endGamePlayerEndArea;
582 bool _playerWasCrushed;
585 virtual void checkSensors();
586 virtual void drawSensorShoot(
Sensor *sensor);
587 void takeDamageFromSensor();
599 void pauseEngineIntern(
bool pause)
override;
602 bool startCountdown(uint32 delay);
605 int _initialCountdown;
612 void getTimeFromCountdown(
int &seconds,
int &minutes,
int &hours);
613 virtual void updateTimeVariables();
616 bool _useExtendedTimer;
617 bool _disableSensors;
618 bool _disableFalling;
624 byte *decompressC64RLE(byte *buffer,
int *size, byte marker);
628 enum GameReleaseFlags {
629 GF_AMIGA_RETAIL = (1 << 0),
630 GF_AMIGA_BUDGET = (1 << 1),
631 GF_ZX_RETAIL = (1 << 2),
632 GF_ZX_BUDGET = (1 << 3),
633 GF_ZX_DISC = (1 << 4),
634 GF_CPC_RETAIL = (1 << 5),
635 GF_CPC_RETAIL_ALT = (1 << 6),
636 GF_CPC_BUDGET = (1 << 7),
637 GF_CPC_VIRTUALWORLDS = (1 << 8),
638 GF_ATARI_RETAIL = (1 << 9),
639 GF_ATARI_BUDGET = (1 << 10),
640 GF_C64_TAPE = (1 << 11),
641 GF_C64_DISC = (1 << 12),
648 #endif // FREESCAPE_H Definition: geometricobject.h:34
Definition: managed_surface.h:51
Definition: framelimiter.h:40
EngineFeature
Definition: engine.h:260
bool canSaveAutosaveCurrently() override
Definition: freescape.h:591
Definition: freescape.h:145
Definition: advancedDetector.h:164
RenderMode
Definition: rendermode.h:48
uint32 CustomEventType
Definition: events.h:204
Definition: archive.h:141
Definition: freescape.h:170
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: freescape.h:592
Definition: algorithm.h:29
Definition: entrance.h:34
Definition: keyboard.h:294
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: freescape.h:590
Definition: instruction.h:36
Definition: freescape.h:137
Common::Platform platform
Definition: advancedDetector.h:199
Language
Definition: language.h:45