FREESCAPE: implemented basic on screen controlls for driller amiga/atari

This commit is contained in:
neuromancer 2023-03-22 08:57:42 +01:00
parent 2d671249d1
commit 22dec672b6
3 changed files with 52 additions and 1 deletions

View File

@ -501,7 +501,10 @@ void FreescapeEngine::processInput() {
case Common::EVENT_LBUTTONDOWN:
if (_hasFallen)
break;
shoot();
if (_viewArea.contains(_crossairPosition))
shoot();
else
onScreenControls(_crossairPosition);
break;
default:
@ -510,6 +513,9 @@ void FreescapeEngine::processInput() {
}
}
void FreescapeEngine::onScreenControls(Common::Point mouse) {
}
void FreescapeEngine::executeMovementConditions() {
// Only execute "on collision" room/global conditions
executeLocalGlobalConditions(false, true);

View File

@ -221,6 +221,7 @@ public:
void resetInput();
void generateDemoInput();
virtual void pressedKey(const int keycode);
virtual void onScreenControls(Common::Point mouse);
void move(CameraMovement direction, uint8 scale, float deltaTime);
virtual void checkIfStillInArea();
void changePlayerHeight(int index);
@ -484,6 +485,7 @@ private:
void drawCPCUI(Graphics::Surface *surface) override;
void drawC64UI(Graphics::Surface *surface) override;
void drawAmigaAtariSTUI(Graphics::Surface *surface) override;
void onScreenControls(Common::Point mouse) override;
Graphics::ManagedSurface *load8bitTitleImage(Common::SeekableReadStream *file, int offset);
Graphics::ManagedSurface *load8bitDemoImage(Common::SeekableReadStream *file, int offset);

View File

@ -825,6 +825,49 @@ bool DrillerEngine::checkIfGameEnded() {
return false;
}
void DrillerEngine::onScreenControls(Common::Point mouse) {
if (isAmiga() || isAtariST()) {
Common::Rect arrowFoward(184, 125, 199, 144);
Common::Rect arrowLeft(161, 145, 174, 164);
Common::Rect arrowRight(207, 145, 222, 164);
Common::Rect arrowBack(184, 152, 199, 171);
Common::Rect arrowUp(231, 145, 246, 164);
Common::Rect arrowDown(254, 145, 269, 164);
Common::Rect deployDrill(284, 145, 299, 166);
Common::Rect infoScreen(125, 172, 152, 197);
Common::Rect saveGame(9, 145, 39, 154);
Common::Rect loadGame(9, 156, 39, 164);
if (arrowFoward.contains(mouse))
move(kForwardMovement, _scaleVector.x(), 20.0);
else if (arrowLeft.contains(mouse))
move(kLeftMovement, _scaleVector.y(), 20.0);
else if (arrowRight.contains(mouse))
move(kRightMovement, _scaleVector.y(), 20.0);
else if (arrowBack.contains(mouse))
move(kBackwardMovement, _scaleVector.x(), 20.0);
else if (arrowUp.contains(mouse))
rise();
else if (arrowDown.contains(mouse))
lower();
else if (deployDrill.contains(mouse))
pressedKey(Common::KEYCODE_d);
else if (infoScreen.contains(mouse))
drawInfoMenu();
else if (saveGame.contains(mouse)) {
_gfx->setViewport(_fullscreenViewArea);
saveGameDialog();
_gfx->setViewport(_viewArea);
} else if (loadGame.contains(mouse)) {
_gfx->setViewport(_fullscreenViewArea);
loadGameDialog();
_gfx->setViewport(_viewArea);
}
}
}
Common::Error DrillerEngine::saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave) {
for (auto &it : _areaMap) { // All but skip area 255
if (it._key == 255)