mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-27 05:32:45 +00:00
ULTIMA1: Implemented Create spell
This commit is contained in:
parent
88df29f4cd
commit
2d3c237857
@ -86,6 +86,14 @@ public:
|
||||
return _mapArea->getTileAt(pt, tile, includePlayer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a tile at a given position
|
||||
*/
|
||||
void setTileAt(const Point &pt, uint tileId) {
|
||||
assert(_mapArea);
|
||||
return _mapArea->setTileAt(pt, tileId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the viewport position
|
||||
*/
|
||||
|
@ -181,6 +181,10 @@ void MapBase::getTileAt(const Point &pt, MapTile *tile, bool includePlayer) {
|
||||
}
|
||||
}
|
||||
|
||||
void MapBase::setTileAt(const Point &pt, uint tileId) {
|
||||
_data[pt.y][pt.x] = tileId;
|
||||
}
|
||||
|
||||
void MapBase::update() {
|
||||
// Call the update method of each widget, to allow for things like npc movement, etc.
|
||||
for (uint idx = 0; idx < _widgets.size(); ++idx)
|
||||
|
@ -114,6 +114,7 @@ protected:
|
||||
uint _mapIndex; // Index of map within the group of same maps
|
||||
uint _mapStyle; // Map style category for towns & castles
|
||||
ViewportPosition _viewportPos; // Viewport position
|
||||
Common::Array<MapCellsRow> _data; // Data for the map
|
||||
protected:
|
||||
/**
|
||||
* Set the size of the map
|
||||
@ -133,7 +134,6 @@ public:
|
||||
Common::String _name; // Name of map, if applicable
|
||||
MapWidget *_playerWidget; // Current means of transport, even if on foot
|
||||
WidgetsArray _widgets; // Party, monsteres, transports, etc.
|
||||
Common::Array<MapCellsRow> _data; // Data for the map
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
@ -171,6 +171,11 @@ public:
|
||||
*/
|
||||
virtual void getTileAt(const Point &pt, MapTile *tile, bool includePlayer = true);
|
||||
|
||||
/**
|
||||
* Sets a tile at a given position
|
||||
*/
|
||||
virtual void setTileAt(const Point &pt, uint tileId);
|
||||
|
||||
/**
|
||||
* Resets the viewport when the viewport changes
|
||||
*/
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "ultima/ultima1/spells/create.h"
|
||||
#include "ultima/ultima1/game.h"
|
||||
#include "ultima/ultima1/core/resources.h"
|
||||
#include "ultima/ultima1/maps/map_tile.h"
|
||||
#include "ultima/ultima1/maps/map_dungeon.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
@ -32,7 +34,19 @@ Create::Create() : Spell(SPELL_CREATE) {
|
||||
}
|
||||
|
||||
void Create::dungeonCast(Maps::MapDungeon *map) {
|
||||
// TODO
|
||||
Point newPos;
|
||||
Maps::U1MapTile tile;
|
||||
|
||||
newPos = map->getPosition() + map->getDirectionDelta();
|
||||
map->getTileAt(newPos, &tile);
|
||||
|
||||
if (tile._isHallway && !tile._widget) {
|
||||
// Create beams on the tile in front of the player
|
||||
map->setTileAt(newPos, Maps::DTILE_BEAMS);
|
||||
} else {
|
||||
// Failed
|
||||
Spell::dungeonCast(map);
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Spells
|
||||
|
Loading…
x
Reference in New Issue
Block a user