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" 56 bool isEncodedCPCDirectColor(uint8 index);
57 uint8 encodeCPCDirectColor(uint8 index);
58 uint8 decodeCPCDirectColor(uint8 index);
60 #define FREESCAPE_DATA_BUNDLE "freescape.dat" 69 enum FreescapeAction {
83 kActionChangeStepSize,
84 kActionToggleRiseLower,
86 kActionLowerOrFlyDown,
96 kActionIncreaseStepSize,
97 kActionDecreaseStepSize,
99 kActionToggleClipMode,
101 kActionDeployDrillingRig,
102 kActionCollectDrillingRig,
113 kActionSelectPrincess,
115 kActionToggleFlashlight,
127 kFreescapeDebugMove = 1,
128 kFreescapeDebugParser,
130 kFreescapeDebugMedia,
131 kFreescapeDebugGroup,
135 kFreescapeDefaultVolume = 192,
138 enum GameStateControl {
139 kFreescapeGameStateStart,
140 kFreescapeGameStatePlaying,
141 kFreescapeGameStateDemo,
142 kFreescapeGameStateEnd,
143 kFreescapeGameStateRestart,
146 extern byte kEGADefaultPalette[16][3];
147 extern byte kCGAPaletteRedGreen[4][3];
148 extern byte kCGAPalettePinkBlue[4][3];
149 extern byte kCGAPalettePinkBlueBright[4][3];
150 extern byte kCGAPaletteRedGreenBright[4][3];
151 extern byte kHerculesPaletteGreen[2][3];
167 void purgeKeyboardEvents();
168 void purgeMouseEvents();
170 void clearExitEvents();
177 kKeyRepeatInitialDelay = 400,
178 kKeyRepeatSustainDelay = 100
186 uint32 _keyRepeatTime;
196 GameStateControl _gameStateControl;
202 bool isSpaceStationOblivion() {
return _targetName.hasPrefix(
"spacestationoblivion"); }
203 bool isDriller() {
return _targetName.hasPrefix(
"driller") || _targetName.hasPrefix(
"spacestationoblivion"); }
204 bool isDark() {
return _targetName.hasPrefix(
"darkside"); }
205 bool isEclipse() {
return _targetName.hasPrefix(
"totaleclipse"); }
206 bool isEclipse2() {
return _targetName.hasPrefix(
"totaleclipse2"); }
207 bool isCastle() {
return _targetName.hasPrefix(
"castle"); }
208 bool isCastleMaster2() {
return _targetName.hasPrefix(
"castlemaster2"); }
209 bool isAmiga() {
return _gameDescription->
platform == Common::kPlatformAmiga; }
210 bool isAtariST() {
return _gameDescription->
platform == Common::kPlatformAtariST; }
211 bool isDOS() {
return _gameDescription->
platform == Common::kPlatformDOS; }
212 bool isSpectrum() {
return _gameDescription->
platform == Common::kPlatformZX; }
213 bool isCPC() {
return _gameDescription->
platform == Common::kPlatformAmstradCPC; }
214 bool isC64() {
return _gameDescription->
platform == Common::kPlatformC64; }
216 virtual void beforeStarting();
222 void centerCrossair();
224 virtual void borderScreen();
225 virtual void titleScreen();
228 virtual void loadBorder();
229 virtual void processBorder();
230 void waitInLoop(
int maxWait);
233 virtual void drawBackground();
234 void clearBackground();
236 virtual void drawUI();
237 virtual void drawInfoMenu();
256 virtual void loadAssets();
257 virtual void loadAssetsDemo();
258 virtual void loadAssetsFullGame();
260 virtual void loadAssetsAtariFullGame();
261 virtual void loadAssetsAtariDemo();
263 virtual void loadAssetsAmigaFullGame();
264 virtual void loadAssetsAmigaDemo();
266 virtual void loadAssetsDOSFullGame();
267 virtual void loadAssetsDOSDemo();
269 virtual void loadAssetsZXFullGame();
270 virtual void loadAssetsZXDemo();
272 virtual void loadAssetsCPCFullGame();
273 virtual void loadAssetsCPCDemo();
275 virtual void loadAssetsC64FullGame();
276 virtual void loadAssetsC64Demo();
285 void loadDataBundle();
290 int dataOffset,
int widthWords,
int height, byte *palette);
298 void swapPalette(uint16 areaID);
299 virtual byte *findCGAPalette(uint16 levelID);
301 void loadColorPalette();
306 int _currentDemoInputCode;
307 int _currentDemoInputRepetition;
311 int decodeAmigaAtariKey(
int code);
312 int decodeDOSKey(
int code);
350 Math::Vector3d _scale;
352 virtual void gotoArea(uint16 areaID,
int entranceID);
354 uint16 _startEntrance;
360 bool _disableDemoMode;
366 bool _smoothMovement;
367 bool _useWASDControls;
368 bool _debugSimulateTouchscreen;
369 bool isTouchscreenActive()
const;
383 void generateDemoInput();
384 virtual void pressedKey(
const int keycode);
385 virtual void releasedKey(
const int keycode);
388 void updatePlayerMovement(
float deltaTime);
389 void updatePlayerMovementSmooth(
float deltaTime);
390 void updatePlayerMovementClassic(
float deltaTime);
391 void resolveCollisions(Math::Vector3d newPosition);
392 virtual void checkIfStillInArea();
393 void changePlayerHeight(
int index);
394 void increaseStepSize();
395 void decreaseStepSize();
396 void changeStepSize();
398 void changeAngle(
int offset,
bool wrapAround);
401 bool checkFloor(Math::Vector3d currentPosition);
402 bool tryStepUp(Math::Vector3d currentPosition);
403 bool tryStepDown(Math::Vector3d currentPosition);
405 bool _isCollidingWithWall;
407 bool _isSteppingDown;
409 int _maxFallingDistance;
413 void rotate(
float xoffset,
float yoffset,
float zoffset);
420 void traverseEntrance(uint16 entranceID);
426 int _angleRotationIndex;
429 Math::Vector3d directionToVector(
float pitch,
float heading,
bool useTable);
431 virtual void onRotate(
float xoffset,
float yoffset,
float zoffset) {}
435 float _mouseSensitivity;
436 Math::Vector3d _upVector;
437 Math::Vector3d _cameraFront, _cameraRight;
439 Math::Vector3d _position, _rotation, _velocity;
440 Math::Vector3d _lastPosition;
441 int _playerHeightNumber;
442 int _playerHeightMaxNumber;
443 uint16 _playerHeight;
446 uint16 _stepUpDistance;
448 int _playerStepIndex;
449 int _savedPlayerStepIndex;
454 void warpMouseToCrossair(
void);
460 bool runCollisionConditions(Math::Vector3d
const lastPosition, Math::Vector3d
const newPosition);
461 Math::Vector3d _objExecutingCodeSize;
462 bool _executingGlobalCode;
463 virtual void executeMovementConditions();
464 bool executeObjectConditions(
GeometricObject *obj,
bool shot,
bool collided,
bool activated);
465 void executeEntranceConditions(
Entrance *entrance);
466 void executeLocalGlobalConditions(
bool shot,
bool collided,
bool timer);
467 bool executeCode(
FCLInstructionVector &code,
bool shot,
bool collided,
bool timer,
bool activated);
470 bool checkConditional(
FCLInstruction &instruction,
bool shot,
bool collided,
bool timer,
bool activated);
505 bool _usePrerecordedSounds;
506 void waitForSounds();
508 bool isPlayingSound();
512 void queueSoundConst(
double hzFreq,
int duration);
513 void playSilence(
int duration,
bool sync);
514 void playSoundConst(
double hzFreq,
int duration,
bool sync);
515 void playSoundSweepIncWL(
double hzFreq1,
double hzFreq2,
double wlStepPerMS,
int resolution,
bool sync);
516 uint16 playSoundDOSSpeaker(uint16 startFrequency,
soundSpeakerFx *speakerFxInfo);
520 virtual void playSoundC64(
int index);
521 virtual void playSoundFx(
int index,
bool sync);
532 void loadSoundsCPC(
Common::SeekableReadStream *file,
int offsetTone,
int sizeTone,
int offsetEnvelope,
int sizeEnvelope,
int offsetSoundDef,
int sizeSoundDef);
542 int _soundIndexShoot;
543 int _soundIndexCollide;
544 int _soundIndexStepDown;
545 int _soundIndexStepUp;
548 int _soundIndexStart;
549 int _soundIndexAreaChange;
552 int _soundIndexNoShield;
553 int _soundIndexNoEnergy;
554 int _soundIndexFallen;
555 int _soundIndexTimeout;
556 int _soundIndexForceEndGame;
557 int _soundIndexCrushed;
558 int _soundIndexMissionComplete;
561 int _screenW, _screenH;
567 int _underFireFrames;
568 int _avoidRenderingFrames;
572 void flashScreen(
int backgroundColor);
574 Math::Vector3d _scaleVector;
575 float _nearClipPlane;
579 void insertTemporaryMessage(
const Common::String &message,
int deadline);
581 void clearTemporalMessages();
601 void loadFonts(byte *font,
int charNumber);
610 virtual void drawStringInSurface(
const Common::String &str,
int x,
int y, uint32 fontColor, uint32 backColor,
Graphics::Surface *surface,
int offset = 0);
611 virtual void drawStringInSurface(
const Common::String &str,
int x,
int y, uint32 primaryFontColor, uint32 secondaryFontColor, uint32 backColor,
Graphics::Surface *surface,
int offset = 0);
615 virtual void initGameState();
616 void setGameBit(
int index);
617 void clearGameBit(
int index);
618 void toggleGameBit(
int index);
619 uint16 getGameBit(
int index);
621 StateVars _gameStateVars;
622 uint32 _gameStateBits;
623 void checkIfPlayerWasCrushed();
624 virtual bool triggerWinCondition();
625 virtual bool checkIfGameEnded();
626 virtual void endGame();
627 int _endGameDelayTicks;
628 bool _endGameKeyPressed;
629 bool _endGamePlayerEndArea;
631 bool _playerWasCrushed;
634 virtual void checkSensors();
635 virtual void drawSensorShoot(
Sensor *sensor);
636 void takeDamageFromSensor();
648 void pauseEngineIntern(
bool pause)
override;
651 bool startCountdown(uint32 delay);
654 int _initialCountdown;
662 void getTimeFromCountdown(
int &seconds,
int &minutes,
int &hours);
663 virtual void updateTimeVariables();
666 bool _useExtendedTimer;
667 bool _disableSensors;
668 bool _disableFalling;
674 byte *decompressC64RLE(byte *buffer,
int *size, byte marker);
678 enum GameReleaseFlags {
679 GF_AMIGA_RETAIL = (1 << 0),
680 GF_AMIGA_BUDGET = (1 << 1),
681 GF_ZX_RETAIL = (1 << 2),
682 GF_ZX_BUDGET = (1 << 3),
683 GF_ZX_DISC = (1 << 4),
684 GF_CPC_RETAIL = (1 << 5),
685 GF_CPC_RETAIL_ALT = (1 << 6),
686 GF_CPC_BUDGET = (1 << 7),
687 GF_CPC_VIRTUALWORLDS = (1 << 8),
688 GF_ATARI_RETAIL = (1 << 9),
689 GF_ATARI_BUDGET = (1 << 10),
690 GF_C64_TAPE = (1 << 11),
691 GF_C64_DISC = (1 << 12),
699 #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:640
Definition: freescape.h:162
Definition: advancedDetector.h:164
RenderMode
Definition: rendermode.h:48
uint32 CustomEventType
Definition: events.h:204
Definition: archive.h:141
Definition: freescape.h:189
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: freescape.h:641
Definition: algorithm.h:29
Definition: entrance.h:34
Definition: keyboard.h:294
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: freescape.h:639
Definition: instruction.h:36
Definition: freescape.h:153
Common::Platform platform
Definition: advancedDetector.h:199
Definition: debugger.h:31
Language
Definition: language.h:45