[Scummvm-git-logs] scummvm master -> 022aa4b2f4c37b5bc5430f6c1893589a5cae6acb
mgerhardy
martin.gerhardy at gmail.com
Thu Nov 26 20:27:49 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
022aa4b2f4 TWINE: fixed blocky rendering
Commit: 022aa4b2f4c37b5bc5430f6c1893589a5cae6acb
https://github.com/scummvm/scummvm/commit/022aa4b2f4c37b5bc5430f6c1893589a5cae6acb
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-26T21:26:26+01:00
Commit Message:
TWINE: fixed blocky rendering
int64 was a typedef to float in the TwinEngine code
Changed paths:
engines/twine/movements.cpp
engines/twine/renderer.cpp
diff --git a/engines/twine/movements.cpp b/engines/twine/movements.cpp
index 2d4db4ae5b..58f49b206a 100644
--- a/engines/twine/movements.cpp
+++ b/engines/twine/movements.cpp
@@ -77,7 +77,7 @@ void Movements::setActorAngle(int16 startAngle, int16 endAngle, int16 stepAngle,
int32 Movements::getAngleAndSetTargetActorDistance(int32 x1, int32 z1, int32 x2, int32 z2) {
/*
//Pythagoras
- targetActorDistance = (int32)sqrt((int64)(((z2 - z1)*(z2 - z1) + (x2 - x1)*(x2 - x1))));
+ targetActorDistance = (int32)sqrt((float)(((z2 - z1)*(z2 - z1) + (x2 - x1)*(x2 - x1))));
if (targetActorDistance == 0)
return 0;
@@ -85,7 +85,7 @@ int32 Movements::getAngleAndSetTargetActorDistance(int32 x1, int32 z1, int32 x2,
//given two points, we calculate its arc-tangent in radians
//Then we convert from radians (360 degrees == 2*M_PI) to a 10bit value (360 degrees == 1024) and invert the rotation direction
//Then we add an offset of 90 degrees (256) and limit it to the 10bit value range.
- return (256 + ((int32)floor((-1024 * atan2((int64)(z2-z1), (int32)(x2-x1))) / (2*M_PI)))) % 1024;
+ return (256 + ((int32)floor((-1024 * atan2((float)(z2-z1), (int32)(x2-x1))) / (2*M_PI)))) % 1024;
*/
int32 difZ = z2 - z1;
@@ -106,7 +106,7 @@ int32 Movements::getAngleAndSetTargetActorDistance(int32 x1, int32 z1, int32 x2,
flag = false;
}
- targetActorDistance = (int32)sqrt((int64)newX + (int64)newZ);
+ targetActorDistance = (int32)sqrt((float)(newX + newZ));
if (!targetActorDistance) {
return 0;
@@ -147,11 +147,11 @@ void Movements::rotateActor(int32 x, int32 z, int32 angle) {
}
int32 Movements::getDistance2D(int32 x1, int32 z1, int32 x2, int32 z2) {
- return (int32)sqrt(((int64)(x2 - x1) * (int64)(x2 - x1) + (int64)(z2 - z1) * (int64)(z2 - z1)));
+ return (int32)sqrt((float)((x2 - x1) * (x2 - x1) + (z2 - z1) * (z2 - z1)));
}
int32 Movements::getDistance3D(int32 x1, int32 y1, int32 z1, int32 x2, int32 y2, int32 z2) {
- return (int32)sqrt(((int64)(x2 - x1) * (int64)(x2 - x1) + (int64)(y2 - y1) * (int64)(y2 - y1) + (int64)(z2 - z1) * (int64)(z2 - z1)));
+ return (int32)sqrt((float)((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) + (z2 - z1) * (z2 - z1)));
}
void Movements::moveActor(int32 angleFrom, int32 angleTo, int32 speed, ActorMoveStruct *movePtr) { // ManualRealAngle
diff --git a/engines/twine/renderer.cpp b/engines/twine/renderer.cpp
index 5fb83269db..b5c35461d4 100644
--- a/engines/twine/renderer.cpp
+++ b/engines/twine/renderer.cpp
@@ -444,7 +444,7 @@ void Renderer::computePolygons(int16 polyRenderType, vertexData *vertices, int32
int16 cvalue;
int16 cdelta;
int16 ypos;
- int16 xpos;
+ float xpos;
if (direction * oldVertexX > direction * currentVertexX) { // if we are going up right
xpos = currentVertexX;
ypos = currentVertexY;
@@ -459,7 +459,7 @@ void Renderer::computePolygons(int16 polyRenderType, vertexData *vertices, int32
}
int16 *outPtr = &polyTab[ypos + (up ? SCREEN_HEIGHT : 0)]; // outPtr is the output ptr in the renderTab
- int64 slope = (int64)hsize / (int64)vsize;
+ float slope = (float)hsize / (float)vsize;
slope = up ? -slope : slope;
for (int32 i = 0; i < vsize + 2; i++) {
@@ -768,7 +768,7 @@ void Renderer::renderPolygons(int32 renderType, vertexData *vertices, int32 /*nu
ptr2++;
- //varf4 = (int64)((int32)varf2 - (int32)varf3);
+ //varf4 = (float)((int32)varf2 - (int32)varf3);
if (hsize == 0) {
if (start >= 0 && start < SCREEN_WIDTH) {
@@ -984,7 +984,7 @@ void Renderer::circleFill(int32 x, int32 y, int32 radius, int8 color) {
double width;
if (ABS(currentLine) != radius) {
- width = sin(acos((int64)currentLine / (int64)radius));
+ width = sin(acos((float)currentLine / (float)radius));
} else {
width = 0;
}
More information about the Scummvm-git-logs
mailing list