mirror of
https://github.com/libretro/scummvm.git
synced 2025-05-13 17:46:22 +00:00
STARK: Fix actor direction placement on some scenes
This commit is contained in:
parent
417fb64e87
commit
951a69b674
@ -80,13 +80,13 @@ void Camera::onEnterLocation() {
|
||||
location->setScrollPosition(location->getScrollPosition());
|
||||
}
|
||||
|
||||
float Camera::getHorizontalAngle() const {
|
||||
Math::Angle Camera::getHorizontalAngle() const {
|
||||
Math::Angle lookDirectionAngle = Math::Vector3d::angle(_lookDirection, Math::Vector3d(1.0, 0.0, 0.0));
|
||||
Math::Vector3d cross = Math::Vector3d::crossProduct(_lookDirection, Math::Vector3d(1.0, 0.0, 0.0));
|
||||
if (cross.z() < 0) {
|
||||
return -lookDirectionAngle.getDegrees();
|
||||
return -lookDirectionAngle;
|
||||
} else {
|
||||
return lookDirectionAngle.getDegrees();
|
||||
return lookDirectionAngle;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "common/rect.h"
|
||||
#include "common/str.h"
|
||||
|
||||
#include "math/angle.h"
|
||||
#include "math/vector3d.h"
|
||||
#include "math/vector4d.h"
|
||||
|
||||
@ -59,7 +60,7 @@ public:
|
||||
void setClipPlanes(float near, float far);
|
||||
|
||||
/** Compute the angle between the X vector and the look at direction in the horizontal plane */
|
||||
float getHorizontalAngle() const;
|
||||
Math::Angle getHorizontalAngle() const;
|
||||
|
||||
protected:
|
||||
void readData(Formats::XRCReadStream *stream) override;
|
||||
|
@ -595,8 +595,8 @@ Command *Command::opItemLookDirection(Script *script, const ResourceReference &i
|
||||
|
||||
Current *current = StarkGlobal->getCurrent();
|
||||
Camera *camera = current->getCamera();
|
||||
float cameraAngle = camera->getHorizontalAngle();
|
||||
float targetAngle = abs(direction + cameraAngle) % 360;
|
||||
Math::Angle cameraAngle = camera->getHorizontalAngle();
|
||||
Math::Angle targetAngle = direction + cameraAngle;
|
||||
|
||||
Math::Matrix3 rot;
|
||||
rot.buildAroundZ(-targetAngle);
|
||||
@ -692,9 +692,9 @@ Command *Command::opItemPlaceDirection(const ResourceReference &itemRef, int32 d
|
||||
|
||||
Current *current = StarkGlobal->getCurrent();
|
||||
Camera *camera = current->getCamera();
|
||||
float cameraAngle = camera->getHorizontalAngle();
|
||||
Math::Angle cameraAngle = camera->getHorizontalAngle();
|
||||
|
||||
item->setDirection(abs(direction + cameraAngle) % 360);
|
||||
item->setDirection(direction + cameraAngle);
|
||||
|
||||
return nextCommand();
|
||||
}
|
||||
|
@ -599,8 +599,8 @@ Math::Vector3d FloorPositionedItem::getDirectionVector() const {
|
||||
return direction;
|
||||
}
|
||||
|
||||
void FloorPositionedItem::setDirection(float direction) {
|
||||
_direction3D = direction;
|
||||
void FloorPositionedItem::setDirection(const Math::Angle &direction) {
|
||||
_direction3D = direction.getDegrees(0.0);
|
||||
}
|
||||
|
||||
float FloorPositionedItem::getSortKey() const {
|
||||
|
@ -332,7 +332,7 @@ public:
|
||||
Math::Vector3d getDirectionVector() const;
|
||||
|
||||
/** Set the direction the item faces */
|
||||
void setDirection(float direction);
|
||||
void setDirection(const Math::Angle &direction);
|
||||
|
||||
/** Obtain the sort value for the item, used to compute the draw order */
|
||||
float getSortKey() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user