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 #define FREESCAPE_DATA_BUNDLE "freescape.dat" 65 enum FreescapeAction {
79 kActionChangeStepSize,
80 kActionToggleRiseLower,
82 kActionLowerOrFlyDown,
92 kActionIncreaseStepSize,
93 kActionDecreaseStepSize,
95 kActionToggleClipMode,
97 kActionDeployDrillingRig,
98 kActionCollectDrillingRig,
108 kActionSelectPrincess,
110 kActionToggleFlashlight,
122 kFreescapeDebugMove = 1,
123 kFreescapeDebugParser,
125 kFreescapeDebugMedia,
126 kFreescapeDebugGroup,
130 kFreescapeDefaultVolume = 192,
133 enum GameStateControl {
134 kFreescapeGameStateStart,
135 kFreescapeGameStatePlaying,
136 kFreescapeGameStateDemo,
137 kFreescapeGameStateEnd,
138 kFreescapeGameStateRestart,
141 extern byte kEGADefaultPalette[16][3];
142 extern byte kCGAPaletteRedGreen[4][3];
143 extern byte kCGAPalettePinkBlue[4][3];
144 extern byte kCGAPalettePinkBlueBright[4][3];
145 extern byte kCGAPaletteRedGreenBright[4][3];
146 extern byte kHerculesPaletteGreen[2][3];
162 void purgeKeyboardEvents();
163 void purgeMouseEvents();
165 void clearExitEvents();
172 kKeyRepeatInitialDelay = 400,
173 kKeyRepeatSustainDelay = 100
180 uint32 _keyRepeatTime;
190 GameStateControl _gameStateControl;
196 bool isSpaceStationOblivion() {
return _targetName.hasPrefix(
"spacestationoblivion"); }
197 bool isDriller() {
return _targetName.hasPrefix(
"driller") || _targetName.hasPrefix(
"spacestationoblivion"); }
198 bool isDark() {
return _targetName.hasPrefix(
"darkside"); }
199 bool isEclipse() {
return _targetName.hasPrefix(
"totaleclipse"); }
200 bool isEclipse2() {
return _targetName.hasPrefix(
"totaleclipse2"); }
201 bool isCastle() {
return _targetName.hasPrefix(
"castle"); }
202 bool isAmiga() {
return _gameDescription->
platform == Common::kPlatformAmiga; }
203 bool isAtariST() {
return _gameDescription->
platform == Common::kPlatformAtariST; }
204 bool isDOS() {
return _gameDescription->
platform == Common::kPlatformDOS; }
205 bool isSpectrum() {
return _gameDescription->
platform == Common::kPlatformZX; }
206 bool isCPC() {
return _gameDescription->
platform == Common::kPlatformAmstradCPC; }
207 bool isC64() {
return _gameDescription->
platform == Common::kPlatformC64; }
209 virtual void beforeStarting();
215 void centerCrossair();
217 virtual void borderScreen();
218 virtual void titleScreen();
221 virtual void loadBorder();
222 virtual void processBorder();
223 void waitInLoop(
int maxWait);
226 virtual void drawBackground();
227 void clearBackground();
228 virtual void drawUI();
229 virtual void drawInfoMenu();
248 virtual void loadAssets();
249 virtual void loadAssetsDemo();
250 virtual void loadAssetsFullGame();
252 virtual void loadAssetsAtariFullGame();
253 virtual void loadAssetsAtariDemo();
255 virtual void loadAssetsAmigaFullGame();
256 virtual void loadAssetsAmigaDemo();
258 virtual void loadAssetsDOSFullGame();
259 virtual void loadAssetsDOSDemo();
261 virtual void loadAssetsZXFullGame();
262 virtual void loadAssetsZXDemo();
264 virtual void loadAssetsCPCFullGame();
265 virtual void loadAssetsCPCDemo();
267 virtual void loadAssetsC64FullGame();
268 virtual void loadAssetsC64Demo();
277 void loadDataBundle();
286 void swapPalette(uint16 areaID);
287 virtual byte *findCGAPalette(uint16 levelID);
289 void loadColorPalette();
294 int _currentDemoInputCode;
295 int _currentDemoInputRepetition;
299 int decodeAmigaAtariKey(
int code);
300 int decodeDOSKey(
int code);
337 Math::Vector3d _scale;
339 virtual void gotoArea(uint16 areaID,
int entranceID);
341 uint16 _startEntrance;
347 bool _disableDemoMode;
353 bool _smoothMovement;
367 void generateDemoInput();
368 virtual void pressedKey(
const int keycode);
369 virtual void releasedKey(
const int keycode);
372 void updatePlayerMovement(
float deltaTime);
373 void updatePlayerMovementSmooth(
float deltaTime);
374 void updatePlayerMovementClassic(
float deltaTime);
375 void resolveCollisions(Math::Vector3d newPosition);
376 virtual void checkIfStillInArea();
377 void changePlayerHeight(
int index);
378 void increaseStepSize();
379 void decreaseStepSize();
380 void changeStepSize();
382 void changeAngle(
int offset,
bool wrapAround);
385 bool checkFloor(Math::Vector3d currentPosition);
386 bool tryStepUp(Math::Vector3d currentPosition);
387 bool tryStepDown(Math::Vector3d currentPosition);
389 bool _isCollidingWithWall;
391 bool _isSteppingDown;
393 int _maxFallingDistance;
397 void rotate(
float xoffset,
float yoffset,
float zoffset);
404 void traverseEntrance(uint16 entranceID);
410 int _angleRotationIndex;
413 Math::Vector3d directionToVector(
float pitch,
float heading,
bool useTable);
418 float _mouseSensitivity;
419 Math::Vector3d _upVector;
420 Math::Vector3d _cameraFront, _cameraRight;
422 Math::Vector3d _position, _rotation, _velocity;
423 Math::Vector3d _lastPosition;
424 int _playerHeightNumber;
425 int _playerHeightMaxNumber;
426 uint16 _playerHeight;
429 uint16 _stepUpDistance;
431 int _playerStepIndex;
436 void warpMouseToCrossair(
void);
442 bool runCollisionConditions(Math::Vector3d
const lastPosition, Math::Vector3d
const newPosition);
443 Math::Vector3d _objExecutingCodeSize;
444 bool _executingGlobalCode;
445 virtual void executeMovementConditions();
446 bool executeObjectConditions(
GeometricObject *obj,
bool shot,
bool collided,
bool activated);
447 void executeEntranceConditions(
Entrance *entrance);
448 void executeLocalGlobalConditions(
bool shot,
bool collided,
bool timer);
449 bool executeCode(
FCLInstructionVector &code,
bool shot,
bool collided,
bool timer,
bool activated);
452 bool checkConditional(
FCLInstruction &instruction,
bool shot,
bool collided,
bool timer,
bool activated);
487 bool _usePrerecordedSounds;
488 void waitForSounds();
490 bool isPlayingSound();
494 void queueSoundConst(
double hzFreq,
int duration);
495 void playSilence(
int duration,
bool sync);
496 void playSoundConst(
double hzFreq,
int duration,
bool sync);
497 void playSoundSweepIncWL(
double hzFreq1,
double hzFreq2,
double wlStepPerMS,
int resolution,
bool sync);
498 uint16 playSoundDOSSpeaker(uint16 startFrequency,
soundSpeakerFx *speakerFxInfo);
502 virtual void playSoundC64(
int index);
503 virtual void playSoundFx(
int index,
bool sync);
514 void loadSoundsCPC(
Common::SeekableReadStream *file,
int offsetTone,
int sizeTone,
int offsetEnvelope,
int sizeEnvelope,
int offsetSoundDef,
int sizeSoundDef);
524 int _soundIndexShoot;
525 int _soundIndexCollide;
526 int _soundIndexStepDown;
527 int _soundIndexStepUp;
530 int _soundIndexStart;
531 int _soundIndexAreaChange;
534 int _soundIndexNoShield;
535 int _soundIndexNoEnergy;
536 int _soundIndexFallen;
537 int _soundIndexTimeout;
538 int _soundIndexForceEndGame;
539 int _soundIndexCrushed;
540 int _soundIndexMissionComplete;
543 int _screenW, _screenH;
549 int _underFireFrames;
550 int _avoidRenderingFrames;
554 void flashScreen(
int backgroundColor);
556 Math::Vector3d _scaleVector;
557 float _nearClipPlane;
561 void insertTemporaryMessage(
const Common::String &message,
int deadline);
563 void clearTemporalMessages();
583 void loadFonts(byte *font,
int charNumber);
592 virtual void drawStringInSurface(
const Common::String &str,
int x,
int y, uint32 fontColor, uint32 backColor,
Graphics::Surface *surface,
int offset = 0);
593 virtual void drawStringInSurface(
const Common::String &str,
int x,
int y, uint32 primaryFontColor, uint32 secondaryFontColor, uint32 backColor,
Graphics::Surface *surface,
int offset = 0);
597 virtual void initGameState();
598 void setGameBit(
int index);
599 void clearGameBit(
int index);
600 void toggleGameBit(
int index);
601 uint16 getGameBit(
int index);
603 StateVars _gameStateVars;
604 uint32 _gameStateBits;
605 void checkIfPlayerWasCrushed();
606 virtual bool checkIfGameEnded();
607 virtual void endGame();
608 int _endGameDelayTicks;
609 bool _endGameKeyPressed;
610 bool _endGamePlayerEndArea;
612 bool _playerWasCrushed;
615 virtual void checkSensors();
616 virtual void drawSensorShoot(
Sensor *sensor);
617 void takeDamageFromSensor();
629 void pauseEngineIntern(
bool pause)
override;
632 bool startCountdown(uint32 delay);
635 int _initialCountdown;
642 void getTimeFromCountdown(
int &seconds,
int &minutes,
int &hours);
643 virtual void updateTimeVariables();
646 bool _useExtendedTimer;
647 bool _disableSensors;
648 bool _disableFalling;
654 byte *decompressC64RLE(byte *buffer,
int *size, byte marker);
658 enum GameReleaseFlags {
659 GF_AMIGA_RETAIL = (1 << 0),
660 GF_AMIGA_BUDGET = (1 << 1),
661 GF_ZX_RETAIL = (1 << 2),
662 GF_ZX_BUDGET = (1 << 3),
663 GF_ZX_DISC = (1 << 4),
664 GF_CPC_RETAIL = (1 << 5),
665 GF_CPC_RETAIL_ALT = (1 << 6),
666 GF_CPC_BUDGET = (1 << 7),
667 GF_CPC_VIRTUALWORLDS = (1 << 8),
668 GF_ATARI_RETAIL = (1 << 9),
669 GF_ATARI_BUDGET = (1 << 10),
670 GF_C64_TAPE = (1 << 11),
671 GF_C64_DISC = (1 << 12),
679 #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:621
Definition: freescape.h:157
Definition: advancedDetector.h:164
RenderMode
Definition: rendermode.h:48
uint32 CustomEventType
Definition: events.h:204
Definition: archive.h:141
Definition: freescape.h:183
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: freescape.h:622
Definition: algorithm.h:29
Definition: entrance.h:34
Definition: keyboard.h:294
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: freescape.h:620
Definition: instruction.h:36
Definition: freescape.h:148
Common::Platform platform
Definition: advancedDetector.h:199
Definition: debugger.h:31
Language
Definition: language.h:45