Match and link CTweakAutoMapper. With a slight hack.

This commit is contained in:
Henrique Gemignani Passos Lima 2022-10-20 15:45:54 +03:00
parent 928ade0175
commit 1a83aa2aac
No known key found for this signature in database
GPG Key ID: E224F951761145F8
8 changed files with 205 additions and 9 deletions

View File

@ -3,8 +3,8 @@
.section .data
.balign 8
.global lbl_803DF438
lbl_803DF438:
.global __vt__16CTweakAutoMapper
__vt__16CTweakAutoMapper:
# ROM: 0x3DC438
.4byte 0
.4byte 0
@ -46,11 +46,11 @@ __ct__16CTweakAutoMapperFR12CInputStream:
/* 800B69D8 000B3938 93 A1 00 14 */ stw r29, 0x14(r1)
/* 800B69DC 000B393C 93 81 00 10 */ stw r28, 0x10(r1)
/* 800B69E0 000B3940 3C C0 80 3E */ lis r6, __vt__12ITweakObject@ha
/* 800B69E4 000B3944 3C A0 80 3E */ lis r5, lbl_803DF438@ha
/* 800B69E4 000B3944 3C A0 80 3E */ lis r5, __vt__16CTweakAutoMapper@ha
/* 800B69E8 000B3948 7C 7F 1B 78 */ mr r31, r3
/* 800B69EC 000B394C 7C 9C 23 78 */ mr r28, r4
/* 800B69F0 000B3950 38 66 9C C4 */ addi r3, r6, __vt__12ITweakObject@l
/* 800B69F4 000B3954 38 05 F4 38 */ addi r0, r5, lbl_803DF438@l
/* 800B69F4 000B3954 38 05 F4 38 */ addi r0, r5, __vt__16CTweakAutoMapper@l
/* 800B69F8 000B3958 90 7F 00 00 */ stw r3, 0(r31)
/* 800B69FC 000B395C 7F 83 E3 78 */ mr r3, r28
/* 800B6A00 000B3960 90 1F 00 00 */ stw r0, 0(r31)
@ -314,9 +314,9 @@ __dt__16CTweakAutoMapperFv:
/* 800B6DF0 000B3D50 93 E1 00 0C */ stw r31, 0xc(r1)
/* 800B6DF4 000B3D54 7C 7F 1B 79 */ or. r31, r3, r3
/* 800B6DF8 000B3D58 41 82 00 90 */ beq lbl_800B6E88
/* 800B6DFC 000B3D5C 3C 60 80 3E */ lis r3, lbl_803DF438@ha
/* 800B6DFC 000B3D5C 3C 60 80 3E */ lis r3, __vt__16CTweakAutoMapper@ha
/* 800B6E00 000B3D60 34 1F 01 00 */ addic. r0, r31, 0x100
/* 800B6E04 000B3D64 38 03 F4 38 */ addi r0, r3, lbl_803DF438@l
/* 800B6E04 000B3D64 38 03 F4 38 */ addi r0, r3, __vt__16CTweakAutoMapper@l
/* 800B6E08 000B3D68 90 1F 00 00 */ stw r0, 0(r31)
/* 800B6E0C 000B3D6C 41 82 00 58 */ beq lbl_800B6E64
/* 800B6E10 000B3D70 80 DF 01 00 */ lwz r6, 0x100(r31)

View File

@ -112,7 +112,7 @@ LIBS = [
"MetroidPrime/ScriptObjects/CScriptCameraWaypoint",
["MetroidPrime/CGameLight", True],
"MetroidPrime/Tweaks/CTweakTargeting",
"MetroidPrime/Tweaks/CTweakAutoMapper",
["MetroidPrime/Tweaks/CTweakAutoMapper", True],
["MetroidPrime/CParticleGenInfoGeneric", True],
["MetroidPrime/CParticleGenInfo", True],
"MetroidPrime/CParticleDatabase",

View File

@ -35,6 +35,10 @@ public:
}
void Get(float& r, float& g, float& b, float& a) const;
void Get(float& r, float& g, float& b) const;
void SetAlpha(float a) {
mA = CCast::ToUint8(a * 255.f);
}
static CColor Lerp(const CColor& a, const CColor& b, float t);
static uint Lerp(uint a, uint b, float t);
static CColor Modulate(const CColor& a, const CColor& b);

View File

@ -107,4 +107,15 @@ inline rstl::vector< T, Alloc >::vector(CInputStream& in, const Alloc& allocator
}
}
#include "rstl/reserved_vector.hpp"
template < typename T, int N >
inline rstl::reserved_vector< T, N >::reserved_vector(CInputStream& in)
: x0_count(in.ReadInt32()) {
for (int i = 0; i < x0_count; i++) {
construct(&data()[i], in.Get(TType< T >()));
}
}
#endif // _CINPUTSTREAM

View File

