From bf090394a8ae2fd0c52a2020bff960ef7807a470 Mon Sep 17 00:00:00 2001 From: escape209 Date: Wed, 28 Aug 2024 16:27:49 +0100 Subject: [PATCH] Couple fixes + match UVAModelInfo::SetColor (#357) --- src/SB/Game/zNPCHazard.cpp | 24 +++++++++++++++++++++--- src/SB/Game/zNPCHazard.h | 8 ++++---- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/SB/Game/zNPCHazard.cpp b/src/SB/Game/zNPCHazard.cpp index c3eb05e7..f87fee36 100644 --- a/src/SB/Game/zNPCHazard.cpp +++ b/src/SB/Game/zNPCHazard.cpp @@ -296,17 +296,17 @@ S32 UVAModelInfo::GetUV(RwTexCoords*& coords, S32& numVertices, RpAtomic* model) #endif -RwV3d* NPCHazard::At() +RwV3d* NPCHazard::At() const { return &this->mdl_hazard->Mat->at; } -RwV3d* NPCHazard::Right() +RwV3d* NPCHazard::Right() const { return &this->mdl_hazard->Mat->right; } -RwV3d* NPCHazard::Up() +RwV3d* NPCHazard::Up() const { return &this->mdl_hazard->Mat->up; } @@ -324,3 +324,21 @@ F32 xVec2Length2(const xVec2* v) { return xVec2Dot(v, v); } + +void UVAModelInfo::SetColor(iColor_tag color) +{ + RpGeometry* geo = model->geometry; + + RwRGBA col; + col.red = color.r; + col.green = color.g; + col.blue = color.b; + col.alpha = color.a; + + int numMats = model->geometry->matList.numMaterials; + + for (int i = 0; i < numMats; i++) + { + geo->matList.materials[i]->color = col; + } +} \ No newline at end of file diff --git a/src/SB/Game/zNPCHazard.h b/src/SB/Game/zNPCHazard.h index 5fd1d72a..bb632898 100644 --- a/src/SB/Game/zNPCHazard.h +++ b/src/SB/Game/zNPCHazard.h @@ -23,6 +23,7 @@ struct UVAModelInfo void Clear(); void UVVelSet(float, float); S32 GetUV(RwTexCoords*& coords, S32& numVertices, RpAtomic* model); + void SetColor(iColor_tag); }; struct NPCHazard; @@ -137,7 +138,6 @@ struct HAZTarTar : HAZCollide F32 spd_lob; xVec3 pos_tgt; U32 streakID; - U32 pad; // This is needed to ensure the correct size! }; struct HAZCatProd : HAZBall @@ -231,9 +231,9 @@ struct NPCHazard void ColResp_Default(xSweptSphere* swdata, F32 tym_inFuture); void CollideResponse(xSweptSphere* swdata, F32 tym_inFuture); void Upd_Patriot(F32); - RwV3d* At(); - RwV3d* Right(); - RwV3d* Up(); + RwV3d* At() const; + RwV3d* Right() const; + RwV3d* Up() const; void Discard(); };