mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-26 12:48:16 +00:00
STARTREK: Fixes to drawR3Shape; red planet renders
This commit is contained in:
parent
552b88cbd5
commit
944370c349
@ -325,13 +325,13 @@ void StarTrekEngine::drawR3Shape(R3 *r3) {
|
||||
int16 index1 = i;
|
||||
int16 index2 = (i + 1) & 3;
|
||||
|
||||
if (thing[index1 + 1] > thing[index2 + 1]) {
|
||||
if (thing[index1 * 2 + 1] > thing[index2 * 2 + 1]) {
|
||||
index1 = index2;
|
||||
index2 = i;
|
||||
}
|
||||
|
||||
int16 top = ceil(thing[index1 + 1]);
|
||||
int16 bottom = floor(thing[index2 + 1]);
|
||||
int16 top = ceil(thing[index1 * 2 + 1]);
|
||||
int16 bottom = floor(thing[index2 * 2 + 1]);
|
||||
|
||||
if (top > bottom)
|
||||
continue;
|
||||
@ -350,29 +350,29 @@ void StarTrekEngine::drawR3Shape(R3 *r3) {
|
||||
shpImageBottom = bottom;
|
||||
|
||||
double dbl3f4;
|
||||
if (thing[index2 + 1] == thing[index1 + 1])
|
||||
if (thing[index2 * 2 + 1] == thing[index1 * 2 + 1])
|
||||
dbl3f4 = 0.0;
|
||||
else
|
||||
dbl3f4 = (thing[index2] - thing[index1]) / (thing[index2 + 1] - thing[index1 + 1]);
|
||||
dbl3f4 = (thing[index2 * 2] - thing[index1 * 2]) / (thing[index2 * 2 + 1] - thing[index1 * 2 + 1]);
|
||||
|
||||
int32 var3ec = (int32)(0x10000 * dbl3f4);
|
||||
int32 var3e8 = (int32)(((top - thing[index1 + 1]) * dbl3f4 + thing[index1]) * 0x10000);
|
||||
int32 boundDiff = (int32)(0x10000 * dbl3f4); // var3ec
|
||||
int32 boundBase = (int32)(((top - thing[index1 * 2 + 1]) * dbl3f4 + thing[index1 * 2]) * 0x10000); // var3e8
|
||||
|
||||
for (int y = top; y <= bottom; y++) {
|
||||
int16 var3f6 = var3e8 >> 16;
|
||||
int16 var3f8 = (var3e8 + 0xffff) >> 16;
|
||||
int16 rightBound = boundBase >> 16; // var3f6
|
||||
int16 leftBound = (boundBase + 0xffff) >> 16; // var3f8
|
||||
|
||||
if (var3f8 < _starfieldRect.left)
|
||||
var3f8 = _starfieldRect.left;
|
||||
if (var3f8 < leftBounds[y])
|
||||
leftBounds[y] = var3f8;
|
||||
if (leftBound < _starfieldRect.left)
|
||||
leftBound = _starfieldRect.left;
|
||||
if (leftBound < leftBounds[y])
|
||||
leftBounds[y] = leftBound;
|
||||
|
||||
if (var3f6 > _starfieldRect.right - 1)
|
||||
var3f6 = _starfieldRect.right - 1;
|
||||
if (var3f6 > rightBounds[y])
|
||||
rightBounds[y] = var3f6;
|
||||
if (rightBound > _starfieldRect.right - 1)
|
||||
rightBound = _starfieldRect.right - 1;
|
||||
if (rightBound > rightBounds[y])
|
||||
rightBounds[y] = rightBound;
|
||||
|
||||
var3e8 += var3ec;
|
||||
boundBase += boundDiff;
|
||||
}
|
||||
}
|
||||
|
||||
@ -389,7 +389,6 @@ void StarTrekEngine::drawR3Shape(R3 *r3) {
|
||||
break;
|
||||
}
|
||||
|
||||
debug("Top: %d, Bot: %d", shpImageTop, shpImageBottom);
|
||||
if (shpImageTop <= shpImageBottom) {
|
||||
bool var3fa = false;
|
||||
if (r3->field1e == 2) {
|
||||
@ -406,8 +405,10 @@ void StarTrekEngine::drawR3Shape(R3 *r3) {
|
||||
}
|
||||
}
|
||||
|
||||
// Amount added to X/Y positions after each pixel is drawn
|
||||
int16 xDiff = (int16)(dbl60 * 256);
|
||||
int16 yDiff = (int16)(dbl58 * 256);
|
||||
|
||||
int16 var3f2 = (int16)(dbl50 * 256);
|
||||
int16 var3f4 = (int16)(dbl48 * 256);
|
||||
|
||||
@ -447,6 +448,7 @@ void StarTrekEngine::drawR3Shape(R3 *r3) {
|
||||
for (int y = shpImageTop; y <= shpImageBottom; y++) {
|
||||
int16 leftBound = leftBounds[y];
|
||||
int16 rowWidth = rightBounds[y] - leftBound;
|
||||
|
||||
int16 srcX = leftBound * xDiff + var3f6;
|
||||
int16 srcY = leftBound * yDiff + var3f8;
|
||||
var3f6 += var3f2;
|
||||
@ -458,8 +460,6 @@ void StarTrekEngine::drawR3Shape(R3 *r3) {
|
||||
if (rowWidth == 0)
|
||||
continue;
|
||||
|
||||
debug("Width: %d", rowWidth);
|
||||
|
||||
if (var3fa) {
|
||||
srcX += 0x80;
|
||||
srcY += 0x80;
|
||||
@ -473,7 +473,7 @@ void StarTrekEngine::drawR3Shape(R3 *r3) {
|
||||
cx += xDiff;
|
||||
bx += yDiff;
|
||||
if (b == 0)
|
||||
*(di++) = 8; // FIXME: shouldn't assign anything, fix after done testing
|
||||
di++;
|
||||
else
|
||||
*(di++) = b;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ public:
|
||||
*this = *this * m2;
|
||||
}
|
||||
|
||||
TMatrix<T> invert() {
|
||||
TMatrix<T> invert() const {
|
||||
TMatrix<T> ret;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
|
@ -127,7 +127,7 @@ Common::Error StarTrekEngine::run() {
|
||||
initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, &format);
|
||||
initializeEventsAndMouse();
|
||||
|
||||
bool shouldPlayIntro = false;
|
||||
bool shouldPlayIntro = true;
|
||||
bool loadedSave = false;
|
||||
|
||||
if (ConfMan.hasKey("save_slot")) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user