@ -0,0 +1,92 @@
#ifndef _CTWEAKAUTOMAPPER
#define _CTWEAKAUTOMAPPER
#include "MetroidPrime/Tweaks/ITweakObject.hpp"
#include "Kyoto/Graphics/CColor.hpp"
#include "Kyoto/TOneStatic.hpp"
#include "rstl/reserved_vector.hpp"
class CInputStream;
class CTweakAutoMapper;
class CTweakAutoMapper : public ITweakObject, public TOneStatic< CTweakAutoMapper > {
public:
~CTweakAutoMapper();
CTweakAutoMapper(CInputStream&);
private:
bool x4_24_showOneMiniMapArea : 1;
bool x4_25_ : 1;
bool x4_26_scaleMoveSpeedWithCamDist : 1;
float x8_camDist;
float xc_minCamDist;
float x10_maxCamDist;
float x14_minCamRotateX;
float x18_maxCamRotateX;
float x1c_camAngle;
float x20_;
CColor x24_automapperWidgetColor;
float x28_miniCamDist;
float x2c_miniCamXAngle;
float x30_miniCamAngle;
float x34_;
CColor x38_automapperWidgetMiniColor;
CColor x3c_surfColorVisited;
CColor x40_outlineColorVisited;
CColor x44_surfColorUnvisited;
CColor x48_outlineColorUnvisited;
CColor x4c_surfaceSelectColorVisited;
CColor x50_outlineSelectColorVisited;
float x54_mapSurfaceNormColorLinear;
float x58_mapSurfaceNormColorConstant;
float x5c_;
float x60_;
float x64_openMapScreenTime;
float x68_closeMapScreenTime;
float x6c_hintPanTime;
float x70_zoomUnitsPerFrame;
float x74_rotateDegPerFrame;
float x78_baseMapScreenCameraMoveSpeed;
CColor x7c_surfaceSelectColorUnvisited;
CColor x80_outlineSelectColorUnvisited;
float x84_miniAlphaSurfaceVisited;
float x88_alphaSurfaceVisited;
float x8c_miniAlphaOutlineVisited;
float x90_alphaOutlineVisited;
float x94_miniAlphaSurfaceUnvisited;
float x98_alphaSurfaceUnvisited;
float x9c_miniAlphaOutlineUnvisited;
float xa0_alphaOutlineUnvisited;
float xa4_doorCenterA;
float xa8_doorCenterB;
float xac_doorCenterC;
float xb0_;
float xb4_;
float xb8_miniMapViewportWidth;
float xbc_miniMapViewportHeight;
float xc0_miniMapCamDistScale;
float xc4_mapPlaneScaleX;
float xc8_mapPlaneScaleZ;
bool xcc_;
float xd0_universeCamDist;
float xd4_minUniverseCamDist;
float xd8_maxUniverseCamDist;
float xdc_switchToFromUniverseTime;
float xe0_camPanUnitsPerFrame;
float xe4_automapperScaleX;
float xe8_automapperScaleZ;
float xec_camVerticalOffset;
CColor xf0_miniMapSamusModColor;
CColor xf4_areaFlashPulseColor;
CColor xf8_;
CColor xfc_;
rstl::reserved_vector< CColor, 5 > x100_doorColors;
CColor x118_doorBorderColor;
CColor x11c_openDoorColor;
};
CHECK_SIZEOF(CTweakAutoMapper, 0x120)
extern CTweakAutoMapper* gpTweakAutoMapper;
#endif // _CTWEAKAUTOMAPPER

View File

