mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
gSPInsertMatrix: fix insert fractional part if old value is negativ
s32 integer = static_cast<s32>(-2.5f) = -2 GetFloatMatrixElement(static_cast<s16>(integer), 0x44) = -1,9993286030 Fix: s32 integer = (-2.5f * 65535.0f) >> 16 = (163837) >> 16 = -3 GetFloatMatrixElement(static_cast<s16>(integer), 0x44) = -2,999008163576715
This commit is contained in:
parent
e0418c3c34
commit
a6adf6308d
|
@ -1593,13 +1593,13 @@ void gSPInsertMatrix( u32 where, u32 num )
|
||||||
if (where < 0x20) {
|
if (where < 0x20) {
|
||||||
// integer elements of the matrix to be changed
|
// integer elements of the matrix to be changed
|
||||||
const s16 integer = static_cast<s16>(pData[i ^ 1]);
|
const s16 integer = static_cast<s16>(pData[i ^ 1]);
|
||||||
const s32 fract = static_cast<s32>(gSP.matrix.combined[0][index + i] * 65536.0f);
|
const u16 fract = GetIntMatrixElement(gSP.matrix.combined[0][index + i]).second;
|
||||||
gSP.matrix.combined[0][index + i] = GetFloatMatrixElement(integer, static_cast<u16>(fract&0xFFFF));
|
gSP.matrix.combined[0][index + i] = GetFloatMatrixElement(integer, fract);
|
||||||
} else {
|
} else {
|
||||||
// fractional elements of the matrix to be changed
|
// fractional elements of the matrix to be changed
|
||||||
const s32 integer = static_cast<s32>(gSP.matrix.combined[0][index + i]);
|
const s16 integer = GetIntMatrixElement(gSP.matrix.combined[0][index + i]).first;
|
||||||
const u16 fract = pData[i ^ 1];
|
const u16 fract = pData[i ^ 1];
|
||||||
gSP.matrix.combined[0][index + i] = GetFloatMatrixElement(static_cast<s16>(integer), fract);
|
gSP.matrix.combined[0][index + i] = GetFloatMatrixElement(integer, fract);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user