mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 05:38:56 +00:00
MM: MM1: Beginnings of interaction views
This commit is contained in:
parent
dba287e903
commit
a43af5fb86
@ -34,6 +34,7 @@
|
||||
#include "mm/mm1/views_enh/main_menu.h"
|
||||
#include "mm/mm1/views_enh/map_popup.h"
|
||||
#include "mm/mm1/views_enh/quick_ref.h"
|
||||
#include "mm/mm1/views_enh/interactions/statue.h"
|
||||
#include "mm/mm1/views_enh/locations/market.h"
|
||||
#include "mm/mm1/views_enh/locations/temple.h"
|
||||
#include "mm/mm1/views_enh/spells/cast_spell.h"
|
||||
@ -50,6 +51,7 @@ private:
|
||||
Views::Locations::Inn _inn;
|
||||
Views::Protect _protect;
|
||||
Views::Title _title;
|
||||
ViewsEnh::Interactions::Statue _statue;
|
||||
ViewsEnh::Locations::Market _market;
|
||||
ViewsEnh::Locations::Temple _temple;
|
||||
ViewsEnh::Spells::CastSpell _castSpell;
|
||||
|
81
engines/mm/mm1/views_enh/interactions/interaction.cpp
Normal file
81
engines/mm/mm1/views_enh/interactions/interaction.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
/* 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 "mm/mm1/views_enh/interactions/interaction.h"
|
||||
#include "mm/mm1/globals.h"
|
||||
#include "mm/mm1/mm1.h"
|
||||
#include "mm/mm1/sound.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace ViewsEnh {
|
||||
namespace Interactions {
|
||||
|
||||
Interaction::Interaction(const Common::String &name, int portrait) : ScrollView(name) {
|
||||
_bounds = Common::Rect(8, 8, 224, 140);
|
||||
_frame.load("frame.fac");
|
||||
_portrait.load(Common::String::format("face%02d.fac", portrait));
|
||||
}
|
||||
|
||||
bool Interaction::msgGame(const GameMessage &msg) {
|
||||
if (msg._name == "DISPLAY") {
|
||||
addView(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
return ScrollView::msgGame(msg);
|
||||
}
|
||||
|
||||
bool Interaction::msgUnfocus(const UnfocusMessage &msg) {
|
||||
ScrollView::msgUnfocus(msg);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Interaction::draw() {
|
||||
ScrollView::draw();
|
||||
|
||||
Graphics::ManagedSurface s = getSurface();
|
||||
_frame.draw(&s, 0, Common::Point(16, 16));
|
||||
_portrait.draw(&s, _portraitFrameNum, Common::Point(23, 22));
|
||||
}
|
||||
|
||||
bool Interaction::tick() {
|
||||
if (_animated && ++_tickCtr >= 10) {
|
||||
_tickCtr = 0;
|
||||
_portraitFrameNum = g_engine->getRandomNumber(3);
|
||||
redraw();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Interaction::leave() {
|
||||
if (g_events->focusedView() == this)
|
||||
close();
|
||||
|
||||
g_maps->turnAround();
|
||||
g_events->redraw();
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace ViewsEnh
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
75
engines/mm/mm1/views_enh/interactions/interaction.h
Normal file
75
engines/mm/mm1/views_enh/interactions/interaction.h
Normal file
@ -0,0 +1,75 @@
|
||||
/* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_ENH_INTERACTIONS_INTERACTION_H
|
||||
#define MM1_VIEWS_ENH_INTERACTIONS_INTERACTION_H
|
||||
|
||||
#include "mm/mm1/views_enh/scroll_view.h"
|
||||
#include "mm/shared/xeen/sprites.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace ViewsEnh {
|
||||
namespace Interactions {
|
||||
|
||||
class Interaction : public ScrollView {
|
||||
private:
|
||||
Shared::Xeen::SpriteResource _frame;
|
||||
Shared::Xeen::SpriteResource _portrait;
|
||||
int _tickCtr = 0;
|
||||
int _portraitFrameNum = 0;
|
||||
protected:
|
||||
bool _animated = true;
|
||||
public:
|
||||
Interaction(const Common::String &name, int portrait);
|
||||
|
||||
/**
|
||||
* Handles game messages
|
||||
*/
|
||||
bool msgGame(const GameMessage &msg) override;
|
||||
|
||||
/**
|
||||
* Unfocuses the view
|
||||
*/
|
||||
bool msgUnfocus(const UnfocusMessage &msg) override;
|
||||
|
||||
/**
|
||||
* Draw the location
|
||||
*/
|
||||
void draw() override;
|
||||
|
||||
/**
|
||||
* Tick handler
|
||||
*/
|
||||
bool tick() override;
|
||||
|
||||
/**
|
||||
* Leave the location, turning around
|
||||
*/
|
||||
void leave();
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace ViewsEnh
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
46
engines/mm/mm1/views_enh/interactions/statue.cpp
Normal file
46
engines/mm/mm1/views_enh/interactions/statue.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
/* 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 "mm/mm1/views_enh/interactions/statue.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace ViewsEnh {
|
||||
namespace Interactions {
|
||||
|
||||
Statue::Statue() : Interaction("Statue", 1) {
|
||||
}
|
||||
|
||||
bool Statue::msgGame(const GameMessage &msg) {
|
||||
if (msg._name == "STATUE") {
|
||||
_topLine = 0;
|
||||
_statueNum = msg._value;
|
||||
addView(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace ViewsEnh
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
50
engines/mm/mm1/views_enh/interactions/statue.h
Normal file
50
engines/mm/mm1/views_enh/interactions/statue.h
Normal file
@ -0,0 +1,50 @@
|
||||
/* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MM1_VIEWS_ENH_INTERACTIONS_STATUE_H
|
||||
#define MM1_VIEWS_ENH_INTERACTIONS_STATUE_H
|
||||
|
||||
#include "mm/mm1/views_enh/interactions/interaction.h"
|
||||
|
||||
namespace MM {
|
||||
namespace MM1 {
|
||||
namespace ViewsEnh {
|
||||
namespace Interactions {
|
||||
|
||||
class Statue : public Interaction {
|
||||
private:
|
||||
int _statueNum = 0;
|
||||
int _topLine = 0;
|
||||
public:
|
||||
Statue();
|
||||
|
||||
/**
|
||||
* Handles game message
|
||||
*/
|
||||
bool msgGame(const GameMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Interactions
|
||||
} // namespace ViewsEnh
|
||||
} // namespace MM1
|
||||
} // namespace MM
|
||||
|
||||
#endif
|
@ -142,6 +142,8 @@ MODULE_OBJS += \
|
||||
mm1/views_enh/scroll_text.o \
|
||||
mm1/views_enh/scroll_view.o \
|
||||
mm1/views_enh/text_view.o \
|
||||
mm1/views_enh/interactions/interaction.o \
|
||||
mm1/views_enh/interactions/statue.o \
|
||||
mm1/views_enh/locations/location.o \
|
||||
mm1/views_enh/locations/market.o \
|
||||
mm1/views_enh/locations/temple.o \
|
||||
|
Loading…
Reference in New Issue
Block a user