fracturehill 533f8aebf2 NANCY: Correctly implement map labels
The map label's position is now properly calculated instead of being hardcoded. Added the (closed) label that shows up when hovering a disabled location on the map.
2021-04-15 15:12:00 +03:00

98 lines
2.2 KiB
C++

/* 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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef NANCY_STATE_MAP_H
#define NANCY_STATE_MAP_H
#include "common/singleton.h"
#include "engines/nancy/state/state.h"
#include "engines/nancy/ui/viewport.h"
namespace Nancy {
class NancyEngine;
namespace UI {
class Button;
}
namespace State {
class Map : public State, public Common::Singleton<Map> {
friend class MapLabel;
friend class MapButton;
public:
enum State { kInit, kRun };
Map();
virtual ~Map();
// State API
virtual void process() override;
virtual void onStateExit() override;
private:
struct Location {
struct SceneChange {
uint16 sceneID = 0;
uint16 frameID = 0;
uint16 verticalOffset = 0;
};
Common::String description;
bool isActive = false;
Common::Rect hotspot;
Common::Array<SceneChange> scenes;
Common::Rect labelSrc;
Common::Rect labelDest;
};
void init();
void run();
void registerGraphics();
void setLabel(int labelID);
Nancy::UI::Viewport _viewport;
RenderObject _label;
RenderObject _closedLabel;
UI::Button *_button;
SoundDescription _sound;
State _state;
uint16 _mapID;
bool _mapButtonClicked;
int16 _pickedLocationID;
Common::Array<Location> _locations;
};
#define NancyMapState Nancy::State::Map::instance()
} // End of namespace State
} // End of namespace Nancy
#endif // NANCY_STATE_MAP_H