mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-24 05:01:43 +00:00
HYPNO: added basic implementation for selection in specific scenes in boyz
This commit is contained in:
parent
bae1dffdde
commit
6a16c8bbb5
@ -31,9 +31,6 @@ namespace Hypno {
|
||||
void HypnoEngine::runMenu(Hotspots *hs, bool only_menu) {
|
||||
Hotspot *h = hs->begin();
|
||||
assert(h->type == MakeMenu);
|
||||
if (!h->background.empty()) {
|
||||
loadImage(h->background, 0, 0, false, true);
|
||||
}
|
||||
|
||||
debugC(1, kHypnoDebugScene, "hotspot actions size: %d", h->actions.size());
|
||||
for (Actions::const_iterator itt = h->actions.begin(); !only_menu && itt != h->actions.end(); ++itt) {
|
||||
|
@ -157,11 +157,58 @@ void BoyzEngine::loadAssets() {
|
||||
loadArcadeLevel("c58.mi_", "c59.mi_", "<retry_menu>", "");
|
||||
loadArcadeLevel("c59.mi_", "<credits>", "<retry_menu>", "");
|
||||
|
||||
Global *gl;
|
||||
ChangeLevel *cl;
|
||||
Cutscene *cs;
|
||||
Highlight *hl;
|
||||
|
||||
loadSceneLevel(selectBoyz, "<select_boyz>", "", "");
|
||||
Scene *sc = (Scene *) _levels["<select_boyz>"];
|
||||
sc->resolution = "320x200";
|
||||
|
||||
ChangeLevel *cl = new ChangeLevel("c19.mi_");
|
||||
hl = new Highlight("GS_SWITCH1");
|
||||
sc->hots[1].actions.push_back(hl);
|
||||
gl = new Global("GS_SWITCH1", "TURNON");
|
||||
sc->hots[1].actions.push_back(gl);
|
||||
cs = new Cutscene("intro/c0i01s.smk");
|
||||
sc->hots[1].actions.push_back(cs);
|
||||
|
||||
hl = new Highlight("GS_SWITCH2");
|
||||
sc->hots[2].actions.push_back(hl);
|
||||
gl = new Global("GS_SWITCH2", "TURNON");
|
||||
sc->hots[2].actions.push_back(gl);
|
||||
cs = new Cutscene("intro/c0i02s.smk");
|
||||
sc->hots[2].actions.push_back(cs);
|
||||
|
||||
hl = new Highlight("GS_SWITCH3");
|
||||
sc->hots[3].actions.push_back(hl);
|
||||
gl = new Global("GS_SWITCH3", "TURNON");
|
||||
sc->hots[3].actions.push_back(gl);
|
||||
cs = new Cutscene("intro/c0i03s.smk");
|
||||
sc->hots[3].actions.push_back(cs);
|
||||
|
||||
hl = new Highlight("GS_SWITCH4");
|
||||
sc->hots[4].actions.push_back(hl);
|
||||
gl = new Global("GS_SWITCH4", "TURNON");
|
||||
sc->hots[4].actions.push_back(gl);
|
||||
cs = new Cutscene("intro/c0i04s.smk");
|
||||
sc->hots[4].actions.push_back(cs);
|
||||
|
||||
hl = new Highlight("GS_SWITCH5");
|
||||
sc->hots[5].actions.push_back(hl);
|
||||
gl = new Global("GS_SWITCH5", "TURNON");
|
||||
sc->hots[5].actions.push_back(gl);
|
||||
cs = new Cutscene("intro/c0i05s.smk");
|
||||
sc->hots[5].actions.push_back(cs);
|
||||
|
||||
hl = new Highlight("GS_SWITCH6");
|
||||
sc->hots[6].actions.push_back(hl);
|
||||
gl = new Global("GS_SWITCH6", "TURNON");
|
||||
sc->hots[6].actions.push_back(gl);
|
||||
cs = new Cutscene("intro/c0i06s.smk");
|
||||
sc->hots[6].actions.push_back(cs);
|
||||
|
||||
cl = new ChangeLevel("c19.mi_");
|
||||
sc->hots[7].actions.push_back(cl);
|
||||
|
||||
loadSceneLevel(selectC3, "<select_c3>", "", "");
|
||||
|
103
engines/hypno/boyz/scene.cpp
Normal file
103
engines/hypno/boyz/scene.cpp
Normal file
@ -0,0 +1,103 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/events.h"
|
||||
|
||||
#include "hypno/hypno.h"
|
||||
|
||||
namespace Hypno {
|
||||
|
||||
void BoyzEngine::runMenu(Hotspots *hs, bool only_menu) {
|
||||
Hotspot *h = hs->begin();
|
||||
assert(h->type == MakeMenu);
|
||||
if (!h->background.empty()) {
|
||||
loadImage(h->background, 0, 0, false, true, 1);
|
||||
if (h->backgroundFrames.empty()) {
|
||||
h->backgroundFrames = decodeFrames(h->background);
|
||||
}
|
||||
}
|
||||
renderHighlights(hs);
|
||||
}
|
||||
|
||||
void BoyzEngine::renderHighlights(Hotspots *hs) {
|
||||
Hotspot *menu = hs->begin();
|
||||
if (menu->type != MakeMenu || menu->background.empty())
|
||||
return;
|
||||
|
||||
for (Hotspots::const_iterator it = hs->begin(); it != hs->end(); ++it) {
|
||||
if (it->type == MakeMenu)
|
||||
continue;
|
||||
|
||||
Highlight *hl;
|
||||
for (Actions::const_iterator itt = it->actions.begin(); itt != it->actions.end(); ++itt) {
|
||||
Action *action = *itt;
|
||||
switch (action->type) {
|
||||
case HighlightAction:
|
||||
hl = (Highlight *)action;
|
||||
if (_sceneState[hl->condition]) {
|
||||
Graphics::Surface sub = menu->backgroundFrames[0]->getSubArea(it->rect);
|
||||
drawImage(sub, it->rect.left, it->rect.top, false);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool BoyzEngine::hoverHotspot(Common::Point mousePos) {
|
||||
if (_rnd->getRandomBit())
|
||||
return false; // Dirty trick to avoid updating the screen too often
|
||||
Hotspots *hots = stack.back();
|
||||
Hotspot selected(MakeHotspot);
|
||||
bool found = false;
|
||||
int rs = 100000000;
|
||||
for (Hotspots::const_iterator it = hots->begin(); it != hots->end(); ++it) {
|
||||
const Hotspot h = *it;
|
||||
if (h.type != MakeHotspot)
|
||||
continue;
|
||||
|
||||
int cs = h.rect.width() * h.rect.height();
|
||||
if (h.rect.contains(mousePos)) {
|
||||
if (cs < rs) {
|
||||
selected = h;
|
||||
found = true;
|
||||
rs = cs;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
Hotspot *menu = hots->begin();
|
||||
if (menu->type == MakeMenu && !menu->background.empty()) { // Hihghlight
|
||||
Graphics::Surface sub = menu->backgroundFrames[2]->getSubArea(selected.rect);
|
||||
drawImage(*menu->backgroundFrames[1], 0, 0, false);
|
||||
drawImage(sub, selected.rect.left, selected.rect.top, false);
|
||||
renderHighlights(hots);
|
||||
drawScreen();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // End of namespace Hypno
|
@ -65,6 +65,7 @@ enum ActionType {
|
||||
TimerAction,
|
||||
PaletteAction,
|
||||
BackgroundAction,
|
||||
HighlightAction,
|
||||
OverlayAction,
|
||||
EscapeAction,
|
||||
SaveAction,
|
||||
@ -94,6 +95,7 @@ class Hotspot;
|
||||
|
||||
typedef Common::Array<Hotspot> Hotspots;
|
||||
typedef Common::Array<Hotspots *> HotspotsStack;
|
||||
typedef Common::Array<Graphics::Surface *> Frames;
|
||||
|
||||
class Hotspot {
|
||||
public:
|
||||
@ -106,7 +108,8 @@ public:
|
||||
Common::String flags[3];
|
||||
Common::Rect rect;
|
||||
Common::String setting;
|
||||
Common::String background;
|
||||
Filename background;
|
||||
Frames backgroundFrames;
|
||||
Actions actions;
|
||||
Hotspots *smenu;
|
||||
};
|
||||
@ -149,6 +152,15 @@ public:
|
||||
Filename path;
|
||||
};
|
||||
|
||||
class Highlight : public Action {
|
||||
public:
|
||||
Highlight(Common::String condition_) {
|
||||
type = HighlightAction;
|
||||
condition = condition_;
|
||||
}
|
||||
Common::String condition;
|
||||
};
|
||||
|
||||
class Background : public Action {
|
||||
public:
|
||||
Background(Filename path_, Common::Point origin_, Common::String condition_, Common::String flag1_, Common::String flag2_) {
|
||||
|
@ -57,8 +57,6 @@ enum {
|
||||
kHypnoDebugScene = 1 << 3
|
||||
};
|
||||
|
||||
typedef Common::Array<Graphics::Surface *> Frames;
|
||||
|
||||
// Player positions
|
||||
|
||||
enum PlayerPosition {
|
||||
@ -141,7 +139,7 @@ public:
|
||||
|
||||
// User input
|
||||
void clickedHotspot(Common::Point);
|
||||
bool hoverHotspot(Common::Point);
|
||||
virtual bool hoverHotspot(Common::Point);
|
||||
|
||||
// Cursors
|
||||
bool cursorPauseMovie(Common::Point);
|
||||
@ -178,7 +176,7 @@ public:
|
||||
void changeCursor(const Graphics::Surface &entry, byte *palette, bool centerCursor = false);
|
||||
|
||||
// Actions
|
||||
void runMenu(Hotspots *hs, bool only_menu = false);
|
||||
virtual void runMenu(Hotspots *hs, bool only_menu = false);
|
||||
void runBackground(Background *a);
|
||||
void runOverlay(Overlay *a);
|
||||
void runMice(Mice *a);
|
||||
@ -545,6 +543,11 @@ public:
|
||||
Common::String findNextLevel(const Common::String &level) override;
|
||||
Common::String findNextLevel(const Transition *trans) override;
|
||||
|
||||
// Scenes
|
||||
void runMenu(Hotspots *hs, bool only_menu = false) override;
|
||||
bool hoverHotspot(Common::Point) override;
|
||||
|
||||
// Arcade
|
||||
void runBeforeArcade(ArcadeShooting *arc) override;
|
||||
void runAfterArcade(ArcadeShooting *arc) override;
|
||||
void pressedKey(const int keycode) override;
|
||||
@ -575,6 +578,8 @@ public:
|
||||
void saveProfile(const Common::String &name, int levelId);
|
||||
|
||||
private:
|
||||
void renderHighlights(Hotspots *hs);
|
||||
|
||||
void runMainMenu(Code *code);
|
||||
void runRetryMenu(Code *code);
|
||||
void runDifficultyMenu(Code *code);
|
||||
|
@ -4,8 +4,9 @@ MODULE_OBJS := \
|
||||
actions.o \
|
||||
arcade.o \
|
||||
boyz/arcade.o \
|
||||
boyz/hard.o \
|
||||
boyz/boyz.o \
|
||||
boyz/hard.o \
|
||||
boyz/scene.o \
|
||||
cursors.o \
|
||||
grammar_mis.o \
|
||||
grammar_arc.o \
|
||||
|
Loading…
x
Reference in New Issue
Block a user