mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-04 02:41:19 +00:00
adjusted coordinates for coc/coe for exteriors (place player in the middle of the cell instead of at the border)
This commit is contained in:
parent
5f84b680af
commit
db2b238328
@ -47,7 +47,7 @@ namespace MWScript
|
||||
if (const ESM::Cell *exterior = context.getWorld().getExterior (cell))
|
||||
{
|
||||
context.getWorld().indexToPosition (exterior->data.gridX, exterior->data.gridY,
|
||||
pos.pos[0], pos.pos[1]);
|
||||
pos.pos[0], pos.pos[1], true);
|
||||
context.getWorld().changeToExteriorCell (pos);
|
||||
}
|
||||
else
|
||||
@ -75,7 +75,7 @@ namespace MWScript
|
||||
|
||||
ESM::Position pos;
|
||||
|
||||
context.getWorld().indexToPosition (x, y, pos.pos[0], pos.pos[1]);
|
||||
context.getWorld().indexToPosition (x, y, pos.pos[0], pos.pos[1], true);
|
||||
pos.pos[2] = 0;
|
||||
|
||||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||
|
@ -770,12 +770,18 @@ namespace MWWorld
|
||||
// TODO cell change for non-player ref
|
||||
}
|
||||
|
||||
void World::indexToPosition (int cellX, int cellY, float &x, float &y) const
|
||||
void World::indexToPosition (int cellX, int cellY, float &x, float &y, bool centre) const
|
||||
{
|
||||
const int cellSize = 8192;
|
||||
|
||||
x = cellSize * cellX;
|
||||
y = cellSize * cellY;
|
||||
|
||||
if (centre)
|
||||
{
|
||||
x += cellSize/2;
|
||||
y += cellSize/2;
|
||||
}
|
||||
}
|
||||
|
||||
void World::positionToIndex (float x, float y, int &cellX, int &cellY) const
|
||||
|
@ -157,7 +157,7 @@ namespace MWWorld
|
||||
|
||||
void moveObject (Ptr ptr, float x, float y, float z);
|
||||
|
||||
void indexToPosition (int cellX, int cellY, float &x, float &y) const;
|
||||
void indexToPosition (int cellX, int cellY, float &x, float &y, bool centre = false) const;
|
||||
///< Convert cell numbers to position.
|
||||
|
||||
void positionToIndex (float x, float y, int &cellX, int &cellY) const;
|
||||
|
Loading…
Reference in New Issue
Block a user