fix Matrix4f-related warnings

This commit is contained in:
Alex Bates 2021-02-09 11:07:05 +00:00
parent c4102d350a
commit d46e65757d
5 changed files with 31 additions and 33 deletions

View File

@ -61,9 +61,7 @@ typedef struct Vec4f {
/* 0x0C */ f32 yaw;
} Vec4f; // size = 0x10
typedef struct Matrix4f {
/* 0x00 */ f32 mtx[4][4];
} Matrix4f; // size = 0x40
typedef f32 Matrix4f[4][4]; // size = 0x40
typedef struct Matrix4s {
/* 0x00 */ s16 whole[4][4];
@ -318,7 +316,7 @@ typedef struct Entity {
/* 0x54 */ Vec3f scale;
/* 0x60 */ Vec3f rotation;
/* 0x6C */ char unk_6C[4];
/* 0x70 */ struct Matrix4f* inverseTransformMatrix; /* world-to-local */
/* 0x70 */ Matrix4f* inverseTransformMatrix; /* world-to-local */
/* 0x74 */ char unk_74[60];
/* 0xB0 */ float effectiveSize;
/* 0xB4 */ char unk_B4[4];
@ -487,10 +485,10 @@ typedef struct Camera {
/* 0x098 */ char unk_98[8];
/* 0x0A0 */ Vp viewport;
/* 0x0B0 */ char unk_B0[0x24];
/* 0x0D4 */ struct Matrix4f perspectiveMatrix;
/* 0x114 */ struct Matrix4f viewMtxPlayer; /* centers on player */
/* 0x154 */ struct Matrix4f viewMtxLeading; /* leads player slightly */
/* 0x194 */ struct Matrix4f viewMtxShaking; /* used while ShakeCam is active */
/* 0x0D4 */ Matrix4f perspectiveMatrix;
/* 0x114 */ Matrix4f viewMtxPlayer; /* centers on player */
/* 0x154 */ Matrix4f viewMtxLeading; /* leads player slightly */
/* 0x194 */ Matrix4f viewMtxShaking; /* used while ShakeCam is active */
/* 0x1D4 */ char unk_1D4[48];
/* 0x204 */ struct Matrix4s* unkMatrix;
/* 0x208 */ char unk_208[572];
@ -715,7 +713,7 @@ typedef struct Model {
/* 0x10 */ s32* currentSpecialMatrix;
/* 0x14 */ char unk_14[4];
/* 0x18 */ struct Matrix4s specialMatrix;
/* 0x58 */ struct Matrix4f transformMatrix;
/* 0x58 */ Matrix4f transformMatrix;
/* 0x98 */ f32 center[3]; /* Created by retype action */
/* 0xA4 */ u8 texPannerID;
/* 0xA5 */ u8 specialDisplayListID;

View File

@ -5,11 +5,11 @@ void NOP_npc_callback(void) {
}
void mtx_ident_mirror_y(Matrix4f* mtx) {
guMtxIdentF(mtx);
mtx->mtx[0][0] = 1.0f;
mtx->mtx[1][1] = -1.0f;
mtx->mtx[2][2] = 1.0f;
mtx->mtx[3][3] = 1.0f;
guMtxIdentF(*mtx);
(*mtx)[0][0] = 1.0f;
(*mtx)[1][1] = -1.0f;
(*mtx)[2][2] = 1.0f;
(*mtx)[3][3] = 1.0f;
}
INCLUDE_ASM(s32, "code_13870_len_6980", clear_npcs);

View File

@ -21,12 +21,12 @@ INCLUDE_ASM(s32, "code_b72b0_len_15ed0", update_entity_rendercmd);
INCLUDE_ASM(s32, "code_b72b0_len_15ed0", step_entity_rendercmd);
void make_mtx_flipZ(Matrix4f* arg0) {
guMtxIdentF(arg0->mtx);
arg0->mtx[0][0] = 1.0f;
arg0->mtx[1][1] = 1.0f;
arg0->mtx[2][2] = -1.0f;
arg0->mtx[3][3] = 1.0f;
void make_mtx_flipZ(Matrix4f* mtx) {
guMtxIdentF(*mtx);
(*mtx)[0][0] = 1.0f;
(*mtx)[1][1] = 1.0f;
(*mtx)[2][2] = -1.0f;
(*mtx)[3][3] = 1.0f;
}
INCLUDE_ASM(s32, "code_b72b0_len_15ed0", appendGfx_entity_model);

View File

@ -2,6 +2,6 @@
#include "map.h"
ApiStatus N(GetNpcUnsafeOwner2)(ScriptInstance* script, s32 isInitialCall) {
get_npc_unsafe(script->owner2.npc);
get_npc_unsafe(script->owner2.npcID);
return ApiStatus_BLOCK;
}

View File

@ -2,10 +2,10 @@
#include "map.h"
void N(SomeMatrixOperation)(Matrix4f* mtx, f32 arg1, f32 arg2, f32 arg3) {
guMtxIdentF(mtx);
mtx->mtx[1][0] = arg1 * arg2;
mtx->mtx[1][1] = 1.0f;
mtx->mtx[1][2] = arg1 * arg3;
guMtxIdentF(*mtx);
(*mtx)[1][0] = arg1 * arg2;
(*mtx)[1][1] = 1.0f;
(*mtx)[1][2] = arg1 * arg3;
}
ApiStatus N(SomeMatrixOperation2)(ScriptInstance* script, s32 isInitialCall) {
@ -19,19 +19,19 @@ ApiStatus N(SomeMatrixOperation2)(ScriptInstance* script, s32 isInitialCall) {
Matrix4f mtx;
if (!(model->flags & 0x400)) {
guTranslateF(&model->transformMatrix, 0.0f, temp_f22, 0.0f);
guTranslateF(model->transformMatrix, 0.0f, temp_f22, 0.0f);
N(SomeMatrixOperation)(&mtx, temp_f28, temp_f26, temp_f24);
guMtxCatF(&mtx, &model->transformMatrix, &model->transformMatrix);
guMtxCatF(mtx, model->transformMatrix, model->transformMatrix);
guTranslateF(&mtx, 0.0f, -temp_f22, 0.0f);
guMtxCatF(&mtx, &model->transformMatrix, &model->transformMatrix);
guMtxCatF(mtx, model->transformMatrix, model->transformMatrix);
model->flags |= 0x1400;
} else {
guTranslateF(&mtx, 0.0f, temp_f22, 0.0f);
guMtxCatF(&mtx, &model->transformMatrix, &model->transformMatrix);
guTranslateF(mtx, 0.0f, temp_f22, 0.0f);
guMtxCatF(mtx, model->transformMatrix, model->transformMatrix);
N(SomeMatrixOperation)(&mtx, temp_f28, temp_f26, temp_f24);
guMtxCatF(&mtx, &model->transformMatrix, &model->transformMatrix);
guTranslateF(&mtx, 0.0f, -temp_f22, 0.0f);
guMtxCatF(&mtx, &model->transformMatrix, &model->transformMatrix);
guMtxCatF(mtx, model->transformMatrix, model->transformMatrix);
guTranslateF(mtx, 0.0f, -temp_f22, 0.0f);
guMtxCatF(mtx, model->transformMatrix, model->transformMatrix);
}
return ApiStatus_DONE2;