mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-22 20:21:06 +00:00
TWINE: fixed game loop in Holomap::drawHolomapTrajectory
This commit is contained in:
parent
37bbfeb6ee
commit
5ae5a557b8
@ -270,13 +270,20 @@ void Holomap::drawHolomapText(int32 centerx, int32 top, const char *title) {
|
||||
_engine->_text->drawText(x, y, title);
|
||||
}
|
||||
|
||||
void Holomap::renderHolomapModel(const BodyData &bodyData, int32 x, int32 y, int32 zPos) {
|
||||
void Holomap::renderHolomapPointModel(const Location &location, int32 x, int32 y) {
|
||||
_engine->_renderer->setBaseRotation(x, y, 0);
|
||||
_engine->_renderer->getBaseRotationPosition(0, 0, zPos + 1000);
|
||||
_engine->_renderer->getBaseRotationPosition(_engine->_renderer->_destPos.x, _engine->_renderer->_destPos.y, _engine->_renderer->_destPos.z);
|
||||
_engine->_renderer->getBaseRotationPosition(0, 0, 1000);
|
||||
const IVec3 destPos = _engine->_renderer->_destPos;
|
||||
_engine->_renderer->setBaseTranslation(0, 0, 0);
|
||||
_engine->_renderer->setBaseRotation(location.angle);
|
||||
_engine->_renderer->updateCameraAnglePositions(5300);
|
||||
// why is this needed? _engine->_renderer->_baseTransPos = _engine->_renderer->_destPos;
|
||||
_engine->_renderer->getBaseRotationPosition(destPos);
|
||||
_engine->_interface->resetClip();
|
||||
Common::Rect dummy;
|
||||
_engine->_renderer->renderIsoModel(_engine->_renderer->_destPos.x, _engine->_renderer->_destPos.y, _engine->_renderer->_destPos.z, x, y, ANGLE_0, bodyData, dummy);
|
||||
_engine->_renderer->renderIsoModel(destPos, x, y, ANGLE_0, _engine->_resources->holomapPointModelPtr, dummy);
|
||||
// debug(3, "renderHolomapPointModel(%i, %i): dirty(%i:%i:%i:%i)", x, y, dummy.left, dummy.top, dummy.right, dummy.bottom);
|
||||
// TODO: update the screen _engine->copyBlockPhys(_engine->rect());
|
||||
}
|
||||
|
||||
void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
|
||||
@ -301,7 +308,7 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
|
||||
renderHolomapSurfacePolygons();
|
||||
|
||||
const Location &loc = _locations[data->locationIdx];
|
||||
renderHolomapModel(_engine->_resources->holomapPointModelPtr, loc.angle.x, loc.angle.y, 0);
|
||||
renderHolomapPointModel(loc, loc.angle.x, loc.angle.y);
|
||||
|
||||
ActorMoveStruct move;
|
||||
AnimTimerDataStruct animTimerData;
|
||||
@ -340,6 +347,7 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
|
||||
_engine->_movements->setActorAngleSafe(ANGLE_0, -ANGLE_90, 500, &move);
|
||||
}
|
||||
|
||||
// render the vehicle you travel with
|
||||
if (_engine->_animations->setModelAnimation(frameNumber, animData, bodyData, &animTimerData)) {
|
||||
frameNumber++;
|
||||
if (frameNumber >= animData.getNumKeyframes()) {
|
||||
@ -357,6 +365,9 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
|
||||
_engine->_renderer->setCameraPosition(400, 240, 128, 1024, 1024);
|
||||
_engine->_renderer->setCameraAngle(0, 0, 0, data->pos.x, data->pos.y, data->pos.z, 5300);
|
||||
_engine->_renderer->setLightVector(data->pos.x, data->pos.y, 0);
|
||||
|
||||
// animate the path from point 1 to point 2 by rendering a point model on each position
|
||||
// on the global every 40 timeunits
|
||||
if (frameTime + 40 <= _engine->_lbaTime) {
|
||||
frameTime = _engine->_lbaTime;
|
||||
int32 modelX;
|
||||
@ -368,10 +379,10 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
|
||||
if (data->numAnimFrames < trajAnimFrameIdx) {
|
||||
break;
|
||||
}
|
||||
modelX = _locations[data->trajLocationIdx].angle.x;
|
||||
modelY = _locations[data->trajLocationIdx].angle.y;
|
||||
modelX = loc.angle.x;
|
||||
modelY = loc.angle.y;
|
||||
}
|
||||
renderHolomapModel(_engine->_resources->holomapPointModelPtr, modelX, modelY, 0);
|
||||
renderHolomapPointModel(loc, modelX, modelY);
|
||||
++trajAnimFrameIdx;
|
||||
}
|
||||
|
||||
@ -380,6 +391,7 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
|
||||
// TODO: this does a flip - which puts stuff onto the screen that shouldn't be there
|
||||
//_engine->_screens->fadeToPal(_engine->_screens->paletteRGBA);
|
||||
}
|
||||
++_engine->_lbaTime;
|
||||
}
|
||||
|
||||
_engine->_screens->clearScreen();
|
||||
|
@ -79,7 +79,7 @@ private:
|
||||
|
||||
void renderLocations(int xRot, int yRot, int zRot, bool lower);
|
||||
|
||||
void renderHolomapModel(const BodyData &bodyData, int32 x, int32 y, int32 zPos);
|
||||
void renderHolomapPointModel(const Location &location, int32 x, int32 y);
|
||||
|
||||
void prepareHolomapSurface();
|
||||
void prepareHolomapProjectedPositions();
|
||||
|
@ -205,11 +205,15 @@ void Renderer::setCameraAngle(int32 transPosX, int32 transPosY, int32 transPosZ,
|
||||
|
||||
_baseRotPos.z += param6;
|
||||
|
||||
getCameraAnglePositions(_baseRotPos.x, _baseRotPos.y, _baseRotPos.z);
|
||||
updateCameraAnglePositions();
|
||||
|
||||
_baseTransPos = _destPos;
|
||||
}
|
||||
|
||||
void Renderer::updateCameraAnglePositions(int zShift) {
|
||||
getCameraAnglePositions(_baseRotPos.x, _baseRotPos.y, _baseRotPos.z + zShift);
|
||||
}
|
||||
|
||||
IVec3 Renderer::getHolomapRotation(const int32 angleX, const int32 angleY, const int32 angleZ) const {
|
||||
int32 rotX = angleX * 2 + 1000;
|
||||
|
||||
|
@ -138,6 +138,9 @@ private:
|
||||
void circleFill(int32 x, int32 y, int32 radius, uint8 color);
|
||||
bool renderModelElements(int32 numOfPrimitives, const BodyData &bodyData, RenderCommand **renderCmds, ModelData *modelData, Common::Rect &modelRect);
|
||||
void getCameraAnglePositions(int32 x, int32 y, int32 z);
|
||||
inline void getCameraAnglePositions(const IVec3 &vec) {
|
||||
getCameraAnglePositions(vec.x, vec.y, vec.z);
|
||||
}
|
||||
void applyRotation(IMatrix3x3 *targetMatrix, const IMatrix3x3 *currentMatrix, const IVec3 &angleVec);
|
||||
void applyPointsRotation(const Common::Array<BodyVertex>& vertices, int32 firstPoint, int32 numPoints, I16Vec3 *destPoints, const IMatrix3x3 *rotationMatrix);
|
||||
void processRotatedElement(IMatrix3x3 *targetMatrix, const Common::Array<BodyVertex>& vertices, int32 rotX, int32 rotY, int32 rotZ, const BodyBone &bone, ModelData *modelData);
|
||||
@ -217,6 +220,10 @@ public:
|
||||
void setLightVector(int32 angleX, int32 angleY, int32 angleZ);
|
||||
void getBaseRotationPosition(int32 x, int32 y, int32 z);
|
||||
|
||||
inline void getBaseRotationPosition(const IVec3& vec) {
|
||||
getBaseRotationPosition(vec.x, vec.y, vec.z);
|
||||
}
|
||||
|
||||
void renderPolygons(const CmdRenderPolygon &polygon, Vertex *vertices, int vtop, int vbottom);
|
||||
|
||||
inline int32 projectPositionOnScreen(const IVec3& pos) {
|
||||
@ -231,12 +238,22 @@ public:
|
||||
void projectXYPositionOnScreen(int32 x,int32 y,int32 z);
|
||||
void setCameraPosition(int32 x, int32 y, int32 depthOffset, int32 scaleY, int32 scaleZ);
|
||||
void setCameraAngle(int32 transPosX, int32 transPosY, int32 transPosZ, int32 rotPosX, int32 rotPosY, int32 rotPosZ, int32 param6);
|
||||
void updateCameraAnglePositions(int zShift = 0);
|
||||
void setBaseTranslation(int32 x, int32 y, int32 z);
|
||||
void setBaseRotation(int32 x, int32 y, int32 z, bool transpose = false);
|
||||
|
||||
inline void setBaseRotation(const IVec3 &rot, bool transpose = false) {
|
||||
setBaseRotation(rot.x, rot.y, rot.z, transpose);
|
||||
}
|
||||
|
||||
void setOrthoProjection(int32 x, int32 y, int32 z);
|
||||
|
||||
bool renderIsoModel(int32 x, int32 y, int32 z, int32 angleX, int32 angleY, int32 angleZ, const BodyData &bodyData, Common::Rect &modelRect);
|
||||
|
||||
inline bool renderIsoModel(const IVec3 &pos, int32 angleX, int32 angleY, int32 angleZ, const BodyData &bodyData, Common::Rect &modelRect) {
|
||||
return renderIsoModel(pos.x, pos.y, pos.z, angleX, angleY, angleZ, bodyData, modelRect);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param angle A value of @c -1 means that the model is automatically rotated
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user