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,
109 kFreescapeDebugMove = 1,
110 kFreescapeDebugParser,
112 kFreescapeDebugMedia,
113 kFreescapeDebugGroup,
117 kFreescapeDefaultVolume = 192,
120 enum GameStateControl {
121 kFreescapeGameStateStart,
122 kFreescapeGameStatePlaying,
123 kFreescapeGameStateDemo,
124 kFreescapeGameStateEnd,
125 kFreescapeGameStateRestart,
140 void purgeKeyboardEvents();
141 void purgeMouseEvents();
143 void clearExitEvents();
148 kKeyRepeatInitialDelay = 400,
149 kKeyRepeatSustainDelay = 100
156 uint32 _keyRepeatTime;
166 GameStateControl _gameStateControl;
172 bool isSpaceStationOblivion() {
return _targetName.hasPrefix(
"spacestationoblivion"); }
173 bool isDriller() {
return _targetName.hasPrefix(
"driller") || _targetName.hasPrefix(
"spacestationoblivion"); }
174 bool isDark() {
return _targetName.hasPrefix(
"darkside"); }
175 bool isEclipse() {
return _targetName.hasPrefix(
"totaleclipse"); }
176 bool isEclipse2() {
return _targetName.hasPrefix(
"totaleclipse2"); }
177 bool isCastle() {
return _targetName.hasPrefix(
"castle"); }
178 bool isAmiga() {
return _gameDescription->
platform == Common::kPlatformAmiga; }
179 bool isAtariST() {
return _gameDescription->
platform == Common::kPlatformAtariST; }
180 bool isDOS() {
return _gameDescription->
platform == Common::kPlatformDOS; }
181 bool isSpectrum() {
return _gameDescription->
platform == Common::kPlatformZX; }
182 bool isCPC() {
return _gameDescription->
platform == Common::kPlatformAmstradCPC; }
183 bool isC64() {
return _gameDescription->
platform == Common::kPlatformC64; }
190 void centerCrossair();
192 virtual void borderScreen();
193 virtual void titleScreen();
196 virtual void loadBorder();
197 virtual void processBorder();
198 void waitInLoop(
int maxWait);
201 virtual void drawBackground();
202 void clearBackground();
203 virtual void drawUI();
204 virtual void drawInfoMenu();
223 virtual void loadAssets();
224 virtual void loadAssetsDemo();
225 virtual void loadAssetsFullGame();
227 virtual void loadAssetsAtariFullGame();
228 virtual void loadAssetsAtariDemo();
230 virtual void loadAssetsAmigaFullGame();
231 virtual void loadAssetsAmigaDemo();
233 virtual void loadAssetsDOSFullGame();
234 virtual void loadAssetsDOSDemo();
236 virtual void loadAssetsZXFullGame();
237 virtual void loadAssetsZXDemo();
239 virtual void loadAssetsCPCFullGame();
240 virtual void loadAssetsCPCDemo();
242 virtual void loadAssetsC64FullGame();
243 virtual void loadAssetsC64Demo();
252 void loadDataBundle();
261 void swapPalette(uint16 areaID);
262 virtual byte *findCGAPalette(uint16 levelID);
264 void loadColorPalette();
269 int _currentDemoInputCode;
270 int _currentDemoInputRepetition;
274 int decodeAmigaAtariKey(
int code);
275 int decodeDOSKey(
int code);
312 Math::Vector3d _scale;
314 virtual void gotoArea(uint16 areaID,
int entranceID);
316 uint16 _startEntrance;
322 bool _disableDemoMode;
331 void generateDemoInput();
332 virtual void pressedKey(
const int keycode);
333 virtual void releasedKey(
const int keycode);
336 void move(CameraMovement direction, uint8
scale,
float deltaTime);
337 void resolveCollisions(Math::Vector3d newPosition);
338 virtual void checkIfStillInArea();
339 void changePlayerHeight(
int index);
340 void increaseStepSize();
341 void decreaseStepSize();
342 void changeStepSize();
347 bool checkFloor(Math::Vector3d currentPosition);
348 bool tryStepUp(Math::Vector3d currentPosition);
349 bool tryStepDown(Math::Vector3d currentPosition);
351 int _maxFallingDistance;
355 void rotate(
float xoffset,
float yoffset);
362 void traverseEntrance(uint16 entranceID);
367 int _angleRotationIndex;
370 Math::Vector3d directionToVector(
float pitch,
float heading,
bool useTable);
375 float _mouseSensitivity;
376 Math::Vector3d _upVector;
377 Math::Vector3d _cameraFront, _cameraRight;
379 Math::Vector3d _position, _rotation, _velocity;
380 Math::Vector3d _lastPosition;
381 int _playerHeightNumber;
382 int _playerHeightMaxNumber;
383 uint16 _playerHeight;
386 uint16 _stepUpDistance;
388 int _playerStepIndex;
393 void warpMouseToCrossair(
void);
399 bool runCollisionConditions(Math::Vector3d
const lastPosition, Math::Vector3d
const newPosition);
400 Math::Vector3d _objExecutingCodeSize;
401 bool _executingGlobalCode;
402 virtual void executeMovementConditions();
403 bool executeObjectConditions(
GeometricObject *obj,
bool shot,
bool collided,
bool activated);
404 void executeEntranceConditions(
Entrance *entrance);
405 void executeLocalGlobalConditions(
bool shot,
bool collided,
bool timer);
406 bool executeCode(
FCLInstructionVector &code,
bool shot,
bool collided,
bool timer,
bool activated);
409 bool checkConditional(
FCLInstruction &instruction,
bool shot,
bool collided,
bool timer,
bool activated);
412 void executeExecute(
FCLInstruction &instruction,
bool shot,
bool collided,
bool activated);
443 bool _usePrerecordedSounds;
444 void waitForSounds();
445 void stopAllSounds();
446 bool isPlayingSound();
447 void playSound(
int index,
bool sync);
450 void queueSoundConst(
double hzFreq,
int duration);
451 void playSilence(
int duration,
bool sync);
452 void playSoundConst(
double hzFreq,
int duration,
bool sync);
453 void playSoundSweepIncWL(
double hzFreq1,
double hzFreq2,
double wlStepPerMS,
int resolution,
bool sync);
454 uint16 playSoundDOSSpeaker(uint16 startFrequency,
soundSpeakerFx *speakerFxInfo);
457 virtual void playSoundFx(
int index,
bool sync);
466 int _soundIndexShoot;
467 int _soundIndexCollide;
469 int _soundIndexClimb;
471 int _soundIndexStart;
472 int _soundIndexAreaChange;
475 int _soundIndexNoShield;
476 int _soundIndexNoEnergy;
477 int _soundIndexFallen;
478 int _soundIndexTimeout;
479 int _soundIndexForceEndGame;
480 int _soundIndexCrushed;
481 int _soundIndexMissionComplete;
484 int _screenW, _screenH;
490 int _underFireFrames;
491 int _avoidRenderingFrames;
495 void flashScreen(
int backgroundColor);
497 Math::Vector3d _scaleVector;
498 float _nearClipPlane;
502 void insertTemporaryMessage(
const Common::String message,
int deadline);
504 void clearTemporalMessages();
524 void loadFonts(byte *font,
int charNumber);
532 virtual void drawStringInSurface(
const Common::String &str,
int x,
int y, uint32 fontColor, uint32 backColor,
Graphics::Surface *surface,
int offset = 0);
533 virtual void drawStringInSurface(
const Common::String &str,
int x,
int y, uint32 primaryFontColor, uint32 secondaryFontColor, uint32 backColor,
Graphics::Surface *surface,
int offset = 0);
537 virtual void initGameState();
538 void setGameBit(
int index);
539 void clearGameBit(
int index);
540 void toggleGameBit(
int index);
541 uint16 getGameBit(
int index);
543 StateVars _gameStateVars;
544 uint32 _gameStateBits;
545 void checkIfPlayerWasCrushed();
546 virtual bool checkIfGameEnded();
547 virtual void endGame();
548 int _endGameDelayTicks;
549 bool _endGameKeyPressed;
550 bool _endGamePlayerEndArea;
552 bool _playerWasCrushed;
555 virtual void checkSensors();
556 virtual void drawSensorShoot(
Sensor *sensor);
557 void takeDamageFromSensor();
569 void pauseEngineIntern(
bool pause)
override;
572 bool startCountdown(uint32 delay);
575 int _initialCountdown;
582 void getTimeFromCountdown(
int &seconds,
int &minutes,
int &hours);
583 virtual void updateTimeVariables();
586 bool _useExtendedTimer;
587 bool _disableSensors;
588 bool _disableFalling;
594 enum GameReleaseFlags {
595 GF_AMIGA_RETAIL = (1 << 0),
596 GF_AMIGA_BUDGET = (1 << 1),
597 GF_ZX_RETAIL = (1 << 2),
598 GF_ZX_BUDGET = (1 << 3),
599 GF_ZX_DISC = (1 << 4),
600 GF_CPC_RETAIL = (1 << 5),
601 GF_CPC_RETAIL_ALT = (1 << 6),
602 GF_CPC_BUDGET = (1 << 7),
603 GF_CPC_VIRTUALWORLDS = (1 << 8),
604 GF_ATARI_RETAIL = (1 << 9),
605 GF_ATARI_BUDGET = (1 << 10),
606 GF_C64_RETAIL = (1 << 11),
607 GF_C64_BUDGET = (1 << 12),
614 #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:561
Definition: freescape.h:135
Definition: advancedDetector.h:163
RenderMode
Definition: rendermode.h:48
uint32 CustomEventType
Definition: events.h:193
Definition: archive.h:141
Definition: freescape.h:159
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: freescape.h:562
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:560
Definition: instruction.h:36
Definition: freescape.h:128
Common::Platform platform
Definition: advancedDetector.h:198
Language
Definition: language.h:45