@ -6,6 +6,8 @@
#include "rstl/construct.hpp"
#include "rstl/pointer_iterator.hpp"
class CInputStream;
namespace rstl {
template < typename T, int N >
class reserved_vector {
@ -24,10 +26,12 @@ public:
inline const_iterator end() const { return const_iterator(data() + x0_count); }
reserved_vector() : x0_count(0) {}
reserved_vector(const T& value) : x0_count(N) { uninitialized_fill_n(data(), N, value); }
explicit reserved_vector(const T& value) : x0_count(N) { uninitialized_fill_n(data(), N, value); }
reserved_vector(const reserved_vector& other) : x0_count(other.x0_count) {
uninitialized_copy_n(other.data(), x0_count, data());
}
reserved_vector(CInputStream& in);
reserved_vector& operator=(const reserved_vector& other) {
if (this != &other) {
clear();

View File

@ -79,7 +79,7 @@ METROIDPRIME :=\
$(BUILD_DIR)/asm/MetroidPrime/ScriptObjects/CScriptCameraWaypoint.o\
$(BUILD_DIR)/src/MetroidPrime/CGameLight.o\
$(BUILD_DIR)/asm/MetroidPrime/Tweaks/CTweakTargeting.o\
$(BUILD_DIR)/asm/MetroidPrime/Tweaks/CTweakAutoMapper.o\
$(BUILD_DIR)/src/MetroidPrime/Tweaks/CTweakAutoMapper.o\
$(BUILD_DIR)/src/MetroidPrime/CParticleGenInfoGeneric.o\
$(BUILD_DIR)/src/MetroidPrime/CParticleGenInfo.o\
$(BUILD_DIR)/asm/MetroidPrime/CParticleDatabase.o\

View File

@ -0,0 +1,85 @@
#include "MetroidPrime/Tweaks/CTweakAutoMapper.hpp"
#include "Kyoto/Streams/CInputStream.hpp"
// Used by CGameArea, CMapArea and CMapWorld.
// TODO: properly handle this
extern "C" int lbl_805A8EB0 = 0;
CTweakAutoMapper::~CTweakAutoMapper() {}
CTweakAutoMapper::CTweakAutoMapper(CInputStream& in)
: x4_24_showOneMiniMapArea(in.ReadBool())
, x4_25_(in.ReadBool())
, x4_26_scaleMoveSpeedWithCamDist(in.ReadBool())
, x8_camDist(in.ReadFloat())
, xc_minCamDist(in.ReadFloat())
, x10_maxCamDist(in.ReadFloat())
, x14_minCamRotateX(in.ReadFloat())
, x18_maxCamRotateX(in.ReadFloat())
, x1c_camAngle(in.ReadFloat())
, x20_(in.ReadFloat())
, x24_automapperWidgetColor(in)
, x28_miniCamDist(in.ReadFloat())
, x2c_miniCamXAngle(in.ReadFloat())
, x30_miniCamAngle(in.ReadFloat())
, x34_(in.ReadFloat())
, x38_automapperWidgetMiniColor(in)
, x3c_surfColorVisited(in)
, x40_outlineColorVisited(in)
, x44_surfColorUnvisited(in)
, x48_outlineColorUnvisited(in)
, x4c_surfaceSelectColorVisited(in)
, x50_outlineSelectColorVisited(in)
, x54_mapSurfaceNormColorLinear(in.ReadFloat())
, x58_mapSurfaceNormColorConstant(in.ReadFloat())
, x5c_(in.ReadFloat())
, x60_(0.4f)
, x64_openMapScreenTime(in.ReadFloat())
, x68_closeMapScreenTime(in.ReadFloat())
, x6c_hintPanTime(in.ReadFloat())
, x70_zoomUnitsPerFrame(in.ReadFloat())
, x74_rotateDegPerFrame(in.ReadFloat())
, x78_baseMapScreenCameraMoveSpeed(in.ReadFloat())
, x7c_surfaceSelectColorUnvisited(in)
, x80_outlineSelectColorUnvisited(in)
, x84_miniAlphaSurfaceVisited(in.ReadFloat())
, x88_alphaSurfaceVisited(in.ReadFloat())
, x8c_miniAlphaOutlineVisited(in.ReadFloat())
, x90_alphaOutlineVisited(in.ReadFloat())
, x94_miniAlphaSurfaceUnvisited(in.ReadFloat())
, x98_alphaSurfaceUnvisited(in.ReadFloat())
, x9c_miniAlphaOutlineUnvisited(in.ReadFloat())
, xa0_alphaOutlineUnvisited(in.ReadFloat())
, xa4_doorCenterA(in.ReadFloat())
, xa8_doorCenterB(in.ReadFloat())
, xac_doorCenterC(in.ReadFloat())
, xb0_(in.ReadFloat())
, xb4_(in.ReadFloat())
, xb8_miniMapViewportWidth(in.ReadFloat())
, xbc_miniMapViewportHeight(in.ReadFloat())
, xc0_miniMapCamDistScale(in.ReadFloat())
, xc4_mapPlaneScaleX(in.ReadFloat())
, xc8_mapPlaneScaleZ(in.ReadFloat())
, xcc_(in.ReadBool())
, xd0_universeCamDist(in.ReadFloat())
, xd4_minUniverseCamDist(in.ReadFloat())
, xd8_maxUniverseCamDist(in.ReadFloat())
, xdc_switchToFromUniverseTime(in.ReadFloat())
, xe0_camPanUnitsPerFrame(in.ReadFloat())
, xe4_automapperScaleX(in.ReadFloat())
, xe8_automapperScaleZ(in.ReadFloat())
, xec_camVerticalOffset(in.ReadFloat())
, xf0_miniMapSamusModColor(in)
, xf4_areaFlashPulseColor(in)
, xf8_(in)
, xfc_(in)
, x100_doorColors(in)
, x118_doorBorderColor(in)
, x11c_openDoorColor(in)
{
x3c_surfColorVisited.SetAlpha(1.0f);
x40_outlineColorVisited.SetAlpha(1.0f);
x44_surfColorUnvisited.SetAlpha(1.0f);
x48_outlineColorUnvisited.SetAlpha(1.0f);
}