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,
116 kFreescapeDefaultVolume = 192,
119 enum GameStateControl {
120 kFreescapeGameStateStart,
121 kFreescapeGameStatePlaying,
122 kFreescapeGameStateDemo,
123 kFreescapeGameStateEnd,
124 kFreescapeGameStateRestart,
139 void purgeKeyboardEvents();
140 void purgeMouseEvents();
142 void clearExitEvents();
147 kKeyRepeatInitialDelay = 400,
148 kKeyRepeatSustainDelay = 100
155 uint32 _keyRepeatTime;
165 GameStateControl _gameStateControl;
171 bool isSpaceStationOblivion() {
return _targetName.hasPrefix(
"spacestationoblivion"); }
172 bool isDriller() {
return _targetName.hasPrefix(
"driller") || _targetName.hasPrefix(
"spacestationoblivion"); }
173 bool isDark() {
return _targetName.hasPrefix(
"darkside"); }
174 bool isEclipse() {
return _targetName.hasPrefix(
"totaleclipse"); }
175 bool isEclipse2() {
return _targetName.hasPrefix(
"totaleclipse2"); }
176 bool isCastle() {
return _targetName.hasPrefix(
"castle"); }
177 bool isAmiga() {
return _gameDescription->
platform == Common::kPlatformAmiga; }
178 bool isAtariST() {
return _gameDescription->
platform == Common::kPlatformAtariST; }
179 bool isDOS() {
return _gameDescription->
platform == Common::kPlatformDOS; }
180 bool isSpectrum() {
return _gameDescription->
platform == Common::kPlatformZX; }
181 bool isCPC() {
return _gameDescription->
platform == Common::kPlatformAmstradCPC; }
182 bool isC64() {
return _gameDescription->
platform == Common::kPlatformC64; }
189 void centerCrossair();
191 virtual void borderScreen();
192 virtual void titleScreen();
195 virtual void loadBorder();
196 virtual void processBorder();
197 void waitInLoop(
int maxWait);
200 virtual void drawBackground();
201 void clearBackground();
202 virtual void drawUI();
203 virtual void drawInfoMenu();
222 virtual void loadAssets();
223 virtual void loadAssetsDemo();
224 virtual void loadAssetsFullGame();
226 virtual void loadAssetsAtariFullGame();
227 virtual void loadAssetsAtariDemo();
229 virtual void loadAssetsAmigaFullGame();
230 virtual void loadAssetsAmigaDemo();
232 virtual void loadAssetsDOSFullGame();
233 virtual void loadAssetsDOSDemo();
235 virtual void loadAssetsZXFullGame();
236 virtual void loadAssetsZXDemo();
238 virtual void loadAssetsCPCFullGame();
239 virtual void loadAssetsCPCDemo();
241 virtual void loadAssetsC64FullGame();
242 virtual void loadAssetsC64Demo();
251 void loadDataBundle();
258 void swapPalette(uint16 areaID);
259 virtual byte *findCGAPalette(uint16 levelID);
261 void loadColorPalette();
266 int _currentDemoInputCode;
267 int _currentDemoInputRepetition;
271 int decodeAmigaAtariKey(
int code);
272 int decodeDOSKey(
int code);
309 Math::Vector3d _scale;
311 virtual void gotoArea(uint16 areaID,
int entranceID);
313 uint16 _startEntrance;
319 bool _disableDemoMode;
328 void generateDemoInput();
329 virtual void pressedKey(
const int keycode);
330 virtual void releasedKey(
const int keycode);
333 void move(CameraMovement direction, uint8
scale,
float deltaTime);
334 void resolveCollisions(Math::Vector3d newPosition);
335 virtual void checkIfStillInArea();
336 void changePlayerHeight(
int index);
337 void increaseStepSize();
338 void decreaseStepSize();
339 void changeStepSize();
344 bool checkFloor(Math::Vector3d currentPosition);
345 bool tryStepUp(Math::Vector3d currentPosition);
346 bool tryStepDown(Math::Vector3d currentPosition);
348 int _maxFallingDistance;
352 void rotate(
float xoffset,
float yoffset);
359 void traverseEntrance(uint16 entranceID);
364 int _angleRotationIndex;
367 Math::Vector3d directionToVector(
float pitch,
float heading,
bool useTable);
372 float _mouseSensitivity;
373 Math::Vector3d _upVector;
374 Math::Vector3d _cameraFront, _cameraRight;
376 Math::Vector3d _position, _rotation, _velocity;
377 Math::Vector3d _lastPosition;
378 int _playerHeightNumber;
379 int _playerHeightMaxNumber;
380 uint16 _playerHeight;
383 uint16 _stepUpDistance;
385 int _playerStepIndex;
390 void warpMouseToCrossair(
void);
396 bool runCollisionConditions(Math::Vector3d
const lastPosition, Math::Vector3d
const newPosition);
397 Math::Vector3d _objExecutingCodeSize;
398 bool _executingGlobalCode;
399 virtual void executeMovementConditions();
400 bool executeObjectConditions(
GeometricObject *obj,
bool shot,
bool collided,
bool activated);
401 void executeEntranceConditions(
Entrance *entrance);
402 void executeLocalGlobalConditions(
bool shot,
bool collided,
bool timer);
403 bool executeCode(
FCLInstructionVector &code,
bool shot,
bool collided,
bool timer,
bool activated);
406 bool checkConditional(
FCLInstruction &instruction,
bool shot,
bool collided,
bool timer,
bool activated);
409 void executeExecute(
FCLInstruction &instruction,
bool shot,
bool collided,
bool activated);
440 bool _usePrerecordedSounds;
441 void waitForSounds();
442 void stopAllSounds();
443 bool isPlayingSound();
444 void playSound(
int index,
bool sync);
447 void queueSoundConst(
double hzFreq,
int duration);
448 void playSilence(
int duration,
bool sync);
449 void playSoundConst(
double hzFreq,
int duration,
bool sync);
450 void playSoundSweepIncWL(
double hzFreq1,
double hzFreq2,
double wlStepPerMS,
int resolution,
bool sync);
451 uint16 playSoundDOSSpeaker(uint16 startFrequency,
soundSpeakerFx *speakerFxInfo);
454 virtual void playSoundFx(
int index,
bool sync);
463 int _soundIndexShoot;
464 int _soundIndexCollide;
466 int _soundIndexClimb;
468 int _soundIndexStart;
469 int _soundIndexAreaChange;
472 int _soundIndexNoShield;
473 int _soundIndexNoEnergy;
474 int _soundIndexFallen;
475 int _soundIndexTimeout;
476 int _soundIndexForceEndGame;
477 int _soundIndexCrushed;
478 int _soundIndexMissionComplete;
481 int _screenW, _screenH;
487 int _underFireFrames;
488 int _avoidRenderingFrames;
492 void flashScreen(
int backgroundColor);
494 Math::Vector3d _scaleVector;
495 float _nearClipPlane;
499 void insertTemporaryMessage(
const Common::String message,
int deadline);
501 void clearTemporalMessages();
521 void loadFonts(byte *font,
int charNumber);
529 virtual void drawStringInSurface(
const Common::String &str,
int x,
int y, uint32 fontColor, uint32 backColor,
Graphics::Surface *surface,
int offset = 0);
530 virtual void drawStringInSurface(
const Common::String &str,
int x,
int y, uint32 primaryFontColor, uint32 secondaryFontColor, uint32 backColor,
Graphics::Surface *surface,
int offset = 0);
534 virtual void initGameState();
535 void setGameBit(
int index);
536 void clearGameBit(
int index);
537 void toggleGameBit(
int index);
538 uint16 getGameBit(
int index);
540 StateVars _gameStateVars;
541 uint32 _gameStateBits;
542 void checkIfPlayerWasCrushed();
543 virtual bool checkIfGameEnded();
544 virtual void endGame();
545 int _endGameDelayTicks;
546 bool _endGameKeyPressed;
547 bool _endGamePlayerEndArea;
549 bool _playerWasCrushed;
552 virtual void checkSensors();
553 virtual void drawSensorShoot(
Sensor *sensor);
554 void takeDamageFromSensor();
566 void pauseEngineIntern(
bool pause)
override;
569 bool startCountdown(uint32 delay);
572 int _initialCountdown;
579 void getTimeFromCountdown(
int &seconds,
int &minutes,
int &hours);
580 virtual void updateTimeVariables();
583 bool _useExtendedTimer;
584 bool _disableSensors;
585 bool _disableFalling;
591 enum GameReleaseFlags {
592 GF_AMIGA_RETAIL = (1 << 0),
593 GF_AMIGA_BUDGET = (1 << 1),
594 GF_ZX_RETAIL = (1 << 2),
595 GF_ZX_BUDGET = (1 << 3),
596 GF_ZX_DISC = (1 << 4),
597 GF_CPC_RETAIL = (1 << 5),
598 GF_CPC_RETAIL_ALT = (1 << 6),
599 GF_CPC_BUDGET = (1 << 7),
600 GF_CPC_VIRTUALWORLDS = (1 << 8),
601 GF_ATARI_RETAIL = (1 << 9),
602 GF_ATARI_BUDGET = (1 << 10)
609 #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:558
Definition: freescape.h:134
Definition: advancedDetector.h:163
RenderMode
Definition: rendermode.h:48
uint32 CustomEventType
Definition: events.h:193
Definition: archive.h:141
Definition: freescape.h:158
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: freescape.h:559
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:557
Definition: instruction.h:36
Definition: freescape.h:127
Common::Platform platform
Definition: advancedDetector.h:198
Language
Definition: language.h:45