You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.1 KiB
33 lines
1.1 KiB
#include "map.h"
|
|
#include "game.h"
|
|
|
|
void Map::draw(int x, int y)
|
|
{
|
|
Position playerPos = g_game.getPlayer()->getPosition();
|
|
for(int ix = 0; ix < 19; ++ix) {
|
|
for(int iy = 0; iy < 15; ++iy) {
|
|
if(playerPos.getZ() >= 7) {
|
|
for(int iz = 7; iz > 0; --iz) {
|
|
m_map[ix][iy][iz].draw(x+ix, y+iy, iz);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void Map::addThing(Thing *thing, const Position& pos)
|
|
{
|
|
Position playerPos = g_game.getPlayer()->getPosition();
|
|
Position relativePos = Position(pos.getX() - playerPos.getX() + 8, pos.getY() - playerPos.getY() + 6, pos.getZ());
|
|
|
|
if(relativePos.getX() >= 18)
|
|
logDebug("relativePos is invalid.");
|
|
if(relativePos.getY() >= 14)
|
|
logDebug("relativePos is invalid.");
|
|
if(relativePos.getZ() >= 15)
|
|
logDebug("relativePos is invalid.");
|
|
|
|
//logDebug("x: ", (int)relativePos.getX(), " y: ", (int)relativePos.getY(), " z: ", (int)relativePos.getZ());
|
|
m_map[relativePos.getX()][relativePos.getY()][relativePos.getZ()].addThing(thing);
|
|
}